@jetshop/core 5.13.2 → 5.13.3-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/ChannelHandler/ChannelHandler.d.ts +2 -0
  2. package/ChannelHandler/ChannelHandler.js +9 -3
  3. package/ChannelHandler/ChannelHandler.js.map +1 -1
  4. package/ChannelHandler/PreserveRedirectRouteQuery.gql +1 -1
  5. package/ChannelHandler/channelUtils.d.ts +4 -0
  6. package/ChannelHandler/channelUtils.js +113 -7
  7. package/ChannelHandler/channelUtils.js.map +1 -1
  8. package/ChannelHandler/redirectUtils.test.js +24 -48
  9. package/ChannelHandler/redirectUtilsGroupedChannels.test.js +732 -0
  10. package/analytics/Analytics.js +1 -1
  11. package/analytics/Analytics.js.map +1 -1
  12. package/analytics/AnalyticsProvider.js +1 -1
  13. package/analytics/AnalyticsProvider.js.map +1 -1
  14. package/analytics/integrations/ga4.js +61 -62
  15. package/analytics/integrations/ga4.js.map +1 -1
  16. package/analytics/integrations/unslugify.js +0 -2
  17. package/analytics/integrations/unslugify.js.map +1 -1
  18. package/components/AuthContext/AuthProvider.js +2 -2
  19. package/components/AuthContext/AuthProvider.js.map +1 -1
  20. package/components/AuthContext/AuthProvider.test.js +2 -2
  21. package/components/ChannelContext/ChannelContext.d.ts +1 -0
  22. package/components/ChannelContext/ChannelContext.js.map +1 -1
  23. package/components/ChannelContext/ChannelProvider.js +4 -2
  24. package/components/ChannelContext/ChannelProvider.js.map +1 -1
  25. package/components/ChannelContext/useCountrySettings.js +2 -2
  26. package/components/ChannelContext/useCountrySettings.js.map +1 -1
  27. package/components/ConfigProvider.d.ts +0 -1
  28. package/components/ConfigProvider.js.map +1 -1
  29. package/components/Head.js +9 -4
  30. package/components/Head.js.map +1 -1
  31. package/components/OpenGraph/OpenGraph.test.js +2 -2
  32. package/components/OpenGraph/OpenGraphGeneralPageData.js +6 -6
  33. package/components/OpenGraph/OpenGraphGeneralPageData.js.map +1 -1
  34. package/components/OpenGraph/OpenGraphProductData.js +1 -1
  35. package/components/OpenGraph/OpenGraphProductData.js.map +1 -1
  36. package/components/Pagination/PaginationProvider.test.js +29 -29
  37. package/components/SortOrder/SortOrderContainer.js +1 -1
  38. package/components/SortOrder/SortOrderContainer.js.map +1 -1
  39. package/data/fragments/ChannelsFragment.gql +1 -0
  40. package/experiments/ExperimentsProvider.test.js +12 -12
  41. package/experiments/integration.test.js +6 -6
  42. package/experiments/useExperiment.test.js +10 -10
  43. package/hooks/Channels/useChannelSettings.js +1 -1
  44. package/hooks/Channels/useChannelSettings.js.map +1 -1
  45. package/hooks/Channels/useChannelSettings.test.js +1 -1
  46. package/hooks/usePrice.test.js +2 -2
  47. package/hooks/useShopConfig.d.ts +1 -1
  48. package/hooks/useShopConfig.js +1 -1
  49. package/hooks/useShopConfig.js.map +1 -1
  50. package/package.json +2 -2
  51. package/test-utils/ProviderPyramid.js +4 -4
  52. package/test-utils/variables.js +1234 -0
