Skip to content

Commit 49d9875

Browse files
dusanradovanovicshaunmaharaj
authored andcommitted
Fixed typescript build (#420)
* Fixed typescript build * Fixed linting errors * Incremented versions in package.json
1 parent c213134 commit 49d9875

23 files changed

+114
-62
lines changed

app/config/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ module.exports = function (webpackEnv) {
633633
tsconfig: paths.appTsConfig,
634634
reportFiles: [
635635
'**',
636+
'./../components/**',
636637
'!**/__tests__/**',
637638
'!**/?(*.)(spec|test).*',
638639
'!**/src/setupProxy.*',

app/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elasticpath/ref-store",
3-
"version": "3.0.4",
3+
"version": "3.0.5",
44
"main": "index.js",
55
"license": "MIT",
66
"dependencies": {
@@ -98,6 +98,7 @@
9898
]
9999
},
100100
"devDependencies": {
101+
"@types/react-router-dom": "^4.3.5",
101102
"@typescript-eslint/eslint-plugin": "^1.12.0",
102103
"@typescript-eslint/parser": "^1.12.0",
103104
"babel-jest": "^24.8.0",
@@ -107,6 +108,7 @@
107108
"eslint-plugin-header": "^3.0.0",
108109
"less": "^3.9.0",
109110
"puppeteer": "^1.18.1",
110-
"typescript": "^3.5.2"
111+
"tsconfig-paths-webpack-plugin": "^3.2.0",
112+
"typescript": "^3.6.3"
111113
}
112114
}

app/src/containers/CartPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
import React from 'react';
23-
import intl from 'react-intl-universal';
23+
import * as intl from 'react-intl-universal';
2424
import { RouteComponentProps } from 'react-router-dom';
2525
import { CartMain, CheckoutSummaryList, AddPromotionContainer } from '@elasticpath/store-components';
2626
import Config from '../ep.config.json';
@@ -116,7 +116,7 @@ class CartPage extends React.Component<RouteComponentProps, CartPageState> {
116116
const { location, history } = this.props;
117117
this.setState({ isLoading: true });
118118
this.fetchCartData();
119-
history.push(location.path);
119+
history.push(window.location.pathname);
120120
}
121121

122122
checkout() {

app/src/containers/HomePage.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const HomePage: React.FunctionComponent = () => {
6262
{/* eslint-disable-next-line no-return-assign */}
6363
<div className="section section-3 container">
6464
<div className="sub-section">
65-
<img className="small-image" alt="home-espot-2" src={Config.siteImagesUrl.replace('%fileName%', homeEspot2FileName)} onError={(e) => { e.target.src = homeEspot2; }} />
65+
<img className="small-image" alt="home-espot-2" src={Config.siteImagesUrl.replace('%fileName%', homeEspot2FileName)} onError={(e: any) => { e.target.src = homeEspot3; }} />
6666
<div className="text-block">
6767
<span className="line line-1">
6868
{intl.get('home-sub-espot-container2-first-line')}
@@ -74,9 +74,9 @@ const HomePage: React.FunctionComponent = () => {
7474
</div>
7575
</div>
7676
<div className="section-parallax section-parallax-1 container" data-region="homeMainContentRegion">
77-
<Parallax y={[-50, 10]} tag="figure">
77+
<Parallax y={[-50, 10]} tagOuter="figure">
7878
<div className="parallax-image-container">
79-
<img className="parallax-image" alt="home-espot-1" src={Config.siteImagesUrl.replace('%fileName%', homeEspotParallax1FileName)} onError={(e) => { e.target.src = homeEspotParallax1; }} />
79+
<img className="parallax-image" alt="home-espot-1" src={Config.siteImagesUrl.replace('%fileName%', homeEspotParallax1FileName)} onError={(e: any) => { e.target.src = homeEspot3; }} />
8080
</div>
8181
</Parallax>
8282
<div className="sub-section">
@@ -92,7 +92,7 @@ const HomePage: React.FunctionComponent = () => {
9292
</div>
9393
<div className="section section-4 container">
9494
<div className="sub-section">
95-
<img className="small-image image-1" alt="home-espot-3" src={Config.siteImagesUrl.replace('%fileName%', homeEspot3FileName)} onError={(e) => { e.target.src = homeEspot3; }} />
95+
<img className="small-image image-1" alt="home-espot-3" src={Config.siteImagesUrl.replace('%fileName%', homeEspot3FileName)} onError={(e: any) => { e.target.src = homeEspot3; }} />
9696
<div className="text-block">
9797
<span className="line line-1">
9898
{intl.get('home-sub-espot-container3-first-line')}
@@ -101,12 +101,12 @@ const HomePage: React.FunctionComponent = () => {
101101
{intl.get('home-sub-espot-container3-second-line')}
102102
</span>
103103
</div>
104-
<img className="small-image image-2" alt="home-espot-3" src={Config.siteImagesUrl.replace('%fileName%', homeEspot3FileName)} onError={(e) => { e.target.src = homeEspot3; }} />
104+
<img className="small-image image-2" alt="home-espot-3" src={Config.siteImagesUrl.replace('%fileName%', homeEspot3FileName)} onError={(e: any) => { e.target.src = homeEspot3; }} />
105105
</div>
106106
</div>
107107
<div className="section section-5 container">
108108
<div className="sub-section">
109-
<img className="small-image" alt="home-espot-4" src={Config.siteImagesUrl.replace('%fileName%', homeEspot4FileName)} onError={(e) => { e.target.src = homeEspot4; }} />
109+
<img className="small-image" alt="home-espot-4" src={Config.siteImagesUrl.replace('%fileName%', homeEspot4FileName)} onError={(e: any) => { e.target.src = homeEspot4; }} />
110110
<div className="text-block">
111111
<span className="line line-1">
112112
{intl.get('home-sub-espot-container4-first-line')}
@@ -118,9 +118,9 @@ const HomePage: React.FunctionComponent = () => {
118118
</div>
119119
</div>
120120
<div className="section-parallax section-parallax-2 container" data-region="homeMainContentRegion">
121-
<Parallax y={[10, -30]} tag="figure">
121+
<Parallax y={[10, -30]} tagOuter="figure">
122122
<div className="parallax-image-container">
123-
<img className="parallax-image" alt="home-espot-1" src={Config.siteImagesUrl.replace('%fileName%', homeEspotParallax2FileName)} onError={(e) => { e.target.src = homeEspotParallax2; }} />
123+
<img className="parallax-image" alt="home-espot-1" src={Config.siteImagesUrl.replace('%fileName%', homeEspotParallax2FileName)} onError={(e: any) => { e.target.src = homeEspotParallax2; }} />
124124
</div>
125125
</Parallax>
126126
<div className="sub-section">

app/src/containers/MaintenancePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function MaintenancePage() {
5656
</div>
5757
<div className="static-container dog-container" style={{ display: 'block' }}>
5858
<div className="container" style={{ display: 'block' }}>
59-
<img alt="dog-espot-1" className="dog-espot-1" src={Config.siteImagesUrl.replace('%fileName%', dogeFileName)} onError={(e) => { e.target.src = doge; }} />
59+
<img alt="dog-espot-1" className="dog-espot-1" src={Config.siteImagesUrl.replace('%fileName%', dogeFileName)} onError={(e: any) => { e.target.src = doge; }} />
6060
</div>
6161
<h2 className="static-dog-name">
6262
{intl.get('name-moki')}

app/src/containers/ProductDetailPage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ import React from 'react';
2323
import { RouteComponentProps } from 'react-router-dom';
2424
import { ProductDisplayItemMain } from '@elasticpath/store-components';
2525

26-
function ProductDetailPage(props: RouteComponentProps) {
26+
interface ProductDetailRouterProps {
27+
url: string;
28+
}
29+
30+
function ProductDetailPage(props: RouteComponentProps<ProductDetailRouterProps>) {
2731
const { history } = props;
2832

2933
function handleAddToCart() {

app/src/containers/RegistrationPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { RegistrationFormMain } from '@elasticpath/store-components';
2626
function RegistrationPage(props: RouteComponentProps) {
2727
function handleRegisterSuccess() {
2828
const { location, history } = props;
29-
if (location.state && location.returnPage) {
29+
if (location.state && location.state.returnPage) {
3030
history.push(location.state.returnPage);
3131
} else {
3232
history.push('/');

app/src/containers/b2b/AccountList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ interface AccountMainState {
4343
showAccountsMobileMenu: boolean,
4444
}
4545

46-
export default class AccountList extends React.Component<AccountMainState, AccountMainProps> {
46+
export default class AccountList extends React.Component<AccountMainProps, AccountMainState> {
4747
static defaultProps = {
4848
getSubAccountData: () => {
4949
},

app/src/containers/b2b/AccountMain.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ interface AccountMainState {
112112
subAccounts: any,
113113
}
114114

115-
export default class AccountMain extends React.Component<RouteComponentProps, AccountMainState> {
115+
interface AccountMainRouterProps {
116+
url: string;
117+
}
118+
119+
export default class AccountMain extends React.Component<RouteComponentProps<AccountMainRouterProps>, AccountMainState> {
116120
constructor(props: any) {
117121
super(props);
118122
this.state = {
@@ -128,6 +132,7 @@ export default class AccountMain extends React.Component<RouteComponentProps, Ac
128132
externalId: '',
129133
registrationNumber: '',
130134
selfSignUpCode: '',
135+
uri: '',
131136
selector: '',
132137
associates: {},
133138
userEmail: '',
@@ -156,7 +161,7 @@ export default class AccountMain extends React.Component<RouteComponentProps, Ac
156161

157162
getAccountData() {
158163
const { match } = this.props;
159-
const accountUri = match.params.uri;
164+
const accountUri = match.params.url;
160165
this.setState({ isLoading: true });
161166
login().then(() => {
162167
const profilePromice = adminFetch('/?zoom=myprofile:primaryemail', {
@@ -317,7 +322,6 @@ export default class AccountMain extends React.Component<RouteComponentProps, Ac
317322
</div>
318323
</div>
319324
<div className="account-component">
320-
<AccountList getAccountData={this.getAccountData} accountListData={accountListData} getSubAccountData={this.subAccountData} handleAddSubAccountClicked={this.handleAddSubAccountClicked} accountName={accountName} registrationNumber={registrationNumber} />
321325
<div className="associates-container">
322326
<div className="add-associate-container">
323327
<button type="button" className="ep-btn primary small add-associate-button" onClick={() => this.handleAddAssociateClicked()}>

app/src/containers/b2b/AddSubAccount.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default class AddSubAccount extends React.Component<AddSubAccountProps, A
101101
const { name } = event.target;
102102
const { value } = event.target;
103103

104-
this.setState({ [name]: value });
104+
this.setState({ name: value });
105105
}
106106

107107
render() {

0 commit comments

Comments
 (0)