@riosst100/pwa-marketplace 3.2.7 → 3.2.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "3.2.7",
4
+ "version": "3.2.8",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { FormattedMessage } from 'react-intl';
3
3
  import cn from 'classnames';
4
- import { ArrowSquareDown } from 'iconsax-react';
4
+ import { Messages3 } from 'iconsax-react';
5
5
  import ChatContent from './chatContent';
6
6
  import { Send } from 'iconsax-react';
7
7
  import Button from '@magento/venia-ui/lib/components/Button';
@@ -71,68 +71,38 @@ const liveChat = (props) => {
71
71
  const { open, setOpen, chatData } = props;
72
72
  const [{ isSignedIn }] = useUserContext();
73
73
 
74
- const dataTabs =
75
- [
76
- {
77
- id: isSignedIn ? 'login-chat' : 'guest-chat',
78
- title: isSignedIn ? 'Login Chat' : 'Guest Chat',
79
- content: <ChatContentComponent chatData={chatData} />
80
- },
81
- {
82
- id: !isSignedIn ? 'login-chat' : 'guest-chat',
83
- title: !isSignedIn ? 'Login Chat' : 'Guest Chat',
84
- content: isSignedIn ? <ChatContentComponent chatData={chatData} /> : <LoginComponent />
85
- }
86
- ];
87
-
88
74
  return (
89
75
  <>
90
76
  <div
91
77
  className={cn(
92
- 'bg-white flex flex-col w-full max-w-[380px] h-[520px] fixed right-6 animate-anima-slide-up z-50 shadow-type-1',
93
- open ? 'animate-anima-slide-up bottom-0' : 'animate-anima-slide-down bottom-[-468px]'
78
+ 'flex flex-col w-full max-w-[150px] fixed z-50',
79
+ 'bottom-[30px] right-[30px]'
94
80
  )}
95
81
  >
96
- <div
97
- className='bg-darkblue-900 p-4 rounded-t-md cursor-pointer flex justify-between items-center'
98
- onClick={() => setOpen(!open)}
82
+ <Link
83
+ className='bg-darkblue-900 p-4 px-6 rounded-[40px] cursor-pointer flex justify-between items-center'
84
+ to={'/messages'}
99
85
  >
100
86
  <span className='text-white font-medium'>
101
87
  <FormattedMessage
102
- id={'chat.ChatWith'}
88
+ id={'chat.messageButton'}
103
89
  defaultMessage={
104
- 'Chat with Gundam Info'
90
+ 'Messages'
105
91
  }
106
92
  />
107
93
  </span>
108
94
  <span>
109
- <ArrowSquareDown
110
- size="14"
95
+ <Messages3
96
+ size="24"
111
97
  className={
112
98
  cn(
113
- 'transition-all text-white',
114
- open ? 'rotate-180' : '',
99
+ 'transition-all text-white'
115
100
  )
116
101
  }
117
102
  />
118
103
  </span>
119
104
 
120
- </div>
121
- <div
122
- className={cn(
123
- 'border border-gray-100 p-4 w-full h-full flex flex-col gap-3',
124
- 'max-h-[468px]'
125
- )}
126
- >
127
- <Tabs
128
- data={dataTabs}
129
- tabContentWrapperClassName='!p-0 h-full'
130
- hasContent
131
- tabWrapperClassName='justify-around'
132
- rootClassName="mb-0"
133
- tabTitleClassName="pt-0 pb-2 text-[12px]"
134
- />
135
- </div>
105
+ </Link>
136
106
  </div>
137
107
  <style jsx="true">
138
108
  {`
@@ -13,7 +13,7 @@ import LoadingIndicator from '@magento/venia-ui/lib/components/LoadingIndicator'
13
13
 
14
14
  const quoteDetail = () => {
15
15
  const { formatMessage } = useIntl();
16
- const { id } = useParams();
16
+ const { urlKey } = useParams();
17
17
  const location = useLocation();
18
18
  const locationRfq = location && location.state && location.state.rfq ? location.state.rfq : null;
19
19
  const { loadRfqDetail, rfqDetailState, handleSendRfqMessage, startDetailPolling, stopDetailPolling, handleConvertQuickrfqToCart } = useRFQ();
@@ -31,15 +31,20 @@ const quoteDetail = () => {
31
31
  // prefer image from info_buy_request if available; otherwise use placeholder
32
32
  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';
33
33
 
34
+ // Ensure we always pass a valid Int quickrfqId: prefer rfq.quickrfq_id, fallback to route param id
35
+ // Ensure we always pass a valid Int quickrfqId: prefer route param id, fallback to detailData.quickrfq_id
34
36
  useEffect(() => {
35
37
  if (!locationRfq) {
36
- const parsedId = id ? parseInt(id, 10) : NaN;
37
- if (!isNaN(parsedId)) {
38
- const variables = { quickrfqId: parsedId };
39
- loadRfqDetail(variables);
38
+ const fromParam = urlKey ? parseInt(urlKey, 10) : NaN;
39
+ const fromData = detailData && detailData.quickrfq_id
40
+ ? (typeof detailData.quickrfq_id === 'number' ? detailData.quickrfq_id : parseInt(detailData.quickrfq_id, 10))
41
+ : NaN;
42
+ const finalId = !isNaN(fromParam) ? fromParam : fromData;
43
+ if (!isNaN(finalId)) {
44
+ loadRfqDetail({ quickrfqId: finalId });
40
45
  }
41
46
  }
42
- }, [id, locationRfq, loadRfqDetail]);
47
+ }, [urlKey, detailData, locationRfq, loadRfqDetail]);
43
48
 
44
49
  // start polling messages every 5s while on detail page; stop on unmount
45
50
  useEffect(() => {
@@ -50,7 +55,9 @@ const quoteDetail = () => {
50
55
  }, [startDetailPolling, stopDetailPolling]);
51
56
 
52
57
  const rfq = locationRfq || detailData || {};
53
- const quickrfqIdValue = rfq && rfq.quickrfq_id ? (typeof rfq.quickrfq_id === 'number' ? rfq.quickrfq_id : parseInt(rfq.quickrfq_id, 10)) : (id ? parseInt(id, 10) : null);
58
+ const quickrfqIdValue = rfq && rfq.quickrfq_id
59
+ ? (typeof rfq.quickrfq_id === 'number' ? rfq.quickrfq_id : parseInt(rfq.quickrfq_id, 10))
60
+ : (urlKey ? parseInt(urlKey, 10) : null);
54
61
  const [isConverting, setIsConverting] = useState(false);
55
62
  const [convertError, setConvertError] = useState(null);
56
63
  const [convertSuccess, setConvertSuccess] = useState(null);
@@ -95,7 +102,7 @@ const quoteDetail = () => {
95
102
  <div className='relative grid gap-y-md'>
96
103
  <StoreTitle>{PAGE_TITLE}</StoreTitle>
97
104
  <div aria-live="polite" className="text-xl font-medium text-left">
98
- {PAGE_TITLE} - #{id}
105
+ {PAGE_TITLE} - #{quickrfqIdValue}
99
106
  </div>
100
107
  <div className='rounded-md border border-gray-100 px-4 py-6 flex flex-col-reverse md_flex-row justify-between gap-x-10'>
101
108
  <div className='flex flex-col gap-y-4 w-full md_w-6/12'>
@@ -1,11 +1,11 @@
1
- import React, { Fragment } from 'react';
1
+ import React, { useState, Fragment } from 'react';
2
2
  import { Facebook, Instagram, Twitter, Linkedin } from 'react-feather';
3
3
  import { FormattedMessage, useIntl } from 'react-intl';
4
4
  import { Link } from 'react-router-dom';
5
5
  import { shape, string } from 'prop-types';
6
6
  import { useFooter } from '@magento/peregrine/lib/talons/Footer/useFooter';
7
7
  import { useLocation } from 'react-router-dom';
8
-
8
+ import LiveChat from '@riosst100/pwa-marketplace/src/components/LiveChat';
9
9
  import Logo from '@magento/venia-ui/lib/components/Logo';
10
10
  import Newsletter from '@magento/venia-ui/lib/components/Newsletter';
11
11
  import { useStyle } from '@magento/venia-ui/lib/classify';
@@ -14,12 +14,17 @@ import { DEFAULT_LINKS, LOREM_IPSUM } from './sampleData';
14
14
  import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
15
15
  import cn from 'classnames';
16
16
  import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
17
-
17
+ import Button from '@magento/venia-ui/lib/components/Button';
18
18
  const Footer = props => {
19
19
  const { links } = props;
20
20
  const classes = useStyle(defaultClasses, props.classes);
21
21
  const talonProps = useFooter();
22
22
 
23
+ const [openChat, setOpenChat] = useState(false);
24
+ const toggleChat = () => {
25
+ setOpenChat(!openChat);
26
+ }
27
+
23
28
  const location = useLocation();
24
29
  const isCheckoutPage = location.pathname === '/checkout';
25
30
 
@@ -86,6 +91,10 @@ const Footer = props => {
86
91
  }
87
92
  }
88
93
  >
94
+ <LiveChat
95
+ open={openChat}
96
+ setOpen={setOpenChat}
97
+ />
89
98
  {!isCheckoutPage && <div className={classes.links} style={{"display":"flex"}}>
90
99
  {linkGroups}
91
100
  {/* <div>
@@ -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]',