@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
@@ -3,7 +3,7 @@ import { render, cleanup, act } from '@testing-library/react';
3
3
  import { StaticRouter, MemoryRouter, Route } from 'react-router';
4
4
  import { CookiesProvider } from 'react-cookie';
5
5
  import PaginationProvider, { usePagination } from './PaginationProvider';
6
- import PaginationContext from './PaginationContext';
6
+ import PaginationContext from '@jetshop/core/components/Pagination/PaginationContext';
7
7
  import Cookies from 'universal-cookie';
8
8
 
9
9
  jest.mock('../../helpers/logWarningInDev');
@@ -17,7 +17,7 @@ describe('PaginationProvider', () => {
17
17
  location,
18
18
  routerProps,
19
19
  Router = StaticRouter,
20
- cookies = new Cookies({}),
20
+ cookies = new Cookies({})
21
21
  }) {
22
22
  return render(
23
23
  <CookiesProvider cookies={cookies}>
@@ -42,7 +42,7 @@ describe('PaginationProvider', () => {
42
42
  beforeEach(() => {
43
43
  // Workaround changes in universal-cookie
44
44
  Object.defineProperty(document, 'cookie', {
45
- value: null,
45
+ value: null
46
46
  });
47
47
  });
48
48
 
@@ -52,7 +52,7 @@ describe('PaginationProvider', () => {
52
52
  setup({
53
53
  collect: ({ currentPage }) => {
54
54
  page = currentPage;
55
- },
55
+ }
56
56
  });
57
57
 
58
58
  expect(page).toBe(1);
@@ -63,7 +63,7 @@ describe('PaginationProvider', () => {
63
63
  setup({
64
64
  collect: ({ perPage: contextPerPage }) => {
65
65
  perPage = contextPerPage;
66
- },
66
+ }
67
67
  });
68
68
 
69
69
  expect(perPage).toBe(16);
@@ -76,8 +76,8 @@ describe('PaginationProvider', () => {
76
76
  page = currentPage;
77
77
  },
78
78
  location: {
79
- search: '?page=2',
80
- },
79
+ search: '?page=2'
80
+ }
81
81
  });
82
82
 
83
83
  expect(page).toBe(2);
@@ -87,8 +87,8 @@ describe('PaginationProvider', () => {
87
87
  page = currentPage;
88
88
  },
89
89
  location: {
90
- search: '?page=11',
91
- },
90
+ search: '?page=11'
91
+ }
92
92
  });
93
93
 
94
94
  expect(page).toBe(11);
@@ -100,7 +100,7 @@ describe('PaginationProvider', () => {
100
100
  collect: ({ perPage: contextPerPage }) => {
101
101
  perPage = contextPerPage;
102
102
  },
103
- perPage: 4,
103
+ perPage: 4
104
104
  });
105
105
 
106
106
  expect(perPage).toBe(4);
@@ -111,7 +111,7 @@ describe('PaginationProvider', () => {
111
111
  setup({
112
112
  collect: (context) => {
113
113
  offset = context.offset;
114
- },
114
+ }
115
115
  });
116
116
 
117
117
  expect(offset).toBe(0);
@@ -122,8 +122,8 @@ describe('PaginationProvider', () => {
122
122
  },
123
123
  perPage: 12,
124
124
  location: {
125
- search: '?page=2',
126
- },
125
+ search: '?page=2'
126
+ }
127
127
  });
128
128
 
129
129
  expect(offset).toBe(12);
@@ -134,8 +134,8 @@ describe('PaginationProvider', () => {
134
134
  },
135
135
  perPage: 20,
136
136
  location: {
137
- search: '?page=4',
138
- },
137
+ search: '?page=4'
138
+ }
139
139
  });
140
140
 
141
141
  expect(offset).toBe(60);
@@ -148,7 +148,7 @@ describe('PaginationProvider', () => {
148
148
  collect: (context) => {
149
149
  currentPage = context.currentPage;
150
150
  goToPage = context.goToPage;
151
- },
151
+ }
152
152
  });
153
153
 
154
154
  expect(currentPage).toBe(1);
