@riosst100/pwa-marketplace 3.2.7 → 3.2.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.
- package/package.json +1 -1
- package/src/components/LiveChat/MessagesModal.js +33 -146
- package/src/components/LiveChat/liveChat.js +12 -42
- package/src/components/Messages/index.js +1 -0
- package/src/components/Messages/messages.js +352 -0
- package/src/components/Messages/messages.module.css +36 -0
- package/src/components/Messages/messagesPage.js +345 -0
- package/src/components/MessagesPage/index.js +1 -0
- package/src/components/MessagesPage/messagesPage.js +50 -0
- package/src/components/MessagesPage/messagesPage.module.css +35 -0
- package/src/components/RFQPage/quoteDetail.js +39 -14
- package/src/intercept.js +7 -0
- package/src/overwrites/venia-ui/lib/components/Footer/footer.js +12 -3
- package/src/talons/Messages/useMessages.js +0 -0
- package/src/talons/MessagesPage/messagesPage.gql.js +299 -0
- package/src/talons/MessagesPage/useMessagesPage.js +87 -0
- package/src/talons/RFQ/rfq.gql.js +13 -0
- package/src/talons/Seller/useSeller.js +4 -2
- package/src/talons/SellerMegaMenu/useSellerMegaMenu.js +0 -11
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_STORE_CONFIG_DATA = gql`
|
|
4
|
+
query getStoreConfigData {
|
|
5
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
6
|
+
storeConfig {
|
|
7
|
+
store_code
|
|
8
|
+
product_url_suffix
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const GET_SELLER_DETAIL_QUERY = gql`
|
|
14
|
+
query getSellerDetailForSellerPage($urlKey: String!, $getOtherInfo: Boolean, $getProducts: Boolean) {
|
|
15
|
+
sellerByUrl(seller_url: $urlKey, get_other_info: $getOtherInfo, get_products: $getProducts) {
|
|
16
|
+
seller_id
|
|
17
|
+
contact_number
|
|
18
|
+
shop_title
|
|
19
|
+
company
|
|
20
|
+
term_and_conditions
|
|
21
|
+
website_url
|
|
22
|
+
ship_to
|
|
23
|
+
ship_to_country
|
|
24
|
+
seller_rates {
|
|
25
|
+
total_count
|
|
26
|
+
page_info {
|
|
27
|
+
current_page
|
|
28
|
+
page_size
|
|
29
|
+
total_pages
|
|
30
|
+
}
|
|
31
|
+
items {
|
|
32
|
+
rating_id
|
|
33
|
+
seller_id
|
|
34
|
+
customer_id
|
|
35
|
+
rate1
|
|
36
|
+
rate2
|
|
37
|
+
rate3
|
|
38
|
+
rate4
|
|
39
|
+
rate5
|
|
40
|
+
rating
|
|
41
|
+
email
|
|
42
|
+
title
|
|
43
|
+
status
|
|
44
|
+
detail
|
|
45
|
+
nickname
|
|
46
|
+
created_at
|
|
47
|
+
verified_buyer
|
|
48
|
+
is_recommended
|
|
49
|
+
is_hidden
|
|
50
|
+
answer
|
|
51
|
+
admin_note
|
|
52
|
+
like_about
|
|
53
|
+
not_like_about
|
|
54
|
+
guest_email
|
|
55
|
+
plus_review
|
|
56
|
+
minus_review
|
|
57
|
+
report_abuse
|
|
58
|
+
country
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
products {
|
|
62
|
+
total_count
|
|
63
|
+
page_info {
|
|
64
|
+
current_page
|
|
65
|
+
page_size
|
|
66
|
+
total_pages
|
|
67
|
+
}
|
|
68
|
+
items {
|
|
69
|
+
name
|
|
70
|
+
sku
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
operating_hours {
|
|
74
|
+
day
|
|
75
|
+
status
|
|
76
|
+
time {
|
|
77
|
+
opening_time
|
|
78
|
+
closing_time
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
store_locators {
|
|
82
|
+
name
|
|
83
|
+
country
|
|
84
|
+
region
|
|
85
|
+
address_line_1
|
|
86
|
+
address_line_2
|
|
87
|
+
city
|
|
88
|
+
postcode
|
|
89
|
+
operating_hours {
|
|
90
|
+
day
|
|
91
|
+
status
|
|
92
|
+
time {
|
|
93
|
+
opening_time
|
|
94
|
+
closing_time
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
description
|
|
99
|
+
country
|
|
100
|
+
image
|
|
101
|
+
thumbnail
|
|
102
|
+
city
|
|
103
|
+
region
|
|
104
|
+
group
|
|
105
|
+
group_id
|
|
106
|
+
url
|
|
107
|
+
email
|
|
108
|
+
name
|
|
109
|
+
sale
|
|
110
|
+
creation_time
|
|
111
|
+
page_layout
|
|
112
|
+
status
|
|
113
|
+
position
|
|
114
|
+
twitter_id
|
|
115
|
+
facebook_id
|
|
116
|
+
gplus_id
|
|
117
|
+
youtube_id
|
|
118
|
+
vimeo_id
|
|
119
|
+
instagram_id
|
|
120
|
+
pinterest_id
|
|
121
|
+
linkedin_id
|
|
122
|
+
tw_active
|
|
123
|
+
fb_active
|
|
124
|
+
gplus_active
|
|
125
|
+
vimeo_active
|
|
126
|
+
instagram_active
|
|
127
|
+
pinterest_active
|
|
128
|
+
linkedin_active
|
|
129
|
+
banner_pic
|
|
130
|
+
shop_url
|
|
131
|
+
url_key
|
|
132
|
+
logo_pic
|
|
133
|
+
verify_status
|
|
134
|
+
product_count
|
|
135
|
+
telephone
|
|
136
|
+
creation_time
|
|
137
|
+
update_time
|
|
138
|
+
country_id
|
|
139
|
+
total_sold
|
|
140
|
+
operating_time
|
|
141
|
+
order_processing_time
|
|
142
|
+
shipping_partners
|
|
143
|
+
offers
|
|
144
|
+
benefits
|
|
145
|
+
product_shipping_info
|
|
146
|
+
prepare_time
|
|
147
|
+
response_ratio
|
|
148
|
+
response_time
|
|
149
|
+
store_id
|
|
150
|
+
products {
|
|
151
|
+
total_count
|
|
152
|
+
page_info {
|
|
153
|
+
page_size
|
|
154
|
+
current_page
|
|
155
|
+
}
|
|
156
|
+
items {
|
|
157
|
+
id
|
|
158
|
+
name
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
164
|
+
|
|
165
|
+
export const GET_COUPON_CODE_QUERY = gql`
|
|
166
|
+
query getSellerCoupons(
|
|
167
|
+
$sellerUrl: String!
|
|
168
|
+
$pageSize: Int
|
|
169
|
+
$currentPage: Int
|
|
170
|
+
$filters: CouponCodeFilterInput
|
|
171
|
+
) {
|
|
172
|
+
sellerCoupons(
|
|
173
|
+
sellerUrl: $sellerUrl
|
|
174
|
+
pageSize: $pageSize
|
|
175
|
+
currentPage: $currentPage
|
|
176
|
+
filters: $filters
|
|
177
|
+
) {
|
|
178
|
+
items {
|
|
179
|
+
code
|
|
180
|
+
coupon_id
|
|
181
|
+
couponcode_id
|
|
182
|
+
created_at
|
|
183
|
+
description
|
|
184
|
+
discount_amount
|
|
185
|
+
expiration_date
|
|
186
|
+
from_date
|
|
187
|
+
is_active
|
|
188
|
+
name
|
|
189
|
+
seller_id
|
|
190
|
+
times_used
|
|
191
|
+
to_date
|
|
192
|
+
type
|
|
193
|
+
uses_per_customer
|
|
194
|
+
}
|
|
195
|
+
page_info {
|
|
196
|
+
current_page
|
|
197
|
+
page_size
|
|
198
|
+
total_pages
|
|
199
|
+
}
|
|
200
|
+
total_count
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
204
|
+
|
|
205
|
+
export const GET_CUSTOMER_SELLER_MESSAGES = gql`
|
|
206
|
+
query GetCustomerSellerMessages(
|
|
207
|
+
$pageSize: Int!
|
|
208
|
+
$currentPage: Int!
|
|
209
|
+
$filter: SellerMessageFilterInput
|
|
210
|
+
$sort: SellerMessageSortInput
|
|
211
|
+
) {
|
|
212
|
+
customer {
|
|
213
|
+
sellerMessages(
|
|
214
|
+
pageSize: $pageSize
|
|
215
|
+
currentPage: $currentPage
|
|
216
|
+
filter: $filter
|
|
217
|
+
sort: $sort
|
|
218
|
+
) {
|
|
219
|
+
total_count
|
|
220
|
+
page_info {
|
|
221
|
+
current_page
|
|
222
|
+
page_size
|
|
223
|
+
total_pages
|
|
224
|
+
}
|
|
225
|
+
items {
|
|
226
|
+
message_id
|
|
227
|
+
subject
|
|
228
|
+
description
|
|
229
|
+
sender_email
|
|
230
|
+
sender_name
|
|
231
|
+
created_at
|
|
232
|
+
status
|
|
233
|
+
is_read
|
|
234
|
+
sender_id
|
|
235
|
+
owner_id
|
|
236
|
+
receiver_id
|
|
237
|
+
seller_send
|
|
238
|
+
details(pageSize: 500, currentPage: 1) {
|
|
239
|
+
total_count
|
|
240
|
+
items {
|
|
241
|
+
content
|
|
242
|
+
sender_name
|
|
243
|
+
sender_email
|
|
244
|
+
receiver_name
|
|
245
|
+
is_read
|
|
246
|
+
created_at
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
`;
|
|
254
|
+
|
|
255
|
+
export const CUSTOMER_SEND_MESSAGE_MUTATION = gql`
|
|
256
|
+
mutation CustomerSendMessage($input: CustomerMessageInput!) {
|
|
257
|
+
customerSendMessage(input: $input) {
|
|
258
|
+
message_id
|
|
259
|
+
subject
|
|
260
|
+
description
|
|
261
|
+
sender_name
|
|
262
|
+
sender_email
|
|
263
|
+
created_at
|
|
264
|
+
status
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
`;
|
|
268
|
+
|
|
269
|
+
export const CUSTOMER_REPLY_MESSAGE_MUTATION = gql`
|
|
270
|
+
mutation CUSTOMER_REPLY_MESSAGE_MUTATION($input: ReplyMessageInput!) {
|
|
271
|
+
customerReplyMessage(input: $input) {
|
|
272
|
+
content
|
|
273
|
+
sender_name
|
|
274
|
+
sender_email
|
|
275
|
+
receiver_name
|
|
276
|
+
is_read
|
|
277
|
+
created_at
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
`;
|
|
281
|
+
|
|
282
|
+
export const CUSTOMER_DELETE_MESSAGE_MUTATION = gql`
|
|
283
|
+
mutation CustomerDeleteMessage($id: Int!) {
|
|
284
|
+
customerDeleteMessage(message_id: $id) {
|
|
285
|
+
message
|
|
286
|
+
code
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
`;
|
|
290
|
+
|
|
291
|
+
export default {
|
|
292
|
+
getStoreConfigData: GET_STORE_CONFIG_DATA,
|
|
293
|
+
getSellerDetailQuery: GET_SELLER_DETAIL_QUERY,
|
|
294
|
+
getCouponCodeQuery: GET_COUPON_CODE_QUERY,
|
|
295
|
+
getCustomerSellerMessages: GET_CUSTOMER_SELLER_MESSAGES,
|
|
296
|
+
customerSendMessageMutation: CUSTOMER_SEND_MESSAGE_MUTATION,
|
|
297
|
+
customerReplyMessageMutation: CUSTOMER_REPLY_MESSAGE_MUTATION,
|
|
298
|
+
customerDeleteMessageMutation: CUSTOMER_DELETE_MESSAGE_MUTATION,
|
|
299
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useCallback, useState, useEffect, useMemo } from 'react';
|
|
2
|
+
import { useHistory, useLocation } from 'react-router-dom';
|
|
3
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
4
|
+
import DEFAULT_OPERATIONS from './messagesPage.gql';
|
|
5
|
+
import { useQuery, useMutation } from '@apollo/client';
|
|
6
|
+
import { useToasts } from '@magento/peregrine/lib';
|
|
7
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
8
|
+
|
|
9
|
+
export const useMessagesPage = props => {
|
|
10
|
+
const operations = mergeOperations(DEFAULT_OPERATIONS, null);
|
|
11
|
+
|
|
12
|
+
const [, { addToast }] = useToasts();
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
getCustomerSellerMessages,
|
|
17
|
+
customerSendMessageMutation,
|
|
18
|
+
customerReplyMessageMutation,
|
|
19
|
+
customerDeleteMessageMutation
|
|
20
|
+
} = operations;
|
|
21
|
+
|
|
22
|
+
const [messageListVars] = useState({
|
|
23
|
+
pageSize: 500,
|
|
24
|
+
currentPage: 1,
|
|
25
|
+
filter: undefined,
|
|
26
|
+
sort: undefined
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
data: messagesData,
|
|
31
|
+
loading: messagesLoading,
|
|
32
|
+
error: messagesError,
|
|
33
|
+
refetch: refetchMessages
|
|
34
|
+
} = useQuery(getCustomerSellerMessages, {
|
|
35
|
+
fetchPolicy: 'network-only',
|
|
36
|
+
nextFetchPolicy: 'network-only',
|
|
37
|
+
variables: messageListVars,
|
|
38
|
+
pollInterval: 10000,
|
|
39
|
+
notifyOnNetworkStatusChange: true
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const [sendMessage] = useMutation(customerSendMessageMutation);
|
|
43
|
+
const [replyMessage] = useMutation(customerReplyMessageMutation);
|
|
44
|
+
const [deleteMessage] = useMutation(customerDeleteMessageMutation);
|
|
45
|
+
|
|
46
|
+
const handleSendMessage = async ({ subject, content, seller_url }) => {
|
|
47
|
+
const input = { subject, content, seller_url };
|
|
48
|
+
const result = await sendMessage({ variables: { input }, refetchQueries: [{ query: getCustomerSellerMessages, variables: messageListVars }] });
|
|
49
|
+
addToast({
|
|
50
|
+
type: 'success',
|
|
51
|
+
message: formatMessage({ id: 'messages.messageSent', defaultMessage: 'Message sent successfully.' }),
|
|
52
|
+
timeout: 3000
|
|
53
|
+
});
|
|
54
|
+
await refetchMessages({ fetchPolicy: 'network-only' });
|
|
55
|
+
return result?.data?.customerSendMessage;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleReplyMessage = async ({ message_id, content }) => {
|
|
59
|
+
const input = { message_id, content };
|
|
60
|
+
const result = await replyMessage({ variables: { input }, refetchQueries: [{ query: getCustomerSellerMessages, variables: messageListVars }] });
|
|
61
|
+
addToast({
|
|
62
|
+
type: 'success',
|
|
63
|
+
message: formatMessage({ id: 'messages.replySent', defaultMessage: 'Reply sent successfully.' }),
|
|
64
|
+
timeout: 3000
|
|
65
|
+
});
|
|
66
|
+
await refetchMessages({ fetchPolicy: 'network-only' });
|
|
67
|
+
return result?.data?.customerReplyMessage;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleDeleteMessage = async ({ id }) => {
|
|
71
|
+
await deleteMessage({ variables: { id }, refetchQueries: [{ query: getCustomerSellerMessages, variables: messageListVars }] });
|
|
72
|
+
addToast({
|
|
73
|
+
type: 'success',
|
|
74
|
+
message: formatMessage({ id: 'messages.messageDeleted', defaultMessage: 'Message deleted successfully.' }),
|
|
75
|
+
timeout: 3000
|
|
76
|
+
});
|
|
77
|
+
await refetchMessages({ fetchPolicy: 'network-only' });
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
messagesData,
|
|
82
|
+
messagesLoading,
|
|
83
|
+
handleReplyMessage,
|
|
84
|
+
handleDeleteMessage,
|
|
85
|
+
handleSendMessage
|
|
86
|
+
};
|
|
87
|
+
};
|
|
@@ -70,6 +70,11 @@ export const GET_QUICK_RFQ_LIST_QUERY = gql`
|
|
|
70
70
|
export const GET_QUICK_RFQ_DETAIL_QUERY = gql`
|
|
71
71
|
query getQuickRfqDetail($quickrfqId: Int!) {
|
|
72
72
|
quickrfqDetail(quickrfq_id: $quickrfqId) {
|
|
73
|
+
admin_price {
|
|
74
|
+
currency
|
|
75
|
+
value
|
|
76
|
+
}
|
|
77
|
+
admin_quantity
|
|
73
78
|
attachment
|
|
74
79
|
attachments {
|
|
75
80
|
created_at
|
|
@@ -84,8 +89,11 @@ export const GET_QUICK_RFQ_DETAIL_QUERY = gql`
|
|
|
84
89
|
cart_id
|
|
85
90
|
comment
|
|
86
91
|
contact_name
|
|
92
|
+
coupon_code
|
|
87
93
|
create_date
|
|
94
|
+
date_need_quote
|
|
88
95
|
email
|
|
96
|
+
expiry
|
|
89
97
|
info_buy_request
|
|
90
98
|
messages {
|
|
91
99
|
created_at
|
|
@@ -103,12 +111,17 @@ export const GET_QUICK_RFQ_DETAIL_QUERY = gql`
|
|
|
103
111
|
}
|
|
104
112
|
product_id
|
|
105
113
|
product_name
|
|
114
|
+
product_sku
|
|
106
115
|
quantity
|
|
107
116
|
quickrfq_id
|
|
117
|
+
seller_id
|
|
118
|
+
seller_name
|
|
108
119
|
status
|
|
109
120
|
store_currency_code
|
|
110
121
|
store_id
|
|
111
122
|
update_date
|
|
123
|
+
user_id
|
|
124
|
+
user_name
|
|
112
125
|
website_id
|
|
113
126
|
}
|
|
114
127
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useQuery, useMutation } from '@apollo/client';
|
|
2
2
|
import { useEffect, useMemo, useCallback, useState } from 'react';
|
|
3
3
|
import { useToasts } from '@magento/peregrine/lib/Toasts/useToasts';
|
|
4
|
-
import { useLocation } from 'react-router-dom';
|
|
4
|
+
import { useLocation, useHistory } from 'react-router-dom';
|
|
5
5
|
import { useAppContext } from '@magento/peregrine/lib/context/app';
|
|
6
6
|
import { useIntl } from 'react-intl';
|
|
7
7
|
|
|
@@ -13,6 +13,8 @@ export const useSeller = props => {
|
|
|
13
13
|
|
|
14
14
|
const { formatMessage } = useIntl();
|
|
15
15
|
|
|
16
|
+
const history = useHistory();
|
|
17
|
+
|
|
16
18
|
const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
|
|
17
19
|
const {
|
|
18
20
|
getStoreConfigData,
|
|
@@ -152,7 +154,7 @@ export const useSeller = props => {
|
|
|
152
154
|
}),
|
|
153
155
|
timeout: 3000
|
|
154
156
|
});
|
|
155
|
-
|
|
157
|
+
history.push('/messages');
|
|
156
158
|
return result?.data?.customerSendMessage;
|
|
157
159
|
}, [sendMessage, refetchMessages, addToast, formatMessage]);
|
|
158
160
|
|
|
@@ -208,9 +208,6 @@ export const useSellerMegaMenu = (props = {}) => {
|
|
|
208
208
|
megaMenuData
|
|
209
209
|
);
|
|
210
210
|
|
|
211
|
-
console.log('megaMenuData',megaMenuData)
|
|
212
|
-
console.log('activeCategory',activeCategory)
|
|
213
|
-
|
|
214
211
|
if (activeCategory) {
|
|
215
212
|
setActiveCategoryId(activeCategory.path[0]);
|
|
216
213
|
setActiveCategory(activeCategory);
|
|
@@ -223,8 +220,6 @@ export const useSellerMegaMenu = (props = {}) => {
|
|
|
223
220
|
useEffect(() => {
|
|
224
221
|
const { search, pathname } = location;
|
|
225
222
|
|
|
226
|
-
console.log('category555',category)
|
|
227
|
-
|
|
228
223
|
if (!hasCategoryPath(pathname) && category && category.url_path) {
|
|
229
224
|
const url_path = category.url_path;
|
|
230
225
|
const categoryUrlPath = `/${url_path}${categoryUrlSuffix || ''}`;
|
|
@@ -244,17 +239,11 @@ export const useSellerMegaMenu = (props = {}) => {
|
|
|
244
239
|
if (activeCategory && activeCategory.default_top_filter) {
|
|
245
240
|
const defaultTopFilter = activeCategory.default_top_filter;
|
|
246
241
|
|
|
247
|
-
console.log('activeCategory',activeCategory)
|
|
248
|
-
console.log('2defaultTopFilte344444',defaultTopFilter)
|
|
249
|
-
console.log('search',search)
|
|
250
|
-
|
|
251
242
|
const attrCode = defaultTopFilter.attribute_code;
|
|
252
243
|
const label = defaultTopFilter.label;
|
|
253
244
|
const value = defaultTopFilter.value;
|
|
254
245
|
|
|
255
246
|
if (!search.includes(attrCode)) {
|
|
256
|
-
console.log('setDefaultSubcategoryAndTopFilter',attrCode)
|
|
257
|
-
|
|
258
247
|
setDefaultSubcategoryAndTopFilter(
|
|
259
248
|
label + ',' + value,
|
|
260
249
|
attrCode + '[filter]',
|