@jetshop/core 5.11.1 → 5.11.2
Sign up to get free protection for your applications and to get access to all the features.
- package/analytics/integrations/ga4.js +1 -1
- package/analytics/integrations/ga4.js.map +1 -1
- package/analytics/integrations/gtag/gtag.d.ts +0 -1
- package/analytics/integrations/gtag/gtag.js +39 -28
- package/analytics/integrations/gtag/gtag.js.map +1 -1
- package/analytics/integrations/gtm/index.d.ts +0 -1
- package/analytics/integrations/gtm/index.js +37 -24
- package/analytics/integrations/gtm/index.js.map +1 -1
- package/analytics/integrations/unslugify.d.ts +1 -0
- package/analytics/integrations/unslugify.js +16 -0
- package/analytics/integrations/unslugify.js.map +1 -0
- package/analytics/trackerRegistry.d.ts +2 -0
- package/analytics/trackerRegistry.js.map +1 -1
- package/analytics/utils/breadcrumbsWithoutProduct.d.ts +1 -0
- package/analytics/utils/breadcrumbsWithoutProduct.js +9 -0
- package/analytics/utils/breadcrumbsWithoutProduct.js.map +1 -0
- package/cart/AddToCartFormik.d.ts +2 -2
- package/cart/AddToCartFormik.js +11 -11
- package/cart/AddToCartFormik.js.map +1 -1
- package/components/ChannelContext/ChannelProvider.test.js +3 -1
- package/components/DynamicRoute/ProductRoute.js +12 -4
- package/components/DynamicRoute/ProductRoute.js.map +1 -1
- package/components/Head.js +4 -4
- package/components/Head.js.map +1 -1
- package/components/Mutation/AddToCart/addToCartUtils.d.ts +1 -1
- package/components/Mutation/AddToCart/addToCartUtils.js +7 -1
- package/components/Mutation/AddToCart/addToCartUtils.js.map +1 -1
- package/components/Mutation/RemoveFromCart.js +10 -1
- package/components/Mutation/RemoveFromCart.js.map +1 -1
- package/components/Mutation/useDecrementQuantity.js +8 -3
- package/components/Mutation/useDecrementQuantity.js.map +1 -1
- package/components/Mutation/useIncrementQuantity.js +8 -3
- package/components/Mutation/useIncrementQuantity.js.map +1 -1
- package/components/Mutation/useRemoveFromCart.js +10 -1
- package/components/Mutation/useRemoveFromCart.js.map +1 -1
- package/components/StructuredData/StructuredBreadcrumbData.d.ts +8 -3
- package/components/StructuredData/StructuredBreadcrumbData.js +42 -24
- package/components/StructuredData/StructuredBreadcrumbData.js.map +1 -1
- package/components/StructuredData/StructuredProductData.js +2 -2
- package/components/StructuredData/StructuredProductData.js.map +1 -1
- package/data/fragments/RouteMetaFragment.gql +18 -0
- package/helpers/isRelativeUrl.d.ts +1 -0
- package/helpers/isRelativeUrl.js +5 -0
- package/helpers/isRelativeUrl.js.map +1 -0
- package/hooks/PackageProducts/usePackageProductItem.d.ts +2 -2
- package/hooks/useAddMultipleToCart.js +11 -5
- package/hooks/useAddMultipleToCart.js.map +1 -1
- package/hooks/useProductVariants/useProductVariants.d.ts +1 -2
- package/hooks/useProductVariants/useProductVariants.js +1 -1
- package/hooks/useProductVariants/useProductVariants.js.map +1 -1
- package/package.json +1 -1
- package/server/tracking/types.d.ts +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import { injectScript } from '../utils/script';
|
2
|
-
import { unSlugify } from './
|
2
|
+
import { unSlugify } from './unslugify';
|
3
3
|
import { getBrand } from '../../../core/components/OpenGraph/OpenGraphProductData';
|
4
4
|
const gtag = () => window.gtag;
|
5
5
|
function productToItem(product, selectedVariation, useArticleNumberAsId = false, brandCustomField) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ga4.js","sourceRoot":"","sources":["ga4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"ga4.js","sourceRoot":"","sources":["ga4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAC;AAEnF,MAAM,IAAI,GAAG,GAAG,EAAE,CAAE,MAAc,CAAC,IAAI,CAAC;AAkBxC,SAAS,aAAa,CACpB,OAAgB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;QACL,CAAC;QACD,eAAe,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO;YAChD,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE;gBAC3B,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;gBAC9B,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QACD,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO;YACrC,IAAI,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;YAClC,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;QACpD,CAAC;QACD,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;YACrC,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,kBAAkB,CAAC,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO;YAClE,IAAI,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE;gBACjC,aAAa;gBACb,WAAW;gBACX,OAAO;aACR,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Tracker } from '../../trackerRegistry';
|
2
|
-
export declare function unSlugify(slug?: string): string;
|
3
2
|
export declare const gtagTracker: ({ trackingId, additionalGtagTrackingIds, currency, brandCustomField, useArticleNumberAsId }: {
|
4
3
|
trackingId: string;
|
5
4
|
additionalGtagTrackingIds: string[];
|
@@ -1,32 +1,20 @@
|
|
1
1
|
import { injectScript } from '../../utils/script';
|
2
2
|
import { getBrand } from '../../../components/OpenGraph/OpenGraphProductData';
|
3
|
+
import { unSlugify } from '../unslugify';
|
4
|
+
import { breadcrumbsWithoutProduct } from '../../utils/breadcrumbsWithoutProduct';
|
3
5
|
const gtag = () => window.gtag;
|
4
|
-
|
5
|
-
if (slug) {
|
6
|
-
slug = slug
|
7
|
-
.split('-')
|
8
|
-
.map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
|
9
|
-
.join(' ');
|
10
|
-
slug = slug
|
11
|
-
.split('/')
|
12
|
-
.map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
|
13
|
-
.join('/');
|
14
|
-
}
|
15
|
-
return slug;
|
16
|
-
}
|
17
|
-
function getProductData(product, selectedVariation, useArticleNumberAsId = false, brandCustomField) {
|
18
|
-
var _a, _b, _c, _d;
|
6
|
+
function getProductData({ product, selectedVariation, useArticleNumberAsId = false, brandCustomField, category = '' }) {
|
19
7
|
const brand = getBrand(product, brandCustomField);
|
20
8
|
if (useArticleNumberAsId) {
|
21
9
|
return {
|
22
|
-
id: product.articleNumber,
|
10
|
+
id: (selectedVariation === null || selectedVariation === void 0 ? void 0 : selectedVariation.articleNumber) || product.articleNumber,
|
23
11
|
productId: product.id,
|
24
12
|
productSKU: product.articleNumber,
|
25
13
|
variant: selectedVariation === null || selectedVariation === void 0 ? void 0 : selectedVariation.values.join('_'),
|
26
14
|
variantSKU: selectedVariation === null || selectedVariation === void 0 ? void 0 : selectedVariation.articleNumber,
|
27
15
|
name: product.name,
|
28
16
|
base_product: product.articleNumber,
|
29
|
-
category
|
17
|
+
category,
|
30
18
|
brand
|
31
19
|
};
|
32
20
|
}
|
@@ -35,12 +23,10 @@ function getProductData(product, selectedVariation, useArticleNumberAsId = false
|
|
35
23
|
// Changing this could affect the statistics in Google Ads/Merchant/Analytics, so we want the new behaviour to be opt-in.
|
36
24
|
return {
|
37
25
|
id: product.id,
|
38
|
-
variant: selectedVariation
|
39
|
-
? selectedVariation.articleNumber
|
40
|
-
: product.articleNumber,
|
26
|
+
variant: (selectedVariation === null || selectedVariation === void 0 ? void 0 : selectedVariation.articleNumber) || product.articleNumber,
|
41
27
|
name: product.name,
|
42
|
-
|
43
|
-
category
|
28
|
+
base_prduct: product.articleNumber,
|
29
|
+
category,
|
44
30
|
brand
|
45
31
|
};
|
46
32
|
}
|
@@ -77,8 +63,14 @@ export const gtagTracker = ({ trackingId, additionalGtagTrackingIds = [], curren
|
|
77
63
|
injectScript({ src: script });
|
78
64
|
gtag();
|
79
65
|
},
|
80
|
-
trackProduct({ quantity, action, product, selectedVariation, list, listName, index }, context, eventId) {
|
81
|
-
const productData = Object.assign(Object.assign({}, getProductData(
|
66
|
+
trackProduct({ quantity, action, product, selectedVariation, list, listName, index, category }, context, eventId) {
|
67
|
+
const productData = Object.assign(Object.assign({}, getProductData({
|
68
|
+
product,
|
69
|
+
selectedVariation,
|
70
|
+
useArticleNumberAsId,
|
71
|
+
brandCustomField,
|
72
|
+
category
|
73
|
+
})), { price: (selectedVariation && selectedVariation.price.incVat) ||
|
82
74
|
(product.price && product.price.incVat), quantity, list_name: list || listName || context.list, list_position: index });
|
83
75
|
switch (action) {
|
84
76
|
case 'click':
|
@@ -117,7 +109,18 @@ export const gtagTracker = ({ trackingId, additionalGtagTrackingIds = [], curren
|
|
117
109
|
}
|
118
110
|
},
|
119
111
|
trackCartCheckout({ cart }, _context, eventId) {
|
120
|
-
const items = cart.items.map((item) =>
|
112
|
+
const items = cart.items.map((item) => {
|
113
|
+
var _a, _b, _c;
|
114
|
+
return (Object.assign(Object.assign({}, getProductData({
|
115
|
+
product: item.product,
|
116
|
+
selectedVariation: item.variant,
|
117
|
+
useArticleNumberAsId,
|
118
|
+
brandCustomField,
|
119
|
+
category: breadcrumbsWithoutProduct((_a = item.product.primaryRoute) === null || _a === void 0 ? void 0 : _a.breadcrumbs) ||
|
120
|
+
unSlugify((_c = (_b = item.product.canonicalCategory) === null || _b === void 0 ? void 0 : _b.primaryRoute) === null || _c === void 0 ? void 0 : _c.path) ||
|
121
|
+
''
|
122
|
+
})), { price: item.total.incVat, quantity: item.quantity }));
|
123
|
+
});
|
121
124
|
gtag()('event', 'begin_checkout', {
|
122
125
|
currency,
|
123
126
|
items,
|
@@ -132,10 +135,18 @@ export const gtagTracker = ({ trackingId, additionalGtagTrackingIds = [], curren
|
|
132
135
|
eventId
|
133
136
|
});
|
134
137
|
},
|
135
|
-
trackList({ listName, products }, _context, eventId) {
|
138
|
+
trackList({ listName, products, category }, _context, eventId) {
|
136
139
|
const productData = products.map((product, i) => {
|
137
|
-
var _a;
|
138
|
-
return (Object.assign(Object.assign({}, getProductData(
|
140
|
+
var _a, _b, _c, _d;
|
141
|
+
return (Object.assign(Object.assign({}, getProductData({
|
142
|
+
product,
|
143
|
+
selectedVariation: null,
|
144
|
+
useArticleNumberAsId,
|
145
|
+
brandCustomField,
|
146
|
+
category: category ||
|
147
|
+
breadcrumbsWithoutProduct((_a = product === null || product === void 0 ? void 0 : product.primaryRoute) === null || _a === void 0 ? void 0 : _a.breadcrumbs) ||
|
148
|
+
unSlugify((_c = (_b = product === null || product === void 0 ? void 0 : product.canonicalCategory) === null || _b === void 0 ? void 0 : _b.primaryRoute) === null || _c === void 0 ? void 0 : _c.path)
|
149
|
+
})), { price: (_d = product.price) === null || _d === void 0 ? void 0 : _d.incVat, list_name: listName, list_position: i }));
|
139
150
|
});
|
140
151
|
gtag()('event', 'view_item_list', {
|
141
152
|
currency,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gtag.js","sourceRoot":"","sources":["gtag.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,oDAAoD,CAAC;
|
1
|
+
{"version":3,"file":"gtag.js","sourceRoot":"","sources":["gtag.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,oDA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O,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,kBAAkB,CAAC,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO;QAClE,IAAI,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE;YACjC,aAAa;YACb,WAAW;YACX,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { injectScript } from '../../utils/script';
|
2
2
|
import { getBrand } from '@jetshop/core/components/OpenGraph/OpenGraphProductData';
|
3
|
+
import { unSlugify } from '../unslugify';
|
4
|
+
import { breadcrumbsWithoutProduct } from '../../utils/breadcrumbsWithoutProduct';
|
3
5
|
function push(event) {
|
4
6
|
if (window.dataLayer) {
|
5
7
|
if (event.ecommerce) {
|
@@ -8,31 +10,17 @@ function push(event) {
|
|
8
10
|
window.dataLayer.push(event);
|
9
11
|
}
|
10
12
|
}
|
11
|
-
|
12
|
-
if (slug) {
|
13
|
-
slug = slug
|
14
|
-
.split('-')
|
15
|
-
.map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
|
16
|
-
.join(' ');
|
17
|
-
slug = slug
|
18
|
-
.split('/')
|
19
|
-
.map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
|
20
|
-
.join('/');
|
21
|
-
}
|
22
|
-
return slug;
|
23
|
-
}
|
24
|
-
function getProductData(product, selectedVariation, useArticleNumberAsId = false, brandCustomField) {
|
25
|
-
var _a, _b, _c, _d;
|
13
|
+
function getProductData({ product, selectedVariation, useArticleNumberAsId = false, brandCustomField, category = '' }) {
|
26
14
|
if (useArticleNumberAsId) {
|
27
15
|
return {
|
28
|
-
id: product.articleNumber,
|
16
|
+
id: (selectedVariation === null || selectedVariation === void 0 ? void 0 : selectedVariation.articleNumber) || product.articleNumber,
|
29
17
|
productId: product.id,
|
30
18
|
productSKU: product.articleNumber,
|
31
19
|
variant: selectedVariation === null || selectedVariation === void 0 ? void 0 : selectedVariation.values.join('_'),
|
32
20
|
variantSKU: selectedVariation === null || selectedVariation === void 0 ? void 0 : selectedVariation.articleNumber,
|
33
21
|
name: product.name,
|
34
22
|
base_product: product.articleNumber,
|
35
|
-
category
|
23
|
+
category,
|
36
24
|
brand: getBrand(product, brandCustomField)
|
37
25
|
};
|
38
26
|
}
|
@@ -46,7 +34,7 @@ function getProductData(product, selectedVariation, useArticleNumberAsId = false
|
|
46
34
|
: product.articleNumber,
|
47
35
|
name: product.name,
|
48
36
|
base_product: product.articleNumber,
|
49
|
-
category
|
37
|
+
category,
|
50
38
|
brand: getBrand(product, brandCustomField)
|
51
39
|
};
|
52
40
|
}
|
@@ -68,8 +56,14 @@ export const gtmTracker = ({ containerId, currency, useArticleNumberAsId = false
|
|
68
56
|
});
|
69
57
|
injectScript({ src: script });
|
70
58
|
},
|
71
|
-
trackProduct({ quantity, action, product, selectedVariation, list, listName, index }, context) {
|
72
|
-
const productData = Object.assign(Object.assign({}, getProductData(
|
59
|
+
trackProduct({ quantity, action, product, selectedVariation, list, listName, index, category }, context) {
|
60
|
+
const productData = Object.assign(Object.assign({}, getProductData({
|
61
|
+
product,
|
62
|
+
selectedVariation,
|
63
|
+
useArticleNumberAsId,
|
64
|
+
brandCustomField,
|
65
|
+
category
|
66
|
+
})), { price: (selectedVariation && selectedVariation.price.incVat) ||
|
73
67
|
(product.price && product.price.incVat), quantity, position: index });
|
74
68
|
switch (action) {
|
75
69
|
case 'click':
|
@@ -129,7 +123,18 @@ export const gtmTracker = ({ containerId, currency, useArticleNumberAsId = false
|
|
129
123
|
}
|
130
124
|
},
|
131
125
|
trackCartCheckout({ cart }) {
|
132
|
-
const items = cart.items.map((item) =>
|
126
|
+
const items = cart.items.map((item) => {
|
127
|
+
var _a, _b, _c;
|
128
|
+
return (Object.assign(Object.assign({}, getProductData({
|
129
|
+
product: item.product,
|
130
|
+
selectedVariation: item.variant,
|
131
|
+
useArticleNumberAsId,
|
132
|
+
brandCustomField,
|
133
|
+
category: breadcrumbsWithoutProduct((_a = item.product.primaryRoute) === null || _a === void 0 ? void 0 : _a.breadcrumbs) ||
|
134
|
+
unSlugify((_c = (_b = item.product.canonicalCategory) === null || _b === void 0 ? void 0 : _b.primaryRoute) === null || _c === void 0 ? void 0 : _c.path) ||
|
135
|
+
''
|
136
|
+
})), { price: item.total.incVat, quantity: item.quantity }));
|
137
|
+
});
|
133
138
|
push({
|
134
139
|
event: 'checkout',
|
135
140
|
ecommerce: {
|
@@ -144,10 +149,18 @@ export const gtmTracker = ({ containerId, currency, useArticleNumberAsId = false
|
|
144
149
|
pageTitle: title
|
145
150
|
});
|
146
151
|
},
|
147
|
-
trackList({ listName, products }) {
|
152
|
+
trackList({ listName, products, category }) {
|
148
153
|
const productData = products.map((product, i) => {
|
149
|
-
var _a;
|
150
|
-
return (Object.assign(Object.assign({}, getProductData(
|
154
|
+
var _a, _b, _c, _d;
|
155
|
+
return (Object.assign(Object.assign({}, getProductData({
|
156
|
+
product,
|
157
|
+
selectedVariation: null,
|
158
|
+
useArticleNumberAsId,
|
159
|
+
brandCustomField,
|
160
|
+
category: category ||
|
161
|
+
breadcrumbsWithoutProduct((_a = product === null || product === void 0 ? void 0 : product.primaryRoute) === null || _a === void 0 ? void 0 : _a.breadcrumbs) ||
|
162
|
+
unSlugify((_c = (_b = product === null || product === void 0 ? void 0 : product.canonicalCategory) === null || _b === void 0 ? void 0 : _b.primaryRoute) === null || _c === void 0 ? void 0 : _c.path)
|
163
|
+
})), { price: (_d = product.price) === null || _d === void 0 ? void 0 : _d.incVat, position: i, list: listName }));
|
151
164
|
});
|
152
165
|
push({
|
153
166
|
event: 'productList',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,y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AAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function unSlugify(slug?: string): string;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import logWarningInDev from '@jetshop/core/helpers/logWarningInDev';
|
2
|
+
export function unSlugify(slug) {
|
3
|
+
logWarningInDev(true, 'Update your queries to request "breadcrumbs" on routes, for improved performance');
|
4
|
+
if (slug) {
|
5
|
+
slug = slug
|
6
|
+
.split('-')
|
7
|
+
.map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
|
8
|
+
.join(' ');
|
9
|
+
slug = slug
|
10
|
+
.split('/')
|
11
|
+
.map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
|
12
|
+
.join('/');
|
13
|
+
}
|
14
|
+
return slug;
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=unslugify.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unslugify.js","sourceRoot":"","sources":["unslugify.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,uCAAuC,CAAC;AAEpE,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,eAAe,CACb,IAAI,EACJ,kFAAkF,CACnF,CAAC;IACF,IAAI,IAAI,EAAE;QACR,IAAI,GAAG,IAAI;aACR,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CACjE;aACA,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,IAAI,GAAG,IAAI;aACR,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CACjE;aACA,IAAI,CAAC,GAAG,CAAC,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
@@ -15,6 +15,7 @@ export interface TrackProductProps {
|
|
15
15
|
index?: number;
|
16
16
|
/** The quantity of items added/removed from cart */
|
17
17
|
quantity?: number;
|
18
|
+
category: string;
|
18
19
|
}
|
19
20
|
export interface TrackCartProps {
|
20
21
|
cart: Cart;
|
@@ -22,6 +23,7 @@ export interface TrackCartProps {
|
|
22
23
|
export interface TrackListProps {
|
23
24
|
listName: string;
|
24
25
|
products: Product[];
|
26
|
+
category: string;
|
25
27
|
}
|
26
28
|
export interface TrackPageProps {
|
27
29
|
pathname: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"trackerRegistry.js","sourceRoot":"","sources":["trackerRegistry.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"trackerRegistry.js","sourceRoot":"","sources":["trackerRegistry.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,MAAM,eAAe,CAAC;AAiI1C,MAAM,CAAC,MAAM,cAAc,GAAiC;IAC1D,cAAc;IACd,mBAAmB;IACnB,WAAW;IACX,WAAW;IACX,eAAe;IACf,iBAAiB;IACjB,WAAW;IACX,YAAY;IACZ,eAAe;IACf,oBAAoB;CACrB,CAAC;AA4BF,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,oBAAoB,EAIrB;IACC,MAAM,QAAQ,GAAG;QACf,oBAAoB;QACpB,QAAQ;KACT,CAAC;IACF,MAAM,aAAa,GAAY;QAC7B,IAAI,EAAE,QAAQ;QACd,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO;YAClC,KAAK,CAAC,4BAA4B,EAAE;gBAClC,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc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D,IAAI;gBACF,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aAC3B;YAAC,OAAO,GAAG,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,SAAS,OAAO,CAAC,IAAI,cAAc,EAAE;oBACjD,GAAG;oBACH,IAAI;iBACL,CAAC,CAAC;aACJ;QACH,CAAC;KACF,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function breadcrumbsWithoutProduct(breadcrumbs?: string[]): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"breadcrumbsWithoutProduct.js","sourceRoot":"","sources":["breadcrumbsWithoutProduct.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,yBAAyB,CAAC,WAAsB;IAC9D,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,EAAE;QACrC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC3C;SAAM;QACL,OAAO,EAAE,CAAC;KACX;AACH,CAAC"}
|
@@ -22,7 +22,7 @@ interface AddToCartFormikProps {
|
|
22
22
|
product: Product;
|
23
23
|
variant?: ProductVariant;
|
24
24
|
commentValidators?: {
|
25
|
-
[commentName: string]: ({ name, value
|
25
|
+
[commentName: string]: ({ name, value }: {
|
26
26
|
name?: string;
|
27
27
|
value: string;
|
28
28
|
}) => string;
|
@@ -38,5 +38,5 @@ interface AddToCartFormikProps {
|
|
38
38
|
}) => void;
|
39
39
|
children: (props: FormikProps<AddToCartFormikValues>) => React.ReactNode;
|
40
40
|
}
|
41
|
-
export declare function AddToCartFormik({ product, variant, commentValidators, getMissingOptions, initialValues, onAddToCartInit, onAddToCartError, onAddToCartSuccess, cartQuery, cartMutation, children
|
41
|
+
export declare function AddToCartFormik({ product, variant, commentValidators, getMissingOptions, initialValues, onAddToCartInit, onAddToCartError, onAddToCartSuccess, cartQuery, cartMutation, children }: AddToCartFormikProps): JSX.Element;
|
42
42
|
export default AddToCartFormik;
|
package/cart/AddToCartFormik.js
CHANGED
@@ -11,7 +11,7 @@ import React from 'react';
|
|
11
11
|
import { useAddToCart } from './useAddToCart';
|
12
12
|
import { FormikProvider } from 'formik';
|
13
13
|
import { useApolloClient, useMutation } from '@apollo/react-hooks';
|
14
|
-
import { addToCartError, addToCartSuccess, useTrackProductAdd
|
14
|
+
import { addToCartError, addToCartSuccess, useTrackProductAdd } from '../components/Mutation/AddToCart/addToCartUtils';
|
15
15
|
import { uniqueId } from 'lodash';
|
16
16
|
import { getAddToCartOptimisticResponse } from '../components/Mutation/cartMutationUtils';
|
17
17
|
import { useCartId } from '../components/Cart/CartIdContext';
|
@@ -19,10 +19,10 @@ export function AddToCartFormik({ product, variant, commentValidators = {}, getM
|
|
19
19
|
// Apollo specific props
|
20
20
|
onAddToCartInit, onAddToCartError, onAddToCartSuccess, cartQuery, cartMutation,
|
21
21
|
// Backwards compatability with render props
|
22
|
-
children
|
22
|
+
children }) {
|
23
23
|
const client = useApolloClient();
|
24
24
|
const [addToCartMutation] = useMutation(cartMutation, {
|
25
|
-
onCompleted: () => localStorage.setItem('cartChange', '1')
|
25
|
+
onCompleted: () => localStorage.setItem('cartChange', '1')
|
26
26
|
});
|
27
27
|
const { cartId, setCartId } = useCartId();
|
28
28
|
const trackAddProductVariant = useTrackProductAdd(variant);
|
@@ -35,31 +35,31 @@ children, }) {
|
|
35
35
|
price: optimistic.price,
|
36
36
|
quantity: input.quantity,
|
37
37
|
selectedVariation: variant,
|
38
|
-
mutationId
|
38
|
+
mutationId
|
39
39
|
};
|
40
40
|
if (onAddToCartInit) {
|
41
41
|
onAddToCartInit(callbackOptions);
|
42
42
|
}
|
43
43
|
return addToCartMutation({
|
44
44
|
variables: {
|
45
|
-
input
|
45
|
+
input
|
46
46
|
},
|
47
47
|
optimisticResponse: {
|
48
48
|
addToCart: {
|
49
49
|
cart: getAddToCartOptimisticResponse(optimistic.product, input.quantity, cartId, client, cartQuery),
|
50
|
-
__typename: 'CartMutation'
|
51
|
-
}
|
52
|
-
}
|
50
|
+
__typename: 'CartMutation'
|
51
|
+
}
|
52
|
+
}
|
53
53
|
})
|
54
54
|
.then(addToCartSuccess({
|
55
55
|
onAddToCartSuccess,
|
56
56
|
callbackOptions,
|
57
57
|
cartId,
|
58
|
-
setCartId
|
58
|
+
setCartId
|
59
59
|
}))
|
60
60
|
.catch(addToCartError({
|
61
61
|
onAddToCartError,
|
62
|
-
callbackOptions
|
62
|
+
callbackOptions
|
63
63
|
}));
|
64
64
|
});
|
65
65
|
}
|
@@ -69,7 +69,7 @@ children, }) {
|
|
69
69
|
commentValidators,
|
70
70
|
getMissingOptions,
|
71
71
|
initialValues,
|
72
|
-
submit
|
72
|
+
submit
|
73
73
|
});
|
74
74
|
return React.createElement(FormikProvider, { value: form }, children(form));
|
75
75
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AddToCartFormik.js","sourceRoot":"","sources":["AddToCartFormik.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAe,MAAM,QAAQ,CAAC;AAWrD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,
|
1
|
+
{"version":3,"file":"AddToCartFormik.js","sourceRoot":"","sources":["AddToCartFormik.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAe,MAAM,QAAQ,CAAC;AAWrD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAC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AAS,EAAE;oBACT,KAAK;iBACN;gBACD,kBAAkB,EAAE;oBAClB,SAAS,EAAE;wBACT,IAAI,EAAE,8BAA8B,CAClC,UAAU,CAAC,OAAO,EAClB,KAAK,CAAC,QAAQ,EACd,MAAM,EACN,MAAM,EACN,SAAS,CACV;wBACD,UAAU,EAAE,cAAc;qBAC3B;iBACF;aACF,CAAC;iBACC,IAAI,CACH,gBAAgB,CAAC;gBACf,kBAAkB;gBAClB,eAAe;gBACf,MAAM;gBACN,SAAS;aACV,CAAC,CACH;iBACA,KAAK,CACJ,cAAc,CAAC;gBACb,gBAAgB;gBAChB,eAAe;aAChB,CAAC,CACH,CAAC;QACN,CAAC;KAAA;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;QAC5B,OAAO;QACP,OAAO;QACP,iBAAiB;QACjB,iBAAiB;QACjB,aAAa;QACb,MAAM;KACP,CAAC,CAAC;IAEH,OAAO,oBAAC,cAAc,IAAC,KAAK,EAAE,IAAI,IAAG,QAAQ,CAAC,IAAI,CAAC,CAAkB,CAAC;AACxE,CAAC;AAED,eAAe,eAAe,CAAC"}
|
@@ -63,11 +63,12 @@ describe('ChannelProvider', () => {
|
|
63
63
|
|
64
64
|
test('Updating a channel', async () => {
|
65
65
|
const newChannel = createSelectedChannel(channels[1]);
|
66
|
+
const newPath = '/foo/bar';
|
66
67
|
|
67
68
|
const channelHandler = new ChannelHandler({
|
68
69
|
selectedChannel,
|
69
70
|
channels,
|
70
|
-
getPrimaryRoutePath: (
|
71
|
+
getPrimaryRoutePath: () => Promise.resolve(newPath)
|
71
72
|
});
|
72
73
|
|
73
74
|
render(
|
@@ -99,6 +100,7 @@ describe('ChannelProvider', () => {
|
|
99
100
|
expect(window.location.assign).toHaveBeenCalled();
|
100
101
|
|
101
102
|
const newUrl = new URL(window.location.assign.mock.calls[0][0]);
|
103
|
+
expect(newUrl.pathname).toBe(newPath);
|
102
104
|
expect(newUrl.searchParams.get('channel')).toBe(newChannel.name);
|
103
105
|
expect(newUrl.searchParams.get('channelCountry')).toBe(
|
104
106
|
newChannel.country.code
|
@@ -17,6 +17,8 @@ import { useShopConfig } from '../../hooks/useShopConfig';
|
|
17
17
|
import ProductConfigurationProvider from '../ProductConfigurationProvider/ProductConfigurationProvider';
|
18
18
|
import { StructuredProductData } from '../StructuredData';
|
19
19
|
import { OpenGraphProductData } from '../OpenGraph';
|
20
|
+
import { unSlugify } from '@jetshop/core/analytics/integrations/unslugify';
|
21
|
+
import { breadcrumbsWithoutProduct } from '@jetshop/core/analytics/utils/breadcrumbsWithoutProduct';
|
20
22
|
const ProductRoute = (props) => {
|
21
23
|
var _a, _b, _c;
|
22
24
|
const { component: ProductPage, partialProduct } = props, rest = __rest(props, ["component", "partialProduct"]);
|
@@ -33,14 +35,20 @@ const ProductRoute = (props) => {
|
|
33
35
|
? !!openGraph.disableDefaultProductData
|
34
36
|
: false;
|
35
37
|
useEffect(() => {
|
36
|
-
var _a;
|
37
|
-
product
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
39
|
+
if (((_b = (_a = props.result.data) === null || _a === void 0 ? void 0 : _a.route) === null || _b === void 0 ? void 0 : _b.object) || ((_c = props.result.data) === null || _c === void 0 ? void 0 : _c.product)) {
|
40
|
+
const category = breadcrumbsWithoutProduct(((_e = (_d = props.result.data) === null || _d === void 0 ? void 0 : _d.route) === null || _e === void 0 ? void 0 : _e.breadcrumbs) ||
|
41
|
+
((_h = (_g = (_f = props.result.data) === null || _f === void 0 ? void 0 : _f.product) === null || _g === void 0 ? void 0 : _g.primaryRoute) === null || _h === void 0 ? void 0 : _h.breadcrumbs)) ||
|
42
|
+
unSlugify((_k = (_j = product.canonicalCategory) === null || _j === void 0 ? void 0 : _j.primaryRoute) === null || _k === void 0 ? void 0 : _k.path) ||
|
43
|
+
'';
|
38
44
|
track(trackProductEvent({
|
39
45
|
action: 'view',
|
40
46
|
product,
|
41
|
-
list: (
|
47
|
+
list: (_l = location.state) === null || _l === void 0 ? void 0 : _l.list,
|
48
|
+
category
|
42
49
|
}));
|
43
|
-
|
50
|
+
}
|
51
|
+
}, [location.state, product, track, props.result.data]);
|
44
52
|
return (React.createElement(React.Fragment, null,
|
45
53
|
product && (React.createElement(React.Fragment, null,
|
46
54
|
!disableStructuredProductData && (React.createElement(StructuredProductData, { product: product })),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ProductRoute.js","sourceRoot":"","sources":["ProductRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAAK,EAAE,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,4BAA4B,MAAM,8DAA8D,CAAC;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"ProductRoute.js","sourceRoot":"","sources":["ProductRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAAK,EAAE,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,4BAA4B,MAAM,8DAA8D,CAAC;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC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