@riosst100/pwa-marketplace 2.9.5 → 2.9.7
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 +5 -1
- package/src/components/LiveChat/chatContent.js +28 -13
- package/src/components/OrderDetail/components/rmaList.js +80 -88
- package/src/components/OrderDetail/orderDetail.js +142 -39
- package/src/components/RMAPage/RMACreate.js +295 -115
- package/src/components/RMAPage/RMADetail.js +243 -154
- package/src/components/RMAPage/RMAList.js +38 -57
- package/src/components/RMAPage/components/productItem.js +76 -26
- package/src/components/RMAPage/orderRow.js +120 -254
- package/src/components/commons/Select/index.js +6 -2
- package/src/overwrites/peregrine/lib/talons/CheckoutPage/PaymentInformation/paymentMethods.gql.js +45 -0
- package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/orderHistoryPage.gql.js +1 -0
- package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/orderRow.gql.js +46 -0
- package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/useOrderRow.js +112 -0
- package/src/overwrites/peregrine/lib/talons/RMAPage/rmaPage.gql.js +202 -0
- package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.js +111 -46
- package/src/talons/RMAPage/useRmaPage.js +179 -0
|
@@ -7,8 +7,8 @@ import { shape, string } from 'prop-types';
|
|
|
7
7
|
import { Form } from 'informed';
|
|
8
8
|
|
|
9
9
|
import { useToasts } from '@magento/peregrine/lib/Toasts';
|
|
10
|
-
import OrderHistoryContextProvider from '@magento/peregrine/lib/talons/OrderHistoryPage/orderHistoryContext';
|
|
11
|
-
import {
|
|
10
|
+
// import OrderHistoryContextProvider from '@magento/peregrine/lib/talons/OrderHistoryPage/orderHistoryContext';
|
|
11
|
+
import { useRmaPage } from '@riosst100/pwa-marketplace/src/talons/RMAPage/useRmaPage';
|
|
12
12
|
|
|
13
13
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
14
14
|
import Button from '@magento/venia-ui/lib/components/Button';
|
|
@@ -16,9 +16,9 @@ import Icon from '@magento/venia-ui/lib/components/Icon';
|
|
|
16
16
|
import LoadingIndicator from '@magento/venia-ui/lib/components/LoadingIndicator';
|
|
17
17
|
import { StoreTitle } from '@magento/venia-ui/lib/components/Head';
|
|
18
18
|
import TextInput from '@magento/venia-ui/lib/components/TextInput';
|
|
19
|
-
|
|
19
|
+
import Pagination from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Pagination';
|
|
20
20
|
import defaultClasses from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.module.css';
|
|
21
|
-
import
|
|
21
|
+
import RmaRow from './orderRow';
|
|
22
22
|
import ResetButton from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/OrderHistoryPage/resetButton';
|
|
23
23
|
import { SearchNormal } from 'iconsax-react';
|
|
24
24
|
import cn from 'classnames';
|
|
@@ -34,17 +34,21 @@ const errorIcon = (
|
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
const RMAList = props => {
|
|
37
|
-
const talonProps =
|
|
37
|
+
const talonProps = useRmaPage();
|
|
38
38
|
const {
|
|
39
39
|
errorMessage,
|
|
40
|
-
|
|
40
|
+
loadMoreRmas,
|
|
41
41
|
handleReset,
|
|
42
42
|
handleSubmit,
|
|
43
43
|
isBackgroundLoading,
|
|
44
44
|
isLoadingWithoutData,
|
|
45
|
-
|
|
45
|
+
rmas,
|
|
46
46
|
pageInfo,
|
|
47
|
-
searchText
|
|
47
|
+
searchText,
|
|
48
|
+
pageControl,
|
|
49
|
+
rmaDetailData,
|
|
50
|
+
rmaDetailLoading,
|
|
51
|
+
rmaDetailError
|
|
48
52
|
} = talonProps;
|
|
49
53
|
const [, { addToast }] = useToasts();
|
|
50
54
|
const { formatMessage } = useIntl();
|
|
@@ -61,33 +65,33 @@ const RMAList = props => {
|
|
|
61
65
|
|
|
62
66
|
const classes = useStyle(defaultClasses, props.classes);
|
|
63
67
|
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
return <
|
|
68
|
+
const rmaRows = useMemo(() => {
|
|
69
|
+
return rmas.map(rma => {
|
|
70
|
+
return <RmaRow key={rma.rma_id} rma={rma} />;
|
|
67
71
|
});
|
|
68
|
-
}, [
|
|
72
|
+
}, [rmas]);
|
|
69
73
|
|
|
70
74
|
const pageContents = useMemo(() => {
|
|
71
75
|
if (isLoadingWithoutData) {
|
|
72
76
|
return <LoadingIndicator />;
|
|
73
|
-
} else if (!isBackgroundLoading && searchText && !
|
|
77
|
+
} else if (!isBackgroundLoading && searchText && !rmas.length) {
|
|
74
78
|
return (
|
|
75
79
|
<h3 className={classes.emptyHistoryMessage}>
|
|
76
80
|
<FormattedMessage
|
|
77
|
-
id={'
|
|
78
|
-
defaultMessage={`Order "${searchText}" was not found.`}
|
|
81
|
+
id={'rmaPage.invalidOrderNumber'}
|
|
82
|
+
defaultMessage={`RMA for Order "${searchText}" was not found.`}
|
|
79
83
|
values={{
|
|
80
84
|
number: searchText
|
|
81
85
|
}}
|
|
82
86
|
/>
|
|
83
87
|
</h3>
|
|
84
88
|
);
|
|
85
|
-
} else if (!isBackgroundLoading && !
|
|
89
|
+
} else if (!isBackgroundLoading && !rmas.length) {
|
|
86
90
|
return (
|
|
87
91
|
<h3 className={classes.emptyHistoryMessage}>
|
|
88
92
|
<FormattedMessage
|
|
89
|
-
id={'
|
|
90
|
-
defaultMessage={"You don't have any
|
|
93
|
+
id={'rmaPage.emptyDataMessage'}
|
|
94
|
+
defaultMessage={"You don't have any RMA requests yet."}
|
|
91
95
|
/>
|
|
92
96
|
</h3>
|
|
93
97
|
);
|
|
@@ -95,9 +99,9 @@ const RMAList = props => {
|
|
|
95
99
|
return (
|
|
96
100
|
<ul
|
|
97
101
|
className={classes.orderHistoryTable}
|
|
98
|
-
data-cy="
|
|
102
|
+
data-cy="RMAPage-rmaTable"
|
|
99
103
|
>
|
|
100
|
-
{
|
|
104
|
+
{rmaRows}
|
|
101
105
|
</ul>
|
|
102
106
|
);
|
|
103
107
|
}
|
|
@@ -106,8 +110,8 @@ const RMAList = props => {
|
|
|
106
110
|
classes.orderHistoryTable,
|
|
107
111
|
isBackgroundLoading,
|
|
108
112
|
isLoadingWithoutData,
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
rmaRows,
|
|
114
|
+
rmas.length,
|
|
111
115
|
searchText
|
|
112
116
|
]);
|
|
113
117
|
|
|
@@ -127,24 +131,20 @@ const RMAList = props => {
|
|
|
127
131
|
/>
|
|
128
132
|
) : null;
|
|
129
133
|
|
|
130
|
-
const loadMoreButton =
|
|
134
|
+
const loadMoreButton = loadMoreRmas ? (
|
|
131
135
|
<Button
|
|
132
136
|
classes={{ root_lowPriority: classes.loadMoreButton }}
|
|
133
137
|
disabled={isBackgroundLoading || isLoadingWithoutData}
|
|
134
|
-
onClick={
|
|
138
|
+
onClick={loadMoreRmas}
|
|
135
139
|
priority="low"
|
|
136
140
|
>
|
|
137
141
|
<FormattedMessage
|
|
138
|
-
id={'
|
|
142
|
+
id={'rmaPage.loadMore'}
|
|
139
143
|
defaultMessage={'Load More'}
|
|
140
144
|
/>
|
|
141
145
|
</Button>
|
|
142
146
|
) : null;
|
|
143
147
|
|
|
144
|
-
const gotoSelectRMA = () => {
|
|
145
|
-
history.push('/return/select')
|
|
146
|
-
}
|
|
147
|
-
|
|
148
148
|
useEffect(() => {
|
|
149
149
|
if (errorMessage) {
|
|
150
150
|
addToast({
|
|
@@ -158,8 +158,7 @@ const RMAList = props => {
|
|
|
158
158
|
}, [addToast, errorMessage]);
|
|
159
159
|
|
|
160
160
|
return (
|
|
161
|
-
<
|
|
162
|
-
<div className="grid gap-y-md">
|
|
161
|
+
<div className="grid gap-y-md">
|
|
163
162
|
<StoreTitle>{PAGE_TITLE}</StoreTitle>
|
|
164
163
|
<div aria-live="polite" className="text-xl font-medium text-left">
|
|
165
164
|
{PAGE_TITLE}
|
|
@@ -196,34 +195,16 @@ const RMAList = props => {
|
|
|
196
195
|
</Form>
|
|
197
196
|
<span className={classes.pageInfo}>{pageInfoLabel}</span>
|
|
198
197
|
</div>
|
|
199
|
-
<div className='flex justify-end w-full'>
|
|
200
|
-
<Button
|
|
201
|
-
priority='high'
|
|
202
|
-
classes={{
|
|
203
|
-
content: "flex justify-center gap-x-2.5 items-center text-[14px] font-medium capitalize"
|
|
204
|
-
}}
|
|
205
|
-
className={cn(
|
|
206
|
-
"bg-blue-600 px-6 py-2 rounded-md text-white border ",
|
|
207
|
-
"border-blue-600 hover_bg-blue-700 hover_border-blue-700 focus-visible_outline-none"
|
|
208
|
-
)}
|
|
209
|
-
onClick={gotoSelectRMA}
|
|
210
|
-
>
|
|
211
|
-
<span className='flex gap-x-3 justify-center'>
|
|
212
|
-
{
|
|
213
|
-
formatMessage({
|
|
214
|
-
id: 'RMA.newReturn',
|
|
215
|
-
defaultMessage: 'New Return'
|
|
216
|
-
})
|
|
217
|
-
}
|
|
218
|
-
</span>
|
|
219
|
-
</Button>
|
|
220
|
-
</div>
|
|
221
198
|
{pageContents}
|
|
199
|
+
<div className="mt-4">
|
|
200
|
+
{pageControl?.totalPages > 1 ? (
|
|
201
|
+
<Pagination pageControl={pageControl} />
|
|
202
|
+
) : null}
|
|
203
|
+
</div>
|
|
222
204
|
{loadMoreButton}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
};
|
|
205
|
+
</div>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
227
208
|
|
|
228
209
|
export default RMAList;
|
|
229
210
|
|
|
@@ -1,39 +1,68 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import Image from '@magento/venia-ui/lib/components/Image';
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
4
|
import Select from '@riosst100/pwa-marketplace/src/components/commons/Select';
|
|
5
5
|
import TextField from '@riosst100/pwa-marketplace/src/components/commons/Textfield';
|
|
6
6
|
import Checkbox from '@riosst100/pwa-marketplace/src/components/commons/Checkbox';
|
|
7
7
|
|
|
8
|
-
const productItem = (props) => {
|
|
9
|
-
const { withCheckbox = false } = props
|
|
10
|
-
const urlImage = 'https://pwa-tcgcollective.local:8255/media/catalog/product/s/-/s-l1600_6__1.jpg?auto=webp&format=pjpg&width=495&height=618.75&fit=cover';
|
|
11
|
-
const reasonOptions = [
|
|
12
|
-
{
|
|
13
|
-
value: 0,
|
|
14
|
-
label: 'Out of Service'
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
const productItem = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
withCheckbox = false,
|
|
12
|
+
item,
|
|
13
|
+
order,
|
|
14
|
+
rmaConfigData,
|
|
15
|
+
itemState = {},
|
|
16
|
+
onItemChange,
|
|
17
|
+
onItemCheck
|
|
18
|
+
} = props;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
let urlImage = undefined;
|
|
21
|
+
if (item && typeof item.product_image === 'string' && item.product_image.length > 0) {
|
|
22
|
+
urlImage = item.product_image;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const reasonOptions = rmaConfigData && rmaConfigData?.lofmpRmaConfigurations && rmaConfigData?.lofmpRmaConfigurations?.reasons
|
|
26
|
+
? rmaConfigData?.lofmpRmaConfigurations?.reasons.map(r => ({ value: r.id, label: r.name }))
|
|
27
|
+
: [];
|
|
28
|
+
const conditionOptions = rmaConfigData && rmaConfigData?.lofmpRmaConfigurations && rmaConfigData?.lofmpRmaConfigurations?.conditions
|
|
29
|
+
? rmaConfigData?.lofmpRmaConfigurations?.conditions.map(c => ({ value: c.id, label: c.name }))
|
|
30
|
+
: [];
|
|
31
|
+
const resolutionOptions = rmaConfigData && rmaConfigData?.lofmpRmaConfigurations && rmaConfigData?.lofmpRmaConfigurations?.resolutions
|
|
32
|
+
? rmaConfigData?.lofmpRmaConfigurations?.resolutions.map(res => ({ value: res.id, label: res.name }))
|
|
33
|
+
: [];
|
|
34
|
+
|
|
35
|
+
// Checkbox handler
|
|
36
|
+
const handleCheck = (e) => {
|
|
37
|
+
if (onItemCheck) onItemCheck(e.target.checked);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// Input change handler with qty_requested validation
|
|
42
|
+
const handleFieldChange = (field, value) => {
|
|
43
|
+
if (field === 'qty_requested' && item && item.quantity_ordered) {
|
|
44
|
+
if (value > item.quantity_ordered) {
|
|
45
|
+
value = item.quantity_ordered;
|
|
46
|
+
}
|
|
47
|
+
if (value < 1) {
|
|
48
|
+
value = 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (onItemChange) onItemChange(field, value);
|
|
52
|
+
};
|
|
53
|
+
|
|
25
54
|
return (
|
|
26
55
|
<>
|
|
27
56
|
<div className='item flex flex-col lg_flex-row justify-between border border-gray-100 rounded-md p-4'>
|
|
28
57
|
<div className='flex gap-4 w-full lg_w-3/5'>
|
|
29
58
|
{withCheckbox ? (
|
|
30
|
-
<Checkbox onChange={
|
|
59
|
+
<Checkbox onChange={handleCheck} checked={!!itemState.checked} />
|
|
31
60
|
) : null}
|
|
32
61
|
|
|
33
62
|
<div className='flex w-full gap-4'>
|
|
34
63
|
<div className='block'>
|
|
35
64
|
<Image
|
|
36
|
-
alt='product image'
|
|
65
|
+
alt={item && item.product_name ? item.product_name : 'product image'}
|
|
37
66
|
className="relative max-w-[120px]"
|
|
38
67
|
src={urlImage}
|
|
39
68
|
classes={{
|
|
@@ -45,36 +74,51 @@ const productItem = (props) => {
|
|
|
45
74
|
<div className='block'>
|
|
46
75
|
<p className='text-[13px] text-colorDefault flex justify-between'>
|
|
47
76
|
<span className='font-medium block'>
|
|
48
|
-
|
|
77
|
+
{item && item.product_name ? item.product_name : '-'}
|
|
49
78
|
</span>
|
|
50
79
|
</p>
|
|
51
80
|
</div>
|
|
52
81
|
<div className='block'>
|
|
53
82
|
<p className='text-[13px] text-gray-200 flex justify-between'>
|
|
54
83
|
<span className='font-normal block'>
|
|
55
|
-
Qty :
|
|
84
|
+
Qty : {item && item.quantity_ordered ? item.quantity_ordered : '-'}
|
|
56
85
|
</span>
|
|
57
86
|
</p>
|
|
58
87
|
</div>
|
|
59
88
|
<div className='block'>
|
|
60
89
|
<p className='text-[13px] text-gray-200 flex justify-between'>
|
|
61
90
|
<span className='font-normal block'>
|
|
62
|
-
|
|
91
|
+
{item && item.product_sale_price && item.product_sale_price.currency ? item.product_sale_price.currency : ''} {item && item.product_sale_price && item.product_sale_price.value ? item.product_sale_price.value : '-'}
|
|
63
92
|
</span>
|
|
64
93
|
</p>
|
|
65
94
|
</div>
|
|
66
95
|
</div>
|
|
67
|
-
|
|
68
96
|
</div>
|
|
69
97
|
</div>
|
|
70
98
|
<div className='block w-full lg_w-2/5'>
|
|
71
|
-
{
|
|
99
|
+
{!!itemState.checked ? (
|
|
72
100
|
<>
|
|
73
101
|
<div className='flex flex-col mb-2.5'>
|
|
74
102
|
<p className='mb-1'>
|
|
75
103
|
Qty Return
|
|
76
104
|
</p>
|
|
77
|
-
<TextField
|
|
105
|
+
<TextField
|
|
106
|
+
value={
|
|
107
|
+
itemState.qty_requested > item.quantity_ordered
|
|
108
|
+
? item.quantity_ordered
|
|
109
|
+
: itemState.qty_requested || ''
|
|
110
|
+
}
|
|
111
|
+
onChange={e => {
|
|
112
|
+
let val = parseFloat(e.target.value);
|
|
113
|
+
if (isNaN(val)) val = '';
|
|
114
|
+
if (val > item.quantity_ordered) val = item.quantity_ordered;
|
|
115
|
+
if (val < 1 && val !== '') val = 1;
|
|
116
|
+
handleFieldChange('qty_requested', val);
|
|
117
|
+
}}
|
|
118
|
+
type="number"
|
|
119
|
+
min={1}
|
|
120
|
+
max={item.quantity_ordered}
|
|
121
|
+
/>
|
|
78
122
|
</div>
|
|
79
123
|
<div className='flex flex-col mb-2.5'>
|
|
80
124
|
<p className='mb-1'>
|
|
@@ -83,6 +127,8 @@ const productItem = (props) => {
|
|
|
83
127
|
<Select
|
|
84
128
|
options={reasonOptions}
|
|
85
129
|
className='w-full'
|
|
130
|
+
value={itemState.reason_id !== undefined && itemState.reason_id !== null ? itemState.reason_id : ''}
|
|
131
|
+
onChange={e => handleFieldChange('reason_id', e.target.value)}
|
|
86
132
|
/>
|
|
87
133
|
</div>
|
|
88
134
|
<div className='flex flex-col mb-2.5'>
|
|
@@ -90,8 +136,10 @@ const productItem = (props) => {
|
|
|
90
136
|
Item Condition
|
|
91
137
|
</p>
|
|
92
138
|
<Select
|
|
93
|
-
options={
|
|
139
|
+
options={conditionOptions}
|
|
94
140
|
className='w-full'
|
|
141
|
+
value={itemState.condition_id !== undefined && itemState.condition_id !== null ? itemState.condition_id : ''}
|
|
142
|
+
onChange={e => handleFieldChange('condition_id', e.target.value)}
|
|
95
143
|
/>
|
|
96
144
|
</div>
|
|
97
145
|
<div className='flex flex-col mb-2.5'>
|
|
@@ -99,8 +147,10 @@ const productItem = (props) => {
|
|
|
99
147
|
Resolution
|
|
100
148
|
</p>
|
|
101
149
|
<Select
|
|
102
|
-
options={
|
|
150
|
+
options={resolutionOptions}
|
|
103
151
|
className='w-full'
|
|
152
|
+
value={itemState.resolution_id !== undefined && itemState.resolution_id !== null ? itemState.resolution_id : ''}
|
|
153
|
+
onChange={e => handleFieldChange('resolution_id', e.target.value)}
|
|
104
154
|
/>
|
|
105
155
|
</div>
|
|
106
156
|
</>
|
|
@@ -108,7 +158,7 @@ const productItem = (props) => {
|
|
|
108
158
|
</div>
|
|
109
159
|
</div>
|
|
110
160
|
</>
|
|
111
|
-
)
|
|
112
|
-
}
|
|
161
|
+
);
|
|
162
|
+
};
|
|
113
163
|
|
|
114
164
|
export default productItem
|