@jetshop/core 5.11.2 → 5.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/ChannelHandler/ChannelHandler.js +3 -6
  2. package/ChannelHandler/ChannelHandler.js.map +1 -1
  3. package/ChannelHandler/redirectUtils.d.ts +2 -1
  4. package/ChannelHandler/redirectUtils.js +2 -1
  5. package/ChannelHandler/redirectUtils.js.map +1 -1
  6. package/analytics/AnalyticsProvider.d.ts +4 -0
  7. package/analytics/AnalyticsProvider.js +17 -1
  8. package/analytics/AnalyticsProvider.js.map +1 -1
  9. package/analytics/integrations/releware/index.js +1 -1
  10. package/analytics/integrations/releware/index.js.map +1 -1
  11. package/analytics/integrations/unslugify.js +6 -4
  12. package/analytics/integrations/unslugify.js.map +1 -1
  13. package/analytics/trackerRegistry.d.ts +6 -3
  14. package/analytics/trackerRegistry.js +41 -17
  15. package/analytics/trackerRegistry.js.map +1 -1
  16. package/analytics/utils/breadcrumbsWithoutProduct.js +1 -1
  17. package/analytics/utils/breadcrumbsWithoutProduct.js.map +1 -1
  18. package/boot/PreviewHandler.js.map +1 -1
  19. package/boot/addMissingConfig.js +1 -1
  20. package/boot/addMissingConfig.js.map +1 -1
  21. package/components/ChannelContext/ChannelContext.d.ts +2 -0
  22. package/components/ChannelContext/ChannelContext.js.map +1 -1
  23. package/components/ChannelContext/ChannelProvider.js +18 -1
  24. package/components/ChannelContext/ChannelProvider.js.map +1 -1
  25. package/components/ConfigProvider.d.ts +2 -0
  26. package/components/ConfigProvider.js.map +1 -1
  27. package/components/DynamicRoute/CategoryRoute.js +9 -2
  28. package/components/DynamicRoute/CategoryRoute.js.map +1 -1
  29. package/components/DynamicRoute/ContentRoute.js +9 -1
  30. package/components/DynamicRoute/ContentRoute.js.map +1 -1
  31. package/components/DynamicRoute/PreviewRoute.js +12 -2
  32. package/components/DynamicRoute/PreviewRoute.js.map +1 -1
  33. package/components/Filters/utils/replaceInSearch.d.ts +1 -0
  34. package/components/Filters/utils/updateHistory.d.ts +3 -0
  35. package/components/PreviewContext.js +3 -1
  36. package/components/PreviewContext.js.map +1 -1
  37. package/components/SortOrder/SortOrderContainer.d.ts +15 -3
  38. package/components/SortOrder/SortOrderContainer.js +27 -18
  39. package/components/SortOrder/SortOrderContainer.js.map +1 -1
  40. package/components/StructuredData/StructuredCategoryData.d.ts +16 -0
  41. package/components/StructuredData/StructuredCategoryData.js +18 -0
  42. package/components/StructuredData/StructuredCategoryData.js.map +1 -0
  43. package/components/StructuredData/StructuredPageData.d.ts +16 -0
  44. package/components/StructuredData/StructuredPageData.js +17 -0
  45. package/components/StructuredData/StructuredPageData.js.map +1 -0
  46. package/components/StructuredData/index.d.ts +2 -0
  47. package/components/StructuredData/index.js +2 -0
  48. package/components/StructuredData/index.js.map +1 -1
  49. package/data/fragments/ChannelsFragment.gql +4 -0
  50. package/helpers/isRelativeUrl.js +0 -1
  51. package/helpers/isRelativeUrl.js.map +1 -1
  52. package/hooks/Filters/useSortOrder.d.ts +1 -0
  53. package/hooks/Filters/useSortOrder.js +6 -3
  54. package/hooks/Filters/useSortOrder.js.map +1 -1
  55. package/hooks/PackageProducts/usePackageProductItem.d.ts +1 -2
  56. package/hooks/ProductList/list-transforms.d.ts +1 -0
  57. package/package.json +1 -1
  58. package/resolvers/filters/defaultActiveFilters.d.ts +1 -1
  59. package/resolvers/filters/defaultActiveFilters.js.map +1 -1
  60. package/resolvers/filters/filterParams.d.ts +1 -1
  61. package/resolvers/filters/filterParams.js +5 -5
  62. package/resolvers/filters/filterParams.js.map +1 -1
  63. package/resolvers/filters/index.d.ts +4 -4
  64. package/resolvers/filters/updateQueryString.d.ts +4 -3
  65. package/resolvers/filters/updateQueryString.js +16 -10
  66. package/resolvers/filters/updateQueryString.js.map +1 -1
  67. package/server/tracking/facebook.d.ts +2 -2
  68. package/server/tracking/facebook.js +11 -12
  69. package/server/tracking/facebook.js.map +1 -1
  70. package/server/tracking/middleware.d.ts +5 -1
  71. package/server/tracking/middleware.js.map +1 -1
  72. package/server/tracking/types.d.ts +3 -1
  73. package/types.d.ts +9 -2
