@greatapps/common 1.1.731 → 1.1.734

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.
@@ -83,6 +83,14 @@ const messages = {
83
83
  other: 'Otro motivo',
84
84
  },
85
85
  },
86
+ deletionWarning: {
87
+ title: 'Su cuenta será eliminada',
88
+ descriptionLine1:
89
+ 'Su suscripción está cancelada desde hace 90 días o más. Su cuenta y todos los datos serán eliminados permanentemente.',
90
+ descriptionLine2:
91
+ 'Para conservar su información, reactive su suscripción antes de la eliminación. Después de ese plazo, no será posible recuperar los datos.',
92
+ reactivate: 'Reactivar suscripción',
93
+ },
86
94
  confirmDelete: {
87
95
  title: '¡Qué pena verte partir!',
88
96
  warning:
@@ -92,6 +92,14 @@ const messages = {
92
92
  other: 'Outro motivo',
93
93
  },
94
94
  },
95
+ deletionWarning: {
96
+ title: 'Sua conta será excluída',
97
+ descriptionLine1:
98
+ 'Sua assinatura está cancelada há 90 dias ou mais. Sua conta e todos os dados serão excluídos permanentemente.',
99
+ descriptionLine2:
100
+ 'Para manter suas informações, reative sua assinatura antes da exclusão. Após esse prazo, não será possível recuperar os dados.',
101
+ reactivate: 'Reativar assinatura',
102
+ },
95
103
  confirmDelete: {
96
104
  title: 'Uma pena te ver ir!',
97
105
  warning:
package/src/index.ts CHANGED
@@ -206,9 +206,11 @@ export {
206
206
  export { useBuyCreditsModal } from "./store/useBuyCreditsModal";
207
207
  export { useCreditsDisabledModal } from "./store/useCreditsDisabledModal";
208
208
  export { usePaidPlanRequiredModal } from "./store/usePaidPlanRequiredModal";
209
+ export { useAccountDeletionWarningModal } from "./store/useAccountDeletionWarningModal";
209
210
  export { default as BuyCreditsModal } from "./components/modals/BuyCreditsModal";
210
211
  export { default as CreditsDisabledModal } from "./components/modals/CreditsDisabledModal";
211
212
  export { default as PaidPlanRequiredModal } from "./components/modals/PaidPlanRequiredModal";
213
+ export { default as AccountDeletionWarningModal } from "./components/modals/AccountDeletionWarningModal";
212
214
  export { default as AddCardModal } from "./components/modals/cards/AddCardModal";
213
215
  export { DeleteCardModal } from "./components/modals/cards/DeleteCardModal";
214
216
  export { CannotDeleteCardModal } from "./components/modals/cards/CannotDeleteCardModal";
@@ -3,8 +3,6 @@ import { ApiError } from "../../../infra/api/types";
3
3
  import { WhitelabelTokenApiResponse, WhitelabelTokenData } from "../schema";
4
4
  import { normalizeHostname } from "../utils/normalize-hostname";
5
5
 
6
- const NOT_FOUND_SENTINEL = "__WL_TOKEN_NOT_FOUND__";
7
-
8
6
  class WhitelabelService {
9
7
  private getApiUrl(): string {
10
8
  const apiUrl = process.env.GAPPS_R3_API_URL;
@@ -58,12 +56,6 @@ class WhitelabelService {
58
56
  });
59
57
 
60
58
  if (!response.ok) {
61
- const body = await response.json().catch(() => null);
62
-
63
- if (response.status === 404 || body?.message === "Whitelabel not found") {
64
- throw new ApiError("Whitelabel token not found", "TOKEN_NOT_FOUND", 404);
65
- }
66
-
67
59
  console.error("[WhitelabelService] Failed to fetch whitelabel token", {
68
60
  response,
69
61
  });
@@ -100,31 +92,15 @@ class WhitelabelService {
100
92
  });
101
93
 
102
94
  if (cachedData.status == 1 && "data" in cachedData && cachedData.data) {
103
- if (cachedData.data === NOT_FOUND_SENTINEL) {
104
- console.log("[WhitelabelService] Negative cache hit for domain", { hostname });
105
- throw new ApiError("Whitelabel token not found", "TOKEN_NOT_FOUND", 404);
106
- }
107
-
108
95
  console.log("[WhitelabelService] Cache hit for domain", { hostname });
109
96
  return JSON.parse(cachedData.data) as WhitelabelTokenData;
110
97
  }
111
98
 
112
- try {
113
- const data = await this.fetchFromApi(hostname);
114
-
115
- await cache.insert(cacheKey, JSON.stringify(data), 604800);
116
-
117
- return data;
118
- } catch (error) {
119
- if (ApiError.isApiError(error) && error.code === "TOKEN_NOT_FOUND") {
120
- try {
121
- await cache.insert(cacheKey, NOT_FOUND_SENTINEL, 60);
122
- } catch {
123
- // falha do cache não pode substituir o TOKEN_NOT_FOUND original
124
- }
125
- }
126
- throw error;
127
- }
99
+ const data = await this.fetchFromApi(hostname);
100
+
101
+ await cache.insert(cacheKey, JSON.stringify(data), 604800);
102
+
103
+ return data;
128
104
  }
129
105
 
130
106
  async getTokenByWhitelabelId(idWl: number): Promise<string> {
@@ -6,7 +6,6 @@ const CATEGORY_PREFIXES = new Set([
6
6
  const SIMPLE_TLDS = new Set(["online"]);
7
7
 
8
8
  export function normalizeHostname(hostname: string): string {
9
- hostname = hostname.split(":")[0];
10
9
  const parts = hostname.split(".");
11
10
  if (parts.length <= 2) return hostname;
12
11
 
@@ -0,0 +1,17 @@
1
+ import { useModalManager } from './useModalManager';
2
+
3
+ interface AccountDeletionWarningModalOptions {
4
+ /** Sobrescreve o redirecionamento padrão para a área de assinatura. */
5
+ onReactivate?: () => void;
6
+ }
7
+
8
+ export function useAccountDeletionWarningModal() {
9
+ const { activeModal, openModal, closeModal } = useModalManager();
10
+
11
+ return {
12
+ open: activeModal === 'accountDeletionWarningModal',
13
+ openModal: (options?: AccountDeletionWarningModalOptions) =>
14
+ openModal('accountDeletionWarningModal', options ?? {}),
15
+ closeModal,
16
+ };
17
+ }
@@ -1,6 +1,3 @@
1
- // Alguns webviews in-app (Google/Meta, Android com storage desabilitado) tanto podem
2
- // devolver `window.localStorage === null` quanto lançar SecurityError ao simplesmente
3
- // acessar o getter. `typeof window === 'undefined'` não cobre nenhum dos dois casos.
4
1
  export function readStorage(key: string): string | null {
5
2
  if (typeof window === 'undefined') return null;
6
3
  try {
@@ -15,6 +12,5 @@ export function writeStorage(key: string, value: string): void {
15
12
  try {
16
13
  window.localStorage?.setItem(key, value);
17
14
  } catch {
18
- // storage indisponível — segue só com o estado em memória
19
15
  }
20
16
  }