@riosst100/pwa-marketplace 3.3.1 → 3.3.3
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 +1 -0
- package/src/components/AboutUs/aboutUs.css +111 -0
- package/src/components/AboutUs/aboutUs.js +6 -2
- package/src/components/AgeVerificationModal/ageVerificationModal.js +6 -4
- package/src/components/AgeVerificationModal/ageVerificationModal.module.css +23 -4
- package/src/components/LoadingRequest/index.js +1 -0
- package/src/components/LoadingRequest/loadingRequest.js +40 -0
- package/src/components/LoadingRequest/loadingRequest.module.css +150 -0
- package/src/components/PrivacyPolicy/index.js +1 -0
- package/src/components/PrivacyPolicy/privacyPolicy.css +125 -0
- package/src/components/PrivacyPolicy/privacyPolicy.js +13 -0
- package/src/components/SocialLogin/socialLogin.js +5 -55
- package/src/components/TermsOfUse/index.js +1 -0
- package/src/components/TermsOfUse/termsOfUse.css +113 -0
- package/src/components/TermsOfUse/termsOfUse.js +13 -0
- package/src/intercept.js +14 -0
- package/src/overwrites/peregrine/lib/Apollo/links/storeLink.js +34 -0
- package/src/overwrites/peregrine/lib/context/cart.js +13 -1
- package/src/overwrites/peregrine/lib/store/actions/cart/asyncActions.js +15 -3
- package/src/overwrites/peregrine/lib/talons/Adapter/useAdapter.js +7 -4
- package/src/overwrites/peregrine/lib/talons/SignIn/useSignIn.js +19 -1
- package/src/overwrites/peregrine/lib/util/makeUrl.js +132 -0
- package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +47 -43
- package/src/overwrites/venia-ui/lib/components/Footer/footer.js +2 -2
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/productFAQ.js +82 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +47 -39
- package/src/overwrites/venia-ui/lib/components/SignIn/signIn.js +3 -1
- package/src/overwrites/venia-ui/lib/components/SignInPage/signInPage.js +27 -21
- package/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js +10 -43
- package/src/talons/ProductFAQ/productFaq.gql.js +39 -0
- package/src/talons/ProductFAQ/useProductFAQ.js +48 -0
- package/src/talons/RFQ/useRFQ.js +0 -2
- package/src/talons/SocialLogin/useSocialLogin.js +5 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useEffect, useMemo } from 'react';
|
|
2
|
+
import Collapsible from '@riosst100/pwa-marketplace/src/components/commons/Collapsible';
|
|
3
|
+
|
|
4
|
+
import useProductFAQ from '@riosst100/pwa-marketplace/src/talons/ProductFAQ/useProductFAQ';
|
|
5
|
+
|
|
6
|
+
const ProductFAQ = ({ productId }) => {
|
|
7
|
+
const { loadProductFaqList, productFaqListState } = useProductFAQ();
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (productId) {
|
|
11
|
+
loadProductFaqList({ productId });
|
|
12
|
+
}
|
|
13
|
+
}, [productId, loadProductFaqList]);
|
|
14
|
+
|
|
15
|
+
const { data, loading, error } = productFaqListState || {};
|
|
16
|
+
const items = useMemo(() => {
|
|
17
|
+
const list = data?.productFaqList || [];
|
|
18
|
+
// Show only active items if status provided (1 = active)
|
|
19
|
+
return list.filter(it => it?.status === 1 || it?.status === '1' || it?.status === true || it?.status === 'true' || it?.status === undefined);
|
|
20
|
+
}, [data]);
|
|
21
|
+
|
|
22
|
+
if (loading) {
|
|
23
|
+
return <div className="p-4 text-sm text-gray-600">Loading FAQs…</div>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (error) {
|
|
27
|
+
return (
|
|
28
|
+
<div className="p-4 text-sm text-red-600">
|
|
29
|
+
Failed to load FAQs. Please try again.
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!items.length) {
|
|
35
|
+
return (
|
|
36
|
+
<div className="p-4 text-sm text-gray-600">
|
|
37
|
+
No FAQs available for this product.
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="space-y-2">
|
|
44
|
+
{items.map((faq, idx) => {
|
|
45
|
+
const headerStyle = {
|
|
46
|
+
color: faq?.title_color || undefined,
|
|
47
|
+
background: faq?.title_background || undefined,
|
|
48
|
+
fontSize: faq?.title_size ? `${faq.title_size}px` : undefined,
|
|
49
|
+
borderColor: faq?.border_color || undefined,
|
|
50
|
+
borderWidth: faq?.border_width ? `${faq.border_width}px` : undefined,
|
|
51
|
+
borderRadius: faq?.border_radius ? `${faq.border_radius}px` : undefined,
|
|
52
|
+
marginBottom: faq?.margin_bottom ? `${faq.margin_bottom}px` : undefined,
|
|
53
|
+
marginLeft: faq?.margin_left ? `${faq.margin_left}px` : undefined
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const bodyStyle = {
|
|
57
|
+
color: faq?.body_color || undefined,
|
|
58
|
+
background: faq?.body_background || undefined
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const title = faq?.title || `Question ${idx + 1}`;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Collapsible
|
|
65
|
+
key={`${faq?.question_id || idx}`}
|
|
66
|
+
title={title}
|
|
67
|
+
rootClassName="border-b border-gray-100"
|
|
68
|
+
contentWrapperClassName="!mt-0"
|
|
69
|
+
titleStyle={headerStyle}
|
|
70
|
+
>
|
|
71
|
+
<div style={bodyStyle} className="p-3 text-sm leading-relaxed">
|
|
72
|
+
{faq?.answer || 'No answer provided.'}
|
|
73
|
+
</div>
|
|
74
|
+
</Collapsible>
|
|
75
|
+
);
|
|
76
|
+
})}
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default ProductFAQ;
|
|
82
|
+
|
|
@@ -30,6 +30,7 @@ import { Star1, Verify, Sms, Message, Shop, ArrowUp2 } from 'iconsax-react';
|
|
|
30
30
|
import { Link } from "react-router-dom";
|
|
31
31
|
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
32
32
|
import { GET_PAYMENT_TYPES } from '@riosst100/pwa-marketplace/src/talons/ProductContent/productContent.gql.js';
|
|
33
|
+
import ProductFAQ from './components/productFAQ';
|
|
33
34
|
|
|
34
35
|
const WishlistButton = React.lazy(() => import('@magento/venia-ui/lib/components/Wishlist/AddToListButton'));
|
|
35
36
|
const Options = React.lazy(() => import('@magento/venia-ui/lib/components/ProductOptions'));
|
|
@@ -86,7 +87,7 @@ const ProductDetailsCollapsible = (props) => {
|
|
|
86
87
|
|
|
87
88
|
const ProductFullDetail = props => {
|
|
88
89
|
const { product } = props;
|
|
89
|
-
|
|
90
|
+
|
|
90
91
|
const history = useHistory();
|
|
91
92
|
|
|
92
93
|
const { search } = useLocation();
|
|
@@ -118,7 +119,7 @@ const ProductFullDetail = props => {
|
|
|
118
119
|
errorAddingProductToCart,
|
|
119
120
|
isAddProductLoading,
|
|
120
121
|
} = talonProps;
|
|
121
|
-
|
|
122
|
+
|
|
122
123
|
const [, { addToast }] = useToasts();
|
|
123
124
|
const [{ isSignedIn }] = useUserContext();
|
|
124
125
|
|
|
@@ -348,7 +349,7 @@ const ProductFullDetail = props => {
|
|
|
348
349
|
pagebuilder: pagebuilder
|
|
349
350
|
};
|
|
350
351
|
}, [productDetailsAttributes, productDetails.sku, formatMessage]);
|
|
351
|
-
|
|
352
|
+
|
|
352
353
|
const shortDescription = productDetails.shortDescription ? (
|
|
353
354
|
<RichText
|
|
354
355
|
rootClassName="px-0"
|
|
@@ -409,7 +410,7 @@ const ProductFullDetail = props => {
|
|
|
409
410
|
}, []),
|
|
410
411
|
[customAttributesDetails.list]
|
|
411
412
|
);
|
|
412
|
-
|
|
413
|
+
|
|
413
414
|
const ProductTNC = () => (
|
|
414
415
|
<div className={cn(contentContainerClass, classes.contentContainerTabOverride)}>
|
|
415
416
|
<p>{customAttributesList.map((data, index) => {
|
|
@@ -440,21 +441,7 @@ const ProductFullDetail = props => {
|
|
|
440
441
|
</div>
|
|
441
442
|
)
|
|
442
443
|
|
|
443
|
-
|
|
444
|
-
<div className={cn(contentContainerClass, classes.contentContainerTabOverride)}>
|
|
445
|
-
{customAttributesList.map((data, index) => {
|
|
446
|
-
if (data.code == "faq") {
|
|
447
|
-
return (
|
|
448
|
-
<RichText
|
|
449
|
-
rootClassName="px-0"
|
|
450
|
-
content={data.value}
|
|
451
|
-
/>
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
})}
|
|
455
|
-
|
|
456
|
-
</div>
|
|
457
|
-
)
|
|
444
|
+
|
|
458
445
|
|
|
459
446
|
|
|
460
447
|
const getAttributeValue = (customAttributesDetails, key, useSuffix = false) => {
|
|
@@ -474,11 +461,13 @@ const ProductFullDetail = props => {
|
|
|
474
461
|
return attr.entered_attribute_value?.value || "";
|
|
475
462
|
};
|
|
476
463
|
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
const
|
|
480
|
-
const
|
|
481
|
-
const
|
|
464
|
+
// Prefer preorder info from product props; fallback to productDetails if present
|
|
465
|
+
const preorderData = (product && product.preorder) || (productDetails && productDetails.preorder) || null;
|
|
466
|
+
const preOrder = preorderData;
|
|
467
|
+
const preOrderDate = preorderData?.pre_order_date || "";
|
|
468
|
+
const preOrderDeposite = preorderData?.pre_order_deposit || "";
|
|
469
|
+
const preOrderNote = preorderData?.pre_order_notes || "";
|
|
470
|
+
const preOrderPaymentType = preorderData?.pre_order_payment_type || "";
|
|
482
471
|
const releaseDate = getAttributeValue(productCardDetailsAttributes, "release_date", true);
|
|
483
472
|
const setNameValue = getAttributeValue(productCardDetailsAttributes, "card_set", true);
|
|
484
473
|
const cardNameValue = getAttributeValue(productCardDetailsAttributes, "card_name", true);
|
|
@@ -509,6 +498,17 @@ const ProductFullDetail = props => {
|
|
|
509
498
|
preOrderClosingDateObj !== null &&
|
|
510
499
|
new Date().getTime() > preOrderClosingDateObj.getTime();
|
|
511
500
|
|
|
501
|
+
// Ensure payment type is only set for preorder products
|
|
502
|
+
useEffect(() => {
|
|
503
|
+
if (isPreOrderProduct) {
|
|
504
|
+
if (preOrderPaymentType) {
|
|
505
|
+
setSelectedPaymentType(preOrderPaymentType);
|
|
506
|
+
}
|
|
507
|
+
} else {
|
|
508
|
+
setSelectedPaymentType(null);
|
|
509
|
+
}
|
|
510
|
+
}, [isPreOrderProduct, preOrderPaymentType]);
|
|
511
|
+
|
|
512
512
|
const cartCallToActionText =
|
|
513
513
|
isPreOrderClosed
|
|
514
514
|
? (
|
|
@@ -680,7 +680,11 @@ const ProductFullDetail = props => {
|
|
|
680
680
|
{
|
|
681
681
|
id: 'product-faq',
|
|
682
682
|
title: 'FAQ',
|
|
683
|
-
content:
|
|
683
|
+
content: (
|
|
684
|
+
<div className={cn(contentContainerClass, classes.contentContainerTabOverride)}>
|
|
685
|
+
<ProductFAQ productId={product?.id} />
|
|
686
|
+
</div>
|
|
687
|
+
)
|
|
684
688
|
},
|
|
685
689
|
{
|
|
686
690
|
id: 'product-reviews',
|
|
@@ -740,7 +744,7 @@ const ProductFullDetail = props => {
|
|
|
740
744
|
};
|
|
741
745
|
|
|
742
746
|
let preorderPayload;
|
|
743
|
-
if (selectedPaymentType) {
|
|
747
|
+
if (isPreOrderProduct && selectedPaymentType) {
|
|
744
748
|
preorderPayload = {
|
|
745
749
|
pre_order_payment_type: selectedPaymentType
|
|
746
750
|
};
|
|
@@ -753,9 +757,11 @@ const ProductFullDetail = props => {
|
|
|
753
757
|
}
|
|
754
758
|
|
|
755
759
|
const nextValues = {
|
|
756
|
-
...formValues
|
|
757
|
-
preorder: preorderPayload
|
|
760
|
+
...formValues
|
|
758
761
|
};
|
|
762
|
+
if (preorderPayload) {
|
|
763
|
+
nextValues.preorder = preorderPayload;
|
|
764
|
+
}
|
|
759
765
|
await originalHandleAddToCart(nextValues);
|
|
760
766
|
} catch (e) {
|
|
761
767
|
addToast({
|
|
@@ -948,17 +954,19 @@ const ProductFullDetail = props => {
|
|
|
948
954
|
/>
|
|
949
955
|
</Suspense>
|
|
950
956
|
</div>
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
957
|
+
{isPreOrderProduct && (
|
|
958
|
+
<PreorderDetail
|
|
959
|
+
preOrder={preOrder}
|
|
960
|
+
preOrderDate={preOrderDate}
|
|
961
|
+
preOrderDeposite={preOrderDeposite}
|
|
962
|
+
preOrderNote={preOrderNote}
|
|
963
|
+
preOrderPaymentType={preOrderPaymentType}
|
|
964
|
+
releaseDate={releaseDate}
|
|
965
|
+
className={'preorder_detail-container'}
|
|
966
|
+
paymentTypeOptions={paymentTypeOptions}
|
|
967
|
+
onPaymentTypeChange={setSelectedPaymentType}
|
|
968
|
+
/>
|
|
969
|
+
)}
|
|
962
970
|
<div className='product_actions-wrapper'>
|
|
963
971
|
{cartActionContent}
|
|
964
972
|
</div>
|
|
@@ -27,6 +27,7 @@ const SignIn = props => {
|
|
|
27
27
|
showCreateAccount,
|
|
28
28
|
showForgotPassword,
|
|
29
29
|
initialValues,
|
|
30
|
+
setIsLoading,
|
|
30
31
|
showSocialLogin = true,
|
|
31
32
|
} = props;
|
|
32
33
|
|
|
@@ -36,7 +37,8 @@ const SignIn = props => {
|
|
|
36
37
|
getCartDetailsQuery: GET_CART_DETAILS_QUERY,
|
|
37
38
|
setDefaultUsername,
|
|
38
39
|
showCreateAccount,
|
|
39
|
-
showForgotPassword
|
|
40
|
+
showForgotPassword,
|
|
41
|
+
setIsLoading
|
|
40
42
|
});
|
|
41
43
|
|
|
42
44
|
const {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { shape, string } from 'prop-types';
|
|
3
3
|
import { FormattedMessage, useIntl } from 'react-intl';
|
|
4
4
|
|
|
@@ -9,37 +9,43 @@ import SignIn from '@magento/venia-ui/lib/components/SignIn';
|
|
|
9
9
|
import cn from 'classnames';
|
|
10
10
|
|
|
11
11
|
import defaultClasses from './signInPage.module.css';
|
|
12
|
+
import LoadingRequest from '@riosst100/pwa-marketplace/src/components/LoadingRequest';
|
|
12
13
|
|
|
13
14
|
const SignInPage = props => {
|
|
14
15
|
const classes = useStyle(defaultClasses, props.classes);
|
|
15
16
|
const { signInProps } = useSignInPage(props);
|
|
16
17
|
const { formatMessage } = useIntl();
|
|
17
18
|
|
|
19
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
20
|
+
|
|
18
21
|
return (
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
<>
|
|
23
|
+
<LoadingRequest isLoading={isLoading} />
|
|
24
|
+
<div className={classes.signInRootContainer}>
|
|
25
|
+
<div className={cn(classes.root, '!py-[60px]')}>
|
|
26
|
+
<StoreTitle>
|
|
27
|
+
{formatMessage({
|
|
28
|
+
id: 'signInPage.title',
|
|
29
|
+
defaultMessage: 'Sign In'
|
|
30
|
+
})}
|
|
31
|
+
</StoreTitle>
|
|
32
|
+
<div className={cn(classes.leftContentContainer, '')}>
|
|
33
|
+
<div class="auth-left">
|
|
34
|
+
<img src="https://img.freepik.com/premium-vector/sign-concept-illustration_114360-125.jpg" width="50%" />
|
|
35
|
+
<p style={{
|
|
36
|
+
"fontSize": "20px",
|
|
37
|
+
"fontWeight": 500
|
|
38
|
+
}}>Sign in to start shopping or sell your collectibles.</p>
|
|
39
|
+
</div>
|
|
34
40
|
</div>
|
|
35
41
|
</div>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
<div className={cn(classes.root, '!py-[60px]')}>
|
|
43
|
+
<div className={cn(classes.contentContainer, 'border border-gray-100 rounded-lg')}>
|
|
44
|
+
<SignIn setIsLoading={setIsLoading} {...signInProps} />
|
|
45
|
+
</div>
|
|
40
46
|
</div>
|
|
41
47
|
</div>
|
|
42
|
-
|
|
48
|
+
</>
|
|
43
49
|
);
|
|
44
50
|
};
|
|
45
51
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { useEffect, useMemo } from 'react';
|
|
2
|
-
import { useHistory } from 'react-router-dom';
|
|
3
2
|
import { BrowserPersistence } from '@magento/peregrine/lib/util';
|
|
4
|
-
import { useCartContext } from '@magento/peregrine/lib/context/cart';
|
|
5
|
-
import { useApolloClient, useQuery } from '@apollo/client';
|
|
6
3
|
|
|
7
4
|
const storage = new BrowserPersistence();
|
|
8
5
|
|
|
@@ -12,7 +9,6 @@ const storage = new BrowserPersistence();
|
|
|
12
9
|
* and reloads the page so that they are used in the graphQL headers.
|
|
13
10
|
*/
|
|
14
11
|
const StoreCodeRoute = () => {
|
|
15
|
-
const history = useHistory();
|
|
16
12
|
|
|
17
13
|
const websiteCodes = [];
|
|
18
14
|
const websiteStores = useMemo(() => ({}), []);
|
|
@@ -34,61 +30,32 @@ const StoreCodeRoute = () => {
|
|
|
34
30
|
// ie `https://example.com/fr/foo/baz.html` => `fr`.
|
|
35
31
|
const { location } = globalThis;
|
|
36
32
|
const match = location && location.pathname.split("/")[1];
|
|
33
|
+
const defaultWebsiteCode = process.env.WEBSITE_CODE;
|
|
37
34
|
let websiteCodeInUrl = websiteCodes.find((str) => str === match);
|
|
38
35
|
|
|
39
36
|
// Determine what the current store code is using the configured basename.
|
|
40
|
-
const currentWebsiteCode = storage && storage.getItem('website_code') || process.env.WEBSITE_CODE;
|
|
41
|
-
|
|
42
|
-
|
|
43
37
|
|
|
44
38
|
// If we find a store code in the url that is not the current one, update
|
|
45
39
|
// the storage value and refresh so that we start using the new code.
|
|
46
40
|
useEffect(() => {
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const storeCodeInUrl = websiteStores[websiteCodeInUrl];
|
|
51
|
-
|
|
52
|
-
// alert(storeCodeInUrl)
|
|
53
|
-
|
|
54
|
-
// update store/website saat url berubah, misal /id ke /sg
|
|
55
|
-
|
|
56
|
-
// issue store view code gk berubah, klo di graphql aman
|
|
57
|
-
|
|
58
|
-
// ini update di graphql dan di cookie, tapi di cookie beda klo ga di hardcode
|
|
41
|
+
if (websiteCodeInUrl) {
|
|
42
|
+
let prefix = '';
|
|
43
|
+
let storeCodeInUrl = websiteStores[websiteCodeInUrl];
|
|
59
44
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// console.log('storeCodeInUrl',storeCodeInUrl)
|
|
63
|
-
|
|
64
|
-
// await apolloClient.clearCacheData(apolloClient, 'cart');
|
|
65
|
-
// await removeCart();
|
|
66
|
-
alert('22ok')
|
|
67
|
-
storage.removeItem('cartId');
|
|
68
|
-
|
|
69
|
-
storage.setItem('store_view_code', storeCodeInUrl);
|
|
70
|
-
storage.setItem('website_code', websiteCodeInUrl);
|
|
45
|
+
storage.setItem(prefix + 'store_view_code', storeCodeInUrl);
|
|
46
|
+
storage.setItem(prefix + 'website_code', websiteCodeInUrl);
|
|
71
47
|
storage.setItem(
|
|
72
|
-
'store_view_currency',
|
|
48
|
+
prefix + 'store_view_currency',
|
|
73
49
|
storeCurrencies[storeCodeInUrl]
|
|
74
50
|
);
|
|
51
|
+
|
|
75
52
|
storage.setItem(
|
|
76
|
-
'store_view_secure_base_media_url',
|
|
53
|
+
prefix + 'store_view_secure_base_media_url',
|
|
77
54
|
storeSecureBaseMediaUrl[storeCodeInUrl]
|
|
78
55
|
);
|
|
79
|
-
|
|
80
|
-
// We're required to reload the page as the basename doesn't
|
|
81
|
-
// change entirely without a full page reload.
|
|
82
|
-
// history.go(0);
|
|
83
56
|
}
|
|
84
57
|
}, [
|
|
85
|
-
websiteCodeInUrl
|
|
86
|
-
// currentWebsiteCode,
|
|
87
|
-
history
|
|
88
|
-
// , apolloClient, removeCart
|
|
89
|
-
// storeCodeInUrl,
|
|
90
|
-
// storeCurrencies,
|
|
91
|
-
// storeSecureBaseMediaUrl
|
|
58
|
+
websiteCodeInUrl
|
|
92
59
|
]);
|
|
93
60
|
|
|
94
61
|
return null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_PRODUCT_FAQ_LIST_QUERY = gql`
|
|
4
|
+
query getProductFaqList($productId: Int!) {
|
|
5
|
+
productFaqList(product_id: $productId) {
|
|
6
|
+
question_id
|
|
7
|
+
seller_id
|
|
8
|
+
customer_name
|
|
9
|
+
customer_email
|
|
10
|
+
category_id
|
|
11
|
+
store_id
|
|
12
|
+
title
|
|
13
|
+
title_size
|
|
14
|
+
title_color
|
|
15
|
+
title_background
|
|
16
|
+
border_width
|
|
17
|
+
border_color
|
|
18
|
+
border_radius
|
|
19
|
+
body_color
|
|
20
|
+
body_background
|
|
21
|
+
margin_bottom
|
|
22
|
+
margin_left
|
|
23
|
+
icon
|
|
24
|
+
answer
|
|
25
|
+
status
|
|
26
|
+
position
|
|
27
|
+
creation_time
|
|
28
|
+
update_time
|
|
29
|
+
meta_keywords
|
|
30
|
+
meta_description
|
|
31
|
+
page_title
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
getProductFaqListQuery: GET_PRODUCT_FAQ_LIST_QUERY,
|
|
38
|
+
};
|
|
39
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useLazyQuery } from '@apollo/client';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
5
|
+
import DEFAULT_OPERATIONS from './productFaq.gql';
|
|
6
|
+
|
|
7
|
+
export const useProductFAQ = props => {
|
|
8
|
+
const operations = mergeOperations(DEFAULT_OPERATIONS, props?.operations);
|
|
9
|
+
const { getProductFaqListQuery } = operations;
|
|
10
|
+
|
|
11
|
+
const [fetchProductFaqList, productFaqListState] = useLazyQuery(
|
|
12
|
+
getProductFaqListQuery,
|
|
13
|
+
{
|
|
14
|
+
fetchPolicy: 'network-only',
|
|
15
|
+
nextFetchPolicy: 'cache-first',
|
|
16
|
+
notifyOnNetworkStatusChange: true,
|
|
17
|
+
errorPolicy: 'all'
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const loadProductFaqList = useCallback(
|
|
22
|
+
variables => {
|
|
23
|
+
const id = variables && variables.productId;
|
|
24
|
+
const parsedId = typeof id === 'number' ? id : parseInt(id, 10);
|
|
25
|
+
if (isNaN(parsedId)) {
|
|
26
|
+
return Promise.resolve(null);
|
|
27
|
+
}
|
|
28
|
+
return fetchProductFaqList({ variables: { productId: parsedId } });
|
|
29
|
+
},
|
|
30
|
+
[fetchProductFaqList]
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
loadProductFaqList,
|
|
35
|
+
productFaqListState,
|
|
36
|
+
startPolling:
|
|
37
|
+
productFaqListState && productFaqListState.startPolling
|
|
38
|
+
? productFaqListState.startPolling
|
|
39
|
+
: undefined,
|
|
40
|
+
stopPolling:
|
|
41
|
+
productFaqListState && productFaqListState.stopPolling
|
|
42
|
+
? productFaqListState.stopPolling
|
|
43
|
+
: undefined
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default useProductFAQ;
|
|
48
|
+
|
package/src/talons/RFQ/useRFQ.js
CHANGED
|
@@ -31,6 +31,7 @@ export const useSocialLogin = props => {
|
|
|
31
31
|
|
|
32
32
|
const apolloClient = useApolloClient();
|
|
33
33
|
const [isSigningIn, setIsSigningIn] = useState(false);
|
|
34
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
34
35
|
|
|
35
36
|
const [
|
|
36
37
|
{ cartId },
|
|
@@ -60,6 +61,7 @@ export const useSocialLogin = props => {
|
|
|
60
61
|
|
|
61
62
|
useEffect(async () => {
|
|
62
63
|
if (jwtToken) {
|
|
64
|
+
setIsLoading(true);
|
|
63
65
|
setIsSigningIn(true);
|
|
64
66
|
try {
|
|
65
67
|
// Get source cart id (guest cart id).
|
|
@@ -124,6 +126,8 @@ export const useSocialLogin = props => {
|
|
|
124
126
|
}),
|
|
125
127
|
timeout: 5000
|
|
126
128
|
});
|
|
129
|
+
|
|
130
|
+
setIsLoading(false);
|
|
127
131
|
} catch (error) {
|
|
128
132
|
if (process.env.NODE_ENV !== 'production') {
|
|
129
133
|
console.error(error);
|
|
@@ -162,6 +166,7 @@ export const useSocialLogin = props => {
|
|
|
162
166
|
|
|
163
167
|
return {
|
|
164
168
|
errors,
|
|
169
|
+
isLoading,
|
|
165
170
|
// isBusy: isGettingDetails || isSigningIn || recaptchaLoading,
|
|
166
171
|
isBusy: isGettingDetails || isSigningIn,
|
|
167
172
|
setFormApi
|