kybernus 3.0.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/commands/ecommerce.d.ts +3 -0
- package/dist/cli/commands/ecommerce.d.ts.map +1 -0
- package/dist/cli/commands/ecommerce.js +164 -0
- package/dist/cli/commands/ecommerce.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/ecommerce/.env.example +10 -0
- package/templates/ecommerce/.github/workflows/ci.yml +102 -0
- package/templates/ecommerce/.github/workflows/deploy.yml +31 -0
- package/templates/ecommerce/.prettierrc +9 -0
- package/templates/ecommerce/Dockerfile +54 -0
- package/templates/ecommerce/README.md +295 -0
- package/templates/ecommerce/apps/api/.env.example +59 -0
- package/templates/ecommerce/apps/api/jest.config.ts +50 -0
- package/templates/ecommerce/apps/api/jest.integration.config.ts +45 -0
- package/templates/ecommerce/apps/api/package.json +59 -0
- package/templates/ecommerce/apps/api/prisma/migrations/20260306000137_init/migration.sql +184 -0
- package/templates/ecommerce/apps/api/prisma/migrations/migration_lock.toml +3 -0
- package/templates/ecommerce/apps/api/prisma/schema.prisma +181 -0
- package/templates/ecommerce/apps/api/prisma/seed.ts +159 -0
- package/templates/ecommerce/apps/api/src/__tests__/app.test.ts +39 -0
- package/templates/ecommerce/apps/api/src/__tests__/globalSetup.ts +34 -0
- package/templates/ecommerce/apps/api/src/__tests__/globalTeardown.ts +16 -0
- package/templates/ecommerce/apps/api/src/__tests__/setup.db.ts +18 -0
- package/templates/ecommerce/apps/api/src/__tests__/setup.env.ts +14 -0
- package/templates/ecommerce/apps/api/src/app.ts +133 -0
- package/templates/ecommerce/apps/api/src/application/admin/admin-user.service.ts +24 -0
- package/templates/ecommerce/apps/api/src/application/admin/dashboard.service.ts +102 -0
- package/templates/ecommerce/apps/api/src/application/auth/auth.service.ts +185 -0
- package/templates/ecommerce/apps/api/src/application/cart/cart.service.ts +151 -0
- package/templates/ecommerce/apps/api/src/application/cart/coupon.service.ts +51 -0
- package/templates/ecommerce/apps/api/src/application/catalog/catalog.service.ts +168 -0
- package/templates/ecommerce/apps/api/src/application/checkout/checkout.service.ts +114 -0
- package/templates/ecommerce/apps/api/src/application/orders/order.service.ts +93 -0
- package/templates/ecommerce/apps/api/src/application/ports/email.port.ts +3 -0
- package/templates/ecommerce/apps/api/src/application/ports/payment.port.ts +24 -0
- package/templates/ecommerce/apps/api/src/application/ports/shipping.port.ts +9 -0
- package/templates/ecommerce/apps/api/src/application/ports/storage.port.ts +3 -0
- package/templates/ecommerce/apps/api/src/application/ports/token-blacklist.port.ts +4 -0
- package/templates/ecommerce/apps/api/src/application/ports/token.port.ts +18 -0
- package/templates/ecommerce/apps/api/src/application/profile/profile.service.ts +76 -0
- package/templates/ecommerce/apps/api/src/domain/auth/user.entity.ts +109 -0
- package/templates/ecommerce/apps/api/src/domain/auth/user.repository.ts +11 -0
- package/templates/ecommerce/apps/api/src/domain/cart/cart.entity.ts +136 -0
- package/templates/ecommerce/apps/api/src/domain/cart/cart.repository.ts +8 -0
- package/templates/ecommerce/apps/api/src/domain/cart/coupon.entity.ts +58 -0
- package/templates/ecommerce/apps/api/src/domain/cart/coupon.repository.ts +10 -0
- package/templates/ecommerce/apps/api/src/domain/catalog/category.entity.ts +51 -0
- package/templates/ecommerce/apps/api/src/domain/catalog/category.repository.ts +10 -0
- package/templates/ecommerce/apps/api/src/domain/catalog/product.entity.ts +130 -0
- package/templates/ecommerce/apps/api/src/domain/catalog/product.repository.ts +28 -0
- package/templates/ecommerce/apps/api/src/domain/checkout/order.entity.ts +121 -0
- package/templates/ecommerce/apps/api/src/domain/checkout/order.repository.ts +11 -0
- package/templates/ecommerce/apps/api/src/domain/shared/AppError.ts +12 -0
- package/templates/ecommerce/apps/api/src/infrastructure/cache/redis.ts +16 -0
- package/templates/ecommerce/apps/api/src/infrastructure/config/registry/admin.registry.ts +13 -0
- package/templates/ecommerce/apps/api/src/infrastructure/config/registry/auth.registry.ts +34 -0
- package/templates/ecommerce/apps/api/src/infrastructure/config/registry/cart.registry.ts +49 -0
- package/templates/ecommerce/apps/api/src/infrastructure/config/registry/catalog.registry.ts +24 -0
- package/templates/ecommerce/apps/api/src/infrastructure/config/registry/checkout.registry.ts +47 -0
- package/templates/ecommerce/apps/api/src/infrastructure/config/registry/orders.registry.ts +6 -0
- package/templates/ecommerce/apps/api/src/infrastructure/config/registry/profile.registry.ts +4 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/in-memory/cart.memory.repository.ts +33 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/in-memory/category.memory.repository.ts +41 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/in-memory/coupon.memory.repository.ts +55 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/in-memory/order.memory.repository.ts +75 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/in-memory/product.memory.repository.ts +100 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/in-memory/user.memory.repository.ts +54 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/prisma/auth/user.prisma.repository.ts +83 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/prisma/catalog/category.prisma.repository.ts +69 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/prisma/catalog/product.prisma.repository.ts +185 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/prisma/checkout/order.prisma.repository.ts +149 -0
- package/templates/ecommerce/apps/api/src/infrastructure/persistence/prisma-client.ts +17 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/email/email.registry.ts +18 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/email/ethereal.email.service.ts +38 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/email/noop.email.service.ts +12 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/email/smtp.email.service.ts +36 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/payment/stripe-webhook.handler.ts +83 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/payment/stripe.adapter.ts +39 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/shipping/mock.shipping.service.ts +17 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/storage/in-memory.storage.service.ts +11 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/storage/local-disk.storage.service.ts +27 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/storage/s3.storage.service.ts +52 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/storage/storage.registry.ts +19 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/token/redis.token.blacklist.ts +23 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/token/token.blacklist.ts +30 -0
- package/templates/ecommerce/apps/api/src/infrastructure/services/token/token.service.ts +136 -0
- package/templates/ecommerce/apps/api/src/modules/admin/__tests__/admin.routes.integration.test.ts +250 -0
- package/templates/ecommerce/apps/api/src/modules/admin/admin.controller.ts +116 -0
- package/templates/ecommerce/apps/api/src/modules/admin/admin.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/admin/admin.routes.ts +21 -0
- package/templates/ecommerce/apps/api/src/modules/admin/admin.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/admin/admin.user.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/auth/__tests__/auth.logout.redis.test.ts +104 -0
- package/templates/ecommerce/apps/api/src/modules/auth/__tests__/auth.routes.integration.test.ts +211 -0
- package/templates/ecommerce/apps/api/src/modules/auth/__tests__/auth.service.unit.test.ts +260 -0
- package/templates/ecommerce/apps/api/src/modules/auth/__tests__/email.service.unit.test.ts +94 -0
- package/templates/ecommerce/apps/api/src/modules/auth/__tests__/token.blacklist.redis.test.ts +65 -0
- package/templates/ecommerce/apps/api/src/modules/auth/__tests__/user.entity.unit.test.ts +79 -0
- package/templates/ecommerce/apps/api/src/modules/auth/__tests__/user.prisma.repository.test.ts +138 -0
- package/templates/ecommerce/apps/api/src/modules/auth/auth.controller.ts +148 -0
- package/templates/ecommerce/apps/api/src/modules/auth/auth.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/auth/auth.routes.ts +17 -0
- package/templates/ecommerce/apps/api/src/modules/auth/auth.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/auth/redis.token.blacklist.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/auth/token.blacklist.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/auth/token.service.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/auth/user.entity.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/auth/user.prisma.repository.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/auth/user.repository.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/cart/__tests__/cart.entity.unit.test.ts +144 -0
- package/templates/ecommerce/apps/api/src/modules/cart/__tests__/cart.routes.integration.test.ts +242 -0
- package/templates/ecommerce/apps/api/src/modules/cart/__tests__/cart.service.unit.test.ts +151 -0
- package/templates/ecommerce/apps/api/src/modules/cart/__tests__/coupon.admin.integration.test.ts +136 -0
- package/templates/ecommerce/apps/api/src/modules/cart/cart.controller.ts +94 -0
- package/templates/ecommerce/apps/api/src/modules/cart/cart.entity.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/cart/cart.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/cart/cart.repository.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/cart/cart.routes.ts +17 -0
- package/templates/ecommerce/apps/api/src/modules/cart/cart.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/cart/coupon.entity.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/cart/coupon.repository.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/cart/coupon.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/cart/shipping.service.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/__tests__/catalog.routes.integration.test.ts +275 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/__tests__/catalog.service.unit.test.ts +223 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/__tests__/product.image.integration.test.ts +130 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/__tests__/product.prisma.repository.test.ts +174 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/catalog.controller.ts +176 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/catalog.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/catalog.routes.ts +38 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/catalog.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/category.entity.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/category.prisma.repository.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/category.repository.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/product.entity.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/product.prisma.repository.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/catalog/product.repository.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/__tests__/checkout.routes.integration.test.ts +163 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/__tests__/checkout.service.unit.test.ts +191 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/__tests__/order.prisma.repository.test.ts +150 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/checkout.controller.ts +59 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/checkout.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/checkout.routes.ts +18 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/checkout.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/order.entity.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/order.prisma.repository.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/order.repository.ts +2 -0
- package/templates/ecommerce/apps/api/src/modules/checkout/tax.service.ts +9 -0
- package/templates/ecommerce/apps/api/src/modules/orders/__tests__/order.entity.unit.test.ts +68 -0
- package/templates/ecommerce/apps/api/src/modules/orders/__tests__/order.routes.integration.test.ts +254 -0
- package/templates/ecommerce/apps/api/src/modules/orders/__tests__/order.service.email.unit.test.ts +142 -0
- package/templates/ecommerce/apps/api/src/modules/orders/order.controller.ts +96 -0
- package/templates/ecommerce/apps/api/src/modules/orders/order.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/orders/order.routes.ts +17 -0
- package/templates/ecommerce/apps/api/src/modules/orders/order.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/payment/__tests__/stripe-webhook.unit.test.ts +330 -0
- package/templates/ecommerce/apps/api/src/modules/payment/__tests__/stripe.adapter.unit.test.ts +84 -0
- package/templates/ecommerce/apps/api/src/modules/payment/adapters/stripe.adapter.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/payment/payment.port.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/payment/stripe-webhook.handler.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/profile/__tests__/profile.routes.integration.test.ts +180 -0
- package/templates/ecommerce/apps/api/src/modules/profile/__tests__/profile.service.unit.test.ts +187 -0
- package/templates/ecommerce/apps/api/src/modules/profile/profile.controller.ts +92 -0
- package/templates/ecommerce/apps/api/src/modules/profile/profile.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/modules/profile/profile.routes.ts +14 -0
- package/templates/ecommerce/apps/api/src/modules/profile/profile.service.ts +1 -0
- package/templates/ecommerce/apps/api/src/presentation/middlewares/authenticate.ts +37 -0
- package/templates/ecommerce/apps/api/src/presentation/middlewares/authorize.ts +23 -0
- package/templates/ecommerce/apps/api/src/presentation/middlewares/errorHandler.ts +48 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/admin/admin.controller.ts +116 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/admin/admin.routes.ts +21 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/auth/auth.controller.ts +147 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/auth/auth.routes.ts +17 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/cart/cart.controller.ts +94 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/cart/cart.routes.ts +17 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/catalog/catalog.controller.ts +176 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/catalog/catalog.routes.ts +38 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/checkout/checkout.controller.ts +59 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/checkout/checkout.routes.ts +18 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/orders/order.controller.ts +96 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/orders/order.routes.ts +17 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/profile/profile.controller.ts +92 -0
- package/templates/ecommerce/apps/api/src/presentation/modules/profile/profile.routes.ts +14 -0
- package/templates/ecommerce/apps/api/src/presentation/validators/uuidParam.ts +20 -0
- package/templates/ecommerce/apps/api/src/server.ts +47 -0
- package/templates/ecommerce/apps/api/src/shared/__tests__/uuid.validation.test.ts +111 -0
- package/templates/ecommerce/apps/api/src/shared/errors/AppError.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/email/EtherealEmailService.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/email/IEmailService.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/email/NoopEmailService.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/email/SmtpEmailService.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/email/__tests__/ethereal.email.integration.test.ts +32 -0
- package/templates/ecommerce/apps/api/src/shared/infra/email/email.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/prisma.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/redis.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/storage/IStorageService.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/storage/InMemoryStorageService.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/storage/LocalDiskStorageService.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/storage/S3StorageService.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/infra/storage/__tests__/s3.storage.unit.test.ts +73 -0
- package/templates/ecommerce/apps/api/src/shared/infra/storage/storage.registry.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/middlewares/authenticate.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/middlewares/authorize.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/middlewares/errorHandler.ts +1 -0
- package/templates/ecommerce/apps/api/src/shared/validators/uuidParam.ts +1 -0
- package/templates/ecommerce/apps/api/tsconfig.json +15 -0
- package/templates/ecommerce/apps/web/.env.example +8 -0
- package/templates/ecommerce/apps/web/index.html +19 -0
- package/templates/ecommerce/apps/web/jest.config.ts +45 -0
- package/templates/ecommerce/apps/web/package.json +38 -0
- package/templates/ecommerce/apps/web/src/App.tsx +133 -0
- package/templates/ecommerce/apps/web/src/__mocks__/fileMock.ts +1 -0
- package/templates/ecommerce/apps/web/src/__mocks__/styleMock.ts +1 -0
- package/templates/ecommerce/apps/web/src/index.css +159 -0
- package/templates/ecommerce/apps/web/src/main.tsx +13 -0
- package/templates/ecommerce/apps/web/src/modules/admin/__tests__/CouponsAdminPage.test.tsx +134 -0
- package/templates/ecommerce/apps/web/src/modules/admin/__tests__/DashboardPage.test.tsx +65 -0
- package/templates/ecommerce/apps/web/src/modules/admin/__tests__/OrdersAdminPage.test.tsx +79 -0
- package/templates/ecommerce/apps/web/src/modules/admin/__tests__/ProductsAdminPage.test.tsx +84 -0
- package/templates/ecommerce/apps/web/src/modules/admin/__tests__/UsersAdminPage.test.tsx +85 -0
- package/templates/ecommerce/apps/web/src/modules/admin/pages/CouponsAdminPage.tsx +179 -0
- package/templates/ecommerce/apps/web/src/modules/admin/pages/DashboardPage.tsx +58 -0
- package/templates/ecommerce/apps/web/src/modules/admin/pages/OrdersAdminPage.tsx +178 -0
- package/templates/ecommerce/apps/web/src/modules/admin/pages/ProductsAdminPage.tsx +444 -0
- package/templates/ecommerce/apps/web/src/modules/admin/pages/UsersAdminPage.tsx +87 -0
- package/templates/ecommerce/apps/web/src/modules/auth/LoginForm.tsx +91 -0
- package/templates/ecommerce/apps/web/src/modules/auth/RegisterForm.tsx +109 -0
- package/templates/ecommerce/apps/web/src/modules/auth/__tests__/ForgotPasswordPage.test.tsx +42 -0
- package/templates/ecommerce/apps/web/src/modules/auth/__tests__/LoginForm.test.tsx +76 -0
- package/templates/ecommerce/apps/web/src/modules/auth/__tests__/RegisterForm.test.tsx +62 -0
- package/templates/ecommerce/apps/web/src/modules/auth/__tests__/ResetPasswordPage.test.tsx +66 -0
- package/templates/ecommerce/apps/web/src/modules/auth/pages/ForgotPasswordPage.tsx +100 -0
- package/templates/ecommerce/apps/web/src/modules/auth/pages/LoginPage.tsx +39 -0
- package/templates/ecommerce/apps/web/src/modules/auth/pages/RegisterPage.tsx +39 -0
- package/templates/ecommerce/apps/web/src/modules/auth/pages/ResetPasswordPage.tsx +110 -0
- package/templates/ecommerce/apps/web/src/modules/auth/useAuthStore.ts +141 -0
- package/templates/ecommerce/apps/web/src/modules/cart/__tests__/CartPage.test.tsx +111 -0
- package/templates/ecommerce/apps/web/src/modules/cart/pages/CartPage.tsx +313 -0
- package/templates/ecommerce/apps/web/src/modules/catalog/__tests__/ProductCard.test.tsx +59 -0
- package/templates/ecommerce/apps/web/src/modules/catalog/__tests__/ProductFilters.test.tsx +56 -0
- package/templates/ecommerce/apps/web/src/modules/catalog/components/ProductCard.tsx +78 -0
- package/templates/ecommerce/apps/web/src/modules/catalog/components/ProductFilters.tsx +104 -0
- package/templates/ecommerce/apps/web/src/modules/catalog/pages/ProductDetailPage.tsx +179 -0
- package/templates/ecommerce/apps/web/src/modules/catalog/pages/ProductListPage.tsx +100 -0
- package/templates/ecommerce/apps/web/src/modules/checkout/__tests__/CheckoutPage.test.tsx +159 -0
- package/templates/ecommerce/apps/web/src/modules/checkout/__tests__/StripePaymentForm.test.tsx +79 -0
- package/templates/ecommerce/apps/web/src/modules/checkout/components/StripePaymentForm.tsx +55 -0
- package/templates/ecommerce/apps/web/src/modules/checkout/hooks/useCheckout.ts +56 -0
- package/templates/ecommerce/apps/web/src/modules/checkout/pages/CheckoutPage.tsx +344 -0
- package/templates/ecommerce/apps/web/src/modules/checkout/pages/CheckoutSuccessPage.tsx +12 -0
- package/templates/ecommerce/apps/web/src/modules/legal/pages/PrivacyPolicyPage.tsx +207 -0
- package/templates/ecommerce/apps/web/src/modules/legal/pages/TermsOfServicePage.tsx +175 -0
- package/templates/ecommerce/apps/web/src/modules/orders/__tests__/OrderDetailPage.test.tsx +75 -0
- package/templates/ecommerce/apps/web/src/modules/orders/__tests__/OrderHistoryPage.test.tsx +87 -0
- package/templates/ecommerce/apps/web/src/modules/orders/pages/OrderDetailPage.tsx +73 -0
- package/templates/ecommerce/apps/web/src/modules/orders/pages/OrderHistoryPage.tsx +97 -0
- package/templates/ecommerce/apps/web/src/modules/profile/__tests__/ProfilePage.test.tsx +150 -0
- package/templates/ecommerce/apps/web/src/modules/profile/pages/ProfilePage.tsx +275 -0
- package/templates/ecommerce/apps/web/src/setupTests.ts +10 -0
- package/templates/ecommerce/apps/web/src/shared/components/CookieConsent.tsx +108 -0
- package/templates/ecommerce/apps/web/src/shared/components/ErrorBoundary.tsx +112 -0
- package/templates/ecommerce/apps/web/src/shared/components/Layout.tsx +143 -0
- package/templates/ecommerce/apps/web/src/shared/components/ProtectedRoute.tsx +21 -0
- package/templates/ecommerce/apps/web/src/shared/config/siteConfig.ts +57 -0
- package/templates/ecommerce/apps/web/src/shared/hooks/usePageTitle.ts +16 -0
- package/templates/ecommerce/apps/web/src/shared/lib/apiFetch.ts +16 -0
- package/templates/ecommerce/apps/web/src/shared/pages/NotFoundPage.tsx +42 -0
- package/templates/ecommerce/apps/web/src/shared/theme/ThemeProvider.tsx +45 -0
- package/templates/ecommerce/apps/web/src/shared/theme/__tests__/ThemeProvider.test.tsx +78 -0
- package/templates/ecommerce/apps/web/src/shared/theme/createTheme.ts +58 -0
- package/templates/ecommerce/apps/web/src/shared/theme/tokens.ts +81 -0
- package/templates/ecommerce/apps/web/src/vite-env.d.ts +1 -0
- package/templates/ecommerce/apps/web/tsconfig.jest.json +12 -0
- package/templates/ecommerce/apps/web/tsconfig.json +25 -0
- package/templates/ecommerce/apps/web/tsconfig.node.json +11 -0
- package/templates/ecommerce/apps/web/vite.config.ts +30 -0
- package/templates/ecommerce/docker-compose.yml +85 -0
- package/templates/ecommerce/package-lock.json +11255 -0
- package/templates/ecommerce/package.json +27 -0
- package/templates/ecommerce/packages/shared-types/package.json +13 -0
- package/templates/ecommerce/packages/shared-types/src/index.ts +3 -0
- package/templates/ecommerce/packages/shared-types/src/theme.ts +44 -0
- package/templates/ecommerce/packages/shared-types/tsconfig.json +11 -0
- package/templates/ecommerce/scripts/customize.sh +201 -0
- package/templates/ecommerce/tsconfig.json +14 -0
- package/templates/java-spring/clean/.gitignore.hbs +72 -0
- package/templates/java-spring/clean/docker-compose.yml.hbs +6 -3
- package/templates/java-spring/clean/src/main/java/{{packagePath}}/application/usecase/PaymentUseCase.java.hbs +21 -17
- package/templates/java-spring/clean/src/main/java/{{packagePath}}/infrastructure/persistence/entity/UserEntity.java.hbs +52 -0
- package/templates/java-spring/clean/src/main/java/{{packagePath}}/infrastructure/persistence/repository/JpaUserRepository.java.hbs +12 -0
- package/templates/java-spring/clean/src/main/java/{{packagePath}}/infrastructure/security/JwtAuthenticationFilter.java.hbs +64 -0
- package/templates/java-spring/clean/src/main/java/{{packagePath}}/infrastructure/security/SecurityConfig.java.hbs +36 -0
- package/templates/java-spring/clean/src/main/java/{{packagePath}}/infrastructure/stripe/StripeGateway.java.hbs +63 -0
- package/templates/java-spring/clean/src/main/resources/application.properties.hbs +6 -7
- package/templates/java-spring/hexagonal/.gitignore.hbs +72 -0
- package/templates/java-spring/hexagonal/docker-compose.yml.hbs +6 -3
- package/templates/java-spring/hexagonal/src/main/java/{{packagePath}}/adapters/outbound/security/JwtFilter.java.hbs +71 -0
- package/templates/java-spring/hexagonal/src/main/java/{{packagePath}}/adapters/outbound/security/SecurityConfig.java.hbs +35 -0
- package/templates/java-spring/hexagonal/src/main/java/{{packagePath}}/core/service/PaymentService.java.hbs +3 -3
- package/templates/java-spring/hexagonal/src/main/resources/application.properties.hbs +4 -4
- package/templates/java-spring/mvc/.gitignore.hbs +72 -0
- package/templates/java-spring/mvc/docker-compose.yml.hbs +6 -3
- package/templates/java-spring/mvc/src/main/java/{{packagePath}}/config/SecurityConfig.java.hbs +13 -12
- package/templates/java-spring/mvc/src/main/java/{{packagePath}}/controller/AuthController.java.hbs +9 -8
- package/templates/java-spring/mvc/src/main/java/{{packagePath}}/controller/PaymentsController.java.hbs +5 -6
- package/templates/java-spring/mvc/src/main/java/{{packagePath}}/service/StripeService.java.hbs +3 -3
- package/templates/java-spring/mvc/src/main/resources/application.yml.hbs +29 -26
- package/templates/nestjs/clean/.gitignore.hbs +42 -0
- package/templates/nestjs/clean/Dockerfile.hbs +6 -3
- package/templates/nestjs/clean/docker-compose.yml.hbs +1 -11
- package/templates/nestjs/clean/src/app.module.ts.hbs +2 -1
- package/templates/nestjs/clean/src/application/payment.service.ts.hbs +72 -72
- package/templates/nestjs/clean/src/domain/entities/user.entity.ts.hbs +2 -2
- package/templates/nestjs/clean/src/domain/repositories/user.repository.ts.hbs +2 -2
- package/templates/nestjs/clean/src/infrastructure/database/repositories/prisma.user.repository.ts.hbs +18 -18
- package/templates/nestjs/clean/src/infrastructure/http/health.controller.ts.hbs +9 -0
- package/templates/nestjs/clean/src/main.ts.hbs +1 -4
- package/templates/nestjs/clean/src/payment.module.ts.hbs +12 -12
- package/templates/nestjs/hexagonal/.gitignore.hbs +42 -0
- package/templates/nestjs/hexagonal/Dockerfile.hbs +6 -3
- package/templates/nestjs/hexagonal/docker-compose.yml.hbs +1 -11
- package/templates/nestjs/hexagonal/src/adapters/inbound/health.controller.ts.hbs +9 -0
- package/templates/nestjs/hexagonal/src/app.module.ts.hbs +2 -1
- package/templates/nestjs/hexagonal/src/core/domain/user.entity.ts.hbs +6 -6
- package/templates/nestjs/hexagonal/src/core/ports/ports.ts.hbs +4 -4
- package/templates/nestjs/hexagonal/src/main.ts.hbs +1 -4
- package/templates/nestjs/mvc/.gitignore.hbs +42 -0
- package/templates/nestjs/mvc/Dockerfile.hbs +6 -3
- package/templates/nestjs/mvc/docker-compose.yml.hbs +1 -11
- package/templates/nestjs/mvc/src/auth/auth.controller.ts.hbs +11 -1
- package/templates/nestjs/mvc/src/auth/auth.service.ts.hbs +3 -1
- package/templates/nestjs/mvc/src/controllers/health.controller.ts.hbs +6 -6
- package/templates/nestjs/mvc/src/main.ts.hbs +1 -4
- package/templates/nestjs/mvc/src/models/create-item.dto.ts.hbs +5 -2
- package/templates/nestjs/mvc/src/prisma/prisma.service.ts.hbs +1 -0
- package/templates/nextjs/mvc/.gitignore.hbs +42 -0
- package/templates/nextjs/mvc/Dockerfile.hbs +23 -8
- package/templates/nextjs/mvc/docker-compose.yml.hbs +1 -1
- package/templates/nodejs-express/clean/.gitignore.hbs +42 -0
- package/templates/nodejs-express/clean/Dockerfile.hbs +6 -1
- package/templates/nodejs-express/clean/docker-compose.yml.hbs +2 -2
- package/templates/nodejs-express/clean/package.json.hbs +69 -69
- package/templates/nodejs-express/clean/src/config.ts.hbs +11 -0
- package/templates/nodejs-express/clean/src/domain/entities/User.ts.hbs +46 -8
- package/templates/nodejs-express/hexagonal/.gitignore.hbs +42 -0
- package/templates/nodejs-express/hexagonal/Dockerfile.hbs +1 -1
- package/templates/nodejs-express/hexagonal/docker-compose.yml.hbs +2 -2
- package/templates/nodejs-express/hexagonal/package.json.hbs +69 -69
- package/templates/nodejs-express/hexagonal/src/adapters/inbound/http/PaymentController.ts.hbs +21 -38
- package/templates/nodejs-express/hexagonal/src/adapters/outbound/persistence/prisma.ts.hbs +2 -0
- package/templates/nodejs-express/hexagonal/src/config.ts.hbs +9 -0
- package/templates/nodejs-express/hexagonal/src/core/AuthService.ts.hbs +5 -5
- package/templates/nodejs-express/hexagonal/src/core/PaymentService.ts.hbs +7 -22
- package/templates/nodejs-express/hexagonal/src/core/domain/entities/User.ts.hbs +24 -4
- package/templates/nodejs-express/mvc/.gitignore.hbs +42 -0
- package/templates/nodejs-express/mvc/package.json.hbs +67 -67
- package/templates/python-fastapi/clean/.gitignore.hbs +76 -0
- package/templates/python-fastapi/clean/app/application/services/payment_service.py.hbs +3 -3
- package/templates/python-fastapi/clean/app/config.py.hbs +6 -7
- package/templates/python-fastapi/clean/app/domain/usecases/login_user.py.hbs +15 -0
- package/templates/python-fastapi/clean/app/infrastructure/http/auth_controller.py.hbs +40 -6
- package/templates/python-fastapi/clean/app/infrastructure/http/payment_controller.py.hbs +5 -4
- package/templates/python-fastapi/clean/app/infrastructure/security/jwt.py.hbs +23 -0
- package/templates/python-fastapi/clean/app/main.py.hbs +3 -0
- package/templates/python-fastapi/clean/docker-compose.yml.hbs +5 -12
- package/templates/python-fastapi/clean/requirements.txt.hbs +3 -0
- package/templates/python-fastapi/hexagonal/.gitignore.hbs +76 -0
- package/templates/python-fastapi/hexagonal/app/adapters/inbound/http_adapter.py.hbs +6 -9
- package/templates/python-fastapi/hexagonal/app/adapters/inbound/payment_http_adapter.py.hbs +4 -3
- package/templates/python-fastapi/hexagonal/app/adapters/outbound/stripe_adapter.py.hbs +30 -19
- package/templates/python-fastapi/hexagonal/app/config.py.hbs +14 -4
- package/templates/python-fastapi/hexagonal/app/core/domain/user.py.hbs +3 -1
- package/templates/python-fastapi/hexagonal/app/core/payment_service.py.hbs +28 -18
- package/templates/python-fastapi/hexagonal/app/core/ports/__init__.py.hbs +3 -0
- package/templates/python-fastapi/hexagonal/app/core/ports/user_repository.py.hbs +15 -0
- package/templates/python-fastapi/hexagonal/app/infrastructure/database/session.py.hbs +7 -0
- package/templates/python-fastapi/hexagonal/app/infrastructure/database/user_repository.py.hbs +53 -0
- package/templates/python-fastapi/hexagonal/app/infrastructure/security/__init__.py.hbs +0 -0
- package/templates/python-fastapi/hexagonal/app/infrastructure/security/adapters.py.hbs +23 -0
- package/templates/python-fastapi/hexagonal/app/infrastructure/security/jwt.py.hbs +23 -0
- package/templates/python-fastapi/hexagonal/docker-compose.yml.hbs +5 -12
- package/templates/python-fastapi/hexagonal/requirements.txt.hbs +4 -0
- package/templates/python-fastapi/mvc/.gitignore.hbs +76 -0
- package/templates/python-fastapi/mvc/app/controllers/payments.py.hbs +3 -17
- package/templates/python-fastapi/mvc/app/middleware/security.py.hbs +24 -3
- package/templates/python-fastapi/mvc/app/schemas/item.py.hbs +3 -1
- package/templates/python-fastapi/mvc/docker-compose.yml.hbs +5 -12
- package/templates/python-fastapi/mvc/requirements.txt.hbs +3 -1
- package/templates/nodejs-express/hexagonal/src/adapters/outbound/persistence/prisma.ts +0 -5
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { apiFetch } from '../../../shared/lib/apiFetch';
|
|
4
|
+
import { usePageTitle } from '../../../shared/hooks/usePageTitle';
|
|
5
|
+
|
|
6
|
+
interface OrderSummary {
|
|
7
|
+
id: string;
|
|
8
|
+
status: string;
|
|
9
|
+
total: number;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
items: Array<{ name: string; qty: number }>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface OrdersResponse {
|
|
15
|
+
items: OrderSummary[];
|
|
16
|
+
nextCursor: string | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function OrderHistoryPage() {
|
|
20
|
+
usePageTitle('Meus Pedidos');
|
|
21
|
+
const [orders, setOrders] = useState<OrderSummary[]>([]);
|
|
22
|
+
const [loading, setLoading] = useState(true);
|
|
23
|
+
const [error, setError] = useState<string | null>(null);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
apiFetch<OrdersResponse>('/api/orders')
|
|
27
|
+
.then((data) => {
|
|
28
|
+
setOrders(data.items);
|
|
29
|
+
setLoading(false);
|
|
30
|
+
})
|
|
31
|
+
.catch(() => {
|
|
32
|
+
setError('Erro ao carregar pedidos');
|
|
33
|
+
setLoading(false);
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
const statusColor: Record<string, string> = {
|
|
38
|
+
PENDING: '#f59e0b', CONFIRMED: '#3b82f6', PROCESSING: '#8b5cf6',
|
|
39
|
+
SHIPPED: '#06b6d4', DELIVERED: '#10b981', CANCELLED: '#ef4444',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (loading) return <p style={{ marginTop: '2rem', color: '#6b7280' }}>Carregando...</p>;
|
|
43
|
+
if (error) return <p role="alert" style={{ color: '#ef4444' }}>{error}</p>;
|
|
44
|
+
if (orders.length === 0) return (
|
|
45
|
+
<main style={{ textAlign: 'center', padding: '4rem 2rem' }}>
|
|
46
|
+
<p style={{ color: '#6b7280', fontSize: '1rem', marginBottom: '1.25rem' }}>
|
|
47
|
+
Você ainda não fez nenhum pedido.
|
|
48
|
+
</p>
|
|
49
|
+
<Link
|
|
50
|
+
to="/"
|
|
51
|
+
style={{
|
|
52
|
+
display: 'inline-block',
|
|
53
|
+
background: 'var(--color-primary)',
|
|
54
|
+
color: '#fff',
|
|
55
|
+
textDecoration: 'none',
|
|
56
|
+
padding: '0.6rem 1.5rem',
|
|
57
|
+
borderRadius: '6px',
|
|
58
|
+
fontWeight: 600,
|
|
59
|
+
fontSize: '0.9rem',
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
Ver produtos →
|
|
63
|
+
</Link>
|
|
64
|
+
</main>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<main>
|
|
69
|
+
<h1 style={{ marginBottom: '1.5rem' }}>Meus Pedidos</h1>
|
|
70
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.75rem' }}>
|
|
71
|
+
{orders.map((order) => (
|
|
72
|
+
<Link
|
|
73
|
+
key={order.id}
|
|
74
|
+
to={`/orders/${order.id}`}
|
|
75
|
+
style={{ textDecoration: 'none', color: 'inherit' }}
|
|
76
|
+
>
|
|
77
|
+
<div style={{ background: '#fff', border: '1px solid #e5e7eb', borderRadius: '0.75rem', padding: '1rem 1.25rem', display: 'flex', justifyContent: 'space-between', alignItems: 'center', transition: 'box-shadow 0.15s' }}
|
|
78
|
+
onMouseEnter={(e) => { (e.currentTarget as HTMLDivElement).style.boxShadow = '0 4px 12px rgba(0,0,0,0.08)'; }}
|
|
79
|
+
onMouseLeave={(e) => { (e.currentTarget as HTMLDivElement).style.boxShadow = 'none'; }}
|
|
80
|
+
>
|
|
81
|
+
<div>
|
|
82
|
+
<p style={{ fontWeight: 600, fontSize: '0.9rem', marginBottom: '0.25rem' }}>Pedido #{order.id}</p>
|
|
83
|
+
<p style={{ fontSize: '0.8rem', color: '#6b7280' }}>{order.items.map((i) => `${i.name} x${i.qty}`).join(', ')}</p>
|
|
84
|
+
</div>
|
|
85
|
+
<div style={{ textAlign: 'right' }}>
|
|
86
|
+
<p style={{ fontWeight: 700, color: '#6366f1', marginBottom: '0.25rem' }}>R$ {order.total.toFixed(2).replace('.', ',')}</p>
|
|
87
|
+
<span style={{ fontSize: '0.75rem', fontWeight: 600, padding: '0.2rem 0.55rem', borderRadius: '9999px', background: `${statusColor[order.status] ?? '#6b7280'}20`, color: statusColor[order.status] ?? '#6b7280' }}>
|
|
88
|
+
{order.status}
|
|
89
|
+
</span>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</Link>
|
|
93
|
+
))}
|
|
94
|
+
</div>
|
|
95
|
+
</main>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
4
|
+
import { ProfilePage } from '../pages/ProfilePage';
|
|
5
|
+
import { useAuthStore } from '../../auth/useAuthStore';
|
|
6
|
+
|
|
7
|
+
const mockFetch = jest.fn();
|
|
8
|
+
beforeAll(() => {
|
|
9
|
+
global.fetch = mockFetch;
|
|
10
|
+
});
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
mockFetch.mockClear();
|
|
13
|
+
useAuthStore.setState({
|
|
14
|
+
accessToken: 'test-token',
|
|
15
|
+
user: { id: 'user-1', name: 'Test User', email: 'test@email.com', role: 'CUSTOMER' },
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
afterAll(() => useAuthStore.setState({ accessToken: null, user: null }));
|
|
19
|
+
|
|
20
|
+
function renderPage() {
|
|
21
|
+
return render(
|
|
22
|
+
<MemoryRouter>
|
|
23
|
+
<ProfilePage />
|
|
24
|
+
</MemoryRouter>,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('ProfilePage', () => {
|
|
29
|
+
// ── Rendering ─────────────────────────────────────────────────────────────
|
|
30
|
+
it('renderiza campos com os dados do usuário preenchidos', () => {
|
|
31
|
+
renderPage();
|
|
32
|
+
|
|
33
|
+
expect(screen.getByLabelText(/nome/i)).toHaveValue('Test User');
|
|
34
|
+
expect(screen.getByLabelText(/^email$/i)).toHaveValue('test@email.com');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('exibe a seção de zona de perigo', () => {
|
|
38
|
+
renderPage();
|
|
39
|
+
expect(screen.getByText(/zona de perigo/i)).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// ── Update profile ────────────────────────────────────────────────────────
|
|
43
|
+
it('atualiza dados pessoais com sucesso', async () => {
|
|
44
|
+
mockFetch.mockResolvedValueOnce({
|
|
45
|
+
ok: true,
|
|
46
|
+
json: async () => ({
|
|
47
|
+
id: 'user-1',
|
|
48
|
+
name: 'Novo Nome',
|
|
49
|
+
email: 'test@email.com',
|
|
50
|
+
role: 'CUSTOMER',
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
renderPage();
|
|
55
|
+
|
|
56
|
+
const nameInput = screen.getByLabelText(/nome/i);
|
|
57
|
+
await userEvent.clear(nameInput);
|
|
58
|
+
await userEvent.type(nameInput, 'Novo Nome');
|
|
59
|
+
await userEvent.click(screen.getByRole('button', { name: /salvar/i }));
|
|
60
|
+
|
|
61
|
+
await waitFor(() =>
|
|
62
|
+
expect(screen.getByRole('alert')).toHaveTextContent(/sucesso/i),
|
|
63
|
+
);
|
|
64
|
+
expect(mockFetch).toHaveBeenCalledWith('/api/me', expect.objectContaining({ method: 'PATCH' }));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('exibe mensagem de erro quando atualização falha', async () => {
|
|
68
|
+
mockFetch.mockResolvedValueOnce({
|
|
69
|
+
ok: false,
|
|
70
|
+
status: 409,
|
|
71
|
+
json: async () => ({ message: 'Email já está em uso' }),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
renderPage();
|
|
75
|
+
|
|
76
|
+
await userEvent.click(screen.getByRole('button', { name: /salvar/i }));
|
|
77
|
+
|
|
78
|
+
await waitFor(() =>
|
|
79
|
+
expect(screen.getByRole('alert')).toBeInTheDocument(),
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// ── Change password ───────────────────────────────────────────────────────
|
|
84
|
+
it('troca a senha com sucesso', async () => {
|
|
85
|
+
mockFetch.mockResolvedValueOnce({ ok: true });
|
|
86
|
+
|
|
87
|
+
renderPage();
|
|
88
|
+
|
|
89
|
+
await userEvent.type(screen.getByLabelText(/senha atual/i), 'senha1234');
|
|
90
|
+
await userEvent.type(screen.getByLabelText(/^nova senha$/i), 'novasenha5678');
|
|
91
|
+
await userEvent.type(screen.getByLabelText(/confirmar nova senha/i), 'novasenha5678');
|
|
92
|
+
await userEvent.click(screen.getByRole('button', { name: /alterar senha/i }));
|
|
93
|
+
|
|
94
|
+
await waitFor(() =>
|
|
95
|
+
expect(screen.getByText(/sucesso/i)).toBeInTheDocument(),
|
|
96
|
+
);
|
|
97
|
+
expect(mockFetch).toHaveBeenCalledWith('/api/me/password', expect.objectContaining({ method: 'PATCH' }));
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('exibe erro quando senhas novas não coincidem', async () => {
|
|
101
|
+
renderPage();
|
|
102
|
+
|
|
103
|
+
await userEvent.type(screen.getByLabelText(/senha atual/i), 'senha1234');
|
|
104
|
+
await userEvent.type(screen.getByLabelText(/^nova senha$/i), 'novasenha5678');
|
|
105
|
+
await userEvent.type(screen.getByLabelText(/confirmar nova senha/i), 'outrasenha');
|
|
106
|
+
await userEvent.click(screen.getByRole('button', { name: /alterar senha/i }));
|
|
107
|
+
|
|
108
|
+
await waitFor(() =>
|
|
109
|
+
expect(screen.getByText(/não coincidem/i)).toBeInTheDocument(),
|
|
110
|
+
);
|
|
111
|
+
expect(mockFetch).not.toHaveBeenCalled();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// ── Delete account ────────────────────────────────────────────────────────
|
|
115
|
+
it('abre o modal de confirmação ao clicar em excluir minha conta', async () => {
|
|
116
|
+
renderPage();
|
|
117
|
+
|
|
118
|
+
await userEvent.click(screen.getByRole('button', { name: /excluir minha conta/i }));
|
|
119
|
+
|
|
120
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
121
|
+
expect(screen.getByLabelText(/senha para confirmar exclusão/i)).toBeInTheDocument();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('fecha o modal ao clicar em cancelar', async () => {
|
|
125
|
+
renderPage();
|
|
126
|
+
|
|
127
|
+
await userEvent.click(screen.getByRole('button', { name: /excluir minha conta/i }));
|
|
128
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
129
|
+
|
|
130
|
+
await userEvent.click(screen.getByRole('button', { name: /cancelar/i }));
|
|
131
|
+
|
|
132
|
+
await waitFor(() =>
|
|
133
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument(),
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('exclui a conta com a senha correta e redireciona', async () => {
|
|
138
|
+
mockFetch.mockResolvedValueOnce({ ok: true });
|
|
139
|
+
|
|
140
|
+
renderPage();
|
|
141
|
+
|
|
142
|
+
await userEvent.click(screen.getByRole('button', { name: /excluir minha conta/i }));
|
|
143
|
+
await userEvent.type(screen.getByLabelText(/senha para confirmar exclusão/i), 'senha1234');
|
|
144
|
+
await userEvent.click(screen.getByRole('button', { name: /^excluir conta$/i }));
|
|
145
|
+
|
|
146
|
+
await waitFor(() =>
|
|
147
|
+
expect(mockFetch).toHaveBeenCalledWith('/api/me', expect.objectContaining({ method: 'DELETE' })),
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { useAuthStore } from '../../auth/useAuthStore';
|
|
4
|
+
import { usePageTitle } from '../../../shared/hooks/usePageTitle';
|
|
5
|
+
|
|
6
|
+
const fieldStyle: React.CSSProperties = {
|
|
7
|
+
display: 'block',
|
|
8
|
+
width: '100%',
|
|
9
|
+
padding: '0.5rem 0.75rem',
|
|
10
|
+
border: '1px solid #d1d5db',
|
|
11
|
+
borderRadius: '6px',
|
|
12
|
+
fontSize: '0.95rem',
|
|
13
|
+
fontFamily: 'var(--font-family)',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const btnPrimary: React.CSSProperties = {
|
|
18
|
+
background: 'var(--color-primary)',
|
|
19
|
+
color: '#fff',
|
|
20
|
+
border: 'none',
|
|
21
|
+
borderRadius: '6px',
|
|
22
|
+
padding: '0.55rem 1.25rem',
|
|
23
|
+
fontSize: '0.9rem',
|
|
24
|
+
cursor: 'pointer',
|
|
25
|
+
fontFamily: 'var(--font-family)',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const btnDanger: React.CSSProperties = {
|
|
29
|
+
...btnPrimary,
|
|
30
|
+
background: '#ef4444',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const card: React.CSSProperties = {
|
|
34
|
+
background: '#fff',
|
|
35
|
+
border: '1px solid #e5e7eb',
|
|
36
|
+
borderRadius: '8px',
|
|
37
|
+
padding: '1.5rem',
|
|
38
|
+
marginBottom: '1.5rem',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export function ProfilePage() {
|
|
42
|
+
usePageTitle('Meu Perfil');
|
|
43
|
+
const { user, updateProfile, changePassword, deleteAccount } = useAuthStore();
|
|
44
|
+
const navigate = useNavigate();
|
|
45
|
+
|
|
46
|
+
// ── Personal data section ────────────────────────────────────────────────
|
|
47
|
+
const [name, setName] = useState(user?.name ?? '');
|
|
48
|
+
const [email, setEmail] = useState(user?.email ?? '');
|
|
49
|
+
const [profileMsg, setProfileMsg] = useState<{ text: string; ok: boolean } | null>(null);
|
|
50
|
+
const [profileLoading, setProfileLoading] = useState(false);
|
|
51
|
+
|
|
52
|
+
async function handleUpdateProfile(e: React.FormEvent) {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
setProfileMsg(null);
|
|
55
|
+
setProfileLoading(true);
|
|
56
|
+
try {
|
|
57
|
+
await updateProfile({ name: name.trim() || undefined, email: email.trim() || undefined });
|
|
58
|
+
setProfileMsg({ text: 'Dados atualizados com sucesso!', ok: true });
|
|
59
|
+
} catch (err) {
|
|
60
|
+
setProfileMsg({ text: err instanceof Error ? err.message : 'Erro ao atualizar', ok: false });
|
|
61
|
+
} finally {
|
|
62
|
+
setProfileLoading(false);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ── Change password section ───────────────────────────────────────────────
|
|
67
|
+
const [currentPwd, setCurrentPwd] = useState('');
|
|
68
|
+
const [newPwd, setNewPwd] = useState('');
|
|
69
|
+
const [confirmPwd, setConfirmPwd] = useState('');
|
|
70
|
+
const [pwdMsg, setPwdMsg] = useState<{ text: string; ok: boolean } | null>(null);
|
|
71
|
+
const [pwdLoading, setPwdLoading] = useState(false);
|
|
72
|
+
|
|
73
|
+
async function handleChangePassword(e: React.FormEvent) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
setPwdMsg(null);
|
|
76
|
+
if (newPwd !== confirmPwd) {
|
|
77
|
+
setPwdMsg({ text: 'As senhas não coincidem', ok: false });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
setPwdLoading(true);
|
|
81
|
+
try {
|
|
82
|
+
await changePassword({ currentPassword: currentPwd, newPassword: newPwd });
|
|
83
|
+
setPwdMsg({ text: 'Senha alterada com sucesso!', ok: true });
|
|
84
|
+
setCurrentPwd('');
|
|
85
|
+
setNewPwd('');
|
|
86
|
+
setConfirmPwd('');
|
|
87
|
+
} catch (err) {
|
|
88
|
+
setPwdMsg({ text: err instanceof Error ? err.message : 'Erro ao trocar senha', ok: false });
|
|
89
|
+
} finally {
|
|
90
|
+
setPwdLoading(false);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ── Delete account section ────────────────────────────────────────────────
|
|
95
|
+
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
|
96
|
+
const [deletePwd, setDeletePwd] = useState('');
|
|
97
|
+
const [deleteMsg, setDeleteMsg] = useState<string | null>(null);
|
|
98
|
+
const [deleteLoading, setDeleteLoading] = useState(false);
|
|
99
|
+
|
|
100
|
+
async function handleDeleteAccount() {
|
|
101
|
+
setDeleteMsg(null);
|
|
102
|
+
setDeleteLoading(true);
|
|
103
|
+
try {
|
|
104
|
+
await deleteAccount(deletePwd);
|
|
105
|
+
navigate('/');
|
|
106
|
+
} catch (err) {
|
|
107
|
+
setDeleteMsg(err instanceof Error ? err.message : 'Erro ao excluir conta');
|
|
108
|
+
setDeleteLoading(false);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<main style={{ maxWidth: '640px', margin: '2rem auto', padding: '0 1rem' }}>
|
|
114
|
+
<h1 style={{ fontSize: '1.5rem', fontWeight: 700, marginBottom: '1.5rem' }}>Meu Perfil</h1>
|
|
115
|
+
|
|
116
|
+
{/* ── Dados pessoais ────────────────────────────────────────────────── */}
|
|
117
|
+
<section style={card}>
|
|
118
|
+
<h2 style={{ fontSize: '1.1rem', fontWeight: 600, marginTop: 0, marginBottom: '1rem' }}>
|
|
119
|
+
Dados Pessoais
|
|
120
|
+
</h2>
|
|
121
|
+
<form onSubmit={(e) => { void handleUpdateProfile(e); }}>
|
|
122
|
+
<label style={{ display: 'block', marginBottom: '1rem' }}>
|
|
123
|
+
<span style={{ display: 'block', fontSize: '0.85rem', fontWeight: 500, marginBottom: '0.35rem' }}>
|
|
124
|
+
Nome
|
|
125
|
+
</span>
|
|
126
|
+
<input
|
|
127
|
+
type="text"
|
|
128
|
+
value={name}
|
|
129
|
+
onChange={(e) => setName(e.target.value)}
|
|
130
|
+
style={fieldStyle}
|
|
131
|
+
aria-label="Nome"
|
|
132
|
+
/>
|
|
133
|
+
</label>
|
|
134
|
+
<label style={{ display: 'block', marginBottom: '1rem' }}>
|
|
135
|
+
<span style={{ display: 'block', fontSize: '0.85rem', fontWeight: 500, marginBottom: '0.35rem' }}>
|
|
136
|
+
Email
|
|
137
|
+
</span>
|
|
138
|
+
<input
|
|
139
|
+
type="email"
|
|
140
|
+
value={email}
|
|
141
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
142
|
+
style={fieldStyle}
|
|
143
|
+
aria-label="Email"
|
|
144
|
+
/>
|
|
145
|
+
</label>
|
|
146
|
+
{profileMsg && (
|
|
147
|
+
<p role="alert" style={{ color: profileMsg.ok ? '#10b981' : '#ef4444', fontSize: '0.875rem', marginBottom: '0.75rem' }}>
|
|
148
|
+
{profileMsg.text}
|
|
149
|
+
</p>
|
|
150
|
+
)}
|
|
151
|
+
<button type="submit" style={btnPrimary} disabled={profileLoading}>
|
|
152
|
+
{profileLoading ? 'Salvando...' : 'Salvar alterações'}
|
|
153
|
+
</button>
|
|
154
|
+
</form>
|
|
155
|
+
</section>
|
|
156
|
+
|
|
157
|
+
{/* ── Trocar senha ─────────────────────────────────────────────────── */}
|
|
158
|
+
<section style={card}>
|
|
159
|
+
<h2 style={{ fontSize: '1.1rem', fontWeight: 600, marginTop: 0, marginBottom: '1rem' }}>
|
|
160
|
+
Trocar Senha
|
|
161
|
+
</h2>
|
|
162
|
+
<form onSubmit={(e) => { void handleChangePassword(e); }}>
|
|
163
|
+
<label style={{ display: 'block', marginBottom: '1rem' }}>
|
|
164
|
+
<span style={{ display: 'block', fontSize: '0.85rem', fontWeight: 500, marginBottom: '0.35rem' }}>
|
|
165
|
+
Senha atual
|
|
166
|
+
</span>
|
|
167
|
+
<input
|
|
168
|
+
type="password"
|
|
169
|
+
value={currentPwd}
|
|
170
|
+
onChange={(e) => setCurrentPwd(e.target.value)}
|
|
171
|
+
style={fieldStyle}
|
|
172
|
+
aria-label="Senha atual"
|
|
173
|
+
/>
|
|
174
|
+
</label>
|
|
175
|
+
<label style={{ display: 'block', marginBottom: '1rem' }}>
|
|
176
|
+
<span style={{ display: 'block', fontSize: '0.85rem', fontWeight: 500, marginBottom: '0.35rem' }}>
|
|
177
|
+
Nova senha
|
|
178
|
+
</span>
|
|
179
|
+
<input
|
|
180
|
+
type="password"
|
|
181
|
+
value={newPwd}
|
|
182
|
+
onChange={(e) => setNewPwd(e.target.value)}
|
|
183
|
+
style={fieldStyle}
|
|
184
|
+
aria-label="Nova senha"
|
|
185
|
+
/>
|
|
186
|
+
</label>
|
|
187
|
+
<label style={{ display: 'block', marginBottom: '1rem' }}>
|
|
188
|
+
<span style={{ display: 'block', fontSize: '0.85rem', fontWeight: 500, marginBottom: '0.35rem' }}>
|
|
189
|
+
Confirmar nova senha
|
|
190
|
+
</span>
|
|
191
|
+
<input
|
|
192
|
+
type="password"
|
|
193
|
+
value={confirmPwd}
|
|
194
|
+
onChange={(e) => setConfirmPwd(e.target.value)}
|
|
195
|
+
style={fieldStyle}
|
|
196
|
+
aria-label="Confirmar nova senha"
|
|
197
|
+
/>
|
|
198
|
+
</label>
|
|
199
|
+
{pwdMsg && (
|
|
200
|
+
<p role="alert" style={{ color: pwdMsg.ok ? '#10b981' : '#ef4444', fontSize: '0.875rem', marginBottom: '0.75rem' }}>
|
|
201
|
+
{pwdMsg.text}
|
|
202
|
+
</p>
|
|
203
|
+
)}
|
|
204
|
+
<button type="submit" style={btnPrimary} disabled={pwdLoading}>
|
|
205
|
+
{pwdLoading ? 'Alterando...' : 'Alterar senha'}
|
|
206
|
+
</button>
|
|
207
|
+
</form>
|
|
208
|
+
</section>
|
|
209
|
+
|
|
210
|
+
{/* ── Zona de perigo ────────────────────────────────────────────────── */}
|
|
211
|
+
<section style={{ ...card, borderColor: '#fecaca' }}>
|
|
212
|
+
<h2 style={{ fontSize: '1.1rem', fontWeight: 600, color: '#ef4444', marginTop: 0, marginBottom: '0.75rem' }}>
|
|
213
|
+
Zona de Perigo
|
|
214
|
+
</h2>
|
|
215
|
+
<p style={{ fontSize: '0.875rem', color: '#6b7280', marginBottom: '1rem' }}>
|
|
216
|
+
Ao excluir sua conta todos os seus dados serão removidos permanentemente. Esta ação não pode ser desfeita.
|
|
217
|
+
</p>
|
|
218
|
+
<button type="button" style={btnDanger} onClick={() => setShowDeleteModal(true)}>
|
|
219
|
+
Excluir minha conta
|
|
220
|
+
</button>
|
|
221
|
+
</section>
|
|
222
|
+
|
|
223
|
+
{/* ── Modal de confirmação de exclusão ─────────────────────────────── */}
|
|
224
|
+
{showDeleteModal && (
|
|
225
|
+
<div
|
|
226
|
+
role="dialog"
|
|
227
|
+
aria-modal="true"
|
|
228
|
+
aria-label="Confirmar exclusão de conta"
|
|
229
|
+
style={{
|
|
230
|
+
position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.5)',
|
|
231
|
+
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
232
|
+
zIndex: 1000,
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
<div style={{ background: '#fff', borderRadius: '10px', padding: '2rem', maxWidth: '420px', width: '90%' }}>
|
|
236
|
+
<h3 style={{ fontSize: '1.1rem', fontWeight: 700, marginTop: 0 }}>Confirmar exclusão</h3>
|
|
237
|
+
<p style={{ fontSize: '0.875rem', color: '#6b7280', marginBottom: '1rem' }}>
|
|
238
|
+
Digite sua senha para confirmar a exclusão permanente da sua conta.
|
|
239
|
+
</p>
|
|
240
|
+
<input
|
|
241
|
+
type="password"
|
|
242
|
+
placeholder="Sua senha"
|
|
243
|
+
value={deletePwd}
|
|
244
|
+
onChange={(e) => setDeletePwd(e.target.value)}
|
|
245
|
+
style={{ ...fieldStyle, marginBottom: '1rem' }}
|
|
246
|
+
aria-label="Senha para confirmar exclusão"
|
|
247
|
+
/>
|
|
248
|
+
{deleteMsg && (
|
|
249
|
+
<p role="alert" style={{ color: '#ef4444', fontSize: '0.875rem', marginBottom: '0.75rem' }}>
|
|
250
|
+
{deleteMsg}
|
|
251
|
+
</p>
|
|
252
|
+
)}
|
|
253
|
+
<div style={{ display: 'flex', gap: '0.75rem', justifyContent: 'flex-end' }}>
|
|
254
|
+
<button
|
|
255
|
+
type="button"
|
|
256
|
+
onClick={() => { setShowDeleteModal(false); setDeletePwd(''); setDeleteMsg(null); }}
|
|
257
|
+
style={{ ...btnPrimary, background: '#6b7280' }}
|
|
258
|
+
>
|
|
259
|
+
Cancelar
|
|
260
|
+
</button>
|
|
261
|
+
<button
|
|
262
|
+
type="button"
|
|
263
|
+
style={btnDanger}
|
|
264
|
+
disabled={deleteLoading || !deletePwd}
|
|
265
|
+
onClick={() => { void handleDeleteAccount(); }}
|
|
266
|
+
>
|
|
267
|
+
{deleteLoading ? 'Excluindo...' : 'Excluir conta'}
|
|
268
|
+
</button>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
)}
|
|
273
|
+
</main>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import { TextEncoder, TextDecoder } from 'util';
|
|
3
|
+
|
|
4
|
+
// React Router v7 requires TextEncoder/TextDecoder which jsdom doesn't provide
|
|
5
|
+
if (typeof globalThis.TextEncoder === 'undefined') {
|
|
6
|
+
globalThis.TextEncoder = TextEncoder as typeof globalThis.TextEncoder;
|
|
7
|
+
}
|
|
8
|
+
if (typeof globalThis.TextDecoder === 'undefined') {
|
|
9
|
+
globalThis.TextDecoder = TextDecoder as typeof globalThis.TextDecoder;
|
|
10
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { siteConfig } from '../config/siteConfig';
|
|
4
|
+
|
|
5
|
+
const STORAGE_KEY = siteConfig.cookies.storageKey;
|
|
6
|
+
|
|
7
|
+
type Consent = 'accepted' | 'declined';
|
|
8
|
+
|
|
9
|
+
function getStoredConsent(): Consent | null {
|
|
10
|
+
try {
|
|
11
|
+
const val = localStorage.getItem(STORAGE_KEY);
|
|
12
|
+
if (val === 'accepted' || val === 'declined') return val;
|
|
13
|
+
return null;
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function CookieConsent() {
|
|
20
|
+
const [visible, setVisible] = useState(false);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
// Only show if the user hasn't decided yet
|
|
24
|
+
if (getStoredConsent() === null) {
|
|
25
|
+
setVisible(true);
|
|
26
|
+
}
|
|
27
|
+
}, []);
|
|
28
|
+
|
|
29
|
+
function handleAccept() {
|
|
30
|
+
try { localStorage.setItem(STORAGE_KEY, 'accepted'); } catch { /* private mode */ }
|
|
31
|
+
setVisible(false);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function handleDecline() {
|
|
35
|
+
try { localStorage.setItem(STORAGE_KEY, 'declined'); } catch { /* private mode */ }
|
|
36
|
+
setVisible(false);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!visible) return null;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
role="dialog"
|
|
44
|
+
aria-live="polite"
|
|
45
|
+
aria-label="Aviso de cookies"
|
|
46
|
+
style={{
|
|
47
|
+
position: 'fixed',
|
|
48
|
+
bottom: 0,
|
|
49
|
+
left: 0,
|
|
50
|
+
right: 0,
|
|
51
|
+
zIndex: 2000,
|
|
52
|
+
background: '#1f2937',
|
|
53
|
+
color: '#f9fafb',
|
|
54
|
+
padding: '1rem 1.5rem',
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'space-between',
|
|
58
|
+
gap: '1rem',
|
|
59
|
+
flexWrap: 'wrap',
|
|
60
|
+
boxShadow: '0 -4px 12px rgba(0,0,0,0.25)',
|
|
61
|
+
fontSize: '0.875rem',
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<p style={{ margin: 0, flex: 1 }}>
|
|
65
|
+
🍪 Utilizamos cookies para melhorar sua experiência de navegação. Ao continuar, você concorda com
|
|
66
|
+
nossa{' '}
|
|
67
|
+
<Link to="/privacy" style={{ color: '#a5b4fc', textDecoration: 'underline' }}>
|
|
68
|
+
Política de Privacidade
|
|
69
|
+
</Link>{' '}
|
|
70
|
+
e com o uso de cookies. Em conformidade com a{' '}
|
|
71
|
+
<strong>LGPD (Lei 13.709/2018)</strong>.
|
|
72
|
+
</p>
|
|
73
|
+
<div style={{ display: 'flex', gap: '0.625rem', flexShrink: 0 }}>
|
|
74
|
+
<button
|
|
75
|
+
onClick={handleDecline}
|
|
76
|
+
style={{
|
|
77
|
+
background: 'transparent',
|
|
78
|
+
border: '1px solid #4b5563',
|
|
79
|
+
color: '#d1d5db',
|
|
80
|
+
borderRadius: '6px',
|
|
81
|
+
padding: '0.4rem 1rem',
|
|
82
|
+
cursor: 'pointer',
|
|
83
|
+
fontSize: '0.8rem',
|
|
84
|
+
fontFamily: 'inherit',
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
Recusar
|
|
88
|
+
</button>
|
|
89
|
+
<button
|
|
90
|
+
onClick={handleAccept}
|
|
91
|
+
style={{
|
|
92
|
+
background: '#6366f1',
|
|
93
|
+
border: 'none',
|
|
94
|
+
color: '#fff',
|
|
95
|
+
borderRadius: '6px',
|
|
96
|
+
padding: '0.4rem 1.25rem',
|
|
97
|
+
cursor: 'pointer',
|
|
98
|
+
fontWeight: 600,
|
|
99
|
+
fontSize: '0.8rem',
|
|
100
|
+
fontFamily: 'inherit',
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
Aceitar
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|