@jetshop/core 5.10.0 → 5.11.0
Sign up to get free protection for your applications and to get access to all the features.
- package/ChannelHandler/ChannelHandler.d.ts +9 -13
- package/ChannelHandler/ChannelHandler.js +16 -63
- package/ChannelHandler/ChannelHandler.js.map +1 -1
- package/ChannelHandler/channelUtils.d.ts +13 -0
- package/ChannelHandler/channelUtils.js +26 -15
- package/ChannelHandler/channelUtils.js.map +1 -1
- package/ChannelHandler/redirectUtils.d.ts +3 -0
- package/ChannelHandler/redirectUtils.js +48 -0
- package/ChannelHandler/redirectUtils.js.map +1 -0
- package/ChannelHandler/redirectUtils.test.js +8 -0
- package/analytics/AnalyticsProvider.js +1 -1
- package/analytics/AnalyticsProvider.js.map +1 -1
- package/boot/SharedTree.js +1 -1
- package/boot/SharedTree.js.map +1 -1
- package/boot/apollo.d.ts +5 -3
- package/boot/apollo.js +9 -13
- package/boot/apollo.js.map +1 -1
- package/boot/client/startClient.js +5 -10
- package/boot/client/startClient.js.map +1 -1
- package/boot/server/createRenderer.js +8 -7
- package/boot/server/createRenderer.js.map +1 -1
- package/boot/server/index.js +2 -2
- package/boot/server/index.js.map +1 -1
- package/boot/server/persistedQueries/__tests__/getPersistedQueriesForRequest.test.js +53 -39
- package/boot/server/persistedQueries/getPersistedQueriesForRequest.js +2 -2
- package/boot/server/persistedQueries/getPersistedQueriesForRequest.js.map +1 -1
- package/components/Auth/CustomerUpdateForm.js +7 -7
- package/components/Auth/CustomerUpdateForm.js.map +1 -1
- package/components/ChannelContext/ChannelProvider.d.ts +1 -3
- package/components/ChannelContext/ChannelProvider.js +6 -13
- package/components/ChannelContext/ChannelProvider.js.map +1 -1
- package/components/ChannelContext/ChannelProvider.test.js +110 -0
- package/components/Mutation/cartMutationUtils.js +7 -6
- package/components/Mutation/cartMutationUtils.js.map +1 -1
- package/components/Query/CartProvider.js +31 -21
- package/components/Query/CartProvider.js.map +1 -1
- package/components/StructuredData/StructuredBreadcrumbData.js +4 -3
- package/components/StructuredData/StructuredBreadcrumbData.js.map +1 -1
- package/hooks/ProductList/ProductListContext.js +37 -14
- package/hooks/ProductList/ProductListContext.js.map +1 -1
- package/hooks/ProductList/action-creators.d.ts +20 -7
- package/hooks/ProductList/action-creators.js +125 -31
- package/hooks/ProductList/action-creators.js.map +1 -1
- package/hooks/ProductList/index.d.ts +34 -8
- package/hooks/ProductList/index.js +19 -0
- package/hooks/ProductList/index.js.map +1 -1
- package/hooks/ProductList/list-transforms.d.ts +2 -2
- package/hooks/ProductList/list-transforms.js +22 -22
- package/hooks/ProductList/list-transforms.js.map +1 -1
- package/hooks/ProductList/list-transforms.test.js +103 -100
- package/hooks/ProductList/product-list-reducer.d.ts +37 -14
- package/hooks/ProductList/product-list-reducer.js +106 -43
- package/hooks/ProductList/product-list-reducer.js.map +1 -1
- package/hooks/ProductList/product-list-reducer.test.js +144 -82
- package/hooks/ProductList/useProductList.d.ts +2 -2
- package/hooks/ProductList/useProductList.js +12 -5
- package/hooks/ProductList/useProductList.js.map +1 -1
- package/hooks/ProductList/useProductListItems.d.ts +1 -1
- package/hooks/ProductList/useProductListItems.js +8 -6
- package/hooks/ProductList/useProductListItems.js.map +1 -1
- package/package.json +1 -1
- package/resolvers/index.d.ts +3 -0
- package/resolvers/index.js +3 -0
- package/resolvers/index.js.map +1 -1
- package/sentry/client.js +1 -1
- package/sentry/client.js.map +1 -1
- package/time.d.ts +1 -0
- package/time.js +6 -0
- package/time.js.map +1 -0
@@ -1,14 +1,18 @@
|
|
1
|
+
import { PRODUCT_LISTS_KEY, productListArrayToMap } from '.';
|
1
2
|
import { flattenList, normalizeServerList } from './list-transforms';
|
2
3
|
import uniqueId from '../../helpers/uniqueId';
|
3
|
-
export function loginAction({ loginMutation }) {
|
4
|
+
export function loginAction({ loginMutation, fetchAll }) {
|
4
5
|
return (dispatch, getState) => {
|
5
6
|
const state = getState();
|
7
|
+
// Merge what is in the default list onto the default list on the server
|
8
|
+
// for this user.
|
9
|
+
const list = state.lists.get(null);
|
6
10
|
loginMutation({
|
7
11
|
fetchPolicy: 'no-cache',
|
8
12
|
context: { useApolloNetworkStatus: false },
|
9
13
|
variables: {
|
10
14
|
id: null,
|
11
|
-
items: flattenList(
|
15
|
+
items: flattenList(list).map((listItem) => ({
|
12
16
|
articleNumber: listItem.articleNumber,
|
13
17
|
quantity: listItem.options.quantity,
|
14
18
|
description: listItem.options.description
|
@@ -16,8 +20,32 @@ export function loginAction({ loginMutation }) {
|
|
16
20
|
}
|
17
21
|
})
|
18
22
|
.then((response) => {
|
19
|
-
const list = normalizeServerList(response.data.addToCustomerProductList);
|
20
|
-
dispatch({
|
23
|
+
const list = normalizeServerList(response.data.addToCustomerProductList.customerProductList);
|
24
|
+
dispatch({
|
25
|
+
type: 'LOGIN',
|
26
|
+
payload: {
|
27
|
+
listId: null,
|
28
|
+
list
|
29
|
+
}
|
30
|
+
});
|
31
|
+
// Also fetch any other list that this user might have and update the state.
|
32
|
+
return fetchAll().then((response) => {
|
33
|
+
response.data.customerProductLists.forEach((serverList) => {
|
34
|
+
if (serverList.name === null) {
|
35
|
+
// The null (default) list has already been fetched and added as listId null
|
36
|
+
// so ignore it here.
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
const list = normalizeServerList(serverList);
|
40
|
+
dispatch({
|
41
|
+
type: 'REPLACE',
|
42
|
+
payload: {
|
43
|
+
listId: serverList.id,
|
44
|
+
list
|
45
|
+
}
|
46
|
+
});
|
47
|
+
});
|
48
|
+
});
|
21
49
|
})
|
22
50
|
.catch((err) => {
|
23
51
|
console.error('Lists could not be merged', err);
|
@@ -26,18 +54,65 @@ export function loginAction({ loginMutation }) {
|
|
26
54
|
}
|
27
55
|
export function refreshAction() {
|
28
56
|
return (dispatch) => {
|
29
|
-
|
30
|
-
|
31
|
-
|
57
|
+
const lists = JSON.parse(localStorage.getItem(PRODUCT_LISTS_KEY));
|
58
|
+
if (lists) {
|
59
|
+
dispatch({
|
60
|
+
type: 'SET_LISTS',
|
61
|
+
payload: {
|
62
|
+
lists: productListArrayToMap(lists)
|
63
|
+
}
|
64
|
+
});
|
65
|
+
}
|
66
|
+
};
|
67
|
+
}
|
68
|
+
export function createListAction({ createMutation, name }) {
|
69
|
+
const variables = {
|
70
|
+
input: {
|
71
|
+
name
|
72
|
+
}
|
73
|
+
};
|
74
|
+
return (dispatch) => {
|
75
|
+
createMutation({ variables }).then((response) => {
|
76
|
+
const serverList = response.data.createCustomerProductList.customerProductList;
|
77
|
+
const listId = serverList.id;
|
78
|
+
if (response.data.createCustomerProductList.success) {
|
79
|
+
dispatch({
|
80
|
+
type: 'CREATE_LIST',
|
81
|
+
payload: { listId, list: normalizeServerList(serverList) }
|
82
|
+
});
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
console.warn(`Could not create list`);
|
86
|
+
}
|
32
87
|
});
|
33
88
|
};
|
34
89
|
}
|
35
|
-
export function
|
90
|
+
export function deleteListAction({ listId, deleteListMutation }) {
|
91
|
+
const variables = {
|
92
|
+
id: listId
|
93
|
+
};
|
94
|
+
return (dispatch) => {
|
95
|
+
deleteListMutation({ variables }).then((response) => {
|
96
|
+
const success = response.data.deleteCustomerProductList.success;
|
97
|
+
if (success) {
|
98
|
+
dispatch({
|
99
|
+
type: 'DELETE_LIST',
|
100
|
+
payload: { listId }
|
101
|
+
});
|
102
|
+
}
|
103
|
+
else {
|
104
|
+
console.warn(`Could not delete product list with id ${listId}`);
|
105
|
+
}
|
106
|
+
});
|
107
|
+
};
|
108
|
+
}
|
109
|
+
export function updateAction({ listId, updateAPI = false, removeMutation, addMutation, options, articleNumber, variantToReplace, variantArticleNumber }) {
|
36
110
|
return (dispatch, getState) => {
|
37
111
|
const { description, quantity } = options;
|
38
112
|
dispatch({
|
39
113
|
type: 'UPDATE',
|
40
114
|
payload: {
|
115
|
+
listId,
|
41
116
|
articleNumber,
|
42
117
|
options,
|
43
118
|
variantArticleNumber,
|
@@ -56,7 +131,7 @@ export function updateAction({ updateAPI = false, removeMutation, addMutation, o
|
|
56
131
|
fetchPolicy: 'no-cache',
|
57
132
|
context: { useApolloNetworkStatus: false },
|
58
133
|
variables: {
|
59
|
-
id:
|
134
|
+
id: listId,
|
60
135
|
articleNumbers: [variantToReplace || articleNumber]
|
61
136
|
}
|
62
137
|
})
|
@@ -65,7 +140,7 @@ export function updateAction({ updateAPI = false, removeMutation, addMutation, o
|
|
65
140
|
fetchPolicy: 'no-cache',
|
66
141
|
context: { useApolloNetworkStatus: false },
|
67
142
|
variables: {
|
68
|
-
id:
|
143
|
+
id: listId,
|
69
144
|
items: [
|
70
145
|
{
|
71
146
|
articleNumber: variantArticleNumber || articleNumber,
|
@@ -76,20 +151,24 @@ export function updateAction({ updateAPI = false, removeMutation, addMutation, o
|
|
76
151
|
}
|
77
152
|
}).then((response) => {
|
78
153
|
requestId === previousState.requestIdRef.current &&
|
79
|
-
syncListFromServer(dispatch, response.data.addToCustomerProductList);
|
154
|
+
syncListFromServer(dispatch, listId, response.data.addToCustomerProductList);
|
80
155
|
});
|
81
156
|
})
|
82
157
|
.catch((err) => {
|
83
|
-
rollbackList(dispatch, previousState.list);
|
84
158
|
console.error('List could not be updated', err);
|
159
|
+
const previousList = previousState.lists.get(listId);
|
160
|
+
if (previousList) {
|
161
|
+
rollbackList(dispatch, listId, previousList);
|
162
|
+
}
|
85
163
|
});
|
86
164
|
};
|
87
165
|
}
|
88
|
-
export function removeAction({ updateAPI = false, articleNumber, variantArticleNumber, removeMutation }) {
|
166
|
+
export function removeAction({ listId, updateAPI = false, articleNumber, variantArticleNumber, removeMutation }) {
|
89
167
|
return (dispatch, getState) => {
|
90
168
|
dispatch({
|
91
169
|
type: 'REMOVE',
|
92
170
|
payload: {
|
171
|
+
listId,
|
93
172
|
articleNumber,
|
94
173
|
variantArticleNumber
|
95
174
|
}
|
@@ -105,50 +184,58 @@ export function removeAction({ updateAPI = false, articleNumber, variantArticleN
|
|
105
184
|
context: { useApolloNetworkStatus: false },
|
106
185
|
variables: {
|
107
186
|
articleNumbers: [variantArticleNumber || articleNumber],
|
108
|
-
id:
|
187
|
+
id: listId
|
109
188
|
}
|
110
189
|
})
|
111
190
|
.then((response) => {
|
112
191
|
requestId === previousState.requestIdRef.current &&
|
113
|
-
syncListFromServer(dispatch, response.data.removeFromCustomerProductList);
|
192
|
+
syncListFromServer(dispatch, listId, response.data.removeFromCustomerProductList);
|
114
193
|
})
|
115
194
|
.catch((err) => {
|
116
195
|
console.error('Product could not be removed from list', err);
|
117
|
-
|
196
|
+
const previousList = previousState.lists.get(listId);
|
197
|
+
if (previousList) {
|
198
|
+
rollbackList(dispatch, listId, previousList);
|
199
|
+
}
|
118
200
|
});
|
119
201
|
};
|
120
202
|
}
|
121
|
-
export function clearAction({ updateAPI = false, removeMutation }) {
|
203
|
+
export function clearAction({ listId, updateAPI = false, removeMutation }) {
|
122
204
|
return (dispatch, getState) => {
|
123
|
-
dispatch({
|
205
|
+
dispatch({
|
206
|
+
type: 'CLEAR_ITEMS',
|
207
|
+
payload: { listId }
|
208
|
+
});
|
124
209
|
if (!updateAPI)
|
125
210
|
return;
|
126
211
|
const [remove] = removeMutation;
|
127
212
|
const state = getState();
|
128
|
-
const
|
213
|
+
const list = state.lists.get(listId);
|
214
|
+
const articleNumbers = flattenList(list).map((listItem) => listItem.articleNumber);
|
129
215
|
const requestId = scopedUniqueID();
|
130
216
|
state.requestIdRef.current = requestId;
|
131
217
|
remove({
|
132
218
|
fetchPolicy: 'no-cache',
|
133
219
|
context: { useApolloNetworkStatus: false },
|
134
|
-
variables: { articleNumbers, id:
|
220
|
+
variables: { articleNumbers, id: listId }
|
135
221
|
})
|
136
222
|
.then((response) => {
|
137
223
|
requestId === state.requestIdRef.current &&
|
138
|
-
syncListFromServer(dispatch, response.data.removeFromCustomerProductList);
|
224
|
+
syncListFromServer(dispatch, listId, response.data.removeFromCustomerProductList);
|
139
225
|
})
|
140
226
|
.catch((err) => {
|
141
227
|
console.error('List could not be cleared', err);
|
142
|
-
rollbackList(dispatch,
|
228
|
+
rollbackList(dispatch, listId, list);
|
143
229
|
});
|
144
230
|
};
|
145
231
|
}
|
146
|
-
export function addAction({ articleNumber, variantArticleNumber, addMutation, options, updateAPI = false }) {
|
232
|
+
export function addAction({ listId, articleNumber, variantArticleNumber, addMutation, options, updateAPI = false }) {
|
147
233
|
return (dispatch, getState) => {
|
148
234
|
const { quantity, description } = options;
|
149
235
|
dispatch({
|
150
236
|
type: 'ADD',
|
151
237
|
payload: {
|
238
|
+
listId,
|
152
239
|
articleNumber,
|
153
240
|
variantArticleNumber,
|
154
241
|
options: { quantity, description }
|
@@ -164,7 +251,8 @@ export function addAction({ articleNumber, variantArticleNumber, addMutation, op
|
|
164
251
|
fetchPolicy: 'no-cache',
|
165
252
|
context: { useApolloNetworkStatus: false },
|
166
253
|
variables: {
|
167
|
-
id: null,
|
254
|
+
//id: null, XXX
|
255
|
+
id: listId,
|
168
256
|
items: [
|
169
257
|
{
|
170
258
|
articleNumber: variantArticleNumber || articleNumber,
|
@@ -176,28 +264,34 @@ export function addAction({ articleNumber, variantArticleNumber, addMutation, op
|
|
176
264
|
})
|
177
265
|
.then(({ data: { addToCustomerProductList } }) => {
|
178
266
|
requestId === previousState.requestIdRef.current &&
|
179
|
-
syncListFromServer(dispatch, addToCustomerProductList);
|
267
|
+
syncListFromServer(dispatch, listId, addToCustomerProductList);
|
180
268
|
})
|
181
269
|
.catch((err) => {
|
182
270
|
console.error('Product could not be added to list', err);
|
183
|
-
rollbackList(dispatch, previousState.
|
271
|
+
rollbackList(dispatch, listId, previousState.lists.get(listId));
|
184
272
|
});
|
185
273
|
};
|
186
274
|
}
|
187
275
|
function scopedUniqueID() {
|
188
276
|
return uniqueId('_product_list_');
|
189
277
|
}
|
190
|
-
function syncListFromServer(dispatch, productList) {
|
191
|
-
const
|
278
|
+
function syncListFromServer(dispatch, listId, productList) {
|
279
|
+
const list = normalizeServerList(productList.customerProductList);
|
192
280
|
dispatch({
|
193
281
|
type: 'REPLACE',
|
194
|
-
payload:
|
282
|
+
payload: {
|
283
|
+
listId,
|
284
|
+
list
|
285
|
+
}
|
195
286
|
});
|
196
287
|
}
|
197
|
-
function rollbackList(dispatch, productList) {
|
288
|
+
function rollbackList(dispatch, listId, productList) {
|
198
289
|
dispatch({
|
199
290
|
type: 'REPLACE',
|
200
|
-
payload:
|
291
|
+
payload: {
|
292
|
+
listId,
|
293
|
+
list: productList
|
294
|
+
}
|
201
295
|
});
|
202
296
|
}
|
203
297
|
//# sourceMappingURL=action-creators.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"action-creators.js","sourceRoot":"","sources":["action-creators.ts"],"names":[],"mappings":"
|
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;AAErE,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAE9C,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;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S;QACf,OAAO,EAAE;YACP,MAAM;YACN,IAAI,EAAE,WAAW;SAClB;KACF,CAAC,CAAC;AACL,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { DocumentNode } from 'graphql';
|
3
3
|
import { MutationTuple, QueryResult } from 'react-apollo';
|
4
|
-
import { CustomerProductListResult, MutationAddToCustomerProductListArgs, MutationRemoveFromCustomerProductListArgs, MutationUpdateCustomerProductListItemArgs, Product, ProductVariant, QueryCustomerProductListArgs, QueryProductsArgs } from '../../types';
|
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
7
|
export { useProductList } from './useProductList';
|
@@ -17,16 +17,42 @@ export interface ProductListContextOptions {
|
|
17
17
|
usingLocalList: boolean;
|
18
18
|
queries: ProductListQueries;
|
19
19
|
}
|
20
|
+
/**
|
21
|
+
* A Product list mapping is a mapping between an ID and a product list
|
22
|
+
*
|
23
|
+
* As a convenienve, an ID of null is used for the "default" product list.
|
24
|
+
*/
|
25
|
+
export declare type ProductListId = string | null;
|
26
|
+
export declare type ProductListMap = Map<ProductListId, NormalizedProductList>;
|
27
|
+
export interface NormalizedProductList {
|
28
|
+
name: string | null;
|
29
|
+
items: {
|
30
|
+
[articleNumber: string]: {
|
31
|
+
options: ProductListItemOptions;
|
32
|
+
variants: ProductListItemVariants | null;
|
33
|
+
};
|
34
|
+
};
|
35
|
+
}
|
36
|
+
export declare const PRODUCT_LISTS_KEY = "productLists";
|
37
|
+
export declare function emptyProductLists(): ProductListMap;
|
38
|
+
export declare function productListMapToArray(map: ProductListMap): [string, NormalizedProductList][];
|
39
|
+
export declare function productListArrayToMap(array: [ProductListId, NormalizedProductList][]): Map<string, NormalizedProductList>;
|
20
40
|
export interface ProductListState {
|
21
41
|
loggedIn: boolean;
|
22
|
-
|
42
|
+
lists: ProductListMap;
|
23
43
|
requestIdRef: React.MutableRefObject<string | null>;
|
24
44
|
}
|
25
45
|
export interface ProductListQueries {
|
26
46
|
/** Products query, used for retrieving products from localList */
|
27
47
|
productsQuery: DocumentNode;
|
48
|
+
/** The customerProductLists query */
|
49
|
+
all: DocumentNode;
|
28
50
|
/** The customerProductList query */
|
29
51
|
query: DocumentNode;
|
52
|
+
/** The createCustomerProductList mutation */
|
53
|
+
createList: DocumentNode;
|
54
|
+
/** The deleteCustomerProductList mutation */
|
55
|
+
deleteList: DocumentNode;
|
30
56
|
/** The addToCustomerProductList mutation */
|
31
57
|
add: DocumentNode;
|
32
58
|
/** An addToCustomerProductList mutation that returns the full list */
|
@@ -45,12 +71,6 @@ export interface ProductListDetail {
|
|
45
71
|
/** An array containing the product data */
|
46
72
|
products: ProductListProduct[];
|
47
73
|
}
|
48
|
-
export interface NormalizedProductList {
|
49
|
-
[articleNumber: string]: {
|
50
|
-
options: ProductListItemOptions;
|
51
|
-
variants: ProductListItemVariants | null;
|
52
|
-
};
|
53
|
-
}
|
54
74
|
export interface FlattenedProductListItem {
|
55
75
|
articleNumber: string;
|
56
76
|
parentArticleNumber?: string;
|
@@ -80,12 +100,18 @@ export declare type ProductListProductValidation = {
|
|
80
100
|
export declare type AddToListMutation = MutationTuple<{
|
81
101
|
addToCustomerProductList: CustomerProductListResult;
|
82
102
|
}, MutationAddToCustomerProductListArgs>;
|
103
|
+
export declare type CreateListMutation = MutationTuple<{
|
104
|
+
createCustomerProductList: CustomerProductListResult;
|
105
|
+
}, MutationCreateCustomerProductListArgs>;
|
83
106
|
export declare type RemoveFromListMutation = MutationTuple<{
|
84
107
|
removeFromCustomerProductList: CustomerProductListResult;
|
85
108
|
}, MutationRemoveFromCustomerProductListArgs>;
|
86
109
|
export declare type UpdateListItemMutation = MutationTuple<{
|
87
110
|
updateCustomerProductListItem: CustomerProductListResult;
|
88
111
|
}, MutationUpdateCustomerProductListItemArgs>;
|
112
|
+
export declare type ListsProductsQuery = QueryResult<{
|
113
|
+
customerProductLists: CustomerProductListResult[];
|
114
|
+
}>;
|
89
115
|
export declare type ListProductsQuery = QueryResult<CustomerProductListResult, QueryCustomerProductListArgs>;
|
90
116
|
export declare type ProductsQuery = QueryResult<{
|
91
117
|
products: Product[];
|
@@ -1,3 +1,22 @@
|
|
1
1
|
export { useProductList } from './useProductList';
|
2
2
|
export { useProductListItems } from './useProductListItems';
|
3
|
+
export const PRODUCT_LISTS_KEY = 'productLists';
|
4
|
+
export function emptyProductLists() {
|
5
|
+
return new Map([
|
6
|
+
[
|
7
|
+
null,
|
8
|
+
{
|
9
|
+
items: {},
|
10
|
+
name: null
|
11
|
+
}
|
12
|
+
]
|
13
|
+
]);
|
14
|
+
}
|
15
|
+
export function productListMapToArray(map) {
|
16
|
+
const [...array] = map;
|
17
|
+
return array;
|
18
|
+
}
|
19
|
+
export function productListArrayToMap(array) {
|
20
|
+
return new Map(array);
|
21
|
+
}
|
3
22
|
//# sourceMappingURL=index.js.map
|
@@ -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":"AAgBA,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,12 +1,12 @@
|
|
1
1
|
import { FlattenedProductListItem, NormalizedProductList, ProductsQuery } from '.';
|
2
|
-
import {
|
2
|
+
import { CustomerProductList, Product } from '../../types';
|
3
3
|
/**
|
4
4
|
* Converts a product list returned from the API to our normalized structure
|
5
5
|
* When a base product is selected, it will have a value for `options`.
|
6
6
|
* When it has variants, it will have one or more keys for `variants`
|
7
7
|
* Either variants or options may be null, but not both.
|
8
8
|
*/
|
9
|
-
export declare function normalizeServerList(
|
9
|
+
export declare function normalizeServerList(productList: CustomerProductList): NormalizedProductList;
|
10
10
|
/**
|
11
11
|
* Takes a flattened product list and result of a products query and returns
|
12
12
|
* product details for each item in the flattened list. */
|
@@ -6,39 +6,39 @@ import { validateProduct } from './validate-product';
|
|
6
6
|
* When it has variants, it will have one or more keys for `variants`
|
7
7
|
* Either variants or options may be null, but not both.
|
8
8
|
*/
|
9
|
-
export function normalizeServerList(
|
9
|
+
export function normalizeServerList(productList) {
|
10
10
|
var _a, _b, _c, _d, _e;
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
const items = productList.items;
|
12
|
+
const newList = {
|
13
|
+
name: productList.name,
|
14
|
+
items: {}
|
15
|
+
};
|
16
16
|
for (const item of items) {
|
17
17
|
// skip if product is hidden
|
18
18
|
if (!((_a = item === null || item === void 0 ? void 0 : item.product) === null || _a === void 0 ? void 0 : _a.articleNumber)) {
|
19
19
|
continue;
|
20
20
|
}
|
21
21
|
if (item.variant) {
|
22
|
-
newList[item.product.articleNumber] = {
|
23
|
-
options: ((_b = newList[item.product.articleNumber]) === null || _b === void 0 ? void 0 : _b.options) || null,
|
24
|
-
variants: produce(((_c = newList[item.product.articleNumber]) === null || _c === void 0 ? void 0 : _c.variants) || {}, (draft) => {
|
22
|
+
newList.items[item.product.articleNumber] = {
|
23
|
+
options: ((_b = newList.items[item.product.articleNumber]) === null || _b === void 0 ? void 0 : _b.options) || null,
|
24
|
+
variants: produce(((_c = newList.items[item.product.articleNumber]) === null || _c === void 0 ? void 0 : _c.variants) || {}, (draft) => {
|
25
25
|
draft[item.variant.articleNumber] = {
|
26
26
|
options: {
|
27
27
|
quantity: item.quantity || 1,
|
28
|
-
description: item.description
|
28
|
+
description: item.description
|
29
29
|
},
|
30
|
-
parentArticleNumber: item.product.articleNumber
|
30
|
+
parentArticleNumber: item.product.articleNumber
|
31
31
|
};
|
32
|
-
})
|
32
|
+
})
|
33
33
|
};
|
34
34
|
}
|
35
35
|
else {
|
36
|
-
newList[item.product.articleNumber] = {
|
37
|
-
variants: ((_d = newList[item.product.articleNumber]) === null || _d === void 0 ? void 0 : _d.variants) || null,
|
36
|
+
newList.items[item.product.articleNumber] = {
|
37
|
+
variants: ((_d = newList.items[item.product.articleNumber]) === null || _d === void 0 ? void 0 : _d.variants) || null,
|
38
38
|
options: {
|
39
39
|
quantity: (_e = item.quantity) !== null && _e !== void 0 ? _e : 1,
|
40
|
-
description: item.description
|
41
|
-
}
|
40
|
+
description: item.description
|
41
|
+
}
|
42
42
|
};
|
43
43
|
}
|
44
44
|
}
|
@@ -76,29 +76,29 @@ export function getVariantFromProductDetails(variant, product) {
|
|
76
76
|
}
|
77
77
|
export function flattenList(list) {
|
78
78
|
const flattenedList = [];
|
79
|
-
const baseProducts = list ? Object.keys(list) : [];
|
79
|
+
const baseProducts = list ? Object.keys(list.items) : [];
|
80
80
|
for (const baseArticleNumber of baseProducts) {
|
81
|
-
const variants = list[baseArticleNumber].variants;
|
81
|
+
const variants = list.items[baseArticleNumber].variants;
|
82
82
|
if (variants) {
|
83
83
|
const variantArticleNumbers = Object.keys(variants);
|
84
84
|
for (const articleNumber of variantArticleNumbers) {
|
85
85
|
flattenedList.push({
|
86
86
|
articleNumber,
|
87
87
|
parentArticleNumber: baseArticleNumber,
|
88
|
-
options: variants[articleNumber].options
|
88
|
+
options: variants[articleNumber].options
|
89
89
|
});
|
90
90
|
}
|
91
|
-
if (list[baseArticleNumber].options) {
|
91
|
+
if (list.items[baseArticleNumber].options) {
|
92
92
|
flattenedList.push({
|
93
93
|
articleNumber: baseArticleNumber,
|
94
|
-
options: list[baseArticleNumber].options
|
94
|
+
options: list.items[baseArticleNumber].options
|
95
95
|
});
|
96
96
|
}
|
97
97
|
}
|
98
98
|
else {
|
99
99
|
flattenedList.push({
|
100
100
|
articleNumber: baseArticleNumber,
|
101
|
-
options: list[baseArticleNumber].options
|
101
|
+
options: list.items[baseArticleNumber].options
|
102
102
|
});
|
103
103
|
}
|
104
104
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"list-transforms.js","sourceRoot":"","sources":["list-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"list-transforms.js","sourceRoot":"","sources":["list-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,OAAO,CAAC;AAW5B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAAgC;;IAEhC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;IAEhC,MAAM,OAAO,GAA0B;QACrC,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,KAAK,EAAE,EAAE;KACV,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,4BAA4B;QAC5B,IAAI,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,aAAa,CAAA,EAAE;YACjC,SAAS;SACV;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,CAAC,KAAK,CAAC,IAAI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