commit
1fefa22944
41 changed files with 1819 additions and 737 deletions
169
.eslintrc.json
Normal file
169
.eslintrc.json
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": ["@typescript-eslint", "import"],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/adjacent-overload-signatures": "error",
|
||||||
|
"@typescript-eslint/array-type": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"default": "array-simple"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/ban-types": "error",
|
||||||
|
"@typescript-eslint/class-name-casing": "error",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "error",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": "off",
|
||||||
|
"@typescript-eslint/indent": "off",
|
||||||
|
"@typescript-eslint/interface-name-prefix": "off",
|
||||||
|
"@typescript-eslint/member-delimiter-style": [
|
||||||
|
"off",
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"multiline": {
|
||||||
|
"delimiter": "none",
|
||||||
|
"requireLast": true
|
||||||
|
},
|
||||||
|
"singleline": {
|
||||||
|
"delimiter": "semi",
|
||||||
|
"requireLast": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/member-ordering": "error",
|
||||||
|
"@typescript-eslint/no-empty-function": "error",
|
||||||
|
"@typescript-eslint/no-empty-interface": "error",
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
"@typescript-eslint/no-misused-new": "error",
|
||||||
|
"@typescript-eslint/no-namespace": "error",
|
||||||
|
"@typescript-eslint/no-parameter-properties": "off",
|
||||||
|
"@typescript-eslint/no-this-alias": "error",
|
||||||
|
"@typescript-eslint/no-use-before-declare": "off",
|
||||||
|
"@typescript-eslint/no-var-requires": "error",
|
||||||
|
"@typescript-eslint/prefer-for-of": "error",
|
||||||
|
"@typescript-eslint/prefer-function-type": "error",
|
||||||
|
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||||
|
"@typescript-eslint/quotes": "off",
|
||||||
|
"@typescript-eslint/semi": ["off", null],
|
||||||
|
"@typescript-eslint/space-within-parens": ["off", "never"],
|
||||||
|
"@typescript-eslint/triple-slash-reference": "error",
|
||||||
|
"@typescript-eslint/type-annotation-spacing": "off",
|
||||||
|
"@typescript-eslint/unified-signatures": "error",
|
||||||
|
"arrow-body-style": "error",
|
||||||
|
"arrow-parens": ["off", "as-needed"],
|
||||||
|
"camelcase": "off",
|
||||||
|
"capitalized-comments": "off",
|
||||||
|
"comma-dangle": "off",
|
||||||
|
"complexity": "off",
|
||||||
|
"constructor-super": "error",
|
||||||
|
"curly": "error",
|
||||||
|
"dot-notation": "error",
|
||||||
|
"eol-last": "off",
|
||||||
|
"eqeqeq": ["error", "smart"],
|
||||||
|
"guard-for-in": "error",
|
||||||
|
"id-blacklist": "off",
|
||||||
|
"import/no-extraneous-dependencies": "off",
|
||||||
|
"import/no-internal-modules": "off",
|
||||||
|
"import/order": "error",
|
||||||
|
"linebreak-style": "off",
|
||||||
|
"max-classes-per-file": "off",
|
||||||
|
"max-len": "off",
|
||||||
|
"new-parens": "off",
|
||||||
|
"newline-per-chained-call": "off",
|
||||||
|
"no-bitwise": "error",
|
||||||
|
"no-caller": "error",
|
||||||
|
"no-cond-assign": "error",
|
||||||
|
"no-console": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"allow": [
|
||||||
|
"warn",
|
||||||
|
"dir",
|
||||||
|
"time",
|
||||||
|
"timeEnd",
|
||||||
|
"timeLog",
|
||||||
|
"trace",
|
||||||
|
"assert",
|
||||||
|
"clear",
|
||||||
|
"count",
|
||||||
|
"countReset",
|
||||||
|
"group",
|
||||||
|
"groupEnd",
|
||||||
|
"table",
|
||||||
|
"debug",
|
||||||
|
"info",
|
||||||
|
"dirxml",
|
||||||
|
"error",
|
||||||
|
"groupCollapsed",
|
||||||
|
"Console",
|
||||||
|
"profile",
|
||||||
|
"profileEnd",
|
||||||
|
"timeStamp",
|
||||||
|
"context"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-debugger": "error",
|
||||||
|
"no-duplicate-case": "error",
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-empty": "error",
|
||||||
|
"no-eval": "error",
|
||||||
|
"no-extra-bind": "error",
|
||||||
|
"no-extra-semi": "off",
|
||||||
|
"no-fallthrough": "off",
|
||||||
|
"no-invalid-this": "off",
|
||||||
|
"no-irregular-whitespace": "off",
|
||||||
|
"no-multiple-empty-lines": "off",
|
||||||
|
"no-new-func": "error",
|
||||||
|
"no-new-wrappers": "error",
|
||||||
|
"no-redeclare": "error",
|
||||||
|
"no-return-await": "error",
|
||||||
|
"no-sequences": "error",
|
||||||
|
"no-shadow": [
|
||||||
|
"off",
|
||||||
|
{
|
||||||
|
"hoist": "all"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-sparse-arrays": "error",
|
||||||
|
"no-template-curly-in-string": "error",
|
||||||
|
"no-throw-literal": "error",
|
||||||
|
"no-trailing-spaces": "off",
|
||||||
|
"no-undef-init": "error",
|
||||||
|
"no-underscore-dangle": "off",
|
||||||
|
"no-unsafe-finally": "error",
|
||||||
|
"no-unused-expressions": "error",
|
||||||
|
"no-unused-labels": "error",
|
||||||
|
"no-var": "error",
|
||||||
|
"object-shorthand": "error",
|
||||||
|
"one-var": ["error", "never"],
|
||||||
|
"prefer-const": "error",
|
||||||
|
"prefer-object-spread": "error",
|
||||||
|
"quote-props": "off",
|
||||||
|
"radix": "error",
|
||||||
|
"sort-keys": "warn",
|
||||||
|
"space-before-function-paren": "off",
|
||||||
|
"spaced-comment": "error",
|
||||||
|
"use-isnan": "error",
|
||||||
|
"valid-typeof": "off"
|
||||||
|
// "@typescript-eslint/tslint/config": [
|
||||||
|
// "error",
|
||||||
|
// {
|
||||||
|
// "rules": {
|
||||||
|
// "jsdoc-format": [true, "check-multiline-start"],
|
||||||
|
// "no-reference-import": true,
|
||||||
|
// "object-literal-sort-keys": true,
|
||||||
|
// "prefer-conditional-expression": true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
},
|
||||||
|
"ignorePatterns": ["node_modules/", "**/types/**/*"]
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ All notable, unreleased changes to this project will be documented in this file.
|
||||||
- Fix voucher limit - #271 by @dominik-zeglen
|
- Fix voucher limit - #271 by @dominik-zeglen
|
||||||
- Allow multiple images to be uploaded - #277 by @dominik-zeglen
|
- Allow multiple images to be uploaded - #277 by @dominik-zeglen
|
||||||
- Fix dropdown clickable areas - #281 by @dominik-zeglen
|
- Fix dropdown clickable areas - #281 by @dominik-zeglen
|
||||||
|
- Use eslint - #285 by @dominik-zeglen
|
||||||
|
|
||||||
## 2.0.0
|
## 2.0.0
|
||||||
|
|
||||||
|
|
1017
package-lock.json
generated
1017
package-lock.json
generated
File diff suppressed because it is too large
Load diff
12
package.json
12
package.json
|
@ -104,6 +104,8 @@
|
||||||
"@types/storybook__react": "^4.0.2",
|
"@types/storybook__react": "^4.0.2",
|
||||||
"@types/url-join": "^0.8.3",
|
"@types/url-join": "^0.8.3",
|
||||||
"@types/webappsec-credential-management": "^0.5.1",
|
"@types/webappsec-credential-management": "^0.5.1",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^2.9.0",
|
||||||
|
"@typescript-eslint/parser": "^2.9.0",
|
||||||
"babel-core": "^7.0.0-bridge.0",
|
"babel-core": "^7.0.0-bridge.0",
|
||||||
"babel-jest": "^23.6.0",
|
"babel-jest": "^23.6.0",
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.0.6",
|
||||||
|
@ -115,8 +117,12 @@
|
||||||
"enzyme": "^3.10.0",
|
"enzyme": "^3.10.0",
|
||||||
"enzyme-adapter-react-16": "^1.14.0",
|
"enzyme-adapter-react-16": "^1.14.0",
|
||||||
"enzyme-to-json": "^3.3.5",
|
"enzyme-to-json": "^3.3.5",
|
||||||
|
"eslint": "^6.7.1",
|
||||||
|
"eslint-loader": "^3.0.2",
|
||||||
|
"eslint-plugin-import": "^2.18.2",
|
||||||
|
"eslint-plugin-prefer-arrow": "^1.1.6",
|
||||||
"file-loader": "^1.1.11",
|
"file-loader": "^1.1.11",
|
||||||
"fork-ts-checker-webpack-plugin": "^0.5.2",
|
"fork-ts-checker-webpack-plugin": "^3.1.1",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
"husky": "^3.0.8",
|
"husky": "^3.0.8",
|
||||||
"jest": "^24.8.0",
|
"jest": "^24.8.0",
|
||||||
|
@ -132,8 +138,6 @@
|
||||||
"testcafe": "^1.3.3",
|
"testcafe": "^1.3.3",
|
||||||
"ts-jest": "^23.10.5",
|
"ts-jest": "^23.10.5",
|
||||||
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
||||||
"tslint": "^5.18.0",
|
|
||||||
"tslint-config-prettier": "^1.18.0",
|
|
||||||
"webpack": "^4.35.3",
|
"webpack": "^4.35.3",
|
||||||
"webpack-bundle-tracker": "^0.3.0",
|
"webpack-bundle-tracker": "^0.3.0",
|
||||||
"webpack-cli": "^3.3.6",
|
"webpack-cli": "^3.3.6",
|
||||||
|
@ -171,7 +175,7 @@
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{ts,tsx}": [
|
"*.{ts,tsx}": [
|
||||||
"tslint --fix",
|
"eslint --fix",
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
"git add"
|
"git add"
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,12 +6,12 @@ import {
|
||||||
saveCredentials
|
saveCredentials
|
||||||
} from "@saleor/utils/credentialsManagement";
|
} from "@saleor/utils/credentialsManagement";
|
||||||
import { MutationFunction, MutationResult } from "react-apollo";
|
import { MutationFunction, MutationResult } from "react-apollo";
|
||||||
import { UserContext } from "./";
|
|
||||||
import { TypedTokenAuthMutation, TypedVerifyTokenMutation } from "./mutations";
|
import { TypedTokenAuthMutation, TypedVerifyTokenMutation } from "./mutations";
|
||||||
import { TokenAuth, TokenAuthVariables } from "./types/TokenAuth";
|
import { TokenAuth, TokenAuthVariables } from "./types/TokenAuth";
|
||||||
import { User } from "./types/User";
|
import { User } from "./types/User";
|
||||||
import { VerifyToken, VerifyTokenVariables } from "./types/VerifyToken";
|
import { VerifyToken, VerifyTokenVariables } from "./types/VerifyToken";
|
||||||
import { getAuthToken, removeAuthToken, setAuthToken } from "./utils";
|
import { getAuthToken, removeAuthToken, setAuthToken } from "./utils";
|
||||||
|
import { UserContext } from "./";
|
||||||
|
|
||||||
interface AuthProviderOperationsProps {
|
interface AuthProviderOperationsProps {
|
||||||
children: (props: {
|
children: (props: {
|
||||||
|
@ -24,21 +24,19 @@ interface AuthProviderOperationsProps {
|
||||||
}
|
}
|
||||||
const AuthProviderOperations: React.FC<AuthProviderOperationsProps> = ({
|
const AuthProviderOperations: React.FC<AuthProviderOperationsProps> = ({
|
||||||
children
|
children
|
||||||
}) => {
|
}) => (
|
||||||
return (
|
<TypedTokenAuthMutation>
|
||||||
<TypedTokenAuthMutation>
|
{(...tokenAuth) => (
|
||||||
{(...tokenAuth) => (
|
<TypedVerifyTokenMutation>
|
||||||
<TypedVerifyTokenMutation>
|
{(...tokenVerify) => (
|
||||||
{(...tokenVerify) => (
|
<AuthProvider tokenAuth={tokenAuth} tokenVerify={tokenVerify}>
|
||||||
<AuthProvider tokenAuth={tokenAuth} tokenVerify={tokenVerify}>
|
{children}
|
||||||
{children}
|
</AuthProvider>
|
||||||
</AuthProvider>
|
)}
|
||||||
)}
|
</TypedVerifyTokenMutation>
|
||||||
</TypedVerifyTokenMutation>
|
)}
|
||||||
)}
|
</TypedTokenAuthMutation>
|
||||||
</TypedTokenAuthMutation>
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
interface AuthProviderProps {
|
interface AuthProviderProps {
|
||||||
children: (props: {
|
children: (props: {
|
||||||
|
@ -69,7 +67,7 @@ class AuthProvider extends React.Component<
|
||||||
> {
|
> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = { user: undefined, persistToken: false };
|
this.state = { persistToken: false, user: undefined };
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(props: AuthProviderProps) {
|
componentWillReceiveProps(props: AuthProviderProps) {
|
||||||
|
|
|
@ -40,15 +40,11 @@ interface CategoryCreateRouteParams {
|
||||||
}
|
}
|
||||||
const CategoryCreate: React.FC<
|
const CategoryCreate: React.FC<
|
||||||
RouteComponentProps<CategoryCreateRouteParams>
|
RouteComponentProps<CategoryCreateRouteParams>
|
||||||
> = ({ match }) => {
|
> = ({ match }) => (
|
||||||
return (
|
<CategoryCreateView
|
||||||
<CategoryCreateView
|
parentId={match.params.id ? decodeURIComponent(match.params.id) : undefined}
|
||||||
parentId={
|
/>
|
||||||
match.params.id ? decodeURIComponent(match.params.id) : undefined
|
);
|
||||||
}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const CategoryList: React.FC<RouteComponentProps<{}>> = ({ location }) => {
|
const CategoryList: React.FC<RouteComponentProps<{}>> = ({ location }) => {
|
||||||
const qs = parseQs(location.search.substr(1));
|
const qs = parseQs(location.search.substr(1));
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import { categoryListUrl } from "../../categories/urls";
|
import { commonMessages, sectionNames } from "@saleor/intl";
|
||||||
import { collectionListUrl } from "../../collections/urls";
|
import { IntlShape } from "react-intl";
|
||||||
import { customerListUrl } from "../../customers/urls";
|
|
||||||
import { saleListUrl, voucherListUrl } from "../../discounts/urls";
|
|
||||||
import { orderDraftListUrl, orderListUrl } from "../../orders/urls";
|
|
||||||
import { productListUrl } from "../../products/urls";
|
|
||||||
import { languageListUrl } from "../../translations/urls";
|
|
||||||
import { PermissionEnum } from "../../types/globalTypes";
|
|
||||||
|
|
||||||
import catalogIcon from "@assets/images/menu-catalog-icon.svg";
|
import catalogIcon from "@assets/images/menu-catalog-icon.svg";
|
||||||
import customerIcon from "@assets/images/menu-customers-icon.svg";
|
import customerIcon from "@assets/images/menu-customers-icon.svg";
|
||||||
|
@ -13,8 +7,14 @@ import discountsIcon from "@assets/images/menu-discounts-icon.svg";
|
||||||
import homeIcon from "@assets/images/menu-home-icon.svg";
|
import homeIcon from "@assets/images/menu-home-icon.svg";
|
||||||
import ordersIcon from "@assets/images/menu-orders-icon.svg";
|
import ordersIcon from "@assets/images/menu-orders-icon.svg";
|
||||||
import translationIcon from "@assets/images/menu-translation-icon.svg";
|
import translationIcon from "@assets/images/menu-translation-icon.svg";
|
||||||
import { commonMessages, sectionNames } from "@saleor/intl";
|
import { categoryListUrl } from "../../categories/urls";
|
||||||
import { IntlShape } from "react-intl";
|
import { collectionListUrl } from "../../collections/urls";
|
||||||
|
import { customerListUrl } from "../../customers/urls";
|
||||||
|
import { orderDraftListUrl, orderListUrl } from "../../orders/urls";
|
||||||
|
import { productListUrl } from "../../products/urls";
|
||||||
|
import { saleListUrl, voucherListUrl } from "../../discounts/urls";
|
||||||
|
import { languageListUrl } from "../../translations/urls";
|
||||||
|
import { PermissionEnum } from "../../types/globalTypes";
|
||||||
|
|
||||||
export interface IMenuItem {
|
export interface IMenuItem {
|
||||||
ariaLabel: string;
|
ariaLabel: string;
|
||||||
|
|
|
@ -104,80 +104,76 @@ const AutocompleteSelectMenu: React.FC<AutocompleteSelectMenuProps> = props => {
|
||||||
itemToString={item => (item ? item.label : "")}
|
itemToString={item => (item ? item.label : "")}
|
||||||
onSelect={handleChange}
|
onSelect={handleChange}
|
||||||
>
|
>
|
||||||
{({ getItemProps, isOpen, openMenu, closeMenu, selectItem }) => {
|
{({ getItemProps, isOpen, openMenu, closeMenu, selectItem }) => (
|
||||||
return (
|
<div className={classes.container}>
|
||||||
<div className={classes.container}>
|
<TextField
|
||||||
<TextField
|
InputProps={{
|
||||||
InputProps={{
|
endAdornment: loading && <CircularProgress size={16} />,
|
||||||
endAdornment: loading && <CircularProgress size={16} />,
|
id: undefined,
|
||||||
id: undefined,
|
onBlur: () => {
|
||||||
onBlur: () => {
|
closeMenu();
|
||||||
closeMenu();
|
setMenuPath([]);
|
||||||
setMenuPath([]);
|
setInputValue(displayValue);
|
||||||
setInputValue(displayValue);
|
},
|
||||||
},
|
onChange: event => {
|
||||||
onChange: event => {
|
debounceFn(event.target.value);
|
||||||
debounceFn(event.target.value);
|
setInputValue(event.target.value);
|
||||||
setInputValue(event.target.value);
|
},
|
||||||
},
|
onFocus: () => openMenu(),
|
||||||
onFocus: () => openMenu(),
|
placeholder
|
||||||
placeholder
|
}}
|
||||||
}}
|
disabled={disabled}
|
||||||
disabled={disabled}
|
error={error}
|
||||||
error={error}
|
helperText={helperText}
|
||||||
helperText={helperText}
|
label={label}
|
||||||
label={label}
|
fullWidth={true}
|
||||||
fullWidth={true}
|
value={inputValue}
|
||||||
value={inputValue}
|
/>
|
||||||
/>
|
{isOpen && (
|
||||||
{isOpen && (
|
<Paper className={classes.paper} square>
|
||||||
<Paper className={classes.paper} square>
|
{options.length ? (
|
||||||
{options.length ? (
|
<>
|
||||||
<>
|
{menuPath.length > 0 && (
|
||||||
{menuPath.length > 0 && (
|
<MenuItem
|
||||||
<MenuItem
|
component="div"
|
||||||
component="div"
|
{...getItemProps({
|
||||||
{...getItemProps({
|
item: null
|
||||||
item: null
|
})}
|
||||||
})}
|
onClick={() =>
|
||||||
onClick={() =>
|
setMenuPath(menuPath.slice(0, menuPath.length - 2))
|
||||||
setMenuPath(
|
}
|
||||||
menuPath.slice(0, menuPath.length - 2)
|
>
|
||||||
)
|
<ArrowBack className={classes.menuBack} />
|
||||||
}
|
<FormattedMessage {...buttonMessages.back} />
|
||||||
>
|
</MenuItem>
|
||||||
<ArrowBack className={classes.menuBack} />
|
)}
|
||||||
<FormattedMessage {...buttonMessages.back} />
|
{(menuPath.length
|
||||||
</MenuItem>
|
? getMenuItemByPath(options, menuPath).children
|
||||||
)}
|
: options
|
||||||
{(menuPath.length
|
).map((suggestion, index) => (
|
||||||
? getMenuItemByPath(options, menuPath).children
|
<MenuItem
|
||||||
: options
|
key={suggestion.value}
|
||||||
).map((suggestion, index) => (
|
component="div"
|
||||||
<MenuItem
|
{...getItemProps({ item: suggestion })}
|
||||||
key={suggestion.value}
|
onClick={() =>
|
||||||
component="div"
|
suggestion.value
|
||||||
{...getItemProps({ item: suggestion })}
|
? selectItem(suggestion.value)
|
||||||
onClick={() =>
|
: setMenuPath([...menuPath, index])
|
||||||
suggestion.value
|
}
|
||||||
? selectItem(suggestion.value)
|
>
|
||||||
: setMenuPath([...menuPath, index])
|
{suggestion.label}
|
||||||
}
|
</MenuItem>
|
||||||
>
|
))}
|
||||||
{suggestion.label}
|
</>
|
||||||
</MenuItem>
|
) : (
|
||||||
))}
|
<MenuItem disabled component="div">
|
||||||
</>
|
<FormattedMessage defaultMessage="No results" />
|
||||||
) : (
|
</MenuItem>
|
||||||
<MenuItem disabled component="div">
|
)}
|
||||||
<FormattedMessage defaultMessage="No results" />
|
</Paper>
|
||||||
</MenuItem>
|
)}
|
||||||
)}
|
</div>
|
||||||
</Paper>
|
)}
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Downshift>
|
</Downshift>
|
||||||
)}
|
)}
|
||||||
</DebounceAutocomplete>
|
</DebounceAutocomplete>
|
||||||
|
|
|
@ -75,6 +75,11 @@ const ConfirmButton = withStyles(styles)(
|
||||||
>,
|
>,
|
||||||
ConfirmButtonState
|
ConfirmButtonState
|
||||||
> {
|
> {
|
||||||
|
state: ConfirmButtonState = {
|
||||||
|
displayCompletedActionState: false
|
||||||
|
};
|
||||||
|
timeout = null;
|
||||||
|
|
||||||
static getDerivedStateFromProps(
|
static getDerivedStateFromProps(
|
||||||
nextProps: ConfirmButtonProps,
|
nextProps: ConfirmButtonProps,
|
||||||
prevState: ConfirmButtonState
|
prevState: ConfirmButtonState
|
||||||
|
@ -87,11 +92,6 @@ const ConfirmButton = withStyles(styles)(
|
||||||
return prevState;
|
return prevState;
|
||||||
}
|
}
|
||||||
|
|
||||||
state: ConfirmButtonState = {
|
|
||||||
displayCompletedActionState: false
|
|
||||||
};
|
|
||||||
timeout = null;
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps: ConfirmButtonProps) {
|
componentDidUpdate(prevProps: ConfirmButtonProps) {
|
||||||
const { transitionState } = this.props;
|
const { transitionState } = this.props;
|
||||||
if (prevProps.transitionState !== transitionState) {
|
if (prevProps.transitionState !== transitionState) {
|
||||||
|
|
|
@ -10,9 +10,9 @@ import classNames from "classnames";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
|
|
||||||
import { FilterContent } from ".";
|
|
||||||
import { FilterContentSubmitData } from "./FilterContent";
|
import { FilterContentSubmitData } from "./FilterContent";
|
||||||
import { IFilter } from "./types";
|
import { IFilter } from "./types";
|
||||||
|
import { FilterContent } from ".";
|
||||||
|
|
||||||
export interface FilterProps<TFilterKeys = string> {
|
export interface FilterProps<TFilterKeys = string> {
|
||||||
currencySymbol: string;
|
currencySymbol: string;
|
||||||
|
|
|
@ -33,7 +33,7 @@ class MenuToggle extends React.Component<MenuToggleProps, MenuToggleState> {
|
||||||
const { open } = this.state;
|
const { open } = this.state;
|
||||||
|
|
||||||
return children({
|
return children({
|
||||||
actions: { open: this.handleClick, close: this.handleClose },
|
actions: { close: this.handleClose, open: this.handleClick },
|
||||||
open
|
open
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,12 @@ export interface MoneyProps {
|
||||||
|
|
||||||
export const Money: React.FC<MoneyProps> = ({ money }) => (
|
export const Money: React.FC<MoneyProps> = ({ money }) => (
|
||||||
<LocaleConsumer>
|
<LocaleConsumer>
|
||||||
{({ locale }) => {
|
{({ locale }) =>
|
||||||
return money.amount.toLocaleString(locale, {
|
money.amount.toLocaleString(locale, {
|
||||||
currency: money.currency,
|
currency: money.currency,
|
||||||
style: "currency"
|
style: "currency"
|
||||||
});
|
})
|
||||||
}}
|
}
|
||||||
</LocaleConsumer>
|
</LocaleConsumer>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@ interface PercentProps {
|
||||||
|
|
||||||
const Percent: React.FC<PercentProps> = ({ amount }) => (
|
const Percent: React.FC<PercentProps> = ({ amount }) => (
|
||||||
<LocaleConsumer>
|
<LocaleConsumer>
|
||||||
{({ locale }) => {
|
{({ locale }) =>
|
||||||
return (amount / 100).toLocaleString(locale, {
|
(amount / 100).toLocaleString(locale, {
|
||||||
maximumFractionDigits: 2,
|
maximumFractionDigits: 2,
|
||||||
style: "percent"
|
style: "percent"
|
||||||
});
|
})
|
||||||
}}
|
}
|
||||||
</LocaleConsumer>
|
</LocaleConsumer>
|
||||||
);
|
);
|
||||||
Percent.displayName = "Percent";
|
Percent.displayName = "Percent";
|
||||||
|
|
|
@ -12,20 +12,17 @@ import {
|
||||||
import isEqual from "lodash-es/isEqual";
|
import isEqual from "lodash-es/isEqual";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
|
import { ChangeEvent } from "@saleor/hooks/useForm";
|
||||||
import BoldIcon from "../../icons/BoldIcon";
|
import BoldIcon from "../../icons/BoldIcon";
|
||||||
import HeaderOne from "../../icons/HeaderOne";
|
|
||||||
import HeaderThree from "../../icons/HeaderThree";
|
|
||||||
import HeaderTwo from "../../icons/HeaderTwo";
|
import HeaderTwo from "../../icons/HeaderTwo";
|
||||||
|
import HeaderThree from "../../icons/HeaderThree";
|
||||||
import ItalicIcon from "../../icons/ItalicIcon";
|
import ItalicIcon from "../../icons/ItalicIcon";
|
||||||
import LinkIcon from "../../icons/LinkIcon";
|
import LinkIcon from "../../icons/LinkIcon";
|
||||||
import OrderedListIcon from "../../icons/OrderedListIcon";
|
import OrderedListIcon from "../../icons/OrderedListIcon";
|
||||||
|
import HeaderOne from "../../icons/HeaderOne";
|
||||||
import QuotationIcon from "../../icons/QuotationIcon";
|
import QuotationIcon from "../../icons/QuotationIcon";
|
||||||
import StrikethroughIcon from "../../icons/StrikethroughIcon";
|
import StrikethroughIcon from "../../icons/StrikethroughIcon";
|
||||||
import UnorderedListIcon from "../../icons/UnorderedListIcon";
|
import UnorderedListIcon from "../../icons/UnorderedListIcon";
|
||||||
|
|
||||||
// import ImageEntity from "./ImageEntity";
|
|
||||||
// import ImageSource from "./ImageSource";
|
|
||||||
import { ChangeEvent } from "@saleor/hooks/useForm";
|
|
||||||
import LinkEntity from "./LinkEntity";
|
import LinkEntity from "./LinkEntity";
|
||||||
import LinkSource from "./LinkSource";
|
import LinkSource from "./LinkSource";
|
||||||
|
|
||||||
|
@ -33,10 +30,10 @@ export interface RichTextEditorProps {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
error: boolean;
|
error: boolean;
|
||||||
helperText: string;
|
helperText: string;
|
||||||
|
initial?: RawDraftContentState;
|
||||||
label: string;
|
label: string;
|
||||||
name: string;
|
name: string;
|
||||||
scroll?: boolean;
|
scroll?: boolean;
|
||||||
initial?: RawDraftContentState;
|
|
||||||
onChange: (event: React.ChangeEvent<any>) => void;
|
onChange: (event: React.ChangeEvent<any>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,14 @@ import TextField from "@material-ui/core/TextField";
|
||||||
import Downshift from "downshift";
|
import Downshift from "downshift";
|
||||||
import { filter } from "fuzzaldrin";
|
import { filter } from "fuzzaldrin";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import SingleAutocompleteSelectFieldContent, {
|
|
||||||
SingleAutocompleteChoiceType
|
|
||||||
} from "./SingleAutocompleteSelectFieldContent";
|
|
||||||
|
|
||||||
import useStateFromProps from "@saleor/hooks/useStateFromProps";
|
import useStateFromProps from "@saleor/hooks/useStateFromProps";
|
||||||
import { FetchMoreProps } from "@saleor/types";
|
import { FetchMoreProps } from "@saleor/types";
|
||||||
import ArrowDropdownIcon from "../../icons/ArrowDropdown";
|
import ArrowDropdownIcon from "../../icons/ArrowDropdown";
|
||||||
import Debounce, { DebounceProps } from "../Debounce";
|
import Debounce, { DebounceProps } from "../Debounce";
|
||||||
|
import SingleAutocompleteSelectFieldContent, {
|
||||||
|
SingleAutocompleteChoiceType
|
||||||
|
} from "./SingleAutocompleteSelectFieldContent";
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
const useStyles = makeStyles({
|
||||||
container: {
|
container: {
|
||||||
|
|
|
@ -17,7 +17,7 @@ interface MessageManagerState {
|
||||||
|
|
||||||
export class MessageManager extends React.Component<{}, MessageManagerState> {
|
export class MessageManager extends React.Component<{}, MessageManagerState> {
|
||||||
state: MessageManagerState = {
|
state: MessageManagerState = {
|
||||||
message: { text: "", key: "0", onUndo: undefined },
|
message: { key: "0", onUndo: undefined, text: "" },
|
||||||
opened: false
|
opened: false
|
||||||
};
|
};
|
||||||
queue = [];
|
queue = [];
|
||||||
|
|
|
@ -987,8 +987,6 @@ export const customer: CustomerDetails_user & CustomerAddresses_user = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dateJoined: "2017-05-07T09:37:30.124154+00:00",
|
dateJoined: "2017-05-07T09:37:30.124154+00:00",
|
||||||
firstName: "Tom",
|
|
||||||
|
|
||||||
defaultBillingAddress: {
|
defaultBillingAddress: {
|
||||||
__typename: "Address",
|
__typename: "Address",
|
||||||
city: "Port Danielshire",
|
city: "Port Danielshire",
|
||||||
|
@ -1028,6 +1026,7 @@ export const customer: CustomerDetails_user & CustomerAddresses_user = {
|
||||||
streetAddress2: ""
|
streetAddress2: ""
|
||||||
},
|
},
|
||||||
email: "elizabeth.vaughn@example.com",
|
email: "elizabeth.vaughn@example.com",
|
||||||
|
firstName: "Tom",
|
||||||
id: "VXNlcjoy",
|
id: "VXNlcjoy",
|
||||||
isActive: true,
|
isActive: true,
|
||||||
lastLogin: "2018-05-07T09:37:30.124154+00:00",
|
lastLogin: "2018-05-07T09:37:30.124154+00:00",
|
||||||
|
|
|
@ -9,6 +9,7 @@ import Form from "@saleor/components/Form";
|
||||||
import Grid from "@saleor/components/Grid";
|
import Grid from "@saleor/components/Grid";
|
||||||
import PageHeader from "@saleor/components/PageHeader";
|
import PageHeader from "@saleor/components/PageHeader";
|
||||||
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
||||||
|
import { sectionNames } from "@saleor/intl";
|
||||||
import { UserError } from "../../../types";
|
import { UserError } from "../../../types";
|
||||||
import {
|
import {
|
||||||
DiscountValueTypeEnum,
|
DiscountValueTypeEnum,
|
||||||
|
@ -21,7 +22,6 @@ import VoucherLimits from "../VoucherLimits";
|
||||||
import VoucherRequirements from "../VoucherRequirements";
|
import VoucherRequirements from "../VoucherRequirements";
|
||||||
import VoucherTypes from "../VoucherTypes";
|
import VoucherTypes from "../VoucherTypes";
|
||||||
|
|
||||||
import { sectionNames } from "@saleor/intl";
|
|
||||||
import VoucherValue from "../VoucherValue";
|
import VoucherValue from "../VoucherValue";
|
||||||
export interface FormData {
|
export interface FormData {
|
||||||
applyOncePerCustomer: boolean;
|
applyOncePerCustomer: boolean;
|
||||||
|
|
486
src/fixtures.ts
486
src/fixtures.ts
|
@ -44,249 +44,249 @@ export const listActionsProps: ListActions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const countries = [
|
export const countries = [
|
||||||
{ name: "Afghanistan", code: "AF" },
|
{ code: "AF", name: "Afghanistan" },
|
||||||
{ name: "Åland Islands", code: "AX" },
|
{ code: "AX", name: "Åland Islands" },
|
||||||
{ name: "Albania", code: "AL" },
|
{ code: "AL", name: "Albania" },
|
||||||
{ name: "Algeria", code: "DZ" },
|
{ code: "DZ", name: "Algeria" },
|
||||||
{ name: "American Samoa", code: "AS" },
|
{ code: "AS", name: "American Samoa" },
|
||||||
{ name: "AndorrA", code: "AD" },
|
{ code: "AD", name: "AndorrA" },
|
||||||
{ name: "Angola", code: "AO" },
|
{ code: "AO", name: "Angola" },
|
||||||
{ name: "Anguilla", code: "AI" },
|
{ code: "AI", name: "Anguilla" },
|
||||||
{ name: "Antarctica", code: "AQ" },
|
{ code: "AQ", name: "Antarctica" },
|
||||||
{ name: "Antigua and Barbuda", code: "AG" },
|
{ code: "AG", name: "Antigua and Barbuda" },
|
||||||
{ name: "Argentina", code: "AR" },
|
{ code: "AR", name: "Argentina" },
|
||||||
{ name: "Armenia", code: "AM" },
|
{ code: "AM", name: "Armenia" },
|
||||||
{ name: "Aruba", code: "AW" },
|
{ code: "AW", name: "Aruba" },
|
||||||
{ name: "Australia", code: "AU" },
|
{ code: "AU", name: "Australia" },
|
||||||
{ name: "Austria", code: "AT" },
|
{ code: "AT", name: "Austria" },
|
||||||
{ name: "Azerbaijan", code: "AZ" },
|
{ code: "AZ", name: "Azerbaijan" },
|
||||||
{ name: "Bahamas", code: "BS" },
|
{ code: "BS", name: "Bahamas" },
|
||||||
{ name: "Bahrain", code: "BH" },
|
{ code: "BH", name: "Bahrain" },
|
||||||
{ name: "Bangladesh", code: "BD" },
|
{ code: "BD", name: "Bangladesh" },
|
||||||
{ name: "Barbados", code: "BB" },
|
{ code: "BB", name: "Barbados" },
|
||||||
{ name: "Belarus", code: "BY" },
|
{ code: "BY", name: "Belarus" },
|
||||||
{ name: "Belgium", code: "BE" },
|
{ code: "BE", name: "Belgium" },
|
||||||
{ name: "Belize", code: "BZ" },
|
{ code: "BZ", name: "Belize" },
|
||||||
{ name: "Benin", code: "BJ" },
|
{ code: "BJ", name: "Benin" },
|
||||||
{ name: "Bermuda", code: "BM" },
|
{ code: "BM", name: "Bermuda" },
|
||||||
{ name: "Bhutan", code: "BT" },
|
{ code: "BT", name: "Bhutan" },
|
||||||
{ name: "Bolivia", code: "BO" },
|
{ code: "BO", name: "Bolivia" },
|
||||||
{ name: "Bosnia and Herzegovina", code: "BA" },
|
{ code: "BA", name: "Bosnia and Herzegovina" },
|
||||||
{ name: "Botswana", code: "BW" },
|
{ code: "BW", name: "Botswana" },
|
||||||
{ name: "Bouvet Island", code: "BV" },
|
{ code: "BV", name: "Bouvet Island" },
|
||||||
{ name: "Brazil", code: "BR" },
|
{ code: "BR", name: "Brazil" },
|
||||||
{ name: "British Indian Ocean Territory", code: "IO" },
|
{ code: "IO", name: "British Indian Ocean Territory" },
|
||||||
{ name: "Brunei Darussalam", code: "BN" },
|
{ code: "BN", name: "Brunei Darussalam" },
|
||||||
{ name: "Bulgaria", code: "BG" },
|
{ code: "BG", name: "Bulgaria" },
|
||||||
{ name: "Burkina Faso", code: "BF" },
|
{ code: "BF", name: "Burkina Faso" },
|
||||||
{ name: "Burundi", code: "BI" },
|
{ code: "BI", name: "Burundi" },
|
||||||
{ name: "Cambodia", code: "KH" },
|
{ code: "KH", name: "Cambodia" },
|
||||||
{ name: "Cameroon", code: "CM" },
|
{ code: "CM", name: "Cameroon" },
|
||||||
{ name: "Canada", code: "CA" },
|
{ code: "CA", name: "Canada" },
|
||||||
{ name: "Cape Verde", code: "CV" },
|
{ code: "CV", name: "Cape Verde" },
|
||||||
{ name: "Cayman Islands", code: "KY" },
|
{ code: "KY", name: "Cayman Islands" },
|
||||||
{ name: "Central African Republic", code: "CF" },
|
{ code: "CF", name: "Central African Republic" },
|
||||||
{ name: "Chad", code: "TD" },
|
{ code: "TD", name: "Chad" },
|
||||||
{ name: "Chile", code: "CL" },
|
{ code: "CL", name: "Chile" },
|
||||||
{ name: "China", code: "CN" },
|
{ code: "CN", name: "China" },
|
||||||
{ name: "Christmas Island", code: "CX" },
|
{ code: "CX", name: "Christmas Island" },
|
||||||
{ name: "Cocos (Keeling) Islands", code: "CC" },
|
{ code: "CC", name: "Cocos (Keeling) Islands" },
|
||||||
{ name: "Colombia", code: "CO" },
|
{ code: "CO", name: "Colombia" },
|
||||||
{ name: "Comoros", code: "KM" },
|
{ code: "KM", name: "Comoros" },
|
||||||
{ name: "Congo", code: "CG" },
|
{ code: "CG", name: "Congo" },
|
||||||
{ name: "Congo, The Democratic Republic of the", code: "CD" },
|
{ code: "CD", name: "Congo, The Democratic Republic of the" },
|
||||||
{ name: "Cook Islands", code: "CK" },
|
{ code: "CK", name: "Cook Islands" },
|
||||||
{ name: "Costa Rica", code: "CR" },
|
{ code: "CR", name: "Costa Rica" },
|
||||||
{ name: "Cote D'Ivoire", code: "CI" },
|
{ code: "CI", name: "Cote D'Ivoire" },
|
||||||
{ name: "Croatia", code: "HR" },
|
{ code: "HR", name: "Croatia" },
|
||||||
{ name: "Cuba", code: "CU" },
|
{ code: "CU", name: "Cuba" },
|
||||||
{ name: "Cyprus", code: "CY" },
|
{ code: "CY", name: "Cyprus" },
|
||||||
{ name: "Czech Republic", code: "CZ" },
|
{ code: "CZ", name: "Czech Republic" },
|
||||||
{ name: "Denmark", code: "DK" },
|
{ code: "DK", name: "Denmark" },
|
||||||
{ name: "Djibouti", code: "DJ" },
|
{ code: "DJ", name: "Djibouti" },
|
||||||
{ name: "Dominica", code: "DM" },
|
{ code: "DM", name: "Dominica" },
|
||||||
{ name: "Dominican Republic", code: "DO" },
|
{ code: "DO", name: "Dominican Republic" },
|
||||||
{ name: "Ecuador", code: "EC" },
|
{ code: "EC", name: "Ecuador" },
|
||||||
{ name: "Egypt", code: "EG" },
|
{ code: "EG", name: "Egypt" },
|
||||||
{ name: "El Salvador", code: "SV" },
|
{ code: "SV", name: "El Salvador" },
|
||||||
{ name: "Equatorial Guinea", code: "GQ" },
|
{ code: "GQ", name: "Equatorial Guinea" },
|
||||||
{ name: "Eritrea", code: "ER" },
|
{ code: "ER", name: "Eritrea" },
|
||||||
{ name: "Estonia", code: "EE" },
|
{ code: "EE", name: "Estonia" },
|
||||||
{ name: "Ethiopia", code: "ET" },
|
{ code: "ET", name: "Ethiopia" },
|
||||||
{ name: "Falkland Islands (Malvinas)", code: "FK" },
|
{ code: "FK", name: "Falkland Islands (Malvinas)" },
|
||||||
{ name: "Faroe Islands", code: "FO" },
|
{ code: "FO", name: "Faroe Islands" },
|
||||||
{ name: "Fiji", code: "FJ" },
|
{ code: "FJ", name: "Fiji" },
|
||||||
{ name: "Finland", code: "FI" },
|
{ code: "FI", name: "Finland" },
|
||||||
{ name: "France", code: "FR" },
|
{ code: "FR", name: "France" },
|
||||||
{ name: "French Guiana", code: "GF" },
|
{ code: "GF", name: "French Guiana" },
|
||||||
{ name: "French Polynesia", code: "PF" },
|
{ code: "PF", name: "French Polynesia" },
|
||||||
{ name: "French Southern Territories", code: "TF" },
|
{ code: "TF", name: "French Southern Territories" },
|
||||||
{ name: "Gabon", code: "GA" },
|
{ code: "GA", name: "Gabon" },
|
||||||
{ name: "Gambia", code: "GM" },
|
{ code: "GM", name: "Gambia" },
|
||||||
{ name: "Georgia", code: "GE" },
|
{ code: "GE", name: "Georgia" },
|
||||||
{ name: "Germany", code: "DE" },
|
{ code: "DE", name: "Germany" },
|
||||||
{ name: "Ghana", code: "GH" },
|
{ code: "GH", name: "Ghana" },
|
||||||
{ name: "Gibraltar", code: "GI" },
|
{ code: "GI", name: "Gibraltar" },
|
||||||
{ name: "Greece", code: "GR" },
|
{ code: "GR", name: "Greece" },
|
||||||
{ name: "Greenland", code: "GL" },
|
{ code: "GL", name: "Greenland" },
|
||||||
{ name: "Grenada", code: "GD" },
|
{ code: "GD", name: "Grenada" },
|
||||||
{ name: "Guadeloupe", code: "GP" },
|
{ code: "GP", name: "Guadeloupe" },
|
||||||
{ name: "Guam", code: "GU" },
|
{ code: "GU", name: "Guam" },
|
||||||
{ name: "Guatemala", code: "GT" },
|
{ code: "GT", name: "Guatemala" },
|
||||||
{ name: "Guernsey", code: "GG" },
|
{ code: "GG", name: "Guernsey" },
|
||||||
{ name: "Guinea", code: "GN" },
|
{ code: "GN", name: "Guinea" },
|
||||||
{ name: "Guinea-Bissau", code: "GW" },
|
{ code: "GW", name: "Guinea-Bissau" },
|
||||||
{ name: "Guyana", code: "GY" },
|
{ code: "GY", name: "Guyana" },
|
||||||
{ name: "Haiti", code: "HT" },
|
{ code: "HT", name: "Haiti" },
|
||||||
{ name: "Heard Island and Mcdonald Islands", code: "HM" },
|
{ code: "HM", name: "Heard Island and Mcdonald Islands" },
|
||||||
{ name: "Holy See (Vatican City State)", code: "VA" },
|
{ code: "VA", name: "Holy See (Vatican City State)" },
|
||||||
{ name: "Honduras", code: "HN" },
|
{ code: "HN", name: "Honduras" },
|
||||||
{ name: "Hong Kong", code: "HK" },
|
{ code: "HK", name: "Hong Kong" },
|
||||||
{ name: "Hungary", code: "HU" },
|
{ code: "HU", name: "Hungary" },
|
||||||
{ name: "Iceland", code: "IS" },
|
{ code: "IS", name: "Iceland" },
|
||||||
{ name: "India", code: "IN" },
|
{ code: "IN", name: "India" },
|
||||||
{ name: "Indonesia", code: "ID" },
|
{ code: "ID", name: "Indonesia" },
|
||||||
{ name: "Iran, Islamic Republic Of", code: "IR" },
|
{ code: "IR", name: "Iran, Islamic Republic Of" },
|
||||||
{ name: "Iraq", code: "IQ" },
|
{ code: "IQ", name: "Iraq" },
|
||||||
{ name: "Ireland", code: "IE" },
|
{ code: "IE", name: "Ireland" },
|
||||||
{ name: "Isle of Man", code: "IM" },
|
{ code: "IM", name: "Isle of Man" },
|
||||||
{ name: "Israel", code: "IL" },
|
{ code: "IL", name: "Israel" },
|
||||||
{ name: "Italy", code: "IT" },
|
{ code: "IT", name: "Italy" },
|
||||||
{ name: "Jamaica", code: "JM" },
|
{ code: "JM", name: "Jamaica" },
|
||||||
{ name: "Japan", code: "JP" },
|
{ code: "JP", name: "Japan" },
|
||||||
{ name: "Jersey", code: "JE" },
|
{ code: "JE", name: "Jersey" },
|
||||||
{ name: "Jordan", code: "JO" },
|
{ code: "JO", name: "Jordan" },
|
||||||
{ name: "Kazakhstan", code: "KZ" },
|
{ code: "KZ", name: "Kazakhstan" },
|
||||||
{ name: "Kenya", code: "KE" },
|
{ code: "KE", name: "Kenya" },
|
||||||
{ name: "Kiribati", code: "KI" },
|
{ code: "KI", name: "Kiribati" },
|
||||||
{ name: "Korea, Democratic People'S Republic of", code: "KP" },
|
{ code: "KP", name: "Korea, Democratic People'S Republic of" },
|
||||||
{ name: "Korea, Republic of", code: "KR" },
|
{ code: "KR", name: "Korea, Republic of" },
|
||||||
{ name: "Kuwait", code: "KW" },
|
{ code: "KW", name: "Kuwait" },
|
||||||
{ name: "Kyrgyzstan", code: "KG" },
|
{ code: "KG", name: "Kyrgyzstan" },
|
||||||
{ name: "Lao People'S Democratic Republic", code: "LA" },
|
{ code: "LA", name: "Lao People'S Democratic Republic" },
|
||||||
{ name: "Latvia", code: "LV" },
|
{ code: "LV", name: "Latvia" },
|
||||||
{ name: "Lebanon", code: "LB" },
|
{ code: "LB", name: "Lebanon" },
|
||||||
{ name: "Lesotho", code: "LS" },
|
{ code: "LS", name: "Lesotho" },
|
||||||
{ name: "Liberia", code: "LR" },
|
{ code: "LR", name: "Liberia" },
|
||||||
{ name: "Libyan Arab Jamahiriya", code: "LY" },
|
{ code: "LY", name: "Libyan Arab Jamahiriya" },
|
||||||
{ name: "Liechtenstein", code: "LI" },
|
{ code: "LI", name: "Liechtenstein" },
|
||||||
{ name: "Lithuania", code: "LT" },
|
{ code: "LT", name: "Lithuania" },
|
||||||
{ name: "Luxembourg", code: "LU" },
|
{ code: "LU", name: "Luxembourg" },
|
||||||
{ name: "Macao", code: "MO" },
|
{ code: "MO", name: "Macao" },
|
||||||
{ name: "Macedonia, The Former Yugoslav Republic of", code: "MK" },
|
{ code: "MK", name: "Macedonia, The Former Yugoslav Republic of" },
|
||||||
{ name: "Madagascar", code: "MG" },
|
{ code: "MG", name: "Madagascar" },
|
||||||
{ name: "Malawi", code: "MW" },
|
{ code: "MW", name: "Malawi" },
|
||||||
{ name: "Malaysia", code: "MY" },
|
{ code: "MY", name: "Malaysia" },
|
||||||
{ name: "Maldives", code: "MV" },
|
{ code: "MV", name: "Maldives" },
|
||||||
{ name: "Mali", code: "ML" },
|
{ code: "ML", name: "Mali" },
|
||||||
{ name: "Malta", code: "MT" },
|
{ code: "MT", name: "Malta" },
|
||||||
{ name: "Marshall Islands", code: "MH" },
|
{ code: "MH", name: "Marshall Islands" },
|
||||||
{ name: "Martinique", code: "MQ" },
|
{ code: "MQ", name: "Martinique" },
|
||||||
{ name: "Mauritania", code: "MR" },
|
{ code: "MR", name: "Mauritania" },
|
||||||
{ name: "Mauritius", code: "MU" },
|
{ code: "MU", name: "Mauritius" },
|
||||||
{ name: "Mayotte", code: "YT" },
|
{ code: "YT", name: "Mayotte" },
|
||||||
{ name: "Mexico", code: "MX" },
|
{ code: "MX", name: "Mexico" },
|
||||||
{ name: "Micronesia, Federated States of", code: "FM" },
|
{ code: "FM", name: "Micronesia, Federated States of" },
|
||||||
{ name: "Moldova, Republic of", code: "MD" },
|
{ code: "MD", name: "Moldova, Republic of" },
|
||||||
{ name: "Monaco", code: "MC" },
|
{ code: "MC", name: "Monaco" },
|
||||||
{ name: "Mongolia", code: "MN" },
|
{ code: "MN", name: "Mongolia" },
|
||||||
{ name: "Montserrat", code: "MS" },
|
{ code: "MS", name: "Montserrat" },
|
||||||
{ name: "Morocco", code: "MA" },
|
{ code: "MA", name: "Morocco" },
|
||||||
{ name: "Mozambique", code: "MZ" },
|
{ code: "MZ", name: "Mozambique" },
|
||||||
{ name: "Myanmar", code: "MM" },
|
{ code: "MM", name: "Myanmar" },
|
||||||
{ name: "Namibia", code: "NA" },
|
{ code: "NA", name: "Namibia" },
|
||||||
{ name: "Nauru", code: "NR" },
|
{ code: "NR", name: "Nauru" },
|
||||||
{ name: "Nepal", code: "NP" },
|
{ code: "NP", name: "Nepal" },
|
||||||
{ name: "Netherlands", code: "NL" },
|
{ code: "NL", name: "Netherlands" },
|
||||||
{ name: "Netherlands Antilles", code: "AN" },
|
{ code: "AN", name: "Netherlands Antilles" },
|
||||||
{ name: "New Caledonia", code: "NC" },
|
{ code: "NC", name: "New Caledonia" },
|
||||||
{ name: "New Zealand", code: "NZ" },
|
{ code: "NZ", name: "New Zealand" },
|
||||||
{ name: "Nicaragua", code: "NI" },
|
{ code: "NI", name: "Nicaragua" },
|
||||||
{ name: "Niger", code: "NE" },
|
{ code: "NE", name: "Niger" },
|
||||||
{ name: "Nigeria", code: "NG" },
|
{ code: "NG", name: "Nigeria" },
|
||||||
{ name: "Niue", code: "NU" },
|
{ code: "NU", name: "Niue" },
|
||||||
{ name: "Norfolk Island", code: "NF" },
|
{ code: "NF", name: "Norfolk Island" },
|
||||||
{ name: "Northern Mariana Islands", code: "MP" },
|
{ code: "MP", name: "Northern Mariana Islands" },
|
||||||
{ name: "Norway", code: "NO" },
|
{ code: "NO", name: "Norway" },
|
||||||
{ name: "Oman", code: "OM" },
|
{ code: "OM", name: "Oman" },
|
||||||
{ name: "Pakistan", code: "PK" },
|
{ code: "PK", name: "Pakistan" },
|
||||||
{ name: "Palau", code: "PW" },
|
{ code: "PW", name: "Palau" },
|
||||||
{ name: "Palestinian Territory, Occupied", code: "PS" },
|
{ code: "PS", name: "Palestinian Territory, Occupied" },
|
||||||
{ name: "Panama", code: "PA" },
|
{ code: "PA", name: "Panama" },
|
||||||
{ name: "Papua New Guinea", code: "PG" },
|
{ code: "PG", name: "Papua New Guinea" },
|
||||||
{ name: "Paraguay", code: "PY" },
|
{ code: "PY", name: "Paraguay" },
|
||||||
{ name: "Peru", code: "PE" },
|
{ code: "PE", name: "Peru" },
|
||||||
{ name: "Philippines", code: "PH" },
|
{ code: "PH", name: "Philippines" },
|
||||||
{ name: "Pitcairn", code: "PN" },
|
{ code: "PN", name: "Pitcairn" },
|
||||||
{ name: "Poland", code: "PL" },
|
{ code: "PL", name: "Poland" },
|
||||||
{ name: "Portugal", code: "PT" },
|
{ code: "PT", name: "Portugal" },
|
||||||
{ name: "Puerto Rico", code: "PR" },
|
{ code: "PR", name: "Puerto Rico" },
|
||||||
{ name: "Qatar", code: "QA" },
|
{ code: "QA", name: "Qatar" },
|
||||||
{ name: "Reunion", code: "RE" },
|
{ code: "RE", name: "Reunion" },
|
||||||
{ name: "Romania", code: "RO" },
|
{ code: "RO", name: "Romania" },
|
||||||
{ name: "Russian Federation", code: "RU" },
|
{ code: "RU", name: "Russian Federation" },
|
||||||
{ name: "RWANDA", code: "RW" },
|
{ code: "RW", name: "RWANDA" },
|
||||||
{ name: "Saint Helena", code: "SH" },
|
{ code: "SH", name: "Saint Helena" },
|
||||||
{ name: "Saint Kitts and Nevis", code: "KN" },
|
{ code: "KN", name: "Saint Kitts and Nevis" },
|
||||||
{ name: "Saint Lucia", code: "LC" },
|
{ code: "LC", name: "Saint Lucia" },
|
||||||
{ name: "Saint Pierre and Miquelon", code: "PM" },
|
{ code: "PM", name: "Saint Pierre and Miquelon" },
|
||||||
{ name: "Saint Vincent and the Grenadines", code: "VC" },
|
{ code: "VC", name: "Saint Vincent and the Grenadines" },
|
||||||
{ name: "Samoa", code: "WS" },
|
{ code: "WS", name: "Samoa" },
|
||||||
{ name: "San Marino", code: "SM" },
|
{ code: "SM", name: "San Marino" },
|
||||||
{ name: "Sao Tome and Principe", code: "ST" },
|
{ code: "ST", name: "Sao Tome and Principe" },
|
||||||
{ name: "Saudi Arabia", code: "SA" },
|
{ code: "SA", name: "Saudi Arabia" },
|
||||||
{ name: "Senegal", code: "SN" },
|
{ code: "SN", name: "Senegal" },
|
||||||
{ name: "Serbia and Montenegro", code: "CS" },
|
{ code: "CS", name: "Serbia and Montenegro" },
|
||||||
{ name: "Seychelles", code: "SC" },
|
{ code: "SC", name: "Seychelles" },
|
||||||
{ name: "Sierra Leone", code: "SL" },
|
{ code: "SL", name: "Sierra Leone" },
|
||||||
{ name: "Singapore", code: "SG" },
|
{ code: "SG", name: "Singapore" },
|
||||||
{ name: "Slovakia", code: "SK" },
|
{ code: "SK", name: "Slovakia" },
|
||||||
{ name: "Slovenia", code: "SI" },
|
{ code: "SI", name: "Slovenia" },
|
||||||
{ name: "Solomon Islands", code: "SB" },
|
{ code: "SB", name: "Solomon Islands" },
|
||||||
{ name: "Somalia", code: "SO" },
|
{ code: "SO", name: "Somalia" },
|
||||||
{ name: "South Africa", code: "ZA" },
|
{ code: "ZA", name: "South Africa" },
|
||||||
{ name: "South Georgia and the South Sandwich Islands", code: "GS" },
|
{ code: "GS", name: "South Georgia and the South Sandwich Islands" },
|
||||||
{ name: "Spain", code: "ES" },
|
{ code: "ES", name: "Spain" },
|
||||||
{ name: "Sri Lanka", code: "LK" },
|
{ code: "LK", name: "Sri Lanka" },
|
||||||
{ name: "Sudan", code: "SD" },
|
{ code: "SD", name: "Sudan" },
|
||||||
{ name: "Suriname", code: "SR" },
|
{ code: "SR", name: "Suriname" },
|
||||||
{ name: "Svalbard and Jan Mayen", code: "SJ" },
|
{ code: "SJ", name: "Svalbard and Jan Mayen" },
|
||||||
{ name: "Swaziland", code: "SZ" },
|
{ code: "SZ", name: "Swaziland" },
|
||||||
{ name: "Sweden", code: "SE" },
|
{ code: "SE", name: "Sweden" },
|
||||||
{ name: "Switzerland", code: "CH" },
|
{ code: "CH", name: "Switzerland" },
|
||||||
{ name: "Syrian Arab Republic", code: "SY" },
|
{ code: "SY", name: "Syrian Arab Republic" },
|
||||||
{ name: "Taiwan, Province of China", code: "TW" },
|
{ code: "TW", name: "Taiwan, Province of China" },
|
||||||
{ name: "Tajikistan", code: "TJ" },
|
{ code: "TJ", name: "Tajikistan" },
|
||||||
{ name: "Tanzania, United Republic of", code: "TZ" },
|
{ code: "TZ", name: "Tanzania, United Republic of" },
|
||||||
{ name: "Thailand", code: "TH" },
|
{ code: "TH", name: "Thailand" },
|
||||||
{ name: "Timor-Leste", code: "TL" },
|
{ code: "TL", name: "Timor-Leste" },
|
||||||
{ name: "Togo", code: "TG" },
|
{ code: "TG", name: "Togo" },
|
||||||
{ name: "Tokelau", code: "TK" },
|
{ code: "TK", name: "Tokelau" },
|
||||||
{ name: "Tonga", code: "TO" },
|
{ code: "TO", name: "Tonga" },
|
||||||
{ name: "Trinidad and Tobago", code: "TT" },
|
{ code: "TT", name: "Trinidad and Tobago" },
|
||||||
{ name: "Tunisia", code: "TN" },
|
{ code: "TN", name: "Tunisia" },
|
||||||
{ name: "Turkey", code: "TR" },
|
{ code: "TR", name: "Turkey" },
|
||||||
{ name: "Turkmenistan", code: "TM" },
|
{ code: "TM", name: "Turkmenistan" },
|
||||||
{ name: "Turks and Caicos Islands", code: "TC" },
|
{ code: "TC", name: "Turks and Caicos Islands" },
|
||||||
{ name: "Tuvalu", code: "TV" },
|
{ code: "TV", name: "Tuvalu" },
|
||||||
{ name: "Uganda", code: "UG" },
|
{ code: "UG", name: "Uganda" },
|
||||||
{ name: "Ukraine", code: "UA" },
|
{ code: "UA", name: "Ukraine" },
|
||||||
{ name: "United Arab Emirates", code: "AE" },
|
{ code: "AE", name: "United Arab Emirates" },
|
||||||
{ name: "United Kingdom", code: "GB" },
|
{ code: "GB", name: "United Kingdom" },
|
||||||
{ name: "United States", code: "US" },
|
{ code: "US", name: "United States" },
|
||||||
{ name: "United States Minor Outlying Islands", code: "UM" },
|
{ code: "UM", name: "United States Minor Outlying Islands" },
|
||||||
{ name: "Uruguay", code: "UY" },
|
{ code: "UY", name: "Uruguay" },
|
||||||
{ name: "Uzbekistan", code: "UZ" },
|
{ code: "UZ", name: "Uzbekistan" },
|
||||||
{ name: "Vanuatu", code: "VU" },
|
{ code: "VU", name: "Vanuatu" },
|
||||||
{ name: "Venezuela", code: "VE" },
|
{ code: "VE", name: "Venezuela" },
|
||||||
{ name: "Viet Nam", code: "VN" },
|
{ code: "VN", name: "Viet Nam" },
|
||||||
{ name: "Virgin Islands, British", code: "VG" },
|
{ code: "VG", name: "Virgin Islands, British" },
|
||||||
{ name: "Virgin Islands, U.S.", code: "VI" },
|
{ code: "VI", name: "Virgin Islands, U.S." },
|
||||||
{ name: "Wallis and Futuna", code: "WF" },
|
{ code: "WF", name: "Wallis and Futuna" },
|
||||||
{ name: "Western Sahara", code: "EH" },
|
{ code: "EH", name: "Western Sahara" },
|
||||||
{ name: "Yemen", code: "YE" },
|
{ code: "YE", name: "Yemen" },
|
||||||
{ name: "Zambia", code: "ZM" },
|
{ code: "ZM", name: "Zambia" },
|
||||||
{ name: "Zimbabwe", code: "ZW" }
|
{ code: "ZW", name: "Zimbabwe" }
|
||||||
];
|
];
|
||||||
|
|
||||||
export const tabPageProps: TabPageProps = {
|
export const tabPageProps: TabPageProps = {
|
||||||
|
|
|
@ -25,7 +25,11 @@ function useListActions<TData>(
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggle(data: TData) {
|
function toggle(data: TData) {
|
||||||
isSelected(data) ? remove(data) : add(data);
|
if (isSelected(data)) {
|
||||||
|
remove(data);
|
||||||
|
} else {
|
||||||
|
add(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function set(data: TData[]) {
|
function set(data: TData[]) {
|
||||||
|
|
|
@ -13,8 +13,13 @@ function useNavigator(): UseNavigatorResult {
|
||||||
|
|
||||||
return (url: string, replace = false, preserveQs = false) => {
|
return (url: string, replace = false, preserveQs = false) => {
|
||||||
const targetUrl = preserveQs ? url + search : url;
|
const targetUrl = preserveQs ? url + search : url;
|
||||||
replace ? history.replace(targetUrl) : history.push(targetUrl);
|
if (replace) {
|
||||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
history.replace(targetUrl);
|
||||||
|
} else {
|
||||||
|
history.push(targetUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.scrollTo({ behavior: "smooth", top: 0 });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ describe("Properly computes trees", () => {
|
||||||
[{ id: "2accessories", type: "remove" }],
|
[{ id: "2accessories", type: "remove" }],
|
||||||
[
|
[
|
||||||
{ id: "2accessories", type: "remove" },
|
{ id: "2accessories", type: "remove" },
|
||||||
{ id: "4apparel", type: "move", sortOrder: 0 },
|
{ id: "4apparel", sortOrder: 0, type: "move" },
|
||||||
{ id: "3groceries", type: "remove" }
|
{ id: "3groceries", type: "remove" }
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
|
@ -6,9 +6,9 @@ export const menuList: MenuList_menus_edges_node[] = [
|
||||||
__typename: "Menu",
|
__typename: "Menu",
|
||||||
id: "TWVudTox",
|
id: "TWVudTox",
|
||||||
items: [
|
items: [
|
||||||
{ id: "TWVudUl0ZW06MQ==", __typename: "MenuItem" },
|
{ __typename: "MenuItem", id: "TWVudUl0ZW06MQ==" },
|
||||||
{ id: "TWVudUl0ZW06Mg==", __typename: "MenuItem" },
|
{ __typename: "MenuItem", id: "TWVudUl0ZW06Mg==" },
|
||||||
{ id: "TWVudUl0ZW06Mw==", __typename: "MenuItem" }
|
{ __typename: "MenuItem", id: "TWVudUl0ZW06Mw==" }
|
||||||
],
|
],
|
||||||
name: "navbar"
|
name: "navbar"
|
||||||
},
|
},
|
||||||
|
@ -16,8 +16,8 @@ export const menuList: MenuList_menus_edges_node[] = [
|
||||||
__typename: "Menu",
|
__typename: "Menu",
|
||||||
id: "TWVudToy",
|
id: "TWVudToy",
|
||||||
items: [
|
items: [
|
||||||
{ id: "TWVudUl0ZW06NA==", __typename: "MenuItem" },
|
{ __typename: "MenuItem", id: "TWVudUl0ZW06NA==" },
|
||||||
{ id: "TWVudUl0ZW06Nw==", __typename: "MenuItem" }
|
{ __typename: "MenuItem", id: "TWVudUl0ZW06Nw==" }
|
||||||
],
|
],
|
||||||
name: "footer"
|
name: "footer"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1160,8 +1160,8 @@ export const countries = [
|
||||||
{ code: "AS", label: "American Samoa" }
|
{ code: "AS", label: "American Samoa" }
|
||||||
];
|
];
|
||||||
export const shippingMethods = [
|
export const shippingMethods = [
|
||||||
{ id: "s1", name: "DHL", country: "whole world", price: {} },
|
{ country: "whole world", id: "s1", name: "DHL", price: {} },
|
||||||
{ id: "s2", name: "UPS", country: "Afghanistan" }
|
{ country: "Afghanistan", id: "s2", name: "UPS" }
|
||||||
];
|
];
|
||||||
export const orderLineSearch = (placeholderImage: string) => [
|
export const orderLineSearch = (placeholderImage: string) => [
|
||||||
{
|
{
|
||||||
|
@ -1177,21 +1177,21 @@ export const orderLineSearch = (placeholderImage: string) => [
|
||||||
__typename: "ProductVariant" as "ProductVariant",
|
__typename: "ProductVariant" as "ProductVariant",
|
||||||
id: "UHJvZHVjdFZhcmlhbnQ6MjAy",
|
id: "UHJvZHVjdFZhcmlhbnQ6MjAy",
|
||||||
name: "500ml",
|
name: "500ml",
|
||||||
price: { amount: 3.0, currency: "USD", __typename: "Money" as "Money" },
|
price: { __typename: "Money" as "Money", amount: 3.0, currency: "USD" },
|
||||||
sku: "93855755"
|
sku: "93855755"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "ProductVariant" as "ProductVariant",
|
__typename: "ProductVariant" as "ProductVariant",
|
||||||
id: "UHJvZHVjdFZhcmlhbnQ6MjAz",
|
id: "UHJvZHVjdFZhcmlhbnQ6MjAz",
|
||||||
name: "1l",
|
name: "1l",
|
||||||
price: { amount: 5.0, currency: "USD", __typename: "Money" as "Money" },
|
price: { __typename: "Money" as "Money", amount: 5.0, currency: "USD" },
|
||||||
sku: "43226647"
|
sku: "43226647"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "ProductVariant" as "ProductVariant",
|
__typename: "ProductVariant" as "ProductVariant",
|
||||||
id: "UHJvZHVjdFZhcmlhbnQ6MjA0",
|
id: "UHJvZHVjdFZhcmlhbnQ6MjA0",
|
||||||
name: "2l",
|
name: "2l",
|
||||||
price: { amount: 7.0, currency: "USD", __typename: "Money" as "Money" },
|
price: { __typename: "Money" as "Money", amount: 7.0, currency: "USD" },
|
||||||
sku: "80884671"
|
sku: "80884671"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1209,21 +1209,21 @@ export const orderLineSearch = (placeholderImage: string) => [
|
||||||
__typename: "ProductVariant" as "ProductVariant",
|
__typename: "ProductVariant" as "ProductVariant",
|
||||||
id: "UHJvZHVjdFZhcmlhbnQ6MjEx",
|
id: "UHJvZHVjdFZhcmlhbnQ6MjEx",
|
||||||
name: "500ml",
|
name: "500ml",
|
||||||
price: { amount: 3.0, currency: "USD", __typename: "Money" as "Money" },
|
price: { __typename: "Money" as "Money", amount: 3.0, currency: "USD" },
|
||||||
sku: "43200242"
|
sku: "43200242"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "ProductVariant" as "ProductVariant",
|
__typename: "ProductVariant" as "ProductVariant",
|
||||||
id: "UHJvZHVjdFZhcmlhbnQ6MjEy",
|
id: "UHJvZHVjdFZhcmlhbnQ6MjEy",
|
||||||
name: "1l",
|
name: "1l",
|
||||||
price: { amount: 5.0, currency: "USD", __typename: "Money" as "Money" },
|
price: { __typename: "Money" as "Money", amount: 5.0, currency: "USD" },
|
||||||
sku: "79129513"
|
sku: "79129513"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "ProductVariant" as "ProductVariant",
|
__typename: "ProductVariant" as "ProductVariant",
|
||||||
id: "UHJvZHVjdFZhcmlhbnQ6MjEz",
|
id: "UHJvZHVjdFZhcmlhbnQ6MjEz",
|
||||||
name: "2l",
|
name: "2l",
|
||||||
price: { amount: 7.0, currency: "USD", __typename: "Money" as "Money" },
|
price: { __typename: "Money" as "Money", amount: 7.0, currency: "USD" },
|
||||||
sku: "75799450"
|
sku: "75799450"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -99,11 +99,13 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
|
||||||
<SeoForm
|
<SeoForm
|
||||||
description={data.seoDescription}
|
description={data.seoDescription}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
descriptionPlaceholder={maybe(() => {
|
descriptionPlaceholder={maybe(
|
||||||
return convertFromRaw(data.content)
|
() =>
|
||||||
.getPlainText()
|
convertFromRaw(data.content)
|
||||||
.slice(0, 300);
|
.getPlainText()
|
||||||
}, "")}
|
.slice(0, 300),
|
||||||
|
""
|
||||||
|
)}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
title={data.seoTitle}
|
title={data.seoTitle}
|
||||||
titlePlaceholder={data.title}
|
titlePlaceholder={data.title}
|
||||||
|
|
|
@ -19,23 +19,21 @@ export interface PageDetailsProps {
|
||||||
params: PageUrlQueryParams;
|
params: PageUrlQueryParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
const createPageInput = (data: FormData): PageInput => {
|
const createPageInput = (data: FormData): PageInput => ({
|
||||||
return {
|
contentJson: JSON.stringify(data.content),
|
||||||
contentJson: JSON.stringify(data.content),
|
isPublished: data.isPublished,
|
||||||
isPublished: data.isPublished,
|
publicationDate: data.isPublished
|
||||||
publicationDate: data.isPublished
|
? null
|
||||||
? null
|
: data.publicationDate === ""
|
||||||
: data.publicationDate === ""
|
? null
|
||||||
? null
|
: data.publicationDate,
|
||||||
: data.publicationDate,
|
seo: {
|
||||||
seo: {
|
description: data.seoDescription,
|
||||||
description: data.seoDescription,
|
title: data.seoTitle
|
||||||
title: data.seoTitle
|
},
|
||||||
},
|
slug: data.slug === "" ? null : data.slug,
|
||||||
slug: data.slug === "" ? null : data.slug,
|
title: data.title
|
||||||
title: data.title
|
});
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PageDetails: React.FC<PageDetailsProps> = ({ id, params }) => {
|
export const PageDetails: React.FC<PageDetailsProps> = ({ id, params }) => {
|
||||||
const navigate = useNavigator();
|
const navigate = useNavigator();
|
||||||
|
|
|
@ -80,14 +80,12 @@ const PluginsDetailsPage: React.FC<PluginsDetailsPageProps> = props => {
|
||||||
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
|
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
|
||||||
{({ data, errors, hasChanged, submit, set, triggerChange }) => {
|
{({ data, errors, hasChanged, submit, set, triggerChange }) => {
|
||||||
const onChange = (event: ChangeEvent) => {
|
const onChange = (event: ChangeEvent) => {
|
||||||
|
const { name, value } = event.target;
|
||||||
const newData = {
|
const newData = {
|
||||||
active: data.active,
|
active: name === "active" ? value : data.active,
|
||||||
configuration: data.configuration
|
configuration: data.configuration
|
||||||
};
|
};
|
||||||
const { name, value } = event.target;
|
|
||||||
name === "active"
|
|
||||||
? (newData.active = value)
|
|
||||||
: (newData.active = data.active);
|
|
||||||
if (newData.configuration) {
|
if (newData.configuration) {
|
||||||
newData.configuration.map(item => {
|
newData.configuration.map(item => {
|
||||||
if (item.name === name) {
|
if (item.name === name) {
|
||||||
|
|
|
@ -98,36 +98,34 @@ const PluginList: React.FC<PluginListProps> = props => {
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{renderCollection(
|
{renderCollection(
|
||||||
plugins,
|
plugins,
|
||||||
plugin => {
|
plugin => (
|
||||||
return (
|
<TableRow
|
||||||
<TableRow
|
hover={!!plugin}
|
||||||
hover={!!plugin}
|
className={!!plugin ? classes.link : undefined}
|
||||||
className={!!plugin ? classes.link : undefined}
|
onClick={plugin ? onRowClick(plugin.id) : undefined}
|
||||||
onClick={plugin ? onRowClick(plugin.id) : undefined}
|
key={plugin ? plugin.id : "skeleton"}
|
||||||
key={plugin ? plugin.id : "skeleton"}
|
>
|
||||||
>
|
<TableCell className={classes.colName}>
|
||||||
<TableCell className={classes.colName}>
|
{maybe<React.ReactNode>(() => plugin.name, <Skeleton />)}
|
||||||
{maybe<React.ReactNode>(() => plugin.name, <Skeleton />)}
|
</TableCell>
|
||||||
</TableCell>
|
<TableCell className={classes.colActive}>
|
||||||
<TableCell className={classes.colActive}>
|
{maybe<React.ReactNode>(
|
||||||
{maybe<React.ReactNode>(
|
() => (
|
||||||
() => (
|
<StatusLabel
|
||||||
<StatusLabel
|
label={translateBoolean(plugin.active, intl)}
|
||||||
label={translateBoolean(plugin.active, intl)}
|
status={plugin.active ? "success" : "error"}
|
||||||
status={plugin.active ? "success" : "error"}
|
/>
|
||||||
/>
|
),
|
||||||
),
|
<Skeleton />
|
||||||
<Skeleton />
|
)}
|
||||||
)}
|
</TableCell>
|
||||||
</TableCell>
|
<TableCell className={classes.colAction}>
|
||||||
<TableCell className={classes.colAction}>
|
<div onClick={plugin ? onRowClick(plugin.id) : undefined}>
|
||||||
<div onClick={plugin ? onRowClick(plugin.id) : undefined}>
|
<EditIcon />
|
||||||
<EditIcon />
|
</div>
|
||||||
</div>
|
</TableCell>
|
||||||
</TableCell>
|
</TableRow>
|
||||||
</TableRow>
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
() => (
|
() => (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={numberOfColumns}>
|
<TableCell colSpan={numberOfColumns}>
|
||||||
|
|
|
@ -98,88 +98,84 @@ const ProductTypeOperations: React.FC<ProductTypeOperationsProps> = ({
|
||||||
onProductTypeAttributeReorder,
|
onProductTypeAttributeReorder,
|
||||||
onProductTypeDelete,
|
onProductTypeDelete,
|
||||||
onProductTypeUpdate
|
onProductTypeUpdate
|
||||||
}) => {
|
}) => (
|
||||||
return (
|
<TypedProductTypeDeleteMutation onCompleted={onProductTypeDelete}>
|
||||||
<TypedProductTypeDeleteMutation onCompleted={onProductTypeDelete}>
|
{(...deleteProductType) => (
|
||||||
{(...deleteProductType) => (
|
<TypedProductTypeUpdateMutation onCompleted={onProductTypeUpdate}>
|
||||||
<TypedProductTypeUpdateMutation onCompleted={onProductTypeUpdate}>
|
{(...updateProductType) => (
|
||||||
{(...updateProductType) => (
|
<TypedAssignAttributeMutation onCompleted={onAssignAttribute}>
|
||||||
<TypedAssignAttributeMutation onCompleted={onAssignAttribute}>
|
{(...assignAttribute) => (
|
||||||
{(...assignAttribute) => (
|
<TypedUnassignAttributeMutation onCompleted={onUnassignAttribute}>
|
||||||
<TypedUnassignAttributeMutation
|
{(...unassignAttribute) => (
|
||||||
onCompleted={onUnassignAttribute}
|
<ProductTypeAttributeReorderMutation
|
||||||
>
|
onCompleted={onProductTypeAttributeReorder}
|
||||||
{(...unassignAttribute) => (
|
>
|
||||||
<ProductTypeAttributeReorderMutation
|
{(
|
||||||
onCompleted={onProductTypeAttributeReorder}
|
reorderAttributeMutation,
|
||||||
>
|
reorderAttributeMutationResult
|
||||||
{(
|
) => {
|
||||||
reorderAttributeMutation,
|
const reorderAttributeMutationFn: MutationFunction<
|
||||||
reorderAttributeMutationResult
|
ProductTypeAttributeReorder,
|
||||||
) => {
|
ProductTypeAttributeReorderVariables
|
||||||
const reorderAttributeMutationFn: MutationFunction<
|
> = opts => {
|
||||||
ProductTypeAttributeReorder,
|
const optimisticResponse: ProductTypeAttributeReorder = {
|
||||||
ProductTypeAttributeReorderVariables
|
productTypeReorderAttributes: {
|
||||||
> = opts => {
|
__typename: "ProductTypeReorderAttributes" as "ProductTypeReorderAttributes",
|
||||||
const optimisticResponse: ProductTypeAttributeReorder = {
|
errors: [],
|
||||||
productTypeReorderAttributes: {
|
productType: {
|
||||||
__typename: "ProductTypeReorderAttributes" as "ProductTypeReorderAttributes",
|
...productType,
|
||||||
errors: [],
|
productAttributes:
|
||||||
productType: {
|
opts.variables.type ===
|
||||||
...productType,
|
AttributeTypeEnum.PRODUCT
|
||||||
productAttributes:
|
? moveAttribute(
|
||||||
opts.variables.type ===
|
productType.productAttributes,
|
||||||
AttributeTypeEnum.PRODUCT
|
opts.variables.move
|
||||||
? moveAttribute(
|
)
|
||||||
productType.productAttributes,
|
: productType.productAttributes,
|
||||||
opts.variables.move
|
variantAttributes:
|
||||||
)
|
opts.variables.type ===
|
||||||
: productType.productAttributes,
|
AttributeTypeEnum.VARIANT
|
||||||
variantAttributes:
|
? moveAttribute(
|
||||||
opts.variables.type ===
|
productType.variantAttributes,
|
||||||
AttributeTypeEnum.VARIANT
|
opts.variables.move
|
||||||
? moveAttribute(
|
)
|
||||||
productType.variantAttributes,
|
: productType.variantAttributes
|
||||||
opts.variables.move
|
|
||||||
)
|
|
||||||
: productType.variantAttributes
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
return reorderAttributeMutation({
|
|
||||||
...opts,
|
|
||||||
optimisticResponse
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
return reorderAttributeMutation({
|
||||||
return children({
|
...opts,
|
||||||
assignAttribute: getMutationProviderData(
|
optimisticResponse
|
||||||
...assignAttribute
|
|
||||||
),
|
|
||||||
deleteProductType: getMutationProviderData(
|
|
||||||
...deleteProductType
|
|
||||||
),
|
|
||||||
reorderAttribute: getMutationProviderData(
|
|
||||||
reorderAttributeMutationFn,
|
|
||||||
reorderAttributeMutationResult
|
|
||||||
),
|
|
||||||
unassignAttribute: getMutationProviderData(
|
|
||||||
...unassignAttribute
|
|
||||||
),
|
|
||||||
updateProductType: getMutationProviderData(
|
|
||||||
...updateProductType
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
}}
|
};
|
||||||
</ProductTypeAttributeReorderMutation>
|
|
||||||
)}
|
return children({
|
||||||
</TypedUnassignAttributeMutation>
|
assignAttribute: getMutationProviderData(
|
||||||
)}
|
...assignAttribute
|
||||||
</TypedAssignAttributeMutation>
|
),
|
||||||
)}
|
deleteProductType: getMutationProviderData(
|
||||||
</TypedProductTypeUpdateMutation>
|
...deleteProductType
|
||||||
)}
|
),
|
||||||
</TypedProductTypeDeleteMutation>
|
reorderAttribute: getMutationProviderData(
|
||||||
);
|
reorderAttributeMutationFn,
|
||||||
};
|
reorderAttributeMutationResult
|
||||||
|
),
|
||||||
|
unassignAttribute: getMutationProviderData(
|
||||||
|
...unassignAttribute
|
||||||
|
),
|
||||||
|
updateProductType: getMutationProviderData(
|
||||||
|
...updateProductType
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
</ProductTypeAttributeReorderMutation>
|
||||||
|
)}
|
||||||
|
</TypedUnassignAttributeMutation>
|
||||||
|
)}
|
||||||
|
</TypedAssignAttributeMutation>
|
||||||
|
)}
|
||||||
|
</TypedProductTypeUpdateMutation>
|
||||||
|
)}
|
||||||
|
</TypedProductTypeDeleteMutation>
|
||||||
|
);
|
||||||
export default ProductTypeOperations;
|
export default ProductTypeOperations;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
//#region
|
|
||||||
import {
|
import {
|
||||||
add,
|
add,
|
||||||
remove,
|
remove,
|
||||||
|
@ -36,7 +35,7 @@ export interface ProductVariantCreateReducerAction {
|
||||||
valueId?: string;
|
valueId?: string;
|
||||||
variantIndex?: number;
|
variantIndex?: number;
|
||||||
}
|
}
|
||||||
//#endregion
|
|
||||||
function selectValue(
|
function selectValue(
|
||||||
prevState: ProductVariantCreateFormData,
|
prevState: ProductVariantCreateFormData,
|
||||||
attributeId: string,
|
attributeId: string,
|
||||||
|
|
|
@ -50,30 +50,28 @@ const VariantUpdateOperations: React.FC<VariantDeleteOperationsProps> = ({
|
||||||
onUpdate,
|
onUpdate,
|
||||||
onImageAssign,
|
onImageAssign,
|
||||||
onImageUnassign
|
onImageUnassign
|
||||||
}) => {
|
}) => (
|
||||||
return (
|
<TypedVariantImageAssignMutation onCompleted={onImageAssign}>
|
||||||
<TypedVariantImageAssignMutation onCompleted={onImageAssign}>
|
{(...assignImage) => (
|
||||||
{(...assignImage) => (
|
<TypedVariantImageUnassignMutation onCompleted={onImageUnassign}>
|
||||||
<TypedVariantImageUnassignMutation onCompleted={onImageUnassign}>
|
{(...unassignImage) => (
|
||||||
{(...unassignImage) => (
|
<TypedVariantUpdateMutation onCompleted={onUpdate}>
|
||||||
<TypedVariantUpdateMutation onCompleted={onUpdate}>
|
{(...updateVariant) => (
|
||||||
{(...updateVariant) => (
|
<TypedVariantDeleteMutation onCompleted={onDelete}>
|
||||||
<TypedVariantDeleteMutation onCompleted={onDelete}>
|
{(...deleteVariant) =>
|
||||||
{(...deleteVariant) =>
|
children({
|
||||||
children({
|
assignImage: getMutationProviderData(...assignImage),
|
||||||
assignImage: getMutationProviderData(...assignImage),
|
deleteVariant: getMutationProviderData(...deleteVariant),
|
||||||
deleteVariant: getMutationProviderData(...deleteVariant),
|
unassignImage: getMutationProviderData(...unassignImage),
|
||||||
unassignImage: getMutationProviderData(...unassignImage),
|
updateVariant: getMutationProviderData(...updateVariant)
|
||||||
updateVariant: getMutationProviderData(...updateVariant)
|
})
|
||||||
})
|
}
|
||||||
}
|
</TypedVariantDeleteMutation>
|
||||||
</TypedVariantDeleteMutation>
|
)}
|
||||||
)}
|
</TypedVariantUpdateMutation>
|
||||||
</TypedVariantUpdateMutation>
|
)}
|
||||||
)}
|
</TypedVariantImageUnassignMutation>
|
||||||
</TypedVariantImageUnassignMutation>
|
)}
|
||||||
)}
|
</TypedVariantImageAssignMutation>
|
||||||
</TypedVariantImageAssignMutation>
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
export default VariantUpdateOperations;
|
export default VariantUpdateOperations;
|
||||||
|
|
|
@ -82,13 +82,11 @@ const ProductImage: React.FC<RouteComponentProps<any>> = ({
|
||||||
|
|
||||||
const ProductVariantCreate: React.FC<RouteComponentProps<any>> = ({
|
const ProductVariantCreate: React.FC<RouteComponentProps<any>> = ({
|
||||||
match
|
match
|
||||||
}) => {
|
}) => (
|
||||||
return (
|
<ProductVariantCreateComponent
|
||||||
<ProductVariantCreateComponent
|
productId={decodeURIComponent(match.params.id)}
|
||||||
productId={decodeURIComponent(match.params.id)}
|
/>
|
||||||
/>
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Component = () => {
|
const Component = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
|
@ -49,80 +49,78 @@ export const ProductImage: React.FC<ProductImageProps> = ({
|
||||||
}}
|
}}
|
||||||
require={["product"]}
|
require={["product"]}
|
||||||
>
|
>
|
||||||
{({ data, loading }) => {
|
{({ data, loading }) => (
|
||||||
return (
|
<TypedProductImageUpdateMutation onCompleted={handleUpdateSuccess}>
|
||||||
<TypedProductImageUpdateMutation onCompleted={handleUpdateSuccess}>
|
{(updateImage, updateResult) => (
|
||||||
{(updateImage, updateResult) => (
|
<TypedProductImageDeleteMutation onCompleted={handleBack}>
|
||||||
<TypedProductImageDeleteMutation onCompleted={handleBack}>
|
{(deleteImage, deleteResult) => {
|
||||||
{(deleteImage, deleteResult) => {
|
const handleDelete = () =>
|
||||||
const handleDelete = () =>
|
deleteImage({ variables: { id: imageId } });
|
||||||
deleteImage({ variables: { id: imageId } });
|
const handleImageClick = (id: string) => () =>
|
||||||
const handleImageClick = (id: string) => () =>
|
navigate(productImageUrl(productId, id));
|
||||||
navigate(productImageUrl(productId, id));
|
const handleUpdate = (formData: { description: string }) => {
|
||||||
const handleUpdate = (formData: { description: string }) => {
|
updateImage({
|
||||||
updateImage({
|
variables: {
|
||||||
variables: {
|
alt: formData.description,
|
||||||
alt: formData.description,
|
id: imageId
|
||||||
id: imageId
|
}
|
||||||
}
|
});
|
||||||
});
|
};
|
||||||
};
|
const image = data && data.product && data.product.mainImage;
|
||||||
const image = data && data.product && data.product.mainImage;
|
|
||||||
|
|
||||||
const formTransitionState = getMutationState(
|
const formTransitionState = getMutationState(
|
||||||
updateResult.called,
|
updateResult.called,
|
||||||
updateResult.loading,
|
updateResult.loading,
|
||||||
maybe(() => updateResult.data.productImageUpdate.errors)
|
maybe(() => updateResult.data.productImageUpdate.errors)
|
||||||
);
|
);
|
||||||
const deleteTransitionState = getMutationState(
|
const deleteTransitionState = getMutationState(
|
||||||
deleteResult.called,
|
deleteResult.called,
|
||||||
deleteResult.loading,
|
deleteResult.loading,
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProductImagePage
|
<ProductImagePage
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
product={maybe(() => data.product.name)}
|
product={maybe(() => data.product.name)}
|
||||||
image={image || null}
|
image={image || null}
|
||||||
images={maybe(() => data.product.images)}
|
images={maybe(() => data.product.images)}
|
||||||
onBack={handleBack}
|
onBack={handleBack}
|
||||||
onDelete={() =>
|
onDelete={() =>
|
||||||
navigate(
|
navigate(
|
||||||
productImageUrl(productId, imageId, {
|
productImageUrl(productId, imageId, {
|
||||||
action: "remove"
|
action: "remove"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
onRowClick={handleImageClick}
|
onRowClick={handleImageClick}
|
||||||
onSubmit={handleUpdate}
|
onSubmit={handleUpdate}
|
||||||
saveButtonBarState={formTransitionState}
|
saveButtonBarState={formTransitionState}
|
||||||
/>
|
/>
|
||||||
<ActionDialog
|
<ActionDialog
|
||||||
onClose={() =>
|
onClose={() =>
|
||||||
navigate(productImageUrl(productId, imageId), true)
|
navigate(productImageUrl(productId, imageId), true)
|
||||||
}
|
}
|
||||||
onConfirm={handleDelete}
|
onConfirm={handleDelete}
|
||||||
open={params.action === "remove"}
|
open={params.action === "remove"}
|
||||||
title={intl.formatMessage({
|
title={intl.formatMessage({
|
||||||
defaultMessage: "Delete Image",
|
defaultMessage: "Delete Image",
|
||||||
description: "dialog header"
|
description: "dialog header"
|
||||||
})}
|
})}
|
||||||
variant="delete"
|
variant="delete"
|
||||||
confirmButtonState={deleteTransitionState}
|
confirmButtonState={deleteTransitionState}
|
||||||
>
|
>
|
||||||
<DialogContentText>
|
<DialogContentText>
|
||||||
<FormattedMessage defaultMessage="Are you sure you want to delete this image?" />
|
<FormattedMessage defaultMessage="Are you sure you want to delete this image?" />
|
||||||
</DialogContentText>
|
</DialogContentText>
|
||||||
</ActionDialog>
|
</ActionDialog>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</TypedProductImageDeleteMutation>
|
</TypedProductImageDeleteMutation>
|
||||||
)}
|
)}
|
||||||
</TypedProductImageUpdateMutation>
|
</TypedProductImageUpdateMutation>
|
||||||
);
|
)}
|
||||||
}}
|
|
||||||
</TypedProductImageQuery>
|
</TypedProductImageQuery>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@ const SiteSettings: React.FC<RouteComponentProps<{}>> = ({ location }) => {
|
||||||
return <SiteSettingsComponent params={params} />;
|
return <SiteSettingsComponent params={params} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SiteSettingsSection: React.FC = () => {
|
export const SiteSettingsSection: React.FC = () => (
|
||||||
return <Route path={siteSettingsPath} component={SiteSettings} />;
|
<Route path={siteSettingsPath} component={SiteSettings} />
|
||||||
};
|
);
|
||||||
export default SiteSettingsSection;
|
export default SiteSettingsSection;
|
||||||
|
|
|
@ -7,10 +7,10 @@ import CardDecorator from "../../CardDecorator";
|
||||||
import Decorator from "../../Decorator";
|
import Decorator from "../../Decorator";
|
||||||
|
|
||||||
const choices = [
|
const choices = [
|
||||||
{ value: "1", label: "Apparel" },
|
{ label: "Apparel", value: "1" },
|
||||||
{ value: "2", label: "Groceries" },
|
{ label: "Groceries", value: "2" },
|
||||||
{ value: "3", label: "Books" },
|
{ label: "Books", value: "3" },
|
||||||
{ value: "4", label: "Accessories" }
|
{ label: "Accessories", value: "4" }
|
||||||
];
|
];
|
||||||
|
|
||||||
storiesOf("Generics / MultiSelectField", module)
|
storiesOf("Generics / MultiSelectField", module)
|
||||||
|
|
|
@ -12,7 +12,7 @@ export const content: RawDraftContentState = {
|
||||||
data: {},
|
data: {},
|
||||||
depth: 0,
|
depth: 0,
|
||||||
entityRanges: [],
|
entityRanges: [],
|
||||||
inlineStyleRanges: [{ offset: 0, length: 4, style: "BOLD" }],
|
inlineStyleRanges: [{ length: 4, offset: 0, style: "BOLD" }],
|
||||||
key: "rosn",
|
key: "rosn",
|
||||||
text: "bold",
|
text: "bold",
|
||||||
type: "unstyled"
|
type: "unstyled"
|
||||||
|
@ -21,7 +21,7 @@ export const content: RawDraftContentState = {
|
||||||
data: {},
|
data: {},
|
||||||
depth: 0,
|
depth: 0,
|
||||||
entityRanges: [],
|
entityRanges: [],
|
||||||
inlineStyleRanges: [{ offset: 0, length: 6, style: "ITALIC" }],
|
inlineStyleRanges: [{ length: 6, offset: 0, style: "ITALIC" }],
|
||||||
key: "6tbch",
|
key: "6tbch",
|
||||||
text: "italic",
|
text: "italic",
|
||||||
type: "unstyled"
|
type: "unstyled"
|
||||||
|
@ -30,7 +30,7 @@ export const content: RawDraftContentState = {
|
||||||
data: {},
|
data: {},
|
||||||
depth: 0,
|
depth: 0,
|
||||||
entityRanges: [],
|
entityRanges: [],
|
||||||
inlineStyleRanges: [{ offset: 0, length: 13, style: "STRIKETHROUGH" }],
|
inlineStyleRanges: [{ length: 13, offset: 0, style: "STRIKETHROUGH" }],
|
||||||
key: "1p044",
|
key: "1p044",
|
||||||
text: "strikethrough",
|
text: "strikethrough",
|
||||||
type: "unstyled"
|
type: "unstyled"
|
||||||
|
@ -92,7 +92,7 @@ export const content: RawDraftContentState = {
|
||||||
{
|
{
|
||||||
data: {},
|
data: {},
|
||||||
depth: 0,
|
depth: 0,
|
||||||
entityRanges: [{ offset: 0, length: 4, key: 0 }],
|
entityRanges: [{ key: 0, length: 4, offset: 0 }],
|
||||||
inlineStyleRanges: [],
|
inlineStyleRanges: [],
|
||||||
key: "5aejo",
|
key: "5aejo",
|
||||||
text: "link",
|
text: "link",
|
||||||
|
@ -100,7 +100,7 @@ export const content: RawDraftContentState = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
entityMap: {
|
entityMap: {
|
||||||
"0": { type: "LINK", mutability: "MUTABLE", data: { url: "#" } }
|
"0": { data: { url: "#" }, mutability: "MUTABLE", type: "LINK" }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
storiesOf("Generics / Rich text editor", module)
|
storiesOf("Generics / Rich text editor", module)
|
||||||
|
|
|
@ -6,10 +6,10 @@ import CardDecorator from "../../CardDecorator";
|
||||||
import Decorator from "../../Decorator";
|
import Decorator from "../../Decorator";
|
||||||
|
|
||||||
const choices = [
|
const choices = [
|
||||||
{ value: "1", label: "Apparel" },
|
{ label: "Apparel", value: "1" },
|
||||||
{ value: "2", label: "Groceries" },
|
{ label: "Groceries", value: "2" },
|
||||||
{ value: "3", label: "Books" },
|
{ label: "Books", value: "3" },
|
||||||
{ value: "4", label: "Accessories" }
|
{ label: "Accessories", value: "4" }
|
||||||
];
|
];
|
||||||
|
|
||||||
storiesOf("Generics / SingleSelectField", module)
|
storiesOf("Generics / SingleSelectField", module)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import placeholder from "@assets/images/placeholder1080x1080.png";
|
||||||
import ProductImagePage from "../../../products/components/ProductImagePage";
|
import ProductImagePage from "../../../products/components/ProductImagePage";
|
||||||
import Decorator from "../../Decorator";
|
import Decorator from "../../Decorator";
|
||||||
|
|
||||||
const image = { id: "", url: placeholder, alt: "Lorem ipsum" };
|
const image = { alt: "Lorem ipsum", id: "", url: placeholder };
|
||||||
const images = (Array(8) as any)
|
const images = (Array(8) as any)
|
||||||
.fill({ id: "img", url: placeholder })
|
.fill({ id: "img", url: placeholder })
|
||||||
.map((image, imageIndex) => ({ ...image, id: image.id + imageIndex }));
|
.map((image, imageIndex) => ({ ...image, id: image.id + imageIndex }));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const CheckerPlugin = require("fork-ts-checker-webpack-plugin");
|
const CheckerPlugin = require("fork-ts-checker-webpack-plugin");
|
||||||
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
||||||
|
@ -7,13 +7,13 @@ const resolve = resolvePath => path.resolve(__dirname, resolvePath);
|
||||||
|
|
||||||
module.exports = ({ config }) => {
|
module.exports = ({ config }) => {
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
test: /\.(jsx?|tsx?)$/,
|
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: "babel-loader",
|
loader: "babel-loader",
|
||||||
options: {
|
options: {
|
||||||
configFile: resolve("../../babel.config.js"),
|
configFile: resolve("../../babel.config.js"),
|
||||||
envName: "storybook"
|
envName: "storybook"
|
||||||
}
|
},
|
||||||
|
test: /\.(jsx?|tsx?)$/
|
||||||
});
|
});
|
||||||
config.optimization.removeAvailableModules = false;
|
config.optimization.removeAvailableModules = false;
|
||||||
config.optimization.removeEmptyChunks = false;
|
config.optimization.removeEmptyChunks = false;
|
||||||
|
@ -24,6 +24,10 @@ module.exports = ({ config }) => {
|
||||||
configFile: "./tsconfig.json"
|
configFile: "./tsconfig.json"
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
config.plugins.push(new CheckerPlugin());
|
config.plugins.push(
|
||||||
|
new CheckerPlugin({
|
||||||
|
eslint: true
|
||||||
|
})
|
||||||
|
);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,11 +9,10 @@ import classNames from "classnames";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
|
||||||
import { ListProps } from "../../../types";
|
|
||||||
|
|
||||||
import ResponsiveTable from "@saleor/components/ResponsiveTable";
|
import ResponsiveTable from "@saleor/components/ResponsiveTable";
|
||||||
import Skeleton from "@saleor/components/Skeleton";
|
|
||||||
import TablePagination from "@saleor/components/TablePagination";
|
import TablePagination from "@saleor/components/TablePagination";
|
||||||
|
import Skeleton from "@saleor/components/Skeleton";
|
||||||
|
import { ListProps } from "../../../types";
|
||||||
import { maybe, renderCollection } from "../../../misc";
|
import { maybe, renderCollection } from "../../../misc";
|
||||||
|
|
||||||
export interface TranslatableEntity {
|
export interface TranslatableEntity {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
const CheckerPlugin = require("fork-ts-checker-webpack-plugin");
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const CheckerPlugin = require("fork-ts-checker-webpack-plugin");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
||||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||||
|
|
||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
|
|
||||||
const resolve = path.resolve.bind(path, __dirname);
|
const resolve = path.resolve.bind(path, __dirname);
|
||||||
|
@ -12,12 +14,12 @@ const pathsPlugin = new TsconfigPathsPlugin({
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkerPlugin = new CheckerPlugin({
|
const checkerPlugin = new CheckerPlugin({
|
||||||
reportFiles: ["src/**/*.{ts,tsx}"],
|
eslint: true,
|
||||||
tslint: true
|
reportFiles: ["src/**/*.{ts,tsx}"]
|
||||||
});
|
});
|
||||||
const htmlWebpackPlugin = new HtmlWebpackPlugin({
|
const htmlWebpackPlugin = new HtmlWebpackPlugin({
|
||||||
hash: true,
|
|
||||||
filename: "index.html",
|
filename: "index.html",
|
||||||
|
hash: true,
|
||||||
template: "./src/index.html"
|
template: "./src/index.html"
|
||||||
});
|
});
|
||||||
const environmentPlugin = new webpack.EnvironmentPlugin([
|
const environmentPlugin = new webpack.EnvironmentPlugin([
|
||||||
|
@ -36,17 +38,17 @@ module.exports = (env, argv) => {
|
||||||
if (!devMode) {
|
if (!devMode) {
|
||||||
const publicPath = process.env.STATIC_URL || "/";
|
const publicPath = process.env.STATIC_URL || "/";
|
||||||
output = {
|
output = {
|
||||||
path: resolve(dashboardBuildPath),
|
|
||||||
filename: "[name].[chunkhash].js",
|
|
||||||
chunkFilename: "[name].[chunkhash].js",
|
chunkFilename: "[name].[chunkhash].js",
|
||||||
|
filename: "[name].[chunkhash].js",
|
||||||
|
path: resolve(dashboardBuildPath),
|
||||||
publicPath
|
publicPath
|
||||||
};
|
};
|
||||||
fileLoaderPath = "file-loader?name=[name].[hash].[ext]";
|
fileLoaderPath = "file-loader?name=[name].[hash].[ext]";
|
||||||
} else {
|
} else {
|
||||||
output = {
|
output = {
|
||||||
path: resolve(dashboardBuildPath),
|
|
||||||
filename: "[name].js",
|
|
||||||
chunkFilename: "[name].js",
|
chunkFilename: "[name].js",
|
||||||
|
filename: "[name].js",
|
||||||
|
path: resolve(dashboardBuildPath),
|
||||||
publicPath: "/"
|
publicPath: "/"
|
||||||
};
|
};
|
||||||
fileLoaderPath = "file-loader?name=[name].[ext]";
|
fileLoaderPath = "file-loader?name=[name].[ext]";
|
||||||
|
@ -54,35 +56,35 @@ module.exports = (env, argv) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: path.join(__dirname, dashboardBuildPath),
|
|
||||||
compress: true,
|
compress: true,
|
||||||
|
contentBase: path.join(__dirname, dashboardBuildPath),
|
||||||
historyApiFallback: true,
|
historyApiFallback: true,
|
||||||
hot: true,
|
hot: true,
|
||||||
port: 9000
|
port: 9000
|
||||||
},
|
},
|
||||||
|
devtool: "sourceMap",
|
||||||
entry: {
|
entry: {
|
||||||
dashboard: "./src/index.tsx"
|
dashboard: "./src/index.tsx"
|
||||||
},
|
},
|
||||||
output,
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.(jsx?|tsx?)$/,
|
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: "babel-loader",
|
loader: "babel-loader",
|
||||||
options: {
|
options: {
|
||||||
configFile: resolve("./babel.config.js")
|
configFile: resolve("./babel.config.js")
|
||||||
}
|
},
|
||||||
|
test: /\.(jsx?|tsx?)$/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(eot|otf|png|svg|jpg|ttf|woff|woff2)(\?v=[0-9.]+)?$/,
|
|
||||||
loader: fileLoaderPath,
|
|
||||||
include: [
|
include: [
|
||||||
resolve("node_modules"),
|
resolve("node_modules"),
|
||||||
resolve("assets/fonts"),
|
resolve("assets/fonts"),
|
||||||
resolve("assets/images"),
|
resolve("assets/images"),
|
||||||
resolve("assets/favicons")
|
resolve("assets/favicons")
|
||||||
]
|
],
|
||||||
|
loader: fileLoaderPath,
|
||||||
|
test: /\.(eot|otf|png|svg|jpg|ttf|woff|woff2)(\?v=[0-9.]+)?$/
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -91,11 +93,11 @@ module.exports = (env, argv) => {
|
||||||
removeEmptyChunks: false,
|
removeEmptyChunks: false,
|
||||||
splitChunks: false
|
splitChunks: false
|
||||||
},
|
},
|
||||||
|
output,
|
||||||
plugins: [checkerPlugin, environmentPlugin, htmlWebpackPlugin],
|
plugins: [checkerPlugin, environmentPlugin, htmlWebpackPlugin],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
||||||
plugins: [pathsPlugin]
|
plugins: [pathsPlugin]
|
||||||
},
|
}
|
||||||
devtool: "sourceMap"
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue