@ikas/storefront 0.0.84 → 0.0.86
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IkasProductDetail, IkasOrderLineItem, IkasCheckout } from "../models/index";
|
|
2
2
|
import { CheckoutStep } from "../components/checkout/model";
|
|
3
|
+
import { IkasCart } from "../models/data/cart/index";
|
|
3
4
|
export declare class Analytics {
|
|
4
5
|
constructor();
|
|
5
6
|
static pageView(url: string): {
|
|
@@ -16,4 +17,6 @@ export declare class Analytics {
|
|
|
16
17
|
static addToWishlist(id: string): void;
|
|
17
18
|
static search(searchKeyword: string): void;
|
|
18
19
|
static completeRegistration(): void;
|
|
20
|
+
static viewCart(cart: IkasCart | null | undefined): void;
|
|
21
|
+
static viewCategory(categoryPath: string): void;
|
|
19
22
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IkasProductDetail, IkasOrderLineItem, IkasCheckout } from "../models/index";
|
|
2
|
+
import { IkasCart } from "../models/data/cart/index";
|
|
2
3
|
export declare class FacebookPixel {
|
|
3
4
|
constructor();
|
|
4
5
|
static productView(productDetail: IkasProductDetail): void;
|
|
@@ -8,4 +9,6 @@ export declare class FacebookPixel {
|
|
|
8
9
|
static addToWishlist(id: string): void;
|
|
9
10
|
static search(searchKeyword: string): void;
|
|
10
11
|
static completeRegistration(): void;
|
|
12
|
+
static viewCart(cart: IkasCart): void;
|
|
13
|
+
static viewCategory(categoryPath: string): void;
|
|
11
14
|
}
|
package/build/index.es.js
CHANGED
|
@@ -19807,6 +19807,32 @@ var FacebookPixel = /** @class */ (function () {
|
|
|
19807
19807
|
window.fbq &&
|
|
19808
19808
|
window.fbq("track", "CompleteRegistration", {
|
|
19809
19809
|
status: true,
|
|
19810
|
+
value: 0,
|
|
19811
|
+
currency: "TRY",
|
|
19812
|
+
});
|
|
19813
|
+
return;
|
|
19814
|
+
}
|
|
19815
|
+
catch (err) {
|
|
19816
|
+
console.error(err);
|
|
19817
|
+
}
|
|
19818
|
+
};
|
|
19819
|
+
FacebookPixel.viewCart = function (cart) {
|
|
19820
|
+
try {
|
|
19821
|
+
!isServer &&
|
|
19822
|
+
window.fbq &&
|
|
19823
|
+
window.fbq("track", "ViewCart", viewCartFBPItem(cart));
|
|
19824
|
+
return;
|
|
19825
|
+
}
|
|
19826
|
+
catch (err) {
|
|
19827
|
+
console.error(err);
|
|
19828
|
+
}
|
|
19829
|
+
};
|
|
19830
|
+
FacebookPixel.viewCategory = function (categoryPath) {
|
|
19831
|
+
try {
|
|
19832
|
+
!isServer &&
|
|
19833
|
+
window.fbq &&
|
|
19834
|
+
window.fbq("track", "ViewCategory", {
|
|
19835
|
+
content_name: categoryPath,
|
|
19810
19836
|
});
|
|
19811
19837
|
return;
|
|
19812
19838
|
}
|
|
@@ -19817,7 +19843,6 @@ var FacebookPixel = /** @class */ (function () {
|
|
|
19817
19843
|
return FacebookPixel;
|
|
19818
19844
|
}());
|
|
19819
19845
|
function productToFBPItem(productDetail, quantity) {
|
|
19820
|
-
if (quantity === void 0) { quantity = 1; }
|
|
19821
19846
|
return {
|
|
19822
19847
|
content_name: productDetail.product.name,
|
|
19823
19848
|
content_category: productDetail.product.categories.length > 0
|
|
@@ -19831,7 +19856,6 @@ function productToFBPItem(productDetail, quantity) {
|
|
|
19831
19856
|
currency: productDetail.selectedVariant.price.currency === ""
|
|
19832
19857
|
? "TRY"
|
|
19833
19858
|
: productDetail.selectedVariant.price.currency,
|
|
19834
|
-
num_items: quantity,
|
|
19835
19859
|
};
|
|
19836
19860
|
}
|
|
19837
19861
|
function beginCheckoutFBPItem(checkout) {
|
|
@@ -19845,12 +19869,29 @@ function beginCheckoutFBPItem(checkout) {
|
|
|
19845
19869
|
return {
|
|
19846
19870
|
contents: contents,
|
|
19847
19871
|
content_category: "",
|
|
19872
|
+
content_type: "product_group",
|
|
19848
19873
|
content_ids: contentIds,
|
|
19849
19874
|
currency: (_b = checkout.cart) === null || _b === void 0 ? void 0 : _b.items[0].currencyCode,
|
|
19850
19875
|
value: (_c = checkout.cart) === null || _c === void 0 ? void 0 : _c.totalPrice,
|
|
19851
19876
|
num_items: (_d = checkout.cart) === null || _d === void 0 ? void 0 : _d.items.length,
|
|
19852
19877
|
};
|
|
19853
19878
|
}
|
|
19879
|
+
function viewCartFBPItem(cart) {
|
|
19880
|
+
var contentIds = [];
|
|
19881
|
+
var contents = [];
|
|
19882
|
+
cart.items.map(function (item) {
|
|
19883
|
+
contentIds.push(item.id);
|
|
19884
|
+
contents.push({ id: item.id, quantity: item.quantity });
|
|
19885
|
+
});
|
|
19886
|
+
return {
|
|
19887
|
+
contents: contents,
|
|
19888
|
+
content_type: "product_group",
|
|
19889
|
+
content_ids: contentIds,
|
|
19890
|
+
currency: cart.items[0].currencyCode,
|
|
19891
|
+
value: cart.totalPrice,
|
|
19892
|
+
num_items: cart.items.length,
|
|
19893
|
+
};
|
|
19894
|
+
}
|
|
19854
19895
|
function orderLineItemToFBPItem(orderLineItem, quantity) {
|
|
19855
19896
|
return {
|
|
19856
19897
|
content_name: orderLineItem.variant.name,
|
|
@@ -21364,6 +21405,26 @@ var Analytics = /** @class */ (function () {
|
|
|
21364
21405
|
console.error(err);
|
|
21365
21406
|
}
|
|
21366
21407
|
};
|
|
21408
|
+
Analytics.viewCart = function (cart) {
|
|
21409
|
+
try {
|
|
21410
|
+
if (cart) {
|
|
21411
|
+
FacebookPixel.viewCart(cart);
|
|
21412
|
+
}
|
|
21413
|
+
return;
|
|
21414
|
+
}
|
|
21415
|
+
catch (err) {
|
|
21416
|
+
console.error(err);
|
|
21417
|
+
}
|
|
21418
|
+
};
|
|
21419
|
+
Analytics.viewCategory = function (categoryPath) {
|
|
21420
|
+
try {
|
|
21421
|
+
FacebookPixel.viewCategory(categoryPath);
|
|
21422
|
+
return;
|
|
21423
|
+
}
|
|
21424
|
+
catch (err) {
|
|
21425
|
+
console.error(err);
|
|
21426
|
+
}
|
|
21427
|
+
};
|
|
21367
21428
|
return Analytics;
|
|
21368
21429
|
}());
|
|
21369
21430
|
|
|
@@ -27447,6 +27508,10 @@ var IkasCheckoutPage = observer(function (_a) {
|
|
|
27447
27508
|
var checkout = _a.checkout, queryParams = _a.queryParams;
|
|
27448
27509
|
var router = useRouter();
|
|
27449
27510
|
var vm = useState(function () { return new CheckoutViewModel(checkout, queryParams, router); })[0];
|
|
27511
|
+
useEffect(function () {
|
|
27512
|
+
Analytics.beginCheckout(vm.checkout);
|
|
27513
|
+
Analytics.checkoutStep(vm.checkout, vm.step);
|
|
27514
|
+
}, []);
|
|
27450
27515
|
var _e = useState(""), policyModalTitle = _e[0], setPolicyModalTitle = _e[1];
|
|
27451
27516
|
var _f = useState(""), policyModalText = _f[0], setPolicyModalText = _f[1];
|
|
27452
27517
|
var step;
|
|
@@ -27540,8 +27605,6 @@ var IkasCheckoutPage = observer(function (_a) {
|
|
|
27540
27605
|
};
|
|
27541
27606
|
if (!vm.isCheckoutLoaded || !vm.customerStore.initialized)
|
|
27542
27607
|
return null;
|
|
27543
|
-
Analytics.beginCheckout(vm.checkout);
|
|
27544
|
-
Analytics.checkoutStep(vm.checkout, vm.step);
|
|
27545
27608
|
return (createElement(Fragment, null,
|
|
27546
27609
|
createElement(IkasPageHead, { pageTitle: (((_b = vm.merchantSettings) === null || _b === void 0 ? void 0 : _b.merchantName) || "") + " - Güvenli Ödeme", description: "Güvenli ödeme" }),
|
|
27547
27610
|
createElement("div", { id: "Checkout", className: styles$2.CheckoutPage },
|
|
@@ -28126,11 +28189,11 @@ var Page$1 = function (_a) {
|
|
|
28126
28189
|
var _c = useState(initialPropValues), propValues = _c[0], setPropValues = _c[1];
|
|
28127
28190
|
useEffect(function () {
|
|
28128
28191
|
setIsBrowser(typeof window !== "undefined");
|
|
28192
|
+
handleAnalytics(page, pageSpecificDataStr);
|
|
28129
28193
|
}, []);
|
|
28130
28194
|
useEffect(function () {
|
|
28131
28195
|
setPropValues(IkasPageDataProvider.initPropValues(propValuesStr, router, isBrowser));
|
|
28132
28196
|
}, [isBrowser, propValuesStr]);
|
|
28133
|
-
handleGTM(page, pageSpecificDataStr);
|
|
28134
28197
|
return (createElement(IkasPage, { page: page, propValues: propValues, pageSpecificDataStr: pageSpecificDataStr, settingsStr: settingsStr, merchantSettings: merchantSettings, addOgpMetas: true }));
|
|
28135
28198
|
};
|
|
28136
28199
|
var index$1 = observer(Page$1);
|
|
@@ -28217,7 +28280,7 @@ var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
28217
28280
|
}
|
|
28218
28281
|
});
|
|
28219
28282
|
}); };
|
|
28220
|
-
function
|
|
28283
|
+
function handleAnalytics(page, pageSpecificDataStr) {
|
|
28221
28284
|
var isServer = typeof window === "undefined";
|
|
28222
28285
|
if (!isServer) {
|
|
28223
28286
|
try {
|
|
@@ -28226,6 +28289,17 @@ function handleGTM(page, pageSpecificDataStr) {
|
|
|
28226
28289
|
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
28227
28290
|
Analytics.productView(productDetail);
|
|
28228
28291
|
}
|
|
28292
|
+
if (page.type === IkasThemePageType.CATEGORY) {
|
|
28293
|
+
var category = JSON.parse(pageSpecificDataStr);
|
|
28294
|
+
var categoryPath = category.path.map(function (cat) { return cat.name; }).join(" > ");
|
|
28295
|
+
if (category.path.length > 0) {
|
|
28296
|
+
categoryPath = categoryPath + " > " + category.name;
|
|
28297
|
+
}
|
|
28298
|
+
else {
|
|
28299
|
+
categoryPath = category.name;
|
|
28300
|
+
}
|
|
28301
|
+
Analytics.viewCategory(categoryPath);
|
|
28302
|
+
}
|
|
28229
28303
|
}
|
|
28230
28304
|
catch (err) {
|
|
28231
28305
|
console.error(err);
|
|
@@ -28562,6 +28636,10 @@ var Page$b = function (_a) {
|
|
|
28562
28636
|
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
28563
28637
|
var router = useRouter();
|
|
28564
28638
|
var propValues = useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router); }, [propValuesStr]);
|
|
28639
|
+
var store = IkasStorefrontConfig.store;
|
|
28640
|
+
useEffect(function () {
|
|
28641
|
+
Analytics.viewCart(store.cartStore.cart);
|
|
28642
|
+
}, []);
|
|
28565
28643
|
return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28566
28644
|
};
|
|
28567
28645
|
var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
package/build/index.js
CHANGED
|
@@ -19790,6 +19790,32 @@ var FacebookPixel = /** @class */ (function () {
|
|
|
19790
19790
|
window.fbq &&
|
|
19791
19791
|
window.fbq("track", "CompleteRegistration", {
|
|
19792
19792
|
status: true,
|
|
19793
|
+
value: 0,
|
|
19794
|
+
currency: "TRY",
|
|
19795
|
+
});
|
|
19796
|
+
return;
|
|
19797
|
+
}
|
|
19798
|
+
catch (err) {
|
|
19799
|
+
console.error(err);
|
|
19800
|
+
}
|
|
19801
|
+
};
|
|
19802
|
+
FacebookPixel.viewCart = function (cart) {
|
|
19803
|
+
try {
|
|
19804
|
+
!isServer &&
|
|
19805
|
+
window.fbq &&
|
|
19806
|
+
window.fbq("track", "ViewCart", viewCartFBPItem(cart));
|
|
19807
|
+
return;
|
|
19808
|
+
}
|
|
19809
|
+
catch (err) {
|
|
19810
|
+
console.error(err);
|
|
19811
|
+
}
|
|
19812
|
+
};
|
|
19813
|
+
FacebookPixel.viewCategory = function (categoryPath) {
|
|
19814
|
+
try {
|
|
19815
|
+
!isServer &&
|
|
19816
|
+
window.fbq &&
|
|
19817
|
+
window.fbq("track", "ViewCategory", {
|
|
19818
|
+
content_name: categoryPath,
|
|
19793
19819
|
});
|
|
19794
19820
|
return;
|
|
19795
19821
|
}
|
|
@@ -19800,7 +19826,6 @@ var FacebookPixel = /** @class */ (function () {
|
|
|
19800
19826
|
return FacebookPixel;
|
|
19801
19827
|
}());
|
|
19802
19828
|
function productToFBPItem(productDetail, quantity) {
|
|
19803
|
-
if (quantity === void 0) { quantity = 1; }
|
|
19804
19829
|
return {
|
|
19805
19830
|
content_name: productDetail.product.name,
|
|
19806
19831
|
content_category: productDetail.product.categories.length > 0
|
|
@@ -19814,7 +19839,6 @@ function productToFBPItem(productDetail, quantity) {
|
|
|
19814
19839
|
currency: productDetail.selectedVariant.price.currency === ""
|
|
19815
19840
|
? "TRY"
|
|
19816
19841
|
: productDetail.selectedVariant.price.currency,
|
|
19817
|
-
num_items: quantity,
|
|
19818
19842
|
};
|
|
19819
19843
|
}
|
|
19820
19844
|
function beginCheckoutFBPItem(checkout) {
|
|
@@ -19828,12 +19852,29 @@ function beginCheckoutFBPItem(checkout) {
|
|
|
19828
19852
|
return {
|
|
19829
19853
|
contents: contents,
|
|
19830
19854
|
content_category: "",
|
|
19855
|
+
content_type: "product_group",
|
|
19831
19856
|
content_ids: contentIds,
|
|
19832
19857
|
currency: (_b = checkout.cart) === null || _b === void 0 ? void 0 : _b.items[0].currencyCode,
|
|
19833
19858
|
value: (_c = checkout.cart) === null || _c === void 0 ? void 0 : _c.totalPrice,
|
|
19834
19859
|
num_items: (_d = checkout.cart) === null || _d === void 0 ? void 0 : _d.items.length,
|
|
19835
19860
|
};
|
|
19836
19861
|
}
|
|
19862
|
+
function viewCartFBPItem(cart) {
|
|
19863
|
+
var contentIds = [];
|
|
19864
|
+
var contents = [];
|
|
19865
|
+
cart.items.map(function (item) {
|
|
19866
|
+
contentIds.push(item.id);
|
|
19867
|
+
contents.push({ id: item.id, quantity: item.quantity });
|
|
19868
|
+
});
|
|
19869
|
+
return {
|
|
19870
|
+
contents: contents,
|
|
19871
|
+
content_type: "product_group",
|
|
19872
|
+
content_ids: contentIds,
|
|
19873
|
+
currency: cart.items[0].currencyCode,
|
|
19874
|
+
value: cart.totalPrice,
|
|
19875
|
+
num_items: cart.items.length,
|
|
19876
|
+
};
|
|
19877
|
+
}
|
|
19837
19878
|
function orderLineItemToFBPItem(orderLineItem, quantity) {
|
|
19838
19879
|
return {
|
|
19839
19880
|
content_name: orderLineItem.variant.name,
|
|
@@ -21347,6 +21388,26 @@ var Analytics = /** @class */ (function () {
|
|
|
21347
21388
|
console.error(err);
|
|
21348
21389
|
}
|
|
21349
21390
|
};
|
|
21391
|
+
Analytics.viewCart = function (cart) {
|
|
21392
|
+
try {
|
|
21393
|
+
if (cart) {
|
|
21394
|
+
FacebookPixel.viewCart(cart);
|
|
21395
|
+
}
|
|
21396
|
+
return;
|
|
21397
|
+
}
|
|
21398
|
+
catch (err) {
|
|
21399
|
+
console.error(err);
|
|
21400
|
+
}
|
|
21401
|
+
};
|
|
21402
|
+
Analytics.viewCategory = function (categoryPath) {
|
|
21403
|
+
try {
|
|
21404
|
+
FacebookPixel.viewCategory(categoryPath);
|
|
21405
|
+
return;
|
|
21406
|
+
}
|
|
21407
|
+
catch (err) {
|
|
21408
|
+
console.error(err);
|
|
21409
|
+
}
|
|
21410
|
+
};
|
|
21350
21411
|
return Analytics;
|
|
21351
21412
|
}());
|
|
21352
21413
|
|
|
@@ -27427,6 +27488,10 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
|
27427
27488
|
var checkout = _a.checkout, queryParams = _a.queryParams;
|
|
27428
27489
|
var router$1 = router.useRouter();
|
|
27429
27490
|
var vm = React.useState(function () { return new CheckoutViewModel(checkout, queryParams, router$1); })[0];
|
|
27491
|
+
React.useEffect(function () {
|
|
27492
|
+
Analytics.beginCheckout(vm.checkout);
|
|
27493
|
+
Analytics.checkoutStep(vm.checkout, vm.step);
|
|
27494
|
+
}, []);
|
|
27430
27495
|
var _e = React.useState(""), policyModalTitle = _e[0], setPolicyModalTitle = _e[1];
|
|
27431
27496
|
var _f = React.useState(""), policyModalText = _f[0], setPolicyModalText = _f[1];
|
|
27432
27497
|
var step;
|
|
@@ -27520,8 +27585,6 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
|
27520
27585
|
};
|
|
27521
27586
|
if (!vm.isCheckoutLoaded || !vm.customerStore.initialized)
|
|
27522
27587
|
return null;
|
|
27523
|
-
Analytics.beginCheckout(vm.checkout);
|
|
27524
|
-
Analytics.checkoutStep(vm.checkout, vm.step);
|
|
27525
27588
|
return (React.createElement(React.Fragment, null,
|
|
27526
27589
|
React.createElement(IkasPageHead, { pageTitle: (((_b = vm.merchantSettings) === null || _b === void 0 ? void 0 : _b.merchantName) || "") + " - Güvenli Ödeme", description: "Güvenli ödeme" }),
|
|
27527
27590
|
React.createElement("div", { id: "Checkout", className: styles$2.CheckoutPage },
|
|
@@ -28106,11 +28169,11 @@ var Page$1 = function (_a) {
|
|
|
28106
28169
|
var _c = React.useState(initialPropValues), propValues = _c[0], setPropValues = _c[1];
|
|
28107
28170
|
React.useEffect(function () {
|
|
28108
28171
|
setIsBrowser(typeof window !== "undefined");
|
|
28172
|
+
handleAnalytics(page, pageSpecificDataStr);
|
|
28109
28173
|
}, []);
|
|
28110
28174
|
React.useEffect(function () {
|
|
28111
28175
|
setPropValues(IkasPageDataProvider.initPropValues(propValuesStr, router$1, isBrowser));
|
|
28112
28176
|
}, [isBrowser, propValuesStr]);
|
|
28113
|
-
handleGTM(page, pageSpecificDataStr);
|
|
28114
28177
|
return (React.createElement(IkasPage, { page: page, propValues: propValues, pageSpecificDataStr: pageSpecificDataStr, settingsStr: settingsStr, merchantSettings: merchantSettings, addOgpMetas: true }));
|
|
28115
28178
|
};
|
|
28116
28179
|
var index$1 = mobxReactLite.observer(Page$1);
|
|
@@ -28197,7 +28260,7 @@ var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
28197
28260
|
}
|
|
28198
28261
|
});
|
|
28199
28262
|
}); };
|
|
28200
|
-
function
|
|
28263
|
+
function handleAnalytics(page, pageSpecificDataStr) {
|
|
28201
28264
|
var isServer = typeof window === "undefined";
|
|
28202
28265
|
if (!isServer) {
|
|
28203
28266
|
try {
|
|
@@ -28206,6 +28269,17 @@ function handleGTM(page, pageSpecificDataStr) {
|
|
|
28206
28269
|
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
28207
28270
|
Analytics.productView(productDetail);
|
|
28208
28271
|
}
|
|
28272
|
+
if (page.type === exports.IkasThemePageType.CATEGORY) {
|
|
28273
|
+
var category = JSON.parse(pageSpecificDataStr);
|
|
28274
|
+
var categoryPath = category.path.map(function (cat) { return cat.name; }).join(" > ");
|
|
28275
|
+
if (category.path.length > 0) {
|
|
28276
|
+
categoryPath = categoryPath + " > " + category.name;
|
|
28277
|
+
}
|
|
28278
|
+
else {
|
|
28279
|
+
categoryPath = category.name;
|
|
28280
|
+
}
|
|
28281
|
+
Analytics.viewCategory(categoryPath);
|
|
28282
|
+
}
|
|
28209
28283
|
}
|
|
28210
28284
|
catch (err) {
|
|
28211
28285
|
console.error(err);
|
|
@@ -28542,6 +28616,10 @@ var Page$b = function (_a) {
|
|
|
28542
28616
|
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
28543
28617
|
var router$1 = router.useRouter();
|
|
28544
28618
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28619
|
+
var store = IkasStorefrontConfig.store;
|
|
28620
|
+
React.useEffect(function () {
|
|
28621
|
+
Analytics.viewCart(store.cartStore.cart);
|
|
28622
|
+
}, []);
|
|
28545
28623
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28546
28624
|
};
|
|
28547
28625
|
var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|