@ikas/storefront 0.0.93 → 0.0.94

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.
@@ -16,4 +16,5 @@ export declare class Analytics {
16
16
  static completeRegistration(): void;
17
17
  static viewCart(cart: IkasCart | null | undefined): void;
18
18
  static viewCategory(categoryPath: string): void;
19
+ static contactForm(): void;
19
20
  }
@@ -11,4 +11,5 @@ export declare class FacebookPixel {
11
11
  static completeRegistration(): void;
12
12
  static viewCart(cart: IkasCart): void;
13
13
  static viewCategory(categoryPath: string): void;
14
+ static contactForm(): void;
14
15
  }
package/build/index.es.js CHANGED
@@ -13194,6 +13194,17 @@ var FacebookPixel = /** @class */ (function () {
13194
13194
  console.error(err);
13195
13195
  }
13196
13196
  };
13197
+ FacebookPixel.contactForm = function () {
13198
+ try {
13199
+ !isServer &&
13200
+ window.fbq &&
13201
+ window.fbq("track", "ContactForm", {});
13202
+ return;
13203
+ }
13204
+ catch (err) {
13205
+ console.error(err);
13206
+ }
13207
+ };
13197
13208
  return FacebookPixel;
13198
13209
  }());
13199
13210
  function productToFBPItem(productDetail, quantity) {
@@ -16856,6 +16867,14 @@ var Analytics = /** @class */ (function () {
16856
16867
  console.error(err);
16857
16868
  }
16858
16869
  };
16870
+ Analytics.contactForm = function () {
16871
+ try {
16872
+ FacebookPixel.contactForm();
16873
+ }
16874
+ catch (err) {
16875
+ console.error(err);
16876
+ }
16877
+ };
16859
16878
  return Analytics;
16860
16879
  }());
16861
16880
 
