native-pytech 1.0.210 → 1.0.213
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/libs/constants/consts.d.ts +0 -2
- package/dist/libs/constants/consts.js +0 -2
- package/dist/libs/login/src/Pages/Home/index.js +1 -9
- package/dist/libs/providers/App/index.d.ts +1 -1
- package/dist/libs/providers/App/index.js +3 -7
- package/dist/libs/providers/App/types.d.ts +2 -7
- package/dist/libs/supabase/src/clients/app/index.d.ts +3 -3
- package/dist/libs/supabase/src/clients/app/utils.d.ts +3 -3
- package/dist/libs/supabase/src/clients/app/utils.js +1 -3
- package/package.json +1 -1
|
@@ -2,8 +2,6 @@ import { NativeStackNavigationOptions } from "expo-router/build/react-navigation
|
|
|
2
2
|
export declare const deviceTier: "low" | "medium" | "high";
|
|
3
3
|
export declare const isLowTier: boolean;
|
|
4
4
|
type ExpoEnv = {
|
|
5
|
-
SUPABASE_USERNAME_LOGIN: string;
|
|
6
|
-
SUPABASE_PASSWORD_LOGIN: string;
|
|
7
5
|
SUPABASE_URL: string;
|
|
8
6
|
SUPABASE_KEY: string;
|
|
9
7
|
SUPABASE_SERVICE_ROLE_KEY: string;
|
|
@@ -6,8 +6,6 @@ export const isLowTier = Platform.OS === 'android' && deviceTier === 'low';
|
|
|
6
6
|
const getExpoEnv = () => {
|
|
7
7
|
const expoEnv = Constants.expoConfig?.extra || {};
|
|
8
8
|
return {
|
|
9
|
-
SUPABASE_USERNAME_LOGIN: expoEnv.SUPABASE_USERNAME_LOGIN || process.env.SUPABASE_USERNAME_LOGIN,
|
|
10
|
-
SUPABASE_PASSWORD_LOGIN: expoEnv.SUPABASE_PASSWORD_LOGIN || process.env.SUPABASE_PASSWORD_LOGIN,
|
|
11
9
|
SUPABASE_URL: expoEnv.SUPABASE_URL || process.env.SUPABASE_URL,
|
|
12
10
|
SUPABASE_KEY: expoEnv.SUPABASE_KEY || process.env.SUPABASE_KEY,
|
|
13
11
|
SUPABASE_SERVICE_ROLE_KEY: expoEnv.SUPABASE_SERVICE_ROLE_KEY || process.env.SUPABASE_SERVICE_ROLE_KEY,
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { useRouter } from 'expo-router';
|
|
2
|
-
import { memo
|
|
3
|
-
import supabase from '../../../../../libs/supabase';
|
|
2
|
+
import { memo } from 'react';
|
|
4
3
|
import Screen from '../../Screen';
|
|
5
4
|
import { handleSubmitLogIn } from '../utils';
|
|
6
5
|
import Link from '../../../../../libs/components/Link';
|
|
7
6
|
export default memo(({ title = 'MiApp', subtitle = 'Inicia sesión con un correo electrónico o nombre de usuario para usar la aplicación.', iconPage = <Screen.SvgPytech />, textCreateAccount, enableCreateAccount = false, }) => {
|
|
8
7
|
const router = useRouter();
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
const { error } = await supabase.logIn();
|
|
12
|
-
if (!error)
|
|
13
|
-
console.log('LogIn exitoso');
|
|
14
|
-
})();
|
|
15
|
-
}, []);
|
|
16
8
|
return (<Screen iconPage={iconPage} title={title} subtitle={subtitle} bottomElements={<>
|
|
17
9
|
<Screen.Input placeholder='Correo o nombre de usuario' keyboardType='email-address' autoComplete='email' handleSubmit={async ({ value }) => await handleSubmitLogIn({ username: value, router })}/>
|
|
18
10
|
{enableCreateAccount && (<Link text={textCreateAccount || `Crear tu cuenta de ${title}`} onPress={({ router }) => router.push({ pathname: '/login/inicio/signIn' })}/>)}
|
|
@@ -6,5 +6,5 @@ declare const useApp: () => {
|
|
|
6
6
|
fontScale: number;
|
|
7
7
|
};
|
|
8
8
|
export { useApp };
|
|
9
|
-
declare const _default: import("react").MemoExoticComponent<({
|
|
9
|
+
declare const _default: import("react").MemoExoticComponent<({ children, getBackgroundColor, getSession, renderItemLoading, onLoadingRealsed, }: Props) => import("react").JSX.Element>;
|
|
10
10
|
export default _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { memo, useMemo, useState, useRef } from "react";
|
|
2
|
-
import { Stack, useRouter } from "expo-router";
|
|
3
2
|
import { useColorScheme, useWindowDimensions, View, StyleSheet } from "react-native";
|
|
4
3
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
4
|
import { DarkTheme, DefaultTheme, ThemeProvider } from 'expo-router';
|
|
@@ -11,7 +10,7 @@ import colors from "../constants";
|
|
|
11
10
|
import './styles.css';
|
|
12
11
|
const [Provider, useApp] = Utils.createCtx();
|
|
13
12
|
export { useApp };
|
|
14
|
-
export default memo(({
|
|
13
|
+
export default memo(({ children, getBackgroundColor, getSession, renderItemLoading = ({ colorScheme }) => (colorScheme === 'dark' ?
|
|
15
14
|
<LoginSvgDark width={200} height={200}/>
|
|
16
15
|
:
|
|
17
16
|
<LoginSvg width={200} height={200}/>), onLoadingRealsed, }) => {
|
|
@@ -19,13 +18,12 @@ export default memo(({ listStackNames = [], getBackgroundColor, getSession, rend
|
|
|
19
18
|
const colorScheme = useColorScheme();
|
|
20
19
|
const Theme = colors[colorScheme];
|
|
21
20
|
const { fontScale } = useWindowDimensions();
|
|
22
|
-
const router = useRouter();
|
|
23
21
|
const [isLoading, setIsLoading] = useState(true);
|
|
24
22
|
const hasSessionRef = useRef(false);
|
|
25
23
|
// -------------- Effects --------------
|
|
26
24
|
Hooks.useEffectWithoutFirstRender(() => {
|
|
27
25
|
if (!isLoading)
|
|
28
|
-
onLoadingRealsed?.({
|
|
26
|
+
onLoadingRealsed?.({ hasSession: hasSessionRef.current });
|
|
29
27
|
}, [isLoading]);
|
|
30
28
|
Hooks.useAsyncEffect(async (isMounted) => {
|
|
31
29
|
hasSessionRef.current = (await getSession?.()) ?? true;
|
|
@@ -43,9 +41,7 @@ export default memo(({ listStackNames = [], getBackgroundColor, getSession, rend
|
|
|
43
41
|
return (<SafeAreaProvider>
|
|
44
42
|
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
|
|
45
43
|
<Provider value={value}>
|
|
46
|
-
|
|
47
|
-
{listStackNames?.map((name) => (<Stack.Screen key={name} name={name}/>))}
|
|
48
|
-
</Stack>
|
|
44
|
+
{children}
|
|
49
45
|
</Provider>
|
|
50
46
|
</ThemeProvider>
|
|
51
47
|
</SafeAreaProvider>);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { ColorSchemeType } from "../../../libs/constants/colors";
|
|
2
|
-
import { ImperativeRouter } from "expo-router";
|
|
3
2
|
type Props = {
|
|
4
|
-
|
|
5
|
-
Lista de nombres de los Stacks que se deben renderizar.
|
|
6
|
-
*/
|
|
7
|
-
listStackNames?: string[];
|
|
3
|
+
children?: React.ReactNode;
|
|
8
4
|
/**
|
|
9
5
|
Función para obtener el color de fondo de las paginas por defecto.
|
|
10
6
|
*/
|
|
@@ -27,8 +23,7 @@ type Props = {
|
|
|
27
23
|
Función para ejecutar cuando se realice el cambio de estado de loading a false.
|
|
28
24
|
Se utiliza para redirigir a la página de inicio.
|
|
29
25
|
*/
|
|
30
|
-
onLoadingRealsed?: ({
|
|
31
|
-
router: ImperativeRouter;
|
|
26
|
+
onLoadingRealsed?: ({ hasSession }: {
|
|
32
27
|
hasSession: boolean;
|
|
33
28
|
}) => void;
|
|
34
29
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const supabase: {
|
|
2
|
-
logIn: ({ email, password }
|
|
3
|
-
email
|
|
4
|
-
password
|
|
2
|
+
logIn: ({ email, password }: {
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
5
|
}) => Promise<import("@supabase/auth-js").AuthTokenResponsePassword>;
|
|
6
6
|
logOut: () => Promise<{
|
|
7
7
|
error: import("@supabase/auth-js").AuthError | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as utils from '../../utils';
|
|
2
|
-
export declare const logIn: ({ email, password }
|
|
3
|
-
email
|
|
4
|
-
password
|
|
2
|
+
export declare const logIn: ({ email, password }: {
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
5
|
}) => Promise<import("@supabase/auth-js").AuthTokenResponsePassword>;
|
|
6
6
|
export declare const logOut: () => Promise<{
|
|
7
7
|
error: import("@supabase/auth-js").AuthError | null;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import supabase from './config';
|
|
2
2
|
import * as utils from '../../utils';
|
|
3
|
-
|
|
4
|
-
const { SUPABASE_USERNAME_LOGIN, SUPABASE_PASSWORD_LOGIN } = expoEnv;
|
|
5
|
-
export const logIn = async ({ email = SUPABASE_USERNAME_LOGIN, password = SUPABASE_PASSWORD_LOGIN } = {}) => (await utils.logIn(supabase, { email, password }));
|
|
3
|
+
export const logIn = async ({ email, password }) => (await utils.logIn(supabase, { email, password }));
|
|
6
4
|
export const logOut = async () => await utils.logOut(supabase);
|
|
7
5
|
export const getUser = async () => await utils.getUser(supabase);
|
|
8
6
|
export const execFunction = async (params) => (await utils.execFunction(supabase, params));
|