-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
damianbenassi
committed
Jun 12, 2020
0 parents
commit d4d23e5
Showing
1,305 changed files
with
158,804 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env", | ||
], | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-transform-runtime", | ||
{ | ||
"useESModules": true, | ||
"regenerator": false | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": ["important-stuff", "plugin:prettier/recommended"], | ||
"parser": "babel-eslint" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next | ||
dist | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.gitignore | ||
.prettierignore | ||
yarn.lock | ||
package-lock.json | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
transform: { | ||
"^.+\\.(j|t)sx?$": "babel-jest", | ||
}, | ||
moduleNameMapper: { | ||
"\\.(css)$": "identity-obj-proxy", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"scripts": { | ||
"start": "webpack-dev-server", | ||
"build": "webpack --mode=production", | ||
"analyze": "webpack --mode=production --env.analyze=true", | ||
"lint": "eslint src --ext js", | ||
"format": "prettier --write './**'", | ||
"test": "jest --passWithNoTests", | ||
"watch-tests": "jest --watch", | ||
"coverage": "jest --coverage" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "pretty-quick --staged && concurrently yarn:test yarn:lint" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.7.5", | ||
"@babel/plugin-transform-runtime": "^7.8.3", | ||
"@babel/preset-env": "^7.7.6", | ||
"@babel/runtime": "^7.8.7", | ||
"@types/jest": "^25.2.1", | ||
"@types/systemjs": "^6.1.0", | ||
"babel-eslint": "^11.0.0-beta.2", | ||
"babel-jest": "^24.9.0", | ||
"babel-loader": "^8.0.6", | ||
"concurrently": "^5.0.1", | ||
"css-loader": "^3.3.2", | ||
"eslint": "^6.7.2", | ||
"eslint-config-important-stuff": "^1.1.0", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"husky": "^3.1.0", | ||
"identity-obj-proxy": "^3.0.0", | ||
"jest": "^25.2.7", | ||
"jest-cli": "^25.2.7", | ||
"prettier": "^2.0.4", | ||
"pretty-quick": "^2.0.1", | ||
"style-loader": "^1.0.1", | ||
"systemjs-webpack-interop": "^1.1.2", | ||
"webpack": "^4.41.2", | ||
"webpack-cli": "^3.3.10", | ||
"webpack-config-single-spa": "^1.0.7", | ||
"webpack-dev-server": "^3.9.0", | ||
"webpack-merge": "^4.2.2" | ||
}, | ||
"dependencies": { | ||
"axios": "^0.19.2", | ||
"axios-mock-adapter": "^1.18.1", | ||
"faker": "^4.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import mock from '../mock'; | ||
import { getJwtDecoded } from '../../helpers'; | ||
|
||
mock.onGet('/spapi/features').reply((request) => { | ||
const token = request.headers.Authorization.split(' ')[1]; | ||
const user = getJwtDecoded(token); | ||
|
||
const features = { | ||
gridview: { | ||
new_people_view: true | ||
}, | ||
project_strategy: { | ||
project_location: true | ||
}, | ||
storybook: { | ||
collapsibleCard: { | ||
v2: true | ||
} | ||
} | ||
}; | ||
|
||
switch(user.id) { | ||
case 5: | ||
return [200, features]; | ||
case 6: | ||
return [200, { ...features, storybook: {} }] | ||
} | ||
|
||
return [200, features]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import './projects/GET'; | ||
//import './login/POST'; | ||
import './features/GET'; | ||
|
||
export { default as default } from './mock'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import mock from '../mock'; | ||
|
||
mock.onPost("//clk-iam.herokuapp.com/session").reply(({ data }) => { | ||
const { email, password } = JSON.parse(data); | ||
|
||
if (email === '[email protected]' && password === '123123') { | ||
return [200, { | ||
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6IkpvaG4gRG9lIiwicm9sZXMiOlsiYWRtaW4iLCJmaXJtIl0sImlhdCI6MTUxNjIzOTAyMn0.HCsnE6PWYbgC3V_6dK6RyZbxQbyUwYICXMSI9WjecIQ', | ||
expiration: Math.floor(Date.now() / 1000) + (10 * 60) | ||
}]; | ||
} else if (email === '[email protected]' && password === '123123') { | ||
return [200, { | ||
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwibmFtZSI6IlVzZXIgdHdvIiwicm9sZXMiOlsiZmlybSJdfQ.5oLbTiNEGihfMqQs45ZXJXbGDeBJPrSWbYvQ-GBr3EY', | ||
expiration: Math.floor(Date.now() / 1000) + (10 * 60) | ||
}]; | ||
} | ||
|
||
return [401, { message: '401 Unauthorized' }]; | ||
}); | ||
|
||
mock.onPost("//clk-iam.herokuapp.com/session/refresh").reply(() => [ | ||
200, | ||
{ | ||
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6IkpvaG4gRG9lIiwicm9sZXMiOlsiYWRtaW4iLCJmaXJtIl0sImlhdCI6MTUxNjIzOTAyMn0.HCsnE6PWYbgC3V_6dK6RyZbxQbyUwYICXMSI9WjecIQ', | ||
expiration: Math.floor(Date.now() / 1000) + (10 * 60) | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import axios from 'axios'; | ||
import MockAdapter from 'axios-mock-adapter'; | ||
|
||
export default new MockAdapter(axios, { delayResponse: 1000 }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import faker from 'faker'; | ||
|
||
import mock from '../mock'; | ||
|
||
mock.onGet("/spapi/projects").reply(() => { | ||
const projects = []; | ||
for (let i = 0; i < 5; i++) { | ||
projects.push({ | ||
id: i+1, | ||
name: faker.name.jobTitle(), | ||
status: faker.lorem.word(), | ||
highestStatus: faker.lorem.word(), | ||
candidates: faker.random.number(), | ||
createdAt: faker.date.past(), | ||
createdAt: faker.date.past(), | ||
isInternal: faker.random.boolean(), | ||
isConfidential: faker.random.boolean(), | ||
industry: faker.name.jobArea(), | ||
specialty: faker.name.jobType(), | ||
seniority: faker.name.jobDescriptor(), | ||
attributes: { selected: true } | ||
}); | ||
} | ||
|
||
return [200, projects]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import faker from 'faker'; | ||
|
||
import mock from '../mock'; | ||
import { PROJECTS } from './fixtures'; | ||
|
||
mock.onGet("/spapi/projects").reply(200, | ||
{ | ||
"data": PROJECTS, | ||
"meta": { | ||
"total": 80, | ||
"currentPage": 1, | ||
"pagesCount": 7, | ||
} | ||
} | ||
); | ||
|
||
mock.onGet("/spapi/projects?faker").reply(() => { | ||
const projects = []; | ||
for (let i = 0; i < 5; i++) { | ||
projects.push({ | ||
id: i+1, | ||
name: faker.name.jobTitle(), | ||
status: faker.lorem.word(), | ||
highestStatus: faker.lorem.word(), | ||
candidates: faker.random.number(), | ||
createdAt: faker.date.past(), | ||
createdAt: faker.date.past(), | ||
isInternal: faker.random.boolean(), | ||
isConfidential: faker.random.boolean(), | ||
industry: faker.name.jobArea(), | ||
specialty: faker.name.jobType(), | ||
seniority: faker.name.jobDescriptor(), | ||
attributes: { selected: true } | ||
}); | ||
} | ||
|
||
return [200, projects]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import faker from 'faker'; | ||
|
||
import mock from '../mock'; | ||
import { PROJECTS } from './fixtures'; | ||
|
||
mock.onGet("/spapi/projects").reply(200, | ||
{ | ||
"data": PROJECTS, | ||
"meta": { | ||
"total": 80, | ||
"currentPage": 1, | ||
"pagesCount": 7, | ||
} | ||
} | ||
); | ||
|
||
mock.onGet("/spapi/projects?faker").reply(() => { | ||
const projects = []; | ||
for (let i = 0; i < 5; i++) { | ||
projects.push({ | ||
id: i+1, | ||
name: faker.name.jobTitle(), | ||
status: faker.lorem.word(), | ||
highestStatus: faker.lorem.word(), | ||
candidates: faker.random.number(), | ||
createdAt: faker.date.past(), | ||
createdAt: faker.date.past(), | ||
isInternal: faker.random.boolean(), | ||
isConfidential: faker.random.boolean(), | ||
industry: faker.name.jobArea(), | ||
specialty: faker.name.jobType(), | ||
seniority: faker.name.jobDescriptor(), | ||
attributes: { selected: true } | ||
}); | ||
} | ||
|
||
return [200, projects]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import axios from 'axios'; | ||
|
||
export const requestFeatures = () => axios.get('/spapi/features'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import axios from 'axios'; | ||
|
||
import { saveJwtToken } from '../helpers'; | ||
|
||
export const requestJwtCreate = (email, password) => | ||
fetch('https://clk-iam.herokuapp.com/session', { | ||
method: 'POST', | ||
body: JSON.stringify({ email, password }), | ||
headers: { 'Content-Type': 'application/json'} | ||
}) | ||
.then((response) => { | ||
console.log({ response }); | ||
if (response.status === 200) { | ||
return response.json().then(data => saveJwtToken(data)); | ||
} | ||
|
||
return response.json().then(({ error: message }) => Promise.reject({ message })); | ||
}) | ||
|
||
/*axios.post('https://clk-iam.herokuapp.com/session', { email, password }, { headers: { 'Content-Type': 'application/json' } }).then((response) => { | ||
console.log('NICE', response); | ||
if (response.status === 200) { | ||
saveJwtToken(response.data); | ||
} | ||
return response; | ||
});*/ | ||
|
||
export const requestJwtRefresh = () => | ||
axios.post('https://clk-iam.herokuapp.com/session/refresh').then((response) => { | ||
console.log('Refreshing token', response); | ||
if (response.status === 200) { | ||
saveJwtToken(response.data); | ||
} else { | ||
alert('Can`t refresh token'); | ||
} | ||
|
||
return response; | ||
}); | ||
|
||
export const requestJwtValidate = () => | ||
axios.post('https://clk-iam.herokuapp.com/session/validate'); | ||
|
||
export const requestUserCreate = (email, password, password_confirmation) => | ||
axios.post('https://clk-iam.herokuapp.com/user.create', { email, password, password_confirmation }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import axios from 'axios'; | ||
|
||
export const requestProjects = () => axios.get('/spapi/projects'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import './set-public-path'; | ||
import './jwt/interceptors'; | ||
import './__mocks__'; | ||
|
||
export * from './api/login'; | ||
export * from './api/features'; | ||
export * from './api/projects'; | ||
export * from './helpers'; |
Oops, something went wrong.