@ikas/storefront 0.0.165-alpha.3 → 0.0.165-alpha.4
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
|
@@ -3,6 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import path$1 from 'path';
|
|
4
4
|
import getConfig from 'next/config';
|
|
5
5
|
import React, { createElement, Fragment as Fragment$1, useEffect, useState, useRef, useCallback, useMemo } from 'react';
|
|
6
|
+
import Script from 'next/script';
|
|
6
7
|
import { observer } from 'mobx-react-lite';
|
|
7
8
|
import Head from 'next/head';
|
|
8
9
|
import { useRouter } from 'next/router';
|
|
@@ -24236,19 +24237,23 @@ var AnalyticsHead = function (_a) {
|
|
|
24236
24237
|
__html: "dataLayer = [{'gtm.blocklist': ['html']}];",
|
|
24237
24238
|
} })),
|
|
24238
24239
|
gtmId && (createElement("script", { dangerouslySetInnerHTML: {
|
|
24239
|
-
__html: "(function(w,
|
|
24240
|
+
__html: "(function(w,l){" +
|
|
24241
|
+
"w[l] = w[l] || [];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});" +
|
|
24242
|
+
"})(window,'dataLayer');",
|
|
24240
24243
|
} })),
|
|
24241
24244
|
fbpId && (createElement("script", { dangerouslySetInnerHTML: {
|
|
24242
|
-
__html: "!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];
|
|
24245
|
+
__html: "!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];}(window);\n fbq('init', '" + fbpId + "');\n fbq('track', 'PageView');",
|
|
24243
24246
|
} }))));
|
|
24244
24247
|
};
|
|
24245
24248
|
var AnalyticsBody = function () {
|
|
24246
24249
|
var gtmId = IkasStorefrontConfig.gtmId;
|
|
24247
24250
|
var fbpId = IkasStorefrontConfig.fbpId;
|
|
24248
24251
|
return (createElement(Fragment$1, null,
|
|
24252
|
+
gtmId && (createElement(Script, { src: "https://www.googletagmanager.com/gtm.js?id=" + gtmId })),
|
|
24249
24253
|
gtmId && (createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24250
24254
|
__html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
|
|
24251
24255
|
} })),
|
|
24256
|
+
fbpId && (createElement(Script, { src: "https://connect.facebook.net/en_US/fbevents.js" })),
|
|
24252
24257
|
fbpId && (createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24253
24258
|
__html: "<img height=\"1\" width=\"1\" style=\"display:none\" \n src=\"https://www.facebook.com/tr?id=" + fbpId + "&ev=PageView&noscript=1\"/>",
|
|
24254
24259
|
} }))));
|
|
@@ -27598,9 +27603,11 @@ var IkasNavigationLink = /** @class */ (function () {
|
|
|
27598
27603
|
}());
|
|
27599
27604
|
|
|
27600
27605
|
var IkasProductDetail = /** @class */ (function () {
|
|
27601
|
-
function IkasProductDetail(product, selectedVariantValues) {
|
|
27606
|
+
function IkasProductDetail(product, selectedVariantValues, router) {
|
|
27607
|
+
this.router = null;
|
|
27602
27608
|
this.product = new IkasProduct(product);
|
|
27603
27609
|
this.selectedVariantValues = selectedVariantValues.map(function (vv) { return new IkasVariantValue(vv); });
|
|
27610
|
+
this.router = router;
|
|
27604
27611
|
makeAutoObservable(this);
|
|
27605
27612
|
}
|
|
27606
27613
|
Object.defineProperty(IkasProductDetail.prototype, "mainVariantValue", {
|
|
@@ -27678,12 +27685,34 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27678
27685
|
configurable: true
|
|
27679
27686
|
});
|
|
27680
27687
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
27688
|
+
var _this = this;
|
|
27689
|
+
var _a;
|
|
27690
|
+
var metaData = this.product.metaData;
|
|
27681
27691
|
var selectedVariantValues = this.selectedVariantValues.map(function (vv) {
|
|
27682
27692
|
if (vv.variantTypeId === variantValue.variantTypeId)
|
|
27683
27693
|
return variantValue;
|
|
27684
27694
|
return vv;
|
|
27685
27695
|
});
|
|
27686
27696
|
this.selectedVariantValues = selectedVariantValues;
|
|
27697
|
+
var variantParams = this.product.variantTypes
|
|
27698
|
+
.map(function (pvt) {
|
|
27699
|
+
var vt = pvt.variantType;
|
|
27700
|
+
var selectedVariant = vt.values.find(function (vv) {
|
|
27701
|
+
return _this.selectedVariantValues.some(function (svv) { return svv.id === vv.id; });
|
|
27702
|
+
});
|
|
27703
|
+
if (selectedVariant)
|
|
27704
|
+
return vt.slug + "=" + selectedVariant.slug;
|
|
27705
|
+
})
|
|
27706
|
+
.filter(function (param) { return !!param; })
|
|
27707
|
+
.join("&");
|
|
27708
|
+
var newUrl = "/" + metaData.slug + "?" + variantParams;
|
|
27709
|
+
if (newUrl === window.location.pathname)
|
|
27710
|
+
return;
|
|
27711
|
+
var isShallow = process.env.NODE_ENV !== "production";
|
|
27712
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl, undefined, {
|
|
27713
|
+
shallow: isShallow,
|
|
27714
|
+
scroll: false,
|
|
27715
|
+
});
|
|
27687
27716
|
};
|
|
27688
27717
|
return IkasProductDetail;
|
|
27689
27718
|
}());
|
|
@@ -33256,16 +33285,6 @@ function createProductSchema(productDetail) {
|
|
|
33256
33285
|
var _a, _b;
|
|
33257
33286
|
try {
|
|
33258
33287
|
var isBrowser = typeof window !== "undefined";
|
|
33259
|
-
if (isBrowser) {
|
|
33260
|
-
var urlParams = new URLSearchParams(window.location.search);
|
|
33261
|
-
var vid_1 = urlParams.get("vid");
|
|
33262
|
-
if (vid_1) {
|
|
33263
|
-
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
33264
|
-
if (variant) {
|
|
33265
|
-
productDetail.selectedVariantValues = variant.variantValues;
|
|
33266
|
-
}
|
|
33267
|
-
}
|
|
33268
|
-
}
|
|
33269
33288
|
var productUrl = isBrowser
|
|
33270
33289
|
? "https://" + window.location.hostname + productDetail.href
|
|
33271
33290
|
: "";
|
|
@@ -33895,7 +33914,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33895
33914
|
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue, router);
|
|
33896
33915
|
break;
|
|
33897
33916
|
case IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
33898
|
-
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, isBrowser);
|
|
33917
|
+
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
|
|
33899
33918
|
break;
|
|
33900
33919
|
case IkasThemeComponentPropType.PRODUCT_ATTRIBUTE:
|
|
33901
33920
|
IkasPageDataProvider.initAttributePropValue(prop, propValue, pageComponentPropValue);
|
|
@@ -33964,23 +33983,40 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33964
33983
|
IkasPageDataProvider._initProductListPropValue = function (propValue, router) {
|
|
33965
33984
|
return new IkasProductList(propValue, router);
|
|
33966
33985
|
};
|
|
33967
|
-
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, isBrowser) {
|
|
33968
|
-
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, isBrowser);
|
|
33986
|
+
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router, isBrowser) {
|
|
33987
|
+
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
33969
33988
|
};
|
|
33970
|
-
IkasPageDataProvider._initProductDetailPropValue = function (propValue, isBrowser) {
|
|
33989
|
+
IkasPageDataProvider._initProductDetailPropValue = function (propValue, router, isBrowser) {
|
|
33971
33990
|
var _propValue = propValue;
|
|
33972
33991
|
var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
|
|
33973
33992
|
if (isBrowser) {
|
|
33974
|
-
var
|
|
33975
|
-
var vid_1 =
|
|
33993
|
+
var urlParams_1 = new URLSearchParams(window.location.search);
|
|
33994
|
+
var vid_1 = urlParams_1.get("vid");
|
|
33976
33995
|
if (vid_1) {
|
|
33977
33996
|
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
33978
33997
|
if (variant) {
|
|
33979
33998
|
productDetail.selectedVariantValues = variant.variantValues;
|
|
33980
33999
|
}
|
|
33981
34000
|
}
|
|
34001
|
+
else {
|
|
34002
|
+
var productVariantTypeSlugs = productDetail.product.variantTypes.map(function (vt) { return vt.variantType.slug; });
|
|
34003
|
+
var selectedVariantValues_1 = [];
|
|
34004
|
+
productVariantTypeSlugs.forEach(function (slug, vtIndex) {
|
|
34005
|
+
var productVariantType = productDetail.product.variantTypes[vtIndex];
|
|
34006
|
+
var variantValueSlug = urlParams_1.get(slug);
|
|
34007
|
+
if (variantValueSlug) {
|
|
34008
|
+
var variantValue = productVariantType.variantType.values.find(function (v) { return v.slug === variantValueSlug; });
|
|
34009
|
+
if (variantValue)
|
|
34010
|
+
selectedVariantValues_1.push(variantValue);
|
|
34011
|
+
}
|
|
34012
|
+
});
|
|
34013
|
+
if (selectedVariantValues_1.length ===
|
|
34014
|
+
productDetail.selectedVariantValues.length) {
|
|
34015
|
+
productDetail.selectedVariantValues = selectedVariantValues_1;
|
|
34016
|
+
}
|
|
34017
|
+
}
|
|
33982
34018
|
}
|
|
33983
|
-
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues);
|
|
34019
|
+
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, router);
|
|
33984
34020
|
};
|
|
33985
34021
|
IkasPageDataProvider.initAttributePropValue = function (prop, propValue, pageComponentPropValue) {
|
|
33986
34022
|
pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initAttributePropValue(propValue);
|
|
@@ -34056,7 +34092,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
34056
34092
|
case IkasThemeComponentPropType.LINK:
|
|
34057
34093
|
return this._initLinkPropValue(propValue);
|
|
34058
34094
|
case IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
34059
|
-
return this._initProductDetailPropValue(propValue, isBrowser);
|
|
34095
|
+
return this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
34060
34096
|
case IkasThemeComponentPropType.PRODUCT_LIST:
|
|
34061
34097
|
return this._initProductListPropValue(propValue, router);
|
|
34062
34098
|
case IkasThemeComponentPropType.PRODUCT_ATTRIBUTE:
|
package/build/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var fs = require('fs');
|
|
|
7
7
|
var path$1 = require('path');
|
|
8
8
|
var getConfig = require('next/config');
|
|
9
9
|
var React = require('react');
|
|
10
|
+
var Script = require('next/script');
|
|
10
11
|
var mobxReactLite = require('mobx-react-lite');
|
|
11
12
|
var Head = require('next/head');
|
|
12
13
|
var router = require('next/router');
|
|
@@ -22,6 +23,7 @@ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
|
22
23
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1);
|
|
23
24
|
var getConfig__default = /*#__PURE__*/_interopDefaultLegacy(getConfig);
|
|
24
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
+
var Script__default = /*#__PURE__*/_interopDefaultLegacy(Script);
|
|
25
27
|
var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
|
|
26
28
|
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto$1);
|
|
27
29
|
var NextImage__default = /*#__PURE__*/_interopDefaultLegacy(NextImage);
|
|
@@ -24244,19 +24246,23 @@ var AnalyticsHead = function (_a) {
|
|
|
24244
24246
|
__html: "dataLayer = [{'gtm.blocklist': ['html']}];",
|
|
24245
24247
|
} })),
|
|
24246
24248
|
gtmId && (React.createElement("script", { dangerouslySetInnerHTML: {
|
|
24247
|
-
__html: "(function(w,
|
|
24249
|
+
__html: "(function(w,l){" +
|
|
24250
|
+
"w[l] = w[l] || [];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});" +
|
|
24251
|
+
"})(window,'dataLayer');",
|
|
24248
24252
|
} })),
|
|
24249
24253
|
fbpId && (React.createElement("script", { dangerouslySetInnerHTML: {
|
|
24250
|
-
__html: "!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];
|
|
24254
|
+
__html: "!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];}(window);\n fbq('init', '" + fbpId + "');\n fbq('track', 'PageView');",
|
|
24251
24255
|
} }))));
|
|
24252
24256
|
};
|
|
24253
24257
|
var AnalyticsBody = function () {
|
|
24254
24258
|
var gtmId = IkasStorefrontConfig.gtmId;
|
|
24255
24259
|
var fbpId = IkasStorefrontConfig.fbpId;
|
|
24256
24260
|
return (React.createElement(React.Fragment, null,
|
|
24261
|
+
gtmId && (React.createElement(Script__default['default'], { src: "https://www.googletagmanager.com/gtm.js?id=" + gtmId })),
|
|
24257
24262
|
gtmId && (React.createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24258
24263
|
__html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
|
|
24259
24264
|
} })),
|
|
24265
|
+
fbpId && (React.createElement(Script__default['default'], { src: "https://connect.facebook.net/en_US/fbevents.js" })),
|
|
24260
24266
|
fbpId && (React.createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24261
24267
|
__html: "<img height=\"1\" width=\"1\" style=\"display:none\" \n src=\"https://www.facebook.com/tr?id=" + fbpId + "&ev=PageView&noscript=1\"/>",
|
|
24262
24268
|
} }))));
|
|
@@ -27581,9 +27587,11 @@ var IkasNavigationLink = /** @class */ (function () {
|
|
|
27581
27587
|
}());
|
|
27582
27588
|
|
|
27583
27589
|
var IkasProductDetail = /** @class */ (function () {
|
|
27584
|
-
function IkasProductDetail(product, selectedVariantValues) {
|
|
27590
|
+
function IkasProductDetail(product, selectedVariantValues, router) {
|
|
27591
|
+
this.router = null;
|
|
27585
27592
|
this.product = new IkasProduct(product);
|
|
27586
27593
|
this.selectedVariantValues = selectedVariantValues.map(function (vv) { return new IkasVariantValue(vv); });
|
|
27594
|
+
this.router = router;
|
|
27587
27595
|
mobx.makeAutoObservable(this);
|
|
27588
27596
|
}
|
|
27589
27597
|
Object.defineProperty(IkasProductDetail.prototype, "mainVariantValue", {
|
|
@@ -27661,12 +27669,34 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27661
27669
|
configurable: true
|
|
27662
27670
|
});
|
|
27663
27671
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
27672
|
+
var _this = this;
|
|
27673
|
+
var _a;
|
|
27674
|
+
var metaData = this.product.metaData;
|
|
27664
27675
|
var selectedVariantValues = this.selectedVariantValues.map(function (vv) {
|
|
27665
27676
|
if (vv.variantTypeId === variantValue.variantTypeId)
|
|
27666
27677
|
return variantValue;
|
|
27667
27678
|
return vv;
|
|
27668
27679
|
});
|
|
27669
27680
|
this.selectedVariantValues = selectedVariantValues;
|
|
27681
|
+
var variantParams = this.product.variantTypes
|
|
27682
|
+
.map(function (pvt) {
|
|
27683
|
+
var vt = pvt.variantType;
|
|
27684
|
+
var selectedVariant = vt.values.find(function (vv) {
|
|
27685
|
+
return _this.selectedVariantValues.some(function (svv) { return svv.id === vv.id; });
|
|
27686
|
+
});
|
|
27687
|
+
if (selectedVariant)
|
|
27688
|
+
return vt.slug + "=" + selectedVariant.slug;
|
|
27689
|
+
})
|
|
27690
|
+
.filter(function (param) { return !!param; })
|
|
27691
|
+
.join("&");
|
|
27692
|
+
var newUrl = "/" + metaData.slug + "?" + variantParams;
|
|
27693
|
+
if (newUrl === window.location.pathname)
|
|
27694
|
+
return;
|
|
27695
|
+
var isShallow = process.env.NODE_ENV !== "production";
|
|
27696
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl, undefined, {
|
|
27697
|
+
shallow: isShallow,
|
|
27698
|
+
scroll: false,
|
|
27699
|
+
});
|
|
27670
27700
|
};
|
|
27671
27701
|
return IkasProductDetail;
|
|
27672
27702
|
}());
|
|
@@ -33236,16 +33266,6 @@ function createProductSchema(productDetail) {
|
|
|
33236
33266
|
var _a, _b;
|
|
33237
33267
|
try {
|
|
33238
33268
|
var isBrowser = typeof window !== "undefined";
|
|
33239
|
-
if (isBrowser) {
|
|
33240
|
-
var urlParams = new URLSearchParams(window.location.search);
|
|
33241
|
-
var vid_1 = urlParams.get("vid");
|
|
33242
|
-
if (vid_1) {
|
|
33243
|
-
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
33244
|
-
if (variant) {
|
|
33245
|
-
productDetail.selectedVariantValues = variant.variantValues;
|
|
33246
|
-
}
|
|
33247
|
-
}
|
|
33248
|
-
}
|
|
33249
33269
|
var productUrl = isBrowser
|
|
33250
33270
|
? "https://" + window.location.hostname + productDetail.href
|
|
33251
33271
|
: "";
|
|
@@ -33875,7 +33895,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33875
33895
|
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue, router);
|
|
33876
33896
|
break;
|
|
33877
33897
|
case exports.IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
33878
|
-
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, isBrowser);
|
|
33898
|
+
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
|
|
33879
33899
|
break;
|
|
33880
33900
|
case exports.IkasThemeComponentPropType.PRODUCT_ATTRIBUTE:
|
|
33881
33901
|
IkasPageDataProvider.initAttributePropValue(prop, propValue, pageComponentPropValue);
|
|
@@ -33944,23 +33964,40 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33944
33964
|
IkasPageDataProvider._initProductListPropValue = function (propValue, router) {
|
|
33945
33965
|
return new IkasProductList(propValue, router);
|
|
33946
33966
|
};
|
|
33947
|
-
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, isBrowser) {
|
|
33948
|
-
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, isBrowser);
|
|
33967
|
+
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router, isBrowser) {
|
|
33968
|
+
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
33949
33969
|
};
|
|
33950
|
-
IkasPageDataProvider._initProductDetailPropValue = function (propValue, isBrowser) {
|
|
33970
|
+
IkasPageDataProvider._initProductDetailPropValue = function (propValue, router, isBrowser) {
|
|
33951
33971
|
var _propValue = propValue;
|
|
33952
33972
|
var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
|
|
33953
33973
|
if (isBrowser) {
|
|
33954
|
-
var
|
|
33955
|
-
var vid_1 =
|
|
33974
|
+
var urlParams_1 = new URLSearchParams(window.location.search);
|
|
33975
|
+
var vid_1 = urlParams_1.get("vid");
|
|
33956
33976
|
if (vid_1) {
|
|
33957
33977
|
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
33958
33978
|
if (variant) {
|
|
33959
33979
|
productDetail.selectedVariantValues = variant.variantValues;
|
|
33960
33980
|
}
|
|
33961
33981
|
}
|
|
33982
|
+
else {
|
|
33983
|
+
var productVariantTypeSlugs = productDetail.product.variantTypes.map(function (vt) { return vt.variantType.slug; });
|
|
33984
|
+
var selectedVariantValues_1 = [];
|
|
33985
|
+
productVariantTypeSlugs.forEach(function (slug, vtIndex) {
|
|
33986
|
+
var productVariantType = productDetail.product.variantTypes[vtIndex];
|
|
33987
|
+
var variantValueSlug = urlParams_1.get(slug);
|
|
33988
|
+
if (variantValueSlug) {
|
|
33989
|
+
var variantValue = productVariantType.variantType.values.find(function (v) { return v.slug === variantValueSlug; });
|
|
33990
|
+
if (variantValue)
|
|
33991
|
+
selectedVariantValues_1.push(variantValue);
|
|
33992
|
+
}
|
|
33993
|
+
});
|
|
33994
|
+
if (selectedVariantValues_1.length ===
|
|
33995
|
+
productDetail.selectedVariantValues.length) {
|
|
33996
|
+
productDetail.selectedVariantValues = selectedVariantValues_1;
|
|
33997
|
+
}
|
|
33998
|
+
}
|
|
33962
33999
|
}
|
|
33963
|
-
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues);
|
|
34000
|
+
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, router);
|
|
33964
34001
|
};
|
|
33965
34002
|
IkasPageDataProvider.initAttributePropValue = function (prop, propValue, pageComponentPropValue) {
|
|
33966
34003
|
pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initAttributePropValue(propValue);
|
|
@@ -34036,7 +34073,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
34036
34073
|
case exports.IkasThemeComponentPropType.LINK:
|
|
34037
34074
|
return this._initLinkPropValue(propValue);
|
|
34038
34075
|
case exports.IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
34039
|
-
return this._initProductDetailPropValue(propValue, isBrowser);
|
|
34076
|
+
return this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
34040
34077
|
case exports.IkasThemeComponentPropType.PRODUCT_LIST:
|
|
34041
34078
|
return this._initProductListPropValue(propValue, router);
|
|
34042
34079
|
case exports.IkasThemeComponentPropType.PRODUCT_ATTRIBUTE:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { IkasProduct, IkasVariantValue } from "../../index";
|
|
2
|
+
import { NextRouter } from "next/router";
|
|
2
3
|
import { IkasProductVariant, IkasVariantType } from "../../data/index";
|
|
3
4
|
export declare class IkasProductDetail {
|
|
4
5
|
product: IkasProduct;
|
|
5
6
|
selectedVariantValues: IkasVariantValue[];
|
|
6
|
-
|
|
7
|
+
private router?;
|
|
8
|
+
constructor(product: IkasProduct, selectedVariantValues: IkasVariantValue[], router?: NextRouter);
|
|
7
9
|
get mainVariantValue(): IkasVariantValue | undefined;
|
|
8
10
|
get selectedVariant(): IkasProductVariant;
|
|
9
11
|
get href(): string;
|
|
@@ -61,8 +61,8 @@ export declare class IkasPageDataProvider {
|
|
|
61
61
|
static _initCategoryListPropValue(propValue: IkasCategoryListParams): IkasCategoryList;
|
|
62
62
|
static initProductListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue, router: NextRouter): void;
|
|
63
63
|
static _initProductListPropValue(propValue: IkasProductListParams, router: NextRouter): IkasProductList;
|
|
64
|
-
static initProductDetailPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue, isBrowser?: boolean): void;
|
|
65
|
-
static _initProductDetailPropValue(propValue: any, isBrowser?: boolean): IkasProductDetail;
|
|
64
|
+
static initProductDetailPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue, router: NextRouter, isBrowser?: boolean): void;
|
|
65
|
+
static _initProductDetailPropValue(propValue: any, router: NextRouter, isBrowser?: boolean): IkasProductDetail;
|
|
66
66
|
static initAttributePropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
|
|
67
67
|
static _initAttributePropValue(propValue: IkasProductAttributeValue[]): IkasProductAttributeValue[];
|
|
68
68
|
static initAttributeListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "0.0.165-alpha.
|
|
3
|
+
"version": "0.0.165-alpha.4",
|
|
4
4
|
"main": "./build/index.js",
|
|
5
5
|
"module": "./build/index.es.js",
|
|
6
6
|
"author": "Umut Ozan Yıldırım",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"mobx": "^6.1.3",
|
|
20
20
|
"mobx-react-lite": "^3.1.5",
|
|
21
|
-
"next": "
|
|
22
|
-
"react": "17.0.
|
|
23
|
-
"react-dom": "17.0.
|
|
21
|
+
"next": "11.1.2",
|
|
22
|
+
"react": "17.0.2",
|
|
23
|
+
"react-dom": "17.0.2"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@apollo/client": "^3.2.0",
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
"jest": "^26.4.2",
|
|
72
72
|
"mobx": "^6.1.3",
|
|
73
73
|
"mobx-react-lite": "^3.1.5",
|
|
74
|
-
"next": "
|
|
74
|
+
"next": "11.1.2",
|
|
75
75
|
"node-sass": "^5.0.0",
|
|
76
76
|
"postcss": "^8.2.4",
|
|
77
77
|
"prettier": "^2.2.1",
|
|
78
|
-
"react": "17.0.
|
|
79
|
-
"react-dom": "17.0.
|
|
78
|
+
"react": "17.0.2",
|
|
79
|
+
"react-dom": "17.0.2",
|
|
80
80
|
"rollup": "^2.38.4",
|
|
81
81
|
"rollup-plugin-copy-assets": "^2.0.3",
|
|
82
82
|
"rollup-plugin-node-polyfills": "^0.2.1",
|