@@ -8,11 +8,13 @@ export declare class ChannelHandler {
8
8
  recommendedChannel?: SelectedChannel;
9
9
  channels?: Channel[];
10
10
  getPrimaryRoutePath?: GetPrimaryRoutePath;
11
+ selectedChannelGroup?: Channel[] | undefined;
11
12
  constructor(args?: {
12
13
  selectedChannel?: SelectedChannel;
13
14
  recommendedChannel?: SelectedChannel;
14
15
  channels?: Channel[];
15
16
  getPrimaryRoutePath?: GetPrimaryRoutePath;
17
+ selectedChannelGroup?: Channel[] | undefined;
16
18
  });
17
19
  setGetPrimaryRoutePath: (getPrimaryRoutePath: GetPrimaryRoutePath) => GetPrimaryRoutePath;
18
20
  getSelectedChannel: () => SelectedChannel;
@@ -10,13 +10,14 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import qs from 'qs';
13
- import { getChannelBasename, getChannelHeaders, getLanguageFromCulture, isInDev } from './channelUtils';
13
+ import { getChannelBasename, getChannelHeaders, getLanguageFromCulture, isInDev, getGroupedChannels } from './channelUtils';
14
14
  export class ChannelHandler {
15
15
  constructor(args = {
16
16
  selectedChannel: undefined,
17
17
  recommendedChannel: undefined,
18
18
  channels: undefined,
19
- getPrimaryRoutePath: undefined
19
+ getPrimaryRoutePath: undefined,
20
+ selectedChannelGroup: undefined
20
21
  }) {
21
22
  this.setGetPrimaryRoutePath = (getPrimaryRoutePath) => (this.getPrimaryRoutePath = getPrimaryRoutePath);
22
23
  this.getSelectedChannel = () => this.selectedChannel;
@@ -29,6 +30,10 @@ export class ChannelHandler {
29
30
  this.getRecommendedChannel = () => this.recommendedChannel;
30
31
  this.setChannels = (channels) => {
31
32
  this.channels = channels;
33
+ this.selectedChannelGroup = getGroupedChannels(channels, {
34
+ // Selected channel here is based on the one returned in getSelectedAndRecommendedChannel
35
+ groupName: this.selectedChannel.groupName
36
+ });
32
37
  };
33
38
  this.getChannels = () => this.channels;
34
39
  this.getChannelHeaders = () => getChannelHeaders(this.selectedChannel);
@@ -90,11 +95,12 @@ export class ChannelHandler {
90
95
  .then((url) => window.location.assign(url))
91
96
  .catch((url) => window.location.assign(url));
92
97
  };
93
- const { selectedChannel, recommendedChannel, channels, getPrimaryRoutePath } = args;
98
+ const { selectedChannel, recommendedChannel, channels, getPrimaryRoutePath, selectedChannelGroup } = args;
94
99
  this.selectedChannel = selectedChannel;
95
100
  this.recommendedChannel = recommendedChannel;
96
101
  this.channels = channels;
97
102
  this.getPrimaryRoutePath = getPrimaryRoutePath;
103
+ this.selectedChannelGroup = selectedChannelGroup;
98
104
  }
99
105
  getPathWithoutBasename(url) {
100
106
  const urlObject = new URL(url);
@@ -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,k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K,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAC7D,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -9,7 +9,7 @@ query preserveRedirectRouteQuery($path: String!) {
9
9
  id
10
10
  }
11
11
  ... on Page {
12
- pageId: id
12
+ id
13
13
  }
14
14
  ... on StartPage {
15
15
  id
@@ -9,6 +9,9 @@ export interface QueryObject {
9
9
  redirectDisabled?: boolean;
10
10
  articlenumber?: string;
11
11
  }
12
+ export declare const getGroupedChannels: (availableChannels: Channel[], { groupName }: {
13
+ groupName: string;
14
+ }) => Channel[];
12
15
  export declare const getURLBasename: (url: URL) => string;
13
16
  export declare const getURLLanguageBasename: ({ url, singleDomainMode }: {
14
17
  url: URL;
@@ -52,6 +55,7 @@ export declare function getSelectedAndRecommendedChannel({ url, singleDomainMode
52
55
  redirect: boolean;
53
56
  selectedChannel: SelectedChannel;
54
57
  recommendedChannel: SelectedChannel;
58
+ channels: Channel[];
55
59
  };
56
60
  export declare function getChannelHeaders(channel?: SelectedChannel): {
57
61
  currency: string;
@@ -1,5 +1,19 @@
1
1
  import acceptLanguageParser from 'accept-language-parser';
2
2
  import qs from 'qs';
3
+ const allChannelsGrouped = (availableChannels) => availableChannels.every((channel) => { var _a; return (_a = channel === null || channel === void 0 ? void 0 : channel.groupName) === null || _a === void 0 ? void 0 : _a.length; });
4
+ export const getGroupedChannels = (availableChannels, { groupName }) => {
5
+ const currentChannel = availableChannels.find((channel) => channel.groupName === groupName);
6
+ if (!currentChannel) {
7
+ return undefined;
8
+ }
9
+ const selectedChannelGroup = availableChannels.filter((channel) => channel.groupName === currentChannel.groupName);
10
+ if (selectedChannelGroup) {
11
+ return selectedChannelGroup;
12
+ }
13
+ else {
14
+ return undefined;
15
+ }
16
+ };
3
17
  export const getURLBasename = (url) => {
4
18
  return url.pathname.split('/')[1];
5
19
  };
@@ -177,8 +191,68 @@ function setGeoIpAndAcceptLanguageCookies({ cookies, geoipCountry, acceptLanguag
177
191
  path: '/'
178
192
  });
179
193
  }
180
- export function getSelectedAndRecommendedChannel({ url, singleDomainMode, channels, cookies, geoipCountry, acceptedLanguages, disableGeoRedirect }) {
181
- setCookiesFromQueryString({ cookies, url });
194
+ function getGroupedChannelsByUrl({ url, channels, singleDomainMode, cookies, geoipCountry }) {
195
+ const hasGroupedChannels = allChannelsGrouped(channels);
196
+ if (!hasGroupedChannels) {
197
+ return {
198
+ hasGroupedChannels,
199
+ groupByChannel: undefined
200
+ };
201
+ }
202
+ switch (true) {
203
+ case isInDev(url): {
204
+ if (singleDomainMode) {
205
+ const currentBaseUrl = getURLBasename(new URL(url));
206
+ // -> se, de, dk, es etcetc
207
+ return {
208
+ hasGroupedChannels,
209
+ groupByChannel: channels.find((channel) =>
210
+ // We always split channel.url to consider if trailing slashes are added in as BaseUrl
211
+ sanitizeURL(channel.url).split('/')[1] === currentBaseUrl)
212
+ };
213
+ }
214
+ else {
215
+ // Try to match with anything during development + non-singledomain,
216
+ // this is b/c we can't match dev urls with any baseurl.
217
+ // If one wan't to test it in dev one can use the ?channel=XX param.
218
+ const { activeChannel, chosenChannel } = getCurrentChannel({
219
+ url,
220
+ singleDomainMode,
221
+ channels,
222
+ cookies,
223
+ geoipCountry
224
+ });
225
+ return {
226
+ hasGroupedChannels,
227
+ // Active channel is given first priority. If it is null we are most likely in staging or development so chosenChannel or defaultChannel is used
228
+ groupByChannel: activeChannel || chosenChannel || getDefaultChannel(channels)
229
+ };
230
+ }
231
+ }
232
+ case singleDomainMode: {
233
+ const currentBaseUrl = sanitizeURL(url).split('/', 2);
234
+ // -> se, de, dk, es etcetc
235
+ return {
236
+ hasGroupedChannels,
237
+ groupByChannel: channels.find((channel) =>
238
+ // We always split channel.url to consider if trailing slashes are added in as BaseUrl
239
+ sanitizeURL(channel.url).split('/')[1] === currentBaseUrl[1]) || getDefaultChannel(channels)
240
+ };
241
+ }
242
+ default: {
243
+ const currentBaseUrl = sanitizeURL(url).split('/')[0];
244
+ // -> domain.com
245
+ return {
246
+ hasGroupedChannels,
247
+ groupByChannel: channels.find((channel) =>
248
+ // We always split channel.url to consider if trailing slashes are added in as BaseUrl
249
+ sanitizeURL(channel.url).split('/')[0] === currentBaseUrl)
250
+ };
251
+ }
252
+ }
253
+ }
254
+ // Is where we determine current channel to get return values in getSelectedAndRecommendedChannel
255
+ function getCurrentChannel({ url, singleDomainMode, channels, cookies, geoipCountry }) {
182
256
  const { activeChannel, activeChannels } = getChannelFromPathOrUrl({
183
257
  url,
184
258
  singleDomainMode,
@@ -188,11 +262,43 @@ export function getSelectedAndRecommendedChannel({ url, singleDomainMode, channe
188
262
  cookies,
189
263
  channels
190
264
  });
265
+ const channelFromGeoIp = findChannelByCountry(geoipCountry || cookies.get('geoipCountry'), channels);
266
+ // But have default channel as fallback,
191
267
  const defaultChannel = getDefaultChannel(channels);
268
+ return {
269
+ activeChannel,
270
+ activeChannels,
271
+ chosenChannel,
272
+ channelFromGeoIp,
273
+ defaultChannel
274
+ };
275
+ }
276
+ export function getSelectedAndRecommendedChannel({ url, singleDomainMode, channels, cookies, geoipCountry, acceptedLanguages, disableGeoRedirect }) {
277
+ setCookiesFromQueryString({ cookies, url });
278
+ const { hasGroupedChannels, groupByChannel } = getGroupedChannelsByUrl({
279
+ url,
280
+ channels,
281
+ singleDomainMode,
282
+ cookies,
283
+ geoipCountry
284
+ });
285
+ // If available, use channel group from here on
286
+ // NB: All channels must be grouped and groupName is nullable.
287
+ const availableChannels = hasGroupedChannels && (groupByChannel === null || groupByChannel === void 0 ? void 0 : groupByChannel.groupName)
288
+ ? getGroupedChannels(channels, {
289
+ groupName: groupByChannel.groupName
290
+ })
291
+ : channels;
292
+ const { defaultChannel, chosenChannel, activeChannel, activeChannels, channelFromGeoIp } = getCurrentChannel({
293
+ url,
294
+ singleDomainMode,
295
+ channels: availableChannels,
296
+ cookies,
297
+ geoipCountry
298
+ });
192
299
  // Active channel is given first priority. If it is null we are most likely in staging or development so chosenChannel or defaultChannel is used
193
300
  const pureChannel = activeChannel || chosenChannel || defaultChannel;
194
301
  let redirect = false;
195
- const channelFromGeoIp = findChannelByCountry(geoipCountry || cookies.get('geoipCountry'), channels);
196
302
  let pureRecommendedChannel;
197
303
  // If a channel has been chosen we want to redirect to it
198
304
  if (chosenChannel &&
@@ -203,9 +309,7 @@ export function getSelectedAndRecommendedChannel({ url, singleDomainMode, channe
203
309
  redirect = true;
204
310
  pureRecommendedChannel = chosenChannel;
205
311
  }
206
- else if (pureChannel &&
207
- channelFromGeoIp &&
208
- pureChannel.id !== channelFromGeoIp.id) {
312
+ else if (channelFromGeoIp && pureChannel.id !== channelFromGeoIp.id) {
209
313
  pureRecommendedChannel = channelFromGeoIp;
210
314
  redirect = !disableGeoRedirect && !chosenChannel;
211
315
  // this should happen when we can't find a matching channel from the url so we want to redirect such that the basename is included
@@ -250,7 +354,9 @@ export function getSelectedAndRecommendedChannel({ url, singleDomainMode, channe
250
354
  return {
251
355
  redirect,
252
356
  selectedChannel,
253
- recommendedChannel
357
+ recommendedChannel,
358
+ // for testing purposes mainly
359
+ channels: availableChannels
254
360
  };
255
361
  }
256
362
  export function getChannelHeaders(channel) {
@@ -1 +1 @@
1
- {"version":3,"file":"channelUtils.js","sourceRoot":"","sources":["channelUtils.ts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,MAAM,IAAI,CAAC;AAWpB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAE,EAAE;IACzC,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,GAAG,EACH,gBAAgB,EAIjB,EAAE,EAAE;IACH,IAAI,gBAAgB,EAAE;QACpB,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,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mB,EACrB;QACA,QAAQ,GAAG,IAAI,CAAC;QAChB,sBAAsB,GAAG,WAAW,CAAC;KACtC;IAED,MAAM,kBAAkB,GACtB,sBAAsB;QACtB,qBAAqB,CACnB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,CACpB,CAAC;IAEJ,OAAO;QACL,QAAQ;QACR,eAAe;QACf,kBAAkB;QAClB,8BAA8B;QAC9B,QAAQ,EAAE,iBAAiB;KAC5B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAyB;IACzD,OAAO,OAAO;QACZ,CAAC,CAAC;YACE,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC7B,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO;YACjC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;YAC7B,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB;QACH,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
@@ -3,41 +3,23 @@ import {
3
3
  getSelectedAndRecommendedChannel
4
4
  } from './channelUtils';
5
5
  import { MockLink } from 'apollo-link-mock';
6
- import { InMemoryCache } from 'apollo-cache-inmemory';
6
+ import {
7
+ InMemoryCache,
8
+ IntrospectionFragmentMatcher
9
+ } from 'apollo-cache-inmemory';
7
10
  import ApolloClient from 'apollo-client';
8
11
  import gql from 'graphql-tag';
9
12
  import { ChannelHandler } from './ChannelHandler';
10
- import { channels, singleDomainChannels } from '../test-utils/variables';
13
+ import {
14
+ channels,
15
+ singleDomainChannels,
16
+ groupedChannels,
17
+ groupedSingleDomainChannels
18
+ } from '../test-utils/variables';
11
19
  import { Cookies } from 'react-cookie';
12
20
  import { primaryRouteForPathFetcher } from './redirectUtils';
13
-
14
- const preserveRedirectRouteQuery = gql`
15
- query preserveRedirectRouteQuery($path: String!) {
16
- route(path: $path) {
17
- id
18
- object {
19
- ... on Category {
20
- id
21
- __typename
22
- }
23
- ... on Product {
24
- id
25
- __typename
26
- }
27
- ... on Page {
28
- id
29
- __typename
30
- }
31
- ... on StartPage {
32
- id
33
- __typename
34
- }
35
- __typename
36
- }
37
- __typename
38
- }
39
- }
40
- `;
21
+ import PreserveRedirectRouteQuery from './PreserveRedirectRouteQuery.gql';
22
+ import fragmentTypes from '@jetshop/core/data/fragmentTypes';
41
23
 
42
24
  const startPagePathnameRedirectQuery = gql`
43
25
  query StartPagePathnameRedirectQuery($id: Int!) {
@@ -90,7 +72,7 @@ const productPathnameRedirectQuery = gql`
90
72
  const redirectQueryMocks = [
91
73
  {
92
74
  request: {
93
- query: preserveRedirectRouteQuery,
75
+ query: PreserveRedirectRouteQuery,
94
76
  variables: {
95
77
  path: '/'
96
78
  }
@@ -115,7 +97,7 @@ const redirectQueryMocks = [
115
97
  startPagePathnameRedirectRequest,
116
98
  {
117
99
  request: {
118
- query: preserveRedirectRouteQuery,
100
+ query: PreserveRedirectRouteQuery,
119
101
  variables: {
120
102
  path: '/accessories/orchid-peach-bag'
121
103
  }
@@ -175,7 +157,16 @@ const redirectQueryMocks = [
175
157
 
176
158
  function createClient(mocks) {
177
159
  return new ApolloClient({
178
- cache: new InMemoryCache({ addTypename: true }),
160
+ cache: new InMemoryCache({
161
+ addTypename: true,
162
+ fragmentMatcher: new IntrospectionFragmentMatcher({
163
+ introspectionQueryResultData: {
164
+ __schema: {
165
+ types: fragmentTypes
166
+ }
167
+ }
168
+ })
169
+ }),
179
170
  link: new MockLink(mocks)
180
171
  });
181
172
  }
@@ -308,7 +299,6 @@ describe('Single domain mode', () => {
308
299
  expect(redirect).toBeFalsy();
309
300
  expect(recommendedChannel).toBeFalsy();
310
301
  });
311
-
312
302
  it('Will redirect when the url is at the wrong channel and the channel is default', () => {
313
303
  const cookies = new Cookies();
314
304
  const { recommendedChannel, redirect } = getSelectedAndRecommendedChannel({
@@ -320,7 +310,6 @@ describe('Single domain mode', () => {
320
310
  expect(redirect).toBe(true);
321
311
  expect(recommendedChannel.url).toBe(selectedChannelSingleDomain.url);
322
312
  });
323
-
324
313
  it('Will not redirect when the redirect is disabled', () => {
325
314
  const cookies = new Cookies();
326
315
  const { redirect } = getSelectedAndRecommendedChannel({
@@ -331,7 +320,6 @@ describe('Single domain mode', () => {
331
320
  });
332
321
  expect(redirect).toBe(false);
333
322
  });
334
-
335
323
  it('Will not when the url is at the right channel', () => {
336
324
  const cookies = new Cookies();
337
325
  const { redirect } = getSelectedAndRecommendedChannel({
@@ -342,7 +330,6 @@ describe('Single domain mode', () => {
342
330
  });
343
331
  expect(redirect).toBe(false);
344
332
  });
345
-
346
333
  it('Will redirect when the url is at the wrong channel', () => {
347
334
  const cookies = new Cookies();
348
335
  cookies.set('channel', singleDomainChannels[2].name);
@@ -355,7 +342,6 @@ describe('Single domain mode', () => {
355
342
  expect(redirect).toBe(true);
356
343
  expect(recommendedChannel.url).toBe('https://flight-m2.jetshop.se/uk');
357
344
  });
358
-
359
345
  it('Georedirect will respect single domain mode', () => {
360
346
  const cookies = new Cookies();
361
347
  const { redirect, recommendedChannel } = getSelectedAndRecommendedChannel({
@@ -368,7 +354,6 @@ describe('Single domain mode', () => {
368
354
  expect(redirect).toBe(true);
369
355
  expect(recommendedChannel.url).toBe('https://flight-m2.jetshop.se/uk');
370
356
  });
371
-
372
357
  it('Georedirect will respect single domain mode when there is a domain path', async () => {
373
358
  const urlToPreserve = '/accessories/orchid-peach-bag';
374
359
  const cookies = new Cookies();
@@ -388,7 +373,6 @@ describe('Single domain mode', () => {
388
373
  getPrimaryRoutePath,
389
374
  channels
390
375
  });
391
-
392
376
  const redirectUrl = channelHandler.getRedirectUrl({
393
377
  client,
394
378
  url: selectedChannelSingleDomain.url + urlToPreserve,
@@ -399,7 +383,6 @@ describe('Single domain mode', () => {
399
383
  'https://flight-m2.jetshop.se/uk/accessories/bags/orchid-peach-bag-uk?culture=sv-SE&channelCountry=UK&channel=UK'
400
384
  );
401
385
  });
402
-
403
386
  it('Redirect on single domain mode when the basename shows up in the url', async () => {
404
387
  const urlToPreserve = '/accessories/int/orchid-peach-bag';
405
388
  const cookies = new Cookies();
@@ -418,7 +401,6 @@ describe('Single domain mode', () => {
418
401
  getPrimaryRoutePath,
419
402
  channels
420
403
  });
421
-
422
404
  const redirectUrl = channelHandler.getRedirectUrl({
423
405
  client,
424
406
  url: channels[0].url + urlToPreserve,
@@ -429,7 +411,6 @@ describe('Single domain mode', () => {
429
411
  `https://flight-m2.jetshop.se/uk${urlToPreserve}?culture=sv-SE&channelCountry=UK&channel=UK`
430
412
  );
431
413
  });
432
-
433
414
  it('Redirect on single domain mode when there is a domain path but no basename', async () => {
434
415
  const urlToPreserve = '/accessories/orchid-peach-bag';
435
416
  const cookies = new Cookies();
@@ -448,7 +429,6 @@ describe('Single domain mode', () => {
448
429
  getPrimaryRoutePath,
449
430
  channels
450
431
  });
451
-
452
432
  const redirectUrl = channelHandler.getRedirectUrl({
453
433
  client,
454
434
  url: channels[0].url + urlToPreserve,
@@ -459,7 +439,6 @@ describe('Single domain mode', () => {
459
439
  `https://flight.jetshop.se/int${urlToPreserve}?culture=en-GB&channelCountry=US&channel=INT`
460
440
  );
461
441
  });
462
-
463
442
  it('Will set the appropriate language based on basename', async () => {
464
443
  const cookies = new Cookies();
465
444
  const { selectedChannel } = getSelectedAndRecommendedChannel({
@@ -469,7 +448,6 @@ describe('Single domain mode', () => {
469
448
  });
470
449
  expect(selectedChannel.language.culture).toBe('en-GB');
471
450
  });
472
-
473
451
  it('Will set the appropriate language based on basename in singledomain mode', async () => {
474
452
  const cookies = new Cookies();
475
453
  const { selectedChannel } = getSelectedAndRecommendedChannel({
@@ -480,7 +458,6 @@ describe('Single domain mode', () => {
480
458
  });
481
459
  expect(selectedChannel.language.culture).toBe('en-GB');
482
460
  });
483
-
484
461
  it('Will redirect to a new language basename based on cookies', async () => {
485
462
  const cookies = new Cookies();
486
463
  cookies.set('culture', 'en-GB');
@@ -507,7 +484,6 @@ describe('Single domain mode', () => {
507
484
  'https://flight-m2.jetshop.se/en/?culture=en-GB&channelCountry=SE&channel=SE'
508
485
  );
509
486
  });
510
-
511
487
  it('Will redirect to a new language basename based on cookies in single domain mode', async () => {
512
488
  const cookies = new Cookies();
513
489
  cookies.set('culture', 'en-GB');