@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.
- package/dist/components/modals/AccountDeletionWarningModal.mjs +50 -0
- package/dist/components/modals/AccountDeletionWarningModal.mjs.map +1 -0
- package/dist/i18n/messages/en-us.mjs +6 -0
- package/dist/i18n/messages/en-us.mjs.map +1 -1
- package/dist/i18n/messages/es-es.mjs +6 -0
- package/dist/i18n/messages/es-es.mjs.map +1 -1
- package/dist/i18n/messages/pt-br.mjs +6 -0
- package/dist/i18n/messages/pt-br.mjs.map +1 -1
- package/dist/index.mjs +36 -32
- package/dist/index.mjs.map +1 -1
- package/dist/modules/whitelabel/services/whitelabel.service.mjs +3 -22
- package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -1
- package/dist/modules/whitelabel/utils/normalize-hostname.mjs +0 -1
- package/dist/modules/whitelabel/utils/normalize-hostname.mjs.map +1 -1
- package/dist/store/useAccountDeletionWarningModal.mjs +13 -0
- package/dist/store/useAccountDeletionWarningModal.mjs.map +1 -0
- package/dist/utils/browser/safe-storage.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/modals/AccountDeletionWarningModal.tsx +67 -0
- package/src/i18n/messages/en-us.ts +8 -0
- package/src/i18n/messages/es-es.ts +8 -0
- package/src/i18n/messages/pt-br.ts +8 -0
- package/src/index.ts +2 -0
- package/src/modules/whitelabel/services/whitelabel.service.ts +5 -29
- package/src/modules/whitelabel/utils/normalize-hostname.ts +0 -1
- package/src/store/useAccountDeletionWarningModal.ts +17 -0
- package/src/utils/browser/safe-storage.ts +0 -4
|
@@ -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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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> {
|
|
@@ -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
|
}
|