simpo-component-library 1.2.12 → 1.2.14

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.
@@ -89,6 +89,8 @@ class EventsService {
89
89
  this.redirectToPage = new EventEmitter();
90
90
  this.addToCart = new EventEmitter();
91
91
  this.placeOrder = new EventEmitter();
92
+ this.featureCollectionList = new EventEmitter();
93
+ this.environmentType = new EventEmitter();
92
94
  }
93
95
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: EventsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
94
96
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: EventsService, providedIn: 'root' }); }
@@ -4251,33 +4253,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImpor
4251
4253
  }] } });
4252
4254
 
4253
4255
  class RestService {
4254
- constructor(http) {
4256
+ constructor(http, eventService) {
4255
4257
  this.http = http;
4258
+ this.eventService = eventService;
4256
4259
  this.BASE_URL = "https://dev-api.simpo.ai/";
4260
+ this.environmentTypeSubscriber = null;
4261
+ this.environmentTypeSubscriber = this.eventService.environmentType.subscribe((response) => {
4262
+ if (response == "DEV")
4263
+ this.BASE_URL = "https://dev-api.simpo.ai/";
4264
+ else if (response == "STAGE")
4265
+ this.BASE_URL = "https://state-api.simpo.ai/";
4266
+ else
4267
+ this.BASE_URL = "https://api.simpo.ai/";
4268
+ });
4257
4269
  }
4258
- getProductByBusiness(searchTxt = "", productId = null) {
4259
- const businessId = "1ef4fe51-6dfc-6199-b966-0f9244067fd0";
4260
- const payload = {
4261
- businessId: businessId,
4262
- pageNo: 0,
4263
- pageSize: 100,
4264
- searchText: searchTxt,
4265
- itemId: productId
4266
- };
4267
- return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => response.data.data.map((product) => new Product(product))));
4270
+ ngOnDestroy() {
4271
+ if (this.environmentTypeSubscriber)
4272
+ this.environmentTypeSubscriber?.unsubscribe();
4268
4273
  }
4269
4274
  getFeaturedProduct(collectionId) {
4270
- const businessId = "1ef4fe51-6dfc-6199-b966-0f9244067fd0";
4275
+ const subIndustryId = JSON.parse(localStorage.getItem("bDetails") ?? "{}")?.subIndustryId;
4276
+ 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))));
4277
+ }
4278
+ getProductDetails(productId = null) {
4271
4279
  const payload = {
4272
- businessId: businessId,
4273
4280
  pageNo: 0,
4274
- pageSize: 100
4281
+ pageSize: 1,
4282
+ itemId: productId
4275
4283
  };
4276
- if (collectionId)
4277
- payload["collectionId"] = [collectionId];
4278
4284
  return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => response.data.data.map((product) => new Product(product))));
4279
4285
  }
4280
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: RestService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
4286
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: RestService, deps: [{ token: i1$1.HttpClient }, { token: EventsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4281
4287
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: RestService, providedIn: 'root' }); }
4282
4288
  }
4283
4289
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: RestService, decorators: [{
@@ -4285,7 +4291,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImpor
4285
4291
  args: [{
4286
4292
  providedIn: 'root',
4287
4293
  }]
4288
- }], ctorParameters: () => [{ type: i1$1.HttpClient }] });
4294
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: EventsService }] });
4289
4295
 
4290
4296
  class FeaturedProductsComponent extends BaseSection {
4291
4297
  constructor(platformId, _eventService, restService, router) {
@@ -4295,6 +4301,7 @@ class FeaturedProductsComponent extends BaseSection {
4295
4301
  this.restService = restService;
4296
4302
  this.router = router;
4297
4303
  this.edit = true;
4304
+ this._eventSubscriber = null;
4298
4305
  this.screenWidth = 0;
4299
4306
  if (isPlatformBrowser(this.platformId)) {
4300
4307
  this.getScreenSize();
@@ -4303,36 +4310,36 @@ class FeaturedProductsComponent extends BaseSection {
4303
4310
  getScreenSize() {
4304
4311
  this.screenWidth = window.innerWidth;
4305
4312
  }
4306
- ngOnChanges(changes) {
4307
- debugger;
4308
- this.content = this.data?.content;
4309
- this.styles = this.data?.styles;
4310
- this.button = this.data?.action.buttons[0];
4311
- this.restService.getFeaturedProduct(this.content?.collectionId).subscribe((response) => {
4312
- this.responseData = response;
4313
- });
4314
- }
4315
4313
  ngOnInit() {
4316
- debugger;
4317
4314
  this.content = this.data?.content;
4318
4315
  this.styles = this.data?.styles;
4319
4316
  this.button = this.data?.action.buttons[0];
4320
- this.restService.getFeaturedProduct(this.content?.collectionId).subscribe((response) => {
4321
- this.responseData = response;
4317
+ this.getFeatureProduct();
4318
+ this._eventSubscriber = this._eventService.featureCollectionList.subscribe((response) => {
4319
+ this.getFeatureProduct();
4322
4320
  });
4323
4321
  }
4322
+ ngOnDestroy() {
4323
+ if (this._eventSubscriber)
4324
+ this._eventSubscriber?.unsubscribe();
4325
+ }
4324
4326
  getProductWidth() {
4325
4327
  return this.screenWidth > 475 ? (this.screenWidth < 1025 ? '25%' : 'calc(' + ((100 / (this.styles?.elementInRow || 4))) + '%)') : (this.styles?.mobileColumn === 1 ? '100%' : '50%');
4326
4328
  }
4327
4329
  getSliceParameters() {
4328
4330
  return [0, (this.styles?.maximumProduct || 0)];
4329
4331
  }
4332
+ getFeatureProduct() {
4333
+ this.restService.getFeaturedProduct(this.content?.collectionId).subscribe((response) => {
4334
+ this.responseData = response;
4335
+ });
4336
+ }
4330
4337
  proceedToProductDesc(productId) {
4331
4338
  this.router.navigate([`details`], { queryParams: { id: productId } });
4332
4339
  // this._eventService.redirectToPage.emit({redirectTo: '/details', data: {productId: productId}})
4333
4340
  }
4334
4341
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: FeaturedProductsComponent, deps: [{ token: PLATFORM_ID }, { token: EventsService }, { token: RestService }, { token: i2$4.Router }], target: i0.ɵɵFactoryTarget.Component }); }
4335
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.3", type: FeaturedProductsComponent, isStandalone: true, selector: "simpo-featured-products", inputs: { data: "data", responseData: "responseData", index: "index", delete: "delete" }, host: { listeners: { "window: resize": "getScreenSize($event)" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<section class=\"container-fluid total-container\" [id]=\"data?.id\" [simpoBackground]=\"styles?.background\"\r\n 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 <div class=\"product-parent\" *ngIf=\"responseData && responseData.length > 0\">\r\n <div *ngFor=\"let product of responseData | slice:getSliceParameters()[0]:getSliceParameters()[1]\" class=\"product\"\r\n [style.width]=\"getProductWidth()\" (click)=\"proceedToProductDesc(product.itemId)\">\r\n <div *ngIf=\"!(product.itemImages.length > 0 && product.itemImages[0].imgUrl)\" class=\"default-image\">\r\n <img src=\"https://www.svgrepo.com/show/149861/t-shirt-black-silhouette.svg\" alt=\"\">\r\n </div>\r\n <div *ngIf=\"product.itemImages.length > 0 && product.itemImages[0].imgUrl\">\r\n <img [src]=\"product.itemImages[0].imgUrl\" alt=\"\" class=\"product-img\">\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}}</div>\r\n <div class=\"price body-large\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n \u20B9\r\n {{product.price.sellingPrice}}\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\">{{content?.button}}</button>\r\n </div>\r\n </div>\r\n </div>\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", styles: [".product-parent{display:flex;flex-wrap:wrap;margin-top:15px}.product{padding:10px}.product-img{height:310px;width:100%}.price{color:#222;font-size:16px;font-weight:600;line-height:normal}.product-name{color:#222;font-size:16px;line-height:26px;margin-bottom:5px}.add-product-button{width:20%}.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}.hover_effect{position:absolute;width:100%;top:0;left:0;height:100%}@media screen and (max-width: 475px){.product-img{height:250px}.default-image img{height:250px}}.add-to-cart-btn{margin-top:15px}.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: "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: "ngmodule", type: HttpClientModule }, { kind: "directive", type:
4342
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.3", type: FeaturedProductsComponent, isStandalone: true, selector: "simpo-featured-products", inputs: { data: "data", responseData: "responseData", index: "index", delete: "delete" }, host: { listeners: { "window: resize": "getScreenSize($event)" } }, usesInheritance: true, ngImport: i0, template: "<section class=\"container-fluid total-container\" [id]=\"data?.id\" [simpoBackground]=\"styles?.background\"\r\n 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 <div class=\"product-parent\" *ngIf=\"responseData && responseData.length > 0\">\r\n <div *ngFor=\"let product of responseData | slice:getSliceParameters()[0]:getSliceParameters()[1]\" class=\"product\"\r\n [style.width]=\"getProductWidth()\" (click)=\"proceedToProductDesc(product.itemId)\">\r\n <div *ngIf=\"!(product.itemImages.length > 0 && product.itemImages[0].imgUrl)\" class=\"default-image\">\r\n <img src=\"https://www.svgrepo.com/show/149861/t-shirt-black-silhouette.svg\" alt=\"\">\r\n </div>\r\n <div *ngIf=\"product.itemImages.length > 0 && product.itemImages[0].imgUrl\">\r\n <img [src]=\"product.itemImages[0].imgUrl\" alt=\"\" class=\"product-img\">\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}}</div>\r\n <div class=\"price body-large\" [id]=\"data?.id\" [simpoColor]=\"styles?.background?.color\">\r\n \u20B9\r\n {{product.price.sellingPrice}}\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\">{{content?.button}}</button>\r\n </div>\r\n </div>\r\n </div>\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", styles: [".product-parent{display:flex;flex-wrap:wrap;margin-top:15px}.product{padding:10px}.product-img{height:310px;width:100%}.price{color:#222;font-size:16px;font-weight:600;line-height:normal}.product-name{color:#222;font-size:16px;line-height:26px;margin-bottom:5px}.add-product-button{width:20%}.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}.hover_effect{position:absolute;width:100%;top:0;left:0;height:100%}@media screen and (max-width: 475px){.product-img{height:250px}.default-image img{height:250px}}.add-to-cart-btn{margin-top:15px}.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: "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: "ngmodule", type: HttpClientModule }, { kind: "directive", type:
4336
4343
  //directive
4337
4344
  AnimationDirective, selector: "[simpoAnimation]", inputs: ["simpoAnimation"] }, { kind: "directive", type: ContentFitDirective, selector: "[simpoLayout]", inputs: ["simpoLayout"] }, { kind: "directive", type: BackgroundDirective, selector: "[simpoBackground]", inputs: ["simpoBackground", "scrollValue"] }, { 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: "directive", type: ButtonDirectiveDirective, selector: "[simpoButtonDirective]", inputs: ["buttonStyle", "color", "scrollValue"] }] }); }
4338
4345
  }
@@ -4536,7 +4543,7 @@ class ProductDescComponent extends BaseSection {
4536
4543
  this.activatedRoute.queryParams.subscribe((qParam) => {
4537
4544
  const productId = qParam["id"];
4538
4545
  if (productId) {
4539
- this.restService.getProductByBusiness("", productId).subscribe((response) => {
4546
+ this.restService.getProductDetails(productId).subscribe((response) => {
4540
4547
  this.responseData = response[0];
4541
4548
  this.currentImg = this.responseData?.itemImages[0].imgUrl;
4542
4549
  });
@@ -4676,8 +4683,8 @@ class ProductListComponent extends BaseSection {
4676
4683
  this.styles = this.data?.styles;
4677
4684
  this.button = this.data?.action.buttons[0];
4678
4685
  this.activatedRoute.queryParams.subscribe((qParam) => {
4679
- const categories = qParam["category"].split("+").map((category) => category.replaceAll("_", " ")).filter((category) => category.length > 0);
4680
- this.categories.forEach((category) => {
4686
+ const categories = qParam["category"]?.split("+")?.map((category) => category.replaceAll("_", " ")).filter((category) => category.length > 0);
4687
+ this.categories?.forEach((category) => {
4681
4688
  category.status = categories.includes(category.option);
4682
4689
  });
4683
4690
  this.filterList = categories;