@greatapps/common 1.1.107 → 1.1.109

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/common",
3
- "version": "1.1.107",
3
+ "version": "1.1.109",
4
4
  "description": "Shared library for GreatApps frontend applications",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./src/index.ts",
@@ -70,7 +70,7 @@ export function AppMobileNavBar({
70
70
  <TooltipContent side="bottom">GreatPages</TooltipContent>
71
71
  </Tooltip>
72
72
  {appIconIndicator && (
73
- <div className="absolute -bottom-[17px] left-1/2 -translate-x-1/2 w-5 h-[3px] bg-pages-300 rounded-t-xl" />
73
+ <div className="absolute -bottom-[17px] left-1/2 -translate-x-1/2 w-5 h-[3px] bg-pages-500 rounded-t-xl" />
74
74
  )}
75
75
  </div>
76
76
  {extraLeftSlot}
@@ -62,7 +62,7 @@ export function AppNavBar({
62
62
  <TooltipContent side="right">GreatPages</TooltipContent>
63
63
  </Tooltip>
64
64
  <div
65
- className={`absolute -left-4 top-1/2 -translate-y-1/2 w-[3px] h-5 bg-pages-300 rounded-r-xl transition-opacity duration-300 ${
65
+ className={`absolute -left-4 top-1/2 -translate-y-1/2 w-[3px] h-5 bg-pages-500 rounded-r-xl transition-opacity duration-300 ${
66
66
  appIconIndicator ? 'opacity-100' : 'opacity-0'
67
67
  }`}
68
68
  />
@@ -118,6 +118,7 @@ export interface RegisterApiRequest {
118
118
  export interface RegisterApiResponse {
119
119
  status: 0 | 1;
120
120
  message: string;
121
+ cookie?: string;
121
122
  data?: Array<{
122
123
  id: number;
123
124
  id_wl: number;
@@ -2,7 +2,6 @@ import { cookies } from "next/headers";
2
2
 
3
3
  import { api } from "../../../infra/api/client";
4
4
  import { ApiError } from "../../../infra/api/types";
5
- import { User } from "../../users/schema";
6
5
  import {
7
6
  ClientInfo,
8
7
  ForgotPasswordRequest,
@@ -134,7 +133,7 @@ class AuthService {
134
133
 
135
134
  return { status: 1 };
136
135
  }
137
- async register(data: RegisterRequest, clientInfo: ClientInfo): Promise<RegisterResponse> {
136
+ async register(data: RegisterRequest, _clientInfo: ClientInfo): Promise<RegisterResponse> {
138
137
  const today = new Date();
139
138
  const trialEndDate = new Date(today);
140
139
  trialEndDate.setDate(today.getDate() + 7); // 7 dias de trial
@@ -188,21 +187,31 @@ class AuthService {
188
187
  );
189
188
  }
190
189
 
190
+ if (!response.cookie) {
191
+ throw new ApiError(
192
+ "Resposta de autenticação inválida",
193
+ "INVALID_RESPONSE",
194
+ 500
195
+ );
196
+ }
197
+
191
198
  const accountData = response.data[0];
192
199
 
193
- const loginResult = await this.login(
194
- { email: data.email, password: data.password },
195
- clientInfo
196
- );
200
+ await this.setAuthCookie(response.cookie);
197
201
 
198
- const user = loginResult.result === 'success' ? loginResult.user : {} as User;
199
- const account = loginResult.result === 'success' ? loginResult.account : {} as import('../../accounts/types').Account;
200
- const accessToken = loginResult.result === 'success' ? loginResult.accessToken : "";
202
+ const [{ userService }, { accountService }] = await Promise.all([
203
+ import('../../users/services/user.service'),
204
+ import('../../accounts/services/account.service'),
205
+ ]);
206
+ const [user, account] = await Promise.all([
207
+ userService.findById(),
208
+ accountService.findCurrentAccount(),
209
+ ]);
201
210
 
202
211
  return {
203
212
  user,
204
213
  account,
205
- accessToken,
214
+ accessToken: response.cookie,
206
215
  refreshToken: "",
207
216
  expiresAt: new Date(Date.now() + COOKIE_MAX_AGE * 1000).toISOString(),
208
217
  requiresEmailVerification: !accountData.verified,