@ikas/storefront 0.0.165-alpha.1 → 0.0.165-alpha.10
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/analytics/analytics.d.ts +2 -2
- package/build/analytics/facebookPixel.d.ts +2 -2
- package/build/index.es.js +172 -144
- package/build/index.js +172 -143
- package/build/utils/index.d.ts +1 -1
- package/build/utils/providers/page-data.d.ts +0 -1
- package/package.json +1 -1
|
@@ -5,10 +5,10 @@ export declare class Analytics {
|
|
|
5
5
|
constructor();
|
|
6
6
|
static pageView(url: string): void;
|
|
7
7
|
static productView(productDetail: IkasProductDetail): void;
|
|
8
|
-
static addToCart(item: IkasProductDetail | IkasOrderLineItem, quantity: number): void;
|
|
8
|
+
static addToCart(item: IkasProductDetail | IkasOrderLineItem, quantity: number, eventId: string): void;
|
|
9
9
|
static removeFromCart(item: IkasProductDetail | IkasOrderLineItem, quantity: number): void;
|
|
10
10
|
static beginCheckout(checkout: IkasCheckout): void;
|
|
11
|
-
static purchase(checkout: IkasCheckout,
|
|
11
|
+
static purchase(checkout: IkasCheckout, eventId: string): void;
|
|
12
12
|
static checkoutStep(checkout: IkasCheckout, step: CheckoutStep): void;
|
|
13
13
|
static disableHTML(): void;
|
|
14
14
|
static addToWishlist(id: string): void;
|
|
@@ -3,9 +3,9 @@ import { IkasCart } from "../models/data/cart/index";
|
|
|
3
3
|
export declare class FacebookPixel {
|
|
4
4
|
constructor();
|
|
5
5
|
static productView(productDetail: IkasProductDetail): void;
|
|
6
|
-
static addToCart(item: IkasProductDetail | IkasOrderLineItem, quantity: number): void;
|
|
6
|
+
static addToCart(item: IkasProductDetail | IkasOrderLineItem, quantity: number, eventId: string): void;
|
|
7
7
|
static beginCheckout(checkout: IkasCheckout): void;
|
|
8
|
-
static purchase(checkout: IkasCheckout,
|
|
8
|
+
static purchase(checkout: IkasCheckout, eventId: string): void;
|
|
9
9
|
static addToWishlist(id: string): void;
|
|
10
10
|
static search(searchKeyword: string): void;
|
|
11
11
|
static completeRegistration(): void;
|
package/build/index.es.js
CHANGED
|
@@ -17876,13 +17876,13 @@ var FacebookPixel = /** @class */ (function () {
|
|
|
17876
17876
|
console.error(err);
|
|
17877
17877
|
}
|
|
17878
17878
|
};
|
|
17879
|
-
FacebookPixel.addToCart = function (item, quantity) {
|
|
17879
|
+
FacebookPixel.addToCart = function (item, quantity, eventId) {
|
|
17880
17880
|
try {
|
|
17881
17881
|
!isServer &&
|
|
17882
17882
|
window.fbq &&
|
|
17883
17883
|
window.fbq("track", "AddToCart", item instanceof IkasProductDetail
|
|
17884
17884
|
? productToFBPItem(item, quantity)
|
|
17885
|
-
: orderLineItemToFBPItem(item, quantity));
|
|
17885
|
+
: orderLineItemToFBPItem(item, quantity), { eventId: eventId });
|
|
17886
17886
|
return;
|
|
17887
17887
|
}
|
|
17888
17888
|
catch (err) {
|
|
@@ -17900,11 +17900,11 @@ var FacebookPixel = /** @class */ (function () {
|
|
|
17900
17900
|
console.error(err);
|
|
17901
17901
|
}
|
|
17902
17902
|
};
|
|
17903
|
-
FacebookPixel.purchase = function (checkout,
|
|
17903
|
+
FacebookPixel.purchase = function (checkout, eventId) {
|
|
17904
17904
|
try {
|
|
17905
17905
|
!isServer &&
|
|
17906
17906
|
window.fbq &&
|
|
17907
|
-
window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout));
|
|
17907
|
+
window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventId: eventId });
|
|
17908
17908
|
return;
|
|
17909
17909
|
}
|
|
17910
17910
|
catch (err) {
|
|
@@ -22514,7 +22514,7 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
22514
22514
|
this.addItem = function (variant, product, initialQuantity) {
|
|
22515
22515
|
if (initialQuantity === void 0) { initialQuantity = 1; }
|
|
22516
22516
|
return __awaiter(_this, void 0, void 0, function () {
|
|
22517
|
-
var existingItem, input, cart, err_2;
|
|
22517
|
+
var existingItem, input, cart, eventId, err_2;
|
|
22518
22518
|
var _a, _b, _c;
|
|
22519
22519
|
return __generator(this, function (_d) {
|
|
22520
22520
|
switch (_d.label) {
|
|
@@ -22553,7 +22553,10 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
22553
22553
|
_d.sent();
|
|
22554
22554
|
_d.label = 3;
|
|
22555
22555
|
case 3:
|
|
22556
|
-
|
|
22556
|
+
if (this.cart) {
|
|
22557
|
+
eventId = this.cart.id + "-" + this.cart.updatedAt;
|
|
22558
|
+
Analytics.addToCart(new IkasProductDetail(product, variant.variantValues), initialQuantity, eventId);
|
|
22559
|
+
}
|
|
22557
22560
|
return [3 /*break*/, 5];
|
|
22558
22561
|
case 4:
|
|
22559
22562
|
err_2 = _d.sent();
|
|
@@ -22565,7 +22568,7 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
22565
22568
|
});
|
|
22566
22569
|
};
|
|
22567
22570
|
this.changeItemQuantity = function (item, quantity) { return __awaiter(_this, void 0, void 0, function () {
|
|
22568
|
-
var input, cart, oldQuantity, err_3;
|
|
22571
|
+
var input, cart, eventId, oldQuantity, err_3;
|
|
22569
22572
|
var _a, _b, _c;
|
|
22570
22573
|
return __generator(this, function (_d) {
|
|
22571
22574
|
switch (_d.label) {
|
|
@@ -22599,12 +22602,15 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
22599
22602
|
_d.label = 3;
|
|
22600
22603
|
case 3:
|
|
22601
22604
|
this.removeCardIfEmpty();
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
|
|
22607
|
-
|
|
22605
|
+
if (this.cart) {
|
|
22606
|
+
eventId = this.cart.id + "-" + this.cart.updatedAt;
|
|
22607
|
+
oldQuantity = item.quantity;
|
|
22608
|
+
if (oldQuantity > quantity) {
|
|
22609
|
+
Analytics.removeFromCart(item, oldQuantity - quantity);
|
|
22610
|
+
}
|
|
22611
|
+
else {
|
|
22612
|
+
Analytics.addToCart(item, quantity - oldQuantity, eventId);
|
|
22613
|
+
}
|
|
22608
22614
|
}
|
|
22609
22615
|
return [3 /*break*/, 5];
|
|
22610
22616
|
case 4:
|
|
@@ -22885,6 +22891,14 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
22885
22891
|
this.checkShippingCountries();
|
|
22886
22892
|
_b.label = 2;
|
|
22887
22893
|
case 2:
|
|
22894
|
+
// Skip shipping if there is only 1 shipping method
|
|
22895
|
+
if (this.step === CheckoutStep.SHIPPING &&
|
|
22896
|
+
this.checkout.availableShippingMethods.length === 1) {
|
|
22897
|
+
this.step = CheckoutStep.PAYMENT;
|
|
22898
|
+
this.router.replace("/checkout/" + this.checkout.id + "?step=" + this.step, undefined, {
|
|
22899
|
+
shallow: true,
|
|
22900
|
+
});
|
|
22901
|
+
}
|
|
22888
22902
|
if (!(this.step === CheckoutStep.PAYMENT ||
|
|
22889
22903
|
this.step === CheckoutStep.SUCCESS)) return [3 /*break*/, 4];
|
|
22890
22904
|
return [4 /*yield*/, this.listPaymentGateways()];
|
|
@@ -24100,9 +24114,9 @@ var Analytics = /** @class */ (function () {
|
|
|
24100
24114
|
console.error(err);
|
|
24101
24115
|
}
|
|
24102
24116
|
};
|
|
24103
|
-
Analytics.addToCart = function (item, quantity) {
|
|
24117
|
+
Analytics.addToCart = function (item, quantity, eventId) {
|
|
24104
24118
|
try {
|
|
24105
|
-
FacebookPixel.addToCart(item, quantity);
|
|
24119
|
+
FacebookPixel.addToCart(item, quantity, eventId);
|
|
24106
24120
|
GoogleTagManager.addToCart(item, quantity);
|
|
24107
24121
|
}
|
|
24108
24122
|
catch (err) {
|
|
@@ -24130,11 +24144,11 @@ var Analytics = /** @class */ (function () {
|
|
|
24130
24144
|
console.error(err);
|
|
24131
24145
|
}
|
|
24132
24146
|
};
|
|
24133
|
-
Analytics.purchase = function (checkout,
|
|
24147
|
+
Analytics.purchase = function (checkout, eventId) {
|
|
24134
24148
|
try {
|
|
24135
24149
|
localStorage.removeItem(LS_BEGIN_CHECKOUT_KEY);
|
|
24136
|
-
FacebookPixel.purchase(checkout,
|
|
24137
|
-
GoogleTagManager.purchase(checkout,
|
|
24150
|
+
FacebookPixel.purchase(checkout, eventId);
|
|
24151
|
+
GoogleTagManager.purchase(checkout, eventId);
|
|
24138
24152
|
}
|
|
24139
24153
|
catch (err) {
|
|
24140
24154
|
console.error(err);
|
|
@@ -24236,11 +24250,13 @@ var AnalyticsHead = function (_a) {
|
|
|
24236
24250
|
blockHTML && (createElement("script", { dangerouslySetInnerHTML: {
|
|
24237
24251
|
__html: "dataLayer = [{'gtm.blocklist': ['html']}];",
|
|
24238
24252
|
} })),
|
|
24253
|
+
gtmId && (createElement(Script, { src: "https://www.googletagmanager.com/gtm.js?id=" + gtmId })),
|
|
24239
24254
|
gtmId && (createElement("script", { dangerouslySetInnerHTML: {
|
|
24240
24255
|
__html: "(function(w,l){" +
|
|
24241
24256
|
"w[l] = w[l] || [];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});" +
|
|
24242
24257
|
"})(window,'dataLayer');",
|
|
24243
24258
|
} })),
|
|
24259
|
+
fbpId && (createElement(Script, { src: "https://connect.facebook.net/en_US/fbevents.js" })),
|
|
24244
24260
|
fbpId && (createElement("script", { dangerouslySetInnerHTML: {
|
|
24245
24261
|
__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');",
|
|
24246
24262
|
} }))));
|
|
@@ -24249,11 +24265,9 @@ var AnalyticsBody = function () {
|
|
|
24249
24265
|
var gtmId = IkasStorefrontConfig.gtmId;
|
|
24250
24266
|
var fbpId = IkasStorefrontConfig.fbpId;
|
|
24251
24267
|
return (createElement(Fragment$1, null,
|
|
24252
|
-
gtmId && (createElement(Script, { src: "https://www.googletagmanager.com/gtm.js?id=" + gtmId })),
|
|
24253
24268
|
gtmId && (createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24254
24269
|
__html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
|
|
24255
24270
|
} })),
|
|
24256
|
-
fbpId && (createElement(Script, { src: "https://connect.facebook.net/en_US/fbevents.js" })),
|
|
24257
24271
|
fbpId && (createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24258
24272
|
__html: "<img height=\"1\" width=\"1\" style=\"display:none\" \n src=\"https://www.facebook.com/tr?id=" + fbpId + "&ev=PageView&noscript=1\"/>",
|
|
24259
24273
|
} }))));
|
|
@@ -24950,11 +24964,15 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
24950
24964
|
};
|
|
24951
24965
|
IkasCustomerStore.prototype.onProductView = function (productId, variantId) {
|
|
24952
24966
|
return __awaiter(this, void 0, void 0, function () {
|
|
24953
|
-
var isSuccess;
|
|
24967
|
+
var existingItem, isSuccess;
|
|
24954
24968
|
return __generator(this, function (_a) {
|
|
24955
24969
|
switch (_a.label) {
|
|
24956
24970
|
case 0:
|
|
24957
24971
|
if (!this.customer) return [3 /*break*/, 2];
|
|
24972
|
+
existingItem = this._lastViewedProducts.find(function (lvp) { return lvp.productId === productId; });
|
|
24973
|
+
if (existingItem) {
|
|
24974
|
+
return [2 /*return*/];
|
|
24975
|
+
}
|
|
24958
24976
|
return [4 /*yield*/, IkasCustomerAPI.saveLastViewedProducts({
|
|
24959
24977
|
customerId: this.customer.id,
|
|
24960
24978
|
products: [
|
|
@@ -27635,15 +27653,25 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27635
27653
|
});
|
|
27636
27654
|
Object.defineProperty(IkasProductDetail.prototype, "href", {
|
|
27637
27655
|
get: function () {
|
|
27656
|
+
var _this = this;
|
|
27638
27657
|
var metaData = this.product.metaData;
|
|
27639
27658
|
if (!(metaData === null || metaData === void 0 ? void 0 : metaData.slug))
|
|
27640
27659
|
return "";
|
|
27641
|
-
|
|
27642
|
-
|
|
27643
|
-
|
|
27644
|
-
|
|
27645
|
-
|
|
27646
|
-
|
|
27660
|
+
var variantParams = this.product.variantTypes
|
|
27661
|
+
.map(function (pvt) {
|
|
27662
|
+
var vt = pvt.variantType;
|
|
27663
|
+
var selectedVariant = vt.values.find(function (vv) {
|
|
27664
|
+
return _this.selectedVariantValues.some(function (svv) { return svv.id === vv.id; });
|
|
27665
|
+
});
|
|
27666
|
+
if (selectedVariant)
|
|
27667
|
+
return vt.slug + "=" + selectedVariant.slug;
|
|
27668
|
+
})
|
|
27669
|
+
.filter(function (param) { return !!param; })
|
|
27670
|
+
.join("&");
|
|
27671
|
+
if (variantParams)
|
|
27672
|
+
return "/" + metaData.slug + "?" + variantParams;
|
|
27673
|
+
else
|
|
27674
|
+
return "/" + metaData.slug;
|
|
27647
27675
|
},
|
|
27648
27676
|
enumerable: false,
|
|
27649
27677
|
configurable: true
|
|
@@ -27690,6 +27718,7 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27690
27718
|
configurable: true
|
|
27691
27719
|
});
|
|
27692
27720
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
27721
|
+
var _this = this;
|
|
27693
27722
|
var _a;
|
|
27694
27723
|
var metaData = this.product.metaData;
|
|
27695
27724
|
var selectedVariantValues = this.selectedVariantValues.map(function (vv) {
|
|
@@ -27698,9 +27727,20 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27698
27727
|
return vv;
|
|
27699
27728
|
});
|
|
27700
27729
|
this.selectedVariantValues = selectedVariantValues;
|
|
27701
|
-
var
|
|
27702
|
-
.map(function (
|
|
27703
|
-
.
|
|
27730
|
+
var variantParams = this.product.variantTypes
|
|
27731
|
+
.map(function (pvt) {
|
|
27732
|
+
var vt = pvt.variantType;
|
|
27733
|
+
var selectedVariant = vt.values.find(function (vv) {
|
|
27734
|
+
return _this.selectedVariantValues.some(function (svv) { return svv.id === vv.id; });
|
|
27735
|
+
});
|
|
27736
|
+
if (selectedVariant)
|
|
27737
|
+
return vt.slug + "=" + selectedVariant.slug;
|
|
27738
|
+
})
|
|
27739
|
+
.filter(function (param) { return !!param; })
|
|
27740
|
+
.join("&");
|
|
27741
|
+
var newUrl = "/" + metaData.slug;
|
|
27742
|
+
if (variantParams)
|
|
27743
|
+
newUrl = "/" + metaData.slug + "?" + variantParams;
|
|
27704
27744
|
if (newUrl === window.location.pathname)
|
|
27705
27745
|
return;
|
|
27706
27746
|
var isShallow = process.env.NODE_ENV !== "production";
|
|
@@ -33280,15 +33320,33 @@ function createProductSchema(productDetail) {
|
|
|
33280
33320
|
var _a, _b;
|
|
33281
33321
|
try {
|
|
33282
33322
|
var isBrowser = typeof window !== "undefined";
|
|
33323
|
+
// TODO this code copy-pasted, organize this block
|
|
33283
33324
|
if (isBrowser) {
|
|
33284
|
-
var
|
|
33285
|
-
var vid_1 =
|
|
33325
|
+
var urlParams_1 = new URLSearchParams(window.location.search);
|
|
33326
|
+
var vid_1 = urlParams_1.get("vid");
|
|
33286
33327
|
if (vid_1) {
|
|
33287
33328
|
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
33288
33329
|
if (variant) {
|
|
33289
33330
|
productDetail.selectedVariantValues = variant.variantValues;
|
|
33290
33331
|
}
|
|
33291
33332
|
}
|
|
33333
|
+
else {
|
|
33334
|
+
var productVariantTypeSlugs = productDetail.product.variantTypes.map(function (vt) { return vt.variantType.slug; });
|
|
33335
|
+
var selectedVariantValues_1 = [];
|
|
33336
|
+
productVariantTypeSlugs.forEach(function (slug, vtIndex) {
|
|
33337
|
+
var productVariantType = productDetail.product.variantTypes[vtIndex];
|
|
33338
|
+
var variantValueSlug = urlParams_1.get(slug);
|
|
33339
|
+
if (variantValueSlug) {
|
|
33340
|
+
var variantValue = productVariantType.variantType.values.find(function (v) { return v.slug === variantValueSlug; });
|
|
33341
|
+
if (variantValue)
|
|
33342
|
+
selectedVariantValues_1.push(variantValue);
|
|
33343
|
+
}
|
|
33344
|
+
});
|
|
33345
|
+
if (selectedVariantValues_1.length ===
|
|
33346
|
+
productDetail.selectedVariantValues.length) {
|
|
33347
|
+
productDetail.selectedVariantValues = selectedVariantValues_1;
|
|
33348
|
+
}
|
|
33349
|
+
}
|
|
33292
33350
|
}
|
|
33293
33351
|
var productUrl = isBrowser
|
|
33294
33352
|
? "https://" + window.location.hostname + productDetail.href
|
|
@@ -33555,7 +33613,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33555
33613
|
IkasPageDataProvider.prototype.getPageSpecificData = function () {
|
|
33556
33614
|
var _a, _b;
|
|
33557
33615
|
return __awaiter(this, void 0, void 0, function () {
|
|
33558
|
-
var slug, metaDataList, metaData, handleBrandPage, handleCategoryPage, handleBlogPage, handleBlogCategoryPage, _c;
|
|
33616
|
+
var slug, metaDataList, metaData, handleProductPage, handleBrandPage, handleCategoryPage, handleBlogPage, handleBlogCategoryPage, _c;
|
|
33559
33617
|
var _this = this;
|
|
33560
33618
|
return __generator(this, function (_d) {
|
|
33561
33619
|
switch (_d.label) {
|
|
@@ -33584,12 +33642,47 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33584
33642
|
case 2: return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData(slug)];
|
|
33585
33643
|
case 3:
|
|
33586
33644
|
metaDataList = _d.sent();
|
|
33587
|
-
if (!metaDataList || !metaDataList.length)
|
|
33588
|
-
return [2 /*return
|
|
33589
|
-
}
|
|
33645
|
+
if (!metaDataList || !metaDataList.length)
|
|
33646
|
+
return [2 /*return*/];
|
|
33590
33647
|
_d.label = 4;
|
|
33591
33648
|
case 4:
|
|
33592
33649
|
metaData = metaDataList[0];
|
|
33650
|
+
if (!metaData.targetId)
|
|
33651
|
+
return [2 /*return*/];
|
|
33652
|
+
handleProductPage = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
33653
|
+
var productsResponse, product, displayedVariantType, inStockVariant;
|
|
33654
|
+
return __generator(this, function (_a) {
|
|
33655
|
+
switch (_a.label) {
|
|
33656
|
+
case 0: return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
33657
|
+
productIdList: [metaData.targetId],
|
|
33658
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
33659
|
+
salesChannelId: IkasStorefrontConfig.salesChannelId,
|
|
33660
|
+
})];
|
|
33661
|
+
case 1:
|
|
33662
|
+
productsResponse = _a.sent();
|
|
33663
|
+
if (!(productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data.length)) {
|
|
33664
|
+
return [2 /*return*/];
|
|
33665
|
+
}
|
|
33666
|
+
product = productsResponse.data[0];
|
|
33667
|
+
this.pageSpecificData = new IkasProductDetail(product, product.variants[0].variantValues);
|
|
33668
|
+
// Select the first displayed in stock variant
|
|
33669
|
+
if (this.pageSpecificData.displayedVariantTypes.length) {
|
|
33670
|
+
displayedVariantType = this
|
|
33671
|
+
.pageSpecificData.displayedVariantTypes[0];
|
|
33672
|
+
if (displayedVariantType.displayedVariantValues.length) {
|
|
33673
|
+
inStockVariant = displayedVariantType.displayedVariantValues.find(function (dvv) { return dvv.hasStock; });
|
|
33674
|
+
if (inStockVariant) {
|
|
33675
|
+
this.pageSpecificData.selectedVariantValues =
|
|
33676
|
+
inStockVariant.variant.variantValues;
|
|
33677
|
+
}
|
|
33678
|
+
}
|
|
33679
|
+
}
|
|
33680
|
+
this.pageType = IkasThemePageType.PRODUCT;
|
|
33681
|
+
this.setPageMetaData(metaData);
|
|
33682
|
+
return [2 /*return*/];
|
|
33683
|
+
}
|
|
33684
|
+
});
|
|
33685
|
+
}); };
|
|
33593
33686
|
handleBrandPage = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
33594
33687
|
var brandsResponse, brand;
|
|
33595
33688
|
return __generator(this, function (_a) {
|
|
@@ -33681,7 +33774,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33681
33774
|
case 6: return [2 /*return*/, _d.sent()];
|
|
33682
33775
|
case 7: return [4 /*yield*/, handleCategoryPage()];
|
|
33683
33776
|
case 8: return [2 /*return*/, _d.sent()];
|
|
33684
|
-
case 9: return [4 /*yield*/,
|
|
33777
|
+
case 9: return [4 /*yield*/, handleProductPage()];
|
|
33685
33778
|
case 10: return [2 /*return*/, _d.sent()];
|
|
33686
33779
|
case 11: return [4 /*yield*/, handleBlogPage()];
|
|
33687
33780
|
case 12: return [2 /*return*/, _d.sent()];
|
|
@@ -33693,91 +33786,6 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33693
33786
|
});
|
|
33694
33787
|
});
|
|
33695
33788
|
};
|
|
33696
|
-
IkasPageDataProvider.prototype.getPageSpecificProduct = function () {
|
|
33697
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
33698
|
-
var slug, getProductMetaData, metaDataResponse, productsResponse, product, isMainProductSlug, selectedVariantValues, variantSlugPart, _i, _a, variant, values, slugPart, displayedVariantType, inStockVariant;
|
|
33699
|
-
var _this = this;
|
|
33700
|
-
return __generator(this, function (_b) {
|
|
33701
|
-
switch (_b.label) {
|
|
33702
|
-
case 0:
|
|
33703
|
-
slug = this.pageParams.slug;
|
|
33704
|
-
if (!slug) {
|
|
33705
|
-
console.log("Slug not found for getPageSpecificProduct");
|
|
33706
|
-
}
|
|
33707
|
-
getProductMetaData = function (slug) { return __awaiter(_this, void 0, void 0, function () {
|
|
33708
|
-
var metaDataList, splitParts, newSlug;
|
|
33709
|
-
return __generator(this, function (_a) {
|
|
33710
|
-
switch (_a.label) {
|
|
33711
|
-
case 0:
|
|
33712
|
-
if (!slug)
|
|
33713
|
-
return [2 /*return*/];
|
|
33714
|
-
return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData(slug)];
|
|
33715
|
-
case 1:
|
|
33716
|
-
metaDataList = _a.sent();
|
|
33717
|
-
if (!(!metaDataList || !metaDataList.length)) return [3 /*break*/, 3];
|
|
33718
|
-
splitParts = slug.split("-");
|
|
33719
|
-
newSlug = splitParts.slice(0, splitParts.length - 1).join("-");
|
|
33720
|
-
return [4 /*yield*/, getProductMetaData(newSlug)];
|
|
33721
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
33722
|
-
case 3: return [2 /*return*/, {
|
|
33723
|
-
metaData: metaDataList[0],
|
|
33724
|
-
slug: slug,
|
|
33725
|
-
}];
|
|
33726
|
-
}
|
|
33727
|
-
});
|
|
33728
|
-
}); };
|
|
33729
|
-
return [4 /*yield*/, getProductMetaData(slug)];
|
|
33730
|
-
case 1:
|
|
33731
|
-
metaDataResponse = _b.sent();
|
|
33732
|
-
if (!metaDataResponse)
|
|
33733
|
-
return [2 /*return*/];
|
|
33734
|
-
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
33735
|
-
productIdList: [metaDataResponse.metaData.targetId],
|
|
33736
|
-
priceListId: IkasStorefrontConfig.priceListId,
|
|
33737
|
-
salesChannelId: IkasStorefrontConfig.salesChannelId,
|
|
33738
|
-
})];
|
|
33739
|
-
case 2:
|
|
33740
|
-
productsResponse = _b.sent();
|
|
33741
|
-
if (!(productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data.length))
|
|
33742
|
-
return [2 /*return*/];
|
|
33743
|
-
product = productsResponse.data[0];
|
|
33744
|
-
isMainProductSlug = slug.length === metaDataResponse.slug.length;
|
|
33745
|
-
selectedVariantValues = [];
|
|
33746
|
-
if (!isMainProductSlug) {
|
|
33747
|
-
variantSlugPart = slug.slice(metaDataResponse.slug.length + 1);
|
|
33748
|
-
for (_i = 0, _a = product.variants; _i < _a.length; _i++) {
|
|
33749
|
-
variant = _a[_i];
|
|
33750
|
-
values = variant.variantValues;
|
|
33751
|
-
slugPart = values.map(function (vv) { return vv.slug; }).join("-");
|
|
33752
|
-
if (slugPart === variantSlugPart) {
|
|
33753
|
-
selectedVariantValues = values;
|
|
33754
|
-
break;
|
|
33755
|
-
}
|
|
33756
|
-
}
|
|
33757
|
-
}
|
|
33758
|
-
this.pageSpecificData = new IkasProductDetail(product, selectedVariantValues.length
|
|
33759
|
-
? selectedVariantValues
|
|
33760
|
-
: product.variants[0].variantValues);
|
|
33761
|
-
// Select the first displayed in stock variant
|
|
33762
|
-
if (!selectedVariantValues.length &&
|
|
33763
|
-
this.pageSpecificData.displayedVariantTypes.length) {
|
|
33764
|
-
displayedVariantType = this.pageSpecificData
|
|
33765
|
-
.displayedVariantTypes[0];
|
|
33766
|
-
if (displayedVariantType.displayedVariantValues.length) {
|
|
33767
|
-
inStockVariant = displayedVariantType.displayedVariantValues.find(function (dvv) { return dvv.hasStock; });
|
|
33768
|
-
if (inStockVariant) {
|
|
33769
|
-
this.pageSpecificData.selectedVariantValues =
|
|
33770
|
-
inStockVariant.variant.variantValues;
|
|
33771
|
-
}
|
|
33772
|
-
}
|
|
33773
|
-
}
|
|
33774
|
-
this.pageType = IkasThemePageType.PRODUCT;
|
|
33775
|
-
this.setPageMetaData(metaDataResponse.metaData);
|
|
33776
|
-
return [2 /*return*/];
|
|
33777
|
-
}
|
|
33778
|
-
});
|
|
33779
|
-
});
|
|
33780
|
-
};
|
|
33781
33789
|
IkasPageDataProvider.prototype.getPageComponentPropValues = function (pageComponent) {
|
|
33782
33790
|
return __awaiter(this, void 0, void 0, function () {
|
|
33783
33791
|
var component, result, setPageComponentPropValue;
|
|
@@ -34045,14 +34053,31 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
34045
34053
|
var _propValue = propValue;
|
|
34046
34054
|
var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
|
|
34047
34055
|
if (isBrowser) {
|
|
34048
|
-
var
|
|
34049
|
-
var vid_1 =
|
|
34056
|
+
var urlParams_1 = new URLSearchParams(window.location.search);
|
|
34057
|
+
var vid_1 = urlParams_1.get("vid");
|
|
34050
34058
|
if (vid_1) {
|
|
34051
34059
|
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
34052
34060
|
if (variant) {
|
|
34053
34061
|
productDetail.selectedVariantValues = variant.variantValues;
|
|
34054
34062
|
}
|
|
34055
34063
|
}
|
|
34064
|
+
else {
|
|
34065
|
+
var productVariantTypeSlugs = productDetail.product.variantTypes.map(function (vt) { return vt.variantType.slug; });
|
|
34066
|
+
var selectedVariantValues_1 = [];
|
|
34067
|
+
productVariantTypeSlugs.forEach(function (slug, vtIndex) {
|
|
34068
|
+
var productVariantType = productDetail.product.variantTypes[vtIndex];
|
|
34069
|
+
var variantValueSlug = urlParams_1.get(slug);
|
|
34070
|
+
if (variantValueSlug) {
|
|
34071
|
+
var variantValue = productVariantType.variantType.values.find(function (v) { return v.slug === variantValueSlug; });
|
|
34072
|
+
if (variantValue)
|
|
34073
|
+
selectedVariantValues_1.push(variantValue);
|
|
34074
|
+
}
|
|
34075
|
+
});
|
|
34076
|
+
if (selectedVariantValues_1.length ===
|
|
34077
|
+
productDetail.selectedVariantValues.length) {
|
|
34078
|
+
productDetail.selectedVariantValues = selectedVariantValues_1;
|
|
34079
|
+
}
|
|
34080
|
+
}
|
|
34056
34081
|
}
|
|
34057
34082
|
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, router);
|
|
34058
34083
|
};
|
|
@@ -61323,6 +61348,7 @@ var StepSuccess = observer(function (_a) {
|
|
|
61323
61348
|
var t = useTranslation().t;
|
|
61324
61349
|
var _f = useState(false), isContactModalVisible = _f[0], setContactModalVisible = _f[1];
|
|
61325
61350
|
useEffect(function () {
|
|
61351
|
+
var _a;
|
|
61326
61352
|
if (typeof localStorage !== "undefined") {
|
|
61327
61353
|
var lsCartId = localStorage.getItem(CART_LS_KEY);
|
|
61328
61354
|
var lsCheckoutId = localStorage.getItem(CHECKOUT_LS_KEY);
|
|
@@ -61331,7 +61357,7 @@ var StepSuccess = observer(function (_a) {
|
|
|
61331
61357
|
if (lsCheckoutId && lsCheckoutId === vm.checkout.id)
|
|
61332
61358
|
localStorage.removeItem(CHECKOUT_LS_KEY);
|
|
61333
61359
|
}
|
|
61334
|
-
Analytics.purchase(vm.checkout, vm.
|
|
61360
|
+
Analytics.purchase(vm.checkout, ((_a = vm.successTransaction) === null || _a === void 0 ? void 0 : _a.id) || "");
|
|
61335
61361
|
}, []);
|
|
61336
61362
|
var customerName = (((_b = vm.checkout.customer) === null || _b === void 0 ? void 0 : _b.firstName) || "") +
|
|
61337
61363
|
" " +
|
|
@@ -61549,13 +61575,30 @@ var OrderStatus = observer(function (_a) {
|
|
|
61549
61575
|
})) === null || _d === void 0 ? void 0 : _d.text : ""));
|
|
61550
61576
|
});
|
|
61551
61577
|
|
|
61578
|
+
var IMAGE_SIZES = [
|
|
61579
|
+
180,
|
|
61580
|
+
360,
|
|
61581
|
+
540,
|
|
61582
|
+
720,
|
|
61583
|
+
900,
|
|
61584
|
+
1080,
|
|
61585
|
+
1296,
|
|
61586
|
+
1512,
|
|
61587
|
+
1728,
|
|
61588
|
+
1950,
|
|
61589
|
+
2560,
|
|
61590
|
+
3840,
|
|
61591
|
+
];
|
|
61552
61592
|
var Image = function (_a) {
|
|
61553
61593
|
var image = _a.image, others = __rest(_a, ["image"]);
|
|
61554
61594
|
var loader = function (_a) {
|
|
61555
61595
|
var width = _a.width;
|
|
61556
|
-
|
|
61596
|
+
var closest = IMAGE_SIZES.reduce(function (prev, curr) {
|
|
61597
|
+
return Math.abs(curr - width) < Math.abs(prev - width) ? curr : prev;
|
|
61598
|
+
});
|
|
61599
|
+
return image.getSrc(closest);
|
|
61557
61600
|
};
|
|
61558
|
-
return (createElement(NextImage, __assign({}, others, { loader: loader, quality: 100, src: image.src, alt: others.alt || "Image" })));
|
|
61601
|
+
return (createElement(NextImage, __assign({}, others, { loader: loader, quality: 100, src: image.src, alt: others.alt || "Image", unoptimized: true })));
|
|
61559
61602
|
};
|
|
61560
61603
|
|
|
61561
61604
|
var css_248z$m = ".style-module_StepContainer__1O2dD {\n width: 100%; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA {\n width: 100%; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 {\n padding: 24px 0;\n border-top: 1px solid var(--checkout-border-color); }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2.style-module_First__cAzdJ {\n border-top: none; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitleTop__3zfsj {\n display: flex;\n align-items: center; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitleTop__3zfsj.style-module_WithRightContent__2fqb1 {\n align-items: flex-start; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepCircle__36A5q {\n width: 32px;\n height: 32px;\n border-radius: 100%;\n border: 1px solid var(--checkout-button-bg-color);\n color: var(--checkout-button-bg-color);\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 16px;\n flex: 0 0 auto;\n font-size: 20px; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepCircle__36A5q.style-module_Selected__3j91L {\n background-color: var(--checkout-button-bg-color);\n color: var(--checkout-button-text-color); }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepCircle__36A5q.style-module_Selected__3j91L svg {\n transform: scale(1.5);\n position: relative;\n right: -1px; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitle__10YDP {\n font-size: 22px;\n color: var(--checkout-primary-text-color);\n flex: 0 0 auto;\n font-weight: 600;\n line-height: 32px; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitle__10YDP.style-module_Light__15wSX {\n color: var(--checkout-button-disabled-text-color); }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitleRightContent__2Q43m {\n flex: 1 1 auto; }\n .style-module_StepContainer__1O2dD .style-module_StepContent__20QIi {\n padding-bottom: 24px;\n padding-left: 48px;\n width: 100%; }\n @media only screen and (max-width: 1000px) {\n .style-module_StepContainer__1O2dD {\n padding: 0 24px; }\n .style-module_StepContainer__1O2dD .style-module_StepContent__20QIi {\n padding-left: 0px; } }\n";
|
|
@@ -61771,7 +61814,7 @@ var Steps = observer(function (_a) {
|
|
|
61771
61814
|
createElement(StepSummaryAddress, { vm: vm }))) : undefined),
|
|
61772
61815
|
new Step(t("checkout-page:shipping"), vm.step === CheckoutStep.SHIPPING, vm.step === CheckoutStep.PAYMENT, vm.step === CheckoutStep.PAYMENT ? (createElement("div", { className: styles$5.AdressStepInfo },
|
|
61773
61816
|
createElement(StepSummaryShipping, { vm: vm }),
|
|
61774
|
-
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 },
|
|
61817
|
+
vm.checkout.availableShippingMethods.length > 1 && (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 },
|
|
61775
61818
|
createElement(StepSummaryShipping, { vm: vm }))) : undefined),
|
|
61776
61819
|
new Step(t("checkout-page:payment"), vm.step === CheckoutStep.PAYMENT, false),
|
|
61777
61820
|
];
|
|
@@ -62320,21 +62363,6 @@ var Page$1 = function (_a) {
|
|
|
62320
62363
|
var index$1 = observer(Page$1);
|
|
62321
62364
|
var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
62322
62365
|
return __generator(this, function (_a) {
|
|
62323
|
-
// const targetTypes = [
|
|
62324
|
-
// IkasHTMLMetaDataTargetType.BRAND,
|
|
62325
|
-
// IkasHTMLMetaDataTargetType.CATEGORY,
|
|
62326
|
-
// ];
|
|
62327
|
-
// const metaData = await IkasHTMLMetaDataAPI.listHTMLMetaData(
|
|
62328
|
-
// undefined,
|
|
62329
|
-
// undefined,
|
|
62330
|
-
// targetTypes
|
|
62331
|
-
// );
|
|
62332
|
-
// metaData.map((m) => ({
|
|
62333
|
-
// params: {
|
|
62334
|
-
// slug: m.slug,
|
|
62335
|
-
// originalSlug: m.slug,
|
|
62336
|
-
// },
|
|
62337
|
-
// }))
|
|
62338
62366
|
return [2 /*return*/, {
|
|
62339
62367
|
paths: [],
|
|
62340
62368
|
fallback: "blocking",
|
|
@@ -63344,4 +63372,4 @@ var en$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Ob
|
|
|
63344
63372
|
'default': en
|
|
63345
63373
|
}));
|
|
63346
63374
|
|
|
63347
|
-
export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, index$5 as BlogPage, _slug_$2 as BlogSlugPage, cart as CartPage, _id_$1 as CheckoutPage, ContactForm, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBlog, IkasBlogAPI, IkasBlogCategory, IkasBlogCategoryList, IkasBlogCategoryListPropValue, IkasBlogCategoryListType, IkasBlogCategoryPropValue, IkasBlogContent, IkasBlogList, IkasBlogListPropValue, IkasBlogListType, IkasBlogMetaData, IkasBlogMetadataTargetType, IkasBlogPropValue, IkasBlogTag, IkasBlogWriter, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasComponentRenderer, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderRefundSettings, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeType, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontConfig, IkasTheme, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$2 as OrderDetailPage, OrderLineItemStatusEnum$1 as OrderLineItemStatusEnum, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, findAllIndexes, formatDate, formatMoney, getPlaceholderBlog, getPlaceholderBlogCategory, getPlaceholderBrand, getPlaceholderCategory, getPlaceholderProduct, parseRangeStr, pascalCase, stringSorter, stringToSlug, useTranslation, validatePhoneNumber };
|
|
63375
|
+
export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, index$5 as BlogPage, _slug_$2 as BlogSlugPage, cart as CartPage, _id_$1 as CheckoutPage, ContactForm, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBlog, IkasBlogAPI, IkasBlogCategory, IkasBlogCategoryList, IkasBlogCategoryListPropValue, IkasBlogCategoryListType, IkasBlogCategoryPropValue, IkasBlogContent, IkasBlogList, IkasBlogListPropValue, IkasBlogListType, IkasBlogMetaData, IkasBlogMetadataTargetType, IkasBlogPropValue, IkasBlogTag, IkasBlogWriter, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasComponentRenderer, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderRefundSettings, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeType, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontConfig, IkasTheme, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$2 as OrderDetailPage, OrderLineItemStatusEnum$1 as OrderLineItemStatusEnum, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, createTranslationInputData, decodeBase64, findAllIndexes, formatDate, formatMoney, getPlaceholderBlog, getPlaceholderBlogCategory, getPlaceholderBrand, getPlaceholderCategory, getPlaceholderProduct, parseRangeStr, pascalCase, stringSorter, stringToSlug, useTranslation, validatePhoneNumber };
|
package/build/index.js
CHANGED
|
@@ -17885,13 +17885,13 @@ var FacebookPixel = /** @class */ (function () {
|
|
|
17885
17885
|
console.error(err);
|
|
17886
17886
|
}
|
|
17887
17887
|
};
|
|
17888
|
-
FacebookPixel.addToCart = function (item, quantity) {
|
|
17888
|
+
FacebookPixel.addToCart = function (item, quantity, eventId) {
|
|
17889
17889
|
try {
|
|
17890
17890
|
!isServer &&
|
|
17891
17891
|
window.fbq &&
|
|
17892
17892
|
window.fbq("track", "AddToCart", item instanceof IkasProductDetail
|
|
17893
17893
|
? productToFBPItem(item, quantity)
|
|
17894
|
-
: orderLineItemToFBPItem(item, quantity));
|
|
17894
|
+
: orderLineItemToFBPItem(item, quantity), { eventId: eventId });
|
|
17895
17895
|
return;
|
|
17896
17896
|
}
|
|
17897
17897
|
catch (err) {
|
|
@@ -17909,11 +17909,11 @@ var FacebookPixel = /** @class */ (function () {
|
|
|
17909
17909
|
console.error(err);
|
|
17910
17910
|
}
|
|
17911
17911
|
};
|
|
17912
|
-
FacebookPixel.purchase = function (checkout,
|
|
17912
|
+
FacebookPixel.purchase = function (checkout, eventId) {
|
|
17913
17913
|
try {
|
|
17914
17914
|
!isServer &&
|
|
17915
17915
|
window.fbq &&
|
|
17916
|
-
window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout));
|
|
17916
|
+
window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventId: eventId });
|
|
17917
17917
|
return;
|
|
17918
17918
|
}
|
|
17919
17919
|
catch (err) {
|
|
@@ -22523,7 +22523,7 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
22523
22523
|
this.addItem = function (variant, product, initialQuantity) {
|
|
22524
22524
|
if (initialQuantity === void 0) { initialQuantity = 1; }
|
|
22525
22525
|
return __awaiter(_this, void 0, void 0, function () {
|
|
22526
|
-
var existingItem, input, cart, err_2;
|
|
22526
|
+
var existingItem, input, cart, eventId, err_2;
|
|
22527
22527
|
var _a, _b, _c;
|
|
22528
22528
|
return __generator(this, function (_d) {
|
|
22529
22529
|
switch (_d.label) {
|
|
@@ -22562,7 +22562,10 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
22562
22562
|
_d.sent();
|
|
22563
22563
|
_d.label = 3;
|
|
22564
22564
|
case 3:
|
|
22565
|
-
|
|
22565
|
+
if (this.cart) {
|
|
22566
|
+
eventId = this.cart.id + "-" + this.cart.updatedAt;
|
|
22567
|
+
Analytics.addToCart(new IkasProductDetail(product, variant.variantValues), initialQuantity, eventId);
|
|
22568
|
+
}
|
|
22566
22569
|
return [3 /*break*/, 5];
|
|
22567
22570
|
case 4:
|
|
22568
22571
|
err_2 = _d.sent();
|
|
@@ -22574,7 +22577,7 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
22574
22577
|
});
|
|
22575
22578
|
};
|
|
22576
22579
|
this.changeItemQuantity = function (item, quantity) { return __awaiter(_this, void 0, void 0, function () {
|
|
22577
|
-
var input, cart, oldQuantity, err_3;
|
|
22580
|
+
var input, cart, eventId, oldQuantity, err_3;
|
|
22578
22581
|
var _a, _b, _c;
|
|
22579
22582
|
return __generator(this, function (_d) {
|
|
22580
22583
|
switch (_d.label) {
|
|
@@ -22608,12 +22611,15 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
22608
22611
|
_d.label = 3;
|
|
22609
22612
|
case 3:
|
|
22610
22613
|
this.removeCardIfEmpty();
|
|
22611
|
-
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22616
|
-
|
|
22614
|
+
if (this.cart) {
|
|
22615
|
+
eventId = this.cart.id + "-" + this.cart.updatedAt;
|
|
22616
|
+
oldQuantity = item.quantity;
|
|
22617
|
+
if (oldQuantity > quantity) {
|
|
22618
|
+
Analytics.removeFromCart(item, oldQuantity - quantity);
|
|
22619
|
+
}
|
|
22620
|
+
else {
|
|
22621
|
+
Analytics.addToCart(item, quantity - oldQuantity, eventId);
|
|
22622
|
+
}
|
|
22617
22623
|
}
|
|
22618
22624
|
return [3 /*break*/, 5];
|
|
22619
22625
|
case 4:
|
|
@@ -22894,6 +22900,14 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
22894
22900
|
this.checkShippingCountries();
|
|
22895
22901
|
_b.label = 2;
|
|
22896
22902
|
case 2:
|
|
22903
|
+
// Skip shipping if there is only 1 shipping method
|
|
22904
|
+
if (this.step === CheckoutStep.SHIPPING &&
|
|
22905
|
+
this.checkout.availableShippingMethods.length === 1) {
|
|
22906
|
+
this.step = CheckoutStep.PAYMENT;
|
|
22907
|
+
this.router.replace("/checkout/" + this.checkout.id + "?step=" + this.step, undefined, {
|
|
22908
|
+
shallow: true,
|
|
22909
|
+
});
|
|
22910
|
+
}
|
|
22897
22911
|
if (!(this.step === CheckoutStep.PAYMENT ||
|
|
22898
22912
|
this.step === CheckoutStep.SUCCESS)) return [3 /*break*/, 4];
|
|
22899
22913
|
return [4 /*yield*/, this.listPaymentGateways()];
|
|
@@ -24109,9 +24123,9 @@ var Analytics = /** @class */ (function () {
|
|
|
24109
24123
|
console.error(err);
|
|
24110
24124
|
}
|
|
24111
24125
|
};
|
|
24112
|
-
Analytics.addToCart = function (item, quantity) {
|
|
24126
|
+
Analytics.addToCart = function (item, quantity, eventId) {
|
|
24113
24127
|
try {
|
|
24114
|
-
FacebookPixel.addToCart(item, quantity);
|
|
24128
|
+
FacebookPixel.addToCart(item, quantity, eventId);
|
|
24115
24129
|
GoogleTagManager.addToCart(item, quantity);
|
|
24116
24130
|
}
|
|
24117
24131
|
catch (err) {
|
|
@@ -24139,11 +24153,11 @@ var Analytics = /** @class */ (function () {
|
|
|
24139
24153
|
console.error(err);
|
|
24140
24154
|
}
|
|
24141
24155
|
};
|
|
24142
|
-
Analytics.purchase = function (checkout,
|
|
24156
|
+
Analytics.purchase = function (checkout, eventId) {
|
|
24143
24157
|
try {
|
|
24144
24158
|
localStorage.removeItem(LS_BEGIN_CHECKOUT_KEY);
|
|
24145
|
-
FacebookPixel.purchase(checkout,
|
|
24146
|
-
GoogleTagManager.purchase(checkout,
|
|
24159
|
+
FacebookPixel.purchase(checkout, eventId);
|
|
24160
|
+
GoogleTagManager.purchase(checkout, eventId);
|
|
24147
24161
|
}
|
|
24148
24162
|
catch (err) {
|
|
24149
24163
|
console.error(err);
|
|
@@ -24245,11 +24259,13 @@ var AnalyticsHead = function (_a) {
|
|
|
24245
24259
|
blockHTML && (React.createElement("script", { dangerouslySetInnerHTML: {
|
|
24246
24260
|
__html: "dataLayer = [{'gtm.blocklist': ['html']}];",
|
|
24247
24261
|
} })),
|
|
24262
|
+
gtmId && (React.createElement(Script__default['default'], { src: "https://www.googletagmanager.com/gtm.js?id=" + gtmId })),
|
|
24248
24263
|
gtmId && (React.createElement("script", { dangerouslySetInnerHTML: {
|
|
24249
24264
|
__html: "(function(w,l){" +
|
|
24250
24265
|
"w[l] = w[l] || [];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});" +
|
|
24251
24266
|
"})(window,'dataLayer');",
|
|
24252
24267
|
} })),
|
|
24268
|
+
fbpId && (React.createElement(Script__default['default'], { src: "https://connect.facebook.net/en_US/fbevents.js" })),
|
|
24253
24269
|
fbpId && (React.createElement("script", { dangerouslySetInnerHTML: {
|
|
24254
24270
|
__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');",
|
|
24255
24271
|
} }))));
|
|
@@ -24258,11 +24274,9 @@ var AnalyticsBody = function () {
|
|
|
24258
24274
|
var gtmId = IkasStorefrontConfig.gtmId;
|
|
24259
24275
|
var fbpId = IkasStorefrontConfig.fbpId;
|
|
24260
24276
|
return (React.createElement(React.Fragment, null,
|
|
24261
|
-
gtmId && (React.createElement(Script__default['default'], { src: "https://www.googletagmanager.com/gtm.js?id=" + gtmId })),
|
|
24262
24277
|
gtmId && (React.createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24263
24278
|
__html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
|
|
24264
24279
|
} })),
|
|
24265
|
-
fbpId && (React.createElement(Script__default['default'], { src: "https://connect.facebook.net/en_US/fbevents.js" })),
|
|
24266
24280
|
fbpId && (React.createElement("noscript", { dangerouslySetInnerHTML: {
|
|
24267
24281
|
__html: "<img height=\"1\" width=\"1\" style=\"display:none\" \n src=\"https://www.facebook.com/tr?id=" + fbpId + "&ev=PageView&noscript=1\"/>",
|
|
24268
24282
|
} }))));
|
|
@@ -24959,11 +24973,15 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
24959
24973
|
};
|
|
24960
24974
|
IkasCustomerStore.prototype.onProductView = function (productId, variantId) {
|
|
24961
24975
|
return __awaiter(this, void 0, void 0, function () {
|
|
24962
|
-
var isSuccess;
|
|
24976
|
+
var existingItem, isSuccess;
|
|
24963
24977
|
return __generator(this, function (_a) {
|
|
24964
24978
|
switch (_a.label) {
|
|
24965
24979
|
case 0:
|
|
24966
24980
|
if (!this.customer) return [3 /*break*/, 2];
|
|
24981
|
+
existingItem = this._lastViewedProducts.find(function (lvp) { return lvp.productId === productId; });
|
|
24982
|
+
if (existingItem) {
|
|
24983
|
+
return [2 /*return*/];
|
|
24984
|
+
}
|
|
24967
24985
|
return [4 /*yield*/, IkasCustomerAPI.saveLastViewedProducts({
|
|
24968
24986
|
customerId: this.customer.id,
|
|
24969
24987
|
products: [
|
|
@@ -27619,15 +27637,25 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27619
27637
|
});
|
|
27620
27638
|
Object.defineProperty(IkasProductDetail.prototype, "href", {
|
|
27621
27639
|
get: function () {
|
|
27640
|
+
var _this = this;
|
|
27622
27641
|
var metaData = this.product.metaData;
|
|
27623
27642
|
if (!(metaData === null || metaData === void 0 ? void 0 : metaData.slug))
|
|
27624
27643
|
return "";
|
|
27625
|
-
|
|
27626
|
-
|
|
27627
|
-
|
|
27628
|
-
|
|
27629
|
-
|
|
27630
|
-
|
|
27644
|
+
var variantParams = this.product.variantTypes
|
|
27645
|
+
.map(function (pvt) {
|
|
27646
|
+
var vt = pvt.variantType;
|
|
27647
|
+
var selectedVariant = vt.values.find(function (vv) {
|
|
27648
|
+
return _this.selectedVariantValues.some(function (svv) { return svv.id === vv.id; });
|
|
27649
|
+
});
|
|
27650
|
+
if (selectedVariant)
|
|
27651
|
+
return vt.slug + "=" + selectedVariant.slug;
|
|
27652
|
+
})
|
|
27653
|
+
.filter(function (param) { return !!param; })
|
|
27654
|
+
.join("&");
|
|
27655
|
+
if (variantParams)
|
|
27656
|
+
return "/" + metaData.slug + "?" + variantParams;
|
|
27657
|
+
else
|
|
27658
|
+
return "/" + metaData.slug;
|
|
27631
27659
|
},
|
|
27632
27660
|
enumerable: false,
|
|
27633
27661
|
configurable: true
|
|
@@ -27674,6 +27702,7 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27674
27702
|
configurable: true
|
|
27675
27703
|
});
|
|
27676
27704
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
27705
|
+
var _this = this;
|
|
27677
27706
|
var _a;
|
|
27678
27707
|
var metaData = this.product.metaData;
|
|
27679
27708
|
var selectedVariantValues = this.selectedVariantValues.map(function (vv) {
|
|
@@ -27682,9 +27711,20 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
27682
27711
|
return vv;
|
|
27683
27712
|
});
|
|
27684
27713
|
this.selectedVariantValues = selectedVariantValues;
|
|
27685
|
-
var
|
|
27686
|
-
.map(function (
|
|
27687
|
-
.
|
|
27714
|
+
var variantParams = this.product.variantTypes
|
|
27715
|
+
.map(function (pvt) {
|
|
27716
|
+
var vt = pvt.variantType;
|
|
27717
|
+
var selectedVariant = vt.values.find(function (vv) {
|
|
27718
|
+
return _this.selectedVariantValues.some(function (svv) { return svv.id === vv.id; });
|
|
27719
|
+
});
|
|
27720
|
+
if (selectedVariant)
|
|
27721
|
+
return vt.slug + "=" + selectedVariant.slug;
|
|
27722
|
+
})
|
|
27723
|
+
.filter(function (param) { return !!param; })
|
|
27724
|
+
.join("&");
|
|
27725
|
+
var newUrl = "/" + metaData.slug;
|
|
27726
|
+
if (variantParams)
|
|
27727
|
+
newUrl = "/" + metaData.slug + "?" + variantParams;
|
|
27688
27728
|
if (newUrl === window.location.pathname)
|
|
27689
27729
|
return;
|
|
27690
27730
|
var isShallow = process.env.NODE_ENV !== "production";
|
|
@@ -33261,15 +33301,33 @@ function createProductSchema(productDetail) {
|
|
|
33261
33301
|
var _a, _b;
|
|
33262
33302
|
try {
|
|
33263
33303
|
var isBrowser = typeof window !== "undefined";
|
|
33304
|
+
// TODO this code copy-pasted, organize this block
|
|
33264
33305
|
if (isBrowser) {
|
|
33265
|
-
var
|
|
33266
|
-
var vid_1 =
|
|
33306
|
+
var urlParams_1 = new URLSearchParams(window.location.search);
|
|
33307
|
+
var vid_1 = urlParams_1.get("vid");
|
|
33267
33308
|
if (vid_1) {
|
|
33268
33309
|
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
33269
33310
|
if (variant) {
|
|
33270
33311
|
productDetail.selectedVariantValues = variant.variantValues;
|
|
33271
33312
|
}
|
|
33272
33313
|
}
|
|
33314
|
+
else {
|
|
33315
|
+
var productVariantTypeSlugs = productDetail.product.variantTypes.map(function (vt) { return vt.variantType.slug; });
|
|
33316
|
+
var selectedVariantValues_1 = [];
|
|
33317
|
+
productVariantTypeSlugs.forEach(function (slug, vtIndex) {
|
|
33318
|
+
var productVariantType = productDetail.product.variantTypes[vtIndex];
|
|
33319
|
+
var variantValueSlug = urlParams_1.get(slug);
|
|
33320
|
+
if (variantValueSlug) {
|
|
33321
|
+
var variantValue = productVariantType.variantType.values.find(function (v) { return v.slug === variantValueSlug; });
|
|
33322
|
+
if (variantValue)
|
|
33323
|
+
selectedVariantValues_1.push(variantValue);
|
|
33324
|
+
}
|
|
33325
|
+
});
|
|
33326
|
+
if (selectedVariantValues_1.length ===
|
|
33327
|
+
productDetail.selectedVariantValues.length) {
|
|
33328
|
+
productDetail.selectedVariantValues = selectedVariantValues_1;
|
|
33329
|
+
}
|
|
33330
|
+
}
|
|
33273
33331
|
}
|
|
33274
33332
|
var productUrl = isBrowser
|
|
33275
33333
|
? "https://" + window.location.hostname + productDetail.href
|
|
@@ -33536,7 +33594,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33536
33594
|
IkasPageDataProvider.prototype.getPageSpecificData = function () {
|
|
33537
33595
|
var _a, _b;
|
|
33538
33596
|
return __awaiter(this, void 0, void 0, function () {
|
|
33539
|
-
var slug, metaDataList, metaData, handleBrandPage, handleCategoryPage, handleBlogPage, handleBlogCategoryPage, _c;
|
|
33597
|
+
var slug, metaDataList, metaData, handleProductPage, handleBrandPage, handleCategoryPage, handleBlogPage, handleBlogCategoryPage, _c;
|
|
33540
33598
|
var _this = this;
|
|
33541
33599
|
return __generator(this, function (_d) {
|
|
33542
33600
|
switch (_d.label) {
|
|
@@ -33565,12 +33623,47 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33565
33623
|
case 2: return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData(slug)];
|
|
33566
33624
|
case 3:
|
|
33567
33625
|
metaDataList = _d.sent();
|
|
33568
|
-
if (!metaDataList || !metaDataList.length)
|
|
33569
|
-
return [2 /*return
|
|
33570
|
-
}
|
|
33626
|
+
if (!metaDataList || !metaDataList.length)
|
|
33627
|
+
return [2 /*return*/];
|
|
33571
33628
|
_d.label = 4;
|
|
33572
33629
|
case 4:
|
|
33573
33630
|
metaData = metaDataList[0];
|
|
33631
|
+
if (!metaData.targetId)
|
|
33632
|
+
return [2 /*return*/];
|
|
33633
|
+
handleProductPage = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
33634
|
+
var productsResponse, product, displayedVariantType, inStockVariant;
|
|
33635
|
+
return __generator(this, function (_a) {
|
|
33636
|
+
switch (_a.label) {
|
|
33637
|
+
case 0: return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
33638
|
+
productIdList: [metaData.targetId],
|
|
33639
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
33640
|
+
salesChannelId: IkasStorefrontConfig.salesChannelId,
|
|
33641
|
+
})];
|
|
33642
|
+
case 1:
|
|
33643
|
+
productsResponse = _a.sent();
|
|
33644
|
+
if (!(productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data.length)) {
|
|
33645
|
+
return [2 /*return*/];
|
|
33646
|
+
}
|
|
33647
|
+
product = productsResponse.data[0];
|
|
33648
|
+
this.pageSpecificData = new IkasProductDetail(product, product.variants[0].variantValues);
|
|
33649
|
+
// Select the first displayed in stock variant
|
|
33650
|
+
if (this.pageSpecificData.displayedVariantTypes.length) {
|
|
33651
|
+
displayedVariantType = this
|
|
33652
|
+
.pageSpecificData.displayedVariantTypes[0];
|
|
33653
|
+
if (displayedVariantType.displayedVariantValues.length) {
|
|
33654
|
+
inStockVariant = displayedVariantType.displayedVariantValues.find(function (dvv) { return dvv.hasStock; });
|
|
33655
|
+
if (inStockVariant) {
|
|
33656
|
+
this.pageSpecificData.selectedVariantValues =
|
|
33657
|
+
inStockVariant.variant.variantValues;
|
|
33658
|
+
}
|
|
33659
|
+
}
|
|
33660
|
+
}
|
|
33661
|
+
this.pageType = exports.IkasThemePageType.PRODUCT;
|
|
33662
|
+
this.setPageMetaData(metaData);
|
|
33663
|
+
return [2 /*return*/];
|
|
33664
|
+
}
|
|
33665
|
+
});
|
|
33666
|
+
}); };
|
|
33574
33667
|
handleBrandPage = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
33575
33668
|
var brandsResponse, brand;
|
|
33576
33669
|
return __generator(this, function (_a) {
|
|
@@ -33662,7 +33755,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33662
33755
|
case 6: return [2 /*return*/, _d.sent()];
|
|
33663
33756
|
case 7: return [4 /*yield*/, handleCategoryPage()];
|
|
33664
33757
|
case 8: return [2 /*return*/, _d.sent()];
|
|
33665
|
-
case 9: return [4 /*yield*/,
|
|
33758
|
+
case 9: return [4 /*yield*/, handleProductPage()];
|
|
33666
33759
|
case 10: return [2 /*return*/, _d.sent()];
|
|
33667
33760
|
case 11: return [4 /*yield*/, handleBlogPage()];
|
|
33668
33761
|
case 12: return [2 /*return*/, _d.sent()];
|
|
@@ -33674,91 +33767,6 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
33674
33767
|
});
|
|
33675
33768
|
});
|
|
33676
33769
|
};
|
|
33677
|
-
IkasPageDataProvider.prototype.getPageSpecificProduct = function () {
|
|
33678
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
33679
|
-
var slug, getProductMetaData, metaDataResponse, productsResponse, product, isMainProductSlug, selectedVariantValues, variantSlugPart, _i, _a, variant, values, slugPart, displayedVariantType, inStockVariant;
|
|
33680
|
-
var _this = this;
|
|
33681
|
-
return __generator(this, function (_b) {
|
|
33682
|
-
switch (_b.label) {
|
|
33683
|
-
case 0:
|
|
33684
|
-
slug = this.pageParams.slug;
|
|
33685
|
-
if (!slug) {
|
|
33686
|
-
console.log("Slug not found for getPageSpecificProduct");
|
|
33687
|
-
}
|
|
33688
|
-
getProductMetaData = function (slug) { return __awaiter(_this, void 0, void 0, function () {
|
|
33689
|
-
var metaDataList, splitParts, newSlug;
|
|
33690
|
-
return __generator(this, function (_a) {
|
|
33691
|
-
switch (_a.label) {
|
|
33692
|
-
case 0:
|
|
33693
|
-
if (!slug)
|
|
33694
|
-
return [2 /*return*/];
|
|
33695
|
-
return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData(slug)];
|
|
33696
|
-
case 1:
|
|
33697
|
-
metaDataList = _a.sent();
|
|
33698
|
-
if (!(!metaDataList || !metaDataList.length)) return [3 /*break*/, 3];
|
|
33699
|
-
splitParts = slug.split("-");
|
|
33700
|
-
newSlug = splitParts.slice(0, splitParts.length - 1).join("-");
|
|
33701
|
-
return [4 /*yield*/, getProductMetaData(newSlug)];
|
|
33702
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
33703
|
-
case 3: return [2 /*return*/, {
|
|
33704
|
-
metaData: metaDataList[0],
|
|
33705
|
-
slug: slug,
|
|
33706
|
-
}];
|
|
33707
|
-
}
|
|
33708
|
-
});
|
|
33709
|
-
}); };
|
|
33710
|
-
return [4 /*yield*/, getProductMetaData(slug)];
|
|
33711
|
-
case 1:
|
|
33712
|
-
metaDataResponse = _b.sent();
|
|
33713
|
-
if (!metaDataResponse)
|
|
33714
|
-
return [2 /*return*/];
|
|
33715
|
-
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
33716
|
-
productIdList: [metaDataResponse.metaData.targetId],
|
|
33717
|
-
priceListId: IkasStorefrontConfig.priceListId,
|
|
33718
|
-
salesChannelId: IkasStorefrontConfig.salesChannelId,
|
|
33719
|
-
})];
|
|
33720
|
-
case 2:
|
|
33721
|
-
productsResponse = _b.sent();
|
|
33722
|
-
if (!(productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data.length))
|
|
33723
|
-
return [2 /*return*/];
|
|
33724
|
-
product = productsResponse.data[0];
|
|
33725
|
-
isMainProductSlug = slug.length === metaDataResponse.slug.length;
|
|
33726
|
-
selectedVariantValues = [];
|
|
33727
|
-
if (!isMainProductSlug) {
|
|
33728
|
-
variantSlugPart = slug.slice(metaDataResponse.slug.length + 1);
|
|
33729
|
-
for (_i = 0, _a = product.variants; _i < _a.length; _i++) {
|
|
33730
|
-
variant = _a[_i];
|
|
33731
|
-
values = variant.variantValues;
|
|
33732
|
-
slugPart = values.map(function (vv) { return vv.slug; }).join("-");
|
|
33733
|
-
if (slugPart === variantSlugPart) {
|
|
33734
|
-
selectedVariantValues = values;
|
|
33735
|
-
break;
|
|
33736
|
-
}
|
|
33737
|
-
}
|
|
33738
|
-
}
|
|
33739
|
-
this.pageSpecificData = new IkasProductDetail(product, selectedVariantValues.length
|
|
33740
|
-
? selectedVariantValues
|
|
33741
|
-
: product.variants[0].variantValues);
|
|
33742
|
-
// Select the first displayed in stock variant
|
|
33743
|
-
if (!selectedVariantValues.length &&
|
|
33744
|
-
this.pageSpecificData.displayedVariantTypes.length) {
|
|
33745
|
-
displayedVariantType = this.pageSpecificData
|
|
33746
|
-
.displayedVariantTypes[0];
|
|
33747
|
-
if (displayedVariantType.displayedVariantValues.length) {
|
|
33748
|
-
inStockVariant = displayedVariantType.displayedVariantValues.find(function (dvv) { return dvv.hasStock; });
|
|
33749
|
-
if (inStockVariant) {
|
|
33750
|
-
this.pageSpecificData.selectedVariantValues =
|
|
33751
|
-
inStockVariant.variant.variantValues;
|
|
33752
|
-
}
|
|
33753
|
-
}
|
|
33754
|
-
}
|
|
33755
|
-
this.pageType = exports.IkasThemePageType.PRODUCT;
|
|
33756
|
-
this.setPageMetaData(metaDataResponse.metaData);
|
|
33757
|
-
return [2 /*return*/];
|
|
33758
|
-
}
|
|
33759
|
-
});
|
|
33760
|
-
});
|
|
33761
|
-
};
|
|
33762
33770
|
IkasPageDataProvider.prototype.getPageComponentPropValues = function (pageComponent) {
|
|
33763
33771
|
return __awaiter(this, void 0, void 0, function () {
|
|
33764
33772
|
var component, result, setPageComponentPropValue;
|
|
@@ -34026,14 +34034,31 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
34026
34034
|
var _propValue = propValue;
|
|
34027
34035
|
var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
|
|
34028
34036
|
if (isBrowser) {
|
|
34029
|
-
var
|
|
34030
|
-
var vid_1 =
|
|
34037
|
+
var urlParams_1 = new URLSearchParams(window.location.search);
|
|
34038
|
+
var vid_1 = urlParams_1.get("vid");
|
|
34031
34039
|
if (vid_1) {
|
|
34032
34040
|
var variant = productDetail.product.variants.find(function (v) { return v.id === vid_1; });
|
|
34033
34041
|
if (variant) {
|
|
34034
34042
|
productDetail.selectedVariantValues = variant.variantValues;
|
|
34035
34043
|
}
|
|
34036
34044
|
}
|
|
34045
|
+
else {
|
|
34046
|
+
var productVariantTypeSlugs = productDetail.product.variantTypes.map(function (vt) { return vt.variantType.slug; });
|
|
34047
|
+
var selectedVariantValues_1 = [];
|
|
34048
|
+
productVariantTypeSlugs.forEach(function (slug, vtIndex) {
|
|
34049
|
+
var productVariantType = productDetail.product.variantTypes[vtIndex];
|
|
34050
|
+
var variantValueSlug = urlParams_1.get(slug);
|
|
34051
|
+
if (variantValueSlug) {
|
|
34052
|
+
var variantValue = productVariantType.variantType.values.find(function (v) { return v.slug === variantValueSlug; });
|
|
34053
|
+
if (variantValue)
|
|
34054
|
+
selectedVariantValues_1.push(variantValue);
|
|
34055
|
+
}
|
|
34056
|
+
});
|
|
34057
|
+
if (selectedVariantValues_1.length ===
|
|
34058
|
+
productDetail.selectedVariantValues.length) {
|
|
34059
|
+
productDetail.selectedVariantValues = selectedVariantValues_1;
|
|
34060
|
+
}
|
|
34061
|
+
}
|
|
34037
34062
|
}
|
|
34038
34063
|
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, router);
|
|
34039
34064
|
};
|
|
@@ -61303,6 +61328,7 @@ var StepSuccess = mobxReactLite.observer(function (_a) {
|
|
|
61303
61328
|
var t = useTranslation().t;
|
|
61304
61329
|
var _f = React.useState(false), isContactModalVisible = _f[0], setContactModalVisible = _f[1];
|
|
61305
61330
|
React.useEffect(function () {
|
|
61331
|
+
var _a;
|
|
61306
61332
|
if (typeof localStorage !== "undefined") {
|
|
61307
61333
|
var lsCartId = localStorage.getItem(CART_LS_KEY);
|
|
61308
61334
|
var lsCheckoutId = localStorage.getItem(CHECKOUT_LS_KEY);
|
|
@@ -61311,7 +61337,7 @@ var StepSuccess = mobxReactLite.observer(function (_a) {
|
|
|
61311
61337
|
if (lsCheckoutId && lsCheckoutId === vm.checkout.id)
|
|
61312
61338
|
localStorage.removeItem(CHECKOUT_LS_KEY);
|
|
61313
61339
|
}
|
|
61314
|
-
Analytics.purchase(vm.checkout, vm.
|
|
61340
|
+
Analytics.purchase(vm.checkout, ((_a = vm.successTransaction) === null || _a === void 0 ? void 0 : _a.id) || "");
|
|
61315
61341
|
}, []);
|
|
61316
61342
|
var customerName = (((_b = vm.checkout.customer) === null || _b === void 0 ? void 0 : _b.firstName) || "") +
|
|
61317
61343
|
" " +
|
|
@@ -61529,13 +61555,30 @@ var OrderStatus = mobxReactLite.observer(function (_a) {
|
|
|
61529
61555
|
})) === null || _d === void 0 ? void 0 : _d.text : ""));
|
|
61530
61556
|
});
|
|
61531
61557
|
|
|
61558
|
+
var IMAGE_SIZES = [
|
|
61559
|
+
180,
|
|
61560
|
+
360,
|
|
61561
|
+
540,
|
|
61562
|
+
720,
|
|
61563
|
+
900,
|
|
61564
|
+
1080,
|
|
61565
|
+
1296,
|
|
61566
|
+
1512,
|
|
61567
|
+
1728,
|
|
61568
|
+
1950,
|
|
61569
|
+
2560,
|
|
61570
|
+
3840,
|
|
61571
|
+
];
|
|
61532
61572
|
var Image = function (_a) {
|
|
61533
61573
|
var image = _a.image, others = __rest(_a, ["image"]);
|
|
61534
61574
|
var loader = function (_a) {
|
|
61535
61575
|
var width = _a.width;
|
|
61536
|
-
|
|
61576
|
+
var closest = IMAGE_SIZES.reduce(function (prev, curr) {
|
|
61577
|
+
return Math.abs(curr - width) < Math.abs(prev - width) ? curr : prev;
|
|
61578
|
+
});
|
|
61579
|
+
return image.getSrc(closest);
|
|
61537
61580
|
};
|
|
61538
|
-
return (React.createElement(NextImage__default['default'], __assign({}, others, { loader: loader, quality: 100, src: image.src, alt: others.alt || "Image" })));
|
|
61581
|
+
return (React.createElement(NextImage__default['default'], __assign({}, others, { loader: loader, quality: 100, src: image.src, alt: others.alt || "Image", unoptimized: true })));
|
|
61539
61582
|
};
|
|
61540
61583
|
|
|
61541
61584
|
var css_248z$m = ".style-module_StepContainer__1O2dD {\n width: 100%; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA {\n width: 100%; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 {\n padding: 24px 0;\n border-top: 1px solid var(--checkout-border-color); }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2.style-module_First__cAzdJ {\n border-top: none; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitleTop__3zfsj {\n display: flex;\n align-items: center; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitleTop__3zfsj.style-module_WithRightContent__2fqb1 {\n align-items: flex-start; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepCircle__36A5q {\n width: 32px;\n height: 32px;\n border-radius: 100%;\n border: 1px solid var(--checkout-button-bg-color);\n color: var(--checkout-button-bg-color);\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 16px;\n flex: 0 0 auto;\n font-size: 20px; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepCircle__36A5q.style-module_Selected__3j91L {\n background-color: var(--checkout-button-bg-color);\n color: var(--checkout-button-text-color); }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepCircle__36A5q.style-module_Selected__3j91L svg {\n transform: scale(1.5);\n position: relative;\n right: -1px; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitle__10YDP {\n font-size: 22px;\n color: var(--checkout-primary-text-color);\n flex: 0 0 auto;\n font-weight: 600;\n line-height: 32px; }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitle__10YDP.style-module_Light__15wSX {\n color: var(--checkout-button-disabled-text-color); }\n .style-module_StepContainer__1O2dD .style-module_Step__1iOYA .style-module_StepTitleContainer__2GUg2 .style-module_StepTitleRightContent__2Q43m {\n flex: 1 1 auto; }\n .style-module_StepContainer__1O2dD .style-module_StepContent__20QIi {\n padding-bottom: 24px;\n padding-left: 48px;\n width: 100%; }\n @media only screen and (max-width: 1000px) {\n .style-module_StepContainer__1O2dD {\n padding: 0 24px; }\n .style-module_StepContainer__1O2dD .style-module_StepContent__20QIi {\n padding-left: 0px; } }\n";
|
|
@@ -61751,7 +61794,7 @@ var Steps = mobxReactLite.observer(function (_a) {
|
|
|
61751
61794
|
React.createElement(StepSummaryAddress, { vm: vm }))) : undefined),
|
|
61752
61795
|
new Step(t("checkout-page:shipping"), vm.step === CheckoutStep.SHIPPING, vm.step === CheckoutStep.PAYMENT, vm.step === CheckoutStep.PAYMENT ? (React.createElement("div", { className: styles$5.AdressStepInfo },
|
|
61753
61796
|
React.createElement(StepSummaryShipping, { vm: vm }),
|
|
61754
|
-
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 },
|
|
61797
|
+
vm.checkout.availableShippingMethods.length > 1 && (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 },
|
|
61755
61798
|
React.createElement(StepSummaryShipping, { vm: vm }))) : undefined),
|
|
61756
61799
|
new Step(t("checkout-page:payment"), vm.step === CheckoutStep.PAYMENT, false),
|
|
61757
61800
|
];
|
|
@@ -62300,21 +62343,6 @@ var Page$1 = function (_a) {
|
|
|
62300
62343
|
var index$1 = mobxReactLite.observer(Page$1);
|
|
62301
62344
|
var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
62302
62345
|
return __generator(this, function (_a) {
|
|
62303
|
-
// const targetTypes = [
|
|
62304
|
-
// IkasHTMLMetaDataTargetType.BRAND,
|
|
62305
|
-
// IkasHTMLMetaDataTargetType.CATEGORY,
|
|
62306
|
-
// ];
|
|
62307
|
-
// const metaData = await IkasHTMLMetaDataAPI.listHTMLMetaData(
|
|
62308
|
-
// undefined,
|
|
62309
|
-
// undefined,
|
|
62310
|
-
// targetTypes
|
|
62311
|
-
// );
|
|
62312
|
-
// metaData.map((m) => ({
|
|
62313
|
-
// params: {
|
|
62314
|
-
// slug: m.slug,
|
|
62315
|
-
// originalSlug: m.slug,
|
|
62316
|
-
// },
|
|
62317
|
-
// }))
|
|
62318
62346
|
return [2 /*return*/, {
|
|
62319
62347
|
paths: [],
|
|
62320
62348
|
fallback: "blocking",
|
|
@@ -63447,6 +63475,7 @@ exports.SlugPage = index$2;
|
|
|
63447
63475
|
exports.ValidationRule = ValidationRule;
|
|
63448
63476
|
exports.Validator = Validator;
|
|
63449
63477
|
exports.apollo = apollo;
|
|
63478
|
+
exports.createTranslationInputData = createTranslationInputData;
|
|
63450
63479
|
exports.decodeBase64 = decodeBase64;
|
|
63451
63480
|
exports.findAllIndexes = findAllIndexes;
|
|
63452
63481
|
exports.formatDate = formatDate;
|
package/build/utils/index.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ export declare class IkasPageDataProvider {
|
|
|
46
46
|
getMerchantSettings(): Promise<void>;
|
|
47
47
|
getPageData(): Promise<void>;
|
|
48
48
|
getPageSpecificData(): Promise<void>;
|
|
49
|
-
getPageSpecificProduct(): Promise<void>;
|
|
50
49
|
getPageComponentPropValues(pageComponent: IkasThemePageComponent): Promise<IkasPageComponentPropValue>;
|
|
51
50
|
getPageComponentPropValue(pageComponent: IkasThemePageComponent, prop: IkasThemeComponentProp): Promise<any>;
|
|
52
51
|
private setPageMetaData;
|