@makroz/mobile 1.1.1 → 1.1.2
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 +6 -6
- package/dist/__mocks__/flash-list.d.ts +0 -12
- package/dist/__mocks__/react-native.d.ts +0 -77
- package/dist/auth/MkAuthContext.d.ts +0 -72
- package/dist/auth/MkAuthForm.d.ts +0 -31
- package/dist/auth/MkAuthProvider.d.ts +0 -57
- package/dist/auth/secureStorage.d.ts +0 -63
- package/dist/auth/types.d.ts +0 -65
- package/dist/auth/useMkAuth.d.ts +0 -17
- package/dist/components/MkAccordion.d.ts +0 -19
- package/dist/components/MkAccordion.test.d.ts +0 -2
- package/dist/components/MkAlert.d.ts +0 -18
- package/dist/components/MkAlert.test.d.ts +0 -2
- package/dist/components/MkAvatar.d.ts +0 -12
- package/dist/components/MkAvatar.test.d.ts +0 -2
- package/dist/components/MkBadge.d.ts +0 -11
- package/dist/components/MkBadge.test.d.ts +0 -2
- package/dist/components/MkButton.d.ts +0 -13
- package/dist/components/MkButton.test.d.ts +0 -2
- package/dist/components/MkCard.d.ts +0 -15
- package/dist/components/MkCard.test.d.ts +0 -2
- package/dist/components/MkCheck.d.ts +0 -18
- package/dist/components/MkCheck.test.d.ts +0 -2
- package/dist/components/MkDatePicker.d.ts +0 -30
- package/dist/components/MkDatePicker.test.d.ts +0 -2
- package/dist/components/MkDivider.d.ts +0 -11
- package/dist/components/MkDivider.test.d.ts +0 -2
- package/dist/components/MkDropDown.d.ts +0 -37
- package/dist/components/MkDropDown.test.d.ts +0 -2
- package/dist/components/MkEmptyState.d.ts +0 -11
- package/dist/components/MkEmptyState.test.d.ts +0 -2
- package/dist/components/MkFileUpload.d.ts +0 -63
- package/dist/components/MkFileUpload.test.d.ts +0 -2
- package/dist/components/MkIcons.d.ts +0 -15
- package/dist/components/MkInfiniteList.d.ts +0 -22
- package/dist/components/MkInfiniteList.test.d.ts +0 -2
- package/dist/components/MkInput.d.ts +0 -16
- package/dist/components/MkInput.test.d.ts +0 -2
- package/dist/components/MkLoading.d.ts +0 -12
- package/dist/components/MkLoading.test.d.ts +0 -2
- package/dist/components/MkModal.d.ts +0 -20
- package/dist/components/MkModal.test.d.ts +0 -2
- package/dist/components/MkProgressBar.d.ts +0 -13
- package/dist/components/MkProgressBar.test.d.ts +0 -2
- package/dist/components/MkRadio.d.ts +0 -20
- package/dist/components/MkRadio.test.d.ts +0 -2
- package/dist/components/MkSearchInput.d.ts +0 -21
- package/dist/components/MkSearchInput.test.d.ts +0 -2
- package/dist/components/MkSelect.d.ts +0 -16
- package/dist/components/MkSelect.test.d.ts +0 -2
- package/dist/components/MkSkeleton.d.ts +0 -13
- package/dist/components/MkSkeleton.test.d.ts +0 -2
- package/dist/components/MkSwitch.d.ts +0 -13
- package/dist/components/MkSwitch.test.d.ts +0 -2
- package/dist/components/MkTable.d.ts +0 -39
- package/dist/components/MkTable.test.d.ts +0 -2
- package/dist/components/MkTabs.d.ts +0 -19
- package/dist/components/MkTabs.test.d.ts +0 -2
- package/dist/components/MkTextArea.d.ts +0 -17
- package/dist/components/MkTextArea.test.d.ts +0 -2
- package/dist/components/MkToastRenderer.d.ts +0 -3
- package/dist/components/MkToastRenderer.test.d.ts +0 -2
- package/dist/components/MkTooltip.d.ts +0 -15
- package/dist/components/MkTooltip.test.d.ts +0 -2
- package/dist/components/MkWindowList.d.ts +0 -47
- package/dist/components/MkWindowList.test.d.ts +0 -2
- package/dist/components/index.d.ts +0 -30
- package/dist/context/MkApiContext.d.ts +0 -15
- package/dist/context/MkAuthContext.d.ts +0 -19
- package/dist/context/MkConfirmContext.d.ts +0 -8
- package/dist/context/MkToastContext.d.ts +0 -19
- package/dist/hooks/filePicker.types.d.ts +0 -13
- package/dist/hooks/useApi.d.ts +0 -19
- package/dist/hooks/useApi.test.d.ts +0 -2
- package/dist/hooks/useMkCrud.d.ts +0 -39
- package/dist/hooks/useMkDebounce.d.ts +0 -24
- package/dist/hooks/useMkEffectDebug.d.ts +0 -6
- package/dist/hooks/useMkEvent.d.ts +0 -42
- package/dist/hooks/useMkFilePickerCli.d.ts +0 -59
- package/dist/hooks/useMkFilePickerExpo.d.ts +0 -38
- package/dist/hooks/useMkForm.d.ts +0 -43
- package/dist/hooks/useMkInfiniteList.d.ts +0 -16
- package/dist/hooks/useMkList.d.ts +0 -61
- package/dist/hooks/useMkLocalStorage.d.ts +0 -6
- package/dist/hooks/useMkPrevious.d.ts +0 -6
- package/dist/hooks/useMkToggle.d.ts +0 -6
- package/dist/index.d.ts +0 -29
- package/dist/test-setup.d.ts +0 -28
- package/dist/test-utils.d.ts +0 -22
- package/dist/theme/MkThemeProvider.d.ts +0 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makroz/mobile",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "React Native UI components and hooks for MK-Director mobile applications",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@shopify/flash-list": ">=2.0.0",
|
|
36
36
|
"expo": "~56.0.0",
|
|
37
|
-
"expo-file-system": "~
|
|
38
|
-
"expo-notifications": "~0.
|
|
37
|
+
"expo-file-system": "~56.0.8",
|
|
38
|
+
"expo-notifications": "~56.0.18",
|
|
39
39
|
"expo-router": "~56.2.0",
|
|
40
|
-
"expo-secure-store": "~
|
|
41
|
-
"expo-sqlite": "~
|
|
42
|
-
"expo-updates": "~0.
|
|
40
|
+
"expo-secure-store": "~56.0.4",
|
|
41
|
+
"expo-sqlite": "~56.0.5",
|
|
42
|
+
"expo-updates": "~56.0.19",
|
|
43
43
|
"react": "^19.0.0",
|
|
44
44
|
"react-native": "0.85.x"
|
|
45
45
|
},
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock for @shopify/flash-list — structural stub.
|
|
3
|
-
*/
|
|
4
|
-
declare const FlashList: (props: any) => {
|
|
5
|
-
type: string;
|
|
6
|
-
props: {
|
|
7
|
-
'data-flashlist': boolean;
|
|
8
|
-
children: any;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export { FlashList };
|
|
12
|
-
//# sourceMappingURL=flash-list.d.ts.map
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
declare const View: (props: any) => {
|
|
2
|
-
type: string;
|
|
3
|
-
props: any;
|
|
4
|
-
};
|
|
5
|
-
declare const Text: (props: any) => {
|
|
6
|
-
type: string;
|
|
7
|
-
props: any;
|
|
8
|
-
};
|
|
9
|
-
declare const TouchableOpacity: (props: any) => {
|
|
10
|
-
type: string;
|
|
11
|
-
props: any;
|
|
12
|
-
};
|
|
13
|
-
declare const TextInput: (props: any) => {
|
|
14
|
-
type: string;
|
|
15
|
-
props: any;
|
|
16
|
-
};
|
|
17
|
-
declare const Pressable: (props: any) => {
|
|
18
|
-
type: string;
|
|
19
|
-
props: any;
|
|
20
|
-
};
|
|
21
|
-
declare const Image: (props: any) => {
|
|
22
|
-
type: string;
|
|
23
|
-
props: any;
|
|
24
|
-
};
|
|
25
|
-
declare const ScrollView: (props: any) => {
|
|
26
|
-
type: string;
|
|
27
|
-
props: any;
|
|
28
|
-
};
|
|
29
|
-
declare const FlatList: (props: any) => {
|
|
30
|
-
type: string;
|
|
31
|
-
props: {
|
|
32
|
-
'data-flatlist': boolean;
|
|
33
|
-
children: any;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
declare const Modal: (props: any) => {
|
|
37
|
-
type: string;
|
|
38
|
-
props: {
|
|
39
|
-
'data-modal': boolean;
|
|
40
|
-
children: any;
|
|
41
|
-
};
|
|
42
|
-
} | null;
|
|
43
|
-
declare const ActivityIndicator: (_props: any) => {
|
|
44
|
-
type: string;
|
|
45
|
-
props: {
|
|
46
|
-
'data-indicator': boolean;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
declare const StyleSheet: {
|
|
50
|
-
create: (styles: any) => any;
|
|
51
|
-
flatten: (style: any) => any;
|
|
52
|
-
hairlineWidth: number;
|
|
53
|
-
};
|
|
54
|
-
declare const Platform: {
|
|
55
|
-
OS: string;
|
|
56
|
-
select: (obj: any) => any;
|
|
57
|
-
};
|
|
58
|
-
declare const LayoutAnimation: {
|
|
59
|
-
configureNext: () => void;
|
|
60
|
-
easeInEaseOut: () => void;
|
|
61
|
-
linear: () => void;
|
|
62
|
-
spring: () => void;
|
|
63
|
-
};
|
|
64
|
-
declare const UIManager: {
|
|
65
|
-
setLayoutAnimationEnabledExperimental: () => void;
|
|
66
|
-
measure: () => void;
|
|
67
|
-
measureInWindow: () => void;
|
|
68
|
-
};
|
|
69
|
-
declare const useColorScheme: () => "light" | "dark";
|
|
70
|
-
declare const useWindowDimensions: () => {
|
|
71
|
-
width: number;
|
|
72
|
-
height: number;
|
|
73
|
-
scale: number;
|
|
74
|
-
fontScale: number;
|
|
75
|
-
};
|
|
76
|
-
export { View, Text, TouchableOpacity, TextInput, Pressable, Image, ScrollView, FlatList, Modal, ActivityIndicator, StyleSheet, Platform, LayoutAnimation, UIManager, useColorScheme, useWindowDimensions, };
|
|
77
|
-
//# sourceMappingURL=react-native.d.ts.map
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth context shape + the React context object.
|
|
3
|
-
*
|
|
4
|
-
* This module is intentionally side-effect free (it only defines
|
|
5
|
-
* the context + the type). The provider lives in
|
|
6
|
-
* `MkAuthProvider.tsx` and the consumer hook lives in
|
|
7
|
-
* `useMkAuth.ts`. Splitting them this way keeps circular imports
|
|
8
|
-
* out of the picture and lets tests import the context type
|
|
9
|
-
* without pulling in the full provider tree.
|
|
10
|
-
*/
|
|
11
|
-
import type { AdminDto, LoginInput, AuthTokens } from './types';
|
|
12
|
-
/**
|
|
13
|
-
* Public auth context value exposed by `MkAuthProvider` and
|
|
14
|
-
* consumed by `useMkAuth`.
|
|
15
|
-
*
|
|
16
|
-
* Design notes:
|
|
17
|
-
* - `isAuthenticated` is derived state from `user`, but it is
|
|
18
|
-
* exposed as a first-class field so call sites don't have to
|
|
19
|
-
* remember the null-vs-false distinction that the legacy
|
|
20
|
-
* `MkAuthContext.tsx` introduced (here we use `null` only,
|
|
21
|
-
* matching the SecureStore contract).
|
|
22
|
-
* - `hasAbility(ability)` accepts a single string and returns
|
|
23
|
-
* whether the current user has *any* permission for that
|
|
24
|
-
* ability. The underlying `canUser` from `@makroz/core` can also
|
|
25
|
-
* take an action verb — consumers that need action-level
|
|
26
|
-
* granularity should call `canUser` directly with
|
|
27
|
-
* `user.role.abilities`.
|
|
28
|
-
*/
|
|
29
|
-
export interface MkAuthContextValue {
|
|
30
|
-
/** The currently authenticated admin, or `null` if not signed in. */
|
|
31
|
-
user: AdminDto | null;
|
|
32
|
-
/** Convenience: `user !== null`. */
|
|
33
|
-
isAuthenticated: boolean;
|
|
34
|
-
/** `true` while the provider is hydrating from SecureStore or waiting on a network call. */
|
|
35
|
-
isLoading: boolean;
|
|
36
|
-
/** Last login/refresh/logout error, or `null` if no error. */
|
|
37
|
-
error: Error | null;
|
|
38
|
-
/**
|
|
39
|
-
* Authenticate with email + password. On success persists
|
|
40
|
-
* the new tokens in SecureStore and updates `user`.
|
|
41
|
-
*
|
|
42
|
-
* Throws on network / server errors so callers can decide
|
|
43
|
-
* whether to surface the error.
|
|
44
|
-
*/
|
|
45
|
-
login: (input: LoginInput) => Promise<AdminDto>;
|
|
46
|
-
/**
|
|
47
|
-
* Best-effort logout. Tells the backend (if reachable) and
|
|
48
|
-
* then unconditionally clears local SecureStore state.
|
|
49
|
-
*
|
|
50
|
-
* Never throws — even if the backend call fails the local
|
|
51
|
-
* session is cleared.
|
|
52
|
-
*/
|
|
53
|
-
logout: () => Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Force a refresh of the access token using the stored
|
|
56
|
-
* refresh token. Returns the new tokens or `null` if the
|
|
57
|
-
* refresh failed (in which case the user is logged out).
|
|
58
|
-
*/
|
|
59
|
-
refresh: () => Promise<AuthTokens | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Check whether the current user has any permission for the
|
|
62
|
-
* given ability. Returns `false` for unauthenticated users.
|
|
63
|
-
*/
|
|
64
|
-
hasAbility: (ability: string) => boolean;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* The React context. Default value is `undefined` so the
|
|
68
|
-
* `useMkAuth` hook can throw a helpful error when used outside
|
|
69
|
-
* the provider.
|
|
70
|
-
*/
|
|
71
|
-
export declare const MkAuthContext: import("react").Context<MkAuthContextValue | undefined>;
|
|
72
|
-
//# sourceMappingURL=MkAuthContext.d.ts.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `MkAuthForm` — a mobile-friendly login form.
|
|
3
|
-
*
|
|
4
|
-
* Self-contained: it owns its own email/password state, calls
|
|
5
|
-
* `login()` from `useMkAuth`, and renders inline error + loading
|
|
6
|
-
* states. Consumers only need to wrap it inside an
|
|
7
|
-
* `<MkAuthProvider>` and (optionally) a `<MkThemeProvider>` so
|
|
8
|
-
* the input/button pick up the design tokens.
|
|
9
|
-
*
|
|
10
|
-
* Styling is plain `StyleSheet` (no NativeWind dependency) so
|
|
11
|
-
* the form works out of the box in any Expo / RN app.
|
|
12
|
-
*/
|
|
13
|
-
export interface MkAuthFormProps {
|
|
14
|
-
/**
|
|
15
|
-
* Override the submit button label. Defaults to `"Sign in"`.
|
|
16
|
-
*/
|
|
17
|
-
submitLabel?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Called after a successful login. Use this to navigate
|
|
20
|
-
* (e.g. `router.replace('/admin')`) instead of letting the
|
|
21
|
-
* form own the navigation state.
|
|
22
|
-
*/
|
|
23
|
-
onSuccess?: () => void;
|
|
24
|
-
/**
|
|
25
|
-
* Optional container style override.
|
|
26
|
-
*/
|
|
27
|
-
style?: object;
|
|
28
|
-
}
|
|
29
|
-
export declare function MkAuthForm({ submitLabel, onSuccess, style, }: MkAuthFormProps): React.JSX.Element;
|
|
30
|
-
export default MkAuthForm;
|
|
31
|
-
//# sourceMappingURL=MkAuthForm.d.ts.map
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `MkAuthProvider` — the React provider that powers `useMkAuth`.
|
|
3
|
-
*
|
|
4
|
-
* Responsibilities:
|
|
5
|
-
* - Hydrate tokens + user from `expo-secure-store` on mount.
|
|
6
|
-
* - Expose `login`, `logout`, `refresh`, `hasAbility` via context.
|
|
7
|
-
* - Provide a memoised `authedFetch` helper that automatically
|
|
8
|
-
* attaches the access token and refreshes once on 401.
|
|
9
|
-
*
|
|
10
|
-
* Networking note: this provider does NOT use TanStack Query
|
|
11
|
-
* (the mk-director monorepo does not currently declare it as a
|
|
12
|
-
* peer dep). It uses the same plain `fetch`-based pattern that
|
|
13
|
-
* the legacy `useApi.ts` hook uses, so the surface stays
|
|
14
|
-
* consistent across the package. Consumers that need query
|
|
15
|
-
* caching should layer TanStack Query on top of `authedFetch`
|
|
16
|
-
* at the call site.
|
|
17
|
-
*/
|
|
18
|
-
import type { ReactNode } from 'react';
|
|
19
|
-
/**
|
|
20
|
-
* Props for `MkAuthProvider`.
|
|
21
|
-
*/
|
|
22
|
-
export interface MkAuthProviderProps {
|
|
23
|
-
/**
|
|
24
|
-
* The auth scope — used to build the URL prefix
|
|
25
|
-
* `/api/${scope}/auth/...`. Example: `"admin"`.
|
|
26
|
-
*/
|
|
27
|
-
scope: string;
|
|
28
|
-
/**
|
|
29
|
-
* Base URL of the backend (no trailing slash). Example:
|
|
30
|
-
* `"http://localhost:8000"` for a dev API.
|
|
31
|
-
*/
|
|
32
|
-
apiBaseUrl: string;
|
|
33
|
-
/**
|
|
34
|
-
* Optional override of the per-request timeout in ms.
|
|
35
|
-
* Defaults to 15s — long enough for slow mobile networks
|
|
36
|
-
* but short enough that the UI doesn't appear to hang.
|
|
37
|
-
*
|
|
38
|
-
* Reserved for a future AbortController-based timeout
|
|
39
|
-
* implementation; the current provider does not enforce
|
|
40
|
-
* it but accepts the prop for forward compatibility.
|
|
41
|
-
*/
|
|
42
|
-
requestTimeoutMs?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Children.
|
|
45
|
-
*/
|
|
46
|
-
children: ReactNode;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* The provider component.
|
|
50
|
-
*
|
|
51
|
-
* Marked `'use client'` equivalent — RN doesn't use the Next.js
|
|
52
|
-
* `'use client'` directive, but conceptually this component is
|
|
53
|
-
* a Client Component (it owns state, effects, and side effects).
|
|
54
|
-
*/
|
|
55
|
-
export declare function MkAuthProvider({ scope, apiBaseUrl, requestTimeoutMs: _requestTimeoutMs, children, }: MkAuthProviderProps): React.JSX.Element;
|
|
56
|
-
export default MkAuthProvider;
|
|
57
|
-
//# sourceMappingURL=MkAuthProvider.d.ts.map
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thin wrapper around `expo-secure-store` for credentials.
|
|
3
|
-
*
|
|
4
|
-
* IMPORTANT: This module is the SOLE place in `@makroz/mobile` that
|
|
5
|
-
* touches persistent credential storage. Do NOT introduce
|
|
6
|
-
* `AsyncStorage` for tokens — they are credentials and must live in
|
|
7
|
-
* the device keychain (iOS) / Keystore (Android).
|
|
8
|
-
*
|
|
9
|
-
* The module imports `expo-secure-store` at the top level so the
|
|
10
|
-
* Vitest test suite can `vi.mock('expo-secure-store', ...)` to
|
|
11
|
-
* substitute an in-memory implementation.
|
|
12
|
-
*/
|
|
13
|
-
import type { AdminDto } from './types';
|
|
14
|
-
/**
|
|
15
|
-
* SecureStore keys. Keep these stable — they are part of the
|
|
16
|
-
* on-disk schema. If you ever need to bump them (e.g. for a
|
|
17
|
-
* breaking schema change) use a migration rather than a rename.
|
|
18
|
-
*/
|
|
19
|
-
export declare const SECURE_KEYS: {
|
|
20
|
-
readonly accessToken: "access_token";
|
|
21
|
-
readonly refreshToken: "refresh_token";
|
|
22
|
-
readonly user: "user";
|
|
23
|
-
};
|
|
24
|
-
export type SecureKey = (typeof SECURE_KEYS)[keyof typeof SECURE_KEYS];
|
|
25
|
-
/**
|
|
26
|
-
* Get the persisted access token, or `null` if none is stored
|
|
27
|
-
* or the store is unavailable (e.g. running in a test that
|
|
28
|
-
* mocked `expo-secure-store` without a backing map).
|
|
29
|
-
*/
|
|
30
|
-
export declare function getAccessToken(): Promise<string | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Persist the access token. `null` clears it.
|
|
33
|
-
*/
|
|
34
|
-
export declare function setAccessToken(token: string | null): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Get the persisted refresh token, or `null` if none is stored.
|
|
37
|
-
*/
|
|
38
|
-
export declare function getRefreshToken(): Promise<string | null>;
|
|
39
|
-
/**
|
|
40
|
-
* Persist the refresh token. `null` clears it.
|
|
41
|
-
*/
|
|
42
|
-
export declare function setRefreshToken(token: string | null): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Get the persisted admin user, or `null` if none is stored.
|
|
45
|
-
*
|
|
46
|
-
* The user is JSON-serialised — SecureStore stores strings only.
|
|
47
|
-
*/
|
|
48
|
-
export declare function getUser(): Promise<AdminDto | null>;
|
|
49
|
-
/**
|
|
50
|
-
* Persist the admin user. `null` clears it.
|
|
51
|
-
*/
|
|
52
|
-
export declare function setUser(user: AdminDto | null): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Wipe all three credential keys. Called on logout and on any
|
|
55
|
-
* unrecoverable refresh failure.
|
|
56
|
-
*
|
|
57
|
-
* The implementation is best-effort: a single failed `deleteItemAsync`
|
|
58
|
-
* is swallowed because the *next* successful login will overwrite
|
|
59
|
-
* the value anyway, and we don't want a transient SecureStore
|
|
60
|
-
* hiccup to brick the user out of the app.
|
|
61
|
-
*/
|
|
62
|
-
export declare function clearAll(): Promise<void>;
|
|
63
|
-
//# sourceMappingURL=secureStorage.d.ts.map
|
package/dist/auth/types.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth types for `@makroz/mobile`.
|
|
3
|
-
*
|
|
4
|
-
* Wire-format DTOs returned by the MK-Director backend
|
|
5
|
-
* (e.g. Laravel `mk-laravel` package). Keep these decoupled from
|
|
6
|
-
* the existing `MkUser` in `@makroz/core` — this is the new
|
|
7
|
-
* SecureStore-backed auth surface introduced in MK-MOB-1.0.3.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Standard admin record as returned by `/api/{scope}/auth/me` and friends.
|
|
11
|
-
*
|
|
12
|
-
* `abilities` is a pipe-delimited string in the format
|
|
13
|
-
* `"users:CRUD|roles:R"` — the same convention the legacy
|
|
14
|
-
* `MkAuthContext` uses via `canUser` from `@makroz/core`.
|
|
15
|
-
*/
|
|
16
|
-
export interface AdminDto {
|
|
17
|
-
id: string | number;
|
|
18
|
-
name: string;
|
|
19
|
-
email: string;
|
|
20
|
-
role?: {
|
|
21
|
-
name: string;
|
|
22
|
-
abilities: string;
|
|
23
|
-
};
|
|
24
|
-
[key: string]: unknown;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Access + refresh token pair persisted in `expo-secure-store`.
|
|
28
|
-
*
|
|
29
|
-
* - `accessToken` is short-lived (15 min) and sent on every API request.
|
|
30
|
-
* - `refreshToken` is long-lived and only used by the auto-refresh
|
|
31
|
-
* interceptor inside `MkAuthProvider`.
|
|
32
|
-
*/
|
|
33
|
-
export interface AuthTokens {
|
|
34
|
-
accessToken: string;
|
|
35
|
-
refreshToken: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Payload accepted by `POST /api/{scope}/auth/login`.
|
|
39
|
-
*
|
|
40
|
-
* The `scope` itself comes from the provider props, NOT the body,
|
|
41
|
-
* so this is just the user-supplied credentials.
|
|
42
|
-
*/
|
|
43
|
-
export interface LoginInput {
|
|
44
|
-
email: string;
|
|
45
|
-
password: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Internal representation of the refresh-token response.
|
|
49
|
-
*
|
|
50
|
-
* Mirrors the wire shape returned by the Laravel `refresh` endpoint.
|
|
51
|
-
*/
|
|
52
|
-
export interface RefreshResponse {
|
|
53
|
-
accessToken: string;
|
|
54
|
-
refreshToken: string;
|
|
55
|
-
user?: AdminDto;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Internal representation of the login response.
|
|
59
|
-
*/
|
|
60
|
-
export interface LoginResponse {
|
|
61
|
-
user: AdminDto;
|
|
62
|
-
accessToken: string;
|
|
63
|
-
refreshToken: string;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/auth/useMkAuth.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `useMkAuth` — the public hook for consuming the auth context.
|
|
3
|
-
*
|
|
4
|
-
* Kept in its own module so the *type* of the context (and the
|
|
5
|
-
* `createContext` call) can be imported in isolation by tests
|
|
6
|
-
* and tooling without dragging in the full provider tree.
|
|
7
|
-
*/
|
|
8
|
-
import { type MkAuthContextValue } from './MkAuthContext';
|
|
9
|
-
/**
|
|
10
|
-
* Access the current auth context value.
|
|
11
|
-
*
|
|
12
|
-
* Throws if used outside an `<MkAuthProvider>` — this is a
|
|
13
|
-
* developer error, not a runtime condition, so failing loudly
|
|
14
|
-
* is the right call.
|
|
15
|
-
*/
|
|
16
|
-
export declare function useMkAuth(): MkAuthContextValue;
|
|
17
|
-
//# sourceMappingURL=useMkAuth.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
export interface MkAccordionItem {
|
|
4
|
-
key: string;
|
|
5
|
-
title: string;
|
|
6
|
-
content: React.ReactNode;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface MkAccordionProps {
|
|
10
|
-
items: MkAccordionItem[];
|
|
11
|
-
multiple?: boolean;
|
|
12
|
-
defaultExpanded?: string[];
|
|
13
|
-
expanded?: string[];
|
|
14
|
-
onChange?: (expandedKeys: string[]) => void;
|
|
15
|
-
variant?: 'default' | 'bordered' | 'separated';
|
|
16
|
-
style?: ViewStyle;
|
|
17
|
-
}
|
|
18
|
-
export declare const MkAccordion: React.FC<MkAccordionProps>;
|
|
19
|
-
//# sourceMappingURL=MkAccordion.d.ts.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
/**
|
|
4
|
-
* @module MkAlert (Mobile)
|
|
5
|
-
* @description Inline alert banner. Same API as mk-web MkAlert.
|
|
6
|
-
*/
|
|
7
|
-
export interface MkAlertProps {
|
|
8
|
-
variant?: 'info' | 'success' | 'warning' | 'error' | 'default';
|
|
9
|
-
title?: string;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
icon?: React.ReactNode;
|
|
12
|
-
dismissible?: boolean;
|
|
13
|
-
onDismiss?: () => void;
|
|
14
|
-
action?: React.ReactNode;
|
|
15
|
-
style?: ViewStyle;
|
|
16
|
-
}
|
|
17
|
-
export declare const MkAlert: React.FC<MkAlertProps>;
|
|
18
|
-
//# sourceMappingURL=MkAlert.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
export interface MkAvatarProps {
|
|
4
|
-
src?: string | null;
|
|
5
|
-
name?: string;
|
|
6
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
-
status?: 'online' | 'offline' | 'away' | 'busy' | null;
|
|
8
|
-
style?: ViewStyle;
|
|
9
|
-
onPress?: () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const MkAvatar: React.FC<MkAvatarProps>;
|
|
12
|
-
//# sourceMappingURL=MkAvatar.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
export interface MkBadgeProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
variant?: 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info';
|
|
6
|
-
size?: 'sm' | 'md';
|
|
7
|
-
dot?: boolean;
|
|
8
|
-
style?: ViewStyle;
|
|
9
|
-
}
|
|
10
|
-
export declare const MkBadge: React.FC<MkBadgeProps>;
|
|
11
|
-
//# sourceMappingURL=MkBadge.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
interface MkButtonProps {
|
|
4
|
-
label: string;
|
|
5
|
-
variant?: 'primary' | 'outline' | 'ghost' | 'error';
|
|
6
|
-
loading?: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
onPress?: () => void;
|
|
9
|
-
style?: ViewStyle;
|
|
10
|
-
}
|
|
11
|
-
export declare const MkButton: React.FC<MkButtonProps>;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=MkButton.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
export interface MkCardProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
title?: string;
|
|
6
|
-
subtitle?: string;
|
|
7
|
-
headerRight?: React.ReactNode;
|
|
8
|
-
footer?: React.ReactNode;
|
|
9
|
-
variant?: 'default' | 'outlined' | 'elevated';
|
|
10
|
-
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
11
|
-
onPress?: () => void;
|
|
12
|
-
style?: ViewStyle;
|
|
13
|
-
}
|
|
14
|
-
export declare const MkCard: React.FC<MkCardProps>;
|
|
15
|
-
//# sourceMappingURL=MkCard.d.ts.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
/**
|
|
4
|
-
* @module MkCheck
|
|
5
|
-
* @description Checkbox component for React Native. Same prop API as mk-web MkCheck.
|
|
6
|
-
*/
|
|
7
|
-
export interface MkCheckProps {
|
|
8
|
-
label?: string;
|
|
9
|
-
checked?: boolean;
|
|
10
|
-
indeterminate?: boolean;
|
|
11
|
-
onChange?: (checked: boolean) => void;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
error?: string;
|
|
14
|
-
size?: 'sm' | 'md' | 'lg';
|
|
15
|
-
style?: ViewStyle;
|
|
16
|
-
}
|
|
17
|
-
export declare const MkCheck: React.FC<MkCheckProps>;
|
|
18
|
-
//# sourceMappingURL=MkCheck.d.ts.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
/**
|
|
4
|
-
* @module MkDatePicker (Mobile)
|
|
5
|
-
* @description Dependency-free DatePicker wrapper for React Native.
|
|
6
|
-
* Uses a dynamic import for `@react-native-community/datetimepicker` to show a modal picker.
|
|
7
|
-
*
|
|
8
|
-
* **Requires**: `npm install @react-native-community/datetimepicker`
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <MkDatePicker
|
|
13
|
-
* label="Fecha de nacimiento"
|
|
14
|
-
* value="2000-01-01"
|
|
15
|
-
* onChange={setDate}
|
|
16
|
-
* />
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export interface MkDatePickerProps {
|
|
20
|
-
label?: string;
|
|
21
|
-
value?: string;
|
|
22
|
-
onChange?: (value: string) => void;
|
|
23
|
-
error?: string;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
min?: string;
|
|
26
|
-
max?: string;
|
|
27
|
-
style?: ViewStyle;
|
|
28
|
-
}
|
|
29
|
-
export declare const MkDatePicker: React.FC<MkDatePickerProps>;
|
|
30
|
-
//# sourceMappingURL=MkDatePicker.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
export interface MkDividerProps {
|
|
4
|
-
label?: string;
|
|
5
|
-
orientation?: 'horizontal' | 'vertical';
|
|
6
|
-
variant?: 'solid' | 'dashed' | 'dotted';
|
|
7
|
-
spacing?: 'sm' | 'md' | 'lg';
|
|
8
|
-
style?: ViewStyle;
|
|
9
|
-
}
|
|
10
|
-
export declare const MkDivider: React.FC<MkDividerProps>;
|
|
11
|
-
//# sourceMappingURL=MkDivider.d.ts.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
/**
|
|
4
|
-
* @module MkDropDown (Mobile)
|
|
5
|
-
* @description Floating action menu as a Modal bottom-sheet-style popup.
|
|
6
|
-
* Same prop API as mk-web's MkDropDown: options, onSelect, withSearch, value.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* <MkDropDown
|
|
11
|
-
* options={[
|
|
12
|
-
* { value: 'edit', label: 'Editar', icon: <EditIcon /> },
|
|
13
|
-
* { value: 'delete', label: 'Eliminar' },
|
|
14
|
-
* ]}
|
|
15
|
-
* onSelect={(val) => handleAction(val)}
|
|
16
|
-
* withSearch
|
|
17
|
-
* />
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export interface MkDropdownOptionType {
|
|
21
|
-
value: string | number;
|
|
22
|
-
label: string;
|
|
23
|
-
icon?: React.ReactNode;
|
|
24
|
-
}
|
|
25
|
-
export interface MkDropDownProps {
|
|
26
|
-
options: MkDropdownOptionType[];
|
|
27
|
-
onSelect: (value: string | number) => void;
|
|
28
|
-
/** Custom trigger element. Default: "⋮" icon. */
|
|
29
|
-
initiator?: React.ReactNode;
|
|
30
|
-
withSearch?: boolean;
|
|
31
|
-
value?: string | number;
|
|
32
|
-
placeholder?: string;
|
|
33
|
-
/** Style for the container */
|
|
34
|
-
style?: ViewStyle;
|
|
35
|
-
}
|
|
36
|
-
export declare const MkDropDown: React.FC<MkDropDownProps>;
|
|
37
|
-
//# sourceMappingURL=MkDropDown.d.ts.map
|