@shopgate/webpack 7.30.4-beta.1 → 7.31.0-alpha.2

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.
@@ -4,10 +4,10 @@ exports[`components/ProductCharacteristics should render 1`] = `
4
4
  <Component
5
5
  render={
6
6
  [MockFunction] {
7
- "calls": Array [
8
- Array [
9
- Object {
10
- "charRef": Object {
7
+ "calls": [
8
+ [
9
+ {
10
+ "charRef": {
11
11
  "current": null,
12
12
  },
13
13
  "disabled": false,
@@ -15,25 +15,29 @@ exports[`components/ProductCharacteristics should render 1`] = `
15
15
  "id": "1",
16
16
  "key": "1",
17
17
  "label": "Color",
18
+ "resetHighlight": [Function],
18
19
  "select": [Function],
19
20
  "selected": null,
20
- "values": Array [
21
- Object {
21
+ "swatch": false,
22
+ "values": [
23
+ {
22
24
  "id": "1",
23
25
  "label": "BLACK-WHITE (9000)",
24
26
  "selectable": true,
27
+ "selected": false,
25
28
  },
26
- Object {
29
+ {
27
30
  "id": "2",
28
31
  "label": "RED-WHITE (1000)",
29
32
  "selectable": true,
33
+ "selected": false,
30
34
  },
31
35
  ],
32
36
  },
33
37
  ],
34
- Array [
35
- Object {
36
- "charRef": Object {
38
+ [
39
+ {
40
+ "charRef": {
37
41
  "current": null,
38
42
  },
39
43
  "disabled": true,
@@ -41,24 +45,37 @@ exports[`components/ProductCharacteristics should render 1`] = `
41
45
  "id": "2",
42
46
  "key": "2",
43
47
  "label": "Size",
48
+ "resetHighlight": [Function],
44
49
  "select": [Function],
45
50
  "selected": null,
46
- "values": Array [
47
- Object {
51
+ "swatch": false,
52
+ "values": [
53
+ {
48
54
  "id": "11",
49
55
  "label": "7",
50
- "selectable": true,
56
+ "selectable": false,
57
+ "selected": false,
51
58
  },
52
- Object {
59
+ {
53
60
  "id": "12",
54
61
  "label": "7.5",
55
- "selectable": true,
62
+ "selectable": false,
63
+ "selected": false,
56
64
  },
57
65
  ],
58
66
  },
59
67
  ],
60
68
  ],
61
- "results": undefined,
69
+ "results": [
70
+ {
71
+ "type": "return",
72
+ "value": undefined,
73
+ },
74
+ {
75
+ "type": "return",
76
+ "value": undefined,
77
+ },
78
+ ],
62
79
  }
63
80
  }
64
81
  >
@@ -66,10 +83,10 @@ exports[`components/ProductCharacteristics should render 1`] = `
66
83
  WrappedComponent={[Function]}
67
84
  render={
68
85
  [MockFunction] {
69
- "calls": Array [
70
- Array [
71
- Object {
72
- "charRef": Object {
86
+ "calls": [
87
+ [
88
+ {
89
+ "charRef": {
73
90
  "current": null,
74
91
  },
75
92
  "disabled": false,
@@ -77,25 +94,29 @@ exports[`components/ProductCharacteristics should render 1`] = `
77
94
  "id": "1",
78
95
  "key": "1",
79
96
  "label": "Color",
97
+ "resetHighlight": [Function],
80
98
  "select": [Function],
81
99
  "selected": null,
82
- "values": Array [
83
- Object {
100
+ "swatch": false,
101
+ "values": [
102
+ {
84
103
  "id": "1",
85
104
  "label": "BLACK-WHITE (9000)",
86
105
  "selectable": true,
106
+ "selected": false,
87
107
  },
88
- Object {
108
+ {
89
109
  "id": "2",
90
110
  "label": "RED-WHITE (1000)",
91
111
  "selectable": true,
112
+ "selected": false,
92
113
  },
93
114
  ],
94
115
  },
95
116
  ],
96
- Array [
97
- Object {
98
- "charRef": Object {
117
+ [
118
+ {
119
+ "charRef": {
99
120
  "current": null,
100
121
  },
101
122
  "disabled": true,
@@ -103,72 +124,119 @@ exports[`components/ProductCharacteristics should render 1`] = `
103
124
  "id": "2",
104
125
  "key": "2",
105
126
  "label": "Size",
127
+ "resetHighlight": [Function],
106
128
  "select": [Function],
107
129
  "selected": null,
108
- "values": Array [
109
- Object {
130
+ "swatch": false,
131
+ "values": [
132
+ {
110
133
  "id": "11",
111
134
  "label": "7",
112
- "selectable": true,
135
+ "selectable": false,
136
+ "selected": false,
113
137
  },
114
- Object {
138
+ {
115
139
  "id": "12",
116
140
  "label": "7.5",
117
- "selectable": true,
141
+ "selectable": false,
142
+ "selected": false,
118
143
  },
119
144
  ],
120
145
  },
121
146
  ],
122
147
  ],
123
- "results": undefined,
148
+ "results": [
149
+ {
150
+ "type": "return",
151
+ "value": undefined,
152
+ },
153
+ {
154
+ "type": "return",
155
+ "value": undefined,
156
+ },
157
+ ],
124
158
  }
125
159
  }
126
160
  >
127
161
  <Theme>
128
- <Component
162
+ <children
129
163
  AppBar={[Function]}
130
164
  Drawer={[Function]}
131
165
  View={[Function]}
132
166
  contexts={
133
- Object {
134
- "ProductContext": Object {
167
+ {
168
+ "ProductContext": {
135
169
  "Consumer": [Function],
136
170
  },
137
171
  }
138
172
  }
139
173
  >
140
174
  <Consumer>
141
- <Component
175
+ <children
142
176
  conditioner={
143
177
  Conditioner {
144
- "conditioners": Map {
145
- "product-variants" => [Function],
178
+ "conditions": Map {
179
+ "product-variants" => {
180
+ "conditioner": [Function],
181
+ "priority": 1,
182
+ },
146
183
  },
147
184
  }
148
185
  }
149
- options={Object {}}
186
+ options={{}}
150
187
  productId="123"
188
+ setCharacteristics={
189
+ [MockFunction] {
190
+ "calls": [
191
+ [
192
+ {},
193
+ ],
194
+ ],
195
+ "results": [
196
+ {
197
+ "type": "return",
198
+ "value": undefined,
199
+ },
200
+ ],
201
+ }
202
+ }
151
203
  variantId="123-45"
152
204
  >
153
205
  <Component
154
206
  productContext={
155
- Object {
207
+ {
156
208
  "conditioner": Conditioner {
157
- "conditioners": Map {
158
- "product-variants" => [Function],
209
+ "conditions": Map {
210
+ "product-variants" => {
211
+ "conditioner": [Function],
212
+ "priority": 1,
213
+ },
159
214
  },
160
215
  },
161
- "options": Object {},
216
+ "options": {},
162
217
  "productId": "123",
218
+ "setCharacteristics": [MockFunction] {
219
+ "calls": [
220
+ [
221
+ {},
222
+ ],
223
+ ],
224
+ "results": [
225
+ {
226
+ "type": "return",
227
+ "value": undefined,
228
+ },
229
+ ],
230
+ },
163
231
  "variantId": "123-45",
164
232
  }
165
233
  }
166
234
  render={
167
235
  [MockFunction] {
168
- "calls": Array [
169
- Array [
170
- Object {
171
- "charRef": Object {
236
+ "calls": [
237
+ [
238
+ {
239
+ "charRef": {
172
240
  "current": null,
173
241
  },
174
242
  "disabled": false,
@@ -176,25 +244,29 @@ exports[`components/ProductCharacteristics should render 1`] = `
176
244
  "id": "1",
177
245
  "key": "1",
178
246
  "label": "Color",
247
+ "resetHighlight": [Function],
179
248
  "select": [Function],
180
249
  "selected": null,
181
- "values": Array [
182
- Object {
250
+ "swatch": false,
251
+ "values": [
252
+ {
183
253
  "id": "1",
184
254
  "label": "BLACK-WHITE (9000)",
185
255
  "selectable": true,
256
+ "selected": false,
186
257
  },
187
- Object {
258
+ {
188
259
  "id": "2",
189
260
  "label": "RED-WHITE (1000)",
190
261
  "selectable": true,
262
+ "selected": false,
191
263
  },
192
264
  ],
193
265
  },
194
266
  ],
195
- Array [
196
- Object {
197
- "charRef": Object {
267
+ [
268
+ {
269
+ "charRef": {
198
270
  "current": null,
199
271
  },
200
272
  "disabled": true,
@@ -202,43 +274,59 @@ exports[`components/ProductCharacteristics should render 1`] = `
202
274
  "id": "2",
203
275
  "key": "2",
204
276
  "label": "Size",
277
+ "resetHighlight": [Function],
205
278
  "select": [Function],
206
279
  "selected": null,
207
- "values": Array [
208
- Object {
280
+ "swatch": false,
281
+ "values": [
282
+ {
209
283
  "id": "11",
210
284
  "label": "7",
211
- "selectable": true,
285
+ "selectable": false,
286
+ "selected": false,
212
287
  },
213
- Object {
288
+ {
214
289
  "id": "12",
215
290
  "label": "7.5",
216
- "selectable": true,
291
+ "selectable": false,
292
+ "selected": false,
217
293
  },
218
294
  ],
219
295
  },
220
296
  ],
221
297
  ],
222
- "results": undefined,
298
+ "results": [
299
+ {
300
+ "type": "return",
301
+ "value": undefined,
302
+ },
303
+ {
304
+ "type": "return",
305
+ "value": undefined,
306
+ },
307
+ ],
223
308
  }
224
309
  }
225
310
  >
226
311
  <Component
227
312
  conditioner={
228
313
  Conditioner {
229
- "conditioners": Map {
230
- "product-variants" => [Function],
314
+ "conditions": Map {
315
+ "product-variants" => {
316
+ "conditioner": [Function],
317
+ "priority": 1,
318
+ },
231
319
  },
232
320
  }
233
321
  }
234
- options={Object {}}
322
+ options={{}}
235
323
  productId="123"
236
324
  render={
237
325
  [MockFunction] {
238
- "calls": Array [
239
- Array [
240
- Object {
241
- "charRef": Object {
326
+ "calls": [
327
+ [
328
+ {
329
+ "charRef": {
242
330
  "current": null,
243
331
  },
244
332
  "disabled": false,
@@ -246,25 +334,29 @@ exports[`components/ProductCharacteristics should render 1`] = `
246
334
  "id": "1",
247
335
  "key": "1",
248
336
  "label": "Color",
337
+ "resetHighlight": [Function],
249
338
  "select": [Function],
250
339
  "selected": null,
251
- "values": Array [
252
- Object {
340
+ "swatch": false,
341
+ "values": [
342
+ {
253
343
  "id": "1",
254
344
  "label": "BLACK-WHITE (9000)",
255
345
  "selectable": true,
346
+ "selected": false,
256
347
  },
257
- Object {
348
+ {
258
349
  "id": "2",
259
350
  "label": "RED-WHITE (1000)",
260
351
  "selectable": true,
352
+ "selected": false,
261
353
  },
262
354
  ],
263
355
  },
264
356
  ],
265
- Array [
266
- Object {
267
- "charRef": Object {
357
+ [
358
+ {
359
+ "charRef": {
268
360
  "current": null,
269
361
  },
270
362
  "disabled": true,
@@ -272,46 +364,78 @@ exports[`components/ProductCharacteristics should render 1`] = `
272
364
  "id": "2",
273
365
  "key": "2",
274
366
  "label": "Size",
367
+ "resetHighlight": [Function],
275
368
  "select": [Function],
276
369
  "selected": null,
277
- "values": Array [
278
- Object {
370
+ "swatch": false,
371
+ "values": [
372
+ {
279
373
  "id": "11",
280
374
  "label": "7",
281
- "selectable": true,
375
+ "selectable": false,
376
+ "selected": false,
282
377
  },
283
- Object {
378
+ {
284
379
  "id": "12",
285
380
  "label": "7.5",
286
- "selectable": true,
381
+ "selectable": false,
382
+ "selected": false,
287
383
  },
288
384
  ],
289
385
  },
290
386
  ],
291
387
  ],
292
- "results": undefined,
388
+ "results": [
389
+ {
390
+ "type": "return",
391
+ "value": undefined,
392
+ },
393
+ {
394
+ "type": "return",
395
+ "value": undefined,
396
+ },
397
+ ],
398
+ }
399
+ }
400
+ setCharacteristics={
401
+ [MockFunction] {
402
+ "calls": [
403
+ [
404
+ {},
405
+ ],
406
+ ],
407
+ "results": [
408
+ {
409
+ "type": "return",
410
+ "value": undefined,
411
+ },
412
+ ],
293
413
  }
294
414
  }
295
415
  variantId="123-45"
296
416
  >
297
417
  <ProductCharacteristics
418
+ characteristics={null}
298
419
  conditioner={
299
420
  Conditioner {
300
- "conditioners": Map {
301
- "product-variants" => [Function],
421
+ "conditions": Map {
422
+ "product-variants" => {
423
+ "conditioner": [Function],
424
+ "priority": 1,
425
+ },
302
426
  },
303
427
  }
304
428
  }
305
429
  finishTimeout={0}
306
- navigate={[Function]}
307
- options={Object {}}
430
+ navigate={[MockFunction]}
431
+ options={{}}
308
432
  productId="123"
309
433
  render={
310
434
  [MockFunction] {
311
- "calls": Array [
312
- Array [
313
- Object {
314
- "charRef": Object {
435
+ "calls": [
436
+ [
437
+ {
438
+ "charRef": {
315
439
  "current": null,
316
440
  },
317
441
  "disabled": false,
@@ -319,25 +443,29 @@ exports[`components/ProductCharacteristics should render 1`] = `
319
443
  "id": "1",
320
444
  "key": "1",
321
445
  "label": "Color",
446
+ "resetHighlight": [Function],
322
447
  "select": [Function],
323
448
  "selected": null,
324
- "values": Array [
325
- Object {
449
+ "swatch": false,
450
+ "values": [
451
+ {
326
452
  "id": "1",
327
453
  "label": "BLACK-WHITE (9000)",
328
454
  "selectable": true,
455
+ "selected": false,
329
456
  },
330
- Object {
457
+ {
331
458
  "id": "2",
332
459
  "label": "RED-WHITE (1000)",
333
460
  "selectable": true,
461
+ "selected": false,
334
462
  },
335
463
  ],
336
464
  },
337
465
  ],
338
- Array [
339
- Object {
340
- "charRef": Object {
466
+ [
467
+ {
468
+ "charRef": {
341
469
  "current": null,
342
470
  },
343
471
  "disabled": true,
@@ -345,69 +473,97 @@ exports[`components/ProductCharacteristics should render 1`] = `
345
473
  "id": "2",
346
474
  "key": "2",
347
475
  "label": "Size",
476
+ "resetHighlight": [Function],
348
477
  "select": [Function],
349
478
  "selected": null,
350
- "values": Array [
351
- Object {
479
+ "swatch": false,
480
+ "values": [
481
+ {
352
482
  "id": "11",
353
483
  "label": "7",
354
- "selectable": true,
484
+ "selectable": false,
485
+ "selected": false,
355
486
  },
356
- Object {
487
+ {
357
488
  "id": "12",
358
489
  "label": "7.5",
359
- "selectable": true,
490
+ "selectable": false,
491
+ "selected": false,
360
492
  },
361
493
  ],
362
494
  },
363
495
  ],
364
496
  ],
365
- "results": undefined,
497
+ "results": [
498
+ {
499
+ "type": "return",
500
+ "value": undefined,
501
+ },
502
+ {
503
+ "type": "return",
504
+ "value": undefined,
505
+ },
506
+ ],
507
+ }
508
+ }
509
+ setCharacteristics={
510
+ [MockFunction] {
511
+ "calls": [
512
+ [
513
+ {},
514
+ ],
515
+ ],
516
+ "results": [
517
+ {
518
+ "type": "return",
519
+ "value": undefined,
520
+ },
521
+ ],
366
522
  }
367
523
  }
368
524
  variantId="123-45"
369
525
  variants={
370
- Object {
371
- "characteristics": Array [
372
- Object {
526
+ {
527
+ "characteristics": [
528
+ {
373
529
  "id": "1",
374
530
  "label": "Color",
375
- "values": Array [
376
- Object {
531
+ "values": [
532
+ {
377
533
  "id": "1",
378
534
  "label": "BLACK-WHITE (9000)",
379
535
  },
380
- Object {
536
+ {
381
537
  "id": "2",
382
538
  "label": "RED-WHITE (1000)",
383
539
  },
384
540
  ],
385
541
  },
386
- Object {
542
+ {
387
543
  "id": "2",
388
544
  "label": "Size",
389
- "values": Array [
390
- Object {
545
+ "values": [
546
+ {
391
547
  "id": "11",
392
548
  "label": "7",
393
549
  },
394
- Object {
550
+ {
395
551
  "id": "12",
396
552
  "label": "7.5",
397
553
  },
398
554
  ],
399
555
  },
400
556
  ],
401
- "products": Array [
402
- Object {
403
- "characteristics": Object {
557
+ "products": [
558
+ {
559
+ "characteristics": {
404
560
  "1": "1",
405
561
  "2": "11",
406
562
  },
407
563
  "id": "32050590001000",
408
564
  },
409
- Object {
410
- "characteristics": Object {
565
+ {
566
+ "characteristics": {
411
567
  "1": "2",
412
568
  "2": "12",
413
569
  },
@@ -419,9 +575,9 @@ exports[`components/ProductCharacteristics should render 1`] = `
419
575
  />
420
576
  </Component>
421
577
  </Component>
422
- </Component>
578
+ </children>
423
579
  </Consumer>
424
- </Component>
580
+ </children>
425
581
  </Theme>
426
582
  </WithProductContext>
427
583
  </Component>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import BaseProductCharacteristics from '@shopgate/pwa-common/components/ProductCharacteristics';
2
+ import { ProductCharacteristics as BaseProductCharacteristics } from '@shopgate/engage/product/components';
3
3
  import withProductContext from '../../connectors/withProductContext';
4
4
 
5
5
  export default withProductContext(({ productContext, ...otherProps }) => (
@@ -30,10 +30,12 @@ const mockedMapStateToPropsResult = {
30
30
  }],
31
31
  },
32
32
  };
33
+
33
34
  jest.mock('react-redux', () => ({
34
35
  connect: mapStateToProps => Component => props => (
35
36
  <Component
36
37
  variants={mockedMapStateToPropsResult.variants}
38
+ navigate={jest.fn()}
37
39
  {...props}
38
40
  />
39
41
  ),
@@ -57,6 +59,7 @@ jest.mock('@shopgate/pwa-common/context', () => ({
57
59
  productId="123"
58
60
  variantId="123-45"
59
61
  conditioner={mockedConditioner}
62
+ setCharacteristics={jest.fn()}
60
63
  {...contextProps}
61
64
  />
62
65
  ),
@@ -110,8 +113,8 @@ describe('components/ProductCharacteristics', () => {
110
113
  label: 'Size',
111
114
  selected: null,
112
115
  values: [
113
- { id: '11', label: '7', selectable: true },
114
- { id: '12', label: '7.5', selectable: true },
116
+ { id: '11', label: '7', selectable: false },
117
+ { id: '12', label: '7.5', selectable: false },
115
118
  ],
116
119
  };
117
120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/webpack",
3
- "version": "7.30.4-beta.1",
3
+ "version": "7.31.0-alpha.2",
4
4
  "description": "The webpack configuration for Shopgate's Engage.",
5
5
  "main": "webpack.config.js",
6
6
  "license": "Apache-2.0",
@@ -28,6 +28,7 @@
28
28
  "workbox-webpack-plugin": "6.5.4"
29
29
  },
30
30
  "devDependencies": {
31
+ "@types/lodash": "^4.17.24",
31
32
  "rxjs": "~5.5.12",
32
33
  "webpack-dev-server": "4.15.2"
33
34
  }
@@ -10,6 +10,7 @@
10
10
  <title>
11
11
  <%= htmlWebpackPlugin.options.title %>
12
12
  </title>
13
+ <meta name="emotion-insertion-point" content="" />
13
14
  <% if (htmlWebpackPlugin.files && htmlWebpackPlugin.files.css) { %>
14
15
  <% htmlWebpackPlugin.files.css.forEach(function(css) { %>
15
16
  <link rel="stylesheet" href="<%= css %>">
package/webpack.config.js CHANGED
@@ -70,7 +70,7 @@ const config = {
70
70
  publicPath: isDev ? '/' : (process.env.publicPath || './'),
71
71
  },
72
72
  resolve: {
73
- extensions: ['.json', '.js', '.jsx', '.mjs'],
73
+ extensions: ['.json', '.js', '.jsx', '.ts', '.tsx', '.mjs'],
74
74
  /**
75
75
  * Aliases for module resolution. They guarantee that whenever one of the bundled modules
76
76
  * uses in import to one of the packages, it will always resolve to the version of the core.
@@ -239,7 +239,7 @@ const config = {
239
239
  type: 'javascript/auto',
240
240
  },
241
241
  {
242
- test: /\.(js|jsx)$/,
242
+ test: /\.(js|jsx|ts|tsx)$/,
243
243
  exclude: new RegExp(`node_modules\\b(?!\\${path.sep}@shopgate)\\b.*`),
244
244
  use: [
245
245
  {