@@ -38,14 +38,11 @@ export class ChannelHandler {
38
38
  const routePathsArray = routes
39
39
  ? Object.keys(routes).map((key) => routes[key].path)
40
40
  : [];
41
- if (routePathsArray.includes(path)) {
41
+ if (routePathsArray.find((routePath) => path.startsWith(routePath))) {
42
42
  return Promise.resolve(path);
43
43
  }
44
44
  if (path) {
45
- // Make sure we set the selected channel so any queries in
46
- // getPrimaryRoutePath will pick up the selected channel
47
- this.setSelectedChannel(newChannel);
48
- return this.getPrimaryRoutePath(path);
45
+ return this.getPrimaryRoutePath(path, newChannel, this.setSelectedChannel);
49
46
  }
50
47
  else {
51
48
  return Promise.resolve('/');
@@ -89,7 +86,7 @@ export class ChannelHandler {
89
86
  };
90
87
  this.updateChannel = (_a) => {
91
88
  var { config } = _a, args = __rest(_a, ["config"]);
92
- this.getRedirectUrl(Object.assign(Object.assign({}, args), { url: window.location.href, preserveRedirect: config.preserveRedirect }))
89
+ this.getRedirectUrl(Object.assign(Object.assign({}, args), { url: window.location.href, preserveRedirect: config.preserveRedirect, routes: config.routes }))
93
90
  .then((url) => window.location.assign(url))
94
91
  .catch((url) => window.location.assign(url));
95
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelHandler.js","sourceRoot":"","sources":["ChannelHandler.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,OAAO,EACR,MAAM,gBAAgB,CAAC;AAGxB,MAAM,OAAO,cAAc;IAMzB,YACE,OAKI;QACF,eAAe,EAAE,SAAS;QAC1B,kBAAkB,EAAE,SAAS;QAC7B,QAAQ,EAAE,SAAS;QACnB,mBAAmB,EAAE,SAAS;KAC/B;QAcH,2BAAsB,GAAG,CAAC,mBAAwC,EAAE,EAAE,CACpE,CAAC,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,CAAC;QAEnD,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AAM,EACJ,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,mBAAmB,EACpB,GAAG,IAAI,CAAC;QACT,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,CAAC;IAiIO,sBAAsB,CAAC,GAAW;QACxC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC3C,MAAM,aAAa,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,CAAC,GAAG,CAAC,KAAI,EAAE,CAAC;QACjD,aAAa,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC;QAC9B,aAAa,CAAC,OAAO,CACnB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAC7D,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,3 +1,4 @@
1
1
  import ApolloClient from 'apollo-client';
2
- export declare type GetPrimaryRoutePath = (path: string) => Promise<string>;
2
+ import { SelectedChannel } from '../components/ChannelContext/ChannelContext';
3
+ export declare type GetPrimaryRoutePath = (path: string, newChannel: SelectedChannel, setSelectedChannel: (selectedChannel: SelectedChannel) => void) => Promise<string>;
3
4
  export declare function primaryRouteForPathFetcher(client: ApolloClient<any>): GetPrimaryRoutePath;
@@ -19,7 +19,7 @@ const PathnameRedirectQueryMap = {
19
19
  Page: PagePathnameRedirectQuery
20
20
  };
21
21
  export function primaryRouteForPathFetcher(client) {
22
- return (path) => __awaiter(this, void 0, void 0, function* () {
22
+ return (path, newChannel, setSelectedChannel) => __awaiter(this, void 0, void 0, function* () {
23
23
  try {
24
24
  if (!path) {
25
25
  throw new Error('No path was provided');
@@ -31,6 +31,7 @@ export function primaryRouteForPathFetcher(client) {
31
31
  }
32
32
  });
33
33
  const { id, __typename } = routeQueryResult.data.route.object;
34
+ setSelectedChannel(newChannel);
34
35
  const pathnameQueryResult = yield client.query({
35
36
  fetchPolicy: 'network-only',
36
37
  query: PathnameRedirectQueryMap[__typename],
@@ -1 +1 @@
1
- {"version":3,"file":"redirectUtils.js","sourceRoot":"","sources":["redirectUtils.ts"],"names":[],"mappings":";;;;;;;;;AASA,OAAO,0BAA0B,MAAM,kCAAkC,CAAC;AAC1E,OAAO,4BAA4B,MAAM,oCAAoC,CAAC;AAC9E,OAAO,6BAA6B,MAAM,qCAAqC,CAAC;AAChF,OAAO,8BAA8B,MAAM,sCAAsC,CAAC;AAClF,OAAO,yBAAyB,MAAM,iCAAiC,CAAC;AAExE,MAAM,wBAAwB,GAAG;IAC/B,OAAO,EAAE,4BAA4B;IACrC,QAAQ,EAAE,6BAA6B;IACvC,SAAS,EAAE,8BAA8B;IACzC,IAAI,EAAE,yBAAyB;CAChC,CAAC;AAKF,MAAM,UAAU,0BAA0B,CACxC,MAAyB;IAEzB,OAAO,CAAO,IAAI,EAAE,EAAE;QACpB,IAAI;YACF,IAAI,CAAC,IAAI,EAAE;gBACT,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;aACzC;YAED,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,KAAK,CAOxC;gBACD,KAAK,EAAE,0BAA0B;gBACjC,SAAS,EAAE;oBACT,IAAI;iBACL;aACF,CAAC,CAAC;YAEH,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YAE9D,MAAM,mBAAmB,GAAG,MAAM,MAAM,CAAC,KA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AAM,mBAAmB,GAAG,MAAM,MAAM,CAAC,KAAK,CAK3C;gBACD,WAAW,EAAE,cAAc;gBAC3B,KAAK,EAAE,wBAAwB,CAAC,UAAU,CAAC;gBAC3C,SAAS,EAAE;oBACT,EAAE;iBACH;aACF,CAAC,CAAC;YAEH,OAAO,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;SAC/D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,GAAG,CAAC;SACZ;IACH,CAAC,CAAA,CAAC;AACJ,CAAC"}
@@ -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,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AA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,2BAA2B,EAAE,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;YACnB,KAAK,MAAM;gBACT,KAAK,CAAC,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,CAAC"}
@@ -6,10 +6,12 @@ export function unSlugify(slug) {
6
6
  .split('-')
7
7
  .map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
8
8
  .join(' ');
9
- slug = slug
10
- .split('/')
11
- .map((part) => part.length > 0 ? part[0].toUpperCase() + part.substring(1) : '')
12
- .join('/');
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;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"}
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): void;
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
- fetch(`/_event?event=trackCartCheckout`, {
34
- method: 'POST',
35
- headers: {
36
- 'Content-Type': 'application/json'
37
- },
38
- body: JSON.stringify(Object.assign(Object.assign({}, defaults), { eventId,
39
- props,
40
- context, location: window.location.href }))
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) {
@@ -57,9 +74,16 @@ export function createServerTracker({ currency, useArticleNumberAsId }) {
57
74
  headers: {
58
75
  'Content-Type': 'application/json'
59
76
  },
60
- body: JSON.stringify(Object.assign(Object.assign({}, defaults), { eventId,
61
- props,
62
- context, location: window.location.href }))
77
+ body: JSON.stringify(Object.assign(Object.assign({}, defaults), { eventId, props: {
78
+ listName: props.listName,
79
+ products: props.products.map((product) => ({
80
+ articleNumber: product.articleNumber,
81
+ id: product.id,
82
+ price: product.price,
83
+ name: product.name,
84
+ previousPrice: product.previousPrice
85
+ }))
86
+ }, context, location: window.location.href }))
63
87
  });
64
88
  },
65
89
  trackPageView(props, context, eventId) {
@@ -143,19 +167,19 @@ export function trackerRegistry({ config, inServer }) {
143
167
  const events = new eventemitter3();
144
168
  const registry = {
145
169
  on(event, listeners, { name } = {}) {
146
- return events.on(event, (...args) => {
170
+ return events.on(event.toString(), (...args) => __awaiter(this, void 0, void 0, function* () {
147
171
  try {
148
- listeners.apply(this, args);
172
+ return yield listeners.apply(this, args);
149
173
  }
150
174
  catch (err) {
151
175
  console.error(`Error triggering ${event}:${name}`, {
152
176
  err
153
177
  });
154
178
  }
155
- });
179
+ }));
156
180
  },
157
181
  emit(event, props, context, eventId) {
158
- return events.emit(event, props, context, eventId);
182
+ return events.emit(event.toString(), props, context, eventId);
159
183
  },
160
184
  add(tracker) {
161
185
  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;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,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;QACD,iBAAiB,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,CAAC,eAAe,EAAE;gBACtE,OAAO;aACR;YAED,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;YACnD,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"}
@@ -1,6 +1,6 @@
1
1
  export function breadcrumbsWithoutProduct(breadcrumbs) {
2
2
  if (breadcrumbs && breadcrumbs.length) {
3
- return breadcrumbs.slice(0, -1).join('/');
3
+ return '/' + breadcrumbs.slice(0, -1).join('/');
4
4
  }
5
5
  else {
6
6
  return '';
@@ -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;KAC3C;SAAM;QACL,OAAO,EAAE,CAAC;KACX;AACH,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,GAAY,KAAK,CAAC;QAEzB,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"}
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"}
@@ -25,7 +25,7 @@ export function addMissingConfig(userConfig) {
25
25
  }
26
26
  if (!userConfig.routes)
27
27
  userConfig.routes = {};
28
- Object.keys(routeList).forEach(key => {
28
+ Object.keys(routeList).forEach((key) => {
29
29
  if (!userConfig.routes.hasOwnProperty(key))
30
30
  userConfig.routes[key] = { path: routeList[key] };
31
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"addMissingConfig.js","sourceRoot":"","sources":["addMissingConfig.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAA8B;IAClD,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAA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;AACtD,MAAM,UAAU,gBAAgB,CAAC,UAAuB;IACtD,IAAI,CAAC,UAAU,CAAC,uBAAuB,EAAE;QACvC,UAAU,CAAC,uBAAuB,GAAG;YACnC,QAAQ;YACR,iBAAiB;YACjB,kBAAkB;SACnB,CAAC;KACH;IAED,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE;QACzB,UAAU,CAAC,SAAS,GAAG,QAAQ,CAAC;KACjC;IAED,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,UAAU,CAAC,MAAM,GAAG,EAAE,CAAC;IAC/C,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACrC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC;YACxC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -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;AAiBtC,MAAM,cAAc,GAAG,aAAa,CAClC,SAAS,CACV,CAAC;AAEF,eAAe,cAAc,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
- }, [channelHandler, channels, config, recommendedChannel, selectedChannel]);
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;AAWnE,MAAM,e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AQ,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;AAmG5D,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"}
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 React, { Fragment, useEffect } from 'react';
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;
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AChB,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
- return React.createElement(ContentPage, Object.assign({ result: result, page: page }, rest));
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;AAc7C,MAAM,YAAY,G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tE,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: () => setPreview(false), query: productQuery, variables: {
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
  }