@@ -172,10 +172,10 @@ describe('PaginationProvider', () => {
172
172
  routerProps: {
173
173
  initialEntries: [
174
174
  {
175
- search: '?page=1',
176
- },
177
- ],
178
- },
175
+ search: '?page=1'
176
+ }
177
+ ]
178
+ }
179
179
  });
180
180
 
181
181
  expect(currentLocation.search).toBe('?page=1');
@@ -194,8 +194,8 @@ describe('PaginationProvider', () => {
194
194
  perPage = context.perPage;
195
195
  },
196
196
  cookies: new Cookies({
197
- perPage: 4,
198
- }),
197
+ perPage: 4
198
+ })
199
199
  });
200
200
 
201
201
  expect(perPage).toBe(4);
@@ -211,7 +211,7 @@ describe('PaginationProvider', () => {
211
211
  perPage = context.perPage;
212
212
  setProductsPerPage = context.setProductsPerPage;
213
213
  },
214
- cookies,
214
+ cookies
215
215
  });
216
216
 
217
217
  expect(perPage).toBe(16);
@@ -236,17 +236,17 @@ describe('PaginationProvider', () => {
236
236
  routerProps: {
237
237
  initialEntries: [
238
238
  {
239
- search: '?page=5',
240
- },
241
- ],
242
- },
239
+ search: '?page=5'
240
+ }
241
+ ]
242
+ }
243
243
  });
244
244
 
245
245
  expect(currentPage).toBe(5);
246
246
 
247
247
  act(() => {
248
248
  history.push({
249
- search: '',
249
+ search: ''
250
250
  });
251
251
  });
252
252
 
