@riosst100/pwa-marketplace 3.0.7 → 3.0.9

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.
Files changed (19) hide show
  1. package/package.json +1 -1
  2. package/src/components/FilterTop/filterTop.js +0 -7
  3. package/src/components/ShowMore/showMore.js +0 -1
  4. package/src/overwrites/peregrine/lib/talons/ProductFullDetail/useProductFullDetail.js +32 -2
  5. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +1 -0
  6. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +2 -2
  7. package/src/overwrites/peregrine/lib/talons/RootComponents/Product/productDetailFragment.gql.js +31 -0
  8. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -1
  9. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +16 -7
  10. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/customAttributes.js +0 -1
  11. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/ProductCardDetails/index.js +1 -0
  12. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/ProductCardDetails/productCardDetails.js +63 -0
  13. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/ProductCardDetails/productCardDetails.module.css +8 -0
  14. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +44 -15
  15. package/src/talons/ProductContent/productContent.gql.js +1 -0
  16. package/src/talons/SellerProducts/productContent.gql.js +1 -0
  17. package/src/components/RelatedProducts/index.js +0 -1
  18. package/src/components/RelatedProducts/relatedProducts.js +0 -44
  19. package/src/talons/RelatedProducts/useRelatedProducts.js +0 -112
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "3.0.7",
4
+ "version": "3.0.9",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -95,13 +95,6 @@ const FilterTop = props => {
95
95
  [handleApply, filterRef]
96
96
  );
97
97
 
