@ikas/storefront 0.0.165-alpha.3 → 0.0.165-alpha.5
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';
|
|
@@ -22884,6 +22885,14 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
22884
22885
|
this.checkShippingCountries();
|
|
22885
22886
|
_b.label = 2;
|
|
22886
22887
|
case 2:
|
|
22888
|
+
// Skip shipping if there is only 1 shipping method
|
|
22889
|
+
if (this.step === CheckoutStep.SHIPPING &&
|
|
22890
|
+
this.checkout.availableShippingMethods.length === 1) {
|
|
22891
|
+
this.step = CheckoutStep.PAYMENT;
|
|
22892
|
+
this.router.replace("/checkout/" + this.checkout.id + "?step=" + this.step, undefined, {
|
|
22893
|
+
shallow: true,
|
|
22894
|
+
});
|
|
22895
|
+
}
|
|
22887
22896
|
if (!(this.step === CheckoutStep.PAYMENT ||
|
|
22888
22897
|
this.step === CheckoutStep.SUCCESS)) return [3 /*break*/, 4];
|
|
22889
22898
|
return [4 /*yield*/, this.listPaymentGateways()];
|
|
@@ -24236,19 +24245,23 @@ var AnalyticsHead = function (_a) {
|
|
|
24236
24245
|
__html: "dataLayer = [{'gtm.blocklist': ['html']}];",
|
|
24237
24246
|
} })),
|
|
24238
24247
|
gtmId && (createElement("script", { dangerouslySetInnerHTML: {
|
|
24239
|
-
__html: "(function(w,
|
|
24248
|
+
__html: "(function(w,l){" +
|
|
24249
|
+
"w[l] = w[l] || [];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});" +
|
|
24250
|
+
"})(window,'dataLayer');",
|
|
24240
24251
|
} })),
|
|
24241
24252
|
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=[];
|
|
24253
|
+
__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
24254
|
} }))));
|
|
24244
24255
|
};
|
|
24245
24256
|
var AnalyticsBody = function () {
|
|
24246
24257
|
var gtmId = IkasStorefrontConfig.gtmId;
|
|
24247
24258
|
var fbpId = IkasStorefrontConfig.fbpId;
|
|
24248
24259
|
return (createElement(Fragment$1, null,
|
|
24260
|
+
gtmId && (createElement(Script, { src: "https://www.googletagmanager.com/gtm.js?id=" + gtmId })),
|
|
24249
24261
|
gtmId && (createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24250
24262
|
__html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
|
|
24251
24263
|
} })),
|
|
24264
|
+
fbpId && (createElement(Script, { src: "https://connect.facebook.net/en_US/fbevents.js" })),
|
|
24252
24265
|
fbpId && (createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24253
24266
|
__html: "<img height=\"1\" width=\"1\" style=\"display:none\" \n src=\"https://www.facebook.com/tr?id=" + fbpId + "&ev=PageView&noscript=1\"/>",
|
|
24254
24267
|
} }))));
|
|
@@ -27598,9 +27611,11 @@ var IkasNavigationLink = /** @class */ (function () {
|
|
|
27598
27611
|
}());
|
|
27599
27612
|
|
|
27600
27613
|
var IkasProductDetail = /** @class */ (function () {
|
|
27601
|
-
function IkasProductDetail(product, selectedVariantValues) {
|
|
27614
|
+
function IkasProductDetail(product, selectedVariantValues, router) {
|
|
27615
|
+
this.router = null;
|
|
27602
27616
|
this.product = new IkasProduct(product);
|
|
27603
27617
|
this.selectedVariantValues = selectedVariantValues.map(function (vv) { return new IkasVariantValue(vv); });
|
|
27618
|
+
this.router = router;
|
|
27604
27619
|
makeAutoObservable(this);
|
|
27605
27620
|
}
|
|
27606
27621
|
Object.defineProperty(IkasProductDetail.prototype, "mainVariantValue", {
|
|
@@ -27678,12 +27693,34 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27678
27693
|
configurable: true
|
|
27679
27694
|
});
|
|
27680
27695
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
27696
|
+
var _this = this;
|
|
27697
|
+
var _a;
|
|
27698
|
+
var metaData = this.product.metaData;
|
|
27681
27699
|
var selectedVariantValues = this.selectedVariantValues.map(function (vv) {
|
|
27682
27700
|
if (vv.variantTypeId === variantValue.variantTypeId)
|
|
27683
27701
|
return variantValue;
|
|
27684
27702
|
return vv;
|
|
27685
27703
|
});
|
|
27686
27704
|
this.selectedVariantValues = selectedVariantValues;
|
|
27705
|
+
var variantParams = this.product.variantTypes
|
|
27706
|
+
.map(function (pvt) {
|
|
27707
|
+
var vt = pvt.variantType;
|
|
27708
|
+
var selectedVariant = vt.values.find(function (vv) {
|
|
27709
|
+
return _this.selectedVariantValues.some(function (svv) { return svv.id === vv.id; });
|
|
27710
|
+
});
|
|
27711
|
+
if (selectedVariant)
|
|
27712
|
+
return vt.slug + "=" + selectedVariant.slug;
|
|
27713
|
+
})
|
|
27714
|
+
.filter(function (param) { return !!param; })
|
|
27715
|
+
.join("&");
|
|
27716
|
+
var newUrl = "/" + metaData.slug + "?" + variantParams;
|
|
27717
|
+
if (newUrl === window.location.pathname)
|
|
27718
|
+
return;
|
|
27719
|
+
var isShallow = process.env.NODE_ENV !== "production";
|
|
27720
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl, undefined, {
|
|
27721
|
+
shallow: isShallow,
|
|
27722
|
+
scroll: false,
|
|
27723
|
+
});
|
|
27687
27724
|
};
|
|
27688
27725
|
return IkasProductDetail;
|
|
27689
27726
|
}());
|
|
@@ -33256,16 +33293,6 @@ function createProductSchema(productDetail) {
|
|
|
33256
33293
|
var _a, _b;
|
|
33257
33294
|
try {
|
|
33258
33295
|
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
33296
|
var productUrl = isBrowser
|
|
33270
33297
|
? "https://" + window.location.hostname + productDetail.href
|
|
33271
33298
|
: "";
|
|
@@ -33895,7 +33922,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33895
33922
|
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue, router);
|
|
33896
33923
|
break;
|
|
33897
33924
|
case IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
33898
|
-
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, isBrowser);
|
|
33925
|
+
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
|
|
33899
33926
|
break;
|
|
33900
33927
|
case IkasThemeComponentPropType.PRODUCT_ATTRIBUTE:
|
|
33901
33928
|
IkasPageDataProvider.initAttributePropValue(prop, propValue, pageComponentPropValue);
|
|
@@ -33964,23 +33991,40 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33964
33991
|
IkasPageDataProvider._initProductListPropValue = function (propValue, router) {
|
|
33965
33992
|
return new IkasProductList(propValue, router);
|
|
33966
33993
|
};
|
|
33967
|
-
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, isBrowser) {
|
|
33968
|
-
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, isBrowser);
|
|
33994
|
+
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router, isBrowser) {
|
|
33995
|
+
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
33969
33996
|
};
|
|
33970
|
-
IkasPageDataProvider._initProductDetailPropValue = function (propValue, isBrowser) {
|
|
33997
|
+
IkasPageDataProvider._initProductDetailPropValue = function (propValue, router, isBrowser) {
|
|
33971
33998
|
var _propValue = propValue;
|
|
33972
33999
|
var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
|
|
33973
34000
|
if (isBrowser) {
|
|
33974
|
-
var
|
|
33975
|
-
var vid_1 =
|
|
34001
|
+
var urlParams_1 = new URLSearchParams(window.location.search);
|
|
34002
|
+
var vid_1 = urlParams_1.get("vid");
|
|
33976
34003
|
if (vid_1) {
|
|
33977
34004
|
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
33978
34005
|
if (variant) {
|
|
33979
34006
|
productDetail.selectedVariantValues = variant.variantValues;
|
|
33980
34007
|
}
|
|
33981
34008
|
}
|
|
34009
|
+
else {
|
|
34010
|
+
var productVariantTypeSlugs = productDetail.product.variantTypes.map(function (vt) { return vt.variantType.slug; });
|
|
34011
|
+
var selectedVariantValues_1 = [];
|
|
34012
|
+
productVariantTypeSlugs.forEach(function (slug, vtIndex) {
|
|
34013
|
+
var productVariantType = productDetail.product.variantTypes[vtIndex];
|
|
34014
|
+
var variantValueSlug = urlParams_1.get(slug);
|
|
34015
|
+
if (variantValueSlug) {
|
|
34016
|
+
var variantValue = productVariantType.variantType.values.find(function (v) { return v.slug === variantValueSlug; });
|
|
34017
|
+
if (variantValue)
|
|
34018
|
+
selectedVariantValues_1.push(variantValue);
|
|
34019
|
+
}
|
|
34020
|
+
});
|
|
34021
|
+
if (selectedVariantValues_1.length ===
|
|
34022
|
+
productDetail.selectedVariantValues.length) {
|
|
34023
|
+
productDetail.selectedVariantValues = selectedVariantValues_1;
|
|
34024
|
+
}
|
|
34025
|
+
}
|
|
33982
34026
|
}
|
|
33983
|
-
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues);
|
|
34027
|
+
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, router);
|
|
33984
34028
|
};
|
|
33985
34029
|
IkasPageDataProvider.initAttributePropValue = function (prop, propValue, pageComponentPropValue) {
|
|
33986
34030
|
pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initAttributePropValue(propValue);
|
|
@@ -34056,7 +34100,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
34056
34100
|
case IkasThemeComponentPropType.LINK:
|
|
34057
34101
|
return this._initLinkPropValue(propValue);
|
|
34058
34102
|
case IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
34059
|
-
return this._initProductDetailPropValue(propValue, isBrowser);
|
|
34103
|
+
return this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
34060
34104
|
case IkasThemeComponentPropType.PRODUCT_LIST:
|
|
34061
34105
|
return this._initProductListPropValue(propValue, router);
|
|
34062
34106
|
case IkasThemeComponentPropType.PRODUCT_ATTRIBUTE:
|
|
@@ -61695,7 +61739,8 @@ var Steps = observer(function (_a) {
|
|
|
61695
61739
|
createElement(StepSummaryAddress, { vm: vm }),
|
|
61696
61740
|
createElement("div", { className: styles$5.EditBtn, onClick: vm.onBackToInfoClick }, t("checkout-page:actions.edit")))) : undefined, vm.step !== CheckoutStep.INFO ? (createElement("div", { className: styles$5.AddressStepInfoMobile },
|
|
61697
61741
|
createElement(StepSummaryAddress, { vm: vm }))) : undefined),
|
|
61698
|
-
new Step(t("checkout-page:shipping"), vm.step === CheckoutStep.SHIPPING, vm.step === CheckoutStep.PAYMENT, vm.step === CheckoutStep.PAYMENT
|
|
61742
|
+
new Step(t("checkout-page:shipping"), vm.step === CheckoutStep.SHIPPING, vm.step === CheckoutStep.PAYMENT, vm.step === CheckoutStep.PAYMENT &&
|
|
61743
|
+
vm.checkout.availableShippingMethods.length > 1 ? (createElement("div", { className: styles$5.AdressStepInfo },
|
|
61699
61744
|
createElement(StepSummaryShipping, { vm: vm }),
|
|
61700
61745
|
createElement("div", { className: styles$5.EditBtn, onClick: vm.onBackToShippingClick }, t("checkout-page:actions.edit")))) : undefined, vm.step === CheckoutStep.PAYMENT ? (createElement("div", { className: styles$5.AddressStepInfoMobile },
|
|
61701
61746
|
createElement(StepSummaryShipping, { vm: vm }))) : undefined),
|
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);
|
|
@@ -22892,6 +22894,14 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
22892
22894
|
this.checkShippingCountries();
|
|
22893
22895
|
_b.label = 2;
|
|
22894
22896
|
case 2:
|
|
22897
|
+
// Skip shipping if there is only 1 shipping method
|
|
22898
|
+
if (this.step === CheckoutStep.SHIPPING &&
|
|
22899
|
+
this.checkout.availableShippingMethods.length === 1) {
|
|
22900
|
+
this.step = CheckoutStep.PAYMENT;
|
|
22901
|
+
this.router.replace("/checkout/" + this.checkout.id + "?step=" + this.step, undefined, {
|
|
22902
|
+
shallow: true,
|
|
22903
|
+
});
|
|
22904
|
+
}
|
|
22895
22905
|
if (!(this.step === CheckoutStep.PAYMENT ||
|
|
22896
22906
|
this.step === CheckoutStep.SUCCESS)) return [3 /*break*/, 4];
|
|
22897
22907
|
return [4 /*yield*/, this.listPaymentGateways()];
|
|
@@ -24244,19 +24254,23 @@ var AnalyticsHead = function (_a) {
|
|
|
24244
24254
|
__html: "dataLayer = [{'gtm.blocklist': ['html']}];",
|
|
24245
24255
|
} })),
|
|
24246
24256
|
gtmId && (React.createElement("script", { dangerouslySetInnerHTML: {
|
|
24247
|
-
__html: "(function(w,
|
|
24257
|
+
__html: "(function(w,l){" +
|
|
24258
|
+
"w[l] = w[l] || [];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});" +
|
|
24259
|
+
"})(window,'dataLayer');",
|
|
24248
24260
|
} })),
|
|
24249
24261
|
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=[];
|
|
24262
|
+
__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
24263
|
} }))));
|
|
24252
24264
|
};
|
|
24253
24265
|
var AnalyticsBody = function () {
|
|
24254
24266
|
var gtmId = IkasStorefrontConfig.gtmId;
|
|
24255
24267
|
var fbpId = IkasStorefrontConfig.fbpId;
|
|
24256
24268
|
return (React.createElement(React.Fragment, null,
|
|
24269
|
+
gtmId && (React.createElement(Script__default['default'], { src: "https://www.googletagmanager.com/gtm.js?id=" + gtmId })),
|
|
24257
24270
|
gtmId && (React.createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24258
24271
|
__html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
|
|
24259
24272
|
} })),
|
|
24273
|
+
fbpId && (React.createElement(Script__default['default'], { src: "https://connect.facebook.net/en_US/fbevents.js" })),
|
|
24260
24274
|
fbpId && (React.createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24261
24275
|
__html: "<img height=\"1\" width=\"1\" style=\"display:none\" \n src=\"https://www.facebook.com/tr?id=" + fbpId + "&ev=PageView&noscript=1\"/>",
|
|
24262
24276
|
} }))));
|
|
@@ -27581,9 +27595,11 @@ var IkasNavigationLink = /** @class */ (function () {
|
|
|
27581
27595
|
}());
|
|
27582
27596
|
|
|
27583
27597
|
var IkasProductDetail = /** @class */ (function () {
|
|
27584
|
-
function IkasProductDetail(product, selectedVariantValues) {
|
|
27598
|
+
function IkasProductDetail(product, selectedVariantValues, router) {
|
|
27599
|
+
this.router = null;
|
|
27585
27600
|
this.product = new IkasProduct(product);
|
|
27586
27601
|
this.selectedVariantValues = selectedVariantValues.map(function (vv) { return new IkasVariantValue(vv); });
|
|
27602
|
+
this.router = router;
|
|
27587
27603
|
mobx.makeAutoObservable(this);
|
|
27588
27604
|
}
|
|
27589
27605
|
Object.defineProperty(IkasProductDetail.prototype, "mainVariantValue", {
|
|
@@ -27661,12 +27677,34 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27661
27677
|
configurable: true
|
|
27662
27678
|
});
|
|
27663
27679
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
27680
|
+
var _this = this;
|
|
27681
|
+
var _a;
|
|
27682
|
+
var metaData = this.product.metaData;
|
|
27664
27683
|
var selectedVariantValues = this.selectedVariantValues.map(function (vv) {
|
|
27665
27684
|
if (vv.variantTypeId === variantValue.variantTypeId)
|
|
27666
27685
|
return variantValue;
|
|
27667
27686
|
return vv;
|
|
27668
27687
|
});
|
|
27669
27688
|
this.selectedVariantValues = selectedVariantValues;
|
|
27689
|
+
var variantParams = this.product.variantTypes
|
|
27690
|
+
.map(function (pvt) {
|
|
27691
|
+
var vt = pvt.variantType;
|
|
27692
|
+
var selectedVariant = vt.values.find(function (vv) {
|
|
27693
|
+
return _this.selectedVariantValues.some(function (svv) { return svv.id === vv.id; });
|
|
27694
|
+
});
|
|
27695
|
+
if (selectedVariant)
|
|
27696
|
+
return vt.slug + "=" + selectedVariant.slug;
|
|
27697
|
+
})
|
|
27698
|
+
.filter(function (param) { return !!param; })
|
|
27699
|
+
.join("&");
|
|
27700
|
+
var newUrl = "/" + metaData.slug + "?" + variantParams;
|
|
27701
|
+
if (newUrl === window.location.pathname)
|
|
27702
|
+
return;
|
|
27703
|
+
var isShallow = process.env.NODE_ENV !== "production";
|
|
27704
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl, undefined, {
|
|
27705
|
+
shallow: isShallow,
|
|
27706
|
+
scroll: false,
|
|
27707
|
+
});
|
|
27670
27708
|
};
|
|
27671
27709
|
return IkasProductDetail;
|
|
27672
27710
|
}());
|
|
@@ -33236,16 +33274,6 @@ function createProductSchema(productDetail) {
|
|
|
33236
33274
|
var _a, _b;
|
|
33237
33275
|
try {
|
|
33238
33276
|
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
33277
|
var productUrl = isBrowser
|
|
33250
33278
|
? "https://" + window.location.hostname + productDetail.href
|
|
33251
33279
|
: "";
|
|
@@ -33875,7 +33903,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33875
33903
|
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue, router);
|
|
33876
33904
|
break;
|
|
33877
33905
|
case exports.IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
33878
|
-
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, isBrowser);
|
|
33906
|
+
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
|
|
33879
33907
|
break;
|
|
33880
33908
|
case exports.IkasThemeComponentPropType.PRODUCT_ATTRIBUTE:
|
|
33881
33909
|
IkasPageDataProvider.initAttributePropValue(prop, propValue, pageComponentPropValue);
|
|
@@ -33944,23 +33972,40 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33944
33972
|
IkasPageDataProvider._initProductListPropValue = function (propValue, router) {
|
|
33945
33973
|
return new IkasProductList(propValue, router);
|
|
33946
33974
|
};
|
|
33947
|
-
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, isBrowser) {
|
|
33948
|
-
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, isBrowser);
|
|
33975
|
+
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router, isBrowser) {
|
|
33976
|
+
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
33949
33977
|
};
|
|
33950
|
-
IkasPageDataProvider._initProductDetailPropValue = function (propValue, isBrowser) {
|
|
33978
|
+
IkasPageDataProvider._initProductDetailPropValue = function (propValue, router, isBrowser) {
|
|
33951
33979
|
var _propValue = propValue;
|
|
33952
33980
|
var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
|
|
33953
33981
|
if (isBrowser) {
|
|
33954
|
-
var
|
|
33955
|
-
var vid_1 =
|
|
33982
|
+
var urlParams_1 = new URLSearchParams(window.location.search);
|
|
33983
|
+
var vid_1 = urlParams_1.get("vid");
|
|
33956
33984
|
if (vid_1) {
|
|
33957
33985
|
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
33958
33986
|
if (variant) {
|
|
33959
33987
|
productDetail.selectedVariantValues = variant.variantValues;
|
|
33960
33988
|
}
|
|
33961
33989
|
}
|
|
33990
|
+
else {
|
|
33991
|
+
var productVariantTypeSlugs = productDetail.product.variantTypes.map(function (vt) { return vt.variantType.slug; });
|
|
33992
|
+
var selectedVariantValues_1 = [];
|
|
33993
|
+
productVariantTypeSlugs.forEach(function (slug, vtIndex) {
|
|
33994
|
+
var productVariantType = productDetail.product.variantTypes[vtIndex];
|
|
33995
|
+
var variantValueSlug = urlParams_1.get(slug);
|
|
33996
|
+
if (variantValueSlug) {
|
|
33997
|
+
var variantValue = productVariantType.variantType.values.find(function (v) { return v.slug === variantValueSlug; });
|
|
33998
|
+
if (variantValue)
|
|
33999
|
+
selectedVariantValues_1.push(variantValue);
|
|
34000
|
+
}
|
|
34001
|
+
});
|
|
34002
|
+
if (selectedVariantValues_1.length ===
|
|
34003
|
+
productDetail.selectedVariantValues.length) {
|
|
34004
|
+
productDetail.selectedVariantValues = selectedVariantValues_1;
|
|
34005
|
+
}
|
|
34006
|
+
}
|
|
33962
34007
|
}
|
|
33963
|
-
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues);
|
|
34008
|
+
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, router);
|
|
33964
34009
|
};
|
|
33965
34010
|
IkasPageDataProvider.initAttributePropValue = function (prop, propValue, pageComponentPropValue) {
|
|
33966
34011
|
pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initAttributePropValue(propValue);
|
|
@@ -34036,7 +34081,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
34036
34081
|
case exports.IkasThemeComponentPropType.LINK:
|
|
34037
34082
|
return this._initLinkPropValue(propValue);
|
|
34038
34083
|
case exports.IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
34039
|
-
return this._initProductDetailPropValue(propValue, isBrowser);
|
|
34084
|
+
return this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
34040
34085
|
case exports.IkasThemeComponentPropType.PRODUCT_LIST:
|
|
34041
34086
|
return this._initProductListPropValue(propValue, router);
|
|
34042
34087
|
case exports.IkasThemeComponentPropType.PRODUCT_ATTRIBUTE:
|
|
@@ -61674,7 +61719,8 @@ var Steps = mobxReactLite.observer(function (_a) {
|
|
|
61674
61719
|
React.createElement(StepSummaryAddress, { vm: vm }),
|
|
61675
61720
|
React.createElement("div", { className: styles$5.EditBtn, onClick: vm.onBackToInfoClick }, t("checkout-page:actions.edit")))) : undefined, vm.step !== CheckoutStep.INFO ? (React.createElement("div", { className: styles$5.AddressStepInfoMobile },
|
|
61676
61721
|
React.createElement(StepSummaryAddress, { vm: vm }))) : undefined),
|
|
61677
|
-
new Step(t("checkout-page:shipping"), vm.step === CheckoutStep.SHIPPING, vm.step === CheckoutStep.PAYMENT, vm.step === CheckoutStep.PAYMENT
|
|
61722
|
+
new Step(t("checkout-page:shipping"), vm.step === CheckoutStep.SHIPPING, vm.step === CheckoutStep.PAYMENT, vm.step === CheckoutStep.PAYMENT &&
|
|
61723
|
+
vm.checkout.availableShippingMethods.length > 1 ? (React.createElement("div", { className: styles$5.AdressStepInfo },
|
|
61678
61724
|
React.createElement(StepSummaryShipping, { vm: vm }),
|
|
61679
61725
|
React.createElement("div", { className: styles$5.EditBtn, onClick: vm.onBackToShippingClick }, t("checkout-page:actions.edit")))) : undefined, vm.step === CheckoutStep.PAYMENT ? (React.createElement("div", { className: styles$5.AddressStepInfoMobile },
|
|
61680
61726
|
React.createElement(StepSummaryShipping, { vm: vm }))) : undefined),
|
|
@@ -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.5",
|
|
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",
|