@riosst100/pwa-marketplace 2.4.4 → 2.4.6
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/i18n/en_US.json +509 -508
- package/i18n/id_ID.json +1 -1
- package/package.json +1 -1
- package/src/componentOverrideMapping.js +1 -0
- package/src/overwrites/peregrine/lib/talons/CartPage/PriceSummary/priceSummary.gql.js +42 -0
- package/src/overwrites/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js +170 -0
- package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +13 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js +6 -75
- package/src/overwrites/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.module.css +4 -2
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListing/product.js +1 -1
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListing/product.module.css +1 -1
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListing/productListing.js +45 -24
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/product.js +278 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/product.module.css +156 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/productListingBySeller.js +125 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/productListingBySeller.module.css +33 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/cartPage.js +11 -8
- package/src/overwrites/venia-ui/lib/components/CartPage/cartPage.module.css +1 -1
- package/src/overwrites/venia-ui/lib/components/Header/cartTrigger.js +12 -11
- package/src/talons/CartPage/ProductListingBySeller/checkoutBySeller.gql.js +21 -0
- package/src/talons/CartPage/ProductListingBySeller/useProductListingBySeller.js +73 -0
|
@@ -12,6 +12,8 @@ import { GET_ITEM_COUNT_QUERY } from '@magento/venia-ui/lib/components/Header/ca
|
|
|
12
12
|
import cn from 'classnames';
|
|
13
13
|
import { ShoppingCart } from 'iconsax-react';
|
|
14
14
|
import { darkBlue } from '@riosst100/pwa-marketplace/src/theme/vars';
|
|
15
|
+
import { Link } from 'react-router-dom';
|
|
16
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
15
17
|
|
|
16
18
|
const MiniCart = React.lazy(() => import('@magento/venia-ui/lib/components/MiniCart'));
|
|
17
19
|
|
|
@@ -50,8 +52,8 @@ const CartTrigger = props => {
|
|
|
50
52
|
<span
|
|
51
53
|
className={cn(
|
|
52
54
|
classes.counter,
|
|
53
|
-
'bg-yellow-300 min-w-[18px] min-h-[18px] text-base font-regular leading-[18px] top-[-
|
|
54
|
-
'!left-auto right-[
|
|
55
|
+
'bg-yellow-300 min-w-[18px] min-h-[18px] text-base font-regular leading-[18px] top-[-2px]',
|
|
56
|
+
'!left-auto right-[3px]'
|
|
55
57
|
)}
|
|
56
58
|
data-cy="CartTrigger-counter"
|
|
57
59
|
>
|
|
@@ -65,20 +67,19 @@ const CartTrigger = props => {
|
|
|
65
67
|
// and control which one displays via CSS.
|
|
66
68
|
<Fragment>
|
|
67
69
|
<div className={cn(triggerClassName, '!h-auto')} ref={miniCartTriggerRef}>
|
|
68
|
-
<
|
|
69
|
-
aria-expanded={miniCartIsOpen}
|
|
70
|
-
aria-label={buttonAriaLabel}
|
|
70
|
+
<Link
|
|
71
71
|
className={cn(
|
|
72
72
|
classes.trigger,
|
|
73
73
|
'gap-[5px] !min-h-[30px] !h-auto !min-w-[35px] !w-fit !justify-between',
|
|
74
74
|
)}
|
|
75
|
-
|
|
76
|
-
data-cy="CartTrigger-trigger"
|
|
75
|
+
to='/cart'
|
|
77
76
|
>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
<span>
|
|
78
|
+
{/* <Icon src={ShoppingCartIcon} /> */}
|
|
79
|
+
<ShoppingCart size="20" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
|
|
80
|
+
{maybeItemCounter}
|
|
81
|
+
</span>
|
|
82
|
+
</Link>
|
|
82
83
|
</div>
|
|
83
84
|
<button
|
|
84
85
|
aria-expanded={miniCartIsOpen}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const INIT_CHECKOUT_SPLIT_CART_MUTATION = gql`
|
|
4
|
+
mutation InitCheckoutSplitCart(
|
|
5
|
+
$input: SubmitSplitCartInput!
|
|
6
|
+
) {
|
|
7
|
+
initCheckoutSplitCart(
|
|
8
|
+
input: $input
|
|
9
|
+
) {
|
|
10
|
+
id
|
|
11
|
+
parent_id
|
|
12
|
+
quote_id
|
|
13
|
+
is_active
|
|
14
|
+
is_ordered
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
initCheckoutSplitCartMutation: INIT_CHECKOUT_SPLIT_CART_MUTATION
|
|
21
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState, useEffect } from 'react';
|
|
2
|
+
import { useFieldApi } from 'informed';
|
|
3
|
+
import useFieldState from '@magento/peregrine/lib/hooks/hook-wrappers/useInformedFieldStateWrapper';
|
|
4
|
+
import debounce from 'lodash.debounce';
|
|
5
|
+
import { useEventingContext } from '@magento/peregrine/lib/context/eventing';
|
|
6
|
+
import { useMutation } from '@apollo/client';
|
|
7
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
8
|
+
import DEFAULT_OPERATIONS from '@riosst100/pwa-marketplace/src/talons/CartPage/ProductListingBySeller/checkoutBySeller.gql';
|
|
9
|
+
|
|
10
|
+
export const useProductListingBySeller = props => {
|
|
11
|
+
const { initialValue, min, onChange } = props;
|
|
12
|
+
|
|
13
|
+
const operations = mergeOperations(DEFAULT_OPERATIONS, null);
|
|
14
|
+
const {
|
|
15
|
+
initCheckoutSplitCartMutation
|
|
16
|
+
} = operations;
|
|
17
|
+
|
|
18
|
+
const [
|
|
19
|
+
initCheckoutSplitCart,
|
|
20
|
+
{
|
|
21
|
+
loading: initCheckoutSplitCartLoading,
|
|
22
|
+
error: initCheckoutSplitCartError,
|
|
23
|
+
called: initCheckoutSplitCartCalled
|
|
24
|
+
}
|
|
25
|
+
] = useMutation(initCheckoutSplitCartMutation);
|
|
26
|
+
|
|
27
|
+
const [displayError, setDisplayError] = useState(false);
|
|
28
|
+
|
|
29
|
+
const [, { dispatch }] = useEventingContext();
|
|
30
|
+
|
|
31
|
+
const handleSellerToCheckout = useCallback(
|
|
32
|
+
async (sellerUrl, cartId) => {
|
|
33
|
+
try {
|
|
34
|
+
// await initCheckoutSplitCart({
|
|
35
|
+
// variables: {
|
|
36
|
+
// seller_url: sellerUrl,
|
|
37
|
+
// cart_id: cartId
|
|
38
|
+
// }
|
|
39
|
+
// });
|
|
40
|
+
|
|
41
|
+
// const selectedOptions =
|
|
42
|
+
// item.configurable_options?.map(
|
|
43
|
+
// ({ option_label, value_label }) => ({
|
|
44
|
+
// attribute: option_label,
|
|
45
|
+
// value: value_label
|
|
46
|
+
// })
|
|
47
|
+
// ) || null;
|
|
48
|
+
|
|
49
|
+
// dispatch({
|
|
50
|
+
// type: quantity ? 'CART_UPDATE_ITEM' : 'CART_REMOVE_ITEM',
|
|
51
|
+
// payload: {
|
|
52
|
+
// cartId,
|
|
53
|
+
// sku: item.product.sku,
|
|
54
|
+
// name: item.product.name,
|
|
55
|
+
// priceTotal: item.prices.price.value,
|
|
56
|
+
// currencyCode: item.prices.price.currency,
|
|
57
|
+
// discountAmount: item.prices.total_item_discount.value,
|
|
58
|
+
// selectedOptions,
|
|
59
|
+
// quantity: quantity || item.quantity
|
|
60
|
+
// }
|
|
61
|
+
// });
|
|
62
|
+
} catch (err) {
|
|
63
|
+
// Make sure any errors from the mutation are displayed.
|
|
64
|
+
setDisplayError(true);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[dispatch, initCheckoutSplitCart]
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
handleSellerToCheckout
|
|
72
|
+
};
|
|
73
|
+
};
|