98
- // const allowedFiltersArr = [];
99
-
100
- // allowedFilters.length && allowedFilters.map((val, index) => {
101
- // allowedFiltersArr.push(val.code);
102
- // });
103
- // const allowedFiltersArr = ['card_rarity','card_print_version','card_set', 'card_product_type'];
104
-
105
98
  const filtersList = useMemo(
106
99
  () =>
107
100
  Array.from(filterItems, ([group, items], iteration) => {
@@ -339,7 +339,6 @@ const ShowMore = props => {
339
339
  <StoreTitle>{title}</StoreTitle>
340
340
  <Breadcrumbs categoryId={categoryId} customPage={title} currentFilter={activeFilters} />
341
341
  {category?.url_path.includes('model-railway') && <FilterTop shopby={shopby} filters={[]} category={category} children={[]} allowedFilters={category ? category.allowed_filters : []} />}
342
- {/* <ShopByFilters handleActiveFilter={handleActiveFilter} activeFilter={activeFilter} category={category} /> */}
343
342
  {availableFilterOption.length ?
344
343
  <ul className={classes.nav}>
345
344
  {availableFilterOption.map((filter, index) => (
@@ -302,12 +302,36 @@ const getCustomAttributes = (product, optionCodes, optionSelections) => {
302
302
  });
303
303
 
304
304
  return item && item.product
305
- ? [...item.product.custom_attributes].sort(attributeLabelCompare)
305
+ ? [...item.product.custom_attributes]
306
306
  : [];
307
307
  }
308
308
 
309
309
  return custom_attributes
310
- ? [...custom_attributes].sort(attributeLabelCompare)
310
+ ? [...custom_attributes]
311
+ : [];
312
+ };
313
+
314
+ const getProductDetailsAttributes = (product, optionCodes, optionSelections) => {
315
+ const { product_details, variants } = product;
316
+ const isConfigurable = isProductConfigurable(product);
317
+ const optionsSelected =
318
+ Array.from(optionSelections.values()).filter(value => !!value).length >
319
+ 0;
320
+
321
+ if (isConfigurable && optionsSelected) {
322
+ const item = findMatchingVariant({
323
+ optionCodes,
324
+ optionSelections,
325
+ variants
326
+ });
327
+
328
+ return item && item.product
329
+ ? [...item.product.product_details]
330
+ : [];
331
+ }
332
+
333
+ return product_details
334
+ ? [...product_details]
311
335
  : [];
312
336
  };
313
337
 
@@ -529,6 +553,11 @@ export const useProductFullDetail = props => {
529
553
  [product, optionCodes, optionSelections]
530
554
  );
531
555
 
556
+ const productDetailsAttributes = useMemo(
557
+ () => getProductDetailsAttributes(product, optionCodes, optionSelections),
558
+ [product, optionCodes, optionSelections]
559
+ );
560
+
532
561
  const productPrice = useMemo(
533
562
  () => getConfigPrice(product, optionCodes, optionSelections),
534
563
  [product, optionCodes, optionSelections]
@@ -817,6 +846,7 @@ export const useProductFullDetail = props => {
817
846
  !!storeConfigData.storeConfig.magento_wishlist_general_is_enabled,
818
847
  productDetails,
819
848
  customAttributes,
849
+ productDetailsAttributes,
820
850
  wishlistButtonProps,
821
851
  wishlistItemOptions,
822
852
  sellerDetails,
@@ -43,6 +43,7 @@ export const GET_CATEGORY_CONTENT = gql`
43
43
  allowed_filters {
44
44
  code
45
45
  }
46
+ prefixes
46
47
  custom_subcategory {
47
48
  name
48
49
  path
@@ -141,9 +141,9 @@ export const useCategoryContent = props => {
141
141
  // Construct the filter arg object.
142
142
  const newFilters = {};
143
143
  filters.forEach((values, key) => {
144
- if (masterAttributes.includes(key)) {
144
+ // if (masterAttributes.includes(key)) {
145
145
  newFilters[key] = getFilterInput(values, filterTypeMap.get(key));
146
- }
146
+ // }
147
147
  });
148
148
 
149
149
  // console.log('newFilters',newFilters)
@@ -131,6 +131,37 @@ export const ProductDetailsFragment = gql`
131
131
  }
132
132
  }
133
133
  }
134
+ product_details {
135
+ selected_attribute_options {
136
+ attribute_option {
137
+ uid
138
+ label
139
+ is_default
140
+ }
141
+ }
142
+ entered_attribute_value {
143
+ value
144
+ }
145
+ attribute_metadata {
146
+ uid
147
+ code
148
+ label
149
+ attribute_labels {
150
+ store_code
151
+ label
152
+ }
153
+ data_type
154
+ is_system
155
+ entity_type
156
+ ui_input {
157
+ ui_input_type
158
+ is_html_allowed
159
+ }
160
+ ... on ProductAttributeMetadata {
161
+ used_in_components
162
+ }
163
+ }
164
+ }
134
165
  ... on ConfigurableProduct {
135
166
  # eslint-disable-next-line @graphql-eslint/require-id-when-available
136
167
  configurable_options {
@@ -165,7 +165,7 @@ const CategoryContent = props => {
165
165
  ) : null;
166
166
 
167
167
  const sidebar = shouldShowFilterButtons ? (
168
- <FilterSidebar hideFilters={category && category.hide_filters ? true : false} children={children} filters={filters} allowedFilters={category ? category.allowed_filters : []} />
168
+ <FilterSidebar hideFilters={category && category.hide_filters ? true : false} children={children} filters={filters} allowedFilters={category ? category.allowed_filters : []} prefixes={category ? category.prefixes : []} />
169
169
  ) : shouldShowFilterShimmer ? (
170
170
  <FilterSidebarShimmer />
171
171
  ) : null;
@@ -21,7 +21,7 @@ const SCROLL_OFFSET = 150;
21
21
  * @param {Object} props.filters - filters to display
22
22
  */
23
23
  const FilterSidebar = props => {
24
- const { filters, filterCountToOpen, allowedFilters, hideFilters } = props;
24
+ const { filters, filterCountToOpen, allowedFilters, prefixes, hideFilters } = props;
25
25
  const talonProps = useFilterSidebar({ filters });
26
26
  const {
27
27
  filterApi,
@@ -116,7 +116,15 @@ const FilterSidebar = props => {
116
116
  // // console.log([...sorted.entries()]);
117
117
  // const filterItems = [...sorted.entries()];
118
118
 
119
- // console.log('filterItems',filterItems)
119
+ const removePrefix = (attrCode) => {
120
+ if (prefixes) {
121
+ return prefixes.reduce((s, p) =>
122
+ s.startsWith(p + "_") ? s.replace(p + "_", "") : s
123
+ , attrCode);
124
+ }
125
+
126
+ return attrCode;
127
+ };
120
128
 
121
129
  const filtersList = useMemo(
122
130
  () =>
@@ -124,10 +132,10 @@ const FilterSidebar = props => {
124
132
  const blockState = filterState.get(group);
125
133
  const groupName = filterNames.get(group);
126
134
  const frontendInput = filterFrontendInput.get(group);
127
-
128
- const hideFilters = ['card_game','bricks_categories','sc_sports_categories','trains','trains_locomotives','trains_supplies_type','lof_preorder','card_pre_orders','auction','special_price','sc_baseball_inserts','sc_baseball_parallel','sale','sc_set_type','sc_brands'];
129
- if (!allowedFiltersArr?.length || filterState.size && allowedFiltersArr.length || !filterState.size && allowedFiltersArr.length && allowedFiltersArr.includes(group)) {
130
- if (!hideFilters.includes(group) && groupName && !group.includes('card_release') && !group.includes('card_set') && !group.includes('sc_set_name')) {
135
+
136
+ if (!allowedFiltersArr.length || allowedFiltersArr.length && allowedFiltersArr.includes(removePrefix(group))) {
137
+ console.log('removePrefix(group)',removePrefix(group))
138
+ // if (!hideFilters.includes(group) && groupName && !group.includes('card_release') && !group.includes('card_set') && !group.includes('sc_set_name')) {
131
139
 
132
140
  // if (!allowedFiltersArr?.length && group != "category_uid" || allowedFiltersArr?.length && allowedFiltersArr.includes(group)) {
133
141
  let subFilter = null;
@@ -177,7 +185,7 @@ const FilterSidebar = props => {
177
185
  initialOpen={true}
178
186
  />
179
187
  );
180
- }
188
+ // }
181
189
  }
182
190
  }),
183
191
  [
@@ -254,6 +262,7 @@ FilterSidebar.propTypes = {
254
262
  root: string,
255
263
  root_open: string
256
264
  }),
265
+ prefixes: [],
257
266
  filters: arrayOf(
258
267
  shape({
259
268
  attribute_code: string,
@@ -22,7 +22,6 @@ const CustomAttributes = props => {
22
22
  const list = useMemo(
23
23
  () =>
24
24
  customAttributes.reduce((previousAttribute, currentAttribute) => {
25
- console.log('currentAttribute',currentAttribute)
26
25
  const attrCode = currentAttribute.attribute_metadata?.code;
27
26
  const usedInComponents =
28
27
  currentAttribute.attribute_metadata?.used_in_components ||
@@ -0,0 +1 @@
1
+ export { default } from './productCardDetails';
@@ -0,0 +1,63 @@
1
+ import React, { useMemo } from 'react';
2
+ import { array, shape, string } from 'prop-types';
3
+
4
+ import { useStyle } from '@magento/venia-ui/lib/classify';
5
+ import defaultClasses from './productCardDetails.module.css';
6
+ import cn from 'classnames';
7
+
8
+ export const IS_VISIBLE_ON_FRONT = 'PRODUCT_DETAILS_PAGE';
9
+
10
+ const ProductCardDetails = props => {
11
+ const { customAttributes, showLabels } = props;
12
+ const classes = useStyle(defaultClasses, props.classes);
13
+
14
+ const getAttributeValue = (currentAttribute, key, useSuffix = false) => {
15
+ if (!currentAttribute) return "";
16
+
17
+ if (currentAttribute.selected_attribute_options?.attribute_option?.length) {
18
+ return currentAttribute.selected_attribute_options.attribute_option
19
+ .map(opt => opt.label)
20
+ .join(", ");
21
+ }
22
+ return currentAttribute.entered_attribute_value?.value || "";
23
+ };
24
+
25
+ const list = useMemo(
26
+ () =>
27
+ customAttributes.reduce((previousAttribute, currentAttribute) => {
28
+ const attrCode = currentAttribute.attribute_metadata?.code;
29
+ const usedInComponents =
30
+ currentAttribute.attribute_metadata?.used_in_components ||
31
+ [];
32
+ // Visible on front attributes only
33
+ if (usedInComponents.includes(IS_VISIBLE_ON_FRONT)) {
34
+ const attributeContent = (
35
+ <p key={currentAttribute.attribute_metadata.uid}><strong>{currentAttribute.attribute_metadata.label}:</strong> {getAttributeValue(currentAttribute)}</p>
36
+ );
37
+
38
+ previousAttribute.push(attributeContent);
39
+ }
40
+
41
+ return previousAttribute;
42
+ }, []),
43
+ [classes, customAttributes, showLabels]
44
+ );
45
+
46
+ if (list.length === 0) {
47
+ return null;
48
+ }
49
+
50
+ return list;
51
+ };
52
+
53
+ ProductCardDetails.propTypes = {
54
+ classes: shape({
55
+ root: string,
56
+ title: string,
57
+ list: string,
58
+ listItem: string
59
+ }),
60
+ customAttributes: array.isRequired
61
+ };
62
+
63
+ export default ProductCardDetails;
@@ -0,0 +1,8 @@
1
+ .root {}
2
+
3
+ .list {
4
+ composes: list-none from global;
5
+ composes: mb-2 from global;
6
+ composes: mt-2 from global;
7
+ composes: pl-2 from global;
8
+ }
@@ -19,6 +19,7 @@ import RichContent from '@magento/venia-ui/lib/components/RichContent/richConten
19
19
  import QuantityStepper from '../QuantityStepper';
20
20
  import { ProductOptionsShimmer } from '@magento/venia-ui/lib/components/ProductOptions';
21
21
  import CustomAttributes from './CustomAttributes';
22
+ import ProductCardDetails from './ProductCardDetails';
22
23
  import defaultClasses from './productFullDetail.module.css';
23
24
  import cn from 'classnames';
24
25
  import Tabs from '@riosst100/pwa-marketplace/src/components/commons/Tabs';
@@ -102,6 +103,7 @@ const ProductFullDetail = props => {
102
103
  selectedMedia,
103
104
  productDetails,
104
105
  customAttributes,
106
+ productDetailsAttributes,
105
107
  wishlistButtonProps,
106
108
  sellerDetails,
107
109
  handleToastAction,
@@ -231,6 +233,28 @@ const ProductFullDetail = props => {
231
233
  };
232
234
  }, [customAttributes, productDetails.sku, formatMessage]);
233
235
 
236
+ const productCardDetailsAttributes = useMemo(() => {
237
+ const list = [];
238
+ const pagebuilder = [];
239
+ if (Array.isArray(productDetailsAttributes)) {
240
+ productDetailsAttributes.forEach(customAttribute => {
241
+ if (
242
+ customAttribute.attribute_metadata.ui_input
243
+ .ui_input_type === 'PAGEBUILDER'
244
+ ) {
245
+ pagebuilder.push(customAttribute);
246
+ } else {
247
+ list.push(customAttribute);
248
+ }
249
+ });
250
+ }
251
+ // list.unshift(skuAttribute);
252
+ return {
253
+ list: list,
254
+ pagebuilder: pagebuilder
255
+ };
256
+ }, [productDetailsAttributes, productDetails.sku, formatMessage]);
257
+
234
258
  const shortDescription = productDetails.shortDescription ? (
235
259
  <RichText
236
260
  rootClassName="px-0"
@@ -356,19 +380,19 @@ const ProductFullDetail = props => {
356
380
  return attr.entered_attribute_value?.value || "";
357
381
  };
358
382
 
359
- const preOrder = getAttributeValue(customAttributesDetails, "card_pre_orders", true);
360
- const preOrderDate = getAttributeValue(customAttributesDetails, "pre_order_date", true);
361
- const preOrderDeposite = getAttributeValue(customAttributesDetails, "pre_order_deposit", true);
362
- const preOrderNote = getAttributeValue(customAttributesDetails, "pre_order_notes", true);
363
- const preOrderPaymentType = getAttributeValue(customAttributesDetails, "pre_order_payment_type", true);
364
- const releaseDate = getAttributeValue(customAttributesDetails, "release_date", true);
365
- const setNameValue = getAttributeValue(customAttributesDetails, "card_set", true);
366
- const cardNameValue = getAttributeValue(customAttributesDetails, "card_name", true);
367
- const cardNumberValue = getAttributeValue(customAttributesDetails, "card_number", true);
368
- const rarityValue = getAttributeValue(customAttributesDetails, "card_rarity", true);
369
- const featureValue = getAttributeValue(customAttributesDetails, "card_feature", true);
370
- const conditionValue = getAttributeValue(customAttributesDetails, "card_condition", true);
371
- const foilValue = getAttributeValue(customAttributesDetails, "card_foil", true);
383
+ const preOrder = getAttributeValue(productCardDetailsAttributes, "card_pre_orders", true);
384
+ const preOrderDate = getAttributeValue(productCardDetailsAttributes, "pre_order_date", true);
385
+ const preOrderDeposite = getAttributeValue(productCardDetailsAttributes, "pre_order_deposit", true);
386
+ const preOrderNote = getAttributeValue(productCardDetailsAttributes, "pre_order_notes", true);
387
+ const preOrderPaymentType = getAttributeValue(productCardDetailsAttributes, "pre_order_payment_type", true);
388
+ const releaseDate = getAttributeValue(productCardDetailsAttributes, "release_date", true);
389
+ const setNameValue = getAttributeValue(productCardDetailsAttributes, "card_set", true);
390
+ const cardNameValue = getAttributeValue(productCardDetailsAttributes, "card_name", true);
391
+ const cardNumberValue = getAttributeValue(productCardDetailsAttributes, "card_number", true);
392
+ const rarityValue = getAttributeValue(productCardDetailsAttributes, "card_rarity", true);
393
+ const featureValue = getAttributeValue(productCardDetailsAttributes, "card_feature", true);
394
+ const conditionValue = getAttributeValue(productCardDetailsAttributes, "card_condition", true);
395
+ const foilValue = getAttributeValue(productCardDetailsAttributes, "card_foil", true);
372
396
 
373
397
  const isPreOrderProduct = typeof preOrder === 'string'
374
398
  ? preOrder.trim().toLowerCase() === 'pre orders'
@@ -729,7 +753,7 @@ const ProductFullDetail = props => {
729
753
  <section className='right_left-container w-full'>
730
754
  <ExpandableSection>
731
755
  <div className="text-sm leading-6 leading-[2.5rem]">
732
- {setNameValue && (
756
+ {/* {setNameValue && (
733
757
  <p><strong>Set Name:</strong> {setNameValue}</p>
734
758
  )}
735
759
  {cardNameValue && (
@@ -749,7 +773,12 @@ const ProductFullDetail = props => {
749
773
  )}
750
774
  {foilValue && (
751
775
  <p><strong>Foil/Non Foil:</strong> {foilValue}</p>
752
- )}
776
+ )} */}
777
+ {/* <div className={cn(contentContainerClass, classes.contentContainerTabOverride)}> */}
778
+ <ProductCardDetails
779
+ customAttributes={productCardDetailsAttributes.list}
780
+ />
781
+ {/* </div> */}
753
782
  </div>
754
783
  </ExpandableSection>
755
784
  </section>
@@ -33,6 +33,7 @@ export const GET_CATEGORY_CONTENT = gql`
33
33
  allowed_filters {
34
34
  code
35
35
  }
36
+ prefixes
36
37
  custom_subcategory {
37
38
  name
38
39
  path
@@ -34,6 +34,7 @@ export const GET_CATEGORY_CONTENT = gql`
34
34
  allowed_filters {
35
35
  code
36
36
  }
37
+ prefixes
37
38
  custom_subcategory {
38
39
  name
39
40
  path
@@ -1 +0,0 @@
1
- export { default } from './relatedProducts';
@@ -1,44 +0,0 @@
1
- import React, { Fragment } from 'react';
2
- import { FormattedMessage } from 'react-intl';
3
- import { useRelatedProducts } from '@riosst100/pwa-marketplace/src/talons/RelatedProducts/useRelatedProducts';
4
- import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
5
- import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
6
- import mapSeller from '@riosst100/pwa-marketplace/src/util/mapSeller';
7
- import SellerDetail from '@riosst100/pwa-marketplace/src/components/SellerDetail/sellerDetail';
8
-
9
- const RelatedProducts = props => {
10
- const { categoryUrlKey } = props;
11
-
12
- const talonProps = useRelatedProducts({
13
- mapSeller
14
- });
15
-
16
- const { error, loading, seller } = talonProps;
17
-
18
- if (loading && !seller)
19
- return '';
20
- // return <SellerShimmer />;
21
- if (error && !seller) return <ErrorView />;
22
- if (!seller) {
23
- return (
24
- <h1>
25
- <FormattedMessage
26
- id={'seller.notFound'}
27
- defaultMessage={
28
- 'Seller Not Found.'
29
- }
30
- />
31
- </h1>
32
- );
33
- }
34
-
35
- return (
36
- <Fragment>
37
- <StoreTitle>{seller.name}</StoreTitle>
38
- <Meta name="description" content={seller.description} />
39
- {seller && <SellerDetail seller={seller} />}
40
- </Fragment>
41
- );
42
- };
43
-
44
- export default RelatedProducts;
@@ -1,112 +0,0 @@
1
- import { useQuery } from '@apollo/client';
2
- import { useEffect, useMemo } from 'react';
3
- import { useLocation } from 'react-router-dom';
4
- import { useAppContext } from '@magento/peregrine/lib/context/app';
5
- import { useIntl } from 'react-intl';
6
-
7
- import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
8
- import DEFAULT_OPERATIONS from './relatedProducts.gql';
9
-
10
- export const useRelatedProducts = props => {
11
- const { mapSeller } = props;
12
-
13
- const { formatMessage } = useIntl();
14
-
15
- const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
16
- const { getStoreConfigData, getSellerDetailQuery, getCouponCodeQuery } = operations;
17
- const { pathname } = useLocation();
18
- const [
19
- ,
20
- {
21
- actions: { setPageLoading }
22
- }
23
- ] = useAppContext();
24
-
25
- const { data: storeConfigData } = useQuery(getStoreConfigData, {
26
- fetchPolicy: 'cache-and-network',
27
- nextFetchPolicy: 'cache-first'
28
- });
29
-
30
- const slug = pathname.split('/')[2];
31
- const productUrlSuffix = storeConfigData?.storeConfig?.product_url_suffix;
32
- const urlKey = productUrlSuffix ? slug.replace(productUrlSuffix, '') : slug;
33
-
34
- const getOtherInfo = true;
35
- const getProducts = true;
36
-
37
- const { error, loading, data } = useQuery(getSellerDetailQuery, {
38
- fetchPolicy: 'cache-and-network',
39
- nextFetchPolicy: 'cache-first',
40
- skip: !storeConfigData,
41
- variables: {
42
- urlKey,
43
- getOtherInfo,
44
- getProducts
45
- }
46
- });
47
-
48
- const {
49
- data: couponData,
50
- error: couponError,
51
- loading: couponLoading
52
- } = useQuery(getCouponCodeQuery, {
53
- fetchPolicy: 'cache-and-network',
54
- nextFetchPolicy: 'cache-first',
55
- variables: {
56
- sellerUrl: urlKey,
57
- pageSize: 20,
58
- currentPage: 1,
59
- filters: {
60
- is_public: {
61
- eq: '1'
62
- }
63
- }
64
- },
65
- skip: !urlKey
66
- });
67
-
68
- const isBackgroundLoading = !!data && loading;
69
-
70
- const seller = useMemo(() => {
71
- if (!data) {
72
- return null;
73
- }
74
-
75
- const seller = data.sellerByUrl;
76
-
77
- if (!seller) {
78
- return null;
79
- }
80
-
81
- return mapSeller(seller);
82
- }, [data, mapSeller, urlKey]);
83
-
84
- // Update the page indicator if the GraphQL query is in flight.
85
- useEffect(() => {
86
- setPageLoading(isBackgroundLoading);
87
- }, [isBackgroundLoading, setPageLoading]);
88
-
89
- const favoriteSellerOptions = useMemo(() => {
90
- const options = {
91
- seller_id: seller?.seller_id
92
- };
93
-
94
- return options;
95
- }, [seller]);
96
-
97
- const favoriteSellerButtonProps = {
98
- buttonText: '',
99
- item: favoriteSellerOptions,
100
- storeConfig: storeConfigData ? storeConfigData.storeConfig : {}
101
- };
102
-
103
- return {
104
- error,
105
- loading,
106
- seller,
107
- favoriteSellerButtonProps,
108
- couponData,
109
- couponError,
110
- couponLoading
111
- };
112
- };