@riosst100/pwa-marketplace 2.7.1 → 2.7.3
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 +1 -1
- package/src/componentOverrideMapping.js +1 -0
- package/src/components/ProductLabel/index.js +2 -0
- package/src/overwrites/peregrine/lib/talons/ProductFullDetail/useProductFullDetail.js +33 -1
- package/src/overwrites/peregrine/lib/talons/RootComponents/Product/productDetailFragment.gql.js +5 -2
- package/src/overwrites/peregrine/lib/talons/SearchPage/searchPage.gql.js +126 -0
- package/src/overwrites/venia-ui/lib/components/Image/image.js +14 -13
- package/src/talons/SellerProducts/categoryFragments.gql.js +4 -2
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ module.exports = componentOverrideMapping = {
|
|
|
15
15
|
[`@magento/peregrine/lib/context/cart.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/context/cart.js',
|
|
16
16
|
[`@magento/peregrine/lib/talons/CheckoutPage/useCheckoutPage.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/CheckoutPage/useCheckoutPage.js',
|
|
17
17
|
[`@magento/peregrine/lib/talons/SignIn/signIn.gql.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/SignIn/signIn.gql.js',
|
|
18
|
+
[`@magento/peregrine/lib/talons/SearchPage/searchPage.gql.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/SearchPage/searchPage.gql.js',
|
|
18
19
|
[`@magento/peregrine/lib/talons/SignIn/useSignIn.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/SignIn/useSignIn.js',
|
|
19
20
|
[`@magento/peregrine/lib/talons/AccountMenu/useAccountMenuItems.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/AccountMenu/useAccountMenuItems.js',
|
|
20
21
|
[`@magento/peregrine/lib/talons/MegaMenu/megaMenu.gql.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/MegaMenu/megaMenu.gql.js',
|
|
@@ -221,6 +221,33 @@ const getConfigPrice = (product, optionCodes, optionSelections) => {
|
|
|
221
221
|
return value;
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
+
const getConfigName = (product, optionCodes, optionSelections) => {
|
|
225
|
+
let value;
|
|
226
|
+
|
|
227
|
+
const { variants } = product;
|
|
228
|
+
const isConfigurable = isProductConfigurable(product);
|
|
229
|
+
|
|
230
|
+
const optionsSelected =
|
|
231
|
+
Array.from(optionSelections.values()).filter(value => !!value).length >
|
|
232
|
+
0;
|
|
233
|
+
|
|
234
|
+
if (!isConfigurable) {
|
|
235
|
+
value = product.name;
|
|
236
|
+
} else {
|
|
237
|
+
const item = findMatchingVariant({
|
|
238
|
+
optionCodes,
|
|
239
|
+
optionSelections,
|
|
240
|
+
variants
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
value = optionsSelected && item
|
|
244
|
+
? item.product.name
|
|
245
|
+
: product.name;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return value;
|
|
249
|
+
};
|
|
250
|
+
|
|
224
251
|
const attributeLabelCompare = (attribute1, attribute2) => {
|
|
225
252
|
const label1 = attribute1['attribute_metadata']['label'].toLowerCase();
|
|
226
253
|
const label2 = attribute2['attribute_metadata']['label'].toLowerCase();
|
|
@@ -418,6 +445,11 @@ export const useProductFullDetail = props => {
|
|
|
418
445
|
[product, optionCodes, optionSelections]
|
|
419
446
|
);
|
|
420
447
|
|
|
448
|
+
const productName = useMemo(
|
|
449
|
+
() => getConfigName(product, optionCodes, optionSelections),
|
|
450
|
+
[product, optionCodes, optionSelections]
|
|
451
|
+
);
|
|
452
|
+
|
|
421
453
|
// The map of ids to values (and their uids)
|
|
422
454
|
// For example:
|
|
423
455
|
// { "179" => [{ uid: "abc", value_index: 1 }, { uid: "def", value_index: 2 }]}
|
|
@@ -590,7 +622,7 @@ export const useProductFullDetail = props => {
|
|
|
590
622
|
const productDetails = {
|
|
591
623
|
description: product.description,
|
|
592
624
|
shortDescription: product.short_description,
|
|
593
|
-
name:
|
|
625
|
+
name: productName,
|
|
594
626
|
price: productPrice?.final_price,
|
|
595
627
|
price_range: product?.price_range,
|
|
596
628
|
sku: product.sku,
|
package/src/overwrites/peregrine/lib/talons/RootComponents/Product/productDetailFragment.gql.js
CHANGED
|
@@ -110,8 +110,10 @@ export const ProductDetailsFragment = gql`
|
|
|
110
110
|
}
|
|
111
111
|
preorder {
|
|
112
112
|
is_preorder
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
pre_order_payment_type
|
|
114
|
+
pre_order_deposit
|
|
115
|
+
pre_order_notes
|
|
116
|
+
pre_order_date
|
|
115
117
|
}
|
|
116
118
|
term_and_conditions
|
|
117
119
|
shipping_policy
|
|
@@ -191,6 +193,7 @@ export const ProductDetailsFragment = gql`
|
|
|
191
193
|
label
|
|
192
194
|
position
|
|
193
195
|
}
|
|
196
|
+
name
|
|
194
197
|
sku
|
|
195
198
|
stock_status
|
|
196
199
|
price {
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_PAGE_SIZE = gql`
|
|
4
|
+
query getPageSize {
|
|
5
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
6
|
+
storeConfig {
|
|
7
|
+
store_code
|
|
8
|
+
grid_per_page
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const GET_PRODUCT_FILTERS_BY_SEARCH = gql`
|
|
14
|
+
query getProductFiltersBySearch($search: String!) {
|
|
15
|
+
products(search: $search) {
|
|
16
|
+
aggregations {
|
|
17
|
+
label
|
|
18
|
+
count
|
|
19
|
+
attribute_code
|
|
20
|
+
options {
|
|
21
|
+
label
|
|
22
|
+
value
|
|
23
|
+
}
|
|
24
|
+
position
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export const GET_SEARCH_TERM_DATA = gql`
|
|
31
|
+
query getSearchTermData($search: String) {
|
|
32
|
+
searchTerm(Search: $search) {
|
|
33
|
+
query_text
|
|
34
|
+
redirect
|
|
35
|
+
popularity
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
export const PRODUCT_SEARCH = gql`
|
|
41
|
+
query ProductSearch(
|
|
42
|
+
$currentPage: Int = 1
|
|
43
|
+
$inputText: String!
|
|
44
|
+
$pageSize: Int = 6
|
|
45
|
+
$filters: ProductAttributeFilterInput!
|
|
46
|
+
$sort: ProductAttributeSortInput
|
|
47
|
+
) {
|
|
48
|
+
products(
|
|
49
|
+
currentPage: $currentPage
|
|
50
|
+
pageSize: $pageSize
|
|
51
|
+
search: $inputText
|
|
52
|
+
filter: $filters
|
|
53
|
+
sort: $sort
|
|
54
|
+
) {
|
|
55
|
+
items {
|
|
56
|
+
id
|
|
57
|
+
uid
|
|
58
|
+
name
|
|
59
|
+
price_range {
|
|
60
|
+
maximum_price {
|
|
61
|
+
final_price {
|
|
62
|
+
currency
|
|
63
|
+
value
|
|
64
|
+
}
|
|
65
|
+
regular_price {
|
|
66
|
+
currency
|
|
67
|
+
value
|
|
68
|
+
}
|
|
69
|
+
discount {
|
|
70
|
+
amount_off
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
sku
|
|
75
|
+
preorder {
|
|
76
|
+
is_preorder
|
|
77
|
+
}
|
|
78
|
+
small_image {
|
|
79
|
+
url
|
|
80
|
+
}
|
|
81
|
+
stock_status
|
|
82
|
+
__typename
|
|
83
|
+
url_key
|
|
84
|
+
}
|
|
85
|
+
page_info {
|
|
86
|
+
total_pages
|
|
87
|
+
}
|
|
88
|
+
total_count
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
export const GET_FILTER_INPUTS = gql`
|
|
94
|
+
query GetFilterInputsForSearch {
|
|
95
|
+
__type(name: "ProductAttributeFilterInput") {
|
|
96
|
+
inputFields {
|
|
97
|
+
name
|
|
98
|
+
type {
|
|
99
|
+
name
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
export const GET_SEARCH_AVAILABLE_SORT_METHODS = gql`
|
|
107
|
+
query getSearchAvailableSortMethods($search: String!) {
|
|
108
|
+
products(search: $search) {
|
|
109
|
+
sort_fields {
|
|
110
|
+
options {
|
|
111
|
+
label
|
|
112
|
+
value
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
export default {
|
|
120
|
+
getFilterInputsQuery: GET_FILTER_INPUTS,
|
|
121
|
+
getPageSize: GET_PAGE_SIZE,
|
|
122
|
+
getSearchTermData: GET_SEARCH_TERM_DATA,
|
|
123
|
+
getProductFiltersBySearchQuery: GET_PRODUCT_FILTERS_BY_SEARCH,
|
|
124
|
+
getSearchAvailableSortMethods: GET_SEARCH_AVAILABLE_SORT_METHODS,
|
|
125
|
+
productSearchQuery: PRODUCT_SEARCH
|
|
126
|
+
};
|
|
@@ -87,19 +87,20 @@ const Image = props => {
|
|
|
87
87
|
{...rest}
|
|
88
88
|
/>
|
|
89
89
|
) : (
|
|
90
|
-
<ResourceImage
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/>
|
|
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
|
+
<></>
|
|
103
104
|
);
|
|
104
105
|
|
|
105
106
|
return (
|