@ikas/storefront 0.0.34 → 0.0.36

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
@@ -1,5 +1,4 @@
1
1
  import { makeAutoObservable, toJS, runInAction, reaction, action, computed, configure } from 'mobx';
2
- import queryString from 'querystring';
3
2
  import React, { createElement, useState, useEffect, Fragment, useCallback, useRef } from 'react';
4
3
  import { observer } from 'mobx-react-lite';
5
4
  import { useRouter } from 'next/router';
@@ -12017,12 +12016,9 @@ var IkasOrderLineVariant = /** @class */ (function () {
12017
12016
  if (!this.slug)
12018
12017
  return;
12019
12018
  if (!!this.variantValues.length) {
12020
- var queryParams_1 = {};
12021
- this.variantValues.forEach(function (orderLineVariant) {
12022
- queryParams_1[orderLineVariant.variantTypeSlug] =
12023
- orderLineVariant.variantNameSlug;
12024
- });
12025
- return "/" + this.slug + "?" + queryString.stringify(queryParams_1);
12019
+ return "/" + this.slug + "-" + this.variantValues
12020
+ .map(function (vv) { return vv.variantNameSlug; })
12021
+ .join("-");
12026
12022
  }
12027
12023
  return "/" + this.slug;
12028
12024
  },
@@ -22691,58 +22687,50 @@ var IkasPageHead = observer(function (_a) {
22691
22687
  });
22692
22688
  function createProductSchema(pageSpecificDataStr) {
22693
22689
  var _a;
22694
- var productDetailParsed = JSON.parse(pageSpecificDataStr);
22695
- var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
22696
- var isBrowser = typeof window !== "undefined";
22697
- if (isBrowser) {
22698
- var urlParams = new URLSearchParams(window.location.search);
22699
- var vid_1 = urlParams.get("vid");
22700
- if (vid_1) {
22701
- var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
22702
- if (variant) {
22703
- productDetail.selectedVariantValues = variant.variantValues;
22690
+ try {
22691
+ var productDetailParsed = JSON.parse(pageSpecificDataStr);
22692
+ var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
22693
+ var isBrowser = typeof window !== "undefined";
22694
+ if (isBrowser) {
22695
+ var urlParams = new URLSearchParams(window.location.search);
22696
+ var vid_1 = urlParams.get("vid");
22697
+ if (vid_1) {
22698
+ var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
22699
+ if (variant) {
22700
+ productDetail.selectedVariantValues = variant.variantValues;
22701
+ }
22704
22702
  }
22705
22703
  }
22706
- }
22707
- return {
22708
- "@context": "https://schema.org/",
22709
- "@type": "Product",
22710
- name: productDetail.product.name,
22711
- image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
22712
- description: "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
22713
- sku: productDetail.selectedVariant.sku,
22714
- mpn: "925872",
22715
- brand: {
22716
- "@type": "Brand",
22717
- name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
22718
- },
22719
- review: {
22720
- "@type": "Review",
22721
- reviewRating: {
22722
- "@type": "Rating",
22723
- ratingValue: "4",
22724
- bestRating: "5",
22704
+ return {
22705
+ "@context": "https://schema.org/",
22706
+ "@type": "Product",
22707
+ name: productDetail.product.name,
22708
+ image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
22709
+ description: "",
22710
+ sku: productDetail.selectedVariant.sku,
22711
+ mpn: productDetail.selectedVariant.barcodeList.length
22712
+ ? productDetail.selectedVariant.barcodeList[0]
22713
+ : "",
22714
+ brand: {
22715
+ "@type": "Brand",
22716
+ name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
22725
22717
  },
22726
- author: {
22727
- "@type": "Person",
22728
- name: "Fred Benson",
22718
+ offers: {
22719
+ "@type": "Offer",
22720
+ url: "https://" + window.location.hostname + productDetail.href,
22721
+ priceCurrency: productDetail.selectedVariant.price.currency,
22722
+ price: productDetail.selectedVariant.price.finalPrice,
22723
+ priceValidUntil: "",
22724
+ itemCondition: "https://schema.org/NewCondition",
22725
+ availability: productDetail.selectedVariant.stock > 0
22726
+ ? "https://schema.org/InStock"
22727
+ : "https://schema.org/OutOfStock",
22729
22728
  },
22730
- },
22731
- aggregateRating: {
22732
- "@type": "AggregateRating",
22733
- ratingValue: "4.4",
22734
- reviewCount: "89",
22735
- },
22736
- offers: {
22737
- "@type": "Offer",
22738
- url: "https://example.com/anvil",
22739
- priceCurrency: productDetail.selectedVariant.price.currency,
22740
- price: productDetail.selectedVariant.price.finalPrice,
22741
- priceValidUntil: "2020-11-20",
22742
- itemCondition: "https://schema.org/UsedCondition",
22743
- availability: "https://schema.org/InStock",
22744
- },
22745
- };
22729
+ };
22730
+ }
22731
+ catch (err) {
22732
+ console.log(err);
22733
+ }
22746
22734
  }
22747
22735
 
22748
22736
  var IkasCheckoutPage = observer(function (_a) {
package/build/index.js CHANGED
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var mobx = require('mobx');
6
- var queryString = require('querystring');
7
6
  var React = require('react');
8
7
  var mobxReactLite = require('mobx-react-lite');
9
8
  var router = require('next/router');
@@ -14,7 +13,6 @@ var dynamic = require('next/dynamic');
14
13
 
15
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
15
 
17
- var queryString__default = /*#__PURE__*/_interopDefaultLegacy(queryString);
18
16
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
17
  var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
20
18
  var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
@@ -12029,12 +12027,9 @@ var IkasOrderLineVariant = /** @class */ (function () {
12029
12027
  if (!this.slug)
12030
12028
  return;
12031
12029
  if (!!this.variantValues.length) {
12032
- var queryParams_1 = {};
12033
- this.variantValues.forEach(function (orderLineVariant) {
12034
- queryParams_1[orderLineVariant.variantTypeSlug] =
12035
- orderLineVariant.variantNameSlug;
12036
- });
12037
- return "/" + this.slug + "?" + queryString__default['default'].stringify(queryParams_1);
12030
+ return "/" + this.slug + "-" + this.variantValues
12031
+ .map(function (vv) { return vv.variantNameSlug; })
12032
+ .join("-");
12038
12033
  }
12039
12034
  return "/" + this.slug;
12040
12035
  },
@@ -22675,58 +22670,50 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
22675
22670
  });
22676
22671
  function createProductSchema(pageSpecificDataStr) {
22677
22672
  var _a;
22678
- var productDetailParsed = JSON.parse(pageSpecificDataStr);
22679
- var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
22680
- var isBrowser = typeof window !== "undefined";
22681
- if (isBrowser) {
22682
- var urlParams = new URLSearchParams(window.location.search);
22683
- var vid_1 = urlParams.get("vid");
22684
- if (vid_1) {
22685
- var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
22686
- if (variant) {
22687
- productDetail.selectedVariantValues = variant.variantValues;
22673
+ try {
22674
+ var productDetailParsed = JSON.parse(pageSpecificDataStr);
22675
+ var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
22676
+ var isBrowser = typeof window !== "undefined";
22677
+ if (isBrowser) {
22678
+ var urlParams = new URLSearchParams(window.location.search);
22679
+ var vid_1 = urlParams.get("vid");
22680
+ if (vid_1) {
22681
+ var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
22682
+ if (variant) {
22683
+ productDetail.selectedVariantValues = variant.variantValues;
22684
+ }
22688
22685
  }
22689
22686
  }
22690
- }
22691
- return {
22692
- "@context": "https://schema.org/",
22693
- "@type": "Product",
22694
- name: productDetail.product.name,
22695
- image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
22696
- description: "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
22697
- sku: productDetail.selectedVariant.sku,
22698
- mpn: "925872",
22699
- brand: {
22700
- "@type": "Brand",
22701
- name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
22702
- },
22703
- review: {
22704
- "@type": "Review",
22705
- reviewRating: {
22706
- "@type": "Rating",
22707
- ratingValue: "4",
22708
- bestRating: "5",
22687
+ return {
22688
+ "@context": "https://schema.org/",
22689
+ "@type": "Product",
22690
+ name: productDetail.product.name,
22691
+ image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
22692
+ description: "",
22693
+ sku: productDetail.selectedVariant.sku,
22694
+ mpn: productDetail.selectedVariant.barcodeList.length
22695
+ ? productDetail.selectedVariant.barcodeList[0]
22696
+ : "",
22697
+ brand: {
22698
+ "@type": "Brand",
22699
+ name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
22709
22700
  },
22710
- author: {
22711
- "@type": "Person",
22712
- name: "Fred Benson",
22701
+ offers: {
22702
+ "@type": "Offer",
22703
+ url: "https://" + window.location.hostname + productDetail.href,
22704
+ priceCurrency: productDetail.selectedVariant.price.currency,
22705
+ price: productDetail.selectedVariant.price.finalPrice,
22706
+ priceValidUntil: "",
22707
+ itemCondition: "https://schema.org/NewCondition",
22708
+ availability: productDetail.selectedVariant.stock > 0
22709
+ ? "https://schema.org/InStock"
22710
+ : "https://schema.org/OutOfStock",
22713
22711
  },
22714
- },
22715
- aggregateRating: {
22716
- "@type": "AggregateRating",
22717
- ratingValue: "4.4",
22718
- reviewCount: "89",
22719
- },
22720
- offers: {
22721
- "@type": "Offer",
22722
- url: "https://example.com/anvil",
22723
- priceCurrency: productDetail.selectedVariant.price.currency,
22724
- price: productDetail.selectedVariant.price.finalPrice,
22725
- priceValidUntil: "2020-11-20",
22726
- itemCondition: "https://schema.org/UsedCondition",
22727
- availability: "https://schema.org/InStock",
22728
- },
22729
- };
22712
+ };
22713
+ }
22714
+ catch (err) {
22715
+ console.log(err);
22716
+ }
22730
22717
  }
22731
22718
 
22732
22719
  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.34",
3
+ "version": "0.0.36",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",