@@ -16941,7 +16960,9 @@ var IkasCustomerStore = /** @class */ (function () {
16941
16960
  this.saveContactForm = function (input) { return __awaiter(_this, void 0, void 0, function () {
16942
16961
  return __generator(this, function (_a) {
16943
16962
  switch (_a.label) {
16944
- case 0: return [4 /*yield*/, IkasContactFormAPI.sendContactFormToMerchant(input)];
16963
+ case 0:
16964
+ Analytics.contactForm();
16965
+ return [4 /*yield*/, IkasContactFormAPI.sendContactFormToMerchant(input)];
16945
16966
  case 1: return [2 /*return*/, _a.sent()];
16946
16967
  }
16947
16968
  });
@@ -17606,6 +17627,15 @@ var IkasProductVariantType = /** @class */ (function () {
17606
17627
  return IkasProductVariantType;
17607
17628
  }());
17608
17629
 
17630
+ var IkasProductTag = /** @class */ (function () {
17631
+ function IkasProductTag(data) {
17632
+ this.id = data.id || "";
17633
+ this.name = data.name || "";
17634
+ makeAutoObservable(this);
17635
+ }
17636
+ return IkasProductTag;
17637
+ }());
17638
+
17609
17639
  var IkasProduct = /** @class */ (function () {
17610
17640
  function IkasProduct(data) {
17611
17641
  if (data === void 0) { data = {}; }
@@ -17621,6 +17651,9 @@ var IkasProduct = /** @class */ (function () {
17621
17651
  this.categories = data.categories
17622
17652
  ? data.categories.map(function (c) { return new IkasCategory(c); })
17623
17653
  : [];
17654
+ this.tags = data.tags
17655
+ ? data.tags.map(function (tag) { return new IkasProductTag(tag); })
17656
+ : [];
17624
17657
  this.variants = data.variants
17625
17658
  ? data.variants.map(function (v) { return new IkasProductVariant(v); })
17626
17659
  : [];
@@ -25507,7 +25540,7 @@ var IkasProductSearchAPI = /** @class */ (function () {
25507
25540
  return IkasProductSearchAPI;
25508
25541
  }());
25509
25542
  function simpleToProduct(simple) {
25510
- var _a, _b, _c, _d, _e;
25543
+ var _a, _b, _c, _d, _e, _f;
25511
25544
  return new IkasProduct({
25512
25545
  id: simple.id,
25513
25546
  attributes: (_a = simple.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
@@ -25541,6 +25574,12 @@ function simpleToProduct(simple) {
25541
25574
  }),
25542
25575
  });
25543
25576
  }),
25577
+ tags: (_f = simple.tags) === null || _f === void 0 ? void 0 : _f.map(function (tag) {
25578
+ return new IkasProductTag({
25579
+ id: tag.id,
25580
+ name: tag.name,
25581
+ });
25582
+ }),
25544
25583
  description: simple.description || undefined,
25545
25584
  metaData: new IkasHTMLMetaData(simple.metaData || undefined),
25546
25585
  name: simple.name,
@@ -27500,11 +27539,9 @@ var IkasPageHead = observer(function (_a) {
27500
27539
  var categorySchema = createCategorySchema(pageSpecificDataStr);
27501
27540
  if (categorySchema)
27502
27541
  schemas.push(categorySchema);
27503
- // TODO
27504
- // const categoryBreadcrumbSchema = createCategoryBreadcrumbSchema(
27505
- // pageSpecificDataStr
27506
- // );
27507
- // if (categoryBreadcrumbSchema) schemas.push(categoryBreadcrumbSchema);
27542
+ var categoryBreadcrumbSchema = createCategoryBreadcrumbSchema(pageSpecificDataStr);
27543
+ if (categoryBreadcrumbSchema)
27544
+ schemas.push(categoryBreadcrumbSchema);
27508
27545
  }
27509
27546
  return (createElement(Head, null,
27510
27547
  createElement("title", null, pageTitle || ""),
@@ -27557,12 +27594,16 @@ function createProductSchema(productDetail) {
27557
27594
  }
27558
27595
  }
27559
27596
  }
27597
+ var productUrl = isBrowser
27598
+ ? "https://" + window.location.hostname + productDetail.href
27599
+ : "";
27560
27600
  return {
27561
27601
  "@context": "https://schema.org/",
27562
27602
  "@type": "Product",
27563
27603
  name: productDetail.product.name,
27564
27604
  description: (_a = productDetail.product.metaData) === null || _a === void 0 ? void 0 : _a.description,
27565
27605
  image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
27606
+ productId: productDetail.selectedVariant.id,
27566
27607
  sku: productDetail.selectedVariant.sku,
27567
27608
  mpn: productDetail.selectedVariant.barcodeList.length
27568
27609
  ? productDetail.selectedVariant.barcodeList[0]
@@ -27573,7 +27614,7 @@ function createProductSchema(productDetail) {
27573
27614
  },
27574
27615
  offers: {
27575
27616
  "@type": "Offer",
27576
- url: "https://" + window.location.hostname + productDetail.href,
27617
+ url: productUrl,
27577
27618
  priceCurrency: productDetail.selectedVariant.price.currency || "TRY",
27578
27619
  price: productDetail.selectedVariant.price.finalPrice,
27579
27620
  priceValidUntil: "",
@@ -27591,10 +27632,13 @@ function createCategorySchema(pageSpecificDataStr) {
27591
27632
  try {
27592
27633
  var categoryParsed = JSON.parse(pageSpecificDataStr);
27593
27634
  var category = new IkasCategory(categoryParsed);
27635
+ var categoryUrl = typeof window !== undefined
27636
+ ? "https://" + window.location.hostname + category.href
27637
+ : "";
27594
27638
  return {
27595
27639
  "@context": "http://schema.org",
27596
27640
  "@type": "CollectionPage",
27597
- url: "https://" + window.location.hostname + category.href,
27641
+ url: categoryUrl,
27598
27642
  name: (_a = category.metaData) === null || _a === void 0 ? void 0 : _a.pageTitle,
27599
27643
  description: (_b = category.metaData) === null || _b === void 0 ? void 0 : _b.description,
27600
27644
  image: (_c = category.image) === null || _c === void 0 ? void 0 : _c.src,
@@ -27602,26 +27646,25 @@ function createCategorySchema(pageSpecificDataStr) {
27602
27646
  }
27603
27647
  catch (_d) { }
27604
27648
  }
27605
- // TODO - Waiting for CategoryParentTree feature
27606
- // https://app.clubhouse.io/ikas/story/256/schema-org-json-lar%C4%B1n%C4%B1n-t%C3%BCm-kategori-sayfalar%C4%B1na-yerle%C5%9Ftirilmesini-istiyorum
27607
- // function createCategoryBreadcrumbSchema(pageSpecificDataStr: string) {
27608
- // try {
27609
- // const categoryParsed = JSON.parse(pageSpecificDataStr) as IkasCategory;
27610
- // const category = new IkasCategory(categoryParsed);
27611
- // return {
27612
- // "@context": "http://schema.org",
27613
- // "@type": "BreadcrumbList",
27614
- // "itemListElement": [
27615
- // {
27616
- // "@type": "ListItem",
27617
- // "position": 1,
27618
- // "name": "category.name",
27619
- // "item": "https://" + window.location.hostname + "category.href"
27620
- // }
27621
- // ]
27622
- // };
27623
- // } catch {}
27624
- // }
27649
+ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
27650
+ try {
27651
+ var categoryParsed = JSON.parse(pageSpecificDataStr);
27652
+ var category = new IkasCategory(categoryParsed);
27653
+ return {
27654
+ "@context": "http://schema.org",
27655
+ "@type": "BreadcrumbList",
27656
+ itemListElement: category.path.map(function (categoryPath, index) { return ({
27657
+ "@type": "ListItem",
27658
+ position: index + 1,
27659
+ name: categoryPath.name,
27660
+ item: typeof window !== undefined
27661
+ ? "https://" + window.location.hostname + categoryPath.href
27662
+ : "",
27663
+ }); }),
27664
+ };
27665
+ }
27666
+ catch (_a) { }
27667
+ }
27625
27668
 
27626
27669
  var IkasCheckoutPage = observer(function (_a) {
27627
27670
  var _b, _c, _d;
package/build/index.js CHANGED
@@ -13199,6 +13199,17 @@ var FacebookPixel = /** @class */ (function () {
13199
13199
  console.error(err);
13200
13200
  }
13201
13201
  };
13202
+ FacebookPixel.contactForm = function () {
13203
+ try {
13204
+ !isServer &&
13205
+ window.fbq &&
13206
+ window.fbq("track", "ContactForm", {});
13207
+ return;
13208
+ }
13209
+ catch (err) {
13210
+ console.error(err);
13211
+ }
13212
+ };
13202
13213
  return FacebookPixel;
13203
13214
  }());
13204
13215
  function productToFBPItem(productDetail, quantity) {
@@ -16861,6 +16872,14 @@ var Analytics = /** @class */ (function () {
16861
16872
  console.error(err);
16862
16873
  }
16863
16874
  };
16875
+ Analytics.contactForm = function () {
16876
+ try {
16877
+ FacebookPixel.contactForm();
16878
+ }
16879
+ catch (err) {
16880
+ console.error(err);
16881
+ }
16882
+ };
16864
16883
  return Analytics;
16865
16884
  }());
16866
16885
 
@@ -16946,7 +16965,9 @@ var IkasCustomerStore = /** @class */ (function () {
16946
16965
  this.saveContactForm = function (input) { return __awaiter(_this, void 0, void 0, function () {
16947
16966
  return __generator(this, function (_a) {
16948
16967
  switch (_a.label) {
16949
- case 0: return [4 /*yield*/, IkasContactFormAPI.sendContactFormToMerchant(input)];
16968
+ case 0:
16969
+ Analytics.contactForm();
16970
+ return [4 /*yield*/, IkasContactFormAPI.sendContactFormToMerchant(input)];
16950
16971
  case 1: return [2 /*return*/, _a.sent()];
16951
16972
  }
16952
16973
  });
@@ -17602,6 +17623,15 @@ var IkasProductVariantType = /** @class */ (function () {
17602
17623
  return IkasProductVariantType;
17603
17624
  }());
17604
17625
 
17626
+ var IkasProductTag = /** @class */ (function () {
17627
+ function IkasProductTag(data) {
17628
+ this.id = data.id || "";
17629
+ this.name = data.name || "";
17630
+ mobx.makeAutoObservable(this);
17631
+ }
17632
+ return IkasProductTag;
17633
+ }());
17634
+
17605
17635
  var IkasProduct = /** @class */ (function () {
17606
17636
  function IkasProduct(data) {
17607
17637
  if (data === void 0) { data = {}; }
@@ -17617,6 +17647,9 @@ var IkasProduct = /** @class */ (function () {
17617
17647
  this.categories = data.categories
17618
17648
  ? data.categories.map(function (c) { return new IkasCategory(c); })
17619
17649
  : [];
17650
+ this.tags = data.tags
17651
+ ? data.tags.map(function (tag) { return new IkasProductTag(tag); })
17652
+ : [];
17620
17653
  this.variants = data.variants
17621
17654
  ? data.variants.map(function (v) { return new IkasProductVariant(v); })
17622
17655
  : [];
@@ -25486,7 +25519,7 @@ var IkasProductSearchAPI = /** @class */ (function () {
25486
25519
  return IkasProductSearchAPI;
25487
25520
  }());
25488
25521
  function simpleToProduct(simple) {
25489
- var _a, _b, _c, _d, _e;
25522
+ var _a, _b, _c, _d, _e, _f;
25490
25523
  return new IkasProduct({
25491
25524
  id: simple.id,
25492
25525
  attributes: (_a = simple.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
@@ -25520,6 +25553,12 @@ function simpleToProduct(simple) {
25520
25553
  }),
25521
25554
  });
25522
25555
  }),
25556
+ tags: (_f = simple.tags) === null || _f === void 0 ? void 0 : _f.map(function (tag) {
25557
+ return new IkasProductTag({
25558
+ id: tag.id,
25559
+ name: tag.name,
25560
+ });
25561
+ }),
25523
25562
  description: simple.description || undefined,
25524
25563
  metaData: new IkasHTMLMetaData(simple.metaData || undefined),
25525
25564
  name: simple.name,
@@ -27479,11 +27518,9 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
27479
27518
  var categorySchema = createCategorySchema(pageSpecificDataStr);
27480
27519
  if (categorySchema)
27481
27520
  schemas.push(categorySchema);
27482
- // TODO
27483
- // const categoryBreadcrumbSchema = createCategoryBreadcrumbSchema(
27484
- // pageSpecificDataStr
27485
- // );
27486
- // if (categoryBreadcrumbSchema) schemas.push(categoryBreadcrumbSchema);
27521
+ var categoryBreadcrumbSchema = createCategoryBreadcrumbSchema(pageSpecificDataStr);
27522
+ if (categoryBreadcrumbSchema)
27523
+ schemas.push(categoryBreadcrumbSchema);
27487
27524
  }
27488
27525
  return (React.createElement(Head__default['default'], null,
27489
27526
  React.createElement("title", null, pageTitle || ""),
@@ -27536,12 +27573,16 @@ function createProductSchema(productDetail) {
27536
27573
  }
27537
27574
  }
27538
27575
  }
27576
+ var productUrl = isBrowser
27577
+ ? "https://" + window.location.hostname + productDetail.href
27578
+ : "";
27539
27579
  return {
27540
27580
  "@context": "https://schema.org/",
27541
27581
  "@type": "Product",
27542
27582
  name: productDetail.product.name,
27543
27583
  description: (_a = productDetail.product.metaData) === null || _a === void 0 ? void 0 : _a.description,
27544
27584
  image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
27585
+ productId: productDetail.selectedVariant.id,
27545
27586
  sku: productDetail.selectedVariant.sku,
27546
27587
  mpn: productDetail.selectedVariant.barcodeList.length
27547
27588
  ? productDetail.selectedVariant.barcodeList[0]
@@ -27552,7 +27593,7 @@ function createProductSchema(productDetail) {
27552
27593
  },
27553
27594
  offers: {
27554
27595
  "@type": "Offer",
27555
- url: "https://" + window.location.hostname + productDetail.href,
27596
+ url: productUrl,
27556
27597
  priceCurrency: productDetail.selectedVariant.price.currency || "TRY",
27557
27598
  price: productDetail.selectedVariant.price.finalPrice,
27558
27599
  priceValidUntil: "",
@@ -27570,10 +27611,13 @@ function createCategorySchema(pageSpecificDataStr) {
27570
27611
  try {
27571
27612
  var categoryParsed = JSON.parse(pageSpecificDataStr);
27572
27613
  var category = new IkasCategory(categoryParsed);
27614
+ var categoryUrl = typeof window !== undefined
27615
+ ? "https://" + window.location.hostname + category.href
27616
+ : "";
27573
27617
  return {
27574
27618
  "@context": "http://schema.org",
27575
27619
  "@type": "CollectionPage",
27576
- url: "https://" + window.location.hostname + category.href,
27620
+ url: categoryUrl,
27577
27621
  name: (_a = category.metaData) === null || _a === void 0 ? void 0 : _a.pageTitle,
27578
27622
  description: (_b = category.metaData) === null || _b === void 0 ? void 0 : _b.description,
27579
27623
  image: (_c = category.image) === null || _c === void 0 ? void 0 : _c.src,
@@ -27581,26 +27625,25 @@ function createCategorySchema(pageSpecificDataStr) {
27581
27625
  }
27582
27626
  catch (_d) { }
27583
27627
  }
27584
- // TODO - Waiting for CategoryParentTree feature
27585
- // https://app.clubhouse.io/ikas/story/256/schema-org-json-lar%C4%B1n%C4%B1n-t%C3%BCm-kategori-sayfalar%C4%B1na-yerle%C5%9Ftirilmesini-istiyorum
27586
- // function createCategoryBreadcrumbSchema(pageSpecificDataStr: string) {
27587
- // try {
27588
- // const categoryParsed = JSON.parse(pageSpecificDataStr) as IkasCategory;
27589
- // const category = new IkasCategory(categoryParsed);
27590
- // return {
27591
- // "@context": "http://schema.org",
27592
- // "@type": "BreadcrumbList",
27593
- // "itemListElement": [
27594
- // {
27595
- // "@type": "ListItem",
27596
- // "position": 1,
27597
- // "name": "category.name",
27598
- // "item": "https://" + window.location.hostname + "category.href"
27599
- // }
27600
- // ]
27601
- // };
27602
- // } catch {}
27603
- // }
27628
+ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
27629
+ try {
27630
+ var categoryParsed = JSON.parse(pageSpecificDataStr);
27631
+ var category = new IkasCategory(categoryParsed);
27632
+ return {
27633
+ "@context": "http://schema.org",
27634
+ "@type": "BreadcrumbList",
27635
+ itemListElement: category.path.map(function (categoryPath, index) { return ({
27636
+ "@type": "ListItem",
27637
+ position: index + 1,
27638
+ name: categoryPath.name,
27639
+ item: typeof window !== undefined
27640
+ ? "https://" + window.location.hostname + categoryPath.href
27641
+ : "",
27642
+ }); }),
27643
+ };
27644
+ }
27645
+ catch (_a) { }
27646
+ }
27604
27647
 
27605
27648
  var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
27606
27649
  var _b, _c, _d;
@@ -4,6 +4,7 @@ import { IkasProductAttributeValue } from "./attribute-value/index";
4
4
  import { IkasProductVariantType } from "./variant-type/index";
5
5
  import { IkasBrand } from "../brand/index";
6
6
  import { IkasHTMLMetaData } from "../html-meta-data/index";
7
+ import { IkasProductTag } from "../product-tag/index";
7
8
  export declare class IkasProduct {
8
9
  id: string;
9
10
  name: string;
@@ -13,6 +14,7 @@ export declare class IkasProduct {
13
14
  metaData?: IkasHTMLMetaData;
14
15
  brand: IkasBrand | null;
15
16
  categories: IkasCategory[];
17
+ tags: IkasProductTag[] | null;
16
18
  variants: IkasProductVariant[];
17
19
  attributes: IkasProductAttributeValue[];
18
20
  variantTypes: IkasProductVariantType[];
@@ -0,0 +1,5 @@
1
+ export declare class IkasProductTag {
2
+ id: string;
3
+ name: string;
4
+ constructor(data: Partial<IkasProductTag>);
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",