@@ -261,7 +261,7 @@ describe('usePagination', () => {
261
261
  perPage: null,
262
262
  offset: null,
263
263
  goToPage: () => {},
264
- setProductsPerPage: () => {},
264
+ setProductsPerPage: () => {}
265
265
  };
266
266
 
267
267
  let result = null;
@@ -44,7 +44,7 @@ export const sortValues = {
44
44
  custom: [
45
45
  {
46
46
  text: t(''),
47
- direction: 'DESCENDING'
47
+ direction: 'ASCENDING'
48
48
  }
49
49
  ]
50
50
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SortOrderContainer.js","sourceRoot":"","sources":["SortOrderContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA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  isDefault
16
16
  displayName
17
+ groupName
17
18
  url
18
19
  imageUrl
19
20
  requiresAuth
@@ -4,9 +4,9 @@ import { StaticRouter } from 'react-router';
4
4
  import { CookiesProvider } from 'react-cookie';
5
5
  import Cookies from 'universal-cookie';
6
6
  import ExperimentsProvider, { ExperimentsContext } from './ExperimentsProvider';
7
- import AnalyticsProvider from '../analytics/AnalyticsProvider';
8
- import { ConfigProvider } from '../components/ConfigProvider';
9
- import { ChannelProvider } from '../components/ChannelContext';
7
+ import AnalyticsProvider from '@jetshop/core/analytics/AnalyticsProvider';
8
+ import { ConfigProvider } from '@jetshop/core/components/ConfigProvider';
9
+ import { ChannelProvider } from '@jetshop/core/components/ChannelContext';
10
10
  import { ChannelHandler } from '../ChannelHandler/ChannelHandler';
11
11
  import { selectedChannel, channels } from '../test-utils/variables';
12
12
  import { HelmetProvider } from 'react-helmet-async';
@@ -23,7 +23,7 @@ const setup = ({ cookies, shopConfig = {} }) => {
23
23
  let data;
24
24
  const channelHandler = new ChannelHandler({
25
25
  selectedChannel,
26
- channels,
26
+ channels
27
27
  });
28
28
 
29
29
  render(
@@ -45,7 +45,7 @@ const setup = ({ cookies, shopConfig = {} }) => {
45
45
  );
46
46
 
47
47
  return {
48
- data,
48
+ data
49
49
  };
50
50
  };
51
51
 
@@ -53,13 +53,13 @@ describe('ExperimentsProvider', () => {
53
53
  beforeEach(() => {
54
54
  // Workaround changes in universal-cookie
55
55
  Object.defineProperty(document, 'cookie', {
56
- value: null,
56
+ value: null
57
57
  });
58
58
  });
59
59
 
60
60
  it('reads the current experiment and value from the optimizeExperiment cookie', () => {
61
61
  const cookies = new Cookies({
62
- optimizeExperiment: 'test.0',
62
+ optimizeExperiment: 'test.0'
63
63
  });
64
64
 
65
65
  const { data } = setup({ cookies });
@@ -78,16 +78,16 @@ describe('ExperimentsProvider', () => {
78
78
  const trackExperiment = jest.fn();
79
79
 
80
80
  const cookies = new Cookies({
81
- optimizeExperiment: 'test.0',
81
+ optimizeExperiment: 'test.0'
82
82
  });
83
83
 
84
84
  const shopConfig = {
85
85
  trackers: [
86
86
  {
87
87
  name: 'test',
88
- trackExperiment,
89
- },
90
- ],
88
+ trackExperiment
89
+ }
90
+ ]
91
91
  };
92
92
 
93
93
  setup({ cookies, shopConfig });
@@ -96,7 +96,7 @@ describe('ExperimentsProvider', () => {
96
96
  expect(trackExperiment).toHaveBeenCalledWith(
97
97
  {
98
98
  id: 'test',
99
- variant: 0,
99
+ variant: 0
100
100
  },
101
101
  expect.anything(),
102
102
  expect.anything()
@@ -5,9 +5,9 @@ import { StaticRouter } from 'react-router';
5
5
  import { CookiesProvider } from 'react-cookie';
6
6
  import Cookies from 'universal-cookie';
7
7
  import ExperimentsProvider from './ExperimentsProvider';
8
- import AnalyticsProvider from '../analytics/AnalyticsProvider';
9
- import { ConfigProvider } from '../components/ConfigProvider';
10
- import { ChannelProvider } from '../components/ChannelContext';
8
+ import AnalyticsProvider from '@jetshop/core//analytics/AnalyticsProvider';
9
+ import { ConfigProvider } from '@jetshop/core/components/ConfigProvider';
10
+ import { ChannelProvider } from '@jetshop/core/components/ChannelContext';
11
11
  import { ChannelHandler } from '../ChannelHandler/ChannelHandler';
12
12
  import { channels, selectedChannel } from '../test-utils/variables';
13
13
  import { HelmetProvider } from 'react-helmet-async';
@@ -29,7 +29,7 @@ const Experiment = () => {
29
29
  const setup = ({ cookies }) => {
30
30
  const channelHandler = new ChannelHandler({
31
31
  channels,
32
- selectedChannel,
32
+ selectedChannel
33
33
  });
34
34
  return render(
35
35
  <StaticRouter>
@@ -55,7 +55,7 @@ describe('experiments', () => {
55
55
  beforeEach(() => {
56
56
  // Workaround changes in universal-cookie
57
57
  Object.defineProperty(document, 'cookie', {
58
- value: null,
58
+ value: null
59
59
  });
60
60
  });
61
61
 
@@ -67,7 +67,7 @@ describe('experiments', () => {
67
67
 
68
68
  it('renders a specific variant if that variant was selected', () => {
69
69
  const cookies = new Cookies({
70
- optimizeExperiment: 'test.2',
70
+ optimizeExperiment: 'test.2'
71
71
  });
72
72
  const { getByText } = setup({ cookies });
73
73
  expect(getByText('Second')).toBeTruthy();
@@ -5,9 +5,9 @@ import { StaticRouter } from 'react-router';
5
5
  import { CookiesProvider } from 'react-cookie';
6
6
  import Cookies from 'universal-cookie';
7
7
  import ExperimentsProvider from './ExperimentsProvider';
8
- import AnalyticsProvider from '../analytics/AnalyticsProvider';
9
- import { ConfigProvider } from '../components/ConfigProvider';
10
- import { ChannelProvider } from '../components/ChannelContext';
8
+ import AnalyticsProvider from '@jetshop/core/analytics/AnalyticsProvider';
9
+ import { ConfigProvider } from '@jetshop/core/components/ConfigProvider';
10
+ import { ChannelProvider } from '@jetshop/core/components/ChannelContext';
11
11
  import { ChannelHandler } from '../ChannelHandler/ChannelHandler';
12
12
  import { selectedChannel, channels } from '../test-utils/variables';
13
13
  import { HelmetProvider } from 'react-helmet-async';
@@ -22,7 +22,7 @@ const Collector = ({ report, id, variant }) => {
22
22
  const setup = ({ report, id, variant, cookies }) => {
23
23
  const channelHandler = new ChannelHandler({
24
24
  selectedChannel,
25
- channels,
25
+ channels
26
26
  });
27
27
  return render(
28
28
  <StaticRouter>
@@ -47,7 +47,7 @@ describe('useExperiment', () => {
47
47
  beforeEach(() => {
48
48
  // Workaround changes in universal-cookie
49
49
  Object.defineProperty(document, 'cookie', {
50
- value: null,
50
+ value: null
51
51
  });
52
52
  });
53
53
 
@@ -59,7 +59,7 @@ describe('useExperiment', () => {
59
59
  cookies,
60
60
  report,
61
61
  id: null,
62
- variant: null,
62
+ variant: null
63
63
  });
64
64
 
65
65
  expect(report).toHaveBeenCalledTimes(1);
@@ -68,14 +68,14 @@ describe('useExperiment', () => {
68
68
 
69
69
  it('returns false if cookie does not match provided experiment and variant', () => {
70
70
  const cookies = new Cookies({
71
- optimizeExperiment: 'test.0',
71
+ optimizeExperiment: 'test.0'
72
72
  });
73
73
  const report = jest.fn();
74
74
  setup({
75
75
  cookies,
76
76
  report,
77
77
  id: 'test',
78
- variant: 1,
78
+ variant: 1
79
79
  });
80
80
 
81
81
  expect(report).toHaveBeenCalledTimes(1);
@@ -84,14 +84,14 @@ describe('useExperiment', () => {
84
84
 
85
85
  it('returns true if cookie matches provided experiment and variant', () => {
86
86
  const cookies = new Cookies({
87
- optimizeExperiment: 'test.0',
87
+ optimizeExperiment: 'test.0'
88
88
  });
89
89
  const report = jest.fn();
90
90
  setup({
91
91
  cookies,
92
92
  report,
93
93
  id: 'test',
94
- variant: 0,
94
+ variant: 0
95
95
  });
96
96
 
97
97
  expect(report).toHaveBeenCalledTimes(1);
@@ -1,5 +1,5 @@
1
1
  import { useContext } from 'react';
2
- import ChannelContext from '../../components/ChannelContext';
2
+ import ChannelContext from '@jetshop/core/components/ChannelContext';
3
3
  export function useChannelSettings() {
4
4
  const context = useContext(ChannelContext);
5
5
  const selectedChannelSettings = Object.assign({}, context.selectedChannel.settings);
@@ -1 +1 @@
1
- {"version":3,"file":"useChannelSettings.js","sourceRoot":"","sources":["useChannelSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,cAAc,MAAM,iCAAiC,CAAC;AAE7D,MAAM,UAAU,kBAAkB;IAChC,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAE3C,MAAM,uBAAuB,qBAAQ,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAE,CAAC;IAExE,yBAAyB;IACzB,IAAI,OAAO,uBAAuB,CAAC,YAAY,KAAK,WAAW,EAAE;QAC/D,uBAAuB,CAAC,YAAY,GAAG,IAAI,CAAC;KAC7C;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"useChannelSettings.js","sourceRoot":"","sources":["useChannelSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,cAAc,MAAM,yCAAyC,CAAC;AAErE,MAAM,UAAU,kBAAkB;IAChC,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAE3C,MAAM,uBAAuB,qBAAQ,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAE,CAAC;IAExE,yBAAyB;IACzB,IAAI,OAAO,uBAAuB,CAAC,YAAY,KAAK,WAAW,EAAE;QAC/D,uBAAuB,CAAC,YAAY,GAAG,IAAI,CAAC;KAC7C;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useChannelSettings } from './useChannelSettings';
3
3
  import { renderHook } from '@testing-library/react-hooks';
4
- import { ProviderPyramid } from 'ProviderPyramid';
4
+ import { ProviderPyramid } from '@jetshop/core/test-utils/ProviderPyramid';
5
5
  import { selectedChannel } from 'variables';
6
6
 
7
7
  describe('useChannelSettings', () => {
@@ -1,6 +1,6 @@
1
1
  import { selectPriceType, usePrice } from './usePrice';
2
2
  import { render } from '@testing-library/react';
3
- import ChannelContext from '../components/ChannelContext';
3
+ import ChannelContext from '@jetshop/core/components/ChannelContext';
4
4
  import React from 'react';
5
5
 
6
6
  describe('selectPriceType', () => {
@@ -67,7 +67,7 @@ describe('usePrice', () => {
67
67
  it('renders using a custom formatter if provided', () => {
68
68
  const { getByText } = setup({
69
69
  ...defaultOpts,
70
- formatter: price => (
70
+ formatter: (price) => (
71
71
  <div>
72
72
  <span>{price}</span>
73
73
  <span>hi</span>
@@ -1 +1 @@
1
- export declare function useShopConfig(): import("../components/ConfigProvider").BootOptions;
1
+ export declare function useShopConfig(): import("@jetshop/core/components/ConfigProvider").BootOptions;
@@ -1,5 +1,5 @@
1
1
  import { useContext, useMemo } from 'react';
2
- import { ShopConfigContext } from '../components/ConfigProvider';
2
+ import { ShopConfigContext } from '@jetshop/core/components/ConfigProvider';
3
3
  import throwErrorInDev from '../helpers/throwErrorInDev';
4
4
  export function useShopConfig() {
5
5
  const config = useContext(ShopConfigContext);
@@ -1 +1 @@
1
- {"version":3,"file":"useShopConfig.js","sourceRoot":"","sources":["useShopConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,eAAe,MAAM,4BAA4B,CAAC;AAEzD,MAAM,UAAU,aAAa;IAC3B,MAAM,MAAM,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAE7C,IAAI,CAAC,MAAM,EAAE;QACX,eAAe,CACb,IAAI,EACJ,iEAAiE,CAClE,CAAC;KACH;IAED,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC"}
1
+ {"version":3,"file":"useShopConfig.js","sourceRoot":"","sources":["useShopConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,eAAe,MAAM,4BAA4B,CAAC;AAEzD,MAAM,UAAU,aAAa;IAC3B,MAAM,MAAM,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAE7C,IAAI,CAAC,MAAM,EAAE;QACX,eAAe,CACb,IAAI,EACJ,iEAAiE,CAClE,CAAC;KACH;IAED,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetshop/core",
3
- "version": "5.13.2",
3
+ "version": "5.13.3-beta.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -44,7 +44,7 @@
44
44
  "@sentry/node": "^6.15.0",
45
45
  "@tanem/react-nprogress": "^1.1.0",
46
46
  "@types/accept-language-parser": "^1.5.1",
47
- "@types/gtag.js": "^0.0.3",
47
+ "@types/gtag.js": "^0.0.10",
48
48
  "@types/loadable__component": "^5.10.0",
49
49
  "@types/loadable__server": "^5.9.1",
50
50
  "@types/react-router-dom": "^5.1.8",
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import { StaticRouter } from 'react-router-dom';
3
3
  import { HelmetProvider } from 'react-helmet-async';
4
- import { ChannelProvider } from '../components/ChannelContext';
5
- import { ConfigProvider } from '../components/ConfigProvider';
6
- import AnalyticsProvider from '../analytics/AnalyticsProvider';
4
+ import { ChannelProvider } from '@jetshop/core/components/ChannelContext';
5
+ import { ConfigProvider } from '@jetshop/core/components/ConfigProvider';
6
+ import AnalyticsProvider from '@jetshop/core/analytics/AnalyticsProvider';
7
7
  import { ChannelHandler } from '../ChannelHandler/ChannelHandler';
8
8
  import {
9
9
  selectedChannel as defaultSelectedChannel,
10
10
  channels as defaultChannels
11
- } from 'variables';
11
+ } from './variables';
12
12
  import { MockedProvider } from '@apollo/react-testing';
13
13
  import { CartIdProvider } from '../components/Cart/CartIdContext';
14
14
  import mockShopConfig from './mockShopConfig';