simpo-component-library 1.4.214 → 1.4.217

Sign up to get free protection for your applications and to get access to all the features.
@@ -3043,6 +3043,7 @@ class RestService {
3043
3043
  let subIndustryId = localStorage.getItem("subIndustryId");
3044
3044
  if (!subIndustryId)
3045
3045
  subIndustryId = "";
3046
+ // collectionId = "1ef5b924-66ad-68f5-b931-2bd654300b1f"
3046
3047
  return this.http.get(this.BASE_URL + `ecommerce/product/collection/id?collectionId=${collectionId || ''}&subIndustryId=${subIndustryId || ''}`).pipe(map((response) => response.data?.map((product) => new Product(product))));
3047
3048
  }
3048
3049
  getProductDetails(productId = null) {
@@ -3223,8 +3224,8 @@ class StorageServiceService {
3223
3224
  };
3224
3225
  request.onupgradeneeded = (event) => {
3225
3226
  this.database = event.target.result;
3226
- this.cartCollectionRef = this.database.createObjectStore(this.cartCollectionName, { keyPath: "itemId" });
3227
- this.favouriteCollectionRef = this.database.createObjectStore(this.favouriteCollectionName, { keyPath: "itemId" });
3227
+ this.cartCollectionRef = this.database.createObjectStore(this.cartCollectionName, { keyPath: "varientId" });
3228
+ this.favouriteCollectionRef = this.database.createObjectStore(this.favouriteCollectionName, { keyPath: "varientId" });
3228
3229
  this.userCollectionRef = this.database.createObjectStore(this.userCollectionName, { keyPath: "userId" });
3229
3230
  };
3230
3231
  }
@@ -3297,7 +3298,7 @@ class StorageServiceService {
3297
3298
  }
3298
3299
  addProductToCart(product) {
3299
3300
  const transaction = this.database.transaction(this.cartCollectionName, "readwrite");
3300
- const response = transaction.objectStore(this.cartCollectionName).get(product.itemId);
3301
+ const response = transaction.objectStore(this.cartCollectionName).get(product.varientId);
3301
3302
  response.onsuccess = (cartResponse) => {
3302
3303
  console.log("Cart Resppnse : ", cartResponse);
3303
3304
  if (cartResponse.target.result) { }
@@ -5115,9 +5116,9 @@ var BUSINESS_CONSTANTS;
5115
5116
  })(BUSINESS_CONSTANTS || (BUSINESS_CONSTANTS = {}));
5116
5117
 
