diff --git a/.env.example b/.env.example index 119819a6..fa8ac5ee 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -VITE_API_URL=http://localhost:4000 \ No newline at end of file +VITE_API_URL=http://localhost:4000 +VITE_HMAC_SECRET_KEY= \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5375d85e..ab4b3a6c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -22,6 +22,7 @@ jobs: run: | touch .env echo VITE_API_URL=${{ secrets.VITE_API_URL }} >> .env + echo VITE_HMAC_SECRET_KEY=${{ secrets.VITE_HMAC_SECRET_KEY }} >> .env cat .env - run: npm run build diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index be5fa7a8..a0c70d84 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -22,6 +22,7 @@ jobs: run: | touch .env echo VITE_API_URL=${{ secrets.DEV_VITE_API_URL }} >> .env + echo VITE_HMAC_SECRET_KEY=${{ secrets.VITE_HMAC_SECRET_KEY }} >> .env cat .env - run: npm run build diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index b9ad33de..044858fd 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -22,6 +22,7 @@ jobs: run: | touch .env echo VITE_API_URL=${{ secrets.STG_VITE_API_URL }} >> .env + echo VITE_HMAC_SECRET_KEY=${{ secrets.VITE_HMAC_SECRET_KEY }} >> .env cat .env - run: npm run build diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..9d44effa --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,127 @@ +# Contribuindo + +Você pode contribuir com o projeto de diversas formas, implementando uma +funcionalidade nova, corrigindo um bug, procurando bugs, revisando pull +requests, entre outras. +Para se inteirar do projeto, entre no +[Discord](https://discord.gg/vjZS6BQXvM) e participe das discussões. + +## 🤝 Contribuindo com atividades que não são de código + +O projeto precisa de ajuda em diversas frentes diferentes como: QA, produto, +design e gestão. Entre no servidor do Discord onde há canais específicos para +essas atividades. + +Se você encontrou um bug, vá nas +[issues](https://github.com/SOS-RS/frontend/issues) +do projeto e reporte-o lá. Verifique antes se já não existe um bug aberto para o +problema que quer relatar, usando a busca. O mesmo vale para novas +funcionalidades. + +O restante deste documento focará nas contribuições de código. + +## ✅ Escolhendo qual será sua contribuição de código + +Verifique no [projeto do Github](https://github.com/orgs/SOS-RS/projects/1) +quais funcionalidades ainda não foram implementadas e já estão prontas para +serem desenvolvidas, elas estarão na coluna "Disponível pra dev". Lá há itens de +backend e frontend, então atente-se para qual você gostaria de participar. + +Após escolher o item que quer trabalhar, faça um comentário no issue informando +que quer contribuir para sua entrega. Uma pessoa que administra o repositório +marcará você como a pessoa responsável por aquele issue, e marcará o item como +"Em desenvolvimento". + +A partir daí você já pode trabalhar no item que escolheu. + +Você também pode mandar a contribuição diretamente sem avisar, mas corre o +risco de alguém solicitar para trabalhar no item e entregá-lo junto ou antes de +você, desperdiçando assim esforços. Somente faça isso se a correção for bem rápida e pontual para +evitar o desperdício. + +⚠️ **Importante**: Itens de alta prioridade precisam ser entregues o mais rápido possível, +idealmente em até dois dias. Verifique se tem tempo livre suficiente para se +dedicar a um item de urgência, a fim de evitar segurar o item por tempo demais +de forma desnecessária. + +## 🚀 Configuração Inicial Local + +1. Faça um fork do repositório para o seu usuário (uma boa ideia é usar um nome mais descritivo do que `frontend`, como `sos-rs-frontend`). +2. Clone o repositório (troque `` na url abaixo pelo seu usuário): + + ```bash + git clone https://github.com//sos-rs-frontend.git + ``` + +3. Instale as dependências: + + ```bash + npm install + ``` + +4. Inicie o servidor: + + ```bash + npm run dev + ``` + + O app estará disponível em . + +5. Inicie o servidor de backend. Veja as instruções no seu + [documento de contribuição](https://github.com/SOS-RS/backend/blob/develop/CONTRIBUTING.md). + +## 💻 Codificando e enviando + +1. Faça suas alterações. +2. Rode o lint com `npm run lint`. +3. Crie um branch com o git `git checkout -b nomedobranch`. +4. Faça um commit com `git commit`. +5. Faça um push para o seu repositório com `git push`. +6. [Sincronize seu repositório](#-sincronizando). +7. [Abra um pull request](https://docs.github.com/pt/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). + Não deixe de informar, no seu pull request, qual a issue que está fechando. + Idealmente coloque um comentário no PR que já fechará a issue, como + `fixes #xxxx` ou `closes #xxxx` (onde `xxxx` é o número do issue). Veja + [como isso funciona](https://docs.github.com/pt/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests). +8. Acompanhe a revisão do PR. Algumas verificações automáticas serão feitas (o + Github Actions rodará o build do Vite, por exemplo). Se uma delas falhar, corrija-a, a + revisão humana só começa quando estas checagem estão passando. Após abrir o + PR uma pessoa que administra o projeto pode pedir revisões e alterações. + Busque respondê-las o mais rápido possível para que o PR possa ser integrado. + +## 🔄 Sincronizando + +Você vai precisar, de tempos em tempos, sincronizar a branch `develop` do +seu repositório. Você pode usar o botão `Sync fork` do Github +(veja [os docs](https://docs.github.com/pt/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork)). +Ou você pode fazer manualmente, o que te permite fazer a sincronização sem depender do Github: + +1. Antes de mais nada, se estiver no meio de uma contribuição, verifique que já commitou + tudo que tinha pra commitar, e então faça checkout do branch `develop`: + + ```bash + git checkout develop + ``` + +2. Adicione o repositório oficial como remoto com nome `upstream` (só necessário na primeira vez): + + ```bash + git remote add upstream https://github.com/SOS-RS/frontend.git + ``` + +3. Faça pull do branch `develop`: + + ```bash + git pull upstream develop + ``` + +4. Se estiver no meio de uma contribuição, faça um rebase no branch `develop` + (substitua `` pelo nome do seu branch): + + ```bash + git checkout + git rebase develop + ``` + + Após o rebase, é importante rodar novamente a aplicação e verificar se tudo + continua funcionando. diff --git a/README.md b/README.md index 6d7e165b..0be3ac88 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,22 @@ -# README +# 🌊 Frontend para App de Ajuda em Enchentes 🌊 Este projeto é o frontend de um aplicativo destinado a auxiliar na organização e distribuição de suprimentos, além de coordenar voluntários durante os alagamentos no Rio Grande do Sul. A aplicação visa conectar pessoas afetadas pelas enchentes com recursos essenciais e voluntários dispostos a ajudar. +O objetivo deste aplicativo é facilitar uma resposta rápida e eficiente em situações de emergência causadas por enchentes, promovendo a colaboração e o apoio mútuo entre a comunidade e organizações de ajuda. + +Se você quiser discutir ideias, problemas ou contribuições, sinta-se à vontade para se juntar ao nosso servidor do +Discord [aqui](https://discord.gg/vjZS6BQXvM). + ## Acesso à Aplicação [SOS Rio Grande do Sul](https://sos-rs.com/) -[Discord](https://discord.gg/eJTuannsd6) -## Sobre o Projeto +## 🤝 Contribuição -O objetivo deste aplicativo é facilitar uma resposta rápida e eficiente em situações de emergência causadas por enchentes, promovendo a colaboração e o apoio mútuo entre a comunidade e organizações de ajuda. +Contribuições são muito bem-vindas! Se deseja ajudar, veja o +[documento de contribuição](./CONTRIBUTING.md). + +Agradecemos o seu interesse e apoio. Juntos, podemos fazer uma diferença significativa para as vítimas das enchentes no Rio Grande do Sul! ## Tecnologias Utilizadas @@ -20,36 +27,12 @@ Este frontend foi desenvolvido utilizando as seguintes tecnologias: - [**Tailwind CSS**](https://tailwindcss.com/docs/installation): Framework CSS baseado em classes utilitárias. - [**shadcn/ui**](https://ui.shadcn.com/docs): Coleção de componentes reutilizáveis, baseado em Tailwind. -Para executar o frontend do aplicativo em seu ambiente local, siga os passos abaixo: - -1. Clone o repositório: - ``` - git clone https://github.com/SOS-RS/frontend - ``` -2. Entre no diretório do projeto: - ``` - cd frontend - ``` -3. Instale as dependências: - ``` - npm install - ``` -4. Inicie o servidor de desenvolvimento: - ``` - npm run dev - ``` - O app estará disponível em `http://localhost:5173`. - -## Contribuindo - -Contribuições são muito bem-vindas! Se você tem interesse em ajudar a melhorar o app, por favor: - -1. Faça um fork do repositório. -2. Crie uma branch para sua feature (`git checkout -b feature/MinhaFeature`). -3. Faça seus commits (`git commit -m 'Adicionando uma nova feature'`). -4. Faça push para a branch (`git push origin feature/MinhaFeature`). -5. Abra um Pull Request. - ---- +## Licença -Agradecemos o seu interesse e apoio. Juntos, podemos fazer uma diferença significativa para as vítimas das enchentes no Rio Grande do Sul! +Este código está licenciado usando a +[licença MIT](./LICENSE). + +## Contribuidores + +Os contribuidores são voluntários, e podem ser encontrados +[na página de contribuidores](https://github.com/SOS-RS/frontend/graphs/contributors). diff --git a/package-lock.json b/package-lock.json index 33731021..7aa87d0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "axios": "^1.6.8", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "crypto-js": "^4.2.0", "date-fns": "^3.6.0", "formik": "^2.4.6", "lucide-react": "^0.378.0", @@ -37,6 +38,7 @@ "yup": "^1.4.0" }, "devDependencies": { + "@types/crypto-js": "^4.2.2", "@types/node": "^20.12.8", "@types/qs": "^6.9.15", "@types/react": "^18.2.66", @@ -49,6 +51,7 @@ "eslint": "^8.57.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", + "javascript-obfuscator": "^4.1.0", "postcss": "^8.4.38", "tailwindcss": "^3.4.3", "typescript": "^5.2.2", @@ -1160,6 +1163,94 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/@javascript-obfuscator/escodegen": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@javascript-obfuscator/escodegen/-/escodegen-2.3.0.tgz", + "integrity": "sha512-QVXwMIKqYMl3KwtTirYIA6gOCiJ0ZDtptXqAv/8KWLG9uQU2fZqTVy7a/A5RvcoZhbDoFfveTxuGxJ5ibzQtkw==", + "dev": true, + "dependencies": { + "@javascript-obfuscator/estraverse": "^5.3.0", + "esprima": "^4.0.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/@javascript-obfuscator/escodegen/node_modules/levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "dev": true, + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@javascript-obfuscator/escodegen/node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@javascript-obfuscator/escodegen/node_modules/prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@javascript-obfuscator/escodegen/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@javascript-obfuscator/escodegen/node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "dev": true, + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@javascript-obfuscator/estraverse": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/@javascript-obfuscator/estraverse/-/estraverse-5.4.0.tgz", + "integrity": "sha512-CZFX7UZVN9VopGbjTx4UXaXsi9ewoM1buL0kY7j1ftYdSs7p2spv9opxFjHlQ/QGTgh4UqufYqJJ0WKLml7b6w==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", @@ -2325,6 +2416,12 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/crypto-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.2.2.tgz", + "integrity": "sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==", + "dev": true + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -2346,6 +2443,12 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, + "node_modules/@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", + "dev": true + }, "node_modules/@types/node": { "version": "20.12.10", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.10.tgz", @@ -2412,6 +2515,12 @@ "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", "dev": true }, + "node_modules/@types/validator": { + "version": "13.11.10", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.10.tgz", + "integrity": "sha512-e2PNXoXLr6Z+dbfx5zSh9TRlXJrELycxiaXznp4S5+D2M3b9bqJEitNHA5923jhnB2zzFiZHa2f0SI1HoIahpg==", + "dev": true + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "7.8.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.8.0.tgz", @@ -2722,6 +2831,15 @@ "node": ">=10" } }, + "node_modules/array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -2731,6 +2849,27 @@ "node": ">=8" } }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "dev": true, + "dependencies": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -2773,6 +2912,21 @@ "postcss": "^8.1.0" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/axios": { "version": "1.6.8", "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", @@ -2864,6 +3018,12 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, "node_modules/call-bind": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", @@ -2931,6 +3091,30 @@ "node": ">=4" } }, + "node_modules/chance": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/chance/-/chance-1.1.9.tgz", + "integrity": "sha512-TfxnA/DcZXRTA4OekA2zL9GH8qscbbl6X0ZqU4tXhGveVY/mXWvEQLt5GwZcYXTEyEFflVtj+pG8nc8EwSm1RQ==", + "dev": true + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -2965,6 +3149,17 @@ "node": ">= 6" } }, + "node_modules/class-validator": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.0.tgz", + "integrity": "sha512-ct3ltplN8I9fOwUd8GrP8UQixwff129BkEtuWDKL5W45cQuLd19xqmTLu5ge78YDm/fdje6FMt0hGOhl0lii3A==", + "dev": true, + "dependencies": { + "@types/validator": "^13.7.10", + "libphonenumber-js": "^1.10.14", + "validator": "^13.7.0" + } + }, "node_modules/class-variance-authority": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.0.tgz", @@ -3072,6 +3267,20 @@ "node": ">= 8" } }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -3144,6 +3353,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -3243,6 +3469,12 @@ "node": ">= 0.4" } }, + "node_modules/es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==", + "dev": true + }, "node_modules/esbuild": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", @@ -3550,6 +3782,19 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/esquery": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", @@ -3727,6 +3972,15 @@ } } }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/foreground-child": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", @@ -3994,6 +4248,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", @@ -4070,6 +4339,28 @@ "loose-envify": "^1.0.0" } }, + "node_modules/inversify": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/inversify/-/inversify-6.0.1.tgz", + "integrity": "sha512-B3ex30927698TJENHR++8FfEaJGqoWOgI6ZY5Ht/nLUsFCwHn6akbwtnUAPCgUepAnTpe2qHxhDNjoKLyz6rgQ==", + "dev": true + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -4086,6 +4377,24 @@ "node": ">=8" } }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-core-module": { "version": "2.13.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", @@ -4113,6 +4422,21 @@ "node": ">=8" } }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -4124,6 +4448,22 @@ "node": ">=0.10.0" } }, + "node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -4141,6 +4481,21 @@ "node": ">=8" } }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -4163,6 +4518,167 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/javascript-obfuscator": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/javascript-obfuscator/-/javascript-obfuscator-4.1.0.tgz", + "integrity": "sha512-ckC0VFKQ0/sFtLH9apW/ZLfsP8LuZqZhVEM4VTJ5KLzyLaodW6C1lTU8808eboDmddKyvd2uyRx5bzc0Me0GYg==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@javascript-obfuscator/escodegen": "2.3.0", + "@javascript-obfuscator/estraverse": "5.4.0", + "acorn": "8.8.2", + "assert": "2.0.0", + "chalk": "4.1.2", + "chance": "1.1.9", + "class-validator": "0.14.0", + "commander": "10.0.0", + "eslint-scope": "7.1.1", + "eslint-visitor-keys": "3.3.0", + "fast-deep-equal": "3.1.3", + "inversify": "6.0.1", + "js-string-escape": "1.0.1", + "md5": "2.3.0", + "mkdirp": "2.1.3", + "multimatch": "5.0.0", + "opencollective-postinstall": "2.0.3", + "process": "0.11.10", + "reflect-metadata": "0.1.13", + "source-map-support": "0.5.21", + "string-template": "1.0.0", + "stringz": "2.1.0", + "tslib": "2.5.0" + }, + "bin": { + "javascript-obfuscator": "bin/javascript-obfuscator" + }, + "engines": { + "node": "^12.22.0 || ^14.0.0 || ^16.0.0 || ^17.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/javascript-obfuscator" + } + }, + "node_modules/javascript-obfuscator/node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/javascript-obfuscator/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/javascript-obfuscator/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/javascript-obfuscator/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/javascript-obfuscator/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/javascript-obfuscator/node_modules/commander": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz", + "integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/javascript-obfuscator/node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/javascript-obfuscator/node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/javascript-obfuscator/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/javascript-obfuscator/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/javascript-obfuscator/node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", + "dev": true + }, "node_modules/jiti": { "version": "1.21.0", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", @@ -4171,6 +4687,15 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-string-escape": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", + "integrity": "sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -4257,6 +4782,12 @@ "node": ">= 0.8.0" } }, + "node_modules/libphonenumber-js": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.1.tgz", + "integrity": "sha512-Wze1LPwcnzvcKGcRHFGFECTaLzxOtujwpf924difr5zniyYv1C2PiW0419qDR7m8lKDxsImu5mwxFuXhXpjmvw==", + "dev": true + }, "node_modules/lilconfig": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", @@ -4329,6 +4860,17 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0" } }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dev": true, + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "node_modules/memoize-one": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", @@ -4395,12 +4937,68 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mkdirp": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.3.tgz", + "integrity": "sha512-sjAkg21peAG9HS+Dkx7hlG9Ztx7HLeKnvB3NQRcu/mltCVmvkF0pisbiTSfDVYTT86XEfZrTUosLdZLStquZUw==", + "dev": true, + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/multimatch": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", + "integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==", + "dev": true, + "dependencies": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/multimatch/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/multimatch/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -4481,6 +5079,31 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object-is": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", + "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -4490,6 +5113,15 @@ "wrappy": "1" } }, + "node_modules/opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", + "dev": true, + "bin": { + "opencollective-postinstall": "index.js" + } + }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -4659,6 +5291,15 @@ "node": ">= 6" } }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/postcss": { "version": "8.4.38", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", @@ -4809,6 +5450,15 @@ "node": ">= 0.8.0" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -5092,6 +5742,12 @@ "node": ">=8.10.0" } }, + "node_modules/reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", + "dev": true + }, "node_modules/regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", @@ -5310,6 +5966,31 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-template": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz", + "integrity": "sha512-SLqR3GBUXuoPP5MmYtD7ompvXiG87QjT6lzOszyXjTM86Uu7At7vNnt2xgyTLq5o9T4IxTYFyGxcULqpsmsfdg==", + "dev": true + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -5370,6 +6051,15 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/stringz": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/stringz/-/stringz-2.1.0.tgz", + "integrity": "sha512-KlywLT+MZ+v0IRepfMxRtnSvDCMc3nR1qqCs3m/qIbSOWkNZYT8XHQA31rS3TnKp0c5xjZu3M4GY/2aRKSi/6A==", + "dev": true, + "dependencies": { + "char-regex": "^1.0.2" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -5746,11 +6436,33 @@ } } }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, + "node_modules/validator": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.12.0.tgz", + "integrity": "sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/vite": { "version": "5.2.11", "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", @@ -5828,6 +6540,25 @@ "node": ">= 8" } }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", diff --git a/package.json b/package.json index 29dd3ef1..62a1de6d 100644 --- a/package.json +++ b/package.json @@ -24,33 +24,36 @@ "axios": "^1.6.8", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "crypto-js": "^4.2.0", "date-fns": "^3.6.0", "formik": "^2.4.6", "lucide-react": "^0.378.0", "qs": "^6.12.1", + "react": "^18.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.51.4", "react-input-mask": "^2.0.4", "react-router-dom": "^6.23.0", "react-select": "^5.8.0", - "react": "^18.2.0", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", "yup": "^1.4.0" }, "devDependencies": { + "@types/crypto-js": "^4.2.2", "@types/node": "^20.12.8", "@types/qs": "^6.9.15", + "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", "@types/react-input-mask": "^3.0.5", - "@types/react": "^18.2.66", "@typescript-eslint/eslint-plugin": "^7.2.0", "@typescript-eslint/parser": "^7.2.0", "@vitejs/plugin-react": "^4.2.1", "autoprefixer": "^10.4.19", + "eslint": "^8.57.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", - "eslint": "^8.57.0", + "javascript-obfuscator": "^4.1.0", "postcss": "^8.4.38", "tailwindcss": "^3.4.3", "typescript": "^5.2.2", diff --git a/src/api/api.ts b/src/api/api.ts index 3c975711..9f1c03fd 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -1,5 +1,6 @@ import axios, { AxiosRequestHeaders, InternalAxiosRequestConfig } from 'axios'; import { clearCache, getCacheRequestData, handleCacheResponse } from './cache'; +import { getHmacHeaders } from './hmac'; const api = axios.create({ baseURL: import.meta.env.VITE_API_URL ?? 'http://localhost:4000/', @@ -14,12 +15,22 @@ api.interceptors.request.use((config) => { if (!config.headers) config.headers = {} as AxiosRequestHeaders; handleRequestAuthToken(config); const response = getCacheRequestData(config); + if (response) { config.adapter = () => { return new Promise((resolve) => { resolve({ ...response, config }); }); }; + } else { + const hmacHeaders = getHmacHeaders({ + method: config.method?.toUpperCase(), + url: [config.url, new URLSearchParams(config.params).toString()] + .filter((p) => !!p) + .join('?'), + body: config.data, + }); + Object.assign(config.headers, hmacHeaders); } return config; }); diff --git a/src/api/hmac.ts b/src/api/hmac.ts new file mode 100644 index 00000000..19516e06 --- /dev/null +++ b/src/api/hmac.ts @@ -0,0 +1,26 @@ +import CryptoJS from 'crypto-js'; + +export interface IHmacProps { + method: string; + url: string; + body?: string; +} + +function getHmacHeaders(props: Partial) { + const { method, url, body } = props; + const timestamp = Math.floor(Date.now() / 1000); + + const payload = `${method}:${url}:${timestamp}:${JSON.stringify(body)}`; + + const signature = CryptoJS.HmacSHA256( + payload, + import.meta.env.VITE_HMAC_SECRET_KEY + ).toString(CryptoJS.enc.Hex); + + return { + 'x-hmac-signature': signature, + 'x-hmac-timestamp': `${timestamp}`, + }; +} + +export { getHmacHeaders }; diff --git a/src/components/ui/badge-variants.tsx b/src/components/ui/badge-variants.tsx new file mode 100644 index 00000000..bee7c587 --- /dev/null +++ b/src/components/ui/badge-variants.tsx @@ -0,0 +1,23 @@ +import { cva } from "class-variance-authority"; + +const badgeVariants = cva( + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + secondary: + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + destructive: + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + } +); + +export { badgeVariants }; diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsx index f000e3ef..aeaf8fb0 100644 --- a/src/components/ui/badge.tsx +++ b/src/components/ui/badge.tsx @@ -1,27 +1,8 @@ -import * as React from "react" -import { cva, type VariantProps } from "class-variance-authority" +import * as React from "react"; +import { type VariantProps } from "class-variance-authority"; -import { cn } from "@/lib/utils" - -const badgeVariants = cva( - "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", - { - variants: { - variant: { - default: - "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", - secondary: - "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", - destructive: - "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", - outline: "text-foreground", - }, - }, - defaultVariants: { - variant: "default", - }, - } -) +import { cn } from "@/lib/utils"; +import { badgeVariants } from "./badge-variants"; export interface BadgeProps extends React.HTMLAttributes, @@ -30,7 +11,7 @@ export interface BadgeProps function Badge({ className, variant, ...props }: BadgeProps) { return (
- ) + ); } -export { Badge, badgeVariants } +export { Badge }; diff --git a/src/components/ui/button-variants.tsx b/src/components/ui/button-variants.tsx new file mode 100644 index 00000000..d997ddee --- /dev/null +++ b/src/components/ui/button-variants.tsx @@ -0,0 +1,32 @@ +import { cva } from 'class-variance-authority'; + +const buttonVariants = cva( + 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', + { + variants: { + variant: { + default: 'bg-primary text-primary-foreground hover:bg-primary/90', + destructive: + 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + outline: + 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', + secondary: + 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline', + }, + size: { + default: 'h-10 px-4 py-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'h-10 w-10', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, + } +); + +export { buttonVariants }; diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 58bd1541..70280b11 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -1,38 +1,10 @@ import * as React from 'react'; import { Slot } from '@radix-ui/react-slot'; -import { cva, type VariantProps } from 'class-variance-authority'; +import { type VariantProps } from 'class-variance-authority'; import { cn } from '@/lib/utils'; import { Loader } from 'lucide-react'; - -const buttonVariants = cva( - 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', - { - variants: { - variant: { - default: 'bg-primary text-primary-foreground hover:bg-primary/90', - destructive: - 'bg-destructive text-destructive-foreground hover:bg-destructive/90', - outline: - 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', - secondary: - 'bg-secondary text-secondary-foreground hover:bg-secondary/80', - ghost: 'hover:bg-accent hover:text-accent-foreground', - link: 'text-primary underline-offset-4 hover:underline', - }, - size: { - default: 'h-10 px-4 py-2', - sm: 'h-9 rounded-md px-3', - lg: 'h-11 rounded-md px-8', - icon: 'h-10 w-10', - }, - }, - defaultVariants: { - variant: 'default', - size: 'default', - }, - } -); +import { buttonVariants } from './button-variants'; export interface ButtonProps extends React.ButtonHTMLAttributes, @@ -70,4 +42,4 @@ const Button = React.forwardRef( ); Button.displayName = 'Button'; -export { Button, buttonVariants }; +export { Button }; diff --git a/src/hooks/useAuthRoles/MappedRoles.tsx b/src/hooks/useAuthRoles/MappedRoles.tsx new file mode 100644 index 00000000..a16f925a --- /dev/null +++ b/src/hooks/useAuthRoles/MappedRoles.tsx @@ -0,0 +1,10 @@ +import { AccessLevel } from '@/service/sessions/types'; + +const MappedRoles: Record = { + Admin: ['Admin'], + DistributionCenter: ['Admin', 'DistributionCenter'], + Staff: ['Admin', 'Staff'], + User: ['Admin', 'Staff', 'DistributionCenter', 'User'], +}; + +export default MappedRoles; diff --git a/src/hooks/useAuthRoles/useAuthRoles.tsx b/src/hooks/useAuthRoles/useAuthRoles.tsx index f3e7d45a..1fd40ffa 100644 --- a/src/hooks/useAuthRoles/useAuthRoles.tsx +++ b/src/hooks/useAuthRoles/useAuthRoles.tsx @@ -1,15 +1,9 @@ import { useContext } from 'react'; import { SessionContext } from '@/contexts'; +import MappedRoles from '@/hooks/useAuthRoles/MappedRoles'; import { AccessLevel } from '@/service/sessions/types'; -const MappedRoles: Record = { - Admin: ['Admin'], - DistributionCenter: ['Admin', 'DistributionCenter'], - Staff: ['Admin', 'Staff'], - User: ['Admin', 'Staff', 'DistributionCenter', 'User'], -}; - const useAuthRoles = (...roles: AccessLevel[]) => { const { session } = useContext(SessionContext); diff --git a/src/hooks/useShelters/useShelters.tsx b/src/hooks/useShelters/useShelters.tsx index a13a3c82..f6959800 100644 --- a/src/hooks/useShelters/useShelters.tsx +++ b/src/hooks/useShelters/useShelters.tsx @@ -53,7 +53,7 @@ const useShelters = (options: IUseShelterOptions = {}) => { if (!append) setLoading(false); }); }, - [] + [cache] ); useEffect(() => { diff --git a/src/lib/utils.ts b/src/lib/utils.ts index dc8981ac..c12c1b59 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -12,36 +12,6 @@ function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } -/** - * deprecated - */ -function variantStatusPriority(priority: SupplyPriority) { - if (priority === SupplyPriority.Needing) return 'danger'; - if (priority === SupplyPriority.Urgent) return 'warn'; - if (priority === SupplyPriority.NotNeeded) return 'alert'; - if (priority === SupplyPriority.Remaining) return 'success'; -} - -/** - * deprecated - */ -const colorStatusPriority = (priority: SupplyPriority) => { - if (priority === SupplyPriority.Needing) return 'bg-[#f69f9d]'; - if (priority === SupplyPriority.Urgent) return 'bg-[#f8b993]'; - if (priority === SupplyPriority.NotNeeded) return 'bg-[#f9cf8d]'; - if (priority === SupplyPriority.Remaining) return 'bg-[#63bc43]'; -}; - -/** - * deprecated - */ -function nameStatusPriority(priority: SupplyPriority) { - if (priority === SupplyPriority.Needing) return 'Precisa urgentimente'; - if (priority === SupplyPriority.Urgent) return 'Precisa'; - if (priority === SupplyPriority.NotNeeded) return 'Não preciso'; - if (priority === SupplyPriority.Remaining) return 'Disponível para doação'; -} - function getAvailabilityProps(props: { capacity?: number | null; shelteredPeople?: number | null; @@ -72,7 +42,7 @@ function getAvailabilityProps(props: { } const priorityOptions: Record = { - [SupplyPriority.Urgent]: 'Necessita urgente', + [SupplyPriority.Urgent]: 'Precisa com urgência', [SupplyPriority.Needing]: 'Precisa', [SupplyPriority.Remaining]: 'Disponível para doação', [SupplyPriority.NotNeeded]: 'Não preciso', @@ -185,9 +155,6 @@ export { getAvailabilityProps, group, getSupplyPriorityProps, - variantStatusPriority, - colorStatusPriority, - nameStatusPriority, priorityOptions, groupShelterSuppliesByTag, removeDuplicatesByField, diff --git a/src/pages/AboutUs/AboutUs.tsx b/src/pages/AboutUs/AboutUs.tsx index 080c909e..efeffa9d 100644 --- a/src/pages/AboutUs/AboutUs.tsx +++ b/src/pages/AboutUs/AboutUs.tsx @@ -1,5 +1,5 @@ -import { useMemo } from 'react'; -import { HandHeart, Home, Loader, Users } from 'lucide-react'; +import { Fragment, useMemo } from 'react'; +import { HandHeart, Home, LifeBuoy, Loader, Users } from 'lucide-react'; import { BurgerMenu, Header } from '@/components'; import { AboutCardInfo, ServicedFrontInfo } from './components'; @@ -7,6 +7,7 @@ import { frontItems } from './frontItems'; import { useGithubContributors } from '@/hooks'; import WithTooltip from '@/components/ui/with-tooltip'; import { removeDuplicatesByField } from '@/lib/utils'; +import { IAboutUsPerson } from './types'; const AboutUs = () => { const { data: frontendContributors, loading: loadingFrontendContributors } = @@ -14,6 +15,45 @@ const AboutUs = () => { const { data: backendContributors, loading: loadingBackendContributors } = useGithubContributors('sos-rs', 'backend'); + const persons: IAboutUsPerson[] = [ + { + name: 'Klaus Riffel', + link: 'https://www.linkedin.com/in/klaus-riffel-69441928/', + }, + { + name: 'Rhuam Estevam', + link: 'https://www.linkedin.com/in/rhuam/', + }, + { + name: 'José Fagundes', + link: 'https://www.linkedin.com/in/jos%C3%A9-fagundes/', + }, + { + name: 'Manoel Júnior', + link: 'https://www.linkedin.com/in/manoelfpjunior/', + }, + { + name: 'Vinicius Arantes', + link: 'https://www.linkedin.com/in/viniciusrnt/', + }, + { + name: 'Thiago Marins', + link: 'https://www.linkedin.com/in/thiago-dable', + }, + { + name: 'Gabriel Mancuso', + link: 'https://www.linkedin.com/in/luizgabrielmancuso/', + }, + { + name: 'Max Riffel', + link: 'https://www.linkedin.com/in/max-riffel-07a134a1/', + }, + { + name: 'Kiwi Bertola', + link: 'https://www.linkedin.com/in/kiwi-bertola-10079073/', + }, + ]; + const loading = useMemo( () => loadingBackendContributors || loadingFrontendContributors, [loadingBackendContributors, loadingFrontendContributors] @@ -45,44 +85,21 @@ const AboutUs = () => { Iniciado no domingo (04/05) e concluído na segunda (05/05), após 18 horas seguidas de desenvolvimento, nosso webapp SOS RS 🛟, idealizado e desenvolvido por{' '} - - Klaus Riffel - - ,{' '} - - Rhuam Estevam - - ,{' '} - - José Fagundes - - ,{' '} - - Manoel Júnior - {' '} + {persons.slice(0, -1).map((p, idx) => ( + + + {p.name} + + {', '} + + ))}{' '} e{' '} - Vinicius Arantes + {persons.at(-1)?.name} , atingiu resultados verdadeiramente inspiradores.

@@ -91,8 +108,8 @@ const AboutUs = () => { seu modelo colaborativo. Alcançamos rapidamente o nível de todas as outras iniciativas de gestão de demanda combinadas e lançamos nossa comunidade open source, recebendo uma enxurrada de contribuições: - nosso projeto alcançou 400 estrelas no GitHub e foi{' '} - forkeado mais de 150 vezes! + nosso projeto alcançou 600 estrelas no GitHub e foi{' '} + forkeado mais de 350 vezes!

Nossos parceiros @@ -105,7 +122,7 @@ const AboutUs = () => { } topLabel="mais de" - centerLabel="500" + centerLabel="800" bottomLabel="abrigos atendidos" className="flex-1" /> @@ -119,15 +136,19 @@ const AboutUs = () => { } topLabel="mais de" - centerLabel="40.000" + centerLabel="55.000" bottomLabel="pessoas beneficiadas desde o lançamento" className="w-full" />

-

- Atualmente, o SOS RS 🛟 apoia a gestão das demandas e - necessidades dos abrigos do Rio Grande do Sul com informações - públicas, atualizadas, confiáveis e auditáveis. +

+ Atualmente, o SOS RS + {' '} + apoia a gestão das demandas e necessidades dos abrigos do Rio Grande + do Sul com informações públicas, atualizadas, confiáveis e auditáveis.

Frentes atendidas diff --git a/src/pages/AboutUs/frontItems.ts b/src/pages/AboutUs/frontItems.tsx similarity index 67% rename from src/pages/AboutUs/frontItems.ts rename to src/pages/AboutUs/frontItems.tsx index 61797ff0..cb05f6c3 100644 --- a/src/pages/AboutUs/frontItems.ts +++ b/src/pages/AboutUs/frontItems.tsx @@ -1,68 +1,79 @@ import { IServicedFrontInfoProps } from './components/ServicedFrontInfo/types'; +import { + Car, + Baby, + MapPinned, + CookingPot, + GlassWater, + Goal, + HeartHandshake, + Infinity, + MonitorSmartphone, + Speech, + Users, +} from 'lucide-react'; -const frontItems: IServicedFrontInfoProps[] = [ +export const frontItems: IServicedFrontInfoProps[] = [ { - icon: '🚰', + icon: , title: 'Água', description: 'Atender demandas urgentes de água;', }, { - icon: '🥘', + icon: , title: 'Cozinhas solidárias', description: 'Auxiliar na operação das cozinhas com o envio de suprimentos e distribuição das marmitas;', }, { - icon: '🏠', + icon: , title: 'Conexões', description: 'Gerir dados confiáveis sobre a demanda de abrigos e a disponibilidade de doações;', }, { - icon: '️❤️', + icon: , title: 'Comunidades', description: 'Mapear e integrar lideranças comunitárias;', }, { - icon: '📣', + icon: , title: 'Comunicação', description: 'Manter as informações sobre a iniciativa atualizadas e disponíveis a todos;', }, { - icon: '📍', + icon: , title: 'Dados e Geolocalização', description: 'Fornecer dados públicos sobre as enchentes e as demandas do cenário de crise com o apoio do IPH UFRGS e nossas operações de voluntários;', }, { - icon: '🎯', + icon: , title: 'Expansão', description: 'Estruturar o crescimento da operação e parcerias;', }, { - icon: '️🚗', + icon: , title: 'Logística', description: 'Conectar o transporte dos centros de distribuição e triagem aos abrigos;', }, { - icon: '🧒🏽', + icon: , title: 'Olhar para a criança', description: 'Proteger e oferecer apoio às crianças em abrigos;', }, { - icon: '️🧑🏽‍🤝‍🧑🏽', + icon: , title: 'Pessoas', description: 'Recrutar, acolher, orientar, treinar e direcionar novos voluntários e padrinhos/madrinhas;', }, { - icon: '🖥️', + icon: , title: 'Tecnologia', description: 'Desenvolver uma solução digital a partir de dados públicos confiáveis.', }, ]; - -export { frontItems }; diff --git a/src/pages/AboutUs/types.ts b/src/pages/AboutUs/types.ts new file mode 100644 index 00000000..029d6d52 --- /dev/null +++ b/src/pages/AboutUs/types.ts @@ -0,0 +1,4 @@ +export interface IAboutUsPerson { + name: string; + link: string; +} diff --git a/src/pages/EditShelterSupply/EditShelterSupply.tsx b/src/pages/EditShelterSupply/EditShelterSupply.tsx index c7729e6e..fb06726b 100644 --- a/src/pages/EditShelterSupply/EditShelterSupply.tsx +++ b/src/pages/EditShelterSupply/EditShelterSupply.tsx @@ -1,12 +1,12 @@ -import { ChevronLeft, PlusCircle } from 'lucide-react'; +import { ChevronLeft } from 'lucide-react'; import { useNavigate, useParams } from 'react-router-dom'; import { Fragment, useCallback, useEffect, useMemo, useState } from 'react'; -import { DialogSelector, Header, LoadingScreen, TextField } from '@/components'; +import { DialogSelector, Header, LoadingScreen } from '@/components'; import { Button } from '@/components/ui/button'; import { useShelter, useSupplies, useThrottle } from '@/hooks'; import { group, normalizedCompare } from '@/lib/utils'; -import { SupplyRow } from './components'; +import { SupplyRow, SupplySearch } from './components'; import { IDialogSelectorProps } from '@/components/DialogSelector/types'; import { ISupplyRowItemProps } from './components/SupplyRow/types'; import { ShelterSupplyServices } from '@/service'; @@ -25,19 +25,50 @@ const EditShelterSupply = () => { const [filteredSupplies, setFilteredSupplies] = useState( [] ); - const [searchValue, setSearchValue] = useState(''); + const [searchedSupplies, setSearchedSupplies] = useState( + [] + ); + const shelterSupplyData = useMemo(() => { + return (shelter?.shelterSupplies ?? []).reduce( + (prev, current) => ({ ...prev, [current.supply.id]: current }), + {} as Record + ); + }, [shelter?.shelterSupplies]); + + const [, setSearchSupplies] = useThrottle( + { + throttle: 200, + callback: (value) => { + if (value) { + const filteredSupplies = supplies.filter((s) => + normalizedCompare(s.name, value) + ); + setSearchedSupplies(filteredSupplies); + } else { + setSearchedSupplies([]); + setSearch(''); + } + }, + }, + [supplies] + ); + const [, setSearch] = useThrottle( { throttle: 400, - callback: (v) => { - if (v) { - setFilteredSupplies( - supplies.filter((s) => normalizedCompare(s.name, v)) + callback: (value) => { + if (value) { + const filteredSupplies = supplies.filter((s) => + normalizedCompare(s.name, value) ); - } else setFilteredSupplies(supplies); + setFilteredSupplies(filteredSupplies); + } else { + const storedSupplies = supplies.filter((s) => !!shelterSupplyData[s.id]); + setFilteredSupplies(storedSupplies); + } }, }, - [supplies] + [supplies, shelterSupplyData] ); const [modalOpened, setModalOpened] = useState(false); const [loadingSave, setLoadingSave] = useState(false); @@ -45,12 +76,7 @@ const EditShelterSupply = () => { IDialogSelectorProps, 'value' | 'onSave' | 'quantity' > | null>(); - const shelterSupplyData = useMemo(() => { - return (shelter?.shelterSupplies ?? []).reduce( - (prev, current) => ({ ...prev, [current.supply.id]: current }), - {} as Record - ); - }, [shelter?.shelterSupplies]); + const supplyGroups = useMemo( () => group(filteredSupplies ?? [], 'supplyCategory.name'), @@ -112,8 +138,9 @@ const EditShelterSupply = () => { ); useEffect(() => { - setFilteredSupplies(supplies); - }, [supplies]); + const storedSupplies = supplies.filter((s) => !!shelterSupplyData[s.id]); + setFilteredSupplies(storedSupplies); + }, [supplies, shelterSupplyData]); if (loading) return ; @@ -126,7 +153,7 @@ const EditShelterSupply = () => { title="Escolha a prioridade do item" options={[ { - label: 'Precisa urgente', + label: 'Precisa com urgência', value: `${SupplyPriority.Urgent}`, }, { @@ -163,27 +190,26 @@ const EditShelterSupply = () => {
Editar itens do abrigo

- Para cada item da lista abaixo, informe a disponibilidade no abrigo - selecionado + Antes de adicionar um novo item, confira na busca abaixo se ele já não foi cadastrado.

-
- { - setSearchValue(ev.target.value); - setSearch(ev.target.value); + + setSearchSupplies(value) + } + onSelectItem={(item) => { + setSearch(item.name); + setSearchedSupplies([]); }} + onAddNewItem={() => navigate(`/abrigo/${shelterId}/item/cadastrar`)} />
+ +

+ Para cada item da lista abaixo, informe a disponibilidade no abrigo selecionado. +

{Object.entries(supplyGroups).map(([key, values], idx) => { const items: ISupplyRowItemProps[] = values diff --git a/src/pages/EditShelterSupply/components/SupplySearch/SupplySearch.tsx b/src/pages/EditShelterSupply/components/SupplySearch/SupplySearch.tsx new file mode 100644 index 00000000..3e27cab3 --- /dev/null +++ b/src/pages/EditShelterSupply/components/SupplySearch/SupplySearch.tsx @@ -0,0 +1,81 @@ +import { Input } from '@/components/ui/input'; +import { IUseSuppliesData } from '@/hooks/useSupplies/types'; +import { Search, PlusCircle, X } from 'lucide-react'; +import { useState } from 'react'; +import { Fragment } from 'react/jsx-runtime'; +import {ISupplySearchProps} from './types'; + +export const SupplySearch = ({ + supplyItems, + limit = 10, + onSearch, + onSelectItem, + onAddNewItem +}: ISupplySearchProps) => { + const [searchValue, setSearchValue] = useState(''); + const [selectedItem, setSelectedItem] = useState(null); + + function onChangeInputHandler(event: React.ChangeEvent) { + setSearchValue(event.target.value); + onSearch(event.target.value); + } + + function onSelectItemHandler(item: IUseSuppliesData) { + setSearchValue(item.name); + setSelectedItem(item); + onSelectItem(item); + } + + function onAddNewItemHandler() { + setSelectedItem(null); + onAddNewItem(); + } + + function onClearClickHandler() { + setSelectedItem(null); + setSearchValue(''); + onSearch(''); + } + + return ( + +
+ + + +
+ + {!!searchValue && !selectedItem ? ( +
+ {supplyItems.slice(0, limit).map((item) => ( +
onSelectItemHandler(item)} + > + {item.name} +
+ ))} +
+
+ + Cadastrar novo item +
+
+
+ ) : null} +
+ ); +}; diff --git a/src/pages/EditShelterSupply/components/SupplySearch/index.ts b/src/pages/EditShelterSupply/components/SupplySearch/index.ts new file mode 100644 index 00000000..77d5b6cb --- /dev/null +++ b/src/pages/EditShelterSupply/components/SupplySearch/index.ts @@ -0,0 +1,3 @@ +import { SupplySearch } from './SupplySearch'; + +export { SupplySearch }; diff --git a/src/pages/EditShelterSupply/components/SupplySearch/types.ts b/src/pages/EditShelterSupply/components/SupplySearch/types.ts new file mode 100644 index 00000000..c91a92f6 --- /dev/null +++ b/src/pages/EditShelterSupply/components/SupplySearch/types.ts @@ -0,0 +1,9 @@ +import { IUseSuppliesData } from "@/hooks/useSupplies/types"; + +export interface ISupplySearchProps { + supplyItems: IUseSuppliesData[]; + limit?: number; + onSearch: (value: string) => void; + onSelectItem: (item: IUseSuppliesData) => void; + onAddNewItem: () => void; +} \ No newline at end of file diff --git a/src/pages/EditShelterSupply/components/index.ts b/src/pages/EditShelterSupply/components/index.ts index 53a42ef8..10b36121 100644 --- a/src/pages/EditShelterSupply/components/index.ts +++ b/src/pages/EditShelterSupply/components/index.ts @@ -1,4 +1,5 @@ import { SupplyRow } from './SupplyRow'; import { SupplyRowInfo } from './SupplyRowInfo'; +import { SupplySearch } from './SupplySearch'; -export { SupplyRowInfo, SupplyRow }; +export { SupplyRowInfo, SupplyRow, SupplySearch }; diff --git a/src/pages/Home/components/Filter/Filter.tsx b/src/pages/Home/components/Filter/Filter.tsx index 344fddd6..59caf9eb 100644 --- a/src/pages/Home/components/Filter/Filter.tsx +++ b/src/pages/Home/components/Filter/Filter.tsx @@ -176,7 +176,7 @@ const Filter = (props: IFilterProps) => {

Busca avançada

- Você pode buscar pelo item que os abrigos precisam urgentemente + Você pode buscar pelo item que os abrigos precisam com urgência de doação ou por itens que os abrigos tem disponibilidade para doar.

diff --git a/src/pages/Home/components/Filter/types.ts b/src/pages/Home/components/Filter/types.ts index 356af68e..c06adb68 100644 --- a/src/pages/Home/components/Filter/types.ts +++ b/src/pages/Home/components/Filter/types.ts @@ -28,6 +28,6 @@ export interface IFilterFormikProps { export interface IFilterProps { onSubmit: (values: IFilterFormProps) => void; data: IFilterFormProps; - open: true; + open: boolean; onClose: () => void; } diff --git a/src/pages/Home/components/ShelterListItem/ShelterListItem.tsx b/src/pages/Home/components/ShelterListItem/ShelterListItem.tsx index 391585e5..4bcdd86a 100644 --- a/src/pages/Home/components/ShelterListItem/ShelterListItem.tsx +++ b/src/pages/Home/components/ShelterListItem/ShelterListItem.tsx @@ -100,7 +100,7 @@ const ShelterListItem = (props: IShelterListItemProps) => { tags={tags.NeedVolunteers.map(getChipProps)} /> fileName.includes(f)) + ) { + const obfuscatedCode = JavaScriptObfuscator.obfuscate(chunk.code, { + compact: true, + numbersToExpressions: true, + stringArrayShuffle: true, + splitStrings: true, + stringArrayThreshold: 1, + }).getObfuscatedCode(); + chunk.code = obfuscatedCode; + } + } + }, + }; +} export default defineConfig({ - plugins: [react()], + plugins: [react(), obfuscate(['api'])], resolve: { alias: { - "@": path.resolve(__dirname, "./src"), + '@': path.resolve(__dirname, './src'), + }, + }, + build: { + rollupOptions: { + output: { + manualChunks: { + vendor: ['react', 'react-dom'], + api: ['./src/api'], + }, + }, }, }, });