forked from beightone/carapreta.checkout-customizations
-
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.
Merge pull request beightone#1 from beightone/SEL-2669
feature: adding dataDog logger into checkout
- Loading branch information
Showing
14 changed files
with
2,912 additions
and
106 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
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 |
---|---|---|
@@ -1,7 +1 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"jsxBracketSameLine": true, | ||
"eslintIntegration": true | ||
} | ||
"@vtex/prettier-config" |
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
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 |
---|---|---|
@@ -1,7 +1,36 @@ | ||
{ | ||
"name": "checkout-customizations", | ||
"private": true, | ||
"license": "UNLICENSED", | ||
"scripts": { | ||
"lint": "eslint --ext js,jsx,ts,tsx .", | ||
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json}\"" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{ts,js,tsx,jsx}": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
], | ||
"*.{json,graphql,gql}": [ | ||
"prettier --write" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@types/jquery": "^3.3.38", | ||
"@types/node": "^12.12.21", | ||
"@types/react": "^16.9.38" | ||
"@types/react": "^16.9.38", | ||
"@vtex/prettier-config": "^0.1.4", | ||
"eslint": "^7.12.1", | ||
"eslint-config-vtex": "^12.3.2", | ||
"eslint-config-vtex-react": "^6.3.2", | ||
"husky": "^4.2.3", | ||
"lint-staged": "^10.1.1", | ||
"prettier": "^2.0.2", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,3 @@ | ||
{ | ||
"extends": "vtex-react/io", | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"jest": true | ||
}, | ||
"rules": { | ||
"react/prefer-stateless-function": false | ||
} | ||
} | ||
"extends": "vtex-react/io" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
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 @@ | ||
export class Logger { | ||
private sendLog(logBody: any) { | ||
fetch('https://beightone.myvtex.com/_v0.0/api/send-log ', { | ||
method: 'POST', | ||
body: JSON.stringify({ ...this.coreLog(), ...logBody }), | ||
}) | ||
} | ||
|
||
private coreLog() { | ||
//@ts-ignore | ||
const { NODE_ENV } = window.vtex.renderRuntime.query.origin | ||
// const { NODE_ENV, VTEX_APP_ID, VTEX_APP_VERSION } = process.env | ||
|
||
const logBody = { | ||
traceId: '', | ||
source: 'vtex', | ||
env: NODE_ENV, | ||
version: '0.5.7' ?? '', | ||
index: 'integration', | ||
hostname: window.location.hostname, | ||
service: 'carapreta.checkout-customizations', | ||
operationId: 'string', | ||
account: 'string', | ||
message: 'NO_MESSAGE', | ||
content: 'NO_CONTENT', | ||
status: 'info', | ||
} | ||
|
||
console.info('INITIAL_LOG', logBody) | ||
|
||
return logBody | ||
} | ||
|
||
public info(title: string, content: any, traceId?: string) { | ||
this.sendLog({ message: title, content, status: 'info', traceId }) | ||
} | ||
|
||
public warn(title: string, content: any, traceId?: string) { | ||
this.sendLog({ message: title, content, status: 'warn', traceId }) | ||
} | ||
|
||
public error(title: string, content: any, traceId?: string) { | ||
this.sendLog({ message: title, content, status: 'error', traceId }) | ||
} | ||
} |
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
Oops, something went wrong.