@jetshop/core 5.11.2 → 5.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/analytics/AnalyticsProvider.d.ts +4 -0
- package/analytics/AnalyticsProvider.js +17 -1
- package/analytics/AnalyticsProvider.js.map +1 -1
- package/analytics/integrations/releware/index.js +1 -1
- package/analytics/integrations/releware/index.js.map +1 -1
- package/analytics/integrations/unslugify.js +6 -4
- package/analytics/integrations/unslugify.js.map +1 -1
- package/analytics/trackerRegistry.d.ts +6 -3
- package/analytics/trackerRegistry.js +31 -14
- package/analytics/trackerRegistry.js.map +1 -1
- package/analytics/utils/breadcrumbsWithoutProduct.js +1 -1
- package/analytics/utils/breadcrumbsWithoutProduct.js.map +1 -1
- package/boot/PreviewHandler.js.map +1 -1
- package/components/ChannelContext/ChannelContext.d.ts +2 -0
- package/components/ChannelContext/ChannelContext.js.map +1 -1
- package/components/ChannelContext/ChannelProvider.js +18 -1
- package/components/ChannelContext/ChannelProvider.js.map +1 -1
- package/components/ConfigProvider.d.ts +2 -0
- package/components/ConfigProvider.js.map +1 -1
- package/components/DynamicRoute/CategoryRoute.js +9 -2
- package/components/DynamicRoute/CategoryRoute.js.map +1 -1
- package/components/DynamicRoute/ContentRoute.js +9 -1
- package/components/DynamicRoute/ContentRoute.js.map +1 -1
- package/components/DynamicRoute/PreviewRoute.js +12 -2
- package/components/DynamicRoute/PreviewRoute.js.map +1 -1
- package/components/PreviewContext.js +3 -1
- package/components/PreviewContext.js.map +1 -1
- package/components/StructuredData/StructuredCategoryData.d.ts +16 -0
- package/components/StructuredData/StructuredCategoryData.js +18 -0
- package/components/StructuredData/StructuredCategoryData.js.map +1 -0
- package/components/StructuredData/StructuredPageData.d.ts +16 -0
- package/components/StructuredData/StructuredPageData.js +17 -0
- package/components/StructuredData/StructuredPageData.js.map +1 -0
- package/components/StructuredData/index.d.ts +2 -0
- package/components/StructuredData/index.js +2 -0
- package/components/StructuredData/index.js.map +1 -1
- package/data/fragments/ChannelsFragment.gql +4 -0
- package/helpers/isRelativeUrl.js +0 -1
- package/helpers/isRelativeUrl.js.map +1 -1
- package/hooks/PackageProducts/usePackageProductItem.d.ts +1 -2
- package/package.json +1 -1
- package/server/tracking/facebook.d.ts +1 -1
- package/server/tracking/facebook.js +4 -2
- package/server/tracking/facebook.js.map +1 -1
- package/server/tracking/types.d.ts +2 -0
- package/types.d.ts +5 -2
@@ -28,6 +28,10 @@ export declare const AnalyticsContext: Context<AnalyticsProviderContext>;
|
|
28
28
|
export interface AnalyticsProviderProps {
|
29
29
|
releware?: AnalyticsConfigReleware;
|
30
30
|
}
|
31
|
+
export declare const getFacebookCapi: (selectedChannel: SelectedChannel) => {
|
32
|
+
token: string;
|
33
|
+
pixelId: string;
|
34
|
+
};
|
31
35
|
export declare const getGoogleAnalytics: (config: BootOptions, selectedChannel: SelectedChannel) => {
|
32
36
|
trackingID: string;
|
33
37
|
useArticleNumberAsId: boolean;
|
@@ -30,6 +30,19 @@ export const AnalyticsContext = createContext({
|
|
30
30
|
config: initialAnalyticsConfig,
|
31
31
|
trackerRegistry: null
|
32
32
|
});
|
33
|
+
export const getFacebookCapi = (selectedChannel) => {
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
35
|
+
let token, pixelId;
|
36
|
+
if (((_c = (_b = (_a = selectedChannel.settings) === null || _a === void 0 ? void 0 : _a.tracking) === null || _b === void 0 ? void 0 : _b.fca) === null || _c === void 0 ? void 0 : _c.accessToken) &&
|
37
|
+
((_f = (_e = (_d = selectedChannel.settings) === null || _d === void 0 ? void 0 : _d.tracking) === null || _e === void 0 ? void 0 : _e.fca) === null || _f === void 0 ? void 0 : _f.pixelId)) {
|
38
|
+
token = (_j = (_h = (_g = selectedChannel.settings) === null || _g === void 0 ? void 0 : _g.tracking) === null || _h === void 0 ? void 0 : _h.fca) === null || _j === void 0 ? void 0 : _j.accessToken;
|
39
|
+
pixelId = (_m = (_l = (_k = selectedChannel.settings) === null || _k === void 0 ? void 0 : _k.tracking) === null || _l === void 0 ? void 0 : _l.fca) === null || _m === void 0 ? void 0 : _m.pixelId;
|
40
|
+
}
|
41
|
+
return {
|
42
|
+
token,
|
43
|
+
pixelId
|
44
|
+
};
|
45
|
+
};
|
33
46
|
export const getGoogleAnalytics = (config, selectedChannel) => {
|
34
47
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
35
48
|
// Channel overrides are used in order to support channel specific overrides for certain shop config variables. You can read more here: https://docs.dev.jetshop.se/features/shop-config#other-options
|
@@ -60,6 +73,7 @@ const AnalyticsProvider = function AnalyticsProvider(props) {
|
|
60
73
|
const shopConfig = useShopConfig();
|
61
74
|
const { selectedChannel } = useContext(ChannelContext);
|
62
75
|
const { tagManagerID, trackingID, useArticleNumberAsId, additionalGtagTrackingIds } = getGoogleAnalytics(shopConfig, selectedChannel);
|
76
|
+
const { pixelId, token } = getFacebookCapi(selectedChannel);
|
63
77
|
const trackingAllowed = allowsTrackingWithDNT();
|
64
78
|
const analyticsConfig = React.useMemo(() => ({
|
65
79
|
gtag: {
|
@@ -125,7 +139,9 @@ const AnalyticsProvider = function AnalyticsProvider(props) {
|
|
125
139
|
if (shopConfig.serverTrackers) {
|
126
140
|
registry.add(createServerTracker({
|
127
141
|
currency: selectedChannel.currency.format.code,
|
128
|
-
useArticleNumberAsId: gtag.useArticleNumberAsId
|
142
|
+
useArticleNumberAsId: gtag.useArticleNumberAsId,
|
143
|
+
pixelId,
|
144
|
+
token
|
129
145
|
}));
|
130
146
|
}
|
131
147
|
const value = useMemo(() => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AnalyticsProvider.js","sourceRoot":"","sources":["AnalyticsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAW,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,WA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AE,CAAC;KACvD;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
@@ -33,7 +33,7 @@ export const relewareTracker = (config) => ({
|
|
33
33
|
console.log('Error: Releware did not receive a valid cart to track');
|
34
34
|
return;
|
35
35
|
}
|
36
|
-
args.cart.items.map(item => track({ productId: item.product.id, logType: 'buy_item' }, config));
|
36
|
+
args.cart.items.map((item) => track({ productId: item.product.id, logType: 'buy_item' }, config));
|
37
37
|
}
|
38
38
|
});
|
39
39
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAQA,SAAS,KAAK,CAAC,OAAsB,EAAE,MAA+B;IACpE,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CACnE,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAC9D,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,OAAsB,EAAE,MAA+B;IAC3E,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAEhC,OAAO,6CAA6C,OAAO,CAAC,SAAS,kBAAkB,OAAO,CAAC,OAAO,QAAQ,OAAO,QAAQ,GAAG,EAAE,CAAC;AACrI,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAA+B,EAAW,EAAE,CAAC,CAAC;IAC5E,IAAI,EAAE,UAAU;IAChB,YAAY,CAAC,IAAI;QACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;YACxE,OAAO;SACR;QAED,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAEvC,QAAQ,IAAI,CAAC,MAAM,EAAE;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
|
.join(' ');
|
9
|
-
slug =
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
slug =
|
10
|
+
'/' +
|
11
|
+
slug
|
12
|
+
.split('/')
|
13
|
+
.map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
|
14
|
+
.join('/');
|
13
15
|
}
|
14
16
|
return slug;
|
15
17
|
}
|
@@ -1 +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;
|
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;YACF,GAAG;gBACH,IAAI;qBACD,KAAK,CAAC,GAAG,CAAC;qBACV,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;qBACA,IAAI,CAAC,GAAG,CAAC,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
@@ -19,6 +19,7 @@ export interface TrackProductProps {
|
|
19
19
|
}
|
20
20
|
export interface TrackCartProps {
|
21
21
|
cart: Cart;
|
22
|
+
callback?: (response?: Response) => void;
|
22
23
|
}
|
23
24
|
export interface TrackListProps {
|
24
25
|
listName: string;
|
@@ -57,7 +58,7 @@ export interface InitOptions {
|
|
57
58
|
}
|
58
59
|
export interface BaseTrackingEvents {
|
59
60
|
trackProduct: (props: TrackProductProps, context: TrackingFunctionContext, eventId?: string) => void;
|
60
|
-
trackCartCheckout: (props: TrackCartProps, context: TrackingFunctionContext, eventId?: string) => void;
|
61
|
+
trackCartCheckout: (props: TrackCartProps, context: TrackingFunctionContext, eventId?: string, callback?: (response: Response) => void) => void;
|
61
62
|
trackCart: (props: TrackCartProps, context: TrackingFunctionContext, eventId?: string) => void;
|
62
63
|
trackList: (props: TrackListProps, context: TrackingFunctionContext, eventId?: string) => void;
|
63
64
|
trackPageView: (props: TrackPageProps, context: TrackingFunctionContext, eventId?: string) => void;
|
@@ -80,7 +81,7 @@ export interface TrackerRegistry {
|
|
80
81
|
on<E extends keyof TrackingEvents>(event: E, args: TrackingEvents[E], opts?: {
|
81
82
|
name?: string;
|
82
83
|
}): void;
|
83
|
-
emit<E extends keyof TrackingEvents>(event: E, props: any, context: TrackingFunctionContext, eventId?: string):
|
84
|
+
emit<E extends keyof TrackingEvents>(event: E, props: any, context: TrackingFunctionContext, eventId?: string): boolean;
|
84
85
|
/**
|
85
86
|
* Add `Tracker` to registry.
|
86
87
|
* - Auto-binds built-in events (see `TrackingEvents`)
|
@@ -88,9 +89,11 @@ export interface TrackerRegistry {
|
|
88
89
|
*/
|
89
90
|
add: (tracker: Tracker) => void;
|
90
91
|
}
|
91
|
-
export declare function createServerTracker({ currency, useArticleNumberAsId }: {
|
92
|
+
export declare function createServerTracker({ currency, useArticleNumberAsId, pixelId, token }: {
|
92
93
|
currency: string;
|
93
94
|
useArticleNumberAsId: boolean;
|
95
|
+
pixelId?: string;
|
96
|
+
token?: string;
|
94
97
|
}): Tracker;
|
95
98
|
export declare function trackerRegistry({ config, inServer }: {
|
96
99
|
config: AnalyticsConfig;
|
@@ -1,3 +1,12 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
1
10
|
import eventemitter3 from 'eventemitter3';
|
2
11
|
export const trackingEvents = [
|
3
12
|
'trackProduct',
|
@@ -11,10 +20,12 @@ export const trackingEvents = [
|
|
11
20
|
'trackRegister',
|
12
21
|
'trackAddToWishList'
|
13
22
|
];
|
14
|
-
export function createServerTracker({ currency, useArticleNumberAsId }) {
|
23
|
+
export function createServerTracker({ currency, useArticleNumberAsId, pixelId, token }) {
|
15
24
|
const defaults = {
|
16
25
|
useArticleNumberAsId,
|
17
|
-
currency
|
26
|
+
currency,
|
27
|
+
pixelId,
|
28
|
+
token
|
18
29
|
};
|
19
30
|
const serverTracker = {
|
20
31
|
name: 'server',
|
@@ -30,14 +41,20 @@ export function createServerTracker({ currency, useArticleNumberAsId }) {
|
|
30
41
|
});
|
31
42
|
},
|
32
43
|
trackCartCheckout(props, context, eventId) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
45
|
+
try {
|
46
|
+
const response = yield fetch(`/_event?event=trackCartCheckout`, {
|
47
|
+
method: 'POST',
|
48
|
+
headers: {
|
49
|
+
'Content-Type': 'application/json'
|
50
|
+
},
|
51
|
+
body: JSON.stringify(Object.assign(Object.assign({}, defaults), { eventId, props: { cart: props.cart }, context, location: window.location.href }))
|
52
|
+
});
|
53
|
+
props.callback(response);
|
54
|
+
}
|
55
|
+
catch (error) {
|
56
|
+
props.callback(error);
|
57
|
+
}
|
41
58
|
});
|
42
59
|
},
|
43
60
|
trackCart(props, context, eventId) {
|
@@ -143,19 +160,19 @@ export function trackerRegistry({ config, inServer }) {
|
|
143
160
|
const events = new eventemitter3();
|
144
161
|
const registry = {
|
145
162
|
on(event, listeners, { name } = {}) {
|
146
|
-
return events.on(event, (...args) => {
|
163
|
+
return events.on(event.toString(), (...args) => __awaiter(this, void 0, void 0, function* () {
|
147
164
|
try {
|
148
|
-
listeners.apply(this, args);
|
165
|
+
return yield listeners.apply(this, args);
|
149
166
|
}
|
150
167
|
catch (err) {
|
151
168
|
console.error(`Error triggering ${event}:${name}`, {
|
152
169
|
err
|
153
170
|
});
|
154
171
|
}
|
155
|
-
});
|
172
|
+
}));
|
156
173
|
},
|
157
174
|
emit(event, props, context, eventId) {
|
158
|
-
return events.emit(event, props, context, eventId);
|
175
|
+
return events.emit(event.toString(), props, context, eventId);
|
159
176
|
},
|
160
177
|
add(tracker) {
|
161
178
|
if (trackers.find(({ name }) => name === tracker.name)) {
|
@@ -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;AAmI1C,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,EACpB,OAAO,EACP,KAAK,EAMN;IACC,MAAM,QAAQ,GAAG;QACf,oBAAoB;QACpB,QAAQ;QACR,OAAO;QACP,KAAK;KACN,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,EAAE,kBAAkB;iBACnC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,iCACf,QAAQ,KACX,OAAO;oBACP,KAAK;oBACL,OAAO,EACP,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,IAC9B;aACH,CAAC,CAAC;QACL,CAAC;QACK,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO;;gBAC7C,IAAI;oBACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iCAAiC,EAAE;wBAC9D,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACP,cAAc,EAAE,kBAAkB;yBACnC;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,iCACf,QAAQ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EAAE;oBACjD,GAAG;oBACH,IAAI;iBACL,CAAC,CAAC;aACJ;QACH,CAAC;KACF,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
@@ -1 +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;
|
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,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjD;SAAM;QACL,OAAO,EAAE,CAAC;KACX;AACH,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PreviewHandler.js","sourceRoot":"","sources":["PreviewHandler.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IAA3B;QACE,YAAO,
|
1
|
+
{"version":3,"file":"PreviewHandler.js","sourceRoot":"","sources":["PreviewHandler.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IAA3B;QACE,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,GAAG,CAAC,UAAmB,EAAE,EAAE;YACnC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;QAC5B,CAAC,CAAC;QAEF,sBAAiB,GAAG,GAAG,EAAE;YACvB,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA"}
|
@@ -8,6 +8,8 @@ export interface SelectedChannel extends Channel {
|
|
8
8
|
export interface ChannelContextValues {
|
9
9
|
channels?: Channel[];
|
10
10
|
updateChannel(newChannel: SelectedChannel): void;
|
11
|
+
restoreCultureForPreview: () => void;
|
12
|
+
setCultureForPreview: (culture: string) => void;
|
11
13
|
selectedChannel?: SelectedChannel;
|
12
14
|
basename?: string;
|
13
15
|
channelsById?: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChannelContext.js","sourceRoot":"","sources":["ChannelContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"ChannelContext.js","sourceRoot":"","sources":["ChannelContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAmBtC,MAAM,cAAc,GAAG,aAAa,CAClC,SAAS,CACV,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -1,11 +1,19 @@
|
|
1
1
|
import React, { useMemo } from 'react';
|
2
2
|
import ChannelContext from './ChannelContext';
|
3
|
+
import { useCookies } from 'react-cookie';
|
3
4
|
const ChannelProvider = ({ channelHandler, children, config }) => {
|
5
|
+
const [cookies] = useCookies(['culture']);
|
4
6
|
const { channels, selectedChannel, recommendedChannel } = channelHandler;
|
5
7
|
const value = useMemo(() => {
|
6
8
|
const updateChannelSingleDomain = (newChannel) => {
|
7
9
|
channelHandler.updateChannel({ config, newChannel });
|
8
10
|
};
|
11
|
+
function setCultureForPreview(culture) {
|
12
|
+
channelHandler.setSelectedChannel(Object.assign(Object.assign({}, selectedChannel), { language: Object.assign(Object.assign({}, selectedChannel.language), { culture }) }));
|
13
|
+
}
|
14
|
+
function restoreCultureForPreview() {
|
15
|
+
channelHandler.setSelectedChannel(Object.assign(Object.assign({}, selectedChannel), { language: Object.assign(Object.assign({}, selectedChannel.language), { culture: cookies.culture }) }));
|
16
|
+
}
|
9
17
|
const channelsById = {};
|
10
18
|
channels &&
|
11
19
|
channels.forEach((channel) => {
|
@@ -17,9 +25,18 @@ const ChannelProvider = ({ channelHandler, children, config }) => {
|
|
17
25
|
channels,
|
18
26
|
selectedChannel,
|
19
27
|
channelsById,
|
28
|
+
setCultureForPreview,
|
29
|
+
restoreCultureForPreview,
|
20
30
|
basename: channelHandler.getChannelBasename() // TODO This isn't used anywhere?
|
21
31
|
};
|
22
|
-
}, [
|
32
|
+
}, [
|
33
|
+
channelHandler,
|
34
|
+
channels,
|
35
|
+
config,
|
36
|
+
cookies.culture,
|
37
|
+
recommendedChannel,
|
38
|
+
selectedChannel
|
39
|
+
]);
|
23
40
|
return (React.createElement(ChannelContext.Provider, { value: value }, children));
|
24
41
|
};
|
25
42
|
export default ChannelProvider;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChannelProvider.js","sourceRoot":"","sources":["ChannelProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,cAAmC,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"ChannelProvider.js","sourceRoot":"","sources":["ChannelProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,cAAmC,MAAM,kBAAkB,CAAC;AAInE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,eAAe,GAAG,CAAC,EACvB,cAAc,EACd,QAAQ,EACR,MAAM,EACe,EAAE,EAAE;IACzB,MAAM,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1C,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,GAAG,cAAc,CAAC;IACzE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,MAAM,yBAAyB,GAAG,CAAC,UAA2B,EAAE,EAAE;YAChE,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,SAAS,oBAAoB,CAAC,OAAe;YAC3C,cAAc,CAAC,kBAAkB,iCAC5B,eAAe,KAClB,QAAQ,kCACH,eAAe,CAAC,QAAQ,KAC3B,OAAO,OAET,CAAC;QACL,CAAC;QAED,SAAS,wBAAwB;YAC/B,cAAc,CAAC,kBAAkB,iCAC5B,eAAe,KAClB,QAAQ,kCACH,eAAe,CAAC,QAAQ,KAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,OAE1B,CAAC;QACL,CAAC;QAED,MAAM,YAAY,GAA+B,EAAE,CAAC;QAEpD,QAAQ;YACN,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;YACrC,CAAC,CAAC,CAAC;QAEL,OAAO;YACL,kBAAkB;YAClB,aAAa,EAAE,yBAAyB;YACxC,QAAQ;YACR,eAAe;YACf,YAAY;YACZ,oBAAoB;YACpB,wBAAwB;YACxB,QAAQ,EAAE,cAAc,CAAC,kBAAkB,EAAE,CAAC,iCAAiC;SAChF,CAAC;IACJ,CAAC,EAAE;QACD,cAAc;QACd,QAAQ;QACR,MAAM;QACN,OAAO,CAAC,OAAO;QACf,kBAAkB;QAClB,eAAe;KAChB,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAA2B,CAC5E,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,eAAe,CAAC"}
|
@@ -65,6 +65,8 @@ export interface BootOptions {
|
|
65
65
|
preserveRedirect: boolean;
|
66
66
|
structuredData: {
|
67
67
|
disableDefaultProductData?: boolean;
|
68
|
+
disableDefaultCategoryData?: boolean;
|
69
|
+
disableDefaultPageData?: boolean;
|
68
70
|
};
|
69
71
|
openGraph: {
|
70
72
|
disableDefaultProductData?: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ConfigProvider.js","sourceRoot":"","sources":["ConfigProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AAM3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"ConfigProvider.js","sourceRoot":"","sources":["ConfigProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AAM3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAqG5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,SAAS,CACV,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAO9B;QAP8B,EAC7B,MAAM,EAAE,UAAU,EAClB,QAAQ,OAKT,EAJI,IAAI,cAHsB,sBAI9B,CADQ;IAKP,MAAM,MAAM,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC5C,OAAO,CACL,oBAAC,iBAAiB,CAAC,QAAQ,kBAAC,KAAK,EAAE,MAAM,IAAM,IAAI,GAChD,QAAQ,CACkB,CAC9B,CAAC;AACJ,CAAC"}
|
@@ -9,10 +9,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
-
import
|
12
|
+
import { useShopConfig } from '@jetshop/core/hooks/useShopConfig';
|
13
|
+
import React, { useEffect } from 'react';
|
13
14
|
import { useApolloClient } from 'react-apollo';
|
14
15
|
import { useHistory } from 'react-router';
|
15
16
|
import { getActiveFiltersFromSearch } from '../../resolvers/filters/filterParams';
|
17
|
+
import { StructuredCategoryData } from '../StructuredData';
|
16
18
|
function useFiltersOnHistoryPop() {
|
17
19
|
const client = useApolloClient();
|
18
20
|
useEffect(() => {
|
@@ -32,6 +34,10 @@ const CategoryRoute = (props) => {
|
|
32
34
|
var _a, _b, _c;
|
33
35
|
const { component: CategoryPage } = props, rest = __rest(props, ["component"]);
|
34
36
|
const category = ((_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.category);
|
37
|
+
const { structuredData } = useShopConfig();
|
38
|
+
const disableDefaultCategoryData = structuredData
|
39
|
+
? !!structuredData.disableDefaultCategoryData
|
40
|
+
: false;
|
35
41
|
const history = useHistory();
|
36
42
|
useFiltersOnHistoryPop();
|
37
43
|
useEffect(() => {
|
@@ -42,7 +48,8 @@ const CategoryRoute = (props) => {
|
|
42
48
|
history.location.hash, Object.assign({ list: category.name }, history.location.state));
|
43
49
|
}
|
44
50
|
}, [category, history]);
|
45
|
-
return (React.createElement(Fragment, null,
|
51
|
+
return (React.createElement(React.Fragment, null,
|
52
|
+
category && (React.createElement(React.Fragment, null, !disableDefaultCategoryData && (React.createElement(StructuredCategoryData, { category: category })))),
|
46
53
|
React.createElement(CategoryPage, Object.assign({}, rest, { category: category }))));
|
47
54
|
};
|
48
55
|
export default CategoryRoute;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CategoryRoute.js","sourceRoot":"","sources":["CategoryRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,
|
1
|
+
{"version":3,"file":"CategoryRoute.js","sourceRoot":"","sources":["CategoryRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAe,eAAe,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE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AAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC,MAAM,IAAG,CAAC,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,QAAQ,CAAC,KAAK,0CAAE,IAAI,CAAA,EAAE;YAC9D,OAAO,CAAC,OAAO,CACb,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,kBAErB,IAAI,EAAE,QAAQ,CAAC,IAAI,IAChB,OAAO,CAAC,QAAQ,CAAC,KAAK,EAE5B,CAAC;SACH;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAExB,OAAO,CACL;QACG,QAAQ,IAAI,CACX,0CACG,CAAC,0BAA0B,IAAI,CAC9B,oBAAC,sBAAsB,IAAC,QAAQ,EAAE,QAAQ,GAAI,CAC/C,CACA,CACJ;QACD,oBAAC,YAAY,oBAAK,IAAI,IAAE,QAAQ,EAAE,QAAQ,IAAI,CAC7C,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
@@ -10,11 +10,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
10
10
|
return t;
|
11
11
|
};
|
12
12
|
import React from 'react';
|
13
|
+
import { StructuredPageData } from '../StructuredData';
|
14
|
+
import { useShopConfig } from '@jetshop/core/hooks/useShopConfig';
|
13
15
|
const ContentRoute = function ContentRoute(props) {
|
14
16
|
var _a, _b, _c, _d;
|
15
17
|
const { result, component: ContentPage } = props, rest = __rest(props, ["result", "component"]);
|
16
18
|
const page = (_c = (_b = (_a = result.data) === null || _a === void 0 ? void 0 : _a.route) === null || _b === void 0 ? void 0 : _b.object) !== null && _c !== void 0 ? _c : (_d = result.data) === null || _d === void 0 ? void 0 : _d.page;
|
17
|
-
|
19
|
+
const { structuredData } = useShopConfig();
|
20
|
+
const disableDefaultPageData = structuredData
|
21
|
+
? !!structuredData.disableDefaultPageData
|
22
|
+
: false;
|
23
|
+
return (React.createElement(React.Fragment, null,
|
24
|
+
page && !disableDefaultPageData && React.createElement(StructuredPageData, { page: page }),
|
25
|
+
React.createElement(ContentPage, Object.assign({ result: result, page: page }, rest))));
|
18
26
|
};
|
19
27
|
export default ContentRoute;
|
20
28
|
//# sourceMappingURL=ContentRoute.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ContentRoute.js","sourceRoot":"","sources":["ContentRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"ContentRoute.js","sourceRoot":"","sources":["ContentRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAYlE,MAAM,YAAY,GAAgC,SAAS,YAAY,CAAC,KAAK;;IAC3E,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAnD,uBAA2C,CAAQ,CAAC;IAE1D,MAAM,IAAI,GAAG,MAAA,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,KAAK,0CAAE,MAAM,mCAAI,MAAA,MAAM,CAAC,IAAI,0CAAE,IAAI,CAAC;IAC7D,MAAM,EAAE,cAAc,EAAE,GAAG,aAAa,EAAE,CAAC;IAE3C,MAAM,sBAAsB,GAAG,cAAc;QAC3C,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,sBAAsB;QACzC,CAAC,CAAC,KAAK,CAAC;IAEV,OAAO,CACL;QACG,IAAI,IAAI,CAAC,sBAAsB,IAAI,oBAAC,kBAAkB,IAAC,IAAI,EAAE,IAAI,GAAI;QACtE,oBAAC,WAAW,kBAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,IAAM,IAAI,EAAI,CACpD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
@@ -8,8 +8,10 @@ import ContentRoute from './ContentRoute';
|
|
8
8
|
import PaginationContext from '../Pagination/PaginationContext';
|
9
9
|
import throwErrorInDev from '../../helpers/throwErrorInDev';
|
10
10
|
import { PreviewContext } from '../PreviewContext';
|
11
|
+
import ChannelContext from '../ChannelContext';
|
11
12
|
const PreviewRoute = ({ productPage, categoryPage, contentPage, productQuery, categoryQuery, pageQuery, location, StartPage }) => {
|
12
13
|
const { setPreview } = useContext(PreviewContext);
|
14
|
+
const { setCultureForPreview, restoreCultureForPreview } = useContext(ChannelContext);
|
13
15
|
throwErrorInDev(!productQuery, `You forgot to pass 'productQuery' to PreviewRoute`);
|
14
16
|
throwErrorInDev(!categoryQuery, `You forgot to pass 'categoryQuery' to PreviewRoute`);
|
15
17
|
throwErrorInDev(!pageQuery, `You forgot to pass 'pageQuery' to PreviewRoute`);
|
@@ -17,10 +19,18 @@ const PreviewRoute = ({ productPage, categoryPage, contentPage, productQuery, ca
|
|
17
19
|
const queryObject = qs.parse(search, {
|
18
20
|
ignoreQueryPrefix: true
|
19
21
|
});
|
20
|
-
const { articlenumber, startpageid, categoryid, pageid } = queryObject;
|
22
|
+
const { articlenumber, startpageid, categoryid, pageid, culture } = queryObject;
|
21
23
|
setPreview(true);
|
24
|
+
if (culture) {
|
25
|
+
setCultureForPreview(culture);
|
26
|
+
}
|
22
27
|
if (articlenumber) {
|
23
|
-
return (React.createElement(Query, { onCompleted: () =>
|
28
|
+
return (React.createElement(Query, { onCompleted: () => {
|
29
|
+
setPreview(false);
|
30
|
+
if (culture) {
|
31
|
+
restoreCultureForPreview();
|
32
|
+
}
|
33
|
+
}, query: productQuery, variables: {
|
24
34
|
articleNumber: articlenumber
|
25
35
|
} }, (result) => (React.createElement(ProductRoute, { result: result, component: productPage }))));
|
26
36
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PreviewRoute.js","sourceRoot":"","sources":["PreviewRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,KAAK,EAAe,MAAM,cAAc,CAAC;AAClD,OAAO,kBAAkB,MAAM,iCAAiC,CAAC;AACjE,OAAO,aAAgC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,YAA8B,MAAM,gBAAgB,CAAC;AAC5D,OAAO,YAA8B,MAAM,gBAAgB,CAAC;AAC5D,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAChE,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"PreviewRoute.js","sourceRoot":"","sources":["PreviewRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,KAAK,EAAe,MAAM,cAAc,CAAC;AAClD,OAAO,kBAAkB,MAAM,iCAAiC,CAAC;AACjE,OAAO,aAAgC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,YAA8B,MAAM,gBAAgB,CAAC;AAC5D,OAAO,YAA8B,MAAM,gBAAgB,CAAC;AAC5D,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAChE,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,MAAM,YAAY,GAAG,CAAC,EACpB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,SAAS,EACT,QAAQ,EACR,SAAS,EAUV,EAAE,EAAE;IACH,MAAM,EAAE,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,SAAS,EAAE,EAAE,EAAE,CAAC,CAC7B,oBAAC,KAAK,IACJ,WAAW,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EACpC,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE;gBACT,EAAE,EAAE,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC;gBAC5B,OAAO,EAAE,SAAS;gBAClB,gBAAgB,EAAE,SAAS;gBAC3B,MAAM;gBACN,KAAK,EAAE,OAAO;aACf,IAEA,CAAC,MAAmB,EAAE,EAAE,CAAC,CACxB,oBAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAI,CAC3D,CACK,CACT,CACkB,CACtB,CAC0B,CAC9B,CAAC;KACH;SAAM,IAAI,MAAM,EAAE;QACjB,OAAO,CACL,oBAAC,KAAK,IACJ,WAAW,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EACpC,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE;gBACT,EAAE,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;aACzB,IAEA,CAAC,MAAmB,EAAE,EAAE,CAAC,CACxB,oBAAC,YAAY,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,GAAI,CACzD,CACK,CACT,CAAC;KACH;SAAM,IAAI,WAAW,EAAE;QACtB,OAAO,CACL,oBAAC,SAAS,IAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAC1E,CAAC;KACH;;QAAM,OAAO,IAAI,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
@@ -11,7 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
11
11
|
};
|
12
12
|
import React, { createContext, useMemo } from 'react';
|
13
13
|
const initialPreviewState = {
|
14
|
-
setPreview: () => {
|
14
|
+
setPreview: () => {
|
15
|
+
return null;
|
16
|
+
}
|
15
17
|
};
|
16
18
|
const PreviewContext = createContext(initialPreviewState);
|
17
19
|
const PreviewProvider = function AuthProvider(_a) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PreviewContext.js","sourceRoot":"","sources":["PreviewContext.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAOtD,MAAM,mBAAmB,GAAiB;IACxC,UAAU,EAAE,GAAG,EAAE,
|
1
|
+
{"version":3,"file":"PreviewContext.js","sourceRoot":"","sources":["PreviewContext.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAOtD,MAAM,mBAAmB,GAAiB;IACxC,UAAU,EAAE,GAAG,EAAE;QACf,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,MAAM,cAAc,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAC;AAE1D,MAAM,eAAe,GAEhB,SAAS,YAAY,CAAC,EAA4B;QAA5B,EAAE,cAAc,OAAY,EAAP,KAAK,cAA1B,kBAA4B,CAAF;IACnD,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,UAAU,EAAE,cAAc,CAAC,UAAU;KACtC,CAAC,EACF,CAAC,cAAc,CAAC,UAAU,CAAC,CAC5B,CAAC;IAEF,OAAO,oBAAC,cAAc,CAAC,QAAQ,kBAAC,KAAK,EAAE,KAAK,IAAM,KAAK,EAAI,CAAC;AAC9D,CAAC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Category } from '@jetshop/core/types';
|
2
|
+
import React from 'react';
|
3
|
+
import { CollectionPage } from 'schema-dts';
|
4
|
+
export interface StructuredCategoryDataProps {
|
5
|
+
/** The category object */
|
6
|
+
category: Category;
|
7
|
+
/**
|
8
|
+
* Optional object containing extra fields. These will be merged with the
|
9
|
+
* default fields. Full list of fields available at
|
10
|
+
* @url https://schema.org/Product
|
11
|
+
*/
|
12
|
+
extraFields?: Partial<CollectionPage>;
|
13
|
+
}
|
14
|
+
/** Renders structured product data using Schema.org vocab */
|
15
|
+
declare const StructuredCategoryData: React.FC<StructuredCategoryDataProps>;
|
16
|
+
export { StructuredCategoryData };
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { StructuredData } from './StructuredData';
|
3
|
+
/** Renders structured product data using Schema.org vocab */
|
4
|
+
const StructuredCategoryData = ({ category, extraFields = {} }) => {
|
5
|
+
var _a, _b, _c, _d;
|
6
|
+
const baseCollectionPageData = {
|
7
|
+
'@context': 'https://schema.org',
|
8
|
+
'@type': 'CollectionPage',
|
9
|
+
name: category.name,
|
10
|
+
description: category.content,
|
11
|
+
primaryImageOfPage: (_b = (_a = category.images) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.url,
|
12
|
+
image: (_d = (_c = category.images) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.url
|
13
|
+
};
|
14
|
+
const withInjectedCategoryData = Object.assign(Object.assign({}, baseCollectionPageData), extraFields);
|
15
|
+
return React.createElement(StructuredData, { json: withInjectedCategoryData });
|
16
|
+
};
|
17
|
+
export { StructuredCategoryData };
|
18
|
+
//# sourceMappingURL=StructuredCategoryData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"StructuredCategoryData.js","sourceRoot":"","sources":["StructuredCategoryData.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAalD,6DAA6D;AAC7D,MAAM,sBAAsB,GAA0C,CAAC,EACrE,QAAQ,EACR,WAAW,GAAG,EAAE,EACjB,EAAE,EAAE;;IACH,MAAM,sBAAsB,GAAgC;QAC1D,UAAU,EAAE,oBAAoB;QAChC,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,WAAW,EAAE,QAAQ,CAAC,OAAO;QAC7B,kBAAkB,EAAE,MAAA,MAAA,QAAQ,CAAC,MAAM,0CAAG,CAAC,CAAC,0CAAE,GAAG;QAC7C,KAAK,EAAE,MAAA,MAAA,QAAQ,CAAC,MAAM,0CAAG,CAAC,CAAC,0CAAE,GAAG;KACjC,CAAC;IACF,MAAM,wBAAwB,mCACzB,sBAAsB,GACrB,WAA8B,CACnC,CAAC;IAEF,OAAO,oBAAC,cAAc,IAAC,IAAI,EAAE,wBAAwB,GAAI,CAAC;AAC5D,CAAC,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Page } from '@jetshop/core/types';
|
2
|
+
import React from 'react';
|
3
|
+
import { WebPage } from 'schema-dts';
|
4
|
+
export interface StructuredPageDataProps {
|
5
|
+
/** The page object */
|
6
|
+
page: Page;
|
7
|
+
/**
|
8
|
+
* Optional object containing extra fields. These will be merged with the
|
9
|
+
* default fields. Full list of fields available at
|
10
|
+
* @url https://schema.org/Product
|
11
|
+
*/
|
12
|
+
extraFields?: Partial<WebPage>;
|
13
|
+
}
|
14
|
+
/** Renders structured product data using Schema.org vocab */
|
15
|
+
declare const StructuredPageData: React.FC<StructuredPageDataProps>;
|
16
|
+
export { StructuredPageData };
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { StructuredData } from './StructuredData';
|
3
|
+
/** Renders structured product data using Schema.org vocab */
|
4
|
+
const StructuredPageData = ({ page, extraFields = {} }) => {
|
5
|
+
var _a, _b, _c, _d;
|
6
|
+
const baseWebPageData = {
|
7
|
+
'@context': 'https://schema.org',
|
8
|
+
'@type': 'WebPage',
|
9
|
+
name: page.name,
|
10
|
+
primaryImageOfPage: (_b = (_a = page.images) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.url,
|
11
|
+
image: (_d = (_c = page.images) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.url
|
12
|
+
};
|
13
|
+
const withInjectedPageData = Object.assign(Object.assign({}, baseWebPageData), extraFields);
|
14
|
+
return React.createElement(StructuredData, { json: withInjectedPageData });
|
15
|
+
};
|
16
|
+
export { StructuredPageData };
|
17
|
+
//# sourceMappingURL=StructuredPageData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"StructuredPageData.js","sourceRoot":"","sources":["StructuredPageData.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAalD,6DAA6D;AAC7D,MAAM,kBAAkB,GAAsC,CAAC,EAC7D,IAAI,EACJ,WAAW,GAAG,EAAE,EACjB,EAAE,EAAE;;IACH,MAAM,eAAe,GAAyB;QAC5C,UAAU,EAAE,oBAAoB;QAChC,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,kBAAkB,EAAE,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAG,CAAC,CAAC,0CAAE,GAAG;QACzC,KAAK,EAAE,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAG,CAAC,CAAC,0CAAE,GAAG;KAC7B,CAAC;IACF,MAAM,oBAAoB,mCACrB,eAAe,GACd,WAAuB,CAC5B,CAAC;IAEF,OAAO,oBAAC,cAAc,IAAC,IAAI,EAAE,oBAAoB,GAAI,CAAC;AACxD,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
@@ -1,3 +1,5 @@
|
|
1
1
|
export { StructuredData } from './StructuredData';
|
2
2
|
export { StructuredProductData } from './StructuredProductData';
|
3
3
|
export { SiteLinksSearchStructuredData } from './SiteLinksSearchStructuredData';
|
4
|
+
export { StructuredCategoryData } from './StructuredCategoryData';
|
5
|
+
export { StructuredPageData } from './StructuredPageData';
|
@@ -1,4 +1,6 @@
|
|
1
1
|
export { StructuredData } from './StructuredData';
|
2
2
|
export { StructuredProductData } from './StructuredProductData';
|
3
3
|
export { SiteLinksSearchStructuredData } from './SiteLinksSearchStructuredData';
|
4
|
+
export { StructuredCategoryData } from './StructuredCategoryData';
|
5
|
+
export { StructuredPageData } from './StructuredPageData';
|
4
6
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/helpers/isRelativeUrl.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"isRelativeUrl.js","sourceRoot":"","sources":["isRelativeUrl.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,OAAO,
|
1
|
+
{"version":3,"file":"isRelativeUrl.js","sourceRoot":"","sources":["isRelativeUrl.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC1E,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { PackageItem } from '../../types';
|
2
|
-
declare type UpdateItem = (articleNumber: string, variantArticleNumber: string, valid: boolean) => void;
|
2
|
+
export declare type UpdateItem = (articleNumber: string, variantArticleNumber: string, valid: boolean) => void;
|
3
3
|
export declare function usePackageProductItem(item: PackageItem, updateItem: UpdateItem, { preselectCheapest }?: {
|
4
4
|
preselectCheapest?: boolean;
|
5
5
|
}): {
|
@@ -15,4 +15,3 @@ export declare function usePackageProductItem(item: PackageItem, updateItem: Upd
|
|
15
15
|
getMissingOptions: () => import("../../types").ProductVariantOption[];
|
16
16
|
};
|
17
17
|
};
|
18
|
-
export {};
|
package/package.json
CHANGED
@@ -21,7 +21,7 @@ function getUserData(req) {
|
|
21
21
|
function createTrackFacebookEvent({ pixelID, token }) {
|
22
22
|
return function trackFacebookEvent(data) {
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
24
|
-
const response = yield fetch(`https://graph.facebook.com/v11.0/${pixelID}/events?access_token=${token}`, {
|
24
|
+
const response = yield fetch(`https://graph.facebook.com/v11.0/${data.pixelID || pixelID}/events?access_token=${data.token || token}`, {
|
25
25
|
method: 'POST',
|
26
26
|
headers: {
|
27
27
|
'Content-Type': 'application/json'
|
@@ -47,7 +47,9 @@ export default function createFacebookTracker(config) {
|
|
47
47
|
event_time,
|
48
48
|
action_source: 'website',
|
49
49
|
event_source_url: data.location,
|
50
|
-
event_id: data.eventId
|
50
|
+
event_id: data.eventId,
|
51
|
+
pixelID: data.pixelID,
|
52
|
+
token: data.token
|
51
53
|
};
|
52
54
|
switch (event) {
|
53
55
|
case 'trackProduct':
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"facebook.js","sourceRoot":"","sources":["facebook.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,KAAK,MAAM,YAAY,CAAC;A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,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAChD,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAC/D;4BACD,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;gCAC7C,OAAO;oCACL,EAAE,EAAE,oBAAoB;wCACtB,CAAC,CAAC,IAAI,CAAC,aAAa;wCACpB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE;oCACtB,QAAQ,EAAE,IAAI,CAAC,QAAQ;oCACvB,UAAU,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,KAAK,0CAAE,MAAM;iCACvC,CAAC;4BACJ,CAAC,CAAC;4BACF,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,aAAa;4BAC1C,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM;yBAC7C,IACD,CAAC;gBACL,KAAK,eAAe;oBAClB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAuC,CAAC;oBAClE,OAAO,MAAM,kBAAkB,iCAC1B,QAAQ,KACX,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE;4BACX,YAAY,EAAE,YAAY,CAAC,KAAK;4BAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ;yBACxB,IACD,CAAC;aACN;SACF;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO,KAAK,CAAC;SACd;IACH,CAAC,CAAA,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/types.d.ts
CHANGED
@@ -13,7 +13,7 @@ export type Scalars = {
|
|
13
13
|
Uri: any;
|
14
14
|
/** The `DateTime` scalar type represents a date and time. `DateTime` expects timestamps to be formatted in accordance with the [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) standard. */
|
15
15
|
DateTime: any;
|
16
|
-
/** The `Paging` scalar type represents a numeric values between
|
16
|
+
/** The `Paging` scalar type represents a numeric values between <1; 100> */
|
17
17
|
Paging: any;
|
18
18
|
};
|
19
19
|
|
@@ -230,7 +230,10 @@ export type Category = Document & {
|
|
230
230
|
* product.primaryRoute will have to be used.
|
231
231
|
*/
|
232
232
|
isDynamic: Scalars['Boolean'];
|
233
|
-
/**
|
233
|
+
/**
|
234
|
+
* Get content data set via the Content Editor.NB: Carries a performance cost, as
|
235
|
+
* asking for this will result in a separate API call in the backend.
|
236
|
+
*/
|
234
237
|
data?: Maybe<Content>;
|
235
238
|
};
|
236
239
|
|