@riosst100/pwa-marketplace 3.1.8 → 3.2.0

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 (39) hide show
  1. package/i18n/en_US.json +30 -1
  2. package/i18n/id_ID.json +30 -1
  3. package/package.json +1 -1
  4. package/src/components/AboutUs/aboutUs.js +9 -0
  5. package/src/components/AboutUs/index.js +1 -0
  6. package/src/components/AgeVerification/ageVerificationModal.js +163 -0
  7. package/src/components/AgeVerification/ageVerificationModal.module.css +85 -0
  8. package/src/components/AgeVerification/ageVerificationModal.shimmer.js +21 -0
  9. package/src/components/AgeVerification/index.js +2 -0
  10. package/src/components/AgeVerification/sellerCoupon.js +119 -0
  11. package/src/components/AgeVerification/sellerCouponCheckout.js +164 -0
  12. package/src/components/HelpCenter/helpCenter.js +95 -23
  13. package/src/components/HelpCenter/helpcenter.module.css +15 -2
  14. package/src/components/HelpCenter/questionDetail.js +1 -1
  15. package/src/components/LiveChat/MessagesModal.js +345 -0
  16. package/src/components/LiveChat/chatContent.js +3 -2
  17. package/src/components/MaintenancePage/maintenancePage.js +2 -2
  18. package/src/components/SellerCoupon/sellerCouponCheckout.js +2 -2
  19. package/src/components/SellerDetail/sellerDetail.js +38 -36
  20. package/src/components/SellerMegaMenu/sellerMegaMenu.js +2 -3
  21. package/src/components/SellerMegaMenu/sellerMegaMenuItem.js +1 -19
  22. package/src/components/SellerProducts/productContent.js +1 -6
  23. package/src/components/WebsiteSwitcher/websiteSwitcherItem.js +17 -7
  24. package/src/intercept.js +21 -0
  25. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +23 -3
  26. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +1 -1
  27. package/src/overwrites/venia-ui/lib/components/Footer/footer.js +21 -22
  28. package/src/overwrites/venia-ui/lib/components/Footer/sampleData.js +35 -31
  29. package/src/overwrites/venia-ui/lib/components/Header/header.js +2 -2
  30. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +105 -3
  31. package/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js +55 -53
  32. package/src/talons/HelpCenter/helpCenter.gql.js +50 -39
  33. package/src/talons/HelpCenter/useHelpCenter.js +67 -7
  34. package/src/talons/Seller/seller.gql.js +90 -0
  35. package/src/talons/Seller/useSeller.js +102 -4
  36. package/src/talons/SellerMegaMenu/megaMenu.gql.js +11 -18
  37. package/src/talons/SellerMegaMenu/useSellerMegaMenu.js +59 -2
  38. package/src/talons/SellerProducts/productContent.gql.js +5 -0
  39. package/src/talons/SellerProducts/useProductContent.js +61 -2
@@ -1,10 +1,11 @@
1
1
  import React, { useState, useMemo, Fragment, Suspense, useRef, useEffect } from 'react';
2
- import { useQuery } from '@apollo/client';
2
+ import { useQuery, useMutation } from '@apollo/client';
3
3
  import { FormattedMessage, useIntl } from 'react-intl';
4
4
  import { arrayOf, bool, number, shape, string } from 'prop-types';
5
5
  import { Form } from 'informed';
6
6
  import { Info } from 'react-feather';
7
7
  import { useToasts } from '@magento/peregrine/lib';
8
+ import { useUserContext } from '@magento/peregrine/lib/context/user';
8
9
 
9
10
  import Price from '@magento/venia-ui/lib/components/Price';
10
11
  import { useProductFullDetail } from '@magento/peregrine/lib/talons/ProductFullDetail/useProductFullDetail';
@@ -43,6 +44,10 @@ import Collapsible from '@riosst100/pwa-marketplace/src/components/commons/Colla
43
44
  import { useLocation } from 'react-router-dom';
44
45
  import Icon from '@magento/venia-ui/lib/components/Icon';
45
46
  import { ShoppingCart } from 'react-feather';
