@jetshop/core 6.3.7 → 6.3.8-alpha-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChannelHandler/channelUtils.js +1 -1
- package/ChannelHandler/channelUtils.js.map +1 -1
- package/boot/apollo.js +3 -39
- package/boot/apollo.js.map +1 -1
- package/boot/client/startClient.js +1 -16
- package/boot/client/startClient.js.map +1 -1
- package/boot/server/createApolloServer.js +0 -6
- package/boot/server/createApolloServer.js.map +1 -1
- package/boot/server/createRenderer.d.ts +2 -2
- package/boot/server/createRenderer.js +12 -25
- package/boot/server/createRenderer.js.map +1 -1
- package/boot/server/createServer.js +0 -11
- package/boot/server/createServer.js.map +1 -1
- package/boot/server/index.d.ts +0 -2
- package/boot/server/index.js +4 -16
- package/boot/server/index.js.map +1 -1
- package/boot/worker/createApolloServerWorker.d.ts +18 -0
- package/boot/worker/createApolloServerWorker.js +119 -0
- package/boot/worker/createApolloServerWorker.js.map +1 -0
- package/boot/worker/createRenderer.d.ts +23 -0
- package/boot/worker/createRenderer.js +242 -0
- package/boot/worker/createRenderer.js.map +1 -0
- package/boot/worker/getPrefetchFiles.d.ts +10 -0
- package/boot/worker/getPrefetchFiles.js +20 -0
- package/boot/worker/getPrefetchFiles.js.map +1 -0
- package/boot/worker/getPreloadAssets.d.ts +10 -0
- package/boot/worker/getPreloadAssets.js +18 -0
- package/boot/worker/getPreloadAssets.js.map +1 -0
- package/boot/worker/index.d.ts +6 -0
- package/boot/worker/index.js +98 -0
- package/boot/worker/index.js.map +1 -0
- package/components/Auth/formFieldsFromSettings.d.ts +1 -1
- package/components/ConfigProvider.d.ts +3 -15
- package/components/ConfigProvider.js.map +1 -1
- package/components/DynamicRoute/GenericError.js +0 -4
- package/components/DynamicRoute/GenericError.js.map +1 -1
- package/components/Pagination/PaginationProvider.d.ts +0 -2
- package/components/Pagination/PaginationProvider.js +1 -10
- package/components/Pagination/PaginationProvider.js.map +1 -1
- package/global.d.ts +0 -1
- package/hooks/usePreconnectLinks.js +1 -5
- package/hooks/usePreconnectLinks.js.map +1 -1
- package/hooks/usePreconnectLinks.test.js +0 -4
- package/package.json +5 -6
- package/analytics/integrations/gtm/README.md +0 -3
- package/boot/server/IntervalQuery.d.ts +0 -32
- package/boot/server/IntervalQuery.js +0 -95
- package/boot/server/IntervalQuery.js.map +0 -1
- package/boot/server/IntervalQuery.test.js +0 -276
- package/boot/server/PersistedApolloClient.d.ts +0 -20
- package/boot/server/PersistedApolloClient.js +0 -40
- package/boot/server/PersistedApolloClient.js.map +0 -1
- package/boot/server/PersistedApolloClient.test.js +0 -234
- package/boot/server/createApolloServer.test.js +0 -114
- package/boot/server/getPreloadAssets.test.js +0 -133
- package/boot/server/persistedQueries/PersistedClient.d.ts +0 -22
- package/boot/server/persistedQueries/PersistedClient.js +0 -58
- package/boot/server/persistedQueries/PersistedClient.js.map +0 -1
- package/boot/server/persistedQueries/__tests__/getPersistedQueriesForRequest.test.js +0 -201
- package/boot/server/persistedQueries/__tests__/mockQuery.gql +0 -6
- package/boot/server/persistedQueries/getPersistedQueriesForRequest.d.ts +0 -3
- package/boot/server/persistedQueries/getPersistedQueriesForRequest.js +0 -27
- package/boot/server/persistedQueries/getPersistedQueriesForRequest.js.map +0 -1
- package/boot/server/saleSource.test.js +0 -39
- package/boot/server/salesSource.d.ts +0 -8
- package/boot/server/salesSource.js +0 -16
- package/boot/server/salesSource.js.map +0 -1
- package/errorReporting.browser.d.ts +0 -3
- package/errorReporting.browser.js +0 -17
- package/errorReporting.browser.js.map +0 -1
- package/errorReporting.d.ts +0 -4
- package/errorReporting.js +0 -24
- package/errorReporting.js.map +0 -1
- package/errorReporting.server.d.ts +0 -3
- package/errorReporting.server.js +0 -12
- package/errorReporting.server.js.map +0 -1
- package/errorReporting.shared.d.ts +0 -5
- package/errorReporting.shared.js +0 -17
- package/errorReporting.shared.js.map +0 -1
- package/polyfills.d.ts +0 -1
- package/polyfills.js +0 -58
- package/polyfills.js.map +0 -1
- package/sentry/client.d.ts +0 -1
- package/sentry/client.js +0 -30
- package/sentry/client.js.map +0 -1
- package/sentry/common.d.ts +0 -1
- package/sentry/common.js +0 -5
- package/sentry/common.js.map +0 -1
- package/sentry/server.d.ts +0 -1
- package/sentry/server.js +0 -20
- package/sentry/server.js.map +0 -1
- package/sentry/utils.d.ts +0 -1
- package/sentry/utils.js +0 -2
- package/sentry/utils.js.map +0 -1
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { getPersistedQueriesForRequest } from '../getPersistedQueriesForRequest';
|
|
2
|
-
import aQuery from './mockQuery.gql';
|
|
3
|
-
import nock from 'nock';
|
|
4
|
-
import { ApolloError } from '@apollo/client';
|
|
5
|
-
import { ChannelHandler } from '../../../../ChannelHandler/ChannelHandler';
|
|
6
|
-
|
|
7
|
-
beforeAll(() => {
|
|
8
|
-
jest.useFakeTimers();
|
|
9
|
-
nock.disableNetConnect();
|
|
10
|
-
});
|
|
11
|
-
afterAll(() => {
|
|
12
|
-
jest.useRealTimers();
|
|
13
|
-
nock.enableNetConnect();
|
|
14
|
-
});
|
|
15
|
-
afterEach(() => {
|
|
16
|
-
jest.restoreAllMocks();
|
|
17
|
-
jest.clearAllTimers();
|
|
18
|
-
nock.enableNetConnect();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const apolloConfig = {
|
|
22
|
-
shopid: '...',
|
|
23
|
-
graphQLURI: 'http://localhost/graphql',
|
|
24
|
-
token: '...',
|
|
25
|
-
enableGateway: false,
|
|
26
|
-
persistedQueries: [{ query: aQuery }]
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const defaultChannel = {
|
|
30
|
-
id: 1,
|
|
31
|
-
language: { name: 'English' },
|
|
32
|
-
currency: { name: 'Dollarydoos' },
|
|
33
|
-
country: {
|
|
34
|
-
id: 1234,
|
|
35
|
-
code: 'UK'
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function mockResponse(resp, { statusCode = 200, errors } = {}) {
|
|
40
|
-
const data = {
|
|
41
|
-
errors,
|
|
42
|
-
data: resp && {
|
|
43
|
-
[resp.name]: resp.values.map((val) =>
|
|
44
|
-
Object.assign({ __typename: resp.name }, val)
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const res = jest.fn(() => data);
|
|
50
|
-
nock('http://localhost').post('/graphql').reply(statusCode, res);
|
|
51
|
-
return res;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
describe('getPersistedQueriesForRequest', () => {
|
|
55
|
-
let opts;
|
|
56
|
-
|
|
57
|
-
beforeEach(() => {
|
|
58
|
-
const channelHandler = new ChannelHandler({
|
|
59
|
-
selectedChannel: defaultChannel
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
opts = {
|
|
63
|
-
apolloConfig,
|
|
64
|
-
channelHandler,
|
|
65
|
-
authHandler: {
|
|
66
|
-
getAuthHeaders: () => {},
|
|
67
|
-
loadAuthToken: () => {},
|
|
68
|
-
authToken: ''
|
|
69
|
-
},
|
|
70
|
-
previewHandler: {
|
|
71
|
-
getPreviewHeaders: () => {},
|
|
72
|
-
preview: false
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
afterEach(() => {
|
|
77
|
-
opts = {};
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('creates an object keyed by the channel', async () => {
|
|
81
|
-
const clients = {};
|
|
82
|
-
|
|
83
|
-
mockResponse({
|
|
84
|
-
name: 'dogs',
|
|
85
|
-
values: [{ id: 1, name: 'Roger' }]
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const newChannel = {
|
|
89
|
-
id: 2,
|
|
90
|
-
language: { name: 'Deutsch' },
|
|
91
|
-
currency: { name: 'Deutschmarks' },
|
|
92
|
-
country: {
|
|
93
|
-
id: 1923,
|
|
94
|
-
code: 'DE'
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// First request comes in at channel 2…
|
|
99
|
-
opts.channelHandler.setSelectedChannel(newChannel);
|
|
100
|
-
getPersistedQueriesForRequest(clients, {
|
|
101
|
-
...opts
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// It's added to the clients object
|
|
105
|
-
expect(Object.keys(clients).length).toBe(1);
|
|
106
|
-
expect(Object.keys(clients)).toEqual(
|
|
107
|
-
expect.arrayContaining(['2_Deutsch_Deutschmarks'])
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
mockResponse({
|
|
111
|
-
name: 'dogs',
|
|
112
|
-
values: [{ id: 1, name: 'Roger' }]
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// Another request comes in on channel 1…
|
|
116
|
-
opts.channelHandler.setSelectedChannel(defaultChannel);
|
|
117
|
-
getPersistedQueriesForRequest(clients, opts);
|
|
118
|
-
|
|
119
|
-
// Now both are kept in memory
|
|
120
|
-
expect(Object.keys(clients).length).toBe(2);
|
|
121
|
-
expect(Object.keys(clients)).toEqual(
|
|
122
|
-
expect.arrayContaining([
|
|
123
|
-
'2_Deutsch_Deutschmarks',
|
|
124
|
-
'1_English_Dollarydoos'
|
|
125
|
-
])
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
test('requests on the same channel do not create new cache entries', async () => {
|
|
129
|
-
const clients = {};
|
|
130
|
-
|
|
131
|
-
mockResponse({
|
|
132
|
-
name: 'dogs',
|
|
133
|
-
values: [{ id: 1, name: 'Roger' }]
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// A request comes in on channel 1…
|
|
137
|
-
getPersistedQueriesForRequest(clients, opts);
|
|
138
|
-
|
|
139
|
-
// And then another!
|
|
140
|
-
getPersistedQueriesForRequest(clients, opts);
|
|
141
|
-
|
|
142
|
-
// Only one entry in the cache tho
|
|
143
|
-
const keys = Object.keys(clients);
|
|
144
|
-
expect(keys.length).toBe(1);
|
|
145
|
-
expect(keys).toEqual(expect.arrayContaining(['1_English_Dollarydoos']));
|
|
146
|
-
});
|
|
147
|
-
test('propagates errors', async () => {
|
|
148
|
-
const clients = {};
|
|
149
|
-
|
|
150
|
-
mockResponse(null, {
|
|
151
|
-
errors: [
|
|
152
|
-
{
|
|
153
|
-
message: 'Something went wrong',
|
|
154
|
-
extensions: { code: 'an error occurred' }
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// A request comes in on channel 1…
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
await getPersistedQueriesForRequest(clients, opts).extractCache();
|
|
163
|
-
} catch (err) {
|
|
164
|
-
expect(err).toBeInstanceOf(ApolloError);
|
|
165
|
-
expect(err.message).toBe(`GraphQL error: Something went wrong`);
|
|
166
|
-
}
|
|
167
|
-
expect.assertions(2);
|
|
168
|
-
});
|
|
169
|
-
it('response updates cache', async () => {
|
|
170
|
-
const clients = {};
|
|
171
|
-
mockResponse({
|
|
172
|
-
name: 'dogs',
|
|
173
|
-
values: [{ id: 1, name: 'Roger' }]
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// A request comes in on channel 1…
|
|
177
|
-
getPersistedQueriesForRequest(clients, opts);
|
|
178
|
-
|
|
179
|
-
const firstCache = await clients['1_English_Dollarydoos'].extractCache();
|
|
180
|
-
|
|
181
|
-
expect(firstCache['dogs:1']).toEqual(
|
|
182
|
-
expect.objectContaining({ name: 'Roger' })
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
const mock = mockResponse({
|
|
186
|
-
name: 'dogs',
|
|
187
|
-
values: [{ id: 1, name: 'Updated name' }]
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// The timer ticks over, firing off another request which should have the
|
|
191
|
-
// updated return value
|
|
192
|
-
jest.advanceTimersByTime(30000);
|
|
193
|
-
expect(mock).toHaveBeenCalled();
|
|
194
|
-
|
|
195
|
-
const updatedCache = await clients['1_English_Dollarydoos'].extractCache();
|
|
196
|
-
|
|
197
|
-
expect(updatedCache['dogs:1']).toEqual(
|
|
198
|
-
expect.objectContaining({ name: 'Updated name' })
|
|
199
|
-
);
|
|
200
|
-
});
|
|
201
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PersistedClient } from './PersistedClient';
|
|
2
|
-
export function getPersistedQueriesForRequest(persistedQueryClients, opts) {
|
|
3
|
-
const { apolloConfig, authHandler, previewHandler, channelHandler } = opts;
|
|
4
|
-
const queriesToPersist = apolloConfig.persistedQueries || [];
|
|
5
|
-
// When auth is enabled or we are in a preview route, we don't want to cache
|
|
6
|
-
if (!!(authHandler === null || authHandler === void 0 ? void 0 : authHandler.authToken) || (previewHandler === null || previewHandler === void 0 ? void 0 : previewHandler.preview))
|
|
7
|
-
return null;
|
|
8
|
-
// If there are no persisted queries in the config, we have nothing to cache
|
|
9
|
-
if (queriesToPersist.length === 0)
|
|
10
|
-
return null;
|
|
11
|
-
let client;
|
|
12
|
-
const channel = channelHandler.getSelectedChannel();
|
|
13
|
-
if (channel.requiresAuth)
|
|
14
|
-
return null;
|
|
15
|
-
// Create a key unique to this selected channel, lang, currency
|
|
16
|
-
const key = `${channel.id}_${channel.language.name}_${channel.currency.name}`;
|
|
17
|
-
const headers = channelHandler.getChannelHeaders();
|
|
18
|
-
if (key in persistedQueryClients) {
|
|
19
|
-
client = persistedQueryClients[key];
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const newClient = new PersistedClient(Object.assign(Object.assign({}, opts), { headers }));
|
|
23
|
-
client = persistedQueryClients[key] = newClient;
|
|
24
|
-
}
|
|
25
|
-
return client;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=getPersistedQueriesForRequest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPersistedQueriesForRequest.js","sourceRoot":"","sources":["getPersistedQueriesForRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,6BAA6B,CAC3C,qBAA0B,EAC1B,IAAsB;IAEtB,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAE3E,MAAM,gBAAgB,GAAG,YAAY,CAAC,gBAAgB,IAAI,EAAE,CAAC;IAE7D,4EAA4E;IAC5E,IAAI,CAAC,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,CAAA,KAAI,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAA;QAAE,OAAO,IAAI,CAAC;IAErE,4EAA4E;IAC5E,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE/C,IAAI,MAAuB,CAAC;IAE5B,MAAM,OAAO,GAAG,cAAc,CAAC,kBAAkB,EAAE,CAAC;IAEpD,IAAI,OAAO,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAEtC,+DAA+D;IAC/D,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE9E,MAAM,OAAO,GAAG,cAAc,CAAC,iBAAiB,EAAE,CAAC;IAEnD,IAAI,GAAG,IAAI,qBAAqB,EAAE;QAChC,MAAM,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;KACrC;SAAM;QACL,MAAM,SAAS,GAAG,IAAI,eAAe,iCAAM,IAAI,KAAE,OAAO,IAAG,CAAC;QAE5D,MAAM,GAAG,qBAAqB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;KACjD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { salesSourceMiddleware } from './salesSource';
|
|
2
|
-
import { Cookies } from 'react-cookie';
|
|
3
|
-
|
|
4
|
-
describe('Sales source test', () => {
|
|
5
|
-
it('Will set the sales source cookie', () => {
|
|
6
|
-
const cookies = new Cookies();
|
|
7
|
-
salesSourceMiddleware({
|
|
8
|
-
queryObject: {
|
|
9
|
-
SalesSource: 'test'
|
|
10
|
-
},
|
|
11
|
-
cookies
|
|
12
|
-
});
|
|
13
|
-
expect(cookies.get('SalesSource')).toBe('test');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('Will remove the sales source cookie', () => {
|
|
17
|
-
const cookies = new Cookies();
|
|
18
|
-
cookies.set('SalesSource', 'test');
|
|
19
|
-
expect(cookies.get('SalesSource')).toBe('test');
|
|
20
|
-
salesSourceMiddleware({
|
|
21
|
-
queryObject: {
|
|
22
|
-
SalesSource: 'remove'
|
|
23
|
-
},
|
|
24
|
-
cookies
|
|
25
|
-
});
|
|
26
|
-
expect(cookies.get('SalesSource')).toBeFalsy();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('Will set the cookie regardless of case', () => {
|
|
30
|
-
const cookies = new Cookies();
|
|
31
|
-
salesSourceMiddleware({
|
|
32
|
-
queryObject: {
|
|
33
|
-
salEsSoUrCe: 'test'
|
|
34
|
-
},
|
|
35
|
-
cookies
|
|
36
|
-
});
|
|
37
|
-
expect(cookies.get('SalesSource')).toBe('test');
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
function salesSourceMiddleware({ queryObject, cookies }) {
|
|
2
|
-
const caseInsensitiveSalesSourceKey = Object.keys(queryObject).find(key => key.toLowerCase() === 'salessource');
|
|
3
|
-
const salesSourceParam = queryObject[caseInsensitiveSalesSourceKey];
|
|
4
|
-
if (salesSourceParam === 'remove') {
|
|
5
|
-
cookies.remove('SalesSource');
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
const expires = new Date();
|
|
9
|
-
expires.setFullYear(new Date().getFullYear() + 10);
|
|
10
|
-
cookies.set('SalesSource', salesSourceParam, {
|
|
11
|
-
expires
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export { salesSourceMiddleware };
|
|
16
|
-
//# sourceMappingURL=salesSource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"salesSource.js","sourceRoot":"","sources":["salesSource.ts"],"names":[],"mappings":"AAEA,SAAS,qBAAqB,CAAC,EAC7B,WAAW,EACX,OAAO,EAMR;IACC,MAAM,6BAA6B,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CACjE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,aAAa,CAC3C,CAAC;IACF,MAAM,gBAAgB,GAAG,WAAW,CAAC,6BAA6B,CAAC,CAAC;IACpE,IAAI,gBAAgB,KAAK,QAAQ,EAAE;QACjC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;KAC/B;SAAM;QACL,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAC3B,OAAO,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,gBAAgB,EAAE;YAC3C,OAAO;SACR,CAAC,CAAC;KACJ;AACH,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/browser';
|
|
2
|
-
import { convertAnyToError } from './errorReporting.shared';
|
|
3
|
-
const errorReporting = (error, extra = {}) => {
|
|
4
|
-
Sentry.withScope((scope) => {
|
|
5
|
-
// https://github.com/getsentry/sentry-javascript/issues/1607#issuecomment-425974249
|
|
6
|
-
Object.keys(extra).forEach((key) => {
|
|
7
|
-
scope.setExtra(key, extra[key]);
|
|
8
|
-
});
|
|
9
|
-
Sentry.captureException(convertAnyToError(error));
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
export default __USE_SENTRY__
|
|
13
|
-
? errorReporting
|
|
14
|
-
: () => {
|
|
15
|
-
return;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=errorReporting.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorReporting.browser.js","sourceRoot":"","sources":["errorReporting.browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAU,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,MAAM,cAAc,GAAG,CAAC,KAAY,EAAE,QAAgB,EAAE,EAAE,EAAE;IAC1D,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;QACzB,oFAAoF;QACpF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACjC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,cAAc;IAC3B,CAAC,CAAC,cAAc;IAChB,CAAC,CAAC,GAAG,EAAE;QACH,OAAO;IACT,CAAC,CAAC"}
|
package/errorReporting.d.ts
DELETED
package/errorReporting.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Import Sentry's node or browser moudule depending on env
|
|
3
|
-
|
|
4
|
-
Use process.env.BUILD_TARGET over @jetshop/core/inServer.
|
|
5
|
-
|
|
6
|
-
When using `process.env.*` this is evaluated at compile time & only one
|
|
7
|
-
of the lines will transpiled into the final code.
|
|
8
|
-
*/
|
|
9
|
-
function errorReporting(error, extra) {
|
|
10
|
-
let report;
|
|
11
|
-
if (__IN_SERVER__) {
|
|
12
|
-
report = require('./errorReporting.server').default;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
report = require('./errorReporting.browser').default;
|
|
16
|
-
}
|
|
17
|
-
return report(error, extra);
|
|
18
|
-
}
|
|
19
|
-
export default __USE_SENTRY__
|
|
20
|
-
? errorReporting
|
|
21
|
-
: (_, __) => {
|
|
22
|
-
return;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=errorReporting.js.map
|
package/errorReporting.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorReporting.js","sourceRoot":"","sources":["errorReporting.ts"],"names":[],"mappings":"AAEA;;;;;;;EAOE;AACF,SAAS,cAAc,CAAC,KAAY,EAAE,KAAc;IAClD,IAAI,MAAc,CAAC;IACnB,IAAI,aAAa,EAAE;QACjB,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,OAAO,CAAC;KACrD;SAAM;QACL,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC;KACtD;IACD,OAAO,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,eAAe,cAAc;IAC3B,CAAC,CAAC,cAAc;IAChB,CAAC,CAAC,CAAC,CAAQ,EAAE,EAAU,EAAE,EAAE;QACvB,OAAO;IACT,CAAC,CAAC"}
|
package/errorReporting.server.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/node';
|
|
2
|
-
import { convertAnyToError } from './errorReporting.shared';
|
|
3
|
-
export default (error, extra = {}) => {
|
|
4
|
-
Sentry.withScope((scope) => {
|
|
5
|
-
// https://github.com/getsentry/sentry-javascript/issues/1607#issuecomment-425974249
|
|
6
|
-
Object.keys(extra).forEach((key) => {
|
|
7
|
-
scope.setExtra(key, extra[key]);
|
|
8
|
-
});
|
|
9
|
-
Sentry.captureException(convertAnyToError(error));
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=errorReporting.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorReporting.server.js","sourceRoot":"","sources":["errorReporting.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAU,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAe,CAAC,KAAY,EAAE,QAAgB,EAAE,EAAE,EAAE;IAClD,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;QACzB,oFAAoF;QACpF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACjC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/errorReporting.shared.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const convertAnyToError = (error) => {
|
|
2
|
-
const errorType = Object.prototype.toString.call(error);
|
|
3
|
-
try {
|
|
4
|
-
switch (errorType) {
|
|
5
|
-
case '[object Error]':
|
|
6
|
-
return error;
|
|
7
|
-
case '[object String]':
|
|
8
|
-
return new Error(error);
|
|
9
|
-
default:
|
|
10
|
-
return new Error(JSON.stringify(error));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
catch (err) {
|
|
14
|
-
return err;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=errorReporting.shared.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorReporting.shared.js","sourceRoot":"","sources":["errorReporting.shared.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAU,EAAE,EAAE;IAC9C,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI;QACF,QAAQ,SAAS,EAAE;YACjB,KAAK,gBAAgB;gBACnB,OAAO,KAAK,CAAC;YAEf,KAAK,iBAAiB;gBACpB,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;YAE1B;gBACE,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SAC3C;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,GAAG,CAAC;KACZ;AACH,CAAC,CAAC"}
|
package/polyfills.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createPolyfill: (locale: string, usePolyfilling: boolean) => string;
|
package/polyfills.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const polyfills = (locale) => [
|
|
2
|
-
'es2015',
|
|
3
|
-
'Object.values',
|
|
4
|
-
'Object.entries',
|
|
5
|
-
'Object.keys',
|
|
6
|
-
'Object.assign',
|
|
7
|
-
'Array.prototype.find',
|
|
8
|
-
'Array.prototype.findIndex',
|
|
9
|
-
'Array.prototype.flatMap',
|
|
10
|
-
'Array.prototype.includes',
|
|
11
|
-
'Array.prototype.keys',
|
|
12
|
-
'Array.from',
|
|
13
|
-
'Array.prototype.fill',
|
|
14
|
-
'String.prototype.endsWith',
|
|
15
|
-
'String.prototype.startsWith',
|
|
16
|
-
'URL',
|
|
17
|
-
'IntersectionObserver',
|
|
18
|
-
`Intl.~locale.${locale}`,
|
|
19
|
-
'Promise',
|
|
20
|
-
'fetch',
|
|
21
|
-
'Symbol',
|
|
22
|
-
'ResizeObserver'
|
|
23
|
-
];
|
|
24
|
-
export const createPolyfill = (locale, usePolyfilling) => {
|
|
25
|
-
const features = polyfills(locale).join(',');
|
|
26
|
-
// Here we add two script tags to be run once the client is loaded. One sets a global variable 'polyFillsLoaded' to false and adds a function bootShop which, when called will set 'polyFillsLoaded' to true. The second script will load the polyfills and once they are loaded will call the bootShop function to let the client know that the polyfills have been loaded and that the shop can be started.
|
|
27
|
-
return `
|
|
28
|
-
<script>
|
|
29
|
-
window.polyFillsLoaded = false;
|
|
30
|
-
|
|
31
|
-
// This is the base function that is later supplanted by startClient.tsx when it is ready to start the client
|
|
32
|
-
window.bootShop = function() {
|
|
33
|
-
window.polyFillsLoaded = true;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// Set the polyFillsLoaded flag to true and start the shop
|
|
37
|
-
window.onPolyfillLoad = function() {
|
|
38
|
-
window.polyFillsLoaded = true;
|
|
39
|
-
window.bootShop();
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// If polyfill service does not respond, start the shop anyway
|
|
44
|
-
if (${usePolyfilling}) {
|
|
45
|
-
setTimeout(function () {
|
|
46
|
-
if(!window.polyFillsLoaded) {
|
|
47
|
-
window.bootShop();
|
|
48
|
-
}
|
|
49
|
-
}, 5000);
|
|
50
|
-
}
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
${usePolyfilling
|
|
54
|
-
? `<script async defer src='https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0${process.env.NODE_ENV === 'production' ? '.min' : ''}.js&callback=onPolyfillLoad&features=${features}'></script>`
|
|
55
|
-
: '<script>window.bootShop();</script>'}
|
|
56
|
-
`;
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=polyfills.js.map
|
package/polyfills.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfills.js","sourceRoot":"","sources":["polyfills.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC;IACpC,QAAQ;IACR,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,sBAAsB;IACtB,2BAA2B;IAC3B,yBAAyB;IACzB,0BAA0B;IAC1B,sBAAsB;IACtB,YAAY;IACZ,sBAAsB;IACtB,2BAA2B;IAC3B,6BAA6B;IAC7B,KAAK;IACL,sBAAsB;IACtB,gBAAgB,MAAM,EAAE;IACxB,SAAS;IACT,OAAO;IACP,QAAQ;IACR,gBAAgB;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,cAAuB,EAAE,EAAE;IACxE,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,6YAA6Y;IAC7Y,OAAO;;;;;;;;;;;;;;;;;QAiBD,cAAc;;;;;;;;;IAUlB,cAAc;QACZ,CAAC,CAAC,kGACE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EACnD,wCAAwC,QAAQ,aAAa;QAC/D,CAAC,CAAC,qCACN;CACD,CAAC;AACF,CAAC,CAAC"}
|
package/sentry/client.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function init(dsn?: string, ignoreErrors?: (string | RegExp)[]): void;
|
package/sentry/client.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/browser';
|
|
2
|
-
import { checkSentryDSN } from './utils';
|
|
3
|
-
import { ignoreErrors as commonIgnoreErrors } from './common';
|
|
4
|
-
export function init(dsn, ignoreErrors = []) {
|
|
5
|
-
if (checkSentryDSN(dsn)) {
|
|
6
|
-
Sentry.init({
|
|
7
|
-
release: process.env.CI_COMMIT_SHA || undefined,
|
|
8
|
-
dsn,
|
|
9
|
-
ignoreErrors: [
|
|
10
|
-
...commonIgnoreErrors,
|
|
11
|
-
'PersistedQueryNotFound',
|
|
12
|
-
'PERSISTED_QUERY_NOT_FOUND',
|
|
13
|
-
'NetworkError when attempting to fetch resource',
|
|
14
|
-
/Loading chunk \d+ failed/,
|
|
15
|
-
// Network errors
|
|
16
|
-
'TypeError: NetworkError when attempting to fetch resource.',
|
|
17
|
-
'TypeError: Nätverksanslutningen förlorades.',
|
|
18
|
-
'TypeError: Netværksforbindelsen gik tabt.',
|
|
19
|
-
'TypeError: Verkkoyhteys katkesi.',
|
|
20
|
-
'Failed to fetch',
|
|
21
|
-
'ResizeObserver loop',
|
|
22
|
-
'Unauthorized'
|
|
23
|
-
].concat(ignoreErrors)
|
|
24
|
-
});
|
|
25
|
-
Sentry.configureScope((scope) => {
|
|
26
|
-
scope.setTag('BUILD_TARGET', 'client');
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=client.js.map
|
package/sentry/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,UAAU,IAAI,CAClB,GAAY,EACZ,eAAoC,EAAE;IAEtC,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC;YACV,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,SAAS;YAC/C,GAAG;YACH,YAAY,EAAE;gBACZ,GAAG,kBAAkB;gBACrB,wBAAwB;gBACxB,2BAA2B;gBAC3B,gDAAgD;gBAChD,0BAA0B;gBAC1B,iBAAiB;gBACjB,4DAA4D;gBAC5D,6CAA6C;gBAC7C,2CAA2C;gBAC3C,kCAAkC;gBAClC,iBAAiB;gBACjB,qBAAqB;gBACrB,cAAc;aACf,CAAC,MAAM,CAAC,YAAY,CAAC;SACvB,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE;YAC9B,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;KACJ;AACH,CAAC"}
|
package/sentry/common.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ignoreErrors: string[];
|
package/sentry/common.js
DELETED
package/sentry/common.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,cAAc;IACd,2CAA2C;CAC5C,CAAC"}
|
package/sentry/server.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function init(dsn: string, ignoreErrors?: (string | RegExp)[]): void;
|
package/sentry/server.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/node';
|
|
2
|
-
import { checkSentryDSN } from './utils';
|
|
3
|
-
import { ignoreErrors as commonIgnoreErrors } from './common';
|
|
4
|
-
export function init(dsn, ignoreErrors = []) {
|
|
5
|
-
if (checkSentryDSN(dsn)) {
|
|
6
|
-
Sentry.init({
|
|
7
|
-
release: process.env.CI_COMMIT_SHA || undefined,
|
|
8
|
-
dsn,
|
|
9
|
-
ignoreErrors: [
|
|
10
|
-
...commonIgnoreErrors,
|
|
11
|
-
'request to https://storeapi.jetshop.io/ failed',
|
|
12
|
-
...ignoreErrors
|
|
13
|
-
]
|
|
14
|
-
});
|
|
15
|
-
Sentry.configureScope((scope) => {
|
|
16
|
-
scope.setTag('BUILD_TARGET', 'server');
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=server.js.map
|
package/sentry/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,UAAU,IAAI,CAClB,GAAW,EACX,eAAoC,EAAE;IAEtC,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC;YACV,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,SAAS;YAC/C,GAAG;YACH,YAAY,EAAE;gBACZ,GAAG,kBAAkB;gBACrB,gDAAgD;gBAChD,GAAG,YAAY;aAChB;SACF,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE;YAC9B,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;KACJ;AACH,CAAC"}
|
package/sentry/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const checkSentryDSN: (dsn: string) => boolean;
|
package/sentry/utils.js
DELETED
package/sentry/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC"}
|