@riosst100/pwa-marketplace 2.7.3 → 2.7.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "2.7.3",
4
+ "version": "2.7.5",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -248,6 +248,33 @@ const getConfigName = (product, optionCodes, optionSelections) => {
248
248
  return value;
249
249
  };
250
250
 
251
+ const getConfigSku = (product, optionCodes, optionSelections) => {
252
+ let value;
253
+
254
+ const { variants } = product;
255
+ const isConfigurable = isProductConfigurable(product);
256
+
257
+ const optionsSelected =
258
+ Array.from(optionSelections.values()).filter(value => !!value).length >
259
+ 0;
260
+
261
+ if (!isConfigurable) {
262
+ value = product.name;
263
+ } else {
264
+ const item = findMatchingVariant({
265
+ optionCodes,
266
+ optionSelections,
267
+ variants
268
+ });
269
+
270
+ value = optionsSelected && item
271
+ ? item.product.sku
272
+ : product.sku;
273
+ }
274
+
275
+ return value;
276
+ };
277
+
251
278
  const attributeLabelCompare = (attribute1, attribute2) => {
252
279
  const label1 = attribute1['attribute_metadata']['label'].toLowerCase();
253
280
  const label2 = attribute2['attribute_metadata']['label'].toLowerCase();
@@ -450,6 +477,11 @@ export const useProductFullDetail = props => {
450
477
  [product, optionCodes, optionSelections]
451
478
  );
452
479
 
480
+ const productSku = useMemo(
481
+ () => getConfigSku(product, optionCodes, optionSelections),
482
+ [product, optionCodes, optionSelections]
483
+ );
484
+
453
485
  // The map of ids to values (and their uids)
454
486
  // For example:
455
487
  // { "179" => [{ uid: "abc", value_index: 1 }, { uid: "def", value_index: 2 }]}
@@ -625,7 +657,7 @@ export const useProductFullDetail = props => {
625
657
  name: productName,
626
658
  price: productPrice?.final_price,
627
659
  price_range: product?.price_range,
628
- sku: product.sku,
660
+ sku: productSku,
629
661
  publish_status: product.publish_status,
630
662
  term_and_conditions: product.term_and_conditions,
631
663
  link_to_other_stores: product.link_to_other_stores,
@@ -87,20 +87,19 @@ const Image = props => {
87
87
  {...rest}
88
88
  />
89
89
  ) : (
90
- // <ResourceImage
91
- // alt={alt}
92
- // className={imageClass}
93
- // handleError={handleError}
94
- // handleLoad={handleImageLoad}
95
- // height={talonResourceHeight}
96
- // resource={resource}
97
- // type={type}
98
- // width={talonResourceWidth}
99
- // widths={widths}
100
- // ratio={ratio}
101
- // {...rest}
102
- // />
103
- <></>
90
+ <ResourceImage
91
+ alt={alt}
92
+ className={imageClass}
93
+ handleError={handleError}
94
+ handleLoad={handleImageLoad}
95
+ height={talonResourceHeight}
96
+ resource={resource}
97
+ type={type}
98
+ width={talonResourceWidth}
99
+ widths={widths}
100
+ ratio={ratio}
101
+ {...rest}
102
+ />
104
103
  );
105
104
 
106
105
  return (
@@ -67,7 +67,7 @@ const Option = props => {
67
67
 
68
68
  return (
69
69
  <div className={classes.root} data-cy="ProductOptions-Option-root">
70
- <span className={classes.title}>{label}</span>
70
+ {/* <span className={classes.title}>{label}</span> */}
71
71
  <ValueList
72
72
  getItemKey={getItemKey}
73
73
  selectedValue={initialSelection}
@@ -76,7 +76,7 @@ const Tile = props => {
76
76
  root: classes.variantImageSwatch
77
77
  }}
78
78
  resource={variantImg}
79
- width={24}
79
+ width={20}
80
80
  />
81
81
  );
82
82
 
@@ -19,6 +19,9 @@
19
19
  .variantImageSwatch {
20
20
  width: 24px;
21
21
  height: 24px;
22
+ display: table;
23
+ margin-bottom: 2px;
24
+ margin-right: 5px;
22
25
  }
23
26
 
24
27
  .root:hover {
@@ -27,7 +30,7 @@
27
30
  }
28
31
 
29
32
  .label {
30
- padding-left: 0.4rem;
33
+ padding-left: 5px;
31
34
  padding-right: 5px;
32
35
  }
33
36