47
+ import MessagesModal from '@riosst100/pwa-marketplace/src/components/LiveChat/MessagesModal';
48
+ import SellerOperations from '@riosst100/pwa-marketplace/src/talons/Seller/seller.gql';
49
+
50
+ import AgeVerificationModal from '@riosst100/pwa-marketplace/src/components/AgeVerification/ageVerificationModal';
46
51
 
47
52
  import { totalListings, lowestPrice } from '@riosst100/pwa-marketplace/src/components/CrossSeller/crossSellerBuy';
48
53
 
@@ -113,6 +118,7 @@ const ProductFullDetail = props => {
113
118
  } = talonProps;
114
119
 
115
120
  const [, { addToast }] = useToasts();
121
+ const [{ isSignedIn }] = useUserContext();
116
122
 
117
123
  const { formatMessage } = useIntl();
118
124
 
@@ -126,6 +132,89 @@ const ProductFullDetail = props => {
126
132
 
127
133
  const [hoveredMedia, setHoveredMedia] = useState(null);
128
134
  const [selectedPaymentType, setSelectedPaymentType] = useState(null);
135
+ const [isMessagesOpen, setIsMessagesOpen] = useState(false);
136
+
137
+ // Messages GraphQL operations
138
+ const {
139
+ getCustomerSellerMessages,
140
+ customerSendMessageMutation,
141
+ customerReplyMessageMutation,
142
+ customerDeleteMessageMutation
143
+ } = SellerOperations;
144
+
145
+ const [messageListVars] = useState({
146
+ pageSize: 500,
147
+ currentPage: 1,
148
+ filter: undefined,
149
+ sort: undefined
150
+ });
151
+
152
+ const {
153
+ data: messagesData,
154
+ loading: messagesLoading,
155
+ error: messagesError,
156
+ refetch: refetchMessages
157
+ } = useQuery(getCustomerSellerMessages, {
158
+ fetchPolicy: 'network-only',
159
+ nextFetchPolicy: 'network-only',
160
+ variables: messageListVars,
161
+ pollInterval: 10000,
162
+ notifyOnNetworkStatusChange: true
163
+ });
164
+
165
+ const [sendMessage] = useMutation(customerSendMessageMutation);
166
+ const [replyMessage] = useMutation(customerReplyMessageMutation);
167
+ const [deleteMessage] = useMutation(customerDeleteMessageMutation);
168
+
169
+ const handleSendMessage = async ({ subject, content, seller_url }) => {
170
+ const input = { subject, content, seller_url };
171
+ const result = await sendMessage({ variables: { input }, refetchQueries: [{ query: getCustomerSellerMessages, variables: messageListVars }] });
172
+ addToast({
173
+ type: 'success',
174
+ message: formatMessage({ id: 'messages.messageSent', defaultMessage: 'Message sent successfully.' }),
175
+ timeout: 3000
176
+ });
177
+ await refetchMessages({ fetchPolicy: 'network-only' });
178
+ return result?.data?.customerSendMessage;
179
+ };
180
+
181
+ const handleReplyMessage = async ({ message_id, content }) => {
182
+ const input = { message_id, content };
183
+ const result = await replyMessage({ variables: { input }, refetchQueries: [{ query: getCustomerSellerMessages, variables: messageListVars }] });
184
+ addToast({
185
+ type: 'success',
186
+ message: formatMessage({ id: 'messages.replySent', defaultMessage: 'Reply sent successfully.' }),
187
+ timeout: 3000
188
+ });
189
+ await refetchMessages({ fetchPolicy: 'network-only' });
190
+ return result?.data?.customerReplyMessage;
191
+ };
192
+
193
+ const handleDeleteMessage = async ({ id }) => {
194
+ await deleteMessage({ variables: { id }, refetchQueries: [{ query: getCustomerSellerMessages, variables: messageListVars }] });
195
+ addToast({
196
+ type: 'success',
197
+ message: formatMessage({ id: 'messages.messageDeleted', defaultMessage: 'Message deleted successfully.' }),
198
+ timeout: 3000
199
+ });
200
+ await refetchMessages({ fetchPolicy: 'network-only' });
201
+ };
202
+
203
+ const openMessagesModal = () => {
204
+ if (!isSignedIn) {
205
+ addToast({
206
+ type: 'info',
207
+ message: formatMessage({
208
+ id: 'messages.loginRequired',
209
+ defaultMessage: 'Please sign in to your account to send a message to the seller.'
210
+ }),
211
+ timeout: 3000
212
+ });
213
+ return;
214
+ }
215
+ setIsMessagesOpen(true);
216
+ };
217
+ const closeMessagesModal = () => setIsMessagesOpen(false);
129
218
 
130
219
  const options = isProductConfigurable(product) ? (
131
220
  <Suspense fallback={<ProductOptionsShimmer />}>
@@ -722,6 +811,7 @@ const ProductFullDetail = props => {
722
811
  <Fragment>
723
812
  {breadcrumbs}
724
813
  {productPreviewMessages}
814
+ {/* <AgeVerificationModal /> */}
725
815
  <Form
726
816
  className={classes.root}
727
817
  data-cy="ProductFullDetail-root"
@@ -886,14 +976,14 @@ const ProductFullDetail = props => {
886
976
  <div class="flex items-center justify-center gap-[5px] py-1 relative bg-white">
887
977
  <div class="flex items-center justify-center gap-[5px] relative">
888
978
  <div className='flex flex-wrap items-start gap-4 relative'>
889
- <Link to='#' class="flex items-center justify-center gap-[5px] py-1 px-5 relative bg-white rounded-[30px] border border-solid border-[#f76b1c]">
979
+ <button type="button" onClick={openMessagesModal} class="flex items-center justify-center gap-[5px] py-1 px-5 relative bg-white rounded-[30px] border border-solid border-[#f76b1c]">
890
980
  <div class="flex items-center justify-center gap-[10px] relative">
891
981
  <Sms color="#f76b1c" size={14} variant="Outline" className='stroke-[#f76b1c]' />
892
982
  <div class="relative xs_hidden lg_flex w-fit font-medium text-[#f76b1c] text-[14px] tracking-[0] leading-[20px] whitespace-nowrap">
893
983
  Send Message
894
984
  </div>
895
985
  </div>
896
- </Link>
986
+ </button>
897
987
  <Link to={"/seller/"+sellerDetails.url_key} class="flex items-center justify-center gap-[5px] py-1 px-5 relative bg-white rounded-[30px] border border-solid border-[#f76b1c]">
898
988
  <div class="flex items-center justify-center gap-[10px] relative">
899
989
  <Shop color="#f76b1c" size={14} variant="Outline" className='stroke-[#f76b1c]' />
@@ -951,6 +1041,16 @@ const ProductFullDetail = props => {
951
1041
  <CrossSeller/>
952
1042
  </div>
953
1043
  </section>
1044
+ <MessagesModal
1045
+ isOpen={isMessagesOpen}
1046
+ onClose={closeMessagesModal}
1047
+ messages={messagesData?.customer?.sellerMessages}
1048
+ seller={sellerDetails}
1049
+ onReply={handleReplyMessage}
1050
+ onDelete={handleDeleteMessage}
1051
+ onSend={handleSendMessage}
1052
+ loading={messagesLoading}
1053
+ />
954
1054
  </Fragment>
955
1055
  );
956
1056
  };
@@ -1006,3 +1106,5 @@ ProductFullDetail.propTypes = {
1006
1106
  };
1007
1107
 
1008
1108
  export default ProductFullDetail;
1109
+ // Messages modal attached at root to avoid layout shifts
1110
+
@@ -1,10 +1,10 @@
1
- // import { useEffect, useMemo } from 'react';
2
- // import { useHistory } from 'react-router-dom';
3
- // import { BrowserPersistence } from '@magento/peregrine/lib/util';
4
- // import { useCartContext } from '@magento/peregrine/lib/context/cart';
5
- // import { useApolloClient, useQuery } from '@apollo/client';
1
+ import { useEffect, useMemo } from 'react';
2
+ import { useHistory } from 'react-router-dom';
3
+ import { BrowserPersistence } from '@magento/peregrine/lib/util';
4
+ import { useCartContext } from '@magento/peregrine/lib/context/cart';
5
+ import { useApolloClient, useQuery } from '@apollo/client';
6
6
 
7
- // const storage = new BrowserPersistence();
7
+ const storage = new BrowserPersistence();
8
8
 
9
9
  /**
10
10
  * This component checks for use of a store code in the url that is not the
@@ -12,42 +12,42 @@
12
12
  * and reloads the page so that they are used in the graphQL headers.
13
13
  */
14
14
  const StoreCodeRoute = () => {
15
- // const history = useHistory();
15
+ const history = useHistory();
16
16
 
17
- // const websiteCodes = [];
18
- // const websiteStores = useMemo(() => ({}), []);
19
- // const storeCurrencies = useMemo(() => ({}), []);
20
- // const storeSecureBaseMediaUrl = useMemo(() => ({}), []);
17
+ const websiteCodes = [];
18
+ const websiteStores = useMemo(() => ({}), []);
19
+ const storeCurrencies = useMemo(() => ({}), []);
20
+ const storeSecureBaseMediaUrl = useMemo(() => ({}), []);
21
21
 
22
- // AVAILABLE_WEBSITES.forEach(store => {
23
- // websiteCodes.push(store.website_code);
24
- // websiteStores[store.website_code] = store.store_code;
25
- // storeCurrencies[store.store_code] = store.default_display_currency_code;
26
- // storeSecureBaseMediaUrl[store.store_code] = store.secure_base_media_url;
27
- // });
22
+ AVAILABLE_WEBSITES.forEach(store => {
23
+ websiteCodes.push(store.website_code);
24
+ websiteStores[store.website_code] = store.store_code;
25
+ storeCurrencies[store.store_code] = store.default_display_currency_code;
26
+ storeSecureBaseMediaUrl[store.store_code] = store.secure_base_media_url;
27
+ });
28
28
 
29
- // // Sort by length (longest first) to avoid false hits ie "en" matching just
30
- // // the "/en" in "/en-us/home.html" when "en-us" is also in storeCodes.
31
- // websiteCodes.sort((a, b) => b.length - a.length);
29
+ // Sort by length (longest first) to avoid false hits ie "en" matching just
30
+ // the "/en" in "/en-us/home.html" when "en-us" is also in storeCodes.
31
+ websiteCodes.sort((a, b) => b.length - a.length);
32
32
 
33
- // // Find the store code in the url. This will always be the first path.
34
- // // ie `https://example.com/fr/foo/baz.html` => `fr`.
35
- // const { location } = globalThis;
36
- // const match = location && location.pathname.split("/")[1];
37
- // let websiteCodeInUrl = websiteCodes.find((str) => str === match);
33
+ // Find the store code in the url. This will always be the first path.
34
+ // ie `https://example.com/fr/foo/baz.html` => `fr`.
35
+ const { location } = globalThis;
36
+ const match = location && location.pathname.split("/")[1];
37
+ let websiteCodeInUrl = websiteCodes.find((str) => str === match);
38
38
 
39
- // // Determine what the current store code is using the configured basename.
40
- // const currentWebsiteCode = storage && storage.getItem('website_code') || process.env.WEBSITE_CODE;
39
+ // Determine what the current store code is using the configured basename.
40
+ const currentWebsiteCode = storage && storage.getItem('website_code') || process.env.WEBSITE_CODE;
41
41
 
42
42
 
43
43
 
44
44
  // If we find a store code in the url that is not the current one, update
45
45
  // the storage value and refresh so that we start using the new code.
46
- // useEffect(() => {
47
- // if (!websiteCodeInUrl) {
48
- // history.replace(location.pathname + location.search)
49
- // } else if (websiteCodeInUrl && websiteCodeInUrl !== currentWebsiteCode) {
50
- // const storeCodeInUrl = websiteStores[websiteCodeInUrl];
46
+ useEffect(() => {
47
+ if (!websiteCodeInUrl) {
48
+ // history.replace(location.pathname + location.search)
49
+ } else if (websiteCodeInUrl && websiteCodeInUrl !== currentWebsiteCode) {
50
+ const storeCodeInUrl = websiteStores[websiteCodeInUrl];
51
51
 
52
52
  // alert(storeCodeInUrl)
53
53
 
@@ -63,31 +63,33 @@ const StoreCodeRoute = () => {
63
63
 
64
64
  // await apolloClient.clearCacheData(apolloClient, 'cart');
65
65
  // await removeCart();
66
-
67
- // storage.setItem('store_view_code', storeCodeInUrl);
68
- // storage.setItem('website_code', websiteCodeInUrl);
69
- // storage.setItem(
70
- // 'store_view_currency',
71
- // storeCurrencies[storeCodeInUrl]
72
- // );
73
- // storage.setItem(
74
- // 'store_view_secure_base_media_url',
75
- // storeSecureBaseMediaUrl[storeCodeInUrl]
76
- // );
66
+ alert('22ok')
67
+ storage.removeItem('cartId');
68
+
69
+ storage.setItem('store_view_code', storeCodeInUrl);
70
+ storage.setItem('website_code', websiteCodeInUrl);
71
+ storage.setItem(
72
+ 'store_view_currency',
73
+ storeCurrencies[storeCodeInUrl]
74
+ );
75
+ storage.setItem(
76
+ 'store_view_secure_base_media_url',
77
+ storeSecureBaseMediaUrl[storeCodeInUrl]
78
+ );
77
79
 
78
80
  // We're required to reload the page as the basename doesn't
79
81
  // change entirely without a full page reload.
80
82
  // history.go(0);
81
- // }
82
- // }, [
83
- // websiteCodeInUrl,
84
- // // currentWebsiteCode,
85
- // history
86
- // // , apolloClient, removeCart
87
- // // storeCodeInUrl,
88
- // // storeCurrencies,
89
- // // storeSecureBaseMediaUrl
90
- // ]);
83
+ }
84
+ }, [
85
+ websiteCodeInUrl,
86
+ // currentWebsiteCode,
87
+ history
88
+ // , apolloClient, removeCart
89
+ // storeCodeInUrl,
90
+ // storeCurrencies,
91
+ // storeSecureBaseMediaUrl
92
+ ]);
91
93
 
92
94
  return null;
93
95
  };
@@ -32,45 +32,56 @@ export const FAQ_CATEGORIES = gql`
32
32
  `;
33
33
 
34
34
  export const FAQ_QUESTIONS = gql`
35
- query faqQuestions {
36
- faqQuestions {
37
- _first_store_id
38
- animation_class
39
- animation_speed
40
- answer
41
- author_email
42
- author_name
43
- body_bg
44
- body_color
45
- body_size
46
- border_width
47
- creation_time
48
- disklike
49
- is_active
50
- is_featured
51
- like
52
- meta_description
53
- meta_keywords
54
- page_title
55
- question_active_icon
56
- question_icon
57
- question_id
58
- question_margin
59
- question_position
60
- question_type
61
- question_url
62
- store_code
63
- store_id
64
- tags
65
- title
66
- title_bg
67
- title_bg_active
68
- title_border_color
69
- title_border_radius
70
- title_color
71
- title_color_active
72
- title_size
73
- update_time
35
+ query faqQuestions(
36
+ $search: String
37
+ $pageSize: Int
38
+ $currentPage: Int
39
+ ) {
40
+ faqQuestions(search: $search, pageSize: $pageSize, currentPage: $currentPage) {
41
+ items {
42
+ _first_store_id
43
+ animation_class
44
+ animation_speed
45
+ answer
46
+ author_email
47
+ author_name
48
+ body_bg
49
+ body_color
50
+ body_size
51
+ border_width
52
+ creation_time
53
+ disklike
54
+ is_active
55
+ is_featured
56
+ like
57
+ meta_description
58
+ meta_keywords
59
+ page_title
60
+ question_active_icon
61
+ question_icon
62
+ question_id
63
+ question_margin
64
+ question_position
65
+ question_type
66
+ question_url
67
+ store_code
68
+ store_id
69
+ tags
70
+ title
71
+ title_bg
72
+ title_bg_active
73
+ title_border_color
74
+ title_border_radius
75
+ title_color
76
+ title_color_active
77
+ title_size
78
+ update_time
79
+ }
80
+ page_info {
81
+ current_page
82
+ total_pages
83
+ }
84
+ total_count
74
85
  }
75
86
  }
76
87
  `;
@@ -1,12 +1,19 @@
1
- import { useMemo } from 'react';
1
+ import { useEffect, useMemo } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
- import { useQuery } from '@apollo/client';
3
+ import { useQuery, useLazyQuery } from '@apollo/client';
4
4
  import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
5
5
  import DEFAULT_OPERATIONS from './helpCenter.gql';
6
+ import { usePagination } from '@magento/peregrine/lib/hooks/usePagination';
6
7
 
7
- export const useHelpCenter = (props = {}) => {
8
+ export const useHelpCenter = (props) => {
8
9
  const { formatMessage } = useIntl();
9
10
 
11
+ const { searchQuery, pageSize = 10 } = props;
12
+
13
+ const [paginationValues, paginationApi] = usePagination();
14
+ const { currentPage = 1, totalPages } = paginationValues;
15
+ const { setCurrentPage, setTotalPages } = paginationApi;
16
+
10
17
  const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
11
18
 
12
19
  const {
@@ -23,13 +30,45 @@ export const useHelpCenter = (props = {}) => {
23
30
  fetchPolicy: 'cache-and-network'
24
31
  });
25
32
 
26
- const {
33
+ // const {
34
+ // data: questionsData,
35
+ // loading: questionsLoading,
36
+ // error: questionsError
37
+ // } = useQuery(faqQuestionsQuery, {
38
+ // fetchPolicy: 'cache-and-network',
39
+ // nextFetchPolicy: 'cache-first',
40
+ // variables: {
41
+ // search: searchQuery,
42
+ // pageSize: 20,
43
+ // currentPage: 1
44
+ // },
45
+ // });
46
+
47
+ console.log('searchQuery',searchQuery)
48
+
49
+ const [runQuery, {
27
50
  data: questionsData,
28
51
  loading: questionsLoading,
29
52
  error: questionsError
30
- } = useQuery(faqQuestionsQuery, {
31
- fetchPolicy: 'cache-and-network'
53
+ }] = useLazyQuery(faqQuestionsQuery, {
54
+ fetchPolicy: 'cache-and-network',
55
+ nextFetchPolicy: 'cache-first'
32
56
  });
57
+
58
+ useEffect(() => {
59
+ runQuery({
60
+ variables: {
61
+ pageSize: pageSize,
62
+ currentPage: currentPage,
63
+ search: searchQuery
64
+ }
65
+ });
66
+ }, [
67
+ runQuery,
68
+ pageSize,
69
+ currentPage,
70
+ searchQuery
71
+ ]);
33
72
 
34
73
  const {
35
74
  data: tagsData,
@@ -44,14 +83,35 @@ export const useHelpCenter = (props = {}) => {
44
83
 
45
84
  const data = useMemo(() => ({
46
85
  categories: categoriesData?.faqCategories || [],
47
- questions: questionsData?.faqQuestions || [],
86
+ questions: questionsData?.faqQuestions.items || [],
48
87
  tags: tagsData?.faqTags || []
49
88
  }), [categoriesData, questionsData, tagsData]);
50
89
 
90
+ const totalPagesFromData = questionsData
91
+ ? questionsData.faqQuestions?.page_info?.total_pages
92
+ : null;
93
+
94
+ useEffect(() => {
95
+ setTotalPages(totalPagesFromData);
96
+ return () => {
97
+ setTotalPages(null);
98
+ };
99
+ }, [setTotalPages, totalPagesFromData]);
100
+
101
+ const pageControl = {
102
+ currentPage,
103
+ setPage: setCurrentPage,
104
+ totalPages
105
+ };
106
+
107
+ console.log('pageControl',pageControl)
108
+
51
109
  return {
52
110
  loading,
53
111
  error,
54
112
  data,
113
+ totalPagesFromData,
114
+ pageControl,
55
115
  formatMessage
56
116
  };
57
117
  };
@@ -202,8 +202,98 @@ export const GET_COUPON_CODE_QUERY = gql`
202
202
  }
203
203
  `;
204
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
+
205
291
  export default {
206
292
  getStoreConfigData: GET_STORE_CONFIG_DATA,
207
293
  getSellerDetailQuery: GET_SELLER_DETAIL_QUERY,
208
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,
209
299
  };