5117
5118
  class OrderedItems {
5118
- constructor(json) {
5119
+ constructor(json, varientId) {
5119
5120
  this.itemId = json?.["itemId"] ?? "";
5120
- this.variantId = json?.["variantId"] ?? "";
5121
+ this.varientId = varientId ?? this.itemId;
5121
5122
  this.businessId = json?.["businessId"];
5122
5123
  this.itemName = json?.["name"];
5123
5124
  this.businessName = json?.["businessName"];
@@ -5157,20 +5158,20 @@ class CartService {
5157
5158
  return this.restService.addItemToDB(userWishlist);
5158
5159
  }
5159
5160
  removeItemFromWishlistPage(product, userWishlist) {
5160
- this.storageService.removeProductFromWishlist(product.itemId);
5161
+ this.storageService.removeProductFromWishlist(product.varientId);
5161
5162
  return this.restService.addItemToDB(userWishlist);
5162
5163
  }
5163
- addItemToCart(product) {
5164
+ addItemToCart(product, varientId) {
5164
5165
  if (product.quantity) {
5165
- const orderedItem = this.objectMapper(product);
5166
+ const orderedItem = this.objectMapper(product, varientId);
5166
5167
  return this.storageService.addProductToCart(orderedItem);
5167
5168
  }
5168
5169
  else {
5169
5170
  return this.removeItemFromCart(product);
5170
5171
  }
5171
5172
  }
5172
- addItemToFavourite(product) {
5173
- const orderedItem = this.objectMapper(product);
5173
+ addItemToFavourite(product, varientId) {
5174
+ const orderedItem = this.objectMapper(product, varientId);
5174
5175
  this.storageService.addProductToWishlist(orderedItem);
5175
5176
  }
5176
5177
  addItemToFavFromCart(product) {
@@ -5179,39 +5180,31 @@ class CartService {
5179
5180
  addOrderedItemToFavourite(orderedItem) {
5180
5181
  this.storageService.addProductToWishlist(orderedItem);
5181
5182
  }
5182
- removeItemFromFavourite(product) {
5183
- this.storageService.removeProductFromWishlist(product.itemId);
5183
+ removeItemFromFavourite(varientId) {
5184
+ this.storageService.removeProductFromWishlist(varientId);
5184
5185
  }
5185
5186
  removeItemFromCart(product) {
5186
- this.storageService.removeProductFromCart(product.itemId);
5187
+ this.storageService.removeProductFromCart(product.varientId);
5187
5188
  }
5188
5189
  getItemIdxJSON(id, type) {
5189
5190
  return this.storageService.getProductFromCart(id);
5190
5191
  }
5191
5192
  storeItemToDB(product, type) {
5192
5193
  if (type == "CART") {
5193
- const orderProduct = this.objectMapper(this.storageService.getProductFromCart(product.itemId));
5194
+ const orderProduct = this.objectMapper(this.storageService.getProductFromCart(product.varientId));
5194
5195
  if (orderProduct) {
5195
5196
  this.storageService.addProductToCart(orderProduct);
5196
5197
  }
5197
5198
  }
5198
5199
  else {
5199
- const orderProduct = this.objectMapper(this.storageService.getProductFromWishlist(product.itemId));
5200
+ const orderProduct = this.objectMapper(this.storageService.getProductFromWishlist(product.varientId));
5200
5201
  if (orderProduct) {
5201
5202
  this.storageService.addProductToWishlist(orderProduct);
5202
5203
  }
5203
5204
  }
5204
5205
  }
5205
- getItemByIdx(itemId, type) {
5206
- const productIdx = this.getItemIdxJSON(itemId, type);
5207
- // console.log(type, productIdx);
5208
- // const json = (type == "FAVOURITE") ? UserFavourites : UserCart;
5209
- // if (productIdx >= 0)
5210
- // return json.orderedItems[productIdx];
5211
- return null;
5212
- }
5213
- objectMapper(product) {
5214
- return new OrderedItems(product);
5206
+ objectMapper(product, variantId) {
5207
+ return new OrderedItems(product, variantId);
5215
5208
  }
5216
5209
  storeCartDataToServer(cart) {
5217
5210
  }
@@ -5310,10 +5303,11 @@ class FeaturedProductsComponent extends BaseSection {
5310
5303
  this.USER_CART?.forEach((item) => {
5311
5304
  if (item.itemId == product.itemId) {
5312
5305
  if (product.itemVariant.length > 0) {
5313
- const itemVarient = this.getItemVarient(product, product.varientId ?? "");
5314
- if (itemVarient) {
5315
- product.itemImages = itemVarient?.variantImages ?? [];
5306
+ const itemVarient = product.itemVariant[0];
5307
+ if (itemVarient.variantId == item.varientId) {
5308
+ product.itemImages = itemVarient.variantImages ?? [];
5316
5309
  product.price = itemVarient.itemVariantPrice;
5310
+ product.quantity = item.quantity;
5317
5311
  }
5318
5312
  }
5319
5313
  else {
@@ -5331,10 +5325,11 @@ class FeaturedProductsComponent extends BaseSection {
5331
5325
  this.USER_WISHLIST?.forEach((item) => {
5332
5326
  if (item.itemId == product.itemId) {
5333
5327
  if (product.itemVariant.length > 0) {
5334
- const itemVarient = this.getItemVarient(product, product.varientId ?? "");
5335
- if (itemVarient) {
5328
+ const itemVarient = product.itemVariant[0];
5329
+ if (itemVarient.variantId == item.varientId) {
5336
5330
  product.itemImages = itemVarient?.variantImages ?? [];
5337
5331
  product.price = itemVarient.itemVariantPrice;
5332
+ product.whislist = true;
5338
5333
  }
5339
5334
  }
5340
5335
  else {
@@ -5352,18 +5347,22 @@ class FeaturedProductsComponent extends BaseSection {
5352
5347
  this.messageService.add({ severity: 'warn', summary: 'Cart', detail: 'Item is not available as of now. We will notify you once available' });
5353
5348
  return;
5354
5349
  }
5355
- if (product.itemVariant?.length > 0) {
5356
- this.router.navigate(['/details']);
5350
+ if (!product?.quantity)
5351
+ product.quantity = 0;
5352
+ if (type == 'ADD') {
5353
+ product.quantity += 1;
5357
5354
  }
5358
5355
  else {
5359
- if (!product?.quantity)
5360
- product.quantity = 0;
5361
- if (type == 'ADD') {
5362
- product.quantity += 1;
5363
- }
5364
- else {
5365
- product.quantity -= 1;
5356
+ product.quantity -= 1;
5357
+ }
5358
+ if (product.itemVariant.length) {
5359
+ const itemVarient = this.getItemVarient(product, product.varientId);
5360
+ if (itemVarient) {
5361
+ itemVarient.quantity = product.quantity;
5362
+ this.cartService.addItemToCart(product, itemVarient.variantId);
5366
5363
  }
5364
+ }
5365
+ else {
5367
5366
  this.cartService.addItemToCart(product);
5368
5367
  }
5369
5368
  }
@@ -5371,26 +5370,32 @@ class FeaturedProductsComponent extends BaseSection {
5371
5370
  if (type == 'ADD') {
5372
5371
  product.whislist = true;
5373
5372
  this.messageService.add({ severity: 'success', summary: 'Wishlist', detail: 'Item added to your wishlist' });
5374
- this.cartService.addItemToFavourite(product);
5373
+ if (product.itemVariant.length) {
5374
+ const itemVarient = this.getItemVarient(product, product.varientId);
5375
+ if (itemVarient) {
5376
+ itemVarient.wishlist = true;
5377
+ this.cartService.addItemToFavourite(product, itemVarient.variantId);
5378
+ }
5379
+ }
5380
+ else {
5381
+ this.cartService.addItemToFavourite(product);
5382
+ }
5375
5383
  }
5376
5384
  else {
5377
5385
  product.whislist = false;
5378
5386
  this.messageService.add({ severity: 'info', summary: 'Wishlist', detail: 'Item remove from your wishlist' });
5379
- this.cartService.removeItemFromFavourite(product);
5387
+ this.cartService.removeItemFromFavourite(product.varientId);
5380
5388
  }
5381
5389
  // event.preventDefault();
5382
5390
  event.stopPropagation();
5383
5391
  }
5384
5392
  proceedToProductDesc(product) {
5385
- console.log("Called");
5386
5393
  if (this.isRelatedProduct) {
5387
- console.log("Change Detected");
5388
5394
  this.changeDetailProduct.emit(product);
5389
5395
  }
5390
5396
  else {
5391
- this.router.navigate([`details`], { queryParams: { id: product.itemId } });
5397
+ this.router.navigate([`details`], { queryParams: { id: product.itemId, varientId: product.varientId } });
5392
5398
  }
5393
- // this._eventService.redirectToPage.emit({redirectTo: '/details', data: {productId: productId}})
5394
5399
  }
5395
5400
  togglePreviewImage(product, idx) {
5396
5401
  const element = document.getElementById('preview_' + idx);
@@ -5411,13 +5416,38 @@ class FeaturedProductsComponent extends BaseSection {
5411
5416
  });
5412
5417
  return selectedVarient;
5413
5418
  }
5419
+ selectVarient(product, varient) {
5420
+ // nedd to change
5421
+ product.varientId = varient.variantId;
5422
+ product.itemImages = varient.variantImages;
5423
+ product.price = varient.itemVariantPrice;
5424
+ product.itemInventory = varient.itemInventory;
5425
+ product.quantity = this.getVarientQuantity(varient);
5426
+ product.whislist = this.isVarientPresentInWishtlist(varient);
5427
+ }
5414
5428
  get currency() {
5415
5429
  return BUSINESS_CONSTANTS.CURRENCY;
5416
5430
  }
5431
+ getVarientQuantity(productVarient) {
5432
+ let itemQuantity = 0;
5433
+ this.USER_CART?.forEach((item) => {
5434
+ if (productVarient.variantId == item.varientId)
5435
+ itemQuantity = item.quantity;
5436
+ });
5437
+ return itemQuantity;
5438
+ }
5439
+ isVarientPresentInWishtlist(productVarient) {
5440
+ let present = false;
5441
+ this.USER_WISHLIST?.forEach((item) => {
5442
+ if (productVarient.variantId == item.varientId)
5443
+ present = true;
5444
+ });
5445
+ return present;
5446
+ }
5417
5447
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: FeaturedProductsComponent, deps: [{ token: PLATFORM_ID }, { token: EventsService }, { token: RestService }, { token: i2$3.Router }, { token: CartService }, { token: i5$1.MatBottomSheet }, { token: StorageServiceService }, { token: i5.MessageService }], target: i0.ɵɵFactoryTarget.Component }); }
5418
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.4", type: FeaturedProductsComponent, isStandalone: true, selector: "simpo-featured-products", inputs: { data: "data", responseData: "responseData", index: "index", isRelatedProduct: "isRelatedProduct", edit: "edit", delete: "delete" }, outputs: { changeDetailProduct: "changeDetailProduct" }, host: { listeners: { "window: resize": "getScreenSize($event)" } }, providers: [MessageService], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "\r\n<p-toast position=\"bottom-right\" [baseZIndex]=\"10000000000\" [autoZIndex]=\"true\"></p-toast>\r\n<ng-container *ngIf=\"!isLoading\">\r\n <section class=\"container-fluid total-container\" [id]=\"data?.id\" simpoHover (hovering)=\"showEditTabs($event)\">\r\n <div [id]=\"data?.id\" class=\"display-block\" #mainContainer [simpoOverlay]=\"styles?.background\" [simpoBorder]=\"styles?.border\"\r\n [simpoAnimation]=\"styles?.animation\" [simpoLayout]=\"styles?.layout\">\r\n <div *ngFor=\"let item of content?.inputText\">\r\n <div [innerHTML]=\"item.value\" [ngClass]=\"item.label === 'Heading' ? 'heading-large lh-2 mb-3' : 'body-large'\">\r\n </div>\r\n </div>\r\n <img src=\"https://dev-beeos.s3.amazonaws.com/library-media/714126c1707378935732span.png\" alt=\"\"\r\n class=\"span-img mt-15\">\r\n <ng-container *ngIf=\"!filterLoading\">\r\n <div class=\"product-parent\" *ngIf=\"responseData && responseData?.length\">\r\n <div *ngFor=\"let product of responseData | slice:getSliceParameters()[0]:getSliceParameters()[1]; let idx = index\" class=\"product\"\r\n [style.width]=\"getProductWidth()\">\r\n <div *ngIf=\"!(product.itemImages?.length && product.itemImages[0].imgUrl)\" class=\"default-image\" (click)=\"proceedToProductDesc(product)\">\r\n <img src=\"https://i.postimg.cc/hPS2JpV0/no-image-available.jpg\" alt=\"\">\r\n <ng-container *ngTemplateOutlet=\"FavouriteTags; context: {data: product}\"></ng-container>\r\n </div>\r\n <div *ngIf=\"product.itemImages?.length && product.itemImages[0].imgUrl\" (click)=\"proceedToProductDesc(product)\" class=\"position-relative\">\r\n <div class=\"tags\">\r\n <div class=\"tag\" *ngIf=\"product.itemInventory && product.itemInventory.lowStockQuantity < 5\">Selling Fast</div>\r\n </div>\r\n <ng-container *ngTemplateOutlet=\"FavouriteTags; context: {data: product}\"></ng-container>\r\n <img [id]=\"'preview_'+idx\" [src]=\"product.itemImages[product.prviewIdx]?.imgUrl\" alt=\"\" class=\"product-img preivew\" (mouseenter)=\"togglePreviewImage(product, idx)\" (mouseleave)=\"product.prviewIdx = 0\">\r\n </div>\r\n <div class=\"mt-15\">\r\n <div class=\"product-name heading-large\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n {{product.name.length > 30 ? (product.name | slice: 0:27) + '...' : product.name }}</div>\r\n <div class=\"d-flex justify-content-between align-items-center\">\r\n <div class=\"price body-large d-flex\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n <div *ngIf=\"product.price.value != product.price.discountedPrice\" class=\"selling-price\">\r\n <span [innerHTML]='currency'></span>\r\n {{product.price.value}}\r\n </div>\r\n <div class=\"discounted-price\">\r\n <span [innerHTML]='currency'></span>\r\n {{product.price.discountedPrice}}\r\n </div>\r\n </div>\r\n <div *ngIf=\"content?.display?.showButton\" class=\"add-to-cart-btn\">\r\n <button simpoButtonDirective [id]=\"data?.id+(button?.id || '')\" [buttonStyle]=\"button?.styles\"\r\n [color]=\"styles?.background?.accentColor\" *ngIf=\"!product.quantity && !isItemOutOfStock(product)\" (click)=\"addItemToCart(product, 'ADD')\">{{button?.content?.label ?? 'Add to Cart'}}</button>\r\n <div class=\"quantity\" *ngIf=\"product.quantity\">\r\n <span (click)=\"addItemToCart(product, 'SUBSTRACT')\">-</span>\r\n <span>{{product.quantity}}</span>\r\n <span (click)=\"addItemToCart(product, 'ADD')\">+</span>\r\n </div>\r\n <button disabled class=\"out-of-stock\" *ngIf=\"isItemOutOfStock(product)\">Out Of Stock</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"action-btn\">\r\n <a [href]=\"data?.action?.buttons?.[1]?.content?.redirectionUrl\" simpoButtonDirective [id]=\"data?.id+(data?.action?.buttons?.[1]?.id || '')\" [buttonStyle]=\"data?.action?.buttons?.[1]?.styles\" [color]=\"styles?.background?.accentColor\" >{{data?.action?.buttons?.[1]?.content?.label }}</a>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div [ngClass]=\"{'hover_effect': edit}\" *ngIf=\"showEditors\">\r\n <simpo-hover-elements [data]=\"data\" [index]=\"index\" [editOptions]=\"edit\"></simpo-hover-elements>\r\n </div>\r\n <div *ngIf=\"showDelete\" [ngClass]=\"{'hover_effect': delete}\">\r\n <simpo-delete-hover-element [data]=\"data\" [index]=\"index\"></simpo-delete-hover-element>\r\n </div>\r\n\r\n </section>\r\n</ng-container>\r\n<ng-template #FavouriteTags let-product=\"data\">\r\n <mat-icon class=\"fav-icon\" [style.color]=\"data?.styles?.background?.accentColor\" (click)=\"toggleItemToFav($event, product, 'ADD')\" *ngIf=\"!product.whislist\">favorite_border</mat-icon>\r\n <mat-icon class=\"fav-icon\" [style.color]=\"data?.styles?.background?.accentColor\" (click)=\"toggleItemToFav($event, product, 'REMOVE')\" *ngIf=\"product.whislist\">favorite</mat-icon>\r\n</ng-template>\r\n<ngx-skeleton-loader *ngIf=\"isLoading || filterLoading\" count=\"1\" appearance=\"circle\" [theme]=\"{\r\n width: '100%',\r\n height: '40vh',\r\n 'border-radius': '10px',\r\n 'position': 'relative',\r\n 'right': '5px'\r\n}\">\r\n</ngx-skeleton-loader>\r\n", styles: [".product-parent{display:flex;flex-wrap:wrap;margin-top:15px}.product{padding:10px;cursor:pointer;position:relative}.product-img{height:310px;width:100%}.price{color:#222;font-size:16px;font-weight:600;line-height:normal}.tags{position:absolute;top:8px;left:8px;display:flex;gap:5px}.tags .tag{font-size:12px;background-color:#fff;padding:5px;border-radius:3px}.out-of-stock{background-color:#d3d3d333;color:#000;border-radius:5px;border:none}.fav-icon{position:absolute;z-index:1000;padding:5px;right:8px;top:8px;height:fit-content;width:fit-content;background-color:#ffffff78;border-radius:50%}.out-of-stock{background-color:#d3d3d333;color:#000;padding:5px 10px;border-radius:5px}.product-name{color:#222;font-size:16px;line-height:26px;margin-bottom:5px}.selling-price{text-decoration:line-through;font-size:14px!important;margin-right:8px;color:#d3d3d3}@media screen and (max-width: 475px){.selling-price{display:none!important}}.discounted-price{margin-top:-3px}.add-product-button{width:20%}.action-btn{display:flex;justify-content:center;margin-top:20px}.action-btn>a{width:fit-content!important;padding:5px 20px;text-decoration:none}.mt-15{margin-top:15px}.default-image{background-color:#f2f3f5;text-align:center}.default-image img{width:70%;height:310px}.total-container{height:auto;position:relative}.display-block{display:block!important}.quantity{display:flex;justify-content:space-between;align-items:center;border:1.5px solid lightgray;border-radius:3px;padding:5px;font-weight:600;width:95px}.preivew{transition:opacity .5s ease-in-out;opacity:1}.transition-preview{opacity:0}.hover_effect{position:absolute;width:100%;top:0;left:0;height:100%}@media screen and (max-width: 475px){.product-img{height:220px}.default-image img{height:250px}}.add-to-cart-btn{display:flex;gap:10px}.add-to-cart-btn .mat-icon{height:30px;width:35px;font-size:27px;margin-top:5px}.add-to-cart-btn button{height:35px;font-size:16px!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.SlicePipe, name: "slice" }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: SimpoComponentModule }, { kind: "component", type: HoverElementsComponent, selector: "simpo-hover-elements", inputs: ["data", "index", "editOptions", "isMerged"], outputs: ["edit"] }, { kind: "component", type: DeleteHoverElementComponent, selector: "simpo-delete-hover-element", inputs: ["index", "data"], outputs: ["edit"] }, { kind: "component", type: i11.NgxSkeletonLoaderComponent, selector: "ngx-skeleton-loader", inputs: ["count", "loadingText", "appearance", "animation", "ariaLabel", "theme"] }, { kind: "component", type:
5448
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.4", type: FeaturedProductsComponent, isStandalone: true, selector: "simpo-featured-products", inputs: { data: "data", responseData: "responseData", index: "index", isRelatedProduct: "isRelatedProduct", edit: "edit", delete: "delete" }, outputs: { changeDetailProduct: "changeDetailProduct" }, host: { listeners: { "window: resize": "getScreenSize($event)" } }, providers: [MessageService], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "\r\n<p-toast position=\"bottom-right\" [baseZIndex]=\"10000000000\" [autoZIndex]=\"true\"></p-toast>\r\n<ng-container *ngIf=\"!isLoading\">\r\n <section class=\"container-fluid total-container\" [id]=\"data?.id\">\r\n <div [id]=\"data?.id\" class=\"display-block\" #mainContainer [simpoOverlay]=\"styles?.background\" [simpoBorder]=\"styles?.border\"\r\n [simpoAnimation]=\"styles?.animation\" [simpoLayout]=\"styles?.layout\">\r\n <div *ngFor=\"let item of content?.inputText\">\r\n <div [innerHTML]=\"item.value\" [ngClass]=\"item.label === 'Heading' ? 'heading-large lh-2 mb-3' : 'body-large'\">\r\n </div>\r\n </div>\r\n <img src=\"https://dev-beeos.s3.amazonaws.com/library-media/714126c1707378935732span.png\" alt=\"\"\r\n class=\"span-img mt-15\">\r\n <ng-container *ngIf=\"!filterLoading\">\r\n <div class=\"product-parent\" *ngIf=\"responseData && responseData?.length\">\r\n <div *ngFor=\"let product of responseData | slice:getSliceParameters()[0]:getSliceParameters()[1]; let idx = index\" class=\"product\"\r\n [style.width]=\"getProductWidth()\">\r\n <div *ngIf=\"!(product.itemImages?.length && product.itemImages[0].imgUrl)\" class=\"default-image\" (click)=\"proceedToProductDesc(product)\">\r\n <img src=\"https://i.postimg.cc/hPS2JpV0/no-image-available.jpg\" alt=\"\">\r\n <ng-container *ngTemplateOutlet=\"FavouriteTags; context: {data: product}\"></ng-container>\r\n </div>\r\n <div *ngIf=\"product.itemImages?.length && product.itemImages[0].imgUrl\" (click)=\"proceedToProductDesc(product)\" class=\"position-relative\">\r\n <div class=\"tags\">\r\n <div class=\"tag\" *ngIf=\"product.itemInventory && product.itemInventory.lowStockQuantity < 5\">Selling Fast</div>\r\n </div>\r\n <ng-container *ngTemplateOutlet=\"FavouriteTags; context: {data: product}\"></ng-container>\r\n <img [id]=\"'preview_'+idx\" [src]=\"product.itemImages[product.prviewIdx]?.imgUrl\" alt=\"\" class=\"product-img preivew\" (mouseenter)=\"togglePreviewImage(product, idx)\" (mouseleave)=\"product.prviewIdx = 0\">\r\n </div>\r\n <div class=\"mt-15\">\r\n <div class=\"product-name heading-large\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n {{product.name.length > 30 ? (product.name | slice: 0:27) + '...' : product.name }}</div>\r\n <div class=\"varient-list\" *ngIf=\"product.itemVariant?.length\">\r\n <ng-container *ngFor=\"let varient of product.itemVariant; let idx = index\">\r\n <img [src]=\"varient.variantImages[0].imgUrl\" alt=\"\" class=\"varient\" [ngClass]=\"{'selected-varient': varient.variantId == product.varientId}\" [style.borderColor]=\"varient.variantId == product.varientId ? 'blue' : 'transparent'\" (click)=\"selectVarient(product, varient)\">\r\n </ng-container>\r\n </div>\r\n <div class=\"d-flex justify-content-between align-items-center\">\r\n <div class=\"price body-large d-flex\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n <div *ngIf=\"product.price.value != product.price.discountedPrice\" class=\"selling-price\">\r\n <span [innerHTML]='currency'></span>\r\n {{product.price.value}}\r\n </div>\r\n <div class=\"discounted-price\">\r\n <span [innerHTML]='currency'></span>\r\n {{product.price.discountedPrice}}\r\n </div>\r\n </div>\r\n <div *ngIf=\"content?.display?.showButton\" class=\"add-to-cart-btn\">\r\n <button simpoButtonDirective [id]=\"data?.id+(button?.id || '')\" [buttonStyle]=\"button?.styles\"\r\n [color]=\"styles?.background?.accentColor\" *ngIf=\"!product.quantity && !isItemOutOfStock(product)\" (click)=\"addItemToCart(product, 'ADD')\">{{button?.content?.label ?? 'Add to Cart'}}</button>\r\n <div class=\"quantity\" *ngIf=\"product.quantity\">\r\n <span (click)=\"addItemToCart(product, 'SUBSTRACT')\">-</span>\r\n <span>{{product.quantity}}</span>\r\n <span (click)=\"addItemToCart(product, 'ADD')\">+</span>\r\n </div>\r\n <button disabled class=\"out-of-stock\" *ngIf=\"isItemOutOfStock(product)\">Out Of Stock</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"action-btn\">\r\n <a [href]=\"data?.action?.buttons?.[1]?.content?.redirectionUrl\" simpoButtonDirective [id]=\"data?.id+(data?.action?.buttons?.[1]?.id || '')\" [buttonStyle]=\"data?.action?.buttons?.[1]?.styles\" [color]=\"styles?.background?.accentColor\" >{{data?.action?.buttons?.[1]?.content?.label }}</a>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div [ngClass]=\"{'hover_effect': edit}\" *ngIf=\"showEditors\">\r\n <simpo-hover-elements [data]=\"data\" [index]=\"index\" [editOptions]=\"edit\"></simpo-hover-elements>\r\n </div>\r\n <div *ngIf=\"showDelete\" [ngClass]=\"{'hover_effect': delete}\">\r\n <simpo-delete-hover-element [data]=\"data\" [index]=\"index\"></simpo-delete-hover-element>\r\n </div>\r\n\r\n </section>\r\n</ng-container>\r\n<ng-template #FavouriteTags let-product=\"data\">\r\n <mat-icon class=\"fav-icon\" [style.color]=\"data?.styles?.background?.accentColor\" (click)=\"toggleItemToFav($event, product, 'ADD')\" *ngIf=\"!product.whislist\">favorite_border</mat-icon>\r\n <mat-icon class=\"fav-icon\" [style.color]=\"data?.styles?.background?.accentColor\" (click)=\"toggleItemToFav($event, product, 'REMOVE')\" *ngIf=\"product.whislist\">favorite</mat-icon>\r\n</ng-template>\r\n<ngx-skeleton-loader *ngIf=\"isLoading || filterLoading\" count=\"1\" appearance=\"circle\" [theme]=\"{\r\n width: '100%',\r\n height: '40vh',\r\n 'border-radius': '10px',\r\n 'position': 'relative',\r\n 'right': '5px'\r\n}\">\r\n</ngx-skeleton-loader>\r\n", styles: [".product-parent{display:flex;flex-wrap:wrap;margin-top:15px}.product{padding:10px;cursor:pointer;position:relative}.product-img{height:310px;width:100%}.price{color:#222;font-size:16px;font-weight:600;line-height:normal}.varient-list{display:flex;gap:5px;margin-bottom:5px;width:100%;overflow-x:auto}.varient-list .varient{height:60px;width:45px;border-radius:5px;border:1px solid lightgray}.varient-list .selected-varient{border:1px solid transparent}.tags{position:absolute;top:8px;left:8px;display:flex;gap:5px}.tags .tag{font-size:12px;background-color:#fff;padding:5px;border-radius:3px}.out-of-stock{background-color:#d3d3d333;color:#000;border-radius:5px;border:none}.fav-icon{position:absolute;z-index:1000;padding:5px;right:8px;top:8px;height:fit-content;width:fit-content;background-color:#ffffff78;border-radius:50%}.out-of-stock{background-color:#d3d3d333;color:#000;padding:5px 10px;border-radius:5px}.product-name{color:#222;font-size:16px;line-height:26px;margin-bottom:5px}.selling-price{text-decoration:line-through;font-size:14px!important;margin-right:8px;color:#d3d3d3}@media screen and (max-width: 475px){.selling-price{display:none!important}}.discounted-price{margin-top:-3px}.add-product-button{width:20%}.action-btn{display:flex;justify-content:center;margin-top:20px}.action-btn>a{width:fit-content!important;padding:5px 20px;text-decoration:none}.mt-15{margin-top:15px}.default-image{background-color:#f2f3f5;text-align:center}.default-image img{width:70%;height:310px}.total-container{height:auto;position:relative}.display-block{display:block!important}.quantity{display:flex;justify-content:space-between;align-items:center;border:1.5px solid lightgray;border-radius:3px;padding:5px;font-weight:600;width:95px}.preivew{transition:opacity .5s ease-in-out;opacity:1}.transition-preview{opacity:0}.hover_effect{position:absolute;width:100%;top:0;left:0;height:100%}@media screen and (max-width: 475px){.product-img{height:220px}.default-image img{height:250px}}.add-to-cart-btn{display:flex;gap:10px}.add-to-cart-btn .mat-icon{height:30px;width:35px;font-size:27px;margin-top:5px}.add-to-cart-btn button{height:35px;font-size:16px!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.SlicePipe, name: "slice" }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: SimpoComponentModule }, { kind: "component", type: HoverElementsComponent, selector: "simpo-hover-elements", inputs: ["data", "index", "editOptions", "isMerged"], outputs: ["edit"] }, { kind: "component", type: DeleteHoverElementComponent, selector: "simpo-delete-hover-element", inputs: ["index", "data"], outputs: ["edit"] }, { kind: "component", type: i11.NgxSkeletonLoaderComponent, selector: "ngx-skeleton-loader", inputs: ["count", "loadingText", "appearance", "animation", "ariaLabel", "theme"] }, { kind: "component", type:
5419
5449
  //directive
5420
- MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: AnimationDirective, selector: "[simpoAnimation]", inputs: ["simpoAnimation"] }, { kind: "directive", type: ContentFitDirective, selector: "[simpoLayout]", inputs: ["simpoLayout"] }, { kind: "directive", type: BorderDirective, selector: "[simpoBorder]", inputs: ["simpoBorder"] }, { kind: "directive", type: HoverDirective, selector: "[simpoHover]", outputs: ["hovering"] }, { kind: "directive", type: OverlayDirective, selector: "[simpoOverlay]", inputs: ["simpoOverlay"] }, { kind: "directive", type: ColorDirective, selector: "[simpoColor]", inputs: ["simpoColor"] }, { kind: "ngmodule", type: MatBottomSheetModule }, { kind: "directive", type: ButtonDirectiveDirective, selector: "[simpoButtonDirective]", inputs: ["buttonStyle", "color", "scrollValue"] }, { kind: "ngmodule", type: ToastModule }, { kind: "component", type: i12.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }] }); }
5450
+ MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: AnimationDirective, selector: "[simpoAnimation]", inputs: ["simpoAnimation"] }, { kind: "directive", type: ContentFitDirective, selector: "[simpoLayout]", inputs: ["simpoLayout"] }, { kind: "directive", type: BorderDirective, selector: "[simpoBorder]", inputs: ["simpoBorder"] }, { kind: "directive", type: OverlayDirective, selector: "[simpoOverlay]", inputs: ["simpoOverlay"] }, { kind: "directive", type: ColorDirective, selector: "[simpoColor]", inputs: ["simpoColor"] }, { kind: "ngmodule", type: MatBottomSheetModule }, { kind: "directive", type: ButtonDirectiveDirective, selector: "[simpoButtonDirective]", inputs: ["buttonStyle", "color", "scrollValue"] }, { kind: "ngmodule", type: ToastModule }, { kind: "component", type: i12.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }] }); }
5421
5451
  }
5422
5452
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: FeaturedProductsComponent, decorators: [{
5423
5453
  type: Component,
@@ -5439,7 +5469,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImpor
5439
5469
  MatBottomSheetModule,
5440
5470
  ButtonDirectiveDirective,
5441
5471
  ToastModule
5442
- ], providers: [MessageService], template: "\r\n<p-toast position=\"bottom-right\" [baseZIndex]=\"10000000000\" [autoZIndex]=\"true\"></p-toast>\r\n<ng-container *ngIf=\"!isLoading\">\r\n <section class=\"container-fluid total-container\" [id]=\"data?.id\" simpoHover (hovering)=\"showEditTabs($event)\">\r\n <div [id]=\"data?.id\" class=\"display-block\" #mainContainer [simpoOverlay]=\"styles?.background\" [simpoBorder]=\"styles?.border\"\r\n [simpoAnimation]=\"styles?.animation\" [simpoLayout]=\"styles?.layout\">\r\n <div *ngFor=\"let item of content?.inputText\">\r\n <div [innerHTML]=\"item.value\" [ngClass]=\"item.label === 'Heading' ? 'heading-large lh-2 mb-3' : 'body-large'\">\r\n </div>\r\n </div>\r\n <img src=\"https://dev-beeos.s3.amazonaws.com/library-media/714126c1707378935732span.png\" alt=\"\"\r\n class=\"span-img mt-15\">\r\n <ng-container *ngIf=\"!filterLoading\">\r\n <div class=\"product-parent\" *ngIf=\"responseData && responseData?.length\">\r\n <div *ngFor=\"let product of responseData | slice:getSliceParameters()[0]:getSliceParameters()[1]; let idx = index\" class=\"product\"\r\n [style.width]=\"getProductWidth()\">\r\n <div *ngIf=\"!(product.itemImages?.length && product.itemImages[0].imgUrl)\" class=\"default-image\" (click)=\"proceedToProductDesc(product)\">\r\n <img src=\"https://i.postimg.cc/hPS2JpV0/no-image-available.jpg\" alt=\"\">\r\n <ng-container *ngTemplateOutlet=\"FavouriteTags; context: {data: product}\"></ng-container>\r\n </div>\r\n <div *ngIf=\"product.itemImages?.length && product.itemImages[0].imgUrl\" (click)=\"proceedToProductDesc(product)\" class=\"position-relative\">\r\n <div class=\"tags\">\r\n <div class=\"tag\" *ngIf=\"product.itemInventory && product.itemInventory.lowStockQuantity < 5\">Selling Fast</div>\r\n </div>\r\n <ng-container *ngTemplateOutlet=\"FavouriteTags; context: {data: product}\"></ng-container>\r\n <img [id]=\"'preview_'+idx\" [src]=\"product.itemImages[product.prviewIdx]?.imgUrl\" alt=\"\" class=\"product-img preivew\" (mouseenter)=\"togglePreviewImage(product, idx)\" (mouseleave)=\"product.prviewIdx = 0\">\r\n </div>\r\n <div class=\"mt-15\">\r\n <div class=\"product-name heading-large\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n {{product.name.length > 30 ? (product.name | slice: 0:27) + '...' : product.name }}</div>\r\n <div class=\"d-flex justify-content-between align-items-center\">\r\n <div class=\"price body-large d-flex\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n <div *ngIf=\"product.price.value != product.price.discountedPrice\" class=\"selling-price\">\r\n <span [innerHTML]='currency'></span>\r\n {{product.price.value}}\r\n </div>\r\n <div class=\"discounted-price\">\r\n <span [innerHTML]='currency'></span>\r\n {{product.price.discountedPrice}}\r\n </div>\r\n </div>\r\n <div *ngIf=\"content?.display?.showButton\" class=\"add-to-cart-btn\">\r\n <button simpoButtonDirective [id]=\"data?.id+(button?.id || '')\" [buttonStyle]=\"button?.styles\"\r\n [color]=\"styles?.background?.accentColor\" *ngIf=\"!product.quantity && !isItemOutOfStock(product)\" (click)=\"addItemToCart(product, 'ADD')\">{{button?.content?.label ?? 'Add to Cart'}}</button>\r\n <div class=\"quantity\" *ngIf=\"product.quantity\">\r\n <span (click)=\"addItemToCart(product, 'SUBSTRACT')\">-</span>\r\n <span>{{product.quantity}}</span>\r\n <span (click)=\"addItemToCart(product, 'ADD')\">+</span>\r\n </div>\r\n <button disabled class=\"out-of-stock\" *ngIf=\"isItemOutOfStock(product)\">Out Of Stock</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"action-btn\">\r\n <a [href]=\"data?.action?.buttons?.[1]?.content?.redirectionUrl\" simpoButtonDirective [id]=\"data?.id+(data?.action?.buttons?.[1]?.id || '')\" [buttonStyle]=\"data?.action?.buttons?.[1]?.styles\" [color]=\"styles?.background?.accentColor\" >{{data?.action?.buttons?.[1]?.content?.label }}</a>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div [ngClass]=\"{'hover_effect': edit}\" *ngIf=\"showEditors\">\r\n <simpo-hover-elements [data]=\"data\" [index]=\"index\" [editOptions]=\"edit\"></simpo-hover-elements>\r\n </div>\r\n <div *ngIf=\"showDelete\" [ngClass]=\"{'hover_effect': delete}\">\r\n <simpo-delete-hover-element [data]=\"data\" [index]=\"index\"></simpo-delete-hover-element>\r\n </div>\r\n\r\n </section>\r\n</ng-container>\r\n<ng-template #FavouriteTags let-product=\"data\">\r\n <mat-icon class=\"fav-icon\" [style.color]=\"data?.styles?.background?.accentColor\" (click)=\"toggleItemToFav($event, product, 'ADD')\" *ngIf=\"!product.whislist\">favorite_border</mat-icon>\r\n <mat-icon class=\"fav-icon\" [style.color]=\"data?.styles?.background?.accentColor\" (click)=\"toggleItemToFav($event, product, 'REMOVE')\" *ngIf=\"product.whislist\">favorite</mat-icon>\r\n</ng-template>\r\n<ngx-skeleton-loader *ngIf=\"isLoading || filterLoading\" count=\"1\" appearance=\"circle\" [theme]=\"{\r\n width: '100%',\r\n height: '40vh',\r\n 'border-radius': '10px',\r\n 'position': 'relative',\r\n 'right': '5px'\r\n}\">\r\n</ngx-skeleton-loader>\r\n", styles: [".product-parent{display:flex;flex-wrap:wrap;margin-top:15px}.product{padding:10px;cursor:pointer;position:relative}.product-img{height:310px;width:100%}.price{color:#222;font-size:16px;font-weight:600;line-height:normal}.tags{position:absolute;top:8px;left:8px;display:flex;gap:5px}.tags .tag{font-size:12px;background-color:#fff;padding:5px;border-radius:3px}.out-of-stock{background-color:#d3d3d333;color:#000;border-radius:5px;border:none}.fav-icon{position:absolute;z-index:1000;padding:5px;right:8px;top:8px;height:fit-content;width:fit-content;background-color:#ffffff78;border-radius:50%}.out-of-stock{background-color:#d3d3d333;color:#000;padding:5px 10px;border-radius:5px}.product-name{color:#222;font-size:16px;line-height:26px;margin-bottom:5px}.selling-price{text-decoration:line-through;font-size:14px!important;margin-right:8px;color:#d3d3d3}@media screen and (max-width: 475px){.selling-price{display:none!important}}.discounted-price{margin-top:-3px}.add-product-button{width:20%}.action-btn{display:flex;justify-content:center;margin-top:20px}.action-btn>a{width:fit-content!important;padding:5px 20px;text-decoration:none}.mt-15{margin-top:15px}.default-image{background-color:#f2f3f5;text-align:center}.default-image img{width:70%;height:310px}.total-container{height:auto;position:relative}.display-block{display:block!important}.quantity{display:flex;justify-content:space-between;align-items:center;border:1.5px solid lightgray;border-radius:3px;padding:5px;font-weight:600;width:95px}.preivew{transition:opacity .5s ease-in-out;opacity:1}.transition-preview{opacity:0}.hover_effect{position:absolute;width:100%;top:0;left:0;height:100%}@media screen and (max-width: 475px){.product-img{height:220px}.default-image img{height:250px}}.add-to-cart-btn{display:flex;gap:10px}.add-to-cart-btn .mat-icon{height:30px;width:35px;font-size:27px;margin-top:5px}.add-to-cart-btn button{height:35px;font-size:16px!important}\n"] }]
5472
+ ], providers: [MessageService], template: "\r\n<p-toast position=\"bottom-right\" [baseZIndex]=\"10000000000\" [autoZIndex]=\"true\"></p-toast>\r\n<ng-container *ngIf=\"!isLoading\">\r\n <section class=\"container-fluid total-container\" [id]=\"data?.id\">\r\n <div [id]=\"data?.id\" class=\"display-block\" #mainContainer [simpoOverlay]=\"styles?.background\" [simpoBorder]=\"styles?.border\"\r\n [simpoAnimation]=\"styles?.animation\" [simpoLayout]=\"styles?.layout\">\r\n <div *ngFor=\"let item of content?.inputText\">\r\n <div [innerHTML]=\"item.value\" [ngClass]=\"item.label === 'Heading' ? 'heading-large lh-2 mb-3' : 'body-large'\">\r\n </div>\r\n </div>\r\n <img src=\"https://dev-beeos.s3.amazonaws.com/library-media/714126c1707378935732span.png\" alt=\"\"\r\n class=\"span-img mt-15\">\r\n <ng-container *ngIf=\"!filterLoading\">\r\n <div class=\"product-parent\" *ngIf=\"responseData && responseData?.length\">\r\n <div *ngFor=\"let product of responseData | slice:getSliceParameters()[0]:getSliceParameters()[1]; let idx = index\" class=\"product\"\r\n [style.width]=\"getProductWidth()\">\r\n <div *ngIf=\"!(product.itemImages?.length && product.itemImages[0].imgUrl)\" class=\"default-image\" (click)=\"proceedToProductDesc(product)\">\r\n <img src=\"https://i.postimg.cc/hPS2JpV0/no-image-available.jpg\" alt=\"\">\r\n <ng-container *ngTemplateOutlet=\"FavouriteTags; context: {data: product}\"></ng-container>\r\n </div>\r\n <div *ngIf=\"product.itemImages?.length && product.itemImages[0].imgUrl\" (click)=\"proceedToProductDesc(product)\" class=\"position-relative\">\r\n <div class=\"tags\">\r\n <div class=\"tag\" *ngIf=\"product.itemInventory && product.itemInventory.lowStockQuantity < 5\">Selling Fast</div>\r\n </div>\r\n <ng-container *ngTemplateOutlet=\"FavouriteTags; context: {data: product}\"></ng-container>\r\n <img [id]=\"'preview_'+idx\" [src]=\"product.itemImages[product.prviewIdx]?.imgUrl\" alt=\"\" class=\"product-img preivew\" (mouseenter)=\"togglePreviewImage(product, idx)\" (mouseleave)=\"product.prviewIdx = 0\">\r\n </div>\r\n <div class=\"mt-15\">\r\n <div class=\"product-name heading-large\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n {{product.name.length > 30 ? (product.name | slice: 0:27) + '...' : product.name }}</div>\r\n <div class=\"varient-list\" *ngIf=\"product.itemVariant?.length\">\r\n <ng-container *ngFor=\"let varient of product.itemVariant; let idx = index\">\r\n <img [src]=\"varient.variantImages[0].imgUrl\" alt=\"\" class=\"varient\" [ngClass]=\"{'selected-varient': varient.variantId == product.varientId}\" [style.borderColor]=\"varient.variantId == product.varientId ? 'blue' : 'transparent'\" (click)=\"selectVarient(product, varient)\">\r\n </ng-container>\r\n </div>\r\n <div class=\"d-flex justify-content-between align-items-center\">\r\n <div class=\"price body-large d-flex\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n <div *ngIf=\"product.price.value != product.price.discountedPrice\" class=\"selling-price\">\r\n <span [innerHTML]='currency'></span>\r\n {{product.price.value}}\r\n </div>\r\n <div class=\"discounted-price\">\r\n <span [innerHTML]='currency'></span>\r\n {{product.price.discountedPrice}}\r\n </div>\r\n </div>\r\n <div *ngIf=\"content?.display?.showButton\" class=\"add-to-cart-btn\">\r\n <button simpoButtonDirective [id]=\"data?.id+(button?.id || '')\" [buttonStyle]=\"button?.styles\"\r\n [color]=\"styles?.background?.accentColor\" *ngIf=\"!product.quantity && !isItemOutOfStock(product)\" (click)=\"addItemToCart(product, 'ADD')\">{{button?.content?.label ?? 'Add to Cart'}}</button>\r\n <div class=\"quantity\" *ngIf=\"product.quantity\">\r\n <span (click)=\"addItemToCart(product, 'SUBSTRACT')\">-</span>\r\n <span>{{product.quantity}}</span>\r\n <span (click)=\"addItemToCart(product, 'ADD')\">+</span>\r\n </div>\r\n <button disabled class=\"out-of-stock\" *ngIf=\"isItemOutOfStock(product)\">Out Of Stock</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"action-btn\">\r\n <a [href]=\"data?.action?.buttons?.[1]?.content?.redirectionUrl\" simpoButtonDirective [id]=\"data?.id+(data?.action?.buttons?.[1]?.id || '')\" [buttonStyle]=\"data?.action?.buttons?.[1]?.styles\" [color]=\"styles?.background?.accentColor\" >{{data?.action?.buttons?.[1]?.content?.label }}</a>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div [ngClass]=\"{'hover_effect': edit}\" *ngIf=\"showEditors\">\r\n <simpo-hover-elements [data]=\"data\" [index]=\"index\" [editOptions]=\"edit\"></simpo-hover-elements>\r\n </div>\r\n <div *ngIf=\"showDelete\" [ngClass]=\"{'hover_effect': delete}\">\r\n <simpo-delete-hover-element [data]=\"data\" [index]=\"index\"></simpo-delete-hover-element>\r\n </div>\r\n\r\n </section>\r\n</ng-container>\r\n<ng-template #FavouriteTags let-product=\"data\">\r\n <mat-icon class=\"fav-icon\" [style.color]=\"data?.styles?.background?.accentColor\" (click)=\"toggleItemToFav($event, product, 'ADD')\" *ngIf=\"!product.whislist\">favorite_border</mat-icon>\r\n <mat-icon class=\"fav-icon\" [style.color]=\"data?.styles?.background?.accentColor\" (click)=\"toggleItemToFav($event, product, 'REMOVE')\" *ngIf=\"product.whislist\">favorite</mat-icon>\r\n</ng-template>\r\n<ngx-skeleton-loader *ngIf=\"isLoading || filterLoading\" count=\"1\" appearance=\"circle\" [theme]=\"{\r\n width: '100%',\r\n height: '40vh',\r\n 'border-radius': '10px',\r\n 'position': 'relative',\r\n 'right': '5px'\r\n}\">\r\n</ngx-skeleton-loader>\r\n", styles: [".product-parent{display:flex;flex-wrap:wrap;margin-top:15px}.product{padding:10px;cursor:pointer;position:relative}.product-img{height:310px;width:100%}.price{color:#222;font-size:16px;font-weight:600;line-height:normal}.varient-list{display:flex;gap:5px;margin-bottom:5px;width:100%;overflow-x:auto}.varient-list .varient{height:60px;width:45px;border-radius:5px;border:1px solid lightgray}.varient-list .selected-varient{border:1px solid transparent}.tags{position:absolute;top:8px;left:8px;display:flex;gap:5px}.tags .tag{font-size:12px;background-color:#fff;padding:5px;border-radius:3px}.out-of-stock{background-color:#d3d3d333;color:#000;border-radius:5px;border:none}.fav-icon{position:absolute;z-index:1000;padding:5px;right:8px;top:8px;height:fit-content;width:fit-content;background-color:#ffffff78;border-radius:50%}.out-of-stock{background-color:#d3d3d333;color:#000;padding:5px 10px;border-radius:5px}.product-name{color:#222;font-size:16px;line-height:26px;margin-bottom:5px}.selling-price{text-decoration:line-through;font-size:14px!important;margin-right:8px;color:#d3d3d3}@media screen and (max-width: 475px){.selling-price{display:none!important}}.discounted-price{margin-top:-3px}.add-product-button{width:20%}.action-btn{display:flex;justify-content:center;margin-top:20px}.action-btn>a{width:fit-content!important;padding:5px 20px;text-decoration:none}.mt-15{margin-top:15px}.default-image{background-color:#f2f3f5;text-align:center}.default-image img{width:70%;height:310px}.total-container{height:auto;position:relative}.display-block{display:block!important}.quantity{display:flex;justify-content:space-between;align-items:center;border:1.5px solid lightgray;border-radius:3px;padding:5px;font-weight:600;width:95px}.preivew{transition:opacity .5s ease-in-out;opacity:1}.transition-preview{opacity:0}.hover_effect{position:absolute;width:100%;top:0;left:0;height:100%}@media screen and (max-width: 475px){.product-img{height:220px}.default-image img{height:250px}}.add-to-cart-btn{display:flex;gap:10px}.add-to-cart-btn .mat-icon{height:30px;width:35px;font-size:27px;margin-top:5px}.add-to-cart-btn button{height:35px;font-size:16px!important}\n"] }]
5443
5473
  }], ctorParameters: () => [{ type: Object, decorators: [{
5444
5474
  type: Inject,
5445
5475
  args: [PLATFORM_ID]
@@ -5586,6 +5616,7 @@ class ProductDescComponent extends BaseSection {
5586
5616
  this.isLoading = false;
5587
5617
  this.responseData = response[0];
5588
5618
  this.responseData.itemVariant.forEach((varient, idx) => {
5619
+ varient.quantity = 0;
5589
5620
  Object.keys(varient.properties).forEach((varientKey) => {
5590
5621
  if (idx == 0)
5591
5622
  this.selectedVarient.set(varientKey, varient.properties[varientKey]);
@@ -5593,6 +5624,10 @@ class ProductDescComponent extends BaseSection {
5593
5624
  this.varients.set(varientKey, [...(this.varients.get(varientKey) ?? []), varient.properties[varientKey]]);
5594
5625
  });
5595
5626
  });
5627
+ const itemVariant = this.getItemVarient();
5628
+ if (itemVariant) {
5629
+ this.responseData.itemImages = itemVariant.variantImages;
5630
+ }
5596
5631
  console.log("Description", this.responseData?.name, this.responseData?.descriptor?.name);
5597
5632
  this.titleService.setTitle(this.responseData?.name);
5598
5633
  this.metaTagService.updateTag({ name: 'description', content: this.responseData?.descriptor?.name });
@@ -5603,8 +5638,18 @@ class ProductDescComponent extends BaseSection {
5603
5638
  cartResponse.onsuccess = (cartData) => {
5604
5639
  this.USER_CART = cartData.target.result;
5605
5640
  this.USER_CART?.forEach((item) => {
5606
- if (item.itemId == productId)
5607
- this.responseData.quantity = item.quantity;
5641
+ if (item.itemId == productId) {
5642
+ if (this.responseData.itemVariant.length > 0) {
5643
+ const itemVariant = this.getItemVarient();
5644
+ if (itemVariant && item.varientId == itemVariant.variantId) {
5645
+ itemVariant.quantity = item.quantity;
5646
+ this.responseData.quantity = item.quantity;
5647
+ }
5648
+ }
5649
+ else {
5650
+ this.responseData.quantity = item.quantity;
5651
+ }
5652
+ }
5608
5653
  });
5609
5654
  };
5610
5655
  });
@@ -5612,8 +5657,18 @@ class ProductDescComponent extends BaseSection {
5612
5657
  wishlistResponse.onsuccess = (whislistData) => {
5613
5658
  this.USER_WISHLIST = whislistData.target.result;
5614
5659
  this.USER_WISHLIST?.forEach((item) => {
5615
- if (item.itemId == productId)
5616
- this.isItemAsFavorite = true;
5660
+ if (item.itemId == productId) {
5661
+ if (this.responseData.itemVariant.length > 0) {
5662
+ const itemVariant = this.getItemVarient();
5663
+ if (itemVariant && itemVariant.variantId == item.varientId) {
5664
+ itemVariant.wishlist = true;
5665
+ this.isItemAsFavorite = true;
5666
+ }
5667
+ }
5668
+ else {
5669
+ this.isItemAsFavorite = true;
5670
+ }
5671
+ }
5617
5672
  });
5618
5673
  };
5619
5674
  });
@@ -5628,27 +5683,30 @@ class ProductDescComponent extends BaseSection {
5628
5683
  selectVarient(key, value) {
5629
5684
  this.selectedVarient.set(key, value);
5630
5685
  this.responseData.itemVariant.forEach((varient) => {
5631
- let foundVarient = false;
5686
+ let foundVarient = true;
5632
5687
  Object.keys(varient.properties).forEach((property) => {
5633
- foundVarient = (this.selectedVarient.get(property) == varient.properties[property]);
5688
+ foundVarient = (this.selectedVarient.get(property) == varient.properties[property]) && foundVarient;
5689
+ console.log(this.selectedVarient.get(property), varient.properties[property]);
5634
5690
  });
5691
+ console.log(foundVarient);
5635
5692
  if (foundVarient) {
5636
5693
  this.itemImages = varient.variantImages;
5637
5694
  this.currentImg = this.itemImages[0]?.imgUrl;
5638
5695
  this.responseData.price.value = varient.itemVariantPrice.value;
5639
5696
  this.responseData.price.discountedPrice = varient.itemVariantPrice.discountedPrice;
5640
5697
  this.responseData.price.sellingPrice = varient.itemVariantPrice.sellingPrice;
5641
- this.responseData.quantity = varient.quantity;
5642
- this.isItemAsFavorite = varient.wishlist;
5698
+ this.responseData.itemInventory = varient.itemInventory;
5699
+ this.responseData.quantity = this.getVarientQuantity(varient);
5700
+ this.isItemAsFavorite = this.isVarientPresentInWishtlist(varient);
5643
5701
  }
5644
5702
  });
5645
5703
  }
5646
5704
  getItemVarient() {
5647
5705
  let selectedVarient = null;
5648
5706
  this.responseData.itemVariant?.forEach((varient) => {
5649
- let foundVarient = false;
5707
+ let foundVarient = true;
5650
5708
  Object.keys(varient.properties).forEach((property) => {
5651
- foundVarient = (this.selectedVarient.get(property) == varient.properties[property]);
5709
+ foundVarient = (this.selectedVarient.get(property) == varient.properties[property]) && foundVarient;
5652
5710
  });
5653
5711
  if (foundVarient)
5654
5712
  selectedVarient = varient;
@@ -5683,6 +5741,12 @@ class ProductDescComponent extends BaseSection {
5683
5741
  return;
5684
5742
  }
5685
5743
  if (this.responseData.itemVariant?.length > 0) {
5744
+ const itemVarient = this.getItemVarient();
5745
+ if (itemVarient) {
5746
+ itemVarient.quantity = itemVarient.quantity + 1;
5747
+ this.responseData.quantity = itemVarient.quantity;
5748
+ }
5749
+ this.cartService.addItemToCart(this.responseData, itemVarient?.variantId);
5686
5750
  }
5687
5751
  else {
5688
5752
  if (!this.responseData?.quantity)
@@ -5693,8 +5757,8 @@ class ProductDescComponent extends BaseSection {
5693
5757
  else {
5694
5758
  this.responseData.quantity -= 1;
5695
5759
  }
5760
+ this.cartService.addItemToCart(this.responseData);
5696
5761
  }
5697
- this.cartService.addItemToCart(this.responseData);
5698
5762
  }
5699
5763
  goToFilter(category) {
5700
5764
  category = category.replaceAll(" ", "_");
@@ -5703,12 +5767,30 @@ class ProductDescComponent extends BaseSection {
5703
5767
  addToFavourite() {
5704
5768
  this.isItemAsFavorite = true;
5705
5769
  this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Item added to your wishlist', key: 'wishlist' });
5706
- this.cartService.addItemToFavourite(this.responseData);
5770
+ if (this.responseData.itemVariant?.length > 0) {
5771
+ const itemVarient = this.getItemVarient();
5772
+ if (itemVarient) {
5773
+ itemVarient.wishlist = true;
5774
+ this.cartService.addItemToFavourite(this.responseData, itemVarient.variantId);
5775
+ }
5776
+ }
5777
+ else {
5778
+ this.cartService.addItemToFavourite(this.responseData);
5779
+ }
5707
5780
  }
5708
5781
  removeToFavourite() {
5709
5782
  this.isItemAsFavorite = false;
5710
5783
  this.messageService.add({ severity: 'info', summary: 'Success', detail: 'Item removed from your wishlist', key: 'wishlist' });
5711
- this.cartService.removeItemFromFavourite(this.responseData);
5784
+ if (this.responseData.itemVariant?.length > 0) {
5785
+ const itemVarient = this.getItemVarient();
5786
+ if (itemVarient) {
5787
+ itemVarient.wishlist = false;
5788
+ this.cartService.removeItemFromFavourite(this.responseData.varientId);
5789
+ }
5790
+ }
5791
+ else {
5792
+ this.cartService.removeItemFromFavourite(this.responseData.varientId);
5793
+ }
5712
5794
  }
5713
5795
  getProductByCategory() {
5714
5796
  this.restService.getProductByCategoryId(this.responseData?.itemCategorisation?.itemCategories?.[0]?.refId ?? "").subscribe((response) => {
@@ -5730,6 +5812,22 @@ class ProductDescComponent extends BaseSection {
5730
5812
  getKeyByIdx(property, index) {
5731
5813
  return Object.keys(property)[index];
5732
5814
  }
5815
+ getVarientQuantity(productVarient) {
5816
+ let itemQuantity = 0;
5817
+ this.USER_CART?.forEach((item) => {
5818
+ if (productVarient.variantId == item.varientId)
5819
+ itemQuantity = item.quantity;
5820
+ });
5821
+ return itemQuantity;
5822
+ }
5823
+ isVarientPresentInWishtlist(productVarient) {
5824
+ let present = false;
5825
+ this.USER_WISHLIST?.forEach((item) => {
5826
+ if (productVarient.variantId == item.varientId)
5827
+ present = true;
5828
+ });
5829
+ return present;
5830
+ }
5733
5831
  get isItemOutOfStock() {
5734
5832
  return this.responseData.itemInventory.openingStock == 0;
5735
5833
  }
@@ -5974,12 +6072,21 @@ class ProductListComponent extends BaseSection {
5974
6072
  if (type == 'ADD') {
5975
6073
  product.whislist = true;
5976
6074
  this.messageService.add({ severity: 'success', summary: 'Wishlist', detail: 'Item added to your wishlist' });
5977
- this.cartService.addItemToFavourite(product);
6075
+ if (product.itemVariant.length) {
6076
+ const itemVarient = this.getItemVarient(product, product.varientId);
6077
+ if (itemVarient) {
6078
+ itemVarient.wishlist = true;
6079
+ this.cartService.addItemToFavourite(product, itemVarient.variantId);
6080
+ }
6081
+ }
6082
+ else {
6083
+ this.cartService.addItemToFavourite(product);
6084
+ }
5978
6085
  }
5979
6086
  else {
5980
6087
  product.whislist = false;
5981
6088
  this.messageService.add({ severity: 'info', summary: 'Wishlist', detail: 'Item removed from your wishlist' });
5982
- this.cartService.removeItemFromFavourite(product);
6089
+ this.cartService.removeItemFromFavourite(product.varientId);
5983
6090
  }
5984
6091
  event.stopPropagation();
5985
6092
  }
@@ -5990,7 +6097,6 @@ class ProductListComponent extends BaseSection {
5990
6097
  }
5991
6098
  product.quantity += (type == 'ADD' ? 1 : -1);
5992
6099
  this.cartService.addItemToCart(product);
5993
- // event.stopPropagation();
5994
6100
  }
5995
6101
  searchProduct() {
5996
6102
  this.navigateFilter(this.sortBy ?? "lowestPrice");
@@ -6035,8 +6141,19 @@ class ProductListComponent extends BaseSection {
6035
6141
  this.USER_CART = cartData.target.result;
6036
6142
  this.responseData?.forEach((product) => {
6037
6143
  this.USER_CART?.forEach((item) => {
6038
- if (item.itemId == product.itemId)
6039
- product.quantity = item.quantity;
6144
+ if (item.itemId == product.itemId) {
6145
+ if (product.itemVariant.length > 0) {
6146
+ const itemVarient = product.itemVariant[0];
6147
+ if (itemVarient.variantId == item.varientId) {
6148
+ product.itemImages = itemVarient.variantImages ?? [];
6149
+ product.price = itemVarient.itemVariantPrice;
6150
+ product.quantity = item.quantity;
6151
+ }
6152
+ }
6153
+ else {
6154
+ product.quantity = item.quantity;
6155
+ }
6156
+ }
6040
6157
  });
6041
6158
  });
6042
6159
  };
@@ -6046,8 +6163,19 @@ class ProductListComponent extends BaseSection {
6046
6163
  this.USER_WISHLIST = whislistData.target.result;
6047
6164
  this.responseData?.forEach((product) => {
6048
6165
  this.USER_WISHLIST?.forEach((item) => {
6049
- if (item.itemId == product.itemId)
6050
- product.wishlist = true;
6166
+ if (item.itemId == product.itemId) {
6167
+ if (product.itemVariant.length > 0) {
6168
+ const itemVarient = product.itemVariant[0];
6169
+ if (itemVarient.variantId == item.varientId) {
6170
+ product.itemImages = itemVarient?.variantImages ?? [];
6171
+ product.price = itemVarient.itemVariantPrice;
6172
+ product.whislist = true;
6173
+ }
6174
+ }
6175
+ else {
6176
+ product.whislist = true;
6177
+ }
6178
+ }
6051
6179
  });
6052
6180
  });
6053
6181
  };
@@ -6077,6 +6205,14 @@ class ProductListComponent extends BaseSection {
6077
6205
  isItemOutOfStock(product) {
6078
6206
  return product.itemInventory.openingStock == 0;
6079
6207
  }
6208
+ getItemVarient(product, varientId) {
6209
+ let selectedVarient = null;
6210
+ product.itemVariant?.forEach((varient) => {
6211
+ if (varient.variantId == varientId)
6212
+ selectedVarient = varient;
6213
+ });
6214
+ return selectedVarient;
6215
+ }
6080
6216
  get isMobile() {
6081
6217
  return window.innerWidth < 475;
6082
6218
  }
@@ -7536,7 +7672,7 @@ class Product {
7536
7672
  constructor(json) {
7537
7673
  this.itemId = json?.["itemId"];
7538
7674
  this.storeId = json?.["storeId"];
7539
- this.varientId = json?.["varientId"];
7675
+ this.varientId = json?.["itemId"];
7540
7676
  this.name = json?.["name"];
7541
7677
  this.itemCategorisation = json?.["itemCategorisation"];
7542
7678
  this.itemInventory = json?.["itemInventory"];
@@ -7558,6 +7694,12 @@ class Product {
7558
7694
  this.prviewIdx = 0;
7559
7695
  this.quantity = json?.["quantity"] ?? 0;
7560
7696
  this.whislist = false;
7697
+ if (this.itemVariant.length > 0) {
7698
+ this.itemImages = this.itemVariant[0].variantImages;
7699
+ this.price = this.itemVariant[0].itemVariantPrice;
7700
+ this.varientId = this.itemVariant[0].variantId;
7701
+ this.itemInventory = this.itemVariant[0].itemInventory;
7702
+ }
7561
7703
  }
7562
7704
  }
7563
7705