@jetshop/core 6.2.7 → 6.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ import { useMutation, useQuery } from '@apollo/client';
14
14
  import useWarningInDev from '@jetshop/core/hooks/useWarningInDev';
15
15
  import productListQueries from '@jetshop/core/data/queries/ProductLists.gql';
16
16
  import productListMutations from '@jetshop/core/data/mutations/productListMutations.gql';
17
- import { emptyProductLists, productListMapToArray, PRODUCT_LISTS_KEY } from '.';
17
+ import { productListMapToArray, PRODUCT_LISTS_KEY } from '.';
18
18
  import useAuth from '../../components/AuthContext/useAuth';
19
19
  import { useThunkReducer } from '../useThunkReducer';
20
20
  import { createListAction, deleteListAction, loginAction, refreshAction } from './action-creators';
@@ -38,6 +38,7 @@ export class ProductListRequestId {
38
38
  }
39
39
  }
40
40
  export const ProductListProvider = function ProductListProvider(_a) {
41
+ var _b;
41
42
  var { queries, initialState = {} } = _a, rest = __rest(_a, ["queries", "initialState"]);
42
43
  // NOTE: Warn about missing queries, should be removed in next major release.
43
44
  useMissingQueryWarning('all', queries);
@@ -49,22 +50,20 @@ export const ProductListProvider = function ProductListProvider(_a) {
49
50
  const { data: serverList, client } = useQuery(allQuery, {
50
51
  skip: !loggedIn
51
52
  });
52
- const lists = serverList
53
- ? new Map(serverList.customerProductLists.map(
54
- // The default list (name === null) must have listId null
55
- (productList) => [
56
- productList.name === null ? null : productList.id,
57
- normalizeServerList(productList)
58
- ]))
59
- : emptyProductLists();
53
+ const lists = new Map((_b = serverList === null || serverList === void 0 ? void 0 : serverList.customerProductLists) === null || _b === void 0 ? void 0 : _b.map(
54
+ // The default list (name === null) must have listId null
55
+ (productList) => [
56
+ productList.name === null ? null : productList.id,
57
+ normalizeServerList(productList)
58
+ ]));
60
59
  const defaultInitialState = Object.assign({ loggedIn,
61
60
  lists,
62
61
  requestIdRef }, initialState);
63
62
  const [state, dispatch] = useThunkReducer(reducer, defaultInitialState, (initialState) => init(initialState));
64
63
  const usingLocalList = !state.loggedIn;
65
- usePersistLocalList({ lists: state.lists });
64
+ usePersistLocalList({ lists: state.lists, usingLocalList });
66
65
  // When localstorage updates, sync it to reducer state
67
- useLocalStorageListener({ refresh });
66
+ useLocalStorageListener({ refresh, usingLocalList });
68
67
  // loginMutation is a mutation to merge product lists
69
68
  const [loginMutation] = useMutation(queries.login);
70
69
  // To be used to fetch all lists of user after login
@@ -99,16 +98,23 @@ export const ProductListProvider = function ProductListProvider(_a) {
99
98
  return React.createElement(ProductListContext.Provider, Object.assign({ value: value }, rest));
100
99
  };
101
100
  /**
102
- * Persist local list to localStorage on every change
101
+ * Persist local list to localStorage on every change (when not logged in that is)
103
102
  */
104
- function usePersistLocalList({ lists }) {
103
+ function usePersistLocalList({ lists, usingLocalList }) {
105
104
  const productListArray = productListMapToArray(lists);
106
105
  useEffect(() => {
106
+ if (!usingLocalList) {
107
+ localStorage.removeItem(PRODUCT_LISTS_KEY);
108
+ return;
109
+ }
107
110
  localStorage.setItem(PRODUCT_LISTS_KEY, JSON.stringify(productListArray));
108
- }, [lists]);
111
+ }, [lists, productListArray, usingLocalList]);
109
112
  }
110
- function useLocalStorageListener({ refresh }) {
113
+ function useLocalStorageListener({ refresh, usingLocalList }) {
111
114
  useEffect(() => {
115
+ if (!usingLocalList) {
116
+ return;
117
+ }
112
118
  const listener = (e) => {
113
119
  if (e.storageArea === localStorage && e.key === PRODUCT_LISTS_KEY) {
114
120
  refresh();
@@ -118,6 +124,6 @@ function useLocalStorageListener({ refresh }) {
118
124
  return () => {
119
125
  window.removeEventListener('storage', listener);
120
126
  };
121
- }, []);
127
+ }, [refresh, usingLocalList]);
122
128
  }
123
129
  //# sourceMappingURL=ProductListContext.js.map
@@ -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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CAAC,CAAC;AAChC,CAAC"}
@@ -87,29 +87,23 @@ export function reducer(state, action) {
87
87
  }
88
88
  }
89
89
  export function init(initialState) {
90
- if (typeof window === 'undefined')
90
+ if (initialState.loggedIn) {
91
+ return initialState;
92
+ }
93
+ if (typeof window === 'undefined') {
91
94
  return initialState;
92
- /**
93
- * Migrate any legacy product list to the new format
94
- *
95
- * TODO Remove this code in next major release!
96
- */
97
- const LEGACY_LIST_KEY = 'productList';
98
- const legacyListData = JSON.parse(window.localStorage.getItem(LEGACY_LIST_KEY));
99
- if (legacyListData) {
100
- const defaultList = initialState.lists.get(null);
101
- Object.assign(defaultList.items, legacyListData);
102
- window.localStorage.removeItem(LEGACY_LIST_KEY);
103
- return {
104
- lists: initialState.lists,
105
- loggedIn: initialState.loggedIn,
106
- requestIdRef: initialState.requestIdRef
107
- };
108
95
  }
109
96
  const localStorageProductLists = JSON.parse(window.localStorage.getItem(PRODUCT_LISTS_KEY));
110
- const lists = (localStorageProductLists &&
111
- productListArrayToMap(localStorageProductLists)) ||
112
- initialState.lists;
97
+ let lists;
98
+ if (localStorageProductLists) {
99
+ lists = productListArrayToMap(localStorageProductLists);
100
+ }
101
+ else if (initialState.lists.size > 0) {
102
+ lists = initialState.lists;
103
+ }
104
+ else {
105
+ lists = emptyProductLists();
106
+ }
113
107
  const updatedState = {
114
108
  lists,
115
109
  loggedIn: initialState.loggedIn,
@@ -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,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;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AC;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"}
@@ -16,6 +16,7 @@ listId = null, options = {}) {
16
16
  // Make a `products` query containing every item in the list
17
17
  const productQueryResult = useQuery(queries.productsQuery, {
18
18
  skip: flattenedList.length === 0,
19
+ ssr: false,
19
20
  errorPolicy: 'all',
20
21
  variables: {
21
22
  articleNumbers: flattenedList
@@ -1 +1 @@
1
- {"version":3,"file":"useProductListItems.js","sourceRoot":"","sources":["useProductListItems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EACL,WAAW,EACX,uCAAuC,EACxC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,mBAAmB;AACjC,iEAAiE;AACjE,SAAwB,IAAI,EAC5B,UAGI,EAAE;IAEN,MAAM,EACJ,KAAK,EAAE,EAAE,KAAK,EAAE,EAChB,OAAO,EACP,QAAQ,EACR,cAAc,EACf,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEnC,MAAM,IAA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