Skip to content

Commit 56f3275

Browse files
author
Valentin Chatelain
authored
Merge pull request #79 from val92130/develop
2.9.2
2 parents c5c1dda + 1d6b72d commit 56f3275

File tree

6 files changed

+42
-17
lines changed

6 files changed

+42
-17
lines changed

bot/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "Supreme Auto-Checkout bot",
44
"description": "Supreme Open-Source add to cart bot",
5-
"version": "2.9.1",
5+
"version": "2.9.2",
66
"background": {
77
"scripts": ["background.js"]
88
},

bot/src/app/components/shops/supreme/pages/Billing.jsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const Billing = props => {
6363
floatingLabelText="Email"
6464
hintText="Email"
6565
style={Styles.fields.text}
66-
validate={[Validators.required, Validators.email]}
66+
validate={[Validators.email]}
6767
/>
6868
</div>
6969

@@ -74,7 +74,6 @@ const Billing = props => {
7474
floatingLabelText="Phone number"
7575
hintText="Phone number"
7676
style={Styles.fields.text}
77-
validate={[Validators.required]}
7877
/>
7978
</div>
8079

@@ -85,7 +84,6 @@ const Billing = props => {
8584
floatingLabelText="Address"
8685
hintText="Address"
8786
style={Styles.fields.text}
88-
validate={[Validators.required]}
8987
/>
9088
</div>
9189

@@ -106,7 +104,6 @@ const Billing = props => {
106104
floatingLabelText="City"
107105
hintText="City"
108106
style={Styles.fields.text}
109-
validate={[Validators.required]}
110107
/>
111108
</div>
112109

@@ -117,7 +114,6 @@ const Billing = props => {
117114
floatingLabelText="Country"
118115
hintText="Country"
119116
style={Styles.fields.text}
120-
validate={[Validators.required]}
121117
>
122118
{
123119
Utils.countries.map(x => <MenuItem key={x.value} value={x.value} primaryText={x.text} />)
@@ -132,7 +128,6 @@ const Billing = props => {
132128
floatingLabelText="State"
133129
hintText="State"
134130
style={Styles.fields.text}
135-
validate={[Validators.required]}
136131
>
137132
{
138133
getStatesForCountry(country).map(x => <MenuItem key={x.value} value={x.value} primaryText={x.text} />)
@@ -146,7 +141,6 @@ const Billing = props => {
146141
component={TextField}
147142
floatingLabelText="Zip"
148143
style={Styles.fields.text}
149-
validate={[Validators.required]}
150144
/>
151145
</div>
152146

@@ -156,7 +150,6 @@ const Billing = props => {
156150
component={SelectField}
157151
floatingLabelText="Credit card type"
158152
style={Styles.fields.text}
159-
validate={[Validators.required]}
160153
>
161154
{
162155
getCreditCardsForCountry(country).map(x =>
@@ -173,7 +166,6 @@ const Billing = props => {
173166
floatingLabelText="Credit Card Number"
174167
hintText="Credit Card Number"
175168
style={Styles.fields.text}
176-
validate={[Validators.required]}
177169
/>
178170
</div>
179171

@@ -183,7 +175,6 @@ const Billing = props => {
183175
component={SelectField}
184176
floatingLabelText="Expiry month"
185177
hintText="Expiry month"
186-
validate={[Validators.required]}
187178
style={Styles.fields.text}
188179
>
189180
{
@@ -202,12 +193,11 @@ const Billing = props => {
202193
floatingLabelText="Expiry year"
203194
hintText="Expiry year"
204195
style={Styles.fields.text}
205-
validate={[Validators.required]}
206196
>
207197
{
208198
Array.apply(null, new Array(10)).map((x, i) => {
209199
const year = new Date().getFullYear() + i;
210-
return <MenuItem key={year} value={year} primaryText={year}/>;
200+
return <MenuItem key={year} value={year} primaryText={year} />;
211201
})
212202
}
213203
</Field>
@@ -220,7 +210,6 @@ const Billing = props => {
220210
hintText="CCV"
221211
floatingLabelText="CCV"
222212
style={Styles.fields.text}
223-
validate={[Validators.required]}
224213
/>
225214
</div>
226215
<div>

bot/src/app/components/shops/supreme/pages/Options.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const defaultValues = {
2626
addToCartDelay: 200,
2727
checkoutDelay: 2000,
2828
showNotifications: false,
29+
disableImages: false,
2930
};
3031

3132
class HelperField extends Component {
@@ -197,6 +198,26 @@ const Options = props => {
197198
}
198199
/>
199200
</div>
201+
202+
<div>
203+
<HelperField
204+
field={
205+
<Field
206+
name="disableImages"
207+
component={Toggle}
208+
style={{ width: 'auto' }}
209+
/>
210+
}
211+
title="Disable images loading"
212+
helperText={
213+
<div>
214+
<p>
215+
If enabled, images will not be loaded on the Supreme website, this can improve speed.
216+
</p>
217+
</div>
218+
}
219+
/>
220+
</div>
200221
<div>
201222
<HelperField
202223
field={

bot/src/app/index.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,26 @@ async function init() {
3636
};
3737
const store = createStore(rootReducer, savedState, applyMiddleware(...middleware));
3838

39+
let imageSettings = 'allow';
3940
// Save state in localStorage automatically
4041
store.subscribe(async () => {
4142
const state = store.getState();
4243
if (state) {
4344
await StorageService.saveState({ menu: state.menu, profiles: state.profiles, atc: state.atc });
45+
try {
46+
const settings = await StorageService.getCurrentProfileSettings();
47+
const newImageSettings = settings.Supreme.Options.disableImages ? 'block' : 'allow';
48+
if (newImageSettings !== imageSettings) {
49+
chrome.contentSettings.images.set({
50+
primaryPattern: 'http://www.supremenewyork.com/*',
51+
setting: newImageSettings,
52+
});
53+
imageSettings = newImageSettings;
54+
}
55+
} catch(e) {
56+
console.error(e);
57+
console.error('Error while trying to set image settings');
58+
}
4459
}
4560
});
4661

bot/src/app/utils/FormValidators.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as Helpers from './Helpers';
22

33
export function email(input) {
44
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
5-
return re.test(input) ? undefined : 'Please enter a valid email';
5+
return (!input || re.test(input)) ? undefined : 'Please enter a valid email';
66
}
77

88
export function required(value) {
@@ -33,7 +33,7 @@ export function maxValue(max) {
3333
}
3434

3535
export function fullName(value) {
36-
return !value || value.split(' ').filter(x => x !== "").length < 2 ? 'Please enter a valid full name (firstname + lastname)' : undefined;
36+
return value && value.split(' ').filter(x => x !== '').length < 2 ? 'Please enter a valid full name (firstname + lastname)' : undefined;
3737
}
3838

3939
export function unique(candidates) {

bot/src/app/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default '2.9.1';
1+
export default '2.9.2';

0 commit comments

Comments
 (0)