@ericbutera/kaleido 0.1.8 → 0.2.0

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.
Files changed (44) hide show
  1. package/dist/{components/admin/AdminLayout.d.ts → admin/components/Layout.d.ts} +1 -1
  2. package/dist/admin/components/Route.d.ts +1 -0
  3. package/dist/admin/components/adminLayoutConfig.d.ts +9 -0
  4. package/dist/{components → admin/components}/tasks/List.d.ts +1 -2
  5. package/dist/admin/components/tasks/Modal.d.ts +7 -0
  6. package/dist/admin/components/users/List.d.ts +7 -0
  7. package/dist/admin/components/users/Modal.d.ts +8 -0
  8. package/dist/admin/components/users/index.d.ts +2 -0
  9. package/dist/admin/index.d.ts +7 -0
  10. package/dist/admin/pages/Dashboard.d.ts +1 -0
  11. package/dist/admin/pages/FeatureFlags.d.ts +1 -0
  12. package/dist/admin/pages/Users.d.ts +1 -0
  13. package/dist/{lib/params/adminTasksParams.d.ts → admin/params/TasksParams.d.ts} +7 -8
  14. package/dist/admin/params/UsersParams.d.ts +18 -0
  15. package/dist/auth/components/ProtectedRoute.d.ts +3 -0
  16. package/dist/auth/index.d.ts +2 -0
  17. package/dist/auth/lib/useAuth.d.ts +8 -0
  18. package/dist/components/featureFlags/FeatureFlagStatus.d.ts +9 -0
  19. package/dist/components/index.d.ts +1 -4
  20. package/dist/configureKaleido.d.ts +26 -0
  21. package/dist/featureFlags/defaults.d.ts +3 -0
  22. package/dist/featureFlags/index.d.ts +2 -0
  23. package/dist/featureFlags/useFeatureFlag.d.ts +86 -0
  24. package/dist/index.d.ts +12 -7
  25. package/dist/index.js +4071 -2541
  26. package/dist/kaleido.d.ts +44 -0
  27. package/dist/lib/apiHelpers.d.ts +15 -0
  28. package/dist/openapi/createKaleidoOpenApiAdapters.d.ts +44 -0
  29. package/dist/openapi/createKaleidoOpenApiAuthClient.d.ts +35 -0
  30. package/dist/openapi/index.d.ts +2 -0
  31. package/dist/tasks/index.d.ts +2 -0
  32. package/dist/tasks/useTasks.d.ts +27 -0
  33. package/dist/users/index.d.ts +2 -0
  34. package/dist/users/useUsers.d.ts +74 -0
  35. package/package.json +74 -72
  36. package/dist/auth/lib/featureFlags.d.ts +0 -21
  37. package/dist/components/admin/tasks/List.d.ts +0 -1
  38. package/dist/components/admin/tasks/Modal.d.ts +0 -1
  39. package/dist/components/tasks/Modal.d.ts +0 -7
  40. package/dist/lib/openapi/react-query/api.d.ts +0 -1
  41. package/dist/lib/queries.d.ts +0 -6
  42. package/dist/lib/tasksApi.d.ts +0 -13
  43. package/dist/pages/index.d.ts +0 -1
  44. /package/dist/{pages/admin → admin/pages}/Tasks.d.ts +0 -0
