@eduzz/apps-toolbar
Advanced tools
Comparing version 1.6.3 to 2.0.0
@@ -5,3 +5,3 @@ export default function EduzzToolbarSetup(params) { | ||
script.async = true; | ||
script.src = 'https://unpkg.com/@eduzz/apps-toolbar@^1.5.1/build/widget.js'; | ||
script.src = 'https://unpkg.com/@eduzz/apps-toolbar@^2.0.0/dist/widget.js'; | ||
@@ -14,3 +14,3 @@ script.onload = () => { | ||
script.onerror = err => { | ||
import('@eduzz/apps-toolbar/build/widget.js') | ||
import('@eduzz/apps-toolbar/dist/widget.js') | ||
.then(() => { | ||
@@ -17,0 +17,0 @@ console.log('@eduzz/apps-toolbar: LOADING FROM FALLBACK'); |
{ | ||
"name": "@eduzz/apps-toolbar", | ||
"version": "1.6.3", | ||
"version": "2.0.0", | ||
"private": false, | ||
"main": "./index.js", | ||
"license": "MIT", | ||
"types": "./src/declarations/index.d.ts", | ||
"types": "./index.d.ts", | ||
"scripts": { | ||
"start": "cross-env NODE_ENV=development node ./scripts/start.js", | ||
"build": "cross-env NODE_ENV=production node ./scripts/build.js", | ||
"start": "react-app-rewired start", | ||
"build": "react-app-rewired build", | ||
"lint": "yarn eslint \"./src/**/*.ts\" \"./src/**/*.tsx\"", | ||
@@ -16,34 +16,34 @@ "preprepare": "concurrently -r \"yarn lint\" \"yarn tsc --noEmit\"", | ||
"devDependencies": { | ||
"@eduzz/eslint-config-houston": "0.12.11", | ||
"@types/node": "15.0.1", | ||
"@types/react": "17.0.4", | ||
"@types/react-dom": "17.0.3", | ||
"@eduzz/eslint-config-houston": "0.40.0", | ||
"@emotion/react": "11.5.0", | ||
"@emotion/styled": "11.3.0", | ||
"@types/node": "16.11.6", | ||
"@types/react": "17.0.33", | ||
"@types/react-dom": "17.0.10", | ||
"@types/validatorjs": "3.15.0", | ||
"@types/yup": "0.29.11", | ||
"@typescript-eslint/eslint-plugin": "4.22.0", | ||
"@typescript-eslint/parser": "4.22.0", | ||
"axios": "0.21.1", | ||
"browser-cookies": "1.2.0", | ||
"concurrently": "6.0.2", | ||
"@types/yup": "0.29.13", | ||
"@typescript-eslint/eslint-plugin": "5.2.0", | ||
"@typescript-eslint/parser": "5.2.0", | ||
"axios": "0.24.0", | ||
"concurrently": "6.3.0", | ||
"cross-env": "7.0.3", | ||
"eslint": "7.25.0", | ||
"eslint": "8.1.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-eslint-plugin": "3.0.2", | ||
"eslint-plugin-import-helpers": "1.1.0", | ||
"eslint-plugin-prettier": "3.4.0", | ||
"eslint-plugin-react": "7.23.2", | ||
"eslint-plugin-eslint-plugin": "4.0.2", | ||
"eslint-plugin-import": "2.25.2", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"eslint-plugin-react": "7.26.1", | ||
"eslint-plugin-react-hooks": "4.2.0", | ||
"eslint-plugin-react-native": "3.10.0", | ||
"eslint-plugin-unused-imports": "1.1.1", | ||
"husky": "6.0.0", | ||
"mdi-react": "7.5.0", | ||
"eslint-plugin-react-native": "3.11.0", | ||
"eslint-plugin-sonarjs": "0.10.0", | ||
"eslint-plugin-unused-imports": "1.1.5", | ||
"husky": "7.0.4", | ||
"mdi-react": "8.1.0", | ||
"mock-require": "3.0.3", | ||
"prettier": "2.2.1", | ||
"prettier": "2.4.1", | ||
"react": "17.0.2", | ||
"react-app-rewired": "2.1.8", | ||
"react-dom": "17.0.2", | ||
"react-jss": "^10.8.2", | ||
"react-scripts": "4.0.3", | ||
"style-loader": "2.0.0", | ||
"typescript": "4.2.4", | ||
"yup": "0.32.9" | ||
"typescript": "4.4.4" | ||
}, | ||
@@ -50,0 +50,0 @@ "browserslist": { |
@@ -5,5 +5,24 @@ # Eduzz Apps Toolbar | ||
### How to use | ||
### Como User | ||
In Browser | ||
Via package (sugerido): | ||
> Mesmo sendo instalado via package, ele possui um processo de auto-atualização, ou seja, no | ||
> browser ele tentará baixar a última versão ([^ patch, semver](https://docs.npmjs.com/about-semantic-versioning#using-semantic-versioning-to-specify-update-types-your-package-can-accept)), | ||
> caso sem sucesso, ele usará a versão do bundle. | ||
```ts | ||
import EduzzAppsToolbar from '@eduzz/apps-toolbar'; | ||
const toolbar = EduzzAppsToolbar({ | ||
application: 'nutror', | ||
show: false //default false | ||
}); | ||
// after | ||
toolbar.show(); | ||
``` | ||
Via CDN: | ||
> Atenção na versão selecionada, importante manter o ^! | ||
```js | ||
@@ -16,3 +35,3 @@ (function (d, l, c) { | ||
d.body.append(s); | ||
})(document, 'https://unpkg.com/@eduzz/apps-toolbar@^1.5.0/build/widget.js', function () { | ||
})(document, 'https://unpkg.com/@eduzz/apps-toolbar@^2.0.0/dist/widget.js', function () { | ||
var toolbar = window.EduzzAppsToolbar({ | ||
@@ -30,22 +49,40 @@ application: 'nutror', | ||
Via npm | ||
## API | ||
```ts | ||
// eduzzToolbar.ts <~ create in your applocation | ||
import EduzzAppsToolbar from '@eduzz/apps-toolbar'; | ||
import { IUser } from 'interfaces/models/user'; | ||
// Parâmetros | ||
interface IEduzzToolbarSetupParams { | ||
show: boolean; // default false | ||
application?: 'nutror' | ||
| 'blinket' | ||
| 'orbita' | ||
| 'sun' | ||
| 'jobzz' | ||
| 'telescope' | ||
| 'safevideo' | ||
| 'alumy' | ||
| 'orbit-pages'; // default null | ||
applicationUrls?: { [key in typeEduzzToolbarApplications]: string }; // override application urls | ||
env?: 'production' | 'homolog' | 'development'; // default production | ||
disableChat?: boolean; // default false, pode ser alterado depois, apenas para black+ | ||
const promiseToolbar = EduzzAppsToolbar({ | ||
application: 'nutror', | ||
show: true //default false | ||
}); | ||
export async function show(user: IUser) { | ||
const toolbar = await promiseToolbar; | ||
toolbar.show(); | ||
user?: { // default null, pode ser alterado depois | ||
id: number; | ||
email: string; | ||
belt?: string; | ||
isSupport?: boolean; | ||
supportId?: number; | ||
isClubeBlack?: boolean; | ||
}; | ||
} | ||
export async function clearUser() { | ||
const toolbar = await promiseToolbar; | ||
toolbar.hide(); | ||
} | ||
// Métodos | ||
const EduzzAppsToolbar: (params: IEduzzToolbarSetupParams) => { | ||
show(): void; | ||
hide(): void; | ||
setUser(user: IEduzzToolbarSetupParams['user']): void; | ||
clearUser(): void; | ||
enableChat(): void; | ||
disableChat(): void; | ||
}; | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85
882038
6
932
1