@riosst100/pwa-marketplace 2.9.4 → 2.9.6
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/i18n/en_US.json +1 -0
- package/i18n/id_ID.json +1 -0
- package/package.json +1 -1
- package/src/componentOverrideMapping.js +6 -1
- package/src/components/ConfirmEmailPage/confirmEmail.js +76 -0
- package/src/components/ConfirmEmailPage/confirmEmail.module.css +71 -0
- package/src/components/ConfirmEmailPage/index.js +1 -0
- package/src/components/FavoriteSellerPage/favoriteSeller.js +0 -1
- package/src/components/FavoriteSellerPage/item.js +0 -2
- package/src/components/OrderDetail/components/itemsOrdered.js +94 -82
- package/src/components/OrderDetail/components/rmaList.js +80 -88
- package/src/components/OrderDetail/orderDetail.js +154 -95
- package/src/components/RMAPage/RMACreate.js +225 -36
- package/src/components/RMAPage/RMADetail.js +141 -89
- package/src/components/RMAPage/RMAList.js +38 -57
- package/src/components/RMAPage/components/productItem.js +55 -30
- package/src/components/RMAPage/orderRow.js +109 -254
- package/src/components/VerifyEmailPage/verifyEmail.js +33 -10
- package/src/intercept.js +8 -1
- package/src/overwrites/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js +2 -2
- package/src/overwrites/peregrine/lib/talons/CheckoutPage/PaymentInformation/paymentMethods.gql.js +45 -0
- package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/orderHistoryPage.gql.js +117 -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 +170 -0
- package/src/overwrites/venia-ui/lib/components/AccountInformationPage/DeleteAccount.js +5 -37
- package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +3 -1
- package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js +10 -2
- package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.js +158 -79
- package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.module.css +3 -3
- package/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js +1 -1
- package/src/talons/AccountInformationPage/deleteAccount.gql.js +23 -0
- package/src/talons/AccountInformationPage/useDeleteAccount.js +98 -0
- package/src/talons/ConfirmEmailPage/confirmEmailPage.gql.js +20 -0
- package/src/talons/ConfirmEmailPage/useConfirmEmailPage.js +78 -0
- package/src/talons/OrderHistoryPage/useOrderHistoryPage.js +115 -0
- package/src/talons/RMAPage/useRmaPage.js +145 -0
- package/src/talons/VerifyEmailPage/useVerifyEmailPage.js +73 -0
- package/src/talons/VerifyEmailPage/verifyEmailPage.gql.js +36 -0
|
@@ -1,18 +1,30 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo, useEffect } from 'react';
|
|
2
2
|
import { useQuery } from '@apollo/client';
|
|
3
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
4
|
import { shape, string } from 'prop-types';
|
|
5
5
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
6
|
import defaultClasses from './verifyEmail.module.css';
|
|
7
|
-
import {
|
|
7
|
+
import { BrowserPersistence } from '@magento/peregrine/lib/util';
|
|
8
|
+
import { useHistory } from 'react-router-dom';
|
|
9
|
+
import { useVerifyEmailPage } from '@riosst100/pwa-marketplace/src/talons/VerifyEmailPage/useVerifyEmailPage';
|
|
8
10
|
|
|
11
|
+
const storage = new BrowserPersistence();
|
|
9
12
|
|
|
10
13
|
const VerifyEmailPage = props => {
|
|
11
14
|
const classes = useStyle(defaultClasses, props.classes);
|
|
12
|
-
const
|
|
13
|
-
const email = data?.customer?.email || '';
|
|
15
|
+
const email = storage.getItem('confirm_email');
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
const history = useHistory();
|
|
18
|
+
|
|
19
|
+
const { handleResendEmail, shouldShowLoadingIndicator } = useVerifyEmailPage({ email });
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!email) {
|
|
23
|
+
history.push('/');
|
|
24
|
+
}
|
|
25
|
+
}, [email, history]);
|
|
26
|
+
|
|
27
|
+
return email ? (
|
|
16
28
|
<div className={classes.root}>
|
|
17
29
|
<div className={classes.card}>
|
|
18
30
|
<h2 className={classes.title}>
|
|
@@ -21,30 +33,41 @@ const VerifyEmailPage = props => {
|
|
|
21
33
|
defaultMessage={'Please verify your email'}
|
|
22
34
|
/>
|
|
23
35
|
</h2>
|
|
36
|
+
{email ?
|
|
24
37
|
<p className={classes.subtitle}>
|
|
25
38
|
<FormattedMessage
|
|
26
39
|
id={'verifyEmail.sentTo'}
|
|
27
40
|
defaultMessage={'You\'re almost there! We sent an email to'}
|
|
28
41
|
/>
|
|
29
42
|
<br />
|
|
30
|
-
<span className={classes.email}>{
|
|
31
|
-
</p>
|
|
43
|
+
<span className={classes.email}>{email}</span>
|
|
44
|
+
</p> : ''}
|
|
32
45
|
<p className={classes.instructions}>
|
|
33
46
|
<FormattedMessage
|
|
34
47
|
id={'verifyEmail.instructions'}
|
|
35
48
|
defaultMessage={'Just click on the link in that email to complete your signup. If you don\'t see it, you may need to check your spam folder.'}
|
|
36
49
|
/>
|
|
37
50
|
</p>
|
|
51
|
+
{shouldShowLoadingIndicator ? <button
|
|
52
|
+
className={classes.resendButton}
|
|
53
|
+
type="button"
|
|
54
|
+
style={{"opacity":"0.5"}}
|
|
55
|
+
>
|
|
56
|
+
<FormattedMessage
|
|
57
|
+
id={'verifyEmail.sendingEmail'}
|
|
58
|
+
defaultMessage={'Sending Email...'}
|
|
59
|
+
/>
|
|
60
|
+
</button> :
|
|
38
61
|
<button
|
|
39
62
|
className={classes.resendButton}
|
|
40
63
|
type="button"
|
|
41
|
-
onClick={
|
|
64
|
+
onClick={handleResendEmail}
|
|
42
65
|
>
|
|
43
66
|
<FormattedMessage
|
|
44
67
|
id={'verifyEmail.resend'}
|
|
45
68
|
defaultMessage={'Resend Email'}
|
|
46
69
|
/>
|
|
47
|
-
</button>
|
|
70
|
+
</button>}
|
|
48
71
|
<div className={classes.contactHelp}>
|
|
49
72
|
<FormattedMessage
|
|
50
73
|
id={'verifyEmail.needHelp'}
|
|
@@ -59,7 +82,7 @@ const VerifyEmailPage = props => {
|
|
|
59
82
|
</div>
|
|
60
83
|
</div>
|
|
61
84
|
</div>
|
|
62
|
-
);
|
|
85
|
+
) : '';
|
|
63
86
|
};
|
|
64
87
|
|
|
65
88
|
VerifyEmailPage.propTypes = {
|
package/src/intercept.js
CHANGED
|
@@ -92,7 +92,14 @@ module.exports = targets => {
|
|
|
92
92
|
name: "VerifyEmailPage",
|
|
93
93
|
pattern: "/verify-email",
|
|
94
94
|
path: require.resolve("./components/VerifyEmailPage/index.js"),
|
|
95
|
-
authed:
|
|
95
|
+
authed: false,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
exact: true,
|
|
99
|
+
name: "ConfirmEmailPage",
|
|
100
|
+
pattern: "/confirm-email",
|
|
101
|
+
path: require.resolve("./components/ConfirmEmailPage/index.js"),
|
|
102
|
+
authed: false,
|
|
96
103
|
},
|
|
97
104
|
{
|
|
98
105
|
exact: true,
|
|
@@ -99,8 +99,8 @@ export const usePriceSummary = (props = {}) => {
|
|
|
99
99
|
|
|
100
100
|
await createSellerCart({ initCheckoutSplitCart, sellerUrl });
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
console.log('initCheckoutSplitCartData',initCheckoutSplitCartData)
|
|
103
|
+
console.log('fetchCartId',fetchCartId)
|
|
104
104
|
|
|
105
105
|
await removeCart();
|
|
106
106
|
await apolloClient.clearCacheData(apolloClient, 'cart');
|
package/src/overwrites/peregrine/lib/talons/CheckoutPage/PaymentInformation/paymentMethods.gql.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_PAYMENT_METHODS = gql`
|
|
4
|
+
query getPaymentMethods($cartId: String!) {
|
|
5
|
+
cart(cart_id: $cartId) {
|
|
6
|
+
id
|
|
7
|
+
available_payment_methods {
|
|
8
|
+
code
|
|
9
|
+
title
|
|
10
|
+
}
|
|
11
|
+
selected_payment_method {
|
|
12
|
+
code
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const SET_PAYMENT_METHOD_ON_CART = gql`
|
|
19
|
+
mutation setPaymentMethodOnCart(
|
|
20
|
+
$cartId: String!
|
|
21
|
+
$paymentMethod: PaymentMethodInput!
|
|
22
|
+
) {
|
|
23
|
+
setPaymentMethodOnCart(
|
|
24
|
+
input: { cart_id: $cartId, payment_method: $paymentMethod }
|
|
25
|
+
) {
|
|
26
|
+
cart {
|
|
27
|
+
id
|
|
28
|
+
payment_fees {
|
|
29
|
+
title
|
|
30
|
+
value
|
|
31
|
+
currency
|
|
32
|
+
}
|
|
33
|
+
selected_payment_method {
|
|
34
|
+
code
|
|
35
|
+
title
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
getPaymentMethodsQuery: GET_PAYMENT_METHODS,
|
|
44
|
+
setPaymentMethodOnCartMutation: SET_PAYMENT_METHOD_ON_CART
|
|
45
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
const CustomerOrdersFragment = gql`
|
|
4
|
+
fragment CustomerOrdersFragment on CustomerOrders {
|
|
5
|
+
items {
|
|
6
|
+
billing_address {
|
|
7
|
+
city
|
|
8
|
+
country_code
|
|
9
|
+
firstname
|
|
10
|
+
lastname
|
|
11
|
+
postcode
|
|
12
|
+
region
|
|
13
|
+
street
|
|
14
|
+
telephone
|
|
15
|
+
}
|
|
16
|
+
id
|
|
17
|
+
invoices {
|
|
18
|
+
id
|
|
19
|
+
number
|
|
20
|
+
}
|
|
21
|
+
items {
|
|
22
|
+
id
|
|
23
|
+
product_image_url
|
|
24
|
+
product_name
|
|
25
|
+
product_sale_price {
|
|
26
|
+
currency
|
|
27
|
+
value
|
|
28
|
+
}
|
|
29
|
+
product_sku
|
|
30
|
+
product_url_key
|
|
31
|
+
selected_options {
|
|
32
|
+
label
|
|
33
|
+
value
|
|
34
|
+
}
|
|
35
|
+
quantity_ordered
|
|
36
|
+
seller_name
|
|
37
|
+
}
|
|
38
|
+
number
|
|
39
|
+
order_date
|
|
40
|
+
payment_methods {
|
|
41
|
+
name
|
|
42
|
+
type
|
|
43
|
+
additional_data {
|
|
44
|
+
name
|
|
45
|
+
value
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
shipments {
|
|
49
|
+
id
|
|
50
|
+
tracking {
|
|
51
|
+
number
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
shipping_address {
|
|
55
|
+
city
|
|
56
|
+
country_code
|
|
57
|
+
firstname
|
|
58
|
+
lastname
|
|
59
|
+
postcode
|
|
60
|
+
region
|
|
61
|
+
street
|
|
62
|
+
telephone
|
|
63
|
+
}
|
|
64
|
+
shipping_method
|
|
65
|
+
status
|
|
66
|
+
total {
|
|
67
|
+
discounts {
|
|
68
|
+
amount {
|
|
69
|
+
currency
|
|
70
|
+
value
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
grand_total {
|
|
74
|
+
currency
|
|
75
|
+
value
|
|
76
|
+
}
|
|
77
|
+
subtotal {
|
|
78
|
+
currency
|
|
79
|
+
value
|
|
80
|
+
}
|
|
81
|
+
total_shipping {
|
|
82
|
+
currency
|
|
83
|
+
value
|
|
84
|
+
}
|
|
85
|
+
total_tax {
|
|
86
|
+
currency
|
|
87
|
+
value
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
page_info {
|
|
92
|
+
current_page
|
|
93
|
+
total_pages
|
|
94
|
+
}
|
|
95
|
+
total_count
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
export const GET_CUSTOMER_ORDERS = gql`
|
|
100
|
+
query GetCustomerOrders(
|
|
101
|
+
$filter: CustomerOrdersFilterInput
|
|
102
|
+
$pageSize: Int!
|
|
103
|
+
$currentPage: Int
|
|
104
|
+
) {
|
|
105
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
106
|
+
customer {
|
|
107
|
+
orders(filter: $filter, pageSize: $pageSize, currentPage: $currentPage) {
|
|
108
|
+
...CustomerOrdersFragment
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
${CustomerOrdersFragment}
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
export default {
|
|
116
|
+
getCustomerOrdersQuery: GET_CUSTOMER_ORDERS
|
|
117
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
// Align fields closely with core to ensure compatibility, while keeping extra image fields safe to use.
|
|
4
|
+
const GET_PRODUCT_THUMBNAILS = gql`
|
|
5
|
+
query getProductThumbnails($urlKeys: [String!]!) {
|
|
6
|
+
products(filter: { url_key: { in: $urlKeys } }) {
|
|
7
|
+
items {
|
|
8
|
+
uid
|
|
9
|
+
sku
|
|
10
|
+
name
|
|
11
|
+
url_key
|
|
12
|
+
thumbnail {
|
|
13
|
+
label
|
|
14
|
+
url
|
|
15
|
+
}
|
|
16
|
+
small_image { url }
|
|
17
|
+
media_gallery { url label }
|
|
18
|
+
... on ConfigurableProduct {
|
|
19
|
+
variants {
|
|
20
|
+
product {
|
|
21
|
+
sku
|
|
22
|
+
uid
|
|
23
|
+
name
|
|
24
|
+
thumbnail { label url }
|
|
25
|
+
small_image { url }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
const GET_CONFIGURABLE_THUMBNAIL_SOURCE = gql`
|
|
35
|
+
query getConfigurableThumbnailSource {
|
|
36
|
+
storeConfig {
|
|
37
|
+
store_code
|
|
38
|
+
configurable_thumbnail_source
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
getProductThumbnailsQuery: GET_PRODUCT_THUMBNAILS,
|
|
45
|
+
getConfigurableThumbnailSource: GET_CONFIGURABLE_THUMBNAIL_SOURCE
|
|
46
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useCallback, useState, useMemo } from 'react';
|
|
2
|
+
import { useQuery } from '@apollo/client';
|
|
3
|
+
|
|
4
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
5
|
+
import DEFAULT_OPERATIONS from './orderRow.gql';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Safe override of useOrderRow to guard against missing product data.
|
|
9
|
+
* Fixes: TypeError Cannot read properties of undefined (reading 'variants').
|
|
10
|
+
*/
|
|
11
|
+
export const useOrderRow = props => {
|
|
12
|
+
const { items = [], operations: ops } = props;
|
|
13
|
+
const operations = mergeOperations(DEFAULT_OPERATIONS, ops);
|
|
14
|
+
const { getProductThumbnailsQuery, getConfigurableThumbnailSource } = operations;
|
|
15
|
+
|
|
16
|
+
const urlKeys = useMemo(() => {
|
|
17
|
+
return items.map(item => item.product_url_key).filter(Boolean).sort();
|
|
18
|
+
}, [items]);
|
|
19
|
+
|
|
20
|
+
const { data, loading } = useQuery(getProductThumbnailsQuery, {
|
|
21
|
+
fetchPolicy: 'cache-and-network',
|
|
22
|
+
nextFetchPolicy: 'cache-first',
|
|
23
|
+
variables: { urlKeys }
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const { data: configurableThumbnailSourceData } = useQuery(
|
|
27
|
+
getConfigurableThumbnailSource,
|
|
28
|
+
{ fetchPolicy: 'cache-and-network' }
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const configurableThumbnailSource = useMemo(() => {
|
|
32
|
+
if (configurableThumbnailSourceData && configurableThumbnailSourceData.storeConfig) {
|
|
33
|
+
return configurableThumbnailSourceData.storeConfig.configurable_thumbnail_source;
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}, [configurableThumbnailSourceData]);
|
|
37
|
+
|
|
38
|
+
const imagesData = useMemo(() => {
|
|
39
|
+
const mappedImagesData = {};
|
|
40
|
+
|
|
41
|
+
if (!data || !data.products || !Array.isArray(data.products.items)) {
|
|
42
|
+
return mappedImagesData;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
items.forEach(item => {
|
|
46
|
+
if (!item) return;
|
|
47
|
+
|
|
48
|
+
const product = data.products.items.find(
|
|
49
|
+
element => item.product_url_key === element.url_key
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (!product) {
|
|
53
|
+
// No matching product found for url_key; leave null to avoid crashes upstream.
|
|
54
|
+
mappedImagesData[item.product_sku] = null;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// When using variant thumbnail, prefer the configured variant image if present.
|
|
59
|
+
if (
|
|
60
|
+
configurableThumbnailSource === 'itself' &&
|
|
61
|
+
Array.isArray(product.variants) &&
|
|
62
|
+
product.variants.length > 0
|
|
63
|
+
) {
|
|
64
|
+
const foundVariant = product.variants.find(
|
|
65
|
+
variant => variant && variant.product && variant.product.sku === item.product_sku
|
|
66
|
+
);
|
|
67
|
+
mappedImagesData[item.product_sku] = (foundVariant && foundVariant.product) || product;
|
|
68
|
+
} else {
|
|
69
|
+
mappedImagesData[item.product_sku] = product;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return mappedImagesData;
|
|
74
|
+
}, [data, items, configurableThumbnailSource]);
|
|
75
|
+
|
|
76
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
77
|
+
const handleContentToggle = useCallback(() => {
|
|
78
|
+
setIsOpen(currentValue => !currentValue);
|
|
79
|
+
}, []);
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
loading,
|
|
83
|
+
imagesData,
|
|
84
|
+
isOpen,
|
|
85
|
+
handleContentToggle
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* JSDoc type definitions
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* GraphQL operations for the Order Row Component
|
|
95
|
+
*
|
|
96
|
+
* @typedef {Object} OrderRowOperations
|
|
97
|
+
*
|
|
98
|
+
* @property {GraphQLAST} getProductThumbnailsQuery The query used to get product thumbnails of items in the Order.
|
|
99
|
+
*
|
|
100
|
+
* @see [`orderRow.gql.js`]{@link https://github.com/magento/pwa-studio/blob/develop/packages/venia-ui/lib/components/OrderHistoryPage/orderRow.gql.js}
|
|
101
|
+
* for queries used in Venia
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Props data to use when rendering a collapsed image gallery
|
|
106
|
+
*
|
|
107
|
+
* @typedef {Object} OrderRowTalonProps
|
|
108
|
+
*
|
|
109
|
+
* @property {Object} imagesData Images data with thumbnail URLs to render.
|
|
110
|
+
* @property {Boolean} isOpen Boolean which represents if a row is open or not
|
|
111
|
+
* @property {Function} handleContentToggle Callback to toggle isOpen value
|
|
112
|
+
*/
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
const LofmpRmasFragment = gql`
|
|
4
|
+
fragment LofmpRmasFragment on RmaSearchResult {
|
|
5
|
+
items {
|
|
6
|
+
created_at
|
|
7
|
+
increment_id
|
|
8
|
+
items {
|
|
9
|
+
condition
|
|
10
|
+
id
|
|
11
|
+
image_url
|
|
12
|
+
name
|
|
13
|
+
price {
|
|
14
|
+
currency
|
|
15
|
+
value
|
|
16
|
+
}
|
|
17
|
+
qty_requested
|
|
18
|
+
reason
|
|
19
|
+
resolution
|
|
20
|
+
seller_name
|
|
21
|
+
sku
|
|
22
|
+
}
|
|
23
|
+
order {
|
|
24
|
+
created_at
|
|
25
|
+
id
|
|
26
|
+
increment_id
|
|
27
|
+
status
|
|
28
|
+
status_label
|
|
29
|
+
}
|
|
30
|
+
order_increment_id
|
|
31
|
+
rma_date
|
|
32
|
+
rma_id
|
|
33
|
+
seller {
|
|
34
|
+
id
|
|
35
|
+
name
|
|
36
|
+
url
|
|
37
|
+
}
|
|
38
|
+
status
|
|
39
|
+
status_label
|
|
40
|
+
}
|
|
41
|
+
total_count
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export const GET_LOFMP_RMA_CONFIGURATIONS = gql`
|
|
46
|
+
query GetLofmpRmaConfigurations {
|
|
47
|
+
lofmpRmaConfigurations {
|
|
48
|
+
conditions {
|
|
49
|
+
id
|
|
50
|
+
name
|
|
51
|
+
}
|
|
52
|
+
reasons {
|
|
53
|
+
id
|
|
54
|
+
name
|
|
55
|
+
}
|
|
56
|
+
resolutions {
|
|
57
|
+
id
|
|
58
|
+
name
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
export const GET_LOFMP_RMAS = gql`
|
|
65
|
+
query GetLofmpRmas($filter: RmaFilterInput, $pageSize: Int!, $currentPage: Int) {
|
|
66
|
+
lofmpRmas(filter: $filter, pageSize: $pageSize, currentPage: $currentPage) {
|
|
67
|
+
...LofmpRmasFragment
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
${LofmpRmasFragment}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
export const LOFMP_CREATE_RMA = gql`
|
|
74
|
+
mutation lofmpCreateRma($input: CreateRmaInput!) {
|
|
75
|
+
lofmpCreateRma(input: $input) {
|
|
76
|
+
message
|
|
77
|
+
rma_id
|
|
78
|
+
status_id
|
|
79
|
+
success
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
export const GET_LOFMP_RMA_DETAIL = gql`
|
|
85
|
+
query GetLofmpRmaDetail($rmaId: ID!) {
|
|
86
|
+
lofmpRmaDetail(rmaId: $rmaId) {
|
|
87
|
+
created_at
|
|
88
|
+
increment_id
|
|
89
|
+
items {
|
|
90
|
+
condition
|
|
91
|
+
id
|
|
92
|
+
image_url
|
|
93
|
+
name
|
|
94
|
+
product_options {
|
|
95
|
+
label
|
|
96
|
+
value
|
|
97
|
+
}
|
|
98
|
+
qty_requested
|
|
99
|
+
reason
|
|
100
|
+
resolution
|
|
101
|
+
sku
|
|
102
|
+
}
|
|
103
|
+
messages {
|
|
104
|
+
attachments {
|
|
105
|
+
id
|
|
106
|
+
name
|
|
107
|
+
url
|
|
108
|
+
}
|
|
109
|
+
created_at
|
|
110
|
+
id
|
|
111
|
+
sender_email
|
|
112
|
+
sender_name
|
|
113
|
+
text
|
|
114
|
+
}
|
|
115
|
+
order {
|
|
116
|
+
created_at
|
|
117
|
+
id
|
|
118
|
+
increment_id
|
|
119
|
+
status
|
|
120
|
+
status_label
|
|
121
|
+
}
|
|
122
|
+
order_increment_id
|
|
123
|
+
rma_date
|
|
124
|
+
rma_id
|
|
125
|
+
seller {
|
|
126
|
+
id
|
|
127
|
+
name
|
|
128
|
+
url
|
|
129
|
+
}
|
|
130
|
+
shipping_address {
|
|
131
|
+
address_type
|
|
132
|
+
base_cash_on_delivery
|
|
133
|
+
cash_on_delivery
|
|
134
|
+
city
|
|
135
|
+
company
|
|
136
|
+
country_id
|
|
137
|
+
customer_address_id
|
|
138
|
+
customer_id
|
|
139
|
+
email
|
|
140
|
+
entity_id
|
|
141
|
+
fax
|
|
142
|
+
firstname
|
|
143
|
+
lastname
|
|
144
|
+
middlename
|
|
145
|
+
parent_id
|
|
146
|
+
postcode
|
|
147
|
+
prefix
|
|
148
|
+
quote_address_id
|
|
149
|
+
region
|
|
150
|
+
region_id
|
|
151
|
+
street
|
|
152
|
+
suffix
|
|
153
|
+
telephone
|
|
154
|
+
vat_id
|
|
155
|
+
vat_is_valid
|
|
156
|
+
vat_request_date
|
|
157
|
+
vat_request_id
|
|
158
|
+
vat_request_success
|
|
159
|
+
}
|
|
160
|
+
status
|
|
161
|
+
status_label
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
|
|
166
|
+
export default {
|
|
167
|
+
getLofmpRmasQuery: GET_LOFMP_RMAS,
|
|
168
|
+
lofmpCreateRmaMutation: LOFMP_CREATE_RMA,
|
|
169
|
+
getLofmpRmaDetailQuery: GET_LOFMP_RMA_DETAIL
|
|
170
|
+
};
|
|
@@ -2,49 +2,17 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { FormattedMessage } from 'react-intl';
|
|
3
3
|
import Button from '@magento/venia-ui/lib/components/Button';
|
|
4
4
|
import { Message } from '@magento/venia-ui/lib/components/Field';
|
|
5
|
-
|
|
6
|
-
// Dummy mutation placeholder
|
|
7
|
-
const useDeleteAccount = () => {
|
|
8
|
-
const [loading, setLoading] = useState(false);
|
|
9
|
-
const [error, setError] = useState(null);
|
|
10
|
-
const [success, setSuccess] = useState(false);
|
|
11
|
-
|
|
12
|
-
const deleteAccount = async () => {
|
|
13
|
-
setLoading(true);
|
|
14
|
-
setError(null);
|
|
15
|
-
setSuccess(false);
|
|
16
|
-
// Simulate API call
|
|
17
|
-
setTimeout(() => {
|
|
18
|
-
setLoading(false);
|
|
19
|
-
setSuccess(true);
|
|
20
|
-
}, 1500);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
loading,
|
|
25
|
-
error,
|
|
26
|
-
success,
|
|
27
|
-
deleteAccount
|
|
28
|
-
};
|
|
29
|
-
};
|
|
5
|
+
import { useDeleteAccount } from '@riosst100/pwa-marketplace/src/talons/AccountInformationPage/useDeleteAccount';
|
|
30
6
|
|
|
31
7
|
const DeleteAccount = () => {
|
|
32
8
|
const [confirm, setConfirm] = useState(false);
|
|
33
9
|
const [agreement, setAgreement] = useState(false);
|
|
34
|
-
|
|
10
|
+
|
|
11
|
+
const { loading, error, success, handleDeleteAccount } = useDeleteAccount();
|
|
12
|
+
|
|
35
13
|
const handleChange = (event) => {
|
|
36
14
|
setAgreement(event.target.checked);
|
|
37
15
|
}
|
|
38
|
-
if (success) {
|
|
39
|
-
return (
|
|
40
|
-
<Message type="success">
|
|
41
|
-
<FormattedMessage
|
|
42
|
-
id="deleteAccount.success"
|
|
43
|
-
defaultMessage="Your account has been deleted."
|
|
44
|
-
/>
|
|
45
|
-
</Message>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
16
|
|
|
49
17
|
return (
|
|
50
18
|
<div style={{ marginTop: 32, border: '1px solid #f87171', padding: 24, borderRadius: 8, background: '#fef2f2' }}>
|
|
@@ -91,7 +59,7 @@ const DeleteAccount = () => {
|
|
|
91
59
|
<Button
|
|
92
60
|
priority="high"
|
|
93
61
|
disabled={loading || !agreement}
|
|
94
|
-
onClick={
|
|
62
|
+
onClick={handleDeleteAccount}
|
|
95
63
|
style={{ marginRight: 8, textTransform: 'none' }}
|
|
96
64
|
>
|
|
97
65
|
<FormattedMessage
|
|
@@ -61,8 +61,10 @@ const Adapter = props => {
|
|
|
61
61
|
useEffect(() => {
|
|
62
62
|
if (!websiteCodeInUrl && getWebsiteByUserIp) {
|
|
63
63
|
setVerifyUserIp(false);
|
|
64
|
+
|
|
65
|
+
const search = location.search;
|
|
64
66
|
|
|
65
|
-
const query = new URLSearchParams(
|
|
67
|
+
const query = new URLSearchParams(search);
|
|
66
68
|
const isAccessBaseWebsite = query.get('access_base_website') || (
|
|
67
69
|
storage.getItem('access_base_website') || null
|
|
68
70
|
);
|