@@ -0,0 +1,44 @@
1
+ import { AuthApiClient, User } from './auth';
2
+ type OpenApiClientLike = {
3
+ useQuery: (...args: any[]) => any;
4
+ useMutation: (...args: any[]) => any;
5
+ };
6
+ type QueryClientLike = {
7
+ invalidateQueries: (args: {
8
+ queryKey: any[];
9
+ }) => unknown;
10
+ refetchQueries: (args: {
11
+ queryKey: any[];
12
+ }) => unknown;
13
+ clear: () => unknown;
14
+ };
15
+ export type KaleidoToggleConfig = {
16
+ auth?: boolean;
17
+ featureFlags?: boolean;
18
+ tasks?: boolean;
19
+ adminUsers?: boolean;
20
+ };
21
+ export type KaleidoRuntimeConfig = {
22
+ api: OpenApiClientLike;
23
+ useQueryClient: () => QueryClientLike;
24
+ toast?: {
25
+ success?: (message: string) => unknown;
26
+ };
27
+ mapCurrentUser?: (rawUser: any) => User | null;
28
+ };
29
+ export type KaleidoAppConfig = KaleidoRuntimeConfig & KaleidoToggleConfig;
30
+ declare class KaleidoApp {
31
+ private authClient;
32
+ configure(config: KaleidoAppConfig): void;
33
+ createAuthApiClient(): AuthApiClient;
34
+ useAuth(): {
35
+ readonly user: User | null;
36
+ readonly isLoading: boolean;
37
+ readonly signIn: (email: string, password: string) => Promise<void>;
38
+ readonly signUp: (email: string, password: string, name?: string) => Promise<void>;
39
+ readonly signOut: () => Promise<void>;
40
+ readonly completeOAuthLogin: (_userData?: unknown) => Promise<boolean>;
41
+ };
42
+ }
43
+ declare const kaleido: KaleidoApp;
44
+ export default kaleido;
@@ -0,0 +1,15 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { default as createFetchClientOrig } from 'openapi-fetch';
3
+ export type ApiError = {
4
+ status: "error";
5
+ message?: string;
6
+ errors?: Record<string, string[]>;
7
+ };
8
+ export declare function handleApiError(err: any): ApiError;
9
+ export declare function newQueryClient(): QueryClient;
10
+ export declare const fetchWithCredentials: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
11
+ export declare function createFetchClient(opts: {
12
+ baseUrl: string;
13
+ fetch?: typeof fetch;
14
+ }): import('openapi-fetch').Client<{}, `${string}/${string}`>;
15
+ export declare function createClient<T extends {}>(fetchClient: ReturnType<typeof createFetchClientOrig>): import('openapi-react-query').OpenapiQueryClient<T, `${string}/${string}`>;
@@ -0,0 +1,44 @@
1
+ import { KaleidoFeatureAdapters } from '../configureKaleido';
2
+ import { User } from '../users/useUsers';
3
+ type OpenApiClientLike = {
4
+ useQuery: (...args: any[]) => any;
5
+ useMutation: (...args: any[]) => any;
6
+ };
7
+ type QueryClientLike = {
8
+ invalidateQueries: (args: {
9
+ queryKey: any[];
10
+ }) => unknown;
11
+ };
12
+ export interface FeatureFlagsOpenApiMapping {
13
+ listPath: string;
14
+ adminListPath: string;
15
+ updatePath: string;
16
+ extractListData?: (responseData: any) => any[];
17
+ }
18
+ export interface TasksOpenApiMapping {
19
+ listPath: string;
20
+ detailPath: string;
21
+ }
22
+ export interface UsersOpenApiMapping {
23
+ listPath: string;
24
+ detailPath: string;
25
+ createPath: string;
26
+ updatePath: string;
27
+ resendForgotPasswordPath: string;
28
+ resendConfirmationPath: string;
29
+ disablePath: string;
30
+ extractListData?: (responseData: any) => User[];
31
+ extractDetailData?: (responseData: any) => User | null;
32
+ }
33
+ export interface CreateKaleidoOpenApiAdaptersOptions {
34
+ api: OpenApiClientLike;
35
+ useQueryClient: () => QueryClientLike;
36
+ toast?: {
37
+ success?: (message: string) => unknown;
38
+ };
39
+ featureFlags?: Partial<FeatureFlagsOpenApiMapping>;
40
+ tasks?: Partial<TasksOpenApiMapping>;
41
+ users?: Partial<UsersOpenApiMapping>;
42
+ }
43
+ export declare function createKaleidoOpenApiAdapters(options: CreateKaleidoOpenApiAdaptersOptions): Pick<KaleidoFeatureAdapters, "tasks" | "featureFlags" | "users">;
44
+ export {};
@@ -0,0 +1,35 @@
1
+ import { AuthApiClient, User } from '../auth/lib/types';
2
+ type OpenApiClientLike = {
3
+ useQuery: (...args: any[]) => any;
4
+ useMutation: (...args: any[]) => any;
5
+ };
6
+ type QueryClientLike = {
7
+ invalidateQueries: (args: {
8
+ queryKey: any[];
9
+ }) => unknown;
10
+ refetchQueries: (args: {
11
+ queryKey: any[];
12
+ }) => unknown;
13
+ clear: () => unknown;
14
+ };
15
+ export interface AuthOpenApiMapping {
16
+ currentPath: string;
17
+ loginPath: string;
18
+ registerPath: string;
19
+ forgotPath: string;
20
+ resetPath: string;
21
+ verifyPath: string;
22
+ resendConfirmationPath: string;
23
+ logoutPath: string;
24
+ refreshPath: string;
25
+ }
26
+ export interface CreateKaleidoOpenApiAuthClientOptions {
27
+ api: OpenApiClientLike;
28
+ useQueryClient: () => QueryClientLike;
29
+ paths?: Partial<AuthOpenApiMapping>;
30
+ currentUserQueryKey?: any[];
31
+ sellerMeQueryKey?: any[];
32
+ mapCurrentUser?: (rawUser: any) => User | null;
33
+ }
34
+ export declare function createKaleidoOpenApiAuthClient(options: CreateKaleidoOpenApiAuthClientOptions): AuthApiClient;
35
+ export {};
@@ -0,0 +1,2 @@
1
+ export { createKaleidoOpenApiAdapters, type CreateKaleidoOpenApiAdaptersOptions, type FeatureFlagsOpenApiMapping, type TasksOpenApiMapping, } from './createKaleidoOpenApiAdapters';
2
+ export { createKaleidoOpenApiAuthClient, type AuthOpenApiMapping, type CreateKaleidoOpenApiAuthClientOptions, } from './createKaleidoOpenApiAuthClient';
@@ -0,0 +1,2 @@
1
+ export { configureTasks, useTask, useTasks } from './useTasks';
2
+ export type { Task, TasksConfig, UseTasksResult } from './useTasks';
@@ -0,0 +1,27 @@
1
+ import { PaginatedQueryResult } from '../lib/paginatedQuery';
2
+ export interface Task {
3
+ id: string | number;
4
+ task_type?: string;
5
+ status?: "pending" | "running" | "completed" | "failed" | string;
6
+ attempts?: number;
7
+ max_attempts?: number;
8
+ error?: string | null;
9
+ created_at?: string;
10
+ [key: string]: any;
11
+ }
12
+ export interface UseTasksResult extends PaginatedQueryResult<Task> {
13
+ refetch?: () => void;
14
+ }
15
+ export interface TasksConfig {
16
+ useTasks: (params?: any) => UseTasksResult;
17
+ useTask?: (id: string | null) => {
18
+ data: Task | null;
19
+ isLoading: boolean;
20
+ };
21
+ }
22
+ export declare function configureTasks(cfg: TasksConfig): void;
23
+ export declare function useTasks(params?: any): UseTasksResult;
24
+ export declare function useTask(id: string | null): {
25
+ data: Task | null;
26
+ isLoading: boolean;
27
+ };
@@ -0,0 +1,2 @@
1
+ export { configureUsers, useCreateUser, useDisableUserAccount, useResendConfirmationEmail, useResendForgotPassword, useUpdateUser, useUser, useUsers, } from './useUsers';
2
+ export type { CreateUserInput, DisableUserInput, UpdateUserInput, User, UserActionInput, UserFormData, UsersConfig, UsersMutation, UseUsersResult, } from './useUsers';
@@ -0,0 +1,74 @@
1
+ import { PaginatedQueryResult } from '../lib/paginatedQuery';
2
+ export interface User {
3
+ id: string | number;
4
+ email?: string;
5
+ name?: string;
6
+ is_admin?: boolean;
7
+ verified?: boolean;
8
+ email_verified_at?: string | null;
9
+ disabled?: boolean;
10
+ is_disabled?: boolean;
11
+ active?: boolean;
12
+ created_at?: string;
13
+ updated_at?: string;
14
+ [key: string]: any;
15
+ }
16
+ export interface UseUsersResult extends PaginatedQueryResult<User> {
17
+ refetch?: () => void;
18
+ }
19
+ export type UsersMutation<TInput = any, TResult = any> = {
20
+ mutateAsync: (input: TInput) => Promise<TResult>;
21
+ isPending: boolean;
22
+ };
23
+ export interface CreateUserInput {
24
+ email: string;
25
+ name?: string;
26
+ password?: string;
27
+ is_admin?: boolean;
28
+ [key: string]: any;
29
+ }
30
+ export type UserFormData = Omit<CreateUserInput, "is_admin"> & {
31
+ is_admin: boolean;
32
+ };
33
+ export interface UpdateUserInput {
34
+ email?: string;
35
+ name?: string;
36
+ is_admin?: boolean;
37
+ [key: string]: any;
38
+ }
39
+ export interface UserActionInput {
40
+ id: string;
41
+ [key: string]: any;
42
+ }
43
+ export interface DisableUserInput extends UserActionInput {
44
+ disabled?: boolean;
45
+ }
46
+ export interface UsersConfig {
47
+ useUsers: (params?: any) => UseUsersResult;
48
+ useUser?: (id: string | null) => {
49
+ data: User | null;
50
+ isLoading: boolean;
51
+ };
52
+ useCreateUser: () => UsersMutation<CreateUserInput, any>;
53
+ useUpdateUser: () => UsersMutation<{
54
+ id: string;
55
+ data: UpdateUserInput;
56
+ }, any>;
57
+ useResendForgotPassword: () => UsersMutation<UserActionInput, any>;
58
+ useResendConfirmationEmail: () => UsersMutation<UserActionInput, any>;
59
+ useDisableUserAccount: () => UsersMutation<DisableUserInput, any>;
60
+ }
61
+ export declare function configureUsers(cfg: UsersConfig): void;
62
+ export declare function useUsers(params?: any): UseUsersResult;
63
+ export declare function useUser(id: string | null): {
64
+ data: User | null;
65
+ isLoading: boolean;
66
+ };
67
+ export declare function useCreateUser(): UsersMutation<CreateUserInput, any>;
68
+ export declare function useUpdateUser(): UsersMutation<{
69
+ id: string;
70
+ data: UpdateUserInput;
71
+ }, any>;
72
+ export declare function useResendForgotPassword(): UsersMutation<UserActionInput, any>;
73
+ export declare function useResendConfirmationEmail(): UsersMutation<UserActionInput, any>;
74
+ export declare function useDisableUserAccount(): UsersMutation<DisableUserInput, any>;
package/package.json CHANGED
@@ -1,74 +1,76 @@
1
1
  {
2
- "name": "@ericbutera/kaleido",
3
- "version": "0.1.8",
4
- "description": "Shared UI components and framework utilities for Kaleido",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
12
- }
13
- },
14
- "files": [
15
- "dist",
16
- "README.md"
17
- ],
18
- "scripts": {
19
- "build": "npx vite build",
20
- "dev": "npx vite build --watch",
21
- "lint": "eslint src",
22
- "clean": "rm -rf dist",
23
- "typecheck": "npx tsc --noEmit"
24
- },
25
- "peerDependencies": {
26
- "@fortawesome/fontawesome-svg-core": ">=6.0.0",
27
- "@fortawesome/free-solid-svg-icons": ">=6.0.0",
28
- "@fortawesome/react-fontawesome": ">=3.1.0",
29
- "@tanstack/react-query": "^5.0.0",
30
- "react": "^18.0.0 || ^19.0.0",
31
- "react-dom": "^18.0.0 || ^19.0.0",
32
- "react-hook-form": "^7.0.0",
33
- "react-hot-toast": "^2.0.0",
34
- "react-router-dom": "^6.0.0 || ^7.0.0"
35
- },
36
- "dependencies": {
37
- "@fortawesome/free-brands-svg-icons": "^7.2.0",
38
- "@types/lodash-es": "^4.17.12",
39
- "lodash-es": "^4.17.23",
40
- "qrcode.react": "^4.2.0",
41
- "zod": "^3.23.0"
42
- },
43
- "devDependencies": {
44
- "@fortawesome/fontawesome-svg-core": "^7.1.0",
45
- "@fortawesome/free-solid-svg-icons": "^7.1.0",
46
- "@fortawesome/react-fontawesome": "^3.1.1",
47
- "@tanstack/react-query": "^5.0.0",
48
- "@types/node": "^25.3.0",
49
- "@types/react": "^19.2.5",
50
- "@types/react-dom": "^19.2.3",
51
- "@vitejs/plugin-react": "^5.1.1",
52
- "eslint": "^9.39.1",
53
- "react": "^19.2.0",
54
- "react-dom": "^19.2.0",
55
- "react-hook-form": "^7.71.1",
56
- "react-hot-toast": "^2.6.0",
57
- "react-router-dom": "^7.0.0",
58
- "typescript": "~5.9.3",
59
- "vite": "^7.2.4",
60
- "vite-plugin-dts": "^4.3.0"
61
- },
62
- "keywords": [
63
- "kaleido",
64
- "ui",
65
- "components"
66
- ],
67
- "author": "Eric Butera",
68
- "license": "MIT",
69
- "repository": {
70
- "type": "git",
71
- "url": "https://github.com/ericbutera/kaleido",
72
- "directory": "typescript/packages/kaleido"
2
+ "name": "@ericbutera/kaleido",
3
+ "version": "0.2.0",
4
+ "description": "Shared UI components and framework utilities for Kaleido",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
73
12
  }
74
- }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "peerDependencies": {
19
+ "@fortawesome/fontawesome-svg-core": ">=6.0.0",
20
+ "@fortawesome/free-solid-svg-icons": ">=6.0.0",
21
+ "@fortawesome/react-fontawesome": ">=3.1.0",
22
+ "@tanstack/react-query": "^5.0.0",
23
+ "react": "^18.0.0 || ^19.0.0",
24
+ "react-dom": "^18.0.0 || ^19.0.0",
25
+ "react-hook-form": "^7.0.0",
26
+ "react-hot-toast": "^2.0.0",
27
+ "react-router-dom": "^6.0.0 || ^7.0.0"
28
+ },
29
+ "dependencies": {
30
+ "@fortawesome/free-brands-svg-icons": "^7.2.0",
31
+ "openapi-fetch": "^0.17.0",
32
+ "openapi-react-query": "^0.5.4",
33
+ "@types/lodash-es": "^4.17.12",
34
+ "lodash-es": "^4.17.23",
35
+ "qrcode.react": "^4.2.0",
36
+ "zod": "^3.23.0"
37
+ },
38
+ "devDependencies": {
39
+ "@fortawesome/fontawesome-svg-core": "^7.1.0",
40
+ "@fortawesome/free-solid-svg-icons": "^7.1.0",
41
+ "@fortawesome/react-fontawesome": "^3.1.1",
42
+ "@tanstack/react-query": "^5.0.0",
43
+ "@types/node": "^25.3.0",
44
+ "@types/react": "^19.2.5",
45
+ "@types/react-dom": "^19.2.3",
46
+ "@vitejs/plugin-react": "^5.1.1",
47
+ "eslint": "^10.0.1",
48
+ "react": "^19.2.0",
49
+ "react-dom": "^19.2.0",
50
+ "react-hook-form": "^7.71.1",
51
+ "react-hot-toast": "^2.6.0",
52
+ "react-router-dom": "^7.0.0",
53
+ "typescript": "~5.9.3",
54
+ "vite": "^7.2.4",
55
+ "vite-plugin-dts": "^4.5.4"
56
+ },
57
+ "keywords": [
58
+ "kaleido",
59
+ "ui",
60
+ "components"
61
+ ],
62
+ "author": "Eric Butera",
63
+ "license": "MIT",
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "https://github.com/ericbutera/kaleido",
67
+ "directory": "typescript/packages/kaleido"
68
+ },
69
+ "scripts": {
70
+ "build": "npx vite build",
71
+ "dev": "npx vite build --watch",
72
+ "lint": "eslint src",
73
+ "clean": "rm -rf dist",
74
+ "typecheck": "npx tsc --noEmit"
75
+ }
76
+ }
@@ -1,21 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export declare const FLAG_OAUTH = "oauth";
3
- export declare const FLAG_REGISTRATION = "registration";
4
- export interface FeatureFlagClient {
5
- useFeatureFlag(flag: string): boolean;
6
- }
7
- export declare function FeatureFlagProvider({ client, children, }: {
8
- client?: FeatureFlagClient;
9
- children: ReactNode;
10
- }): import("react/jsx-runtime").JSX.Element;
11
- /**
12
- * Hook to read a single feature flag. This delegates to the configured
13
- * `FeatureFlagClient` so callers can be provider-agnostic (local flags,
14
- * LaunchDarkly, remote config, etc.).
15
- */
16
- export declare function useFeatureFlag(flag: string): boolean;
17
- /**
18
- * Helper to expose the raw client for advanced use-cases.
19
- */
20
- export declare function useFeatureFlagClient(): FeatureFlagClient;
21
- export default FeatureFlagProvider;
@@ -1 +0,0 @@
1
- export { default } from '../../tasks/List';
@@ -1 +0,0 @@
1
- export { default } from '../../tasks/Modal';
@@ -1,7 +0,0 @@
1
- import { components } from '../../lib/openapi/react-query/api';
2
- interface ModalProps {
3
- selectedTask: components["schemas"]["AdminTaskResponse"] | null;
4
- setSelectedTask: (task: components["schemas"]["AdminTaskResponse"] | null) => void;
5
- }
6
- export default function Modal({ selectedTask, setSelectedTask }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
7
- export {};
@@ -1 +0,0 @@
1
- export type components = Record<string, any>;
@@ -1,6 +0,0 @@
1
- import { PaginatedQueryResult } from './paginatedQuery';
2
- export declare function useAdminTasks(_params: any): PaginatedQueryResult<any>;
3
- export declare function useAdminTask(_id: string | null): {
4
- data: null;
5
- isLoading: boolean;
6
- };
@@ -1,13 +0,0 @@
1
- import { PaginatedQueryResult } from './paginatedQuery';
2
- export interface Task {
3
- id: string | number;
4
- [key: string]: any;
5
- }
6
- export interface TasksApiClient {
7
- useList: (params: any) => PaginatedQueryResult<Task>;
8
- useGet: (id: string | null) => {
9
- data: Task | null;
10
- isLoading: boolean;
11
- };
12
- }
13
- export declare function useTasksApi(): TasksApiClient;
@@ -1 +0,0 @@
1
- export { default as AdminTasks } from './admin/Tasks';
File without changes