@riosst100/pwa-marketplace 1.0.0 → 1.0.2
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/Utilities/graphQL.js +1 -1
- package/src/componentOverrideMapping.js +9 -9
- package/src/components/BecomeSeller/becomeSeller.js +220 -0
- package/src/components/BecomeSeller/becomeSeller.module.css +47 -0
- package/src/components/BecomeSeller/index.js +1 -0
- package/src/components/BecomeSellerLink/becomeSellerLink.js +28 -0
- package/src/components/BecomeSellerLink/becomeSellerLink.module.css +13 -0
- package/src/components/BecomeSellerPage/becomeSellerPage.js +50 -0
- package/src/components/BecomeSellerPage/becomeSellerPage.module.css +21 -0
- package/src/components/BecomeSellerPage/index.js +1 -0
- package/src/components/Header/becomeSellerLink.js +28 -0
- package/src/components/Header/becomeSellerLink.module.css +13 -0
- package/src/components/Header/websiteSwitcher.js +1 -1
- package/src/components/WebsiteSwitcher/websiteSwitcher.js +109 -0
- package/src/components/WebsiteSwitcher/websiteSwitcher.module.css +111 -0
- package/src/components/WebsiteSwitcher/websiteSwitcher.shimmer.js +6 -0
- package/src/components/WebsiteSwitcher/websiteSwitcherItem.js +47 -0
- package/src/components/WebsiteSwitcher/websiteSwitcherItem.module.css +20 -0
- package/src/intercept.js +32 -19
- package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +1 -1
- package/src/overwrites/venia-ui/lib/components/Header/header.js +3 -1
- package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js +2 -2
- package/src/talons/BecomeSeller/becomeSeller.gql.js +136 -0
- package/src/talons/BecomeSeller/useBecomeSeller.js +288 -0
- package/src/talons/BecomeSellerLink/useBecomeSellerLink.js +13 -0
- package/src/talons/BecomeSellerPage/useBecomeSellerPage.js +68 -0
- package/src/talons/Header/useBecomeSellerLink.js +13 -0
- package/src/talons/WebsiteSwitcher/useWebsiteSwitcher.js +218 -0
- package/src/talons/WebsiteSwitcher/websiteSwitcher.gql.js +45 -0
package/package.json
CHANGED
package/src/Utilities/graphQL.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const debug = require('@magento/pwa-buildpack/lib/util/debug').makeFileLogger(__filename);
|
|
2
2
|
|
|
3
3
|
const fetch = require('node-fetch');
|
|
4
|
-
const graphQLQueries = require('@riosst100/pwa-
|
|
4
|
+
const graphQLQueries = require('@riosst100/pwa-marketplace/src/queries');
|
|
5
5
|
const https = require('https');
|
|
6
6
|
|
|
7
7
|
// To be used with `node-fetch` in order to allow self-signed certificates.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = componentOverrideMapping = {
|
|
2
|
-
[`@magento/venia-ui/lib/components/Adapter/adapter.js`]: '@riosst100/pwa-
|
|
3
|
-
[`@magento/venia-ui/lib/components/Header/header.js`]: '@riosst100/pwa-
|
|
4
|
-
[`@magento/venia-ui/lib/components/Header/storeSwitcher.js`]: '@riosst100/pwa-
|
|
5
|
-
[`@magento/venia-ui/lib/components/Header/switcherItem.js`]: '@riosst100/pwa-
|
|
6
|
-
[`@magento/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js`]: '@riosst100/pwa-
|
|
7
|
-
[`@magento/peregrine/lib/talons/Adapter/useAdapter.js`]: '@riosst100/pwa-
|
|
8
|
-
[`@magento/peregrine/lib/talons/Header/useStoreSwitcher.js`]: '@riosst100/pwa-
|
|
9
|
-
[`@magento/peregrine/lib/talons/Header/storeSwitcher.gql.js`]: '@riosst100/pwa-
|
|
10
|
-
[`@magento/pwa-buildpack/lib/queries/getAvailableStoresConfigData.graphql`]: '@riosst100/pwa-
|
|
2
|
+
[`@magento/venia-ui/lib/components/Adapter/adapter.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Adapter/adapter.js',
|
|
3
|
+
[`@magento/venia-ui/lib/components/Header/header.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/header.js',
|
|
4
|
+
[`@magento/venia-ui/lib/components/Header/storeSwitcher.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js',
|
|
5
|
+
[`@magento/venia-ui/lib/components/Header/switcherItem.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/switcherItem.js',
|
|
6
|
+
[`@magento/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js',
|
|
7
|
+
[`@magento/peregrine/lib/talons/Adapter/useAdapter.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/Adapter/useAdapter.js',
|
|
8
|
+
[`@magento/peregrine/lib/talons/Header/useStoreSwitcher.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/Header/useStoreSwitcher.js',
|
|
9
|
+
[`@magento/peregrine/lib/talons/Header/storeSwitcher.gql.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/Header/storeSwitcher.gql.js',
|
|
10
|
+
[`@magento/pwa-buildpack/lib/queries/getAvailableStoresConfigData.graphql`]: '@riosst100/pwa-marketplace/src/overwrites/pwa-buildpack/lib/queries/getAvailableStoresConfigData.graphql'
|
|
11
11
|
};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
3
|
+
import { Form } from 'informed';
|
|
4
|
+
import { func, shape, string, bool } from 'prop-types';
|
|
5
|
+
import { useBecomeSeller } from '@riosst100/pwa-marketplace/src/talons/BecomeSeller/useBecomeSeller';
|
|
6
|
+
|
|
7
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
8
|
+
import combine from '@magento/venia-ui/lib/util/combineValidators';
|
|
9
|
+
import {
|
|
10
|
+
hasLengthAtLeast,
|
|
11
|
+
isRequired,
|
|
12
|
+
validatePassword
|
|
13
|
+
} from '@magento/venia-ui/lib/util/formValidators';
|
|
14
|
+
import Button from '@magento/venia-ui/lib/components/Button';
|
|
15
|
+
import Checkbox from '@magento/venia-ui/lib/components/Checkbox';
|
|
16
|
+
import Field from '@magento/venia-ui/lib/components/Field';
|
|
17
|
+
import TextInput from '@magento/venia-ui/lib/components/TextInput';
|
|
18
|
+
import defaultClasses from './becomeSeller.module.css';
|
|
19
|
+
import FormError from '@magento/venia-ui/lib/components/FormError';
|
|
20
|
+
import Password from '@magento/venia-ui/lib/components/Password';
|
|
21
|
+
import GoogleRecaptcha from '@magento/venia-ui/lib/components/GoogleReCaptcha';
|
|
22
|
+
|
|
23
|
+
const BecomeSeller = props => {
|
|
24
|
+
const talonProps = useBecomeSeller({
|
|
25
|
+
initialValues: props.initialValues,
|
|
26
|
+
onSubmit: props.onSubmit,
|
|
27
|
+
onCancel: props.onCancel
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
errors,
|
|
32
|
+
handleCancel,
|
|
33
|
+
handleSubmit,
|
|
34
|
+
handleEnterKeyPress,
|
|
35
|
+
handleCancelKeyPress,
|
|
36
|
+
isDisabled,
|
|
37
|
+
initialValues,
|
|
38
|
+
recaptchaWidgetProps
|
|
39
|
+
} = talonProps;
|
|
40
|
+
const { formatMessage } = useIntl();
|
|
41
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
42
|
+
|
|
43
|
+
const cancelButton = props.isCancelButtonHidden ? null : (
|
|
44
|
+
<Button
|
|
45
|
+
data-cy="BecomeSeller-cancelButton"
|
|
46
|
+
className={classes.cancelButton}
|
|
47
|
+
disabled={isDisabled}
|
|
48
|
+
type="button"
|
|
49
|
+
priority="low"
|
|
50
|
+
onClick={handleCancel}
|
|
51
|
+
onKeyDown={handleCancelKeyPress}
|
|
52
|
+
>
|
|
53
|
+
<FormattedMessage
|
|
54
|
+
id={'becomeSeller.cancelText'}
|
|
55
|
+
defaultMessage={'Cancel'}
|
|
56
|
+
/>
|
|
57
|
+
</Button>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const submitButton = (
|
|
61
|
+
<Button
|
|
62
|
+
className={classes.submitButton}
|
|
63
|
+
disabled={isDisabled}
|
|
64
|
+
type="submit"
|
|
65
|
+
priority="high"
|
|
66
|
+
onKeyDown={handleEnterKeyPress}
|
|
67
|
+
data-cy="BecomeSeller-submitButton"
|
|
68
|
+
>
|
|
69
|
+
<FormattedMessage
|
|
70
|
+
id={'becomeSeller.becomeSellerText'}
|
|
71
|
+
defaultMessage={'Become a Seller'}
|
|
72
|
+
/>
|
|
73
|
+
</Button>
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Form
|
|
78
|
+
data-cy="BecomeSeller-form"
|
|
79
|
+
className={classes.root}
|
|
80
|
+
initialValues={initialValues}
|
|
81
|
+
onSubmit={handleSubmit}
|
|
82
|
+
>
|
|
83
|
+
<h2 data-cy="BecomeSeller-title" className={classes.title}>
|
|
84
|
+
<FormattedMessage
|
|
85
|
+
id={'becomeSeller.becomeSellerText'}
|
|
86
|
+
defaultMessage={'Become a Seller'}
|
|
87
|
+
/>
|
|
88
|
+
</h2>
|
|
89
|
+
<FormError errors={Array.from(errors.values())} />
|
|
90
|
+
<Field
|
|
91
|
+
id="firstName"
|
|
92
|
+
label={formatMessage({
|
|
93
|
+
id: 'becomeSeller.firstNameText',
|
|
94
|
+
defaultMessage: 'First Name'
|
|
95
|
+
})}
|
|
96
|
+
>
|
|
97
|
+
<TextInput
|
|
98
|
+
id="firstName"
|
|
99
|
+
field="customer.firstname"
|
|
100
|
+
autoComplete="given-name"
|
|
101
|
+
validate={isRequired}
|
|
102
|
+
validateOnBlur
|
|
103
|
+
mask={value => value && value.trim()}
|
|
104
|
+
maskOnBlur={true}
|
|
105
|
+
data-cy="customer-firstname"
|
|
106
|
+
aria-label={formatMessage({
|
|
107
|
+
id: 'global.firstNameRequired',
|
|
108
|
+
defaultMessage: 'First Name Required'
|
|
109
|
+
})}
|
|
110
|
+
/>
|
|
111
|
+
</Field>
|
|
112
|
+
<Field
|
|
113
|
+
id="lastName"
|
|
114
|
+
label={formatMessage({
|
|
115
|
+
id: 'becomeSeller.lastNameText',
|
|
116
|
+
defaultMessage: 'Last Name'
|
|
117
|
+
})}
|
|
118
|
+
>
|
|
119
|
+
<TextInput
|
|
120
|
+
id="lastName"
|
|
121
|
+
field="customer.lastname"
|
|
122
|
+
autoComplete="family-name"
|
|
123
|
+
validate={isRequired}
|
|
124
|
+
validateOnBlur
|
|
125
|
+
mask={value => value && value.trim()}
|
|
126
|
+
maskOnBlur={true}
|
|
127
|
+
data-cy="customer-lastname"
|
|
128
|
+
aria-label={formatMessage({
|
|
129
|
+
id: 'global.lastNameRequired',
|
|
130
|
+
defaultMessage: 'Last Name Required'
|
|
131
|
+
})}
|
|
132
|
+
/>
|
|
133
|
+
</Field>
|
|
134
|
+
<Field
|
|
135
|
+
id="Email"
|
|
136
|
+
label={formatMessage({
|
|
137
|
+
id: 'becomeSeller.emailText',
|
|
138
|
+
defaultMessage: 'Email'
|
|
139
|
+
})}
|
|
140
|
+
>
|
|
141
|
+
<TextInput
|
|
142
|
+
id="Email"
|
|
143
|
+
field="customer.email"
|
|
144
|
+
autoComplete="email"
|
|
145
|
+
validate={isRequired}
|
|
146
|
+
validateOnBlur
|
|
147
|
+
mask={value => value && value.trim()}
|
|
148
|
+
maskOnBlur={true}
|
|
149
|
+
data-cy="customer-email"
|
|
150
|
+
aria-label={formatMessage({
|
|
151
|
+
id: 'global.emailRequired',
|
|
152
|
+
defaultMessage: 'Email Required'
|
|
153
|
+
})}
|
|
154
|
+
/>
|
|
155
|
+
</Field>
|
|
156
|
+
<Password
|
|
157
|
+
id="Password"
|
|
158
|
+
autoComplete="new-password"
|
|
159
|
+
fieldName="password"
|
|
160
|
+
isToggleButtonHidden={false}
|
|
161
|
+
label={formatMessage({
|
|
162
|
+
id: 'becomeSeller.passwordText',
|
|
163
|
+
defaultMessage: 'Password'
|
|
164
|
+
})}
|
|
165
|
+
validate={combine([
|
|
166
|
+
isRequired,
|
|
167
|
+
[hasLengthAtLeast, 8],
|
|
168
|
+
validatePassword
|
|
169
|
+
])}
|
|
170
|
+
validateOnBlur
|
|
171
|
+
mask={value => value && value.trim()}
|
|
172
|
+
maskOnBlur={true}
|
|
173
|
+
data-cy="password"
|
|
174
|
+
aria-label={formatMessage({
|
|
175
|
+
id: 'global.passwordRequired',
|
|
176
|
+
defaultMessage: 'Password Required'
|
|
177
|
+
})}
|
|
178
|
+
/>
|
|
179
|
+
<div className={classes.subscribe}>
|
|
180
|
+
<Checkbox
|
|
181
|
+
field="subscribe"
|
|
182
|
+
id="subscribe"
|
|
183
|
+
label={formatMessage({
|
|
184
|
+
id: 'becomeSeller.subscribeText',
|
|
185
|
+
defaultMessage: 'Subscribe to news and updates'
|
|
186
|
+
})}
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
<GoogleRecaptcha {...recaptchaWidgetProps} />
|
|
190
|
+
<div className={classes.actions}>
|
|
191
|
+
{submitButton}
|
|
192
|
+
{cancelButton}
|
|
193
|
+
</div>
|
|
194
|
+
</Form>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
BecomeSeller.propTypes = {
|
|
199
|
+
classes: shape({
|
|
200
|
+
actions: string,
|
|
201
|
+
lead: string,
|
|
202
|
+
root: string,
|
|
203
|
+
subscribe: string
|
|
204
|
+
}),
|
|
205
|
+
initialValues: shape({
|
|
206
|
+
email: string,
|
|
207
|
+
firstName: string,
|
|
208
|
+
lastName: string
|
|
209
|
+
}),
|
|
210
|
+
isCancelButtonHidden: bool,
|
|
211
|
+
onSubmit: func,
|
|
212
|
+
onCancel: func
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
BecomeSeller.defaultProps = {
|
|
216
|
+
onCancel: () => {},
|
|
217
|
+
isCancelButtonHidden: true
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export default BecomeSeller;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: gap-xs from global;
|
|
3
|
+
composes: grid from global;
|
|
4
|
+
composes: justify-items-stretch from global;
|
|
5
|
+
composes: px-sm from global;
|
|
6
|
+
composes: py-xs from global;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.message {
|
|
10
|
+
composes: bg-subtle from global;
|
|
11
|
+
composes: leading-tight from global;
|
|
12
|
+
composes: p-xs from global;
|
|
13
|
+
composes: rounded from global;
|
|
14
|
+
composes: text-sm from global;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* TODO @TW: cannot compose */
|
|
18
|
+
.message:empty {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.actions {
|
|
23
|
+
composes: gap-xs from global;
|
|
24
|
+
composes: grid from global;
|
|
25
|
+
composes: grid-flow-row from global;
|
|
26
|
+
composes: justify-center from global;
|
|
27
|
+
composes: mt-xs from global;
|
|
28
|
+
composes: text-center from global;
|
|
29
|
+
|
|
30
|
+
composes: lg_grid-flow-col from global;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.cancelButton {
|
|
34
|
+
composes: root_lowPriority from '@magento/venia-ui/lib/components/Button/button.module.css';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.submitButton {
|
|
38
|
+
composes: root_highPriority from '@magento/venia-ui/lib/components/Button/button.module.css';
|
|
39
|
+
|
|
40
|
+
composes: col-start-auto from global;
|
|
41
|
+
|
|
42
|
+
composes: lg_col-start-2 from global;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.subscribe {
|
|
46
|
+
composes: -ml-1.5 from global;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './becomeSeller';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
3
|
+
import defaultClasses from './becomeSellerLink.module.css';
|
|
4
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
import { shape, string } from 'prop-types';
|
|
7
|
+
|
|
8
|
+
const BecomeSellerLink = props => {
|
|
9
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
10
|
+
const becomeSellerLabel = "Become a Seller";
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className={classes.root} data-cy="BecomeSellerLink-root">
|
|
14
|
+
<Link
|
|
15
|
+
aria-label={becomeSellerLabel}
|
|
16
|
+
to={resourceUrl('/become-seller')}
|
|
17
|
+
>{becomeSellerLabel}</Link>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default BecomeSellerLink;
|
|
23
|
+
|
|
24
|
+
BecomeSellerLink.propTypes = {
|
|
25
|
+
classes: shape({
|
|
26
|
+
root: string
|
|
27
|
+
})
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: grid from global;
|
|
3
|
+
composes: items-center from global;
|
|
4
|
+
composes: justify-items-start from global;
|
|
5
|
+
composes: max-w-site from global;
|
|
6
|
+
composes: mx-auto from global;
|
|
7
|
+
composes: my-0 from global;
|
|
8
|
+
composes: px-xs from global;
|
|
9
|
+
composes: py-2xs from global;
|
|
10
|
+
composes: relative from global;
|
|
11
|
+
|
|
12
|
+
composes: sm_justify-items-end from global;
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
import { useBecomeSellerPage } from '@riosst100/pwa-marketplace/src/talons/BecomeSellerPage/useBecomeSellerPage';
|
|
6
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
+
import BecomeSeller from '@riosst100/pwa-marketplace/src/components/BecomeSeller';
|
|
8
|
+
import { StoreTitle } from '@magento/venia-ui/lib/components/Head';
|
|
9
|
+
import defaultClasses from './becomeSellerPage.module.css';
|
|
10
|
+
|
|
11
|
+
const BecomeSellerPage = props => {
|
|
12
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
13
|
+
const { becomeSellerProps } = useBecomeSellerPage(props);
|
|
14
|
+
const { formatMessage } = useIntl();
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className={classes.root}>
|
|
18
|
+
<StoreTitle>
|
|
19
|
+
{formatMessage({
|
|
20
|
+
id: 'becomeSellerPage.title',
|
|
21
|
+
defaultMessage: 'Become a Seller'
|
|
22
|
+
})}
|
|
23
|
+
</StoreTitle>
|
|
24
|
+
<h1 className={classes.header}>
|
|
25
|
+
<FormattedMessage
|
|
26
|
+
id="becomeSellerPage.header"
|
|
27
|
+
defaultMessage="Become a Seller"
|
|
28
|
+
/>
|
|
29
|
+
</h1>
|
|
30
|
+
<div className={classes.contentContainer}>
|
|
31
|
+
<BecomeSeller {...becomeSellerProps} />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default BecomeSellerPage;
|
|
38
|
+
|
|
39
|
+
BecomeSellerPage.defaultProps = {
|
|
40
|
+
signedInRedirectUrl: '/become-seller',
|
|
41
|
+
signInPageUrl: 'https://seller-local.tcgcollective.co'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
BecomeSellerPage.propTypes = {
|
|
45
|
+
classes: shape({
|
|
46
|
+
root: string
|
|
47
|
+
}),
|
|
48
|
+
signedInRedirectUrl: string,
|
|
49
|
+
signInPageUrl: string
|
|
50
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: gap-y-md from global;
|
|
3
|
+
composes: grid from global;
|
|
4
|
+
composes: justify-center from global;
|
|
5
|
+
composes: px-0 from global;
|
|
6
|
+
composes: py-md from global;
|
|
7
|
+
composes: text-center from global;
|
|
8
|
+
grid-template-columns: minmax(auto, 512px);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.header {
|
|
12
|
+
composes: font-serif from global;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.contentContainer {
|
|
16
|
+
composes: lg_border-2 from global;
|
|
17
|
+
composes: lg_border-solid from global;
|
|
18
|
+
composes: lg_border-subtle from global;
|
|
19
|
+
composes: lg_pb-md from global;
|
|
20
|
+
composes: lg_rounded-md from global;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './becomeSellerPage';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
3
|
+
import defaultClasses from './becomeSellerLink.module.css';
|
|
4
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
import { shape, string } from 'prop-types';
|
|
7
|
+
|
|
8
|
+
const BecomeSellerLink = props => {
|
|
9
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
10
|
+
const becomeSellerLabel = "Become a Seller";
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className={classes.root} data-cy="BecomeSellerLink-root">
|
|
14
|
+
<Link
|
|
15
|
+
aria-label={becomeSellerLabel}
|
|
16
|
+
to={resourceUrl('/become-seller')}
|
|
17
|
+
>{becomeSellerLabel}</Link>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default BecomeSellerLink;
|
|
23
|
+
|
|
24
|
+
BecomeSellerLink.propTypes = {
|
|
25
|
+
classes: shape({
|
|
26
|
+
root: string
|
|
27
|
+
})
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: grid from global;
|
|
3
|
+
composes: items-center from global;
|
|
4
|
+
composes: justify-items-start from global;
|
|
5
|
+
composes: max-w-site from global;
|
|
6
|
+
composes: mx-auto from global;
|
|
7
|
+
composes: my-0 from global;
|
|
8
|
+
composes: px-xs from global;
|
|
9
|
+
composes: py-2xs from global;
|
|
10
|
+
composes: relative from global;
|
|
11
|
+
|
|
12
|
+
composes: sm_justify-items-end from global;
|
|
13
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { shape, string } from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import { useWebsiteSwitcher } from '@riosst100/pwa-
|
|
4
|
+
import { useWebsiteSwitcher } from '@riosst100/pwa-marketplace/src/talons/Header/useWebsiteSwitcher';
|
|
5
5
|
import { availableRoutes } from '@magento/venia-ui/lib/components/Routes/routes';
|
|
6
6
|
|
|
7
7
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useWebsiteSwitcher } from '@riosst100/pwa-marketplace/src/talons/WebsiteSwitcher/useWebsiteSwitcher';
|
|
5
|
+
import { availableRoutes } from '@magento/venia-ui/lib/components/Routes/routes';
|
|
6
|
+
|
|
7
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
8
|
+
import defaultClasses from './websiteSwitcher.module.css';
|
|
9
|
+
import WebsiteSwitcherItem from './websiteSwitcherItem';
|
|
10
|
+
import Shimmer from './websiteSwitcher.shimmer';
|
|
11
|
+
|
|
12
|
+
const WebsiteSwitcher = props => {
|
|
13
|
+
const {
|
|
14
|
+
availableStores,
|
|
15
|
+
currentGroupName,
|
|
16
|
+
currentWebsiteName,
|
|
17
|
+
handleSwitchWebsite,
|
|
18
|
+
storeGroups,
|
|
19
|
+
storeMenuRef,
|
|
20
|
+
storeMenuTriggerRef,
|
|
21
|
+
storeMenuIsOpen,
|
|
22
|
+
handleTriggerClick
|
|
23
|
+
} = useWebsiteSwitcher({ availableRoutes });
|
|
24
|
+
|
|
25
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
26
|
+
const menuClassName = storeMenuIsOpen ? classes.menu_open : classes.menu;
|
|
27
|
+
|
|
28
|
+
if (!availableStores) return <Shimmer />;
|
|
29
|
+
|
|
30
|
+
if (availableStores.size <= 1) return null;
|
|
31
|
+
|
|
32
|
+
const groups = [];
|
|
33
|
+
const hasOnlyOneGroup = storeGroups.size === 1;
|
|
34
|
+
|
|
35
|
+
storeGroups.forEach((group, key) => {
|
|
36
|
+
const stores = [];
|
|
37
|
+
group.forEach(({ storeGroupName, websiteCode, websiteName, isCurrent, storeCode }) => {
|
|
38
|
+
let label = `${websiteName}`;
|
|
39
|
+
stores.push(
|
|
40
|
+
<li
|
|
41
|
+
aria-selected={currentWebsiteName}
|
|
42
|
+
role="option"
|
|
43
|
+
key={storeCode}
|
|
44
|
+
className={classes.menuItem}
|
|
45
|
+
data-cy="WebsiteSwitcher-view"
|
|
46
|
+
>
|
|
47
|
+
<WebsiteSwitcherItem
|
|
48
|
+
active={isCurrent}
|
|
49
|
+
onClick={handleSwitchWebsite}
|
|
50
|
+
option={storeCode}
|
|
51
|
+
option2={websiteCode}
|
|
52
|
+
>
|
|
53
|
+
{label}
|
|
54
|
+
</WebsiteSwitcherItem>
|
|
55
|
+
</li>
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
groups.push(
|
|
60
|
+
<ul
|
|
61
|
+
role="listbox"
|
|
62
|
+
className={classes.groupList}
|
|
63
|
+
key={key}
|
|
64
|
+
data-cy="WebsiteSwitcher-group"
|
|
65
|
+
>
|
|
66
|
+
{stores}
|
|
67
|
+
</ul>
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
let triggerLabel = `${currentWebsiteName}`;
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div className={classes.root} data-cy="WebsiteSwitcher-root">
|
|
75
|
+
<button
|
|
76
|
+
data-cy="WebsiteSwitcher-triggerButton"
|
|
77
|
+
className={classes.trigger}
|
|
78
|
+
aria-label={currentWebsiteName}
|
|
79
|
+
onClick={handleTriggerClick}
|
|
80
|
+
ref={storeMenuTriggerRef}
|
|
81
|
+
data-cy="WebsiteSwitcher-trigger"
|
|
82
|
+
aria-expanded={storeMenuIsOpen}
|
|
83
|
+
>
|
|
84
|
+
{triggerLabel || ''}
|
|
85
|
+
</button>
|
|
86
|
+
<div
|
|
87
|
+
ref={storeMenuRef}
|
|
88
|
+
className={menuClassName}
|
|
89
|
+
data-cy="WebsiteSwitcher-menu"
|
|
90
|
+
>
|
|
91
|
+
<div className={classes.groups}>{groups}</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default WebsiteSwitcher;
|
|
98
|
+
|
|
99
|
+
WebsiteSwitcher.propTypes = {
|
|
100
|
+
classes: shape({
|
|
101
|
+
groupList: string,
|
|
102
|
+
groups: string,
|
|
103
|
+
menu: string,
|
|
104
|
+
menu_open: string,
|
|
105
|
+
menuItem: string,
|
|
106
|
+
root: string,
|
|
107
|
+
trigger: string
|
|
108
|
+
})
|
|
109
|
+
};
|