@greatapps/common 1.1.522 → 1.1.525
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/account/ConfigurationsMyAccountModal.mjs +4 -10
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +1 -3
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/sections/ChangeEmailModal.mjs +1 -3
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
- package/dist/components/account/sections/ChangePhoneModal.mjs +1 -3
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs +1 -2
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/embeds/EmbedWidgets.mjs +1 -3
- package/dist/components/embeds/EmbedWidgets.mjs.map +1 -1
- package/dist/components/layouts/AppMobileNavBar.mjs +1 -3
- package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -1
- package/dist/components/layouts/AppNavBar.mjs +8 -4
- package/dist/components/layouts/AppNavBar.mjs.map +1 -1
- package/dist/components/layouts/NavBar.mjs +9 -10
- package/dist/components/layouts/NavBar.mjs.map +1 -1
- package/dist/components/layouts/NotificationsPopover.mjs +2 -5
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
- package/dist/components/layouts/ProfilePopover.mjs +2 -4
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/SideBarNavigation.mjs +1 -4
- package/dist/components/layouts/SideBarNavigation.mjs.map +1 -1
- package/dist/components/modals/BuyCreditsModal.mjs +9 -26
- package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddCardModal.mjs +1 -3
- package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +1 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
- package/dist/components/navigation/ProjectSelectorPopover.mjs +6 -7
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +19 -39
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
- package/dist/components/navigation/types.mjs +1 -0
- package/dist/components/navigation/types.mjs.map +1 -0
- package/dist/components/pages/NotFoundPage.mjs +2 -2
- package/dist/components/pages/NotFoundPage.mjs.map +1 -1
- package/dist/components/ui/buttons/Button.mjs +2 -7
- package/dist/components/ui/buttons/Button.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs +1 -1
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentInfoCard.mjs +2 -4
- package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
- package/dist/components/ui/data-display/UserAvatar.mjs +2 -6
- package/dist/components/ui/data-display/UserAvatar.mjs.map +1 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +1 -4
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
- package/dist/components/ui/feedback/Toast.mjs +2 -7
- package/dist/components/ui/feedback/Toast.mjs.map +1 -1
- package/dist/components/ui/form/FormField.mjs +1 -1
- package/dist/components/ui/form/FormField.mjs.map +1 -1
- package/dist/components/ui/form/Select.mjs +1 -1
- package/dist/components/ui/form/Select.mjs.map +1 -1
- package/dist/components/ui/overlay/Popover.mjs +1 -1
- package/dist/components/ui/overlay/Popover.mjs.map +1 -1
- package/dist/components/ui/overlay/Sheet.mjs +6 -8
- package/dist/components/ui/overlay/Sheet.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageUpload.mjs +1 -2
- package/dist/components/widgets/ImageUpload/ImageUpload.mjs.map +1 -1
- package/dist/components/widgets/notifications/NotificationCard.mjs +1 -4
- package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -1
- package/dist/enums/AccountSectionType.mjs +0 -1
- package/dist/enums/AccountSectionType.mjs.map +1 -1
- package/dist/index.mjs +8 -90
- package/dist/index.mjs.map +1 -1
- package/dist/modules/accounts/hooks/current-account.hook.mjs +2 -5
- package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useAccountManagement.mjs +9 -19
- package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useCurrencies.mjs +1 -3
- package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useTimezones.mjs +1 -3
- package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -1
- package/dist/modules/auth/hooks/useUserQuery.mjs +6 -15
- package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -1
- package/dist/modules/cards/hooks/cards.hook.mjs +3 -11
- package/dist/modules/cards/hooks/cards.hook.mjs.map +1 -1
- package/dist/modules/cards/hooks/create-card.hook.mjs +2 -13
- package/dist/modules/cards/hooks/create-card.hook.mjs.map +1 -1
- package/dist/modules/cards/services/cards.service.mjs +4 -45
- package/dist/modules/cards/services/cards.service.mjs.map +1 -1
- package/dist/modules/cards/types.mjs +3 -11
- package/dist/modules/cards/types.mjs.map +1 -1
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +1 -3
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +1 -1
- package/dist/modules/plans/hooks/list-plans.hook.mjs +1 -3
- package/dist/modules/plans/hooks/list-plans.hook.mjs.map +1 -1
- package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs +2 -4
- package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs.map +1 -1
- package/dist/modules/plans/services/plans.service.mjs +2 -4
- package/dist/modules/plans/services/plans.service.mjs.map +1 -1
- package/dist/modules/plans/types/plan.type.mjs.map +1 -1
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +10 -20
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
- package/dist/modules/projects/hooks/add-project-user.hook.mjs +12 -15
- package/dist/modules/projects/hooks/add-project-user.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +1 -3
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-available-users.hook.mjs +1 -3
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-project-users.hook.mjs +1 -3
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/remove-project-user.hook.mjs +12 -15
- package/dist/modules/projects/hooks/remove-project-user.hook.mjs.map +1 -1
- package/dist/modules/projects/types.mjs +4 -19
- package/dist/modules/projects/types.mjs.map +1 -1
- package/dist/modules/subscriptions/constants/query-keys.constants.mjs +0 -2
- package/dist/modules/subscriptions/constants/query-keys.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +2 -5
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +1 -3
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs +3 -6
- package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/types/calculate-subscription.type.mjs +2 -29
- package/dist/modules/subscriptions/types/calculate-subscription.type.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/periodicity.mjs +0 -7
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
- package/dist/modules/users/action/list-messages.action.mjs +2 -14
- package/dist/modules/users/action/list-messages.action.mjs.map +1 -1
- package/dist/modules/users/hooks/messages.hook.mjs +4 -9
- package/dist/modules/users/hooks/messages.hook.mjs.map +1 -1
- package/dist/modules/users/services/messages.service.mjs.map +1 -1
- package/dist/providers/auth.provider.mjs +4 -6
- package/dist/providers/auth.provider.mjs.map +1 -1
- package/dist/providers/query.provider.mjs +2 -2
- package/dist/providers/query.provider.mjs.map +1 -1
- package/dist/providers/whitelabel.provider.mjs +0 -5
- package/dist/providers/whitelabel.provider.mjs.map +1 -1
- package/dist/server.mjs +0 -14
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/widgets/ImageUpload/ImageCropModal.tsx +10 -37
- package/dist/components/account/sections/TokenSection.mjs +0 -72
- package/dist/components/account/sections/TokenSection.mjs.map +0 -1
- package/dist/components/embeds/ClarityEmbed.mjs +0 -55
- package/dist/components/embeds/ClarityEmbed.mjs.map +0 -1
- package/dist/hooks/useAuthQueryKey.mjs +0 -23
- package/dist/hooks/useAuthQueryKey.mjs.map +0 -1
- package/dist/infra/utils/array.mjs +0 -34
- package/dist/infra/utils/array.mjs.map +0 -1
- package/dist/modules/accounts/actions/get-account-token.action.mjs +0 -10
- package/dist/modules/accounts/actions/get-account-token.action.mjs.map +0 -1
- package/dist/modules/accounts/hooks/use-account-token.hook.mjs +0 -15
- package/dist/modules/accounts/hooks/use-account-token.hook.mjs.map +0 -1
- package/dist/modules/accounts/services/account-token.service.mjs +0 -32
- package/dist/modules/accounts/services/account-token.service.mjs.map +0 -1
- package/dist/modules/cards/actions/delete-card.action.mjs +0 -10
- package/dist/modules/cards/actions/delete-card.action.mjs.map +0 -1
- package/dist/modules/cards/actions/find-card-by-id.action.mjs +0 -10
- package/dist/modules/cards/actions/find-card-by-id.action.mjs.map +0 -1
- package/dist/modules/cards/actions/set-default-card.action.mjs +0 -10
- package/dist/modules/cards/actions/set-default-card.action.mjs.map +0 -1
- package/dist/modules/cards/hooks/card-by-id.hook.mjs +0 -22
- package/dist/modules/cards/hooks/card-by-id.hook.mjs.map +0 -1
- package/dist/modules/cards/hooks/delete-card.hook.mjs +0 -50
- package/dist/modules/cards/hooks/delete-card.hook.mjs.map +0 -1
- package/dist/modules/cards/hooks/set-default-card.hook.mjs +0 -51
- package/dist/modules/cards/hooks/set-default-card.hook.mjs.map +0 -1
- package/dist/modules/projects/actions/create-project.action.mjs +0 -10
- package/dist/modules/projects/actions/create-project.action.mjs.map +0 -1
- package/dist/modules/projects/actions/delete-project.action.mjs +0 -10
- package/dist/modules/projects/actions/delete-project.action.mjs.map +0 -1
- package/dist/modules/projects/actions/find-project.action.mjs +0 -10
- package/dist/modules/projects/actions/find-project.action.mjs.map +0 -1
- package/dist/modules/projects/actions/list-projects.action.mjs +0 -10
- package/dist/modules/projects/actions/list-projects.action.mjs.map +0 -1
- package/dist/modules/projects/actions/update-project.action.mjs +0 -10
- package/dist/modules/projects/actions/update-project.action.mjs.map +0 -1
- package/dist/modules/projects/hooks/create-project.hook.mjs +0 -71
- package/dist/modules/projects/hooks/create-project.hook.mjs.map +0 -1
- package/dist/modules/projects/hooks/delete-project.hook.mjs +0 -53
- package/dist/modules/projects/hooks/delete-project.hook.mjs.map +0 -1
- package/dist/modules/projects/hooks/find-project.hook.mjs +0 -19
- package/dist/modules/projects/hooks/find-project.hook.mjs.map +0 -1
- package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs +0 -39
- package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs.map +0 -1
- package/dist/modules/projects/hooks/list-projects.hook.mjs +0 -22
- package/dist/modules/projects/hooks/list-projects.hook.mjs.map +0 -1
- package/dist/modules/projects/hooks/update-project.hook.mjs +0 -70
- package/dist/modules/projects/hooks/update-project.hook.mjs.map +0 -1
- package/dist/modules/projects/services/projects.service.mjs +0 -99
- package/dist/modules/projects/services/projects.service.mjs.map +0 -1
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
ACCOUNT_QUERY_KEY
|
|
21
21
|
} from "../modules/accounts/hooks/current-account.hook";
|
|
22
22
|
import { useWhitelabelUrls } from "./whitelabel.provider";
|
|
23
|
-
import { useWlQueryKey } from "../hooks/useAuthQueryKey";
|
|
24
23
|
const AuthContext = createContext(
|
|
25
24
|
void 0
|
|
26
25
|
);
|
|
@@ -31,7 +30,6 @@ function AuthProvider({ children }) {
|
|
|
31
30
|
const queryClient = useQueryClient();
|
|
32
31
|
const setUserData = useSetUserData();
|
|
33
32
|
const { accountsUrl, pagesUrl } = useWhitelabelUrls();
|
|
34
|
-
const accountKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);
|
|
35
33
|
const { mutateAsync: loginMutate, isPending: isLogging } = useLogin();
|
|
36
34
|
const { mutateAsync: registerMutate, isPending: isRegistering } = useRegister();
|
|
37
35
|
const { mutateAsync: logoutMutate, isPending: isLoggingOut } = useLogout();
|
|
@@ -46,14 +44,14 @@ function AuthProvider({ children }) {
|
|
|
46
44
|
}
|
|
47
45
|
queryClient.clear();
|
|
48
46
|
setUserData(data.user);
|
|
49
|
-
queryClient.setQueryData(
|
|
47
|
+
queryClient.setQueryData(ACCOUNT_QUERY_KEY, data.account);
|
|
50
48
|
return { result: "success" };
|
|
51
49
|
} catch (error) {
|
|
52
50
|
const message = error instanceof Error ? error.message : "Ocorreu um erro ao fazer login. Tente novamente.";
|
|
53
51
|
return { result: "error", message };
|
|
54
52
|
}
|
|
55
53
|
},
|
|
56
|
-
[queryClient, setUserData
|
|
54
|
+
[queryClient, setUserData]
|
|
57
55
|
);
|
|
58
56
|
const register = useCallback(
|
|
59
57
|
async (data) => {
|
|
@@ -61,11 +59,11 @@ function AuthProvider({ children }) {
|
|
|
61
59
|
onSuccess: (data2) => {
|
|
62
60
|
queryClient.clear();
|
|
63
61
|
setUserData(data2.user);
|
|
64
|
-
queryClient.setQueryData(
|
|
62
|
+
queryClient.setQueryData(ACCOUNT_QUERY_KEY, data2.account);
|
|
65
63
|
}
|
|
66
64
|
});
|
|
67
65
|
},
|
|
68
|
-
[queryClient, setUserData
|
|
66
|
+
[queryClient, setUserData]
|
|
69
67
|
);
|
|
70
68
|
const resolveLogoutRedirect = useCallback(() => {
|
|
71
69
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/auth.provider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n ReactNode,\n useCallback,\n useContext,\n useMemo,\n} from \"react\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport {\n useUserQuery,\n useSetUserData,\n useUserValidateSession,\n} from \"../modules/auth/hooks/useUserQuery\";\nimport { useLogin } from \"../modules/auth/hooks/login.hook\";\nimport { useRegister } from \"../modules/auth/hooks/register.hook\";\nimport { useLogout } from \"../modules/auth/hooks/logout.hook\";\nimport {\n AuthState,\n LoginRequest,\n RegisterRequest,\n} from \"../modules/auth/schema\";\n\nexport type LoginResult =\n | { result: \"success\" }\n | { result: \"two_factor_required\"; cookie: string; twoFactorMode: \"verify\" | \"setup\" }\n | { result: \"error\"; message: string };\nimport {\n useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"../modules/accounts/hooks/current-account.hook\";\nimport { useWhitelabelUrls } from \"./whitelabel.provider\";\
|
|
1
|
+
{"version":3,"sources":["../../src/providers/auth.provider.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n createContext,\r\n ReactNode,\r\n useCallback,\r\n useContext,\r\n useMemo,\r\n} from \"react\";\r\nimport { useQueryClient } from \"@tanstack/react-query\";\r\nimport {\r\n useUserQuery,\r\n useSetUserData,\r\n useUserValidateSession,\r\n} from \"../modules/auth/hooks/useUserQuery\";\r\nimport { useLogin } from \"../modules/auth/hooks/login.hook\";\r\nimport { useRegister } from \"../modules/auth/hooks/register.hook\";\r\nimport { useLogout } from \"../modules/auth/hooks/logout.hook\";\r\nimport {\r\n AuthState,\r\n LoginRequest,\r\n RegisterRequest,\r\n} from \"../modules/auth/schema\";\r\n\r\nexport type LoginResult =\r\n | { result: \"success\" }\r\n | { result: \"two_factor_required\"; cookie: string; twoFactorMode: \"verify\" | \"setup\" }\r\n | { result: \"error\"; message: string };\r\nimport {\r\n useCurrentAccount,\r\n ACCOUNT_QUERY_KEY,\r\n} from \"../modules/accounts/hooks/current-account.hook\";\r\nimport { useWhitelabelUrls } from \"./whitelabel.provider\";\r\n\r\ninterface AuthContextProps extends AuthState {\r\n login: (credentials: LoginRequest) => Promise<LoginResult>;\r\n register: (data: RegisterRequest) => Promise<void>;\r\n logout: () => Promise<void>;\r\n}\r\n\r\nexport const AuthContext = createContext<AuthContextProps | undefined>(\r\n undefined,\r\n);\r\n\r\ninterface AuthProviderProps {\r\n children: ReactNode;\r\n}\r\n\r\nexport function AuthProvider({ children }: AuthProviderProps) {\r\n const { data: user, isLoading: isQueryLoading } = useUserQuery();\r\n const { data: account, isLoading: isAccountLoading } = useCurrentAccount();\r\n const { isLoading: isSessionLoading } = useUserValidateSession();\r\n\r\n const queryClient = useQueryClient();\r\n const setUserData = useSetUserData();\r\n const { accountsUrl, pagesUrl } = useWhitelabelUrls();\r\n\r\n const { mutateAsync: loginMutate, isPending: isLogging } = useLogin();\r\n const { mutateAsync: registerMutate, isPending: isRegistering } =\r\n useRegister();\r\n const { mutateAsync: logoutMutate, isPending: isLoggingOut } = useLogout();\r\n\r\n const isAuthenticated = !!user;\r\n const isLoading =\r\n isLogging ||\r\n isRegistering ||\r\n isLoggingOut ||\r\n isQueryLoading ||\r\n isAccountLoading ||\r\n isSessionLoading;\r\n\r\n const login = useCallback(\r\n async (credentials: LoginRequest): Promise<LoginResult> => {\r\n try {\r\n const data = await loginMutate(credentials);\r\n\r\n if (data.result === \"two_factor_required\") {\r\n return { result: \"two_factor_required\", cookie: data.cookie, twoFactorMode: data.twoFactorMode };\r\n }\r\n\r\n queryClient.clear();\r\n setUserData(data.user);\r\n queryClient.setQueryData(ACCOUNT_QUERY_KEY, data.account);\r\n\r\n return { result: \"success\" };\r\n } catch (error) {\r\n const message =\r\n error instanceof Error\r\n ? error.message\r\n : \"Ocorreu um erro ao fazer login. Tente novamente.\";\r\n return { result: \"error\", message };\r\n }\r\n },\r\n [queryClient, setUserData],\r\n );\r\n\r\n const register = useCallback(\r\n async (data: RegisterRequest): Promise<void> => {\r\n await registerMutate(data, {\r\n onSuccess: (data) => {\r\n queryClient.clear();\r\n setUserData(data.user);\r\n queryClient.setQueryData(ACCOUNT_QUERY_KEY, data.account);\r\n },\r\n });\r\n },\r\n [queryClient, setUserData],\r\n );\r\n\r\n const resolveLogoutRedirect = useCallback(() => {\r\n try {\r\n const currentOrigin = window.location.origin;\r\n const pagesOrigin = pagesUrl ? new URL(pagesUrl).origin : \"\";\r\n\r\n if (pagesOrigin && currentOrigin === pagesOrigin) {\r\n return `${accountsUrl}/login?redirect=${encodeURIComponent(pagesUrl)}`;\r\n }\r\n } catch {\r\n // fallback below\r\n }\r\n\r\n return `${accountsUrl}/login?redirect=${encodeURIComponent(pagesUrl || \"/\")}`;\r\n }, [accountsUrl, pagesUrl]);\r\n\r\n const logout = useCallback(async (): Promise<void> => {\r\n try {\r\n await logoutMutate(undefined);\r\n } catch {\r\n // cookie já removido no servidor mesmo se a API falhou\r\n } finally {\r\n queryClient.clear();\r\n window.location.assign(resolveLogoutRedirect());\r\n }\r\n }, [queryClient, logoutMutate, resolveLogoutRedirect]);\r\n\r\n const value: AuthContextProps = useMemo(\r\n () => ({\r\n user: user ?? null,\r\n account: account ?? null,\r\n isAuthenticated,\r\n isLoading,\r\n login,\r\n register,\r\n logout,\r\n }),\r\n [user, account, isAuthenticated, isLoading, login, register, logout],\r\n );\r\n\r\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;\r\n}\r\n\r\nexport function useAuth(): AuthContextProps {\r\n const context = useContext(AuthContext);\r\n\r\n if (context === undefined) {\r\n throw new Error(\"useAuth deve ser usado dentro de um AuthProvider\");\r\n }\r\n\r\n return context;\r\n}\r\n"],"mappings":";AAoJS;AAlJT;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAW1B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAQ3B,MAAM,cAAc;AAAA,EACzB;AACF;AAMO,SAAS,aAAa,EAAE,SAAS,GAAsB;AAC5D,QAAM,EAAE,MAAM,MAAM,WAAW,eAAe,IAAI,aAAa;AAC/D,QAAM,EAAE,MAAM,SAAS,WAAW,iBAAiB,IAAI,kBAAkB;AACzE,QAAM,EAAE,WAAW,iBAAiB,IAAI,uBAAuB;AAE/D,QAAM,cAAc,eAAe;AACnC,QAAM,cAAc,eAAe;AACnC,QAAM,EAAE,aAAa,SAAS,IAAI,kBAAkB;AAEpD,QAAM,EAAE,aAAa,aAAa,WAAW,UAAU,IAAI,SAAS;AACpE,QAAM,EAAE,aAAa,gBAAgB,WAAW,cAAc,IAC5D,YAAY;AACd,QAAM,EAAE,aAAa,cAAc,WAAW,aAAa,IAAI,UAAU;AAEzE,QAAM,kBAAkB,CAAC,CAAC;AAC1B,QAAM,YACJ,aACA,iBACA,gBACA,kBACA,oBACA;AAEF,QAAM,QAAQ;AAAA,IACZ,OAAO,gBAAoD;AACzD,UAAI;AACF,cAAM,OAAO,MAAM,YAAY,WAAW;AAE1C,YAAI,KAAK,WAAW,uBAAuB;AACzC,iBAAO,EAAE,QAAQ,uBAAuB,QAAQ,KAAK,QAAQ,eAAe,KAAK,cAAc;AAAA,QACjG;AAEA,oBAAY,MAAM;AAClB,oBAAY,KAAK,IAAI;AACrB,oBAAY,aAAa,mBAAmB,KAAK,OAAO;AAExD,eAAO,EAAE,QAAQ,UAAU;AAAA,MAC7B,SAAS,OAAO;AACd,cAAM,UACJ,iBAAiB,QACb,MAAM,UACN;AACN,eAAO,EAAE,QAAQ,SAAS,QAAQ;AAAA,MACpC;AAAA,IACF;AAAA,IACA,CAAC,aAAa,WAAW;AAAA,EAC3B;AAEA,QAAM,WAAW;AAAA,IACf,OAAO,SAAyC;AAC9C,YAAM,eAAe,MAAM;AAAA,QACzB,WAAW,CAACA,UAAS;AACnB,sBAAY,MAAM;AAClB,sBAAYA,MAAK,IAAI;AACrB,sBAAY,aAAa,mBAAmBA,MAAK,OAAO;AAAA,QAC1D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,aAAa,WAAW;AAAA,EAC3B;AAEA,QAAM,wBAAwB,YAAY,MAAM;AAC9C,QAAI;AACF,YAAM,gBAAgB,OAAO,SAAS;AACtC,YAAM,cAAc,WAAW,IAAI,IAAI,QAAQ,EAAE,SAAS;AAE1D,UAAI,eAAe,kBAAkB,aAAa;AAChD,eAAO,GAAG,WAAW,mBAAmB,mBAAmB,QAAQ,CAAC;AAAA,MACtE;AAAA,IACF,QAAQ;AAAA,IAER;AAEA,WAAO,GAAG,WAAW,mBAAmB,mBAAmB,YAAY,GAAG,CAAC;AAAA,EAC7E,GAAG,CAAC,aAAa,QAAQ,CAAC;AAE1B,QAAM,SAAS,YAAY,YAA2B;AACpD,QAAI;AACF,YAAM,aAAa,MAAS;AAAA,IAC9B,QAAQ;AAAA,IAER,UAAE;AACA,kBAAY,MAAM;AAClB,aAAO,SAAS,OAAO,sBAAsB,CAAC;AAAA,IAChD;AAAA,EACF,GAAG,CAAC,aAAa,cAAc,qBAAqB,CAAC;AAErD,QAAM,QAA0B;AAAA,IAC9B,OAAO;AAAA,MACL,MAAM,QAAQ;AAAA,MACd,SAAS,WAAW;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,MAAM,SAAS,iBAAiB,WAAW,OAAO,UAAU,MAAM;AAAA,EACrE;AAEA,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACvD;AAEO,SAAS,UAA4B;AAC1C,QAAM,UAAU,WAAW,WAAW;AAEtC,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AAEA,SAAO;AACT;","names":["data"]}
|
|
@@ -49,8 +49,8 @@ function QueryProvider({
|
|
|
49
49
|
() => new QueryClient({
|
|
50
50
|
defaultOptions: {
|
|
51
51
|
queries: {
|
|
52
|
-
staleTime:
|
|
53
|
-
gcTime:
|
|
52
|
+
staleTime: 5 * 60 * 1e3,
|
|
53
|
+
gcTime: 4 * 60 * 60 * 1e3,
|
|
54
54
|
refetchOnWindowFocus: false,
|
|
55
55
|
refetchOnReconnect: true,
|
|
56
56
|
retry: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/query.provider.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n QueryCache,\r\n QueryClient,\r\n QueryClientProvider,\r\n} from \"@tanstack/react-query\";\r\nimport { ReactNode, useEffect, useState } from \"react\";\r\nimport dynamic from \"next/dynamic\";\r\nimport { toast } from \"sonner\";\r\nimport {\r\n PersistedClient,\r\n PersistQueryClientProvider,\r\n} from \"@tanstack/react-query-persist-client\";\r\nimport { broadcastQueryClient } from \"@tanstack/query-broadcast-client-experimental\";\r\nimport { set, get, del } from \"idb-keyval\";\r\n\r\n// React Query Devtools só em desenvolvimento - remove do bundle de produção\r\nconst ReactQueryDevtools =\r\n process.env.NODE_ENV === \"development\"\r\n ? dynamic(\r\n () =>\r\n import(\"@tanstack/react-query-devtools\").then((mod) => ({\r\n default: mod.ReactQueryDevtools,\r\n })),\r\n { ssr: false },\r\n )\r\n : () => null;\r\n\r\nexport const persister = {\r\n persistClient: async (client: PersistedClient) => {\r\n try {\r\n await set(\"rq-cache\", client);\r\n } catch {\r\n console.warn(\"Falha ao persistir cache\");\r\n }\r\n },\r\n restoreClient: async (): Promise<PersistedClient | undefined> => {\r\n try {\r\n return await get(\"rq-cache\");\r\n } catch {\r\n await del(\"rq-cache\").catch(() => {});\r\n return undefined;\r\n }\r\n },\r\n removeClient: async () => {\r\n try {\r\n await del(\"rq-cache\");\r\n } catch {\r\n console.warn(\"Falha ao remover cache\");\r\n }\r\n },\r\n};\r\n\r\ninterface QueryProviderProps {\r\n children: ReactNode;\r\n persisterVersion?: string;\r\n}\r\n\r\nexport function QueryProvider({\r\n children,\r\n persisterVersion = \"v1\",\r\n}: QueryProviderProps) {\r\n const [queryClient] = useState(\r\n () =>\r\n new QueryClient({\r\n defaultOptions: {\r\n queries: {\r\n staleTime:
|
|
1
|
+
{"version":3,"sources":["../../src/providers/query.provider.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n QueryCache,\r\n QueryClient,\r\n QueryClientProvider,\r\n} from \"@tanstack/react-query\";\r\nimport { ReactNode, useEffect, useState } from \"react\";\r\nimport dynamic from \"next/dynamic\";\r\nimport { toast } from \"sonner\";\r\nimport {\r\n PersistedClient,\r\n PersistQueryClientProvider,\r\n} from \"@tanstack/react-query-persist-client\";\r\nimport { broadcastQueryClient } from \"@tanstack/query-broadcast-client-experimental\";\r\nimport { set, get, del } from \"idb-keyval\";\r\n\r\n// React Query Devtools só em desenvolvimento - remove do bundle de produção\r\nconst ReactQueryDevtools =\r\n process.env.NODE_ENV === \"development\"\r\n ? dynamic(\r\n () =>\r\n import(\"@tanstack/react-query-devtools\").then((mod) => ({\r\n default: mod.ReactQueryDevtools,\r\n })),\r\n { ssr: false },\r\n )\r\n : () => null;\r\n\r\nexport const persister = {\r\n persistClient: async (client: PersistedClient) => {\r\n try {\r\n await set(\"rq-cache\", client);\r\n } catch {\r\n console.warn(\"Falha ao persistir cache\");\r\n }\r\n },\r\n restoreClient: async (): Promise<PersistedClient | undefined> => {\r\n try {\r\n return await get(\"rq-cache\");\r\n } catch {\r\n await del(\"rq-cache\").catch(() => {});\r\n return undefined;\r\n }\r\n },\r\n removeClient: async () => {\r\n try {\r\n await del(\"rq-cache\");\r\n } catch {\r\n console.warn(\"Falha ao remover cache\");\r\n }\r\n },\r\n};\r\n\r\ninterface QueryProviderProps {\r\n children: ReactNode;\r\n persisterVersion?: string;\r\n}\r\n\r\nexport function QueryProvider({\r\n children,\r\n persisterVersion = \"v1\",\r\n}: QueryProviderProps) {\r\n const [queryClient] = useState(\r\n () =>\r\n new QueryClient({\r\n defaultOptions: {\r\n queries: {\r\n staleTime: 5 * 60 * 1000,\r\n gcTime: 4 * 60 * 60 * 1000,\r\n refetchOnWindowFocus: false,\r\n refetchOnReconnect: true,\r\n retry: 2,\r\n retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 30000),\r\n },\r\n mutations: {\r\n retry: false,\r\n },\r\n },\r\n }),\r\n );\r\n\r\n useEffect(() => {\r\n broadcastQueryClient({\r\n queryClient,\r\n broadcastChannel: \"react-query\",\r\n });\r\n }, [queryClient]);\r\n\r\n return (\r\n <PersistQueryClientProvider\r\n client={queryClient}\r\n persistOptions={{\r\n persister,\r\n maxAge: 2 * 60 * 60 * 1000,\r\n buster: persisterVersion,\r\n dehydrateOptions: {\r\n shouldDehydrateQuery: (query) => {\r\n if (query.state.status === \"error\") return false;\r\n if (query.meta?.persist === false) return false;\r\n if ((query.state.dataUpdateCount ?? 0) > 10) return false;\r\n return true;\r\n },\r\n },\r\n }}\r\n >\r\n {children}\r\n <ReactQueryDevtools initialIsOpen={false} />\r\n </PersistQueryClientProvider>\r\n );\r\n}\r\n"],"mappings":";AA0FI,SAiBE,KAjBF;AAxFJ;AAAA,EAEE;AAAA,OAEK;AACP,SAAoB,WAAW,gBAAgB;AAC/C,OAAO,aAAa;AAEpB;AAAA,EAEE;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,KAAK,KAAK,WAAW;AAG9B,MAAM,qBACJ,QAAQ,IAAI,aAAa,gBACrB;AAAA,EACE,MACE,OAAO,gCAAgC,EAAE,KAAK,CAAC,SAAS;AAAA,IACtD,SAAS,IAAI;AAAA,EACf,EAAE;AAAA,EACJ,EAAE,KAAK,MAAM;AACf,IACA,MAAM;AAEL,MAAM,YAAY;AAAA,EACvB,eAAe,OAAO,WAA4B;AAChD,QAAI;AACF,YAAM,IAAI,YAAY,MAAM;AAAA,IAC9B,QAAQ;AACN,cAAQ,KAAK,0BAA0B;AAAA,IACzC;AAAA,EACF;AAAA,EACA,eAAe,YAAkD;AAC/D,QAAI;AACF,aAAO,MAAM,IAAI,UAAU;AAAA,IAC7B,QAAQ;AACN,YAAM,IAAI,UAAU,EAAE,MAAM,MAAM;AAAA,MAAC,CAAC;AACpC,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,cAAc,YAAY;AACxB,QAAI;AACF,YAAM,IAAI,UAAU;AAAA,IACtB,QAAQ;AACN,cAAQ,KAAK,wBAAwB;AAAA,IACvC;AAAA,EACF;AACF;AAOO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,mBAAmB;AACrB,GAAuB;AACrB,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS;AAAA,UACP,WAAW,IAAI,KAAK;AAAA,UACpB,QAAQ,IAAI,KAAK,KAAK;AAAA,UACtB,sBAAsB;AAAA,UACtB,oBAAoB;AAAA,UACpB,OAAO;AAAA,UACP,YAAY,CAAC,YAAY,KAAK,IAAI,MAAO,KAAK,SAAS,GAAK;AAAA,QAC9D;AAAA,QACA,WAAW;AAAA,UACT,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACL;AAEA,YAAU,MAAM;AACd,yBAAqB;AAAA,MACnB;AAAA,MACA,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH,GAAG,CAAC,WAAW,CAAC;AAEhB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR,gBAAgB;AAAA,QACd;AAAA,QACA,QAAQ,IAAI,KAAK,KAAK;AAAA,QACtB,QAAQ;AAAA,QACR,kBAAkB;AAAA,UAChB,sBAAsB,CAAC,UAAU;AAC/B,gBAAI,MAAM,MAAM,WAAW,QAAS,QAAO;AAC3C,gBAAI,MAAM,MAAM,YAAY,MAAO,QAAO;AAC1C,iBAAK,MAAM,MAAM,mBAAmB,KAAK,GAAI,QAAO;AACpD,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,QACD,oBAAC,sBAAmB,eAAe,OAAO;AAAA;AAAA;AAAA,EAC5C;AAEJ;","names":[]}
|
|
@@ -24,10 +24,6 @@ function useWhitelabelStyles() {
|
|
|
24
24
|
dashboard: whitelabel?.dashboard ?? null
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function useIsDefaultWhitelabel() {
|
|
28
|
-
const context = useContext(WhitelabelContext);
|
|
29
|
-
return !context?.whitelabel || context.whitelabel.id === 1;
|
|
30
|
-
}
|
|
31
27
|
function useWhitelabelUrls() {
|
|
32
28
|
const { whitelabel } = useWhitelabel();
|
|
33
29
|
return {
|
|
@@ -39,7 +35,6 @@ function useWhitelabelUrls() {
|
|
|
39
35
|
}
|
|
40
36
|
export {
|
|
41
37
|
WhitelabelProvider,
|
|
42
|
-
useIsDefaultWhitelabel,
|
|
43
38
|
useWhitelabel,
|
|
44
39
|
useWhitelabelStyles,
|
|
45
40
|
useWhitelabelUrls
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/whitelabel.provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, ReactNode, useContext } from \"react\";\nimport type { WhitelabelData, GeneralStyleJson, PageStyleJson, DashboardStyleJson } from \"../modules/whitelabel/schema\";\n\ninterface WhitelabelContextProps {\n whitelabel: WhitelabelData | null;\n}\n\nconst WhitelabelContext = createContext<WhitelabelContextProps | undefined>(undefined);\n\ninterface WhitelabelProviderProps {\n children: ReactNode;\n whitelabel: WhitelabelData | null;\n}\n\nexport function WhitelabelProvider({\n children,\n whitelabel,\n}: WhitelabelProviderProps) {\n return (\n <WhitelabelContext.Provider value={{ whitelabel }}>\n {children}\n </WhitelabelContext.Provider>\n );\n}\n\nexport function useWhitelabel(): WhitelabelContextProps {\n const context = useContext(WhitelabelContext);\n if (context === undefined) {\n throw new Error(\"useWhitelabel deve ser usado dentro de um WhitelabelProvider\");\n }\n return context;\n}\n\nexport function useWhitelabelStyles() {\n const { whitelabel } = useWhitelabel();\n return {\n general: whitelabel?.general ?? null,\n signin_page: whitelabel?.signin_page ?? null,\n signup_page: whitelabel?.signup_page ?? null,\n dashboard: whitelabel?.dashboard ?? null,\n };\n}\n\nexport function
|
|
1
|
+
{"version":3,"sources":["../../src/providers/whitelabel.provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, ReactNode, useContext } from \"react\";\nimport type { WhitelabelData, GeneralStyleJson, PageStyleJson, DashboardStyleJson } from \"../modules/whitelabel/schema\";\n\ninterface WhitelabelContextProps {\n whitelabel: WhitelabelData | null;\n}\n\nconst WhitelabelContext = createContext<WhitelabelContextProps | undefined>(undefined);\n\ninterface WhitelabelProviderProps {\n children: ReactNode;\n whitelabel: WhitelabelData | null;\n}\n\nexport function WhitelabelProvider({\n children,\n whitelabel,\n}: WhitelabelProviderProps) {\n return (\n <WhitelabelContext.Provider value={{ whitelabel }}>\n {children}\n </WhitelabelContext.Provider>\n );\n}\n\nexport function useWhitelabel(): WhitelabelContextProps {\n const context = useContext(WhitelabelContext);\n if (context === undefined) {\n throw new Error(\"useWhitelabel deve ser usado dentro de um WhitelabelProvider\");\n }\n return context;\n}\n\nexport function useWhitelabelStyles() {\n const { whitelabel } = useWhitelabel();\n return {\n general: whitelabel?.general ?? null,\n signin_page: whitelabel?.signin_page ?? null,\n signup_page: whitelabel?.signup_page ?? null,\n dashboard: whitelabel?.dashboard ?? null,\n };\n}\n\nexport function useWhitelabelUrls() {\n const { whitelabel } = useWhitelabel();\n return {\n editorUrl: whitelabel?.editor_url ?? '',\n pagesUrl: whitelabel?.pages_url ?? '',\n accountsUrl: whitelabel?.accounts_url ?? '',\n previewUrl: whitelabel?.pages_preview_url ?? '',\n };\n}\n"],"mappings":";AAqBI;AAnBJ,SAAS,eAA0B,kBAAkB;AAOrD,MAAM,oBAAoB,cAAkD,MAAS;AAO9E,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAA4B;AAC1B,SACE,oBAAC,kBAAkB,UAAlB,EAA2B,OAAO,EAAE,WAAW,GAC7C,UACH;AAEJ;AAEO,SAAS,gBAAwC;AACtD,QAAM,UAAU,WAAW,iBAAiB;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AACA,SAAO;AACT;AAEO,SAAS,sBAAsB;AACpC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO;AAAA,IACL,SAAS,YAAY,WAAW;AAAA,IAChC,aAAa,YAAY,eAAe;AAAA,IACxC,aAAa,YAAY,eAAe;AAAA,IACxC,WAAW,YAAY,aAAa;AAAA,EACtC;AACF;AAEO,SAAS,oBAAoB;AAClC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO;AAAA,IACL,WAAW,YAAY,cAAc;AAAA,IACrC,UAAU,YAAY,aAAa;AAAA,IACnC,aAAa,YAAY,gBAAgB;AAAA,IACzC,YAAY,YAAY,qBAAqB;AAAA,EAC/C;AACF;","names":[]}
|
package/dist/server.mjs
CHANGED
|
@@ -15,7 +15,6 @@ import { findWhitelabel } from "./modules/whitelabel/actions/find-whitelabel.act
|
|
|
15
15
|
import { validateSessionAction } from "./modules/auth/actions/validate-session.action";
|
|
16
16
|
import { findUserById } from "./modules/users/action/find-user-by-id.action";
|
|
17
17
|
import { findCurrentAccount } from "./modules/accounts/actions/find-current-account.action";
|
|
18
|
-
import { getAccountTokenAction } from "./modules/accounts/actions/get-account-token.action";
|
|
19
18
|
import { listSubscriptionsAction } from "./modules/subscriptions/actions/list-subscriptions.action";
|
|
20
19
|
import { findPlanByIdAction } from "./modules/plans/actions/find-plan-by-id.action";
|
|
21
20
|
import { listPlansAction } from "./modules/plans/actions/list-plans.action";
|
|
@@ -26,12 +25,6 @@ import { createCardAction } from "./modules/cards/actions/create-card.action";
|
|
|
26
25
|
import { resolvePlanExtrasPrices } from "./modules/subscriptions/utils/resolve-plan-extras-prices";
|
|
27
26
|
import { hasSubscriptionExpired } from "./modules/subscriptions/utils/has-subscription-expired";
|
|
28
27
|
import { listIaCreditsAction } from "./modules/ia-credits/actions/list-ia-credits.action";
|
|
29
|
-
import { projectsService } from "./modules/projects/services/projects.service";
|
|
30
|
-
import { listProjectsAction } from "./modules/projects/actions/list-projects.action";
|
|
31
|
-
import { findProjectAction } from "./modules/projects/actions/find-project.action";
|
|
32
|
-
import { createProjectAction } from "./modules/projects/actions/create-project.action";
|
|
33
|
-
import { updateProjectAction } from "./modules/projects/actions/update-project.action";
|
|
34
|
-
import { deleteProjectAction } from "./modules/projects/actions/delete-project.action";
|
|
35
28
|
import { projectUsersService } from "./modules/projects/services/project-users.service";
|
|
36
29
|
import { listProjectUsersAction } from "./modules/projects/actions/list-project-users.action";
|
|
37
30
|
import { listAvailableUsersAction } from "./modules/projects/actions/list-available-users.action";
|
|
@@ -83,18 +76,14 @@ export {
|
|
|
83
76
|
confirmTwoFactorAction,
|
|
84
77
|
createAccountUserAction,
|
|
85
78
|
createCardAction,
|
|
86
|
-
createProjectAction,
|
|
87
79
|
deleteAccountAction,
|
|
88
80
|
deleteAccountUserAction,
|
|
89
|
-
deleteProjectAction,
|
|
90
81
|
disableTwoFactorAction,
|
|
91
82
|
findCurrentAccount,
|
|
92
83
|
findPlanByIdAction,
|
|
93
|
-
findProjectAction,
|
|
94
84
|
findUserById,
|
|
95
85
|
findWhitelabel,
|
|
96
86
|
generateTwoFactorAction,
|
|
97
|
-
getAccountTokenAction,
|
|
98
87
|
getClientInfoFromRequest,
|
|
99
88
|
getUserContext,
|
|
100
89
|
hasSubscriptionExpired,
|
|
@@ -105,13 +94,11 @@ export {
|
|
|
105
94
|
listIaCreditsAction,
|
|
106
95
|
listPlansAction,
|
|
107
96
|
listProjectUsersAction,
|
|
108
|
-
listProjectsAction,
|
|
109
97
|
listSubscriptionsAction,
|
|
110
98
|
plansService,
|
|
111
99
|
processImage,
|
|
112
100
|
processImageAction,
|
|
113
101
|
projectUsersService,
|
|
114
|
-
projectsService,
|
|
115
102
|
removeProjectUserAction,
|
|
116
103
|
requestEmailChangeAction,
|
|
117
104
|
requestPhoneChangeAction,
|
|
@@ -122,7 +109,6 @@ export {
|
|
|
122
109
|
twoFactorService,
|
|
123
110
|
updateAccountAction,
|
|
124
111
|
updateAccountUserByIdAction,
|
|
125
|
-
updateProjectAction,
|
|
126
112
|
updateSubscriptionPlanAction,
|
|
127
113
|
updateUserAction,
|
|
128
114
|
validateSessionAction,
|
package/dist/server.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\r\n\r\n// API Client\r\nexport { ApiClient, api, apiClient } from './infra/api/client';\r\n\r\n// Services\r\nexport { authService } from './modules/auth/services/auth.service';\r\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\r\nexport { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';\r\nexport { assertManagementPermission } from './modules/auth/utils/assert-management-permission';\r\nexport { assertManagementSubscription } from './modules/auth/utils/assert-management-subscription';\r\nexport { assertSubscriptionAddon } from './modules/auth/utils/assert-subscription-addon';\r\nexport { assertPaidSubscription } from './modules/auth/utils/assert-paid-subscription';\r\nexport { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';\r\nexport { plansService } from './modules/plans/services/plans.service';\r\nexport { cardsService } from './modules/cards/services/cards.service';\r\nexport { iaCreditsService } from './modules/ia-credits/services/ia-credits.service';\r\n\r\n// Actions\r\nexport { findWhitelabel } from './modules/whitelabel/actions/find-whitelabel.action';\r\nexport { validateSessionAction } from './modules/auth/actions/validate-session.action';\r\nexport { findUserById } from './modules/users/action/find-user-by-id.action';\r\nexport { findCurrentAccount } from './modules/accounts/actions/find-current-account.action';\r\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\r\n\r\n// API Client\r\nexport { ApiClient, api, apiClient } from './infra/api/client';\r\n\r\n// Services\r\nexport { authService } from './modules/auth/services/auth.service';\r\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\r\nexport { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';\r\nexport { assertManagementPermission } from './modules/auth/utils/assert-management-permission';\r\nexport { assertManagementSubscription } from './modules/auth/utils/assert-management-subscription';\r\nexport { assertSubscriptionAddon } from './modules/auth/utils/assert-subscription-addon';\r\nexport { assertPaidSubscription } from './modules/auth/utils/assert-paid-subscription';\r\nexport { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';\r\nexport { plansService } from './modules/plans/services/plans.service';\r\nexport { cardsService } from './modules/cards/services/cards.service';\r\nexport { iaCreditsService } from './modules/ia-credits/services/ia-credits.service';\r\n\r\n// Actions\r\nexport { findWhitelabel } from './modules/whitelabel/actions/find-whitelabel.action';\r\nexport { validateSessionAction } from './modules/auth/actions/validate-session.action';\r\nexport { findUserById } from './modules/users/action/find-user-by-id.action';\r\nexport { findCurrentAccount } from './modules/accounts/actions/find-current-account.action';\r\nexport { listSubscriptionsAction } from './modules/subscriptions/actions/list-subscriptions.action';\r\nexport { findPlanByIdAction } from './modules/plans/actions/find-plan-by-id.action';\r\nexport { listPlansAction } from './modules/plans/actions/list-plans.action';\r\nexport { calculateSubscriptionAction } from './modules/subscriptions/actions/calculate-subscription.action';\r\nexport { updateSubscriptionPlanAction } from './modules/subscriptions/actions/update-subscription-plan.action';\r\nexport { listCardsAction } from './modules/cards/actions/list-cards.action';\r\nexport { createCardAction } from './modules/cards/actions/create-card.action';\r\nexport { resolvePlanExtrasPrices } from './modules/subscriptions/utils/resolve-plan-extras-prices';\r\nexport { hasSubscriptionExpired } from './modules/subscriptions/utils/has-subscription-expired';\r\nexport { listIaCreditsAction } from './modules/ia-credits/actions/list-ia-credits.action';\r\n\r\n// Project Users Services & Actions (server-only)\r\nexport { projectUsersService } from './modules/projects/services/project-users.service';\r\nexport { listProjectUsersAction } from './modules/projects/actions/list-project-users.action';\r\nexport { listAvailableUsersAction } from './modules/projects/actions/list-available-users.action';\r\nexport { addProjectUserAction } from './modules/projects/actions/add-project-user.action';\r\nexport { removeProjectUserAction } from './modules/projects/actions/remove-project-user.action';\r\n\r\n// Account Services & Actions (server-only)\r\nexport { accountService } from './modules/accounts/services/account.service';\r\nexport { twoFactorService } from './modules/accounts/services/two-factor.service';\r\nexport {\r\n listAccountUsersAction,\r\n updateUserAction,\r\n updateAccountAction,\r\n updateAccountUserByIdAction,\r\n deleteAccountUserAction,\r\n deleteAccountAction,\r\n createAccountUserAction,\r\n changePasswordAction,\r\n requestEmailChangeAction,\r\n confirmEmailChangeAction,\r\n requestPhoneChangeAction,\r\n confirmPhoneChangeAction,\r\n generateTwoFactorAction,\r\n confirmTwoFactorAction,\r\n disableTwoFactorAction,\r\n} from './modules/accounts/actions/account-management.action';\r\n\r\n// Server Utils\r\nexport { getClientInfoFromRequest } from './infra/utils/client-info';\r\nexport { getUserContext } from './modules/auth/utils/get-user-context';\r\nexport { buildWlOverride, buildWlOverrideFromJwt } from './modules/auth/utils/build-wl-override';\r\nexport { safeServerAction } from './utils/safeServerAction';\r\n\r\n// Image Processing (server-side)\r\nexport { processImageAction } from './modules/images/actions/process-image.action';\r\nexport { processImage } from './modules/images/services/image-processing.service';\r\nexport type {\r\n ProcessImageInput,\r\n ProcessImageOutput,\r\n ProcessImageActionInput,\r\n ProcessImageActionOutput,\r\n} from './modules/images/types/image.type';\r\n"],"mappings":"AAAA,OAAO;AAGP,SAAS,WAAW,KAAK,iBAAiB;AAG1C,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,oCAAoC;AAC7C,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AAGpC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AAGxC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB,8BAA8B;AACxD,SAAS,wBAAwB;AAGjC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;","names":[]}
|
package/package.json
CHANGED
|
@@ -74,39 +74,16 @@ const baseCropStyles = `
|
|
|
74
74
|
pointer-events: none;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
/*
|
|
78
|
-
.custom-crop-area .
|
|
79
|
-
|
|
80
|
-
width: 10px;
|
|
81
|
-
height: 10px;
|
|
82
|
-
background: white;
|
|
83
|
-
border-radius: 50%;
|
|
84
|
-
pointer-events: none;
|
|
85
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.custom-crop-area .ReactCrop__crop-selection .crop-handle.top {
|
|
89
|
-
top: -5px;
|
|
90
|
-
left: 50%;
|
|
91
|
-
transform: translateX(-50%);
|
|
77
|
+
/* Ocultar handles nativos do react-image-crop */
|
|
78
|
+
.custom-crop-area .ReactCrop__drag-handle {
|
|
79
|
+
display: none !important;
|
|
92
80
|
}
|
|
93
81
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.custom-crop-area .ReactCrop__crop-selection .crop-handle.left {
|
|
101
|
-
left: -5px;
|
|
102
|
-
top: 50%;
|
|
103
|
-
transform: translateY(-50%);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.custom-crop-area .ReactCrop__crop-selection .crop-handle.right {
|
|
107
|
-
right: -5px;
|
|
108
|
-
top: 50%;
|
|
109
|
-
transform: translateY(-50%);
|
|
82
|
+
/* Desabilitar drag da imagem de fundo */
|
|
83
|
+
.custom-crop-area img {
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
user-select: none;
|
|
86
|
+
-webkit-user-drag: none;
|
|
110
87
|
}
|
|
111
88
|
`
|
|
112
89
|
|
|
@@ -194,11 +171,6 @@ export function ImageCropModal({
|
|
|
194
171
|
</div>
|
|
195
172
|
{/* Círculo inscrito */}
|
|
196
173
|
{shouldShowCircle && <div className="crop-circle" />}
|
|
197
|
-
{/* Bolinhas centrais nas bordas */}
|
|
198
|
-
<div className="crop-handle top" />
|
|
199
|
-
<div className="crop-handle bottom" />
|
|
200
|
-
<div className="crop-handle left" />
|
|
201
|
-
<div className="crop-handle right" />
|
|
202
174
|
</>
|
|
203
175
|
)
|
|
204
176
|
|
|
@@ -232,7 +204,8 @@ export function ImageCropModal({
|
|
|
232
204
|
src={imageSrc}
|
|
233
205
|
alt="Crop"
|
|
234
206
|
onLoad={onImageLoad}
|
|
235
|
-
|
|
207
|
+
draggable={false}
|
|
208
|
+
className="max-h-[50vh] object-contain select-none"
|
|
236
209
|
/>
|
|
237
210
|
</ReactCrop>
|
|
238
211
|
</div>
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { IconCheck, IconCopy, IconInfoCircle } from "@tabler/icons-react";
|
|
4
|
-
import { toast } from "sonner";
|
|
5
|
-
import { Toast } from "../../ui/feedback/Toast";
|
|
6
|
-
import { Button } from "../../ui/buttons/Button";
|
|
7
|
-
import { FormField } from "../../ui/form/FormField";
|
|
8
|
-
import useCopyToClipboard from "../../../hooks/copy-to-clipboard.hook";
|
|
9
|
-
import { useAccountToken } from "../../../modules/accounts/hooks/use-account-token.hook";
|
|
10
|
-
import { useIsDefaultWhitelabel } from "../../../providers/whitelabel.provider";
|
|
11
|
-
function TokenSection() {
|
|
12
|
-
const { data: token = "", isLoading } = useAccountToken();
|
|
13
|
-
const isDefaultWl = useIsDefaultWhitelabel();
|
|
14
|
-
const { isCopied, copy } = useCopyToClipboard({
|
|
15
|
-
onSuccess: () => {
|
|
16
|
-
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Token copiado com sucesso", toastId: t }));
|
|
17
|
-
},
|
|
18
|
-
onError: () => {
|
|
19
|
-
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "N\xE3o foi poss\xEDvel copiar o token", toastId: t }));
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return /* @__PURE__ */ jsxs("div", { className: "h-full overflow-y-auto overscroll-contain px-4 pb-20 lg:p-5 lg:pt-5 flex flex-col gap-5 lg:gap-6 lg:pb-31 lg:overscroll-auto", children: [
|
|
23
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: "Token da conta" }),
|
|
24
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
25
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-3", children: [
|
|
26
|
-
/* @__PURE__ */ jsx(
|
|
27
|
-
FormField,
|
|
28
|
-
{
|
|
29
|
-
label: "Token",
|
|
30
|
-
value: isLoading ? "Carregando..." : token,
|
|
31
|
-
disabled: true,
|
|
32
|
-
readOnly: true,
|
|
33
|
-
classnameContainer: "bg-gray-50 cursor-default opacity-100!",
|
|
34
|
-
className: "text-gray-950/50"
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
/* @__PURE__ */ jsxs(
|
|
38
|
-
Button,
|
|
39
|
-
{
|
|
40
|
-
type: "button",
|
|
41
|
-
variant: "secondary",
|
|
42
|
-
className: "h-10! shrink-0 gap-2",
|
|
43
|
-
onClick: () => copy(token),
|
|
44
|
-
disabled: isLoading || !token,
|
|
45
|
-
children: [
|
|
46
|
-
isCopied ? /* @__PURE__ */ jsx(IconCheck, { size: 16 }) : /* @__PURE__ */ jsx(IconCopy, { size: 16 }),
|
|
47
|
-
isCopied ? "Copiado" : "Copiar"
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
] }),
|
|
52
|
-
/* @__PURE__ */ jsxs("div", { className: `flex items-center gap-3 p-4 rounded-lg ${isDefaultWl ? "bg-cyan-50" : "bg-zinc-50"}`, children: [
|
|
53
|
-
/* @__PURE__ */ jsx(IconInfoCircle, { className: "size-4 text-zinc-950 shrink-0" }),
|
|
54
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-950 max-w-[420px]", children: "Este token \xE9 exclusivo da sua conta e permite acesso \xE0 API. N\xE3o compartilhe com terceiros." })
|
|
55
|
-
] }),
|
|
56
|
-
/* @__PURE__ */ jsx(
|
|
57
|
-
"a",
|
|
58
|
-
{
|
|
59
|
-
href: "https://documenter.getpostman.com/view/4861938/2sAYdoDmj4",
|
|
60
|
-
target: "_blank",
|
|
61
|
-
rel: "noopener noreferrer",
|
|
62
|
-
className: "paragraph-small-medium text-gray-500 underline hover:text-gray-700 transition-colors w-fit",
|
|
63
|
-
children: "Acessar a documenta\xE7\xE3o"
|
|
64
|
-
}
|
|
65
|
-
)
|
|
66
|
-
] })
|
|
67
|
-
] });
|
|
68
|
-
}
|
|
69
|
-
export {
|
|
70
|
-
TokenSection
|
|
71
|
-
};
|
|
72
|
-
//# sourceMappingURL=TokenSection.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/account/sections/TokenSection.tsx"],"sourcesContent":["'use client';\n\nimport { IconCheck, IconCopy, IconInfoCircle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { Button } from '../../ui/buttons/Button';\nimport { FormField } from '../../ui/form/FormField';\nimport useCopyToClipboard from '../../../hooks/copy-to-clipboard.hook';\nimport { useAccountToken } from '../../../modules/accounts/hooks/use-account-token.hook';\nimport { useIsDefaultWhitelabel } from '../../../providers/whitelabel.provider';\n\nexport function TokenSection() {\n const { data: token = '', isLoading } = useAccountToken();\n const isDefaultWl = useIsDefaultWhitelabel();\n\n const { isCopied, copy } = useCopyToClipboard({\n onSuccess: () => {\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Token copiado com sucesso\" toastId={t} />\n ));\n },\n onError: () => {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Não foi possível copiar o token\" toastId={t} />\n ));\n },\n });\n\n return (\n <div className=\"h-full overflow-y-auto overscroll-contain px-4 pb-20 lg:p-5 lg:pt-5 flex flex-col gap-5 lg:gap-6 lg:pb-31 lg:overscroll-auto\">\n <span className=\"paragraph-medium-semibold text-gray-950\">Token da conta</span>\n\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-end gap-3\">\n <FormField\n label=\"Token\"\n value={isLoading ? 'Carregando...' : token}\n disabled\n readOnly\n classnameContainer=\"bg-gray-50 cursor-default opacity-100!\"\n className=\"text-gray-950/50\"\n />\n <Button\n type=\"button\"\n variant=\"secondary\"\n className=\"h-10! shrink-0 gap-2\"\n onClick={() => copy(token)}\n disabled={isLoading || !token}\n >\n {isCopied ? <IconCheck size={16} /> : <IconCopy size={16} />}\n {isCopied ? 'Copiado' : 'Copiar'}\n </Button>\n </div>\n\n <div className={`flex items-center gap-3 p-4 rounded-lg ${isDefaultWl ? 'bg-cyan-50' : 'bg-zinc-50'}`}>\n <IconInfoCircle className=\"size-4 text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-regular text-zinc-950 max-w-[420px]\">\n Este token é exclusivo da sua conta e permite acesso à API. Não compartilhe com terceiros.\n </span>\n </div>\n\n <a\n href=\"https://documenter.getpostman.com/view/4861938/2sAYdoDmj4\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"paragraph-small-medium text-gray-500 underline hover:text-gray-700 transition-colors w-fit\"\n >\n Acessar a documentação\n </a>\n </div>\n </div>\n );\n}\n"],"mappings":";AAkBQ,cAwBE,YAxBF;AAhBR,SAAS,WAAW,UAAU,sBAAsB;AACpD,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,OAAO,wBAAwB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AAEhC,SAAS,eAAe;AAC7B,QAAM,EAAE,MAAM,QAAQ,IAAI,UAAU,IAAI,gBAAgB;AACxD,QAAM,cAAc,uBAAuB;AAE3C,QAAM,EAAE,UAAU,KAAK,IAAI,mBAAmB;AAAA,IAC5C,WAAW,MAAM;AACf,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,WAAU,SAAQ,6BAA4B,SAAS,GAAG,CAC1E;AAAA,IACH;AAAA,IACA,SAAS,MAAM;AACb,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAQ,yCAAkC,SAAS,GAAG,CAC9E;AAAA,IACH;AAAA,EACF,CAAC;AAED,SACE,qBAAC,SAAI,WAAU,gIACb;AAAA,wBAAC,UAAK,WAAU,2CAA0C,4BAAc;AAAA,IAExE,qBAAC,SAAI,WAAU,uBACb;AAAA,2BAAC,SAAI,WAAU,wBACb;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,OAAO,YAAY,kBAAkB;AAAA,YACrC,UAAQ;AAAA,YACR,UAAQ;AAAA,YACR,oBAAmB;AAAA,YACnB,WAAU;AAAA;AAAA,QACZ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,SAAS,MAAM,KAAK,KAAK;AAAA,YACzB,UAAU,aAAa,CAAC;AAAA,YAEvB;AAAA,yBAAW,oBAAC,aAAU,MAAM,IAAI,IAAK,oBAAC,YAAS,MAAM,IAAI;AAAA,cACzD,WAAW,YAAY;AAAA;AAAA;AAAA,QAC1B;AAAA,SACF;AAAA,MAEA,qBAAC,SAAI,WAAW,0CAA0C,cAAc,eAAe,YAAY,IACjG;AAAA,4BAAC,kBAAe,WAAU,iCAAgC;AAAA,QAC1D,oBAAC,UAAK,WAAU,uDAAsD,iHAEtE;AAAA,SACF;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,QAAO;AAAA,UACP,KAAI;AAAA,UACJ,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
import { useAuth } from "../../providers/auth.provider";
|
|
4
|
-
const CLARITY_PROJECT_ID = "rc99jr00nn";
|
|
5
|
-
const CLARITY_SCRIPT_BASE = "https://www.clarity.ms/tag/";
|
|
6
|
-
const CLARITY_LOAD_DELAY = 800;
|
|
7
|
-
function loadClarityScript() {
|
|
8
|
-
try {
|
|
9
|
-
const win = window;
|
|
10
|
-
win.clarity = win.clarity || function(...args) {
|
|
11
|
-
(win.clarity.q = win.clarity.q || []).push(args);
|
|
12
|
-
};
|
|
13
|
-
const src = CLARITY_SCRIPT_BASE + CLARITY_PROJECT_ID;
|
|
14
|
-
if (document.querySelector(`script[src="${src}"]`)) return;
|
|
15
|
-
const t = document.createElement("script");
|
|
16
|
-
t.async = true;
|
|
17
|
-
t.src = src;
|
|
18
|
-
const y = document.getElementsByTagName("script")[0];
|
|
19
|
-
y?.parentNode?.insertBefore(t, y);
|
|
20
|
-
} catch {
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function identifyClarityUser(user) {
|
|
24
|
-
try {
|
|
25
|
-
if (!window.clarity) return;
|
|
26
|
-
const fullName = `${user.name ?? ""} ${user.last_name ?? ""}`.trim();
|
|
27
|
-
window.clarity("identify", String(user.id ?? ""), void 0, void 0, fullName || void 0);
|
|
28
|
-
if (user.email) window.clarity("set", "email", user.email);
|
|
29
|
-
} catch {
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function ClarityEmbed() {
|
|
33
|
-
const { user } = useAuth();
|
|
34
|
-
const scriptLoadedRef = useRef(false);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!user || scriptLoadedRef.current) return;
|
|
37
|
-
const timeout = setTimeout(() => {
|
|
38
|
-
try {
|
|
39
|
-
loadClarityScript();
|
|
40
|
-
scriptLoadedRef.current = true;
|
|
41
|
-
} catch {
|
|
42
|
-
}
|
|
43
|
-
}, CLARITY_LOAD_DELAY);
|
|
44
|
-
return () => clearTimeout(timeout);
|
|
45
|
-
}, [user]);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!user || !scriptLoadedRef.current) return;
|
|
48
|
-
identifyClarityUser(user);
|
|
49
|
-
}, [user]);
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
ClarityEmbed
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=ClarityEmbed.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/embeds/ClarityEmbed.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport { useAuth } from '../../providers/auth.provider';\n\nconst CLARITY_PROJECT_ID = 'rc99jr00nn';\nconst CLARITY_SCRIPT_BASE = 'https://www.clarity.ms/tag/';\nconst CLARITY_LOAD_DELAY = 800;\n\ndeclare global {\n interface Window {\n clarity?: (...args: unknown[]) => void;\n }\n}\n\nfunction loadClarityScript() {\n try {\n const win = window as any;\n win.clarity =\n win.clarity ||\n function (...args: unknown[]) {\n (win.clarity.q = win.clarity.q || []).push(args);\n };\n\n const src = CLARITY_SCRIPT_BASE + CLARITY_PROJECT_ID;\n if (document.querySelector(`script[src=\"${src}\"]`)) return;\n\n const t = document.createElement('script');\n t.async = true;\n t.src = src;\n const y = document.getElementsByTagName('script')[0];\n y?.parentNode?.insertBefore(t, y);\n } catch {}\n}\n\nfunction identifyClarityUser(user: { id?: number; email?: string; name?: string; last_name?: string }) {\n try {\n if (!window.clarity) return;\n\n const fullName = `${user.name ?? ''} ${user.last_name ?? ''}`.trim();\n window.clarity('identify', String(user.id ?? ''), undefined, undefined, fullName || undefined);\n\n if (user.email) window.clarity('set', 'email', user.email);\n } catch {}\n}\n\nexport function ClarityEmbed() {\n const { user } = useAuth();\n const scriptLoadedRef = useRef(false);\n\n useEffect(() => {\n if (!user || scriptLoadedRef.current) return;\n\n const timeout = setTimeout(() => {\n try {\n loadClarityScript();\n scriptLoadedRef.current = true;\n } catch {}\n }, CLARITY_LOAD_DELAY);\n\n return () => clearTimeout(timeout);\n }, [user]);\n\n useEffect(() => {\n if (!user || !scriptLoadedRef.current) return;\n identifyClarityUser(user);\n }, [user]);\n\n return null;\n}\n"],"mappings":";AAEA,SAAS,WAAW,cAAc;AAClC,SAAS,eAAe;AAExB,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAQ3B,SAAS,oBAAoB;AAC3B,MAAI;AACF,UAAM,MAAM;AACZ,QAAI,UACF,IAAI,WACJ,YAAa,MAAiB;AAC5B,OAAC,IAAI,QAAQ,IAAI,IAAI,QAAQ,KAAK,CAAC,GAAG,KAAK,IAAI;AAAA,IACjD;AAEF,UAAM,MAAM,sBAAsB;AAClC,QAAI,SAAS,cAAc,eAAe,GAAG,IAAI,EAAG;AAEpD,UAAM,IAAI,SAAS,cAAc,QAAQ;AACzC,MAAE,QAAQ;AACV,MAAE,MAAM;AACR,UAAM,IAAI,SAAS,qBAAqB,QAAQ,EAAE,CAAC;AACnD,OAAG,YAAY,aAAa,GAAG,CAAC;AAAA,EAClC,QAAQ;AAAA,EAAC;AACX;AAEA,SAAS,oBAAoB,MAA0E;AACrG,MAAI;AACF,QAAI,CAAC,OAAO,QAAS;AAErB,UAAM,WAAW,GAAG,KAAK,QAAQ,EAAE,IAAI,KAAK,aAAa,EAAE,GAAG,KAAK;AACnE,WAAO,QAAQ,YAAY,OAAO,KAAK,MAAM,EAAE,GAAG,QAAW,QAAW,YAAY,MAAS;AAE7F,QAAI,KAAK,MAAO,QAAO,QAAQ,OAAO,SAAS,KAAK,KAAK;AAAA,EAC3D,QAAQ;AAAA,EAAC;AACX;AAEO,SAAS,eAAe;AAC7B,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,kBAAkB,OAAO,KAAK;AAEpC,YAAU,MAAM;AACd,QAAI,CAAC,QAAQ,gBAAgB,QAAS;AAEtC,UAAM,UAAU,WAAW,MAAM;AAC/B,UAAI;AACF,0BAAkB;AAClB,wBAAgB,UAAU;AAAA,MAC5B,QAAQ;AAAA,MAAC;AAAA,IACX,GAAG,kBAAkB;AAErB,WAAO,MAAM,aAAa,OAAO;AAAA,EACnC,GAAG,CAAC,IAAI,CAAC;AAET,YAAU,MAAM;AACd,QAAI,CAAC,QAAQ,CAAC,gBAAgB,QAAS;AACvC,wBAAoB,IAAI;AAAA,EAC1B,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AACT;","names":[]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useAuth } from "../providers/auth.provider";
|
|
3
|
-
import { useWhitelabel } from "../providers/whitelabel.provider";
|
|
4
|
-
function useWlId() {
|
|
5
|
-
const { whitelabel } = useWhitelabel();
|
|
6
|
-
return whitelabel?.id ?? 0;
|
|
7
|
-
}
|
|
8
|
-
function useWlQueryKey(baseKey) {
|
|
9
|
-
const wlId = useWlId();
|
|
10
|
-
return ["whitelabel", wlId, ...baseKey];
|
|
11
|
-
}
|
|
12
|
-
function useAuthQueryKey(baseKey) {
|
|
13
|
-
const wlId = useWlId();
|
|
14
|
-
const { user } = useAuth();
|
|
15
|
-
const userId = user?.id ?? 0;
|
|
16
|
-
return ["whitelabel", wlId, "user", userId, ...baseKey];
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
useAuthQueryKey,
|
|
20
|
-
useWlId,
|
|
21
|
-
useWlQueryKey
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=useAuthQueryKey.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useAuthQueryKey.ts"],"sourcesContent":["'use client';\n\nimport { useAuth } from '../providers/auth.provider';\nimport { useWhitelabel } from '../providers/whitelabel.provider';\n\n/**\n * Retorna o id da whitelabel do contexto.\n */\nexport function useWlId(): number {\n const { whitelabel } = useWhitelabel();\n return whitelabel?.id ?? 0;\n}\n\n/**\n * Prefixa query keys com ['whitelabel', wlId] para isolamento por whitelabel.\n * Usar para queries públicas e bootstrap (plans, currencies, user, account, etc).\n */\nexport function useWlQueryKey<T extends readonly unknown[]>(baseKey: [...T]): ['whitelabel', number, ...T] {\n const wlId = useWlId();\n return ['whitelabel', wlId, ...baseKey];\n}\n\n/**\n * Prefixa query keys com ['whitelabel', wlId, 'user', userId] para isolamento\n * por whitelabel + usuário. Usar para queries autenticadas (cards, subscriptions, etc).\n */\nexport function useAuthQueryKey<T extends readonly unknown[]>(baseKey: [...T]): ['whitelabel', number, 'user', number, ...T] {\n const wlId = useWlId();\n const { user } = useAuth();\n const userId = user?.id ?? 0;\n return ['whitelabel', wlId, 'user', userId, ...baseKey];\n}\n"],"mappings":";AAEA,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAKvB,SAAS,UAAkB;AAChC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO,YAAY,MAAM;AAC3B;AAMO,SAAS,cAA4C,SAA+C;AACzG,QAAM,OAAO,QAAQ;AACrB,SAAO,CAAC,cAAc,MAAM,GAAG,OAAO;AACxC;AAMO,SAAS,gBAA8C,SAA+D;AAC3H,QAAM,OAAO,QAAQ;AACrB,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,SAAS,MAAM,MAAM;AAC3B,SAAO,CAAC,cAAc,MAAM,QAAQ,QAAQ,GAAG,OAAO;AACxD;","names":[]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
function insertSorted(data, newItem, compareFn) {
|
|
2
|
-
const index = data.findIndex((item) => compareFn(newItem, item) < 0);
|
|
3
|
-
if (index === -1) return [...data, newItem];
|
|
4
|
-
return [...data.slice(0, index), newItem, ...data.slice(index)];
|
|
5
|
-
}
|
|
6
|
-
function buildCompareFn(sort) {
|
|
7
|
-
const fields = sort.split(",").map((f) => f.trim()).filter(Boolean);
|
|
8
|
-
const parsedFields = fields.map((field) => {
|
|
9
|
-
const desc = field.startsWith("-");
|
|
10
|
-
const key = desc ? field.slice(1) : field;
|
|
11
|
-
return { key, desc };
|
|
12
|
-
});
|
|
13
|
-
return (a, b) => {
|
|
14
|
-
for (const { key, desc } of parsedFields) {
|
|
15
|
-
const aVal = a[key];
|
|
16
|
-
const bVal = b[key];
|
|
17
|
-
let result;
|
|
18
|
-
if (typeof aVal === "string" && typeof bVal === "string") {
|
|
19
|
-
result = aVal.localeCompare(bVal);
|
|
20
|
-
} else if (typeof aVal === "number" && typeof bVal === "number") {
|
|
21
|
-
result = aVal - bVal;
|
|
22
|
-
} else {
|
|
23
|
-
result = String(aVal ?? "").localeCompare(String(bVal ?? ""));
|
|
24
|
-
}
|
|
25
|
-
if (result !== 0) return desc ? -result : result;
|
|
26
|
-
}
|
|
27
|
-
return 0;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
buildCompareFn,
|
|
32
|
-
insertSorted
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=array.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infra/utils/array.ts"],"sourcesContent":["/**\n * Insere um item em um array já ordenado, mantendo a ordenação\n * com base na função de comparação fornecida.\n */\nexport function insertSorted<T>(\n data: T[],\n newItem: T,\n compareFn: (a: T, b: T) => number\n): T[] {\n const index = data.findIndex((item) => compareFn(newItem, item) < 0);\n if (index === -1) return [...data, newItem];\n return [...data.slice(0, index), newItem, ...data.slice(index)];\n}\n\n/**\n * Cria uma função de comparação a partir de uma string de sort da API.\n * Suporta múltiplos campos separados por vírgula e prefixo `-` para desc.\n *\n * Exemplos:\n * - \"title\" → ascendente por title\n * - \"-title\" → descendente por title\n * - \"title,-datetime_add\" → ascendente por title, depois descendente por datetime_add\n */\nexport function buildCompareFn<T extends Record<string, unknown>>(\n sort: string\n): (a: T, b: T) => number {\n const fields = sort.split(',').map((f) => f.trim()).filter(Boolean);\n\n const parsedFields = fields.map((field) => {\n const desc = field.startsWith('-');\n const key = desc ? field.slice(1) : field;\n return { key, desc };\n });\n\n return (a: T, b: T) => {\n for (const { key, desc } of parsedFields) {\n const aVal = a[key];\n const bVal = b[key];\n\n let result: number;\n\n if (typeof aVal === 'string' && typeof bVal === 'string') {\n result = aVal.localeCompare(bVal);\n } else if (typeof aVal === 'number' && typeof bVal === 'number') {\n result = aVal - bVal;\n } else {\n result = String(aVal ?? '').localeCompare(String(bVal ?? ''));\n }\n\n if (result !== 0) return desc ? -result : result;\n }\n return 0;\n };\n}\n"],"mappings":"AAIO,SAAS,aACd,MACA,SACA,WACK;AACL,QAAM,QAAQ,KAAK,UAAU,CAAC,SAAS,UAAU,SAAS,IAAI,IAAI,CAAC;AACnE,MAAI,UAAU,GAAI,QAAO,CAAC,GAAG,MAAM,OAAO;AAC1C,SAAO,CAAC,GAAG,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,MAAM,KAAK,CAAC;AAChE;AAWO,SAAS,eACd,MACwB;AACxB,QAAM,SAAS,KAAK,MAAM,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,OAAO;AAElE,QAAM,eAAe,OAAO,IAAI,CAAC,UAAU;AACzC,UAAM,OAAO,MAAM,WAAW,GAAG;AACjC,UAAM,MAAM,OAAO,MAAM,MAAM,CAAC,IAAI;AACpC,WAAO,EAAE,KAAK,KAAK;AAAA,EACrB,CAAC;AAED,SAAO,CAAC,GAAM,MAAS;AACrB,eAAW,EAAE,KAAK,KAAK,KAAK,cAAc;AACxC,YAAM,OAAO,EAAE,GAAG;AAClB,YAAM,OAAO,EAAE,GAAG;AAElB,UAAI;AAEJ,UAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AACxD,iBAAS,KAAK,cAAc,IAAI;AAAA,MAClC,WAAW,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AAC/D,iBAAS,OAAO;AAAA,MAClB,OAAO;AACL,iBAAS,OAAO,QAAQ,EAAE,EAAE,cAAc,OAAO,QAAQ,EAAE,CAAC;AAAA,MAC9D;AAEA,UAAI,WAAW,EAAG,QAAO,OAAO,CAAC,SAAS;AAAA,IAC5C;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { accountTokenService } from "../services/account-token.service";
|
|
4
|
-
async function getAccountTokenAction() {
|
|
5
|
-
return safeServerAction(() => accountTokenService.getOrCreateToken());
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
getAccountTokenAction
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=get-account-token.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/actions/get-account-token.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { accountTokenService } from '../services/account-token.service';\n\nexport async function getAccountTokenAction() {\n return safeServerAction(() => accountTokenService.getOrCreateToken());\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAEpC,eAAsB,wBAAwB;AAC5C,SAAO,iBAAiB,MAAM,oBAAoB,iBAAiB,CAAC;AACtE;","names":[]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useQuery } from "@tanstack/react-query";
|
|
3
|
-
import { withAction } from "../../../utils/withAction";
|
|
4
|
-
import { getAccountTokenAction } from "../actions/get-account-token.action";
|
|
5
|
-
const ACCOUNT_TOKEN_QUERY_KEY = ["account-token"];
|
|
6
|
-
function useAccountToken() {
|
|
7
|
-
return useQuery({
|
|
8
|
-
queryKey: ACCOUNT_TOKEN_QUERY_KEY,
|
|
9
|
-
queryFn: withAction(getAccountTokenAction)
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
useAccountToken
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=use-account-token.hook.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/use-account-token.hook.tsx"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { getAccountTokenAction } from '../actions/get-account-token.action';\n\nconst ACCOUNT_TOKEN_QUERY_KEY = ['account-token'];\n\nexport function useAccountToken() {\n return useQuery({\n queryKey: ACCOUNT_TOKEN_QUERY_KEY,\n queryFn: withAction(getAccountTokenAction),\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AAEtC,MAAM,0BAA0B,CAAC,eAAe;AAEzC,SAAS,kBAAkB;AAChC,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS,WAAW,qBAAqB;AAAA,EAC3C,CAAC;AACH;","names":[]}
|