@jetshop/core 6.1.0-alpha.60f2f3f7 → 6.1.0-alpha.996f4762
Sign up to get free protection for your applications and to get access to all the features.
- package/analytics/trackerRegistry.js +11 -1
- package/analytics/trackerRegistry.js.map +1 -1
- package/boot/SharedTree.d.ts +1 -3
- package/boot/SharedTree.js +2 -4
- package/boot/SharedTree.js.map +1 -1
- package/boot/client/startClient.js +8 -11
- package/boot/client/startClient.js.map +1 -1
- package/boot/server/createRenderer.js +4 -2
- package/boot/server/createRenderer.js.map +1 -1
- package/boot/server/createServer.js +2 -2
- package/boot/server/createServer.js.map +1 -1
- package/boot/server/index.js +4 -2
- package/boot/server/index.js.map +1 -1
- package/components/Auth/signupSubmit.js +14 -8
- package/components/Auth/signupSubmit.js.map +1 -1
- package/components/AuthContext/AuthContext.d.ts +5 -1
- package/components/AuthContext/AuthContext.js +3 -1
- package/components/AuthContext/AuthContext.js.map +1 -1
- package/components/AuthContext/AuthProvider.js +8 -4
- package/components/AuthContext/AuthProvider.js.map +1 -1
- package/components/AuthContext/useAuth.d.ts +1 -1
- package/components/AuthContext/useAuth.js +3 -4
- package/components/AuthContext/useAuth.js.map +1 -1
- package/components/Cart/CartIdContext.js +1 -1
- package/components/Cart/CartIdContext.js.map +1 -1
- package/components/DynamicRoute/RouteResolver.js +3 -5
- package/components/DynamicRoute/RouteResolver.js.map +1 -1
- package/data/mutations/accountMutations.gql +3 -2
- package/data/mutations/signup.gql +1 -0
- package/data/queries/ProductLists.gql +1 -1
- package/errorReporting.browser.js +8 -3
- package/errorReporting.browser.js.map +1 -1
- package/errorReporting.d.ts +2 -1
- package/errorReporting.js +5 -1
- package/errorReporting.js.map +1 -1
- package/global.d.ts +1 -0
- package/helpers/throwErrorInDev.js +7 -2
- package/helpers/throwErrorInDev.js.map +1 -1
- package/hooks/ProductList/ProductListContext.d.ts +5 -0
- package/hooks/ProductList/ProductListContext.js +15 -3
- package/hooks/ProductList/ProductListContext.js.map +1 -1
- package/hooks/ProductList/action-creators.js +10 -12
- package/hooks/ProductList/action-creators.js.map +1 -1
- package/hooks/ProductList/index.d.ts +2 -1
- package/hooks/ProductList/index.js.map +1 -1
- package/hooks/ProductList/product-list-reducer.js +1 -1
- package/hooks/ProductList/product-list-reducer.js.map +1 -1
- package/hooks/useLoginMutation.d.ts +1 -0
- package/hooks/useLoginMutation.js +5 -1
- package/hooks/useLoginMutation.js.map +1 -1
- package/hooks/useRoutePreload.js +5 -0
- package/hooks/useRoutePreload.js.map +1 -1
- package/hooks/useThunkReducer.js +2 -2
- package/hooks/useThunkReducer.js.map +1 -1
- package/package.json +1 -3
- package/types.d.ts +2 -1
- package/analytics/webVitals.d.ts +0 -5
- package/analytics/webVitals.js +0 -39
- package/analytics/webVitals.js.map +0 -1
@@ -1,12 +1,17 @@
|
|
1
1
|
import * as Sentry from '@sentry/browser';
|
2
2
|
import { convertAnyToError } from './errorReporting.shared';
|
3
|
-
|
4
|
-
Sentry.withScope(scope => {
|
3
|
+
const errorReporting = (error, extra = {}) => {
|
4
|
+
Sentry.withScope((scope) => {
|
5
5
|
// https://github.com/getsentry/sentry-javascript/issues/1607#issuecomment-425974249
|
6
|
-
Object.keys(extra).forEach(key => {
|
6
|
+
Object.keys(extra).forEach((key) => {
|
7
7
|
scope.setExtra(key, extra[key]);
|
8
8
|
});
|
9
9
|
Sentry.captureException(convertAnyToError(error));
|
10
10
|
});
|
11
11
|
};
|
12
|
+
export default __USE_SENTRY__
|
13
|
+
? errorReporting
|
14
|
+
: () => {
|
15
|
+
return;
|
16
|
+
};
|
12
17
|
//# sourceMappingURL=errorReporting.browser.js.map
|
@@ -1 +1 @@
|
|
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,
|
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
CHANGED
package/errorReporting.js
CHANGED
package/errorReporting.js.map
CHANGED
@@ -1 +1 @@
|
|
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,CAAC"}
|
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/global.d.ts
CHANGED
@@ -3,12 +3,17 @@
|
|
3
3
|
* @param condition
|
4
4
|
* @param msg
|
5
5
|
*/
|
6
|
-
export default function throwErrorInDev(condition, msg, info =
|
6
|
+
export default function throwErrorInDev(condition, msg, info = null) {
|
7
7
|
if (process.env.NODE_ENV !== 'production') {
|
8
8
|
if (!condition) {
|
9
9
|
return;
|
10
10
|
}
|
11
|
-
|
11
|
+
if (info) {
|
12
|
+
console.error(msg, 'Info:', info);
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
console.error(msg);
|
16
|
+
}
|
12
17
|
throw new Error(msg);
|
13
18
|
}
|
14
19
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"throwErrorInDev.js","sourceRoot":"","sources":["throwErrorInDev.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAkB,EAClB,GAAW,EACX,OAAY,
|
1
|
+
{"version":3,"file":"throwErrorInDev.js","sourceRoot":"","sources":["throwErrorInDev.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAkB,EAClB,GAAW,EACX,OAAY,IAAI;IAEhB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAI,CAAC,SAAS,EAAE;YACd,OAAO;SACR;QAED,IAAI,IAAI,EAAE;YACR,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;SACnC;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;QAED,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;KACtB;AACH,CAAC"}
|
@@ -1,6 +1,11 @@
|
|
1
1
|
import React, { Context } from 'react';
|
2
2
|
import { ProductListContextOptions, ProductListQueries, ProductListState } from '.';
|
3
3
|
export declare const ProductListContext: Context<ProductListContextOptions>;
|
4
|
+
export declare class ProductListRequestId {
|
5
|
+
private id;
|
6
|
+
increment(): void;
|
7
|
+
get(): string;
|
8
|
+
}
|
4
9
|
export declare const ProductListProvider: React.FC<{
|
5
10
|
initialState: ProductListState;
|
6
11
|
queries: ProductListQueries;
|
@@ -20,11 +20,23 @@ import { useThunkReducer } from '../useThunkReducer';
|
|
20
20
|
import { createListAction, deleteListAction, loginAction, refreshAction } from './action-creators';
|
21
21
|
import { normalizeServerList } from './list-transforms';
|
22
22
|
import { init, reducer } from './product-list-reducer';
|
23
|
+
import uniqueId from '../../helpers/uniqueId';
|
23
24
|
export const ProductListContext = React.createContext(undefined);
|
24
25
|
function useMissingQueryWarning(property, queries) {
|
25
26
|
return useWarningInDev(!(property in queries), `No \`${property}\` query available in \`queries\` for \`ProductListProvider\`. ` +
|
26
27
|
`Check migration guide for 5.11.0 (product lists section) to remove this warning`);
|
27
28
|
}
|
29
|
+
export class ProductListRequestId {
|
30
|
+
constructor() {
|
31
|
+
this.id = null;
|
32
|
+
}
|
33
|
+
increment() {
|
34
|
+
this.id = uniqueId('_product_list_');
|
35
|
+
}
|
36
|
+
get() {
|
37
|
+
return this.id;
|
38
|
+
}
|
39
|
+
}
|
28
40
|
export const ProductListProvider = function ProductListProvider(_a) {
|
29
41
|
var { queries, initialState = {} } = _a, rest = __rest(_a, ["queries", "initialState"]);
|
30
42
|
// NOTE: Warn about missing queries, should be removed in next major release.
|
@@ -32,7 +44,7 @@ export const ProductListProvider = function ProductListProvider(_a) {
|
|
32
44
|
useMissingQueryWarning('createList', queries);
|
33
45
|
useMissingQueryWarning('deleteList', queries);
|
34
46
|
const { loggedIn } = useAuth();
|
35
|
-
const requestIdRef = React.useRef(
|
47
|
+
const requestIdRef = React.useRef(new ProductListRequestId());
|
36
48
|
const allQuery = queries.all || productListQueries.ProductLists;
|
37
49
|
const { data: serverList, client } = useQuery(allQuery, {
|
38
50
|
skip: !loggedIn
|
@@ -46,8 +58,8 @@ export const ProductListProvider = function ProductListProvider(_a) {
|
|
46
58
|
]))
|
47
59
|
: emptyProductLists();
|
48
60
|
const defaultInitialState = Object.assign({ loggedIn,
|
49
|
-
|
50
|
-
|
61
|
+
lists,
|
62
|
+
requestIdRef }, initialState);
|
51
63
|
const [state, dispatch] = useThunkReducer(reducer, defaultInitialState, (initialState) => init(initialState));
|
52
64
|
const usingLocalList = !state.loggedIn;
|
53
65
|
usePersistLocalList({ lists: state.lists });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ProductListContext.js","sourceRoot":"","sources":["ProductListContext.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAW,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,kBAAkB,MAAM,6CAA6C,CAAC;AAC7E,OAAO,oBAAoB,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAEL,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EAKlB,MAAM,GAAG,CAAC;AACX,OAAO,OAAO,MAAM,sCAAsC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM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H,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAE7C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { PRODUCT_LISTS_KEY, productListArrayToMap } from '.';
|
2
2
|
import { flattenList, normalizeServerList } from './list-transforms';
|
3
|
-
import uniqueId from '../../helpers/uniqueId';
|
4
3
|
export function loginAction({ loginMutation, fetchAll }) {
|
5
4
|
return (dispatch, getState) => {
|
6
5
|
const state = getState();
|
@@ -124,8 +123,8 @@ export function updateAction({ listId, updateAPI = false, removeMutation, addMut
|
|
124
123
|
const [remove] = removeMutation;
|
125
124
|
const [add] = addMutation;
|
126
125
|
const previousState = getState();
|
127
|
-
|
128
|
-
previousState.requestIdRef.current
|
126
|
+
previousState.requestIdRef.current.increment();
|
127
|
+
const requestId = previousState.requestIdRef.current;
|
129
128
|
remove({
|
130
129
|
// Don't write to the cache. This avoids re-rendering the list.
|
131
130
|
fetchPolicy: 'no-cache',
|
@@ -165,6 +164,7 @@ export function updateAction({ listId, updateAPI = false, removeMutation, addMut
|
|
165
164
|
}
|
166
165
|
export function removeAction({ listId, updateAPI = false, articleNumber, variantArticleNumber, removeMutation }) {
|
167
166
|
return (dispatch, getState) => {
|
167
|
+
var _a, _b;
|
168
168
|
dispatch({
|
169
169
|
type: 'REMOVE',
|
170
170
|
payload: {
|
@@ -177,8 +177,8 @@ export function removeAction({ listId, updateAPI = false, articleNumber, variant
|
|
177
177
|
return;
|
178
178
|
const [remove] = removeMutation;
|
179
179
|
const previousState = getState();
|
180
|
-
|
181
|
-
previousState.requestIdRef.current
|
180
|
+
(_b = (_a = previousState.requestIdRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.increment();
|
181
|
+
const requestId = previousState.requestIdRef.current;
|
182
182
|
remove({
|
183
183
|
fetchPolicy: 'no-cache',
|
184
184
|
context: { useApolloNetworkStatus: false },
|
@@ -212,8 +212,8 @@ export function clearAction({ listId, updateAPI = false, removeMutation }) {
|
|
212
212
|
const state = getState();
|
213
213
|
const list = state.lists.get(listId);
|
214
214
|
const articleNumbers = flattenList(list).map((listItem) => listItem.articleNumber);
|
215
|
-
|
216
|
-
state.requestIdRef.current
|
215
|
+
state.requestIdRef.current.increment();
|
216
|
+
const requestId = state.requestIdRef.current;
|
217
217
|
remove({
|
218
218
|
fetchPolicy: 'no-cache',
|
219
219
|
context: { useApolloNetworkStatus: false },
|
@@ -231,6 +231,7 @@ export function clearAction({ listId, updateAPI = false, removeMutation }) {
|
|
231
231
|
}
|
232
232
|
export function addAction({ listId, articleNumber, variantArticleNumber, addMutation, options, updateAPI = false }) {
|
233
233
|
return (dispatch, getState) => {
|
234
|
+
var _a, _b;
|
234
235
|
const { quantity, description } = options;
|
235
236
|
dispatch({
|
236
237
|
type: 'ADD',
|
@@ -245,8 +246,8 @@ export function addAction({ listId, articleNumber, variantArticleNumber, addMuta
|
|
245
246
|
return;
|
246
247
|
const [add] = addMutation;
|
247
248
|
const previousState = getState();
|
248
|
-
|
249
|
-
previousState.requestIdRef.current
|
249
|
+
(_b = (_a = previousState.requestIdRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.increment();
|
250
|
+
const requestId = previousState.requestIdRef.current;
|
250
251
|
add({
|
251
252
|
fetchPolicy: 'no-cache',
|
252
253
|
context: { useApolloNetworkStatus: false },
|
@@ -272,9 +273,6 @@ export function addAction({ listId, articleNumber, variantArticleNumber, addMuta
|
|
272
273
|
});
|
273
274
|
};
|
274
275
|
}
|
275
|
-
function scopedUniqueID() {
|
276
|
-
return uniqueId('_product_list_');
|
277
|
-
}
|
278
276
|
function syncListFromServer(dispatch, listId, productList) {
|
279
277
|
const list = normalizeServerList(productList.customerProductList);
|
280
278
|
dispatch({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"action-creators.js","sourceRoot":"","sources":["action-creators.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAOjB,qBAAqB,EACtB,MAAM,GAAG,CAAC;AAEX,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"action-creators.js","sourceRoot":"","sources":["action-creators.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAOjB,qBAAqB,EACtB,MAAM,GAAG,CAAC;AAEX,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGrE,MAAM,UAAU,WAAW,CAAC,EAC1B,aAAa,EACb,QAAQ,EAIT;IACC,OAAO,CACL,QAAgC,EAChC,QAAgC,EAChC,EAAE;QACF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;QAEzB,wEAAwE;QACxE,iBAAiB;QACjB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,aAAa,CAAC;YACZ,WAAW,EAAE,UAAU;YACvB,OAAO,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE;YAC1C,SAAS,EAAE;gBACT,EAAE,EAAE,IAAI;gBACR,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;oBAC1C,aAAa,EAAE,QAAQ,CAAC,aAAa;oBACrC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ;oBACnC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW;iBAC1C,CAAC,CAAC;aACJ;SACF,CAAC;aACC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,MAAM,IAAI,GAAG,mBAAmB,CAC9B,QAAQ,CAAC,IAAI,CAAC,wB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4,6 +4,7 @@ import { DocumentNode } from 'graphql';
|
|
4
4
|
import { CustomerProductListResult, MutationCreateCustomerProductListArgs, MutationAddToCustomerProductListArgs, MutationRemoveFromCustomerProductListArgs, MutationUpdateCustomerProductListItemArgs, Product, ProductVariant, QueryCustomerProductListArgs, QueryProductsArgs } from '../../types';
|
5
5
|
import { ThunkAction } from '../useThunkReducer';
|
6
6
|
import { Action } from './product-list-reducer';
|
7
|
+
import { ProductListRequestId } from 'packages/core/hooks/ProductList/ProductListContext';
|
7
8
|
export { useProductList } from './useProductList';
|
8
9
|
export { useProductListItems } from './useProductListItems';
|
9
10
|
export interface UpdateListOptions {
|
@@ -40,7 +41,7 @@ export declare function productListArrayToMap(array: [ProductListId, NormalizedP
|
|
40
41
|
export interface ProductListState {
|
41
42
|
loggedIn: boolean;
|
42
43
|
lists: ProductListMap;
|
43
|
-
requestIdRef: React.MutableRefObject<
|
44
|
+
requestIdRef: React.MutableRefObject<ProductListRequestId>;
|
44
45
|
}
|
45
46
|
export interface ProductListQueries {
|
46
47
|
/** Products query, used for retrieving products from localList */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAgC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEhD,MAAM,UAAU,iBAAiB;IAC/B,OAAO,IAAI,GAAG,CAAC;QACb;YACE,IAAI;YACJ;gBACE,KAAK,EAAE,EAAE;gBACT,IAAI,EAAE,IAAI;aACX;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,GAAmB;IACvD,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC;IACvB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAA+C;IAE/C,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { enableMapSet, produce } from 'immer';
|
2
|
+
import { emptyProductLists, PRODUCT_LISTS_KEY, productListArrayToMap } from '.';
|
2
3
|
// The Product lists are stored as a Map so need to enable Map support for Immer
|
3
4
|
enableMapSet();
|
4
|
-
import { emptyProductLists, PRODUCT_LISTS_KEY, productListArrayToMap } from '.';
|
5
5
|
export function reducer(state, action) {
|
6
6
|
switch (action.type) {
|
7
7
|
case 'LOGIN':
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"product-list-reducer.js","sourceRoot":"","sources":["product-list-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC9C,
|
1
|
+
{"version":3,"file":"product-list-reducer.js","sourceRoot":"","sources":["product-list-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAOjB,qBAAqB,EACtB,MAAM,GAAG,CAAC;AACX,gFAAgF;AAChF,YAAY,EAAE,CAAC;AAEf,MAAM,UAAU,OAAO,CACrB,KAAuB,EACvB,MAAc;IAEd,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC9B,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACtB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;gBACxC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAChC,CAAC,CAAC,CA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BAAoB,CAAC,EAAE;oBACtB,OAAO;oBACP,mBAAmB,EAAE,aAAa;iBACnC,GACF,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;;YAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;YAC5C,KAAK,CAAC,aAAa,CAAC,GAAG;gBACrB,OAAO,EAAE,IAAI;gBACb,QAAQ,kCACH,MAAA,KAAK,CAAC,aAAa,CAAC,0CAAE,QAAQ,KACjC,CAAC,oBAAoB,CAAC,EAAE;wBACtB,OAAO;wBACP,mBAAmB,EAAE,aAAa;qBACnC,GACF;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;AACH,CAAC"}
|
@@ -5,6 +5,7 @@ declare const useLoginMutation: () => {
|
|
5
5
|
}, {
|
6
6
|
email: string;
|
7
7
|
password: string;
|
8
|
+
cartId?: string;
|
8
9
|
}, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>) => Promise<import("@apollo/client").FetchResult<{
|
9
10
|
login: LoginResponse;
|
10
11
|
}, Record<string, any>, Record<string, any>>>;
|
@@ -6,7 +6,11 @@ const useLoginMutation = () => {
|
|
6
6
|
const { updateLoggedIn } = useContext(AuthContext);
|
7
7
|
const [loginMutation] = useMutation(login, {
|
8
8
|
onCompleted: (data) => {
|
9
|
-
updateLoggedIn(
|
9
|
+
updateLoggedIn({
|
10
|
+
loggedIn: !!data.login.token,
|
11
|
+
customerId: data.login.customerId,
|
12
|
+
token: data.login.token.value
|
13
|
+
});
|
10
14
|
}
|
11
15
|
});
|
12
16
|
return { loginMutation };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useLoginMutation.js","sourceRoot":"","sources":["useLoginMutation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC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,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/hooks/useRoutePreload.js
CHANGED
@@ -3,10 +3,15 @@ import { useContext } from 'react';
|
|
3
3
|
import { useShopConfig } from './useShopConfig';
|
4
4
|
import { usePagination } from '../components/Pagination/PaginationProvider';
|
5
5
|
import SortOrderContext from '../components/SortOrder/SortOrderContext';
|
6
|
+
import throwErrorInDev from '@jetshop/core/helpers/throwErrorInDev';
|
6
7
|
export const useRoutePreload = () => {
|
7
8
|
var _a, _b, _c;
|
8
9
|
const config = useShopConfig();
|
9
10
|
const routeQuery = (_b = (_a = config === null || config === void 0 ? void 0 : config.preload) === null || _a === void 0 ? void 0 : _a.routeQuery) !== null && _b !== void 0 ? _b : null;
|
11
|
+
throwErrorInDev(!routeQuery, `\n ⛔️ useRoutePreload hook requires a routeQuery from shop.config.
|
12
|
+
This error messages is shown because you are using CategoryLink and ProductLink components.
|
13
|
+
Visit https://flight.norce.io/flight-frontend/features/general/#route-preloading for details on adding a routeQuery to your shop.config. \n
|
14
|
+
`);
|
10
15
|
const preloadComponents = (_c = config === null || config === void 0 ? void 0 : config.preload) === null || _c === void 0 ? void 0 : _c.preloadComponents;
|
11
16
|
const pagination = usePagination();
|
12
17
|
const sortOrderState = useContext(SortOrderContext);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useRoutePreload.js","sourceRoot":"","sources":["useRoutePreload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;
|
1
|
+
{"version":3,"file":"useRoutePreload.js","sourceRoot":"","sources":["useRoutePreload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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AAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,KAAI,EAAE,EAChC,MAAM,EAAE,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,KAAI,CAAC,EAC/B,OAAO,EAAE,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,SAAS,KAAI,IAAI,EAC1C,gBAAgB,EAAE,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,SAAS,KAAI,YAAY,EAC3D,OAAO,EAAE;wBACP,WAAW,EAAE,EAAE;wBACf,YAAY,EAAE,EAAE;wBAChB,cAAc,EAAE,EAAE;wBAClB,gBAAgB,EAAE,EAAE;qBACrB,IACE,SAAS,CACb;aACF,CAAC,CAAC;QAEL,iBAAiB;YACf,iBAAiB,CAAC,SAAS,CAAC;YAC5B,iBAAiB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;gBACjD,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC,CAAC"}
|
package/hooks/useThunkReducer.js
CHANGED
@@ -8,7 +8,7 @@ function isThunk(action) {
|
|
8
8
|
*/
|
9
9
|
export function useThunkReducer(reducer, initialState, initializer) {
|
10
10
|
const [state, dispatch] = useReducer(reducer, initialState, initializer);
|
11
|
-
const previousState = useRef();
|
11
|
+
const previousState = useRef(null);
|
12
12
|
previousState.current = state;
|
13
13
|
const thunkedDispatch = useCallback(function thunkedDispatch(action) {
|
14
14
|
if (isThunk(action)) {
|
@@ -18,7 +18,7 @@ export function useThunkReducer(reducer, initialState, initializer) {
|
|
18
18
|
},
|
19
19
|
// exhaustive-deps doesn't work with recursion
|
20
20
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
21
|
-
[]);
|
21
|
+
[previousState]);
|
22
22
|
return [previousState.current, thunkedDispatch];
|
23
23
|
}
|
24
24
|
//# sourceMappingURL=useThunkReducer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useThunkReducer.js","sourceRoot":"","sources":["useThunkReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAW,MAAM,OAAO,CAAC;AAOjE,SAAS,OAAO,CACd,MAA2C;IAE3C,OAAO,OAAO,MAAM,KAAK,UAAU,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,OAA+B,EAC/B,YAAmB,EACnB,WAAmC;IAEnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IAEzE,MAAM,aAAa,GAAG,MAAM,
|
1
|
+
{"version":3,"file":"useThunkReducer.js","sourceRoot":"","sources":["useThunkReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAW,MAAM,OAAO,CAAC;AAOjE,SAAS,OAAO,CACd,MAA2C;IAE3C,OAAO,OAAO,MAAM,KAAK,UAAU,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,OAA+B,EAC/B,YAAmB,EACnB,WAAmC;IAEnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IAEzE,MAAM,aAAa,GAAG,MAAM,CAAe,IAAI,CAAC,CAAC;IACjD,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;IAE9B,MAAM,eAAe,GAAG,WAAW,CACjC,SAAS,eAAe,CAAC,MAA2C;QAClE,IAAI,OAAO,CAAgB,MAAM,CAAC,EAAE;YAClC,OAAO,MAAM,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;SAC7D;QAED,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC;IACD,8CAA8C;IAC9C,uDAAuD;IACvD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jetshop/core",
|
3
|
-
"version": "6.1.0-alpha.
|
3
|
+
"version": "6.1.0-alpha.996f4762",
|
4
4
|
"license": "MIT",
|
5
5
|
"files": [
|
6
6
|
"**/*.js",
|
@@ -75,8 +75,6 @@
|
|
75
75
|
"typed-emitter": "^0.1.0",
|
76
76
|
"universal-cookie-express": "^4.0.3",
|
77
77
|
"uuid": "^8.3.2",
|
78
|
-
"web-vitals": "^3.4.0",
|
79
|
-
"web-vitals-reporter": "^1.0.0",
|
80
78
|
"xstate": "^4.13.0"
|
81
79
|
},
|
82
80
|
"devDependencies": {
|
package/types.d.ts
CHANGED
@@ -2059,7 +2059,7 @@ export type MutationLoginArgs = {
|
|
2059
2059
|
memberNumber?: Maybe<Scalars['String']>;
|
2060
2060
|
externalHashId?: Maybe<Scalars['String']>;
|
2061
2061
|
timeStamp?: Maybe<Scalars['String']>;
|
2062
|
-
|
2062
|
+
cartId?: Maybe<Scalars['String']>;
|
2063
2063
|
};
|
2064
2064
|
|
2065
2065
|
|
@@ -2278,6 +2278,7 @@ export type LoginExternalCustomerInput = {
|
|
2278
2278
|
export type LoginResponse = {
|
2279
2279
|
__typename?: 'LoginResponse';
|
2280
2280
|
token: Token;
|
2281
|
+
customerId?: Maybe<Scalars['Int']>;
|
2281
2282
|
};
|
2282
2283
|
|
2283
2284
|
export type RequestPasswordResetResult = {
|
package/analytics/webVitals.d.ts
DELETED
package/analytics/webVitals.js
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
import { onCLS, onLCP, onFID } from 'web-vitals';
|
2
|
-
import { createApiReporter, getDeviceInfo } from 'web-vitals-reporter';
|
3
|
-
import { routeList } from '../boot/addMissingConfig';
|
4
|
-
let globalPageType = undefined;
|
5
|
-
export function setPageType(type) {
|
6
|
-
if (!globalPageType) {
|
7
|
-
globalPageType = type;
|
8
|
-
}
|
9
|
-
}
|
10
|
-
export function webVitals({ shopId, apiUrl }) {
|
11
|
-
var _a;
|
12
|
-
// Init report callback with information about the browser.
|
13
|
-
const deviceInfo = getDeviceInfo();
|
14
|
-
Object.keys(routeList).forEach((route) => {
|
15
|
-
var _a;
|
16
|
-
if ((_a = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.url) === null || _a === void 0 ? void 0 : _a.includes(routeList[route])) {
|
17
|
-
globalPageType = route;
|
18
|
-
}
|
19
|
-
});
|
20
|
-
const sendToAnalytics = createApiReporter(`${apiUrl}/api/v1/webvitals`, {
|
21
|
-
initial: {
|
22
|
-
shopId: shopId,
|
23
|
-
appName: 'flight',
|
24
|
-
pageType: globalPageType,
|
25
|
-
userAgent: deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.userAgent,
|
26
|
-
memory: deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.memory,
|
27
|
-
cpus: deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.cpus,
|
28
|
-
connection: (_a = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.connection) === null || _a === void 0 ? void 0 : _a.effectiveType
|
29
|
-
},
|
30
|
-
beforeSend: () => {
|
31
|
-
return { pageType: globalPageType };
|
32
|
-
}
|
33
|
-
});
|
34
|
-
// Setup web-vitals
|
35
|
-
onLCP(sendToAnalytics);
|
36
|
-
onFID(sendToAnalytics);
|
37
|
-
onCLS(sendToAnalytics);
|
38
|
-
}
|
39
|
-
//# sourceMappingURL=webVitals.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"webVitals.js","sourceRoot":"","sources":["webVitals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,E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