@ikas/storefront 0.0.33 → 0.0.35

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.
package/build/index.es.js CHANGED
@@ -11469,10 +11469,10 @@ var IkasPageDataProvider = /** @class */ (function () {
11469
11469
  };
11470
11470
  IkasPageDataProvider.prototype.getPageSpecificProduct = function () {
11471
11471
  return __awaiter(this, void 0, void 0, function () {
11472
- var slug, getProductMetaData, metaDataResponse, productsResponse, product, isMainProductSlug, selectedVariantValues, variantSlugPart, variantSlugs, _i, _a, variant, isSelectedVariant, _loop_1, _b, variantSlugs_1, variantSlug, state_1;
11472
+ var slug, getProductMetaData, metaDataResponse, productsResponse, product, isMainProductSlug, selectedVariantValues, variantSlugPart, _i, _a, variant, values, slugPart;
11473
11473
  var _this = this;
11474
- return __generator(this, function (_c) {
11475
- switch (_c.label) {
11474
+ return __generator(this, function (_b) {
11475
+ switch (_b.label) {
11476
11476
  case 0:
11477
11477
  slug = this.pageParams.slug;
11478
11478
  if (!slug) {
@@ -11499,14 +11499,14 @@ var IkasPageDataProvider = /** @class */ (function () {
11499
11499
  }); };
11500
11500
  return [4 /*yield*/, getProductMetaData(slug)];
11501
11501
  case 1:
11502
- metaDataResponse = _c.sent();
11502
+ metaDataResponse = _b.sent();
11503
11503
  if (!metaDataResponse)
11504
11504
  return [2 /*return*/];
11505
11505
  return [4 /*yield*/, IkasProductAPI.listProducts({
11506
11506
  idList: [metaDataResponse.metaData.targetId],
11507
11507
  })];
11508
11508
  case 2:
11509
- productsResponse = _c.sent();
11509
+ productsResponse = _b.sent();
11510
11510
  if (!productsResponse.products.length)
11511
11511
  return [2 /*return*/];
11512
11512
  product = productsResponse.products[0];
@@ -11514,24 +11514,12 @@ var IkasPageDataProvider = /** @class */ (function () {
11514
11514
  selectedVariantValues = [];
11515
11515
  if (!isMainProductSlug) {
11516
11516
  variantSlugPart = slug.slice(metaDataResponse.slug.length + 1);
11517
- variantSlugs = variantSlugPart.split("-");
11518
11517
  for (_i = 0, _a = product.variants; _i < _a.length; _i++) {
11519
11518
  variant = _a[_i];
11520
- isSelectedVariant = true;
11521
- _loop_1 = function (variantSlug) {
11522
- if (!variant.variantValues.some(function (vv) { return vv.slug === variantSlug; })) {
11523
- isSelectedVariant = false;
11524
- return "break";
11525
- }
11526
- };
11527
- for (_b = 0, variantSlugs_1 = variantSlugs; _b < variantSlugs_1.length; _b++) {
11528
- variantSlug = variantSlugs_1[_b];
11529
- state_1 = _loop_1(variantSlug);
11530
- if (state_1 === "break")
11531
- break;
11532
- }
11533
- if (isSelectedVariant) {
11534
- selectedVariantValues = variant.variantValues;
11519
+ values = variant.variantValues;
11520
+ slugPart = values.map(function (vv) { return vv.slug; }).join("-");
11521
+ if (slugPart === variantSlugPart) {
11522
+ selectedVariantValues = values;
11535
11523
  break;
11536
11524
  }
11537
11525
  }
@@ -22703,58 +22691,50 @@ var IkasPageHead = observer(function (_a) {
22703
22691
  });
22704
22692
  function createProductSchema(pageSpecificDataStr) {
22705
22693
  var _a;
22706
- var productDetailParsed = JSON.parse(pageSpecificDataStr);
22707
- var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
22708
- var isBrowser = typeof window !== "undefined";
22709
- if (isBrowser) {
22710
- var urlParams = new URLSearchParams(window.location.search);
22711
- var vid_1 = urlParams.get("vid");
22712
- if (vid_1) {
22713
- var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
22714
- if (variant) {
22715
- productDetail.selectedVariantValues = variant.variantValues;
22694
+ try {
22695
+ var productDetailParsed = JSON.parse(pageSpecificDataStr);
22696
+ var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
22697
+ var isBrowser = typeof window !== "undefined";
22698
+ if (isBrowser) {
22699
+ var urlParams = new URLSearchParams(window.location.search);
22700
+ var vid_1 = urlParams.get("vid");
22701
+ if (vid_1) {
22702
+ var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
22703
+ if (variant) {
22704
+ productDetail.selectedVariantValues = variant.variantValues;
22705
+ }
22716
22706
  }
22717
22707
  }
22718
- }
22719
- return {
22720
- "@context": "https://schema.org/",
22721
- "@type": "Product",
22722
- name: productDetail.product.name,
22723
- image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
22724
- description: "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
22725
- sku: productDetail.selectedVariant.sku,
22726
- mpn: "925872",
22727
- brand: {
22728
- "@type": "Brand",
22729
- name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
22730
- },
22731
- review: {
22732
- "@type": "Review",
22733
- reviewRating: {
22734
- "@type": "Rating",
22735
- ratingValue: "4",
22736
- bestRating: "5",
22708
+ return {
22709
+ "@context": "https://schema.org/",
22710
+ "@type": "Product",
22711
+ name: productDetail.product.name,
22712
+ image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
22713
+ description: "",
22714
+ sku: productDetail.selectedVariant.sku,
22715
+ mpn: productDetail.selectedVariant.barcodeList.length
22716
+ ? productDetail.selectedVariant.barcodeList[0]
22717
+ : "",
22718
+ brand: {
22719
+ "@type": "Brand",
22720
+ name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
22737
22721
  },
22738
- author: {
22739
- "@type": "Person",
22740
- name: "Fred Benson",
22722
+ offers: {
22723
+ "@type": "Offer",
22724
+ url: "https://" + window.location.hostname + productDetail.href,
22725
+ priceCurrency: productDetail.selectedVariant.price.currency,
22726
+ price: productDetail.selectedVariant.price.finalPrice,
22727
+ priceValidUntil: "",
22728
+ itemCondition: "https://schema.org/NewCondition",
22729
+ availability: productDetail.selectedVariant.stock > 0
22730
+ ? "https://schema.org/InStock"
22731
+ : "https://schema.org/OutOfStock",
22741
22732
  },
22742
- },
22743
- aggregateRating: {
22744
- "@type": "AggregateRating",
22745
- ratingValue: "4.4",
22746
- reviewCount: "89",
22747
- },
22748
- offers: {
22749
- "@type": "Offer",
22750
- url: "https://example.com/anvil",
22751
- priceCurrency: productDetail.selectedVariant.price.currency,
22752
- price: productDetail.selectedVariant.price.finalPrice,
22753
- priceValidUntil: "2020-11-20",
22754
- itemCondition: "https://schema.org/UsedCondition",
22755
- availability: "https://schema.org/InStock",
22756
- },
22757
- };
22733
+ };
22734
+ }
22735
+ catch (err) {
22736
+ console.log(err);
22737
+ }
22758
22738
  }
22759
22739
 
22760
22740
  var IkasCheckoutPage = observer(function (_a) {
package/build/index.js CHANGED
@@ -11482,10 +11482,10 @@ var IkasPageDataProvider = /** @class */ (function () {
11482
11482
  };
11483
11483
  IkasPageDataProvider.prototype.getPageSpecificProduct = function () {
11484
11484
  return __awaiter(this, void 0, void 0, function () {
11485
- var slug, getProductMetaData, metaDataResponse, productsResponse, product, isMainProductSlug, selectedVariantValues, variantSlugPart, variantSlugs, _i, _a, variant, isSelectedVariant, _loop_1, _b, variantSlugs_1, variantSlug, state_1;
11485
+ var slug, getProductMetaData, metaDataResponse, productsResponse, product, isMainProductSlug, selectedVariantValues, variantSlugPart, _i, _a, variant, values, slugPart;
11486
11486
  var _this = this;
11487
- return __generator(this, function (_c) {
11488
- switch (_c.label) {
11487
+ return __generator(this, function (_b) {
11488
+ switch (_b.label) {
11489
11489
  case 0:
11490
11490
  slug = this.pageParams.slug;
11491
11491
  if (!slug) {
@@ -11512,14 +11512,14 @@ var IkasPageDataProvider = /** @class */ (function () {
11512
11512
  }); };
11513
11513
  return [4 /*yield*/, getProductMetaData(slug)];
11514
11514
  case 1:
11515
- metaDataResponse = _c.sent();
11515
+ metaDataResponse = _b.sent();
11516
11516
  if (!metaDataResponse)
11517
11517
  return [2 /*return*/];
11518
11518
  return [4 /*yield*/, IkasProductAPI.listProducts({
11519
11519
  idList: [metaDataResponse.metaData.targetId],
11520
11520
  })];
11521
11521
  case 2:
11522
- productsResponse = _c.sent();
11522
+ productsResponse = _b.sent();
11523
11523
  if (!productsResponse.products.length)
11524
11524
  return [2 /*return*/];
11525
11525
  product = productsResponse.products[0];
@@ -11527,24 +11527,12 @@ var IkasPageDataProvider = /** @class */ (function () {
11527
11527
  selectedVariantValues = [];
11528
11528
  if (!isMainProductSlug) {
11529
11529
  variantSlugPart = slug.slice(metaDataResponse.slug.length + 1);
11530
- variantSlugs = variantSlugPart.split("-");
11531
11530
  for (_i = 0, _a = product.variants; _i < _a.length; _i++) {
11532
11531
  variant = _a[_i];
11533
- isSelectedVariant = true;
11534
- _loop_1 = function (variantSlug) {
11535
- if (!variant.variantValues.some(function (vv) { return vv.slug === variantSlug; })) {
11536
- isSelectedVariant = false;
11537
- return "break";
11538
- }
11539
- };
11540
- for (_b = 0, variantSlugs_1 = variantSlugs; _b < variantSlugs_1.length; _b++) {
11541
- variantSlug = variantSlugs_1[_b];
11542
- state_1 = _loop_1(variantSlug);
11543
- if (state_1 === "break")
11544
- break;
11545
- }
11546
- if (isSelectedVariant) {
11547
- selectedVariantValues = variant.variantValues;
11532
+ values = variant.variantValues;
11533
+ slugPart = values.map(function (vv) { return vv.slug; }).join("-");
11534
+ if (slugPart === variantSlugPart) {
11535
+ selectedVariantValues = values;
11548
11536
  break;
11549
11537
  }
11550
11538
  }
@@ -22687,58 +22675,50 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
22687
22675
  });
22688
22676
  function createProductSchema(pageSpecificDataStr) {
22689
22677
  var _a;
22690
- var productDetailParsed = JSON.parse(pageSpecificDataStr);
22691
- var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
22692
- var isBrowser = typeof window !== "undefined";
22693
- if (isBrowser) {
22694
- var urlParams = new URLSearchParams(window.location.search);
22695
- var vid_1 = urlParams.get("vid");
22696
- if (vid_1) {
22697
- var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
22698
- if (variant) {
22699
- productDetail.selectedVariantValues = variant.variantValues;
22678
+ try {
22679
+ var productDetailParsed = JSON.parse(pageSpecificDataStr);
22680
+ var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
22681
+ var isBrowser = typeof window !== "undefined";
22682
+ if (isBrowser) {
22683
+ var urlParams = new URLSearchParams(window.location.search);
22684
+ var vid_1 = urlParams.get("vid");
22685
+ if (vid_1) {
22686
+ var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
22687
+ if (variant) {
22688
+ productDetail.selectedVariantValues = variant.variantValues;
22689
+ }
22700
22690
  }
22701
22691
  }
22702
- }
22703
- return {
22704
- "@context": "https://schema.org/",
22705
- "@type": "Product",
22706
- name: productDetail.product.name,
22707
- image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
22708
- description: "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
22709
- sku: productDetail.selectedVariant.sku,
22710
- mpn: "925872",
22711
- brand: {
22712
- "@type": "Brand",
22713
- name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
22714
- },
22715
- review: {
22716
- "@type": "Review",
22717
- reviewRating: {
22718
- "@type": "Rating",
22719
- ratingValue: "4",
22720
- bestRating: "5",
22692
+ return {
22693
+ "@context": "https://schema.org/",
22694
+ "@type": "Product",
22695
+ name: productDetail.product.name,
22696
+ image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
22697
+ description: "",
22698
+ sku: productDetail.selectedVariant.sku,
22699
+ mpn: productDetail.selectedVariant.barcodeList.length
22700
+ ? productDetail.selectedVariant.barcodeList[0]
22701
+ : "",
22702
+ brand: {
22703
+ "@type": "Brand",
22704
+ name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
22721
22705
  },
22722
- author: {
22723
- "@type": "Person",
22724
- name: "Fred Benson",
22706
+ offers: {
22707
+ "@type": "Offer",
22708
+ url: "https://" + window.location.hostname + productDetail.href,
22709
+ priceCurrency: productDetail.selectedVariant.price.currency,
22710
+ price: productDetail.selectedVariant.price.finalPrice,
22711
+ priceValidUntil: "",
22712
+ itemCondition: "https://schema.org/NewCondition",
22713
+ availability: productDetail.selectedVariant.stock > 0
22714
+ ? "https://schema.org/InStock"
22715
+ : "https://schema.org/OutOfStock",
22725
22716
  },
22726
- },
22727
- aggregateRating: {
22728
- "@type": "AggregateRating",
22729
- ratingValue: "4.4",
22730
- reviewCount: "89",
22731
- },
22732
- offers: {
22733
- "@type": "Offer",
22734
- url: "https://example.com/anvil",
22735
- priceCurrency: productDetail.selectedVariant.price.currency,
22736
- price: productDetail.selectedVariant.price.finalPrice,
22737
- priceValidUntil: "2020-11-20",
22738
- itemCondition: "https://schema.org/UsedCondition",
22739
- availability: "https://schema.org/InStock",
22740
- },
22741
- };
22717
+ };
22718
+ }
22719
+ catch (err) {
22720
+ console.log(err);
22721
+ }
22742
22722
  }
22743
22723
 
22744
22724
  var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",