@nocios/crudify-ui 4.0.2 → 4.0.4

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/index.d.mts CHANGED
@@ -3,7 +3,6 @@ export * from '@nocios/crudify-browser';
3
3
  export { default as crudify } from '@nocios/crudify-browser';
4
4
  import React, { ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { Theme } from '@mui/material/styles';
7
6
 
8
7
  type BoxScreenType = "login" | "signUp" | "forgotPassword" | "resetPassword" | "checkCode";
9
8
  interface CrudifyLoginConfig {
@@ -11,11 +10,6 @@ interface CrudifyLoginConfig {
11
10
  env?: "dev" | "stg" | "api" | "prod";
12
11
  appName?: string;
13
12
  logo?: string;
14
- colors?: {
15
- primaryColor?: string;
16
- bgColor?: string;
17
- [key: string]: string | undefined;
18
- };
19
13
  loginActions?: string[];
20
14
  }
21
15
  interface CrudifyLoginTranslations {
@@ -382,11 +376,6 @@ type CrudifyConfig = {
382
376
  appName?: string;
383
377
  loginActions?: string[];
384
378
  logo?: string;
385
- colors?: {
386
- primaryColor?: string;
387
- bgColor?: string;
388
- [key: string]: string | undefined;
389
- };
390
379
  };
391
380
  type SessionContextType = {
392
381
  isAuthenticated: boolean;
@@ -813,78 +802,4 @@ declare const useCrudifyWithNotifications: (options?: CrudifyWithNotificationsOp
813
802
  shouldShowNotification: (response: CrudifyResponse) => boolean;
814
803
  };
815
804
 
816
- interface CrudifyThemeColors {
817
- primary: {
818
- main: string;
819
- light: string;
820
- dark: string;
821
- contrastText: string;
822
- };
823
- secondary: {
824
- main: string;
825
- light: string;
826
- dark: string;
827
- contrastText: string;
828
- };
829
- background: {
830
- default: string;
831
- paper: string;
832
- light: string;
833
- };
834
- button: {
835
- primary: {
836
- background: string;
837
- backgroundHover: string;
838
- border: string;
839
- borderHover: string;
840
- text: string;
841
- textHover: string;
842
- };
843
- secondary: {
844
- background: string;
845
- backgroundHover: string;
846
- border: string;
847
- borderHover: string;
848
- text: string;
849
- textHover: string;
850
- };
851
- };
852
- input: {
853
- background: string;
854
- border: string;
855
- borderFocus: string;
856
- text: string;
857
- placeholder: string;
858
- };
859
- text: {
860
- primary: string;
861
- secondary: string;
862
- disabled: string;
863
- };
864
- divider: string;
865
- error: {
866
- main: string;
867
- light: string;
868
- dark: string;
869
- };
870
- warning: {
871
- main: string;
872
- light: string;
873
- dark: string;
874
- };
875
- success: {
876
- main: string;
877
- light: string;
878
- dark: string;
879
- };
880
- info: {
881
- main: string;
882
- light: string;
883
- dark: string;
884
- };
885
- }
886
- declare const defaultCrudifyColors: CrudifyThemeColors;
887
- declare const createCrudifyTheme: (colors?: Partial<CrudifyThemeColors>) => Theme;
888
- declare const getCrudifyThemeFromCookies: () => Theme;
889
-
890
- export { type ApiError, type BoxScreenType, type CrudifyApiResponse, CrudifyLogin, type CrudifyLoginConfig, type CrudifyLoginProps, type CrudifyLoginTranslations, type CrudifyThemeColors, type CrudifyTransactionResponse, ERROR_CODES, ERROR_SEVERITY_MAP, type ErrorCode, type ErrorSeverity, type ErrorTranslationConfig, type ForgotPasswordRequest, GlobalNotificationProvider, type GlobalNotificationProviderProps, type JwtPayload, LoginComponent, type LoginRequest, type LoginResponse, type LoginResult, type Notification, type NotificationOptions, type NotificationSeverity, POLICY_ACTIONS, PREFERRED_POLICY_ORDER, type ParsedError, Policies, type PolicyAction, ProtectedRoute, type ProtectedRouteProps, type ResetPasswordRequest, type SessionConfig, SessionDebugInfo, SessionManager, SessionProvider, type SessionProviderProps, type SessionState, SessionStatus, type StorageType, type TokenData, TokenStorage, type TransactionResponseData, type UseAuthReturn, type UseDataReturn, type UseSessionOptions, type UseUserDataOptions, type UseUserDataReturn, type UserData, type UserLoginData, type UserProfile, UserProfileDisplay, type ValidateCodeRequest, type ValidationError, createCrudifyTheme, createErrorTranslator, decodeJwtSafely, defaultCrudifyColors, getCookie, getCrudifyThemeFromCookies, getCurrentUserEmail, getErrorMessage, handleCrudifyError, isTokenExpired, parseApiError, parseJavaScriptError, parseTransactionError, secureLocalStorage, secureSessionStorage, translateError, translateErrorCode, translateErrorCodes, useAuth, useCrudifyWithNotifications, useData, useGlobalNotification, useSession, useSessionContext, useUserData, useUserProfile };
805
+ export { type ApiError, type BoxScreenType, type CrudifyApiResponse, CrudifyLogin, type CrudifyLoginConfig, type CrudifyLoginProps, type CrudifyLoginTranslations, type CrudifyTransactionResponse, ERROR_CODES, ERROR_SEVERITY_MAP, type ErrorCode, type ErrorSeverity, type ErrorTranslationConfig, type ForgotPasswordRequest, GlobalNotificationProvider, type GlobalNotificationProviderProps, type JwtPayload, LoginComponent, type LoginRequest, type LoginResponse, type LoginResult, type Notification, type NotificationOptions, type NotificationSeverity, POLICY_ACTIONS, PREFERRED_POLICY_ORDER, type ParsedError, Policies, type PolicyAction, ProtectedRoute, type ProtectedRouteProps, type ResetPasswordRequest, type SessionConfig, SessionDebugInfo, SessionManager, SessionProvider, type SessionProviderProps, type SessionState, SessionStatus, type StorageType, type TokenData, TokenStorage, type TransactionResponseData, type UseAuthReturn, type UseDataReturn, type UseSessionOptions, type UseUserDataOptions, type UseUserDataReturn, type UserData, type UserLoginData, type UserProfile, UserProfileDisplay, type ValidateCodeRequest, type ValidationError, createErrorTranslator, decodeJwtSafely, getCookie, getCurrentUserEmail, getErrorMessage, handleCrudifyError, isTokenExpired, parseApiError, parseJavaScriptError, parseTransactionError, secureLocalStorage, secureSessionStorage, translateError, translateErrorCode, translateErrorCodes, useAuth, useCrudifyWithNotifications, useData, useGlobalNotification, useSession, useSessionContext, useUserData, useUserProfile };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ export * from '@nocios/crudify-browser';
3
3
  export { default as crudify } from '@nocios/crudify-browser';
4
4
  import React, { ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { Theme } from '@mui/material/styles';
7
6
 
8
7
  type BoxScreenType = "login" | "signUp" | "forgotPassword" | "resetPassword" | "checkCode";
9
8
  interface CrudifyLoginConfig {
@@ -11,11 +10,6 @@ interface CrudifyLoginConfig {
11
10
  env?: "dev" | "stg" | "api" | "prod";
12
11
  appName?: string;
13
12
  logo?: string;
14
- colors?: {
15
- primaryColor?: string;
16
- bgColor?: string;
17
- [key: string]: string | undefined;
18
- };
19
13
  loginActions?: string[];
20
14
  }
21
15
  interface CrudifyLoginTranslations {
@@ -382,11 +376,6 @@ type CrudifyConfig = {
382
376
  appName?: string;
383
377
  loginActions?: string[];
384
378
  logo?: string;
385
- colors?: {
386
- primaryColor?: string;
387
- bgColor?: string;
388
- [key: string]: string | undefined;
389
- };
390
379
  };
391
380
  type SessionContextType = {
392
381
  isAuthenticated: boolean;
@@ -813,78 +802,4 @@ declare const useCrudifyWithNotifications: (options?: CrudifyWithNotificationsOp
813
802
  shouldShowNotification: (response: CrudifyResponse) => boolean;
814
803
  };
815
804
 
816
- interface CrudifyThemeColors {
817
- primary: {
818
- main: string;
819
- light: string;
820
- dark: string;
821
- contrastText: string;
822
- };
823
- secondary: {
824
- main: string;
825
- light: string;
826
- dark: string;
827
- contrastText: string;
828
- };
829
- background: {
830
- default: string;
831
- paper: string;
832
- light: string;
833
- };
834
- button: {
835
- primary: {
836
- background: string;
837
- backgroundHover: string;
838
- border: string;
839
- borderHover: string;
840
- text: string;
841
- textHover: string;
842
- };
843
- secondary: {
844
- background: string;
845
- backgroundHover: string;
846
- border: string;
847
- borderHover: string;
848
- text: string;
849
- textHover: string;
850
- };
851
- };
852
- input: {
853
- background: string;
854
- border: string;
855
- borderFocus: string;
856
- text: string;
857
- placeholder: string;
858
- };
859
- text: {
860
- primary: string;
861
- secondary: string;
862
- disabled: string;
863
- };
864
- divider: string;
865
- error: {
866
- main: string;
867
- light: string;
868
- dark: string;
869
- };
870
- warning: {
871
- main: string;
872
- light: string;
873
- dark: string;
874
- };
875
- success: {
876
- main: string;
877
- light: string;
878
- dark: string;
879
- };
880
- info: {
881
- main: string;
882
- light: string;
883
- dark: string;
884
- };
885
- }
886
- declare const defaultCrudifyColors: CrudifyThemeColors;
887
- declare const createCrudifyTheme: (colors?: Partial<CrudifyThemeColors>) => Theme;
888
- declare const getCrudifyThemeFromCookies: () => Theme;
889
-
890
- export { type ApiError, type BoxScreenType, type CrudifyApiResponse, CrudifyLogin, type CrudifyLoginConfig, type CrudifyLoginProps, type CrudifyLoginTranslations, type CrudifyThemeColors, type CrudifyTransactionResponse, ERROR_CODES, ERROR_SEVERITY_MAP, type ErrorCode, type ErrorSeverity, type ErrorTranslationConfig, type ForgotPasswordRequest, GlobalNotificationProvider, type GlobalNotificationProviderProps, type JwtPayload, LoginComponent, type LoginRequest, type LoginResponse, type LoginResult, type Notification, type NotificationOptions, type NotificationSeverity, POLICY_ACTIONS, PREFERRED_POLICY_ORDER, type ParsedError, Policies, type PolicyAction, ProtectedRoute, type ProtectedRouteProps, type ResetPasswordRequest, type SessionConfig, SessionDebugInfo, SessionManager, SessionProvider, type SessionProviderProps, type SessionState, SessionStatus, type StorageType, type TokenData, TokenStorage, type TransactionResponseData, type UseAuthReturn, type UseDataReturn, type UseSessionOptions, type UseUserDataOptions, type UseUserDataReturn, type UserData, type UserLoginData, type UserProfile, UserProfileDisplay, type ValidateCodeRequest, type ValidationError, createCrudifyTheme, createErrorTranslator, decodeJwtSafely, defaultCrudifyColors, getCookie, getCrudifyThemeFromCookies, getCurrentUserEmail, getErrorMessage, handleCrudifyError, isTokenExpired, parseApiError, parseJavaScriptError, parseTransactionError, secureLocalStorage, secureSessionStorage, translateError, translateErrorCode, translateErrorCodes, useAuth, useCrudifyWithNotifications, useData, useGlobalNotification, useSession, useSessionContext, useUserData, useUserProfile };
805
+ export { type ApiError, type BoxScreenType, type CrudifyApiResponse, CrudifyLogin, type CrudifyLoginConfig, type CrudifyLoginProps, type CrudifyLoginTranslations, type CrudifyTransactionResponse, ERROR_CODES, ERROR_SEVERITY_MAP, type ErrorCode, type ErrorSeverity, type ErrorTranslationConfig, type ForgotPasswordRequest, GlobalNotificationProvider, type GlobalNotificationProviderProps, type JwtPayload, LoginComponent, type LoginRequest, type LoginResponse, type LoginResult, type Notification, type NotificationOptions, type NotificationSeverity, POLICY_ACTIONS, PREFERRED_POLICY_ORDER, type ParsedError, Policies, type PolicyAction, ProtectedRoute, type ProtectedRouteProps, type ResetPasswordRequest, type SessionConfig, SessionDebugInfo, SessionManager, SessionProvider, type SessionProviderProps, type SessionState, SessionStatus, type StorageType, type TokenData, TokenStorage, type TransactionResponseData, type UseAuthReturn, type UseDataReturn, type UseSessionOptions, type UseUserDataOptions, type UseUserDataReturn, type UserData, type UserLoginData, type UserProfile, UserProfileDisplay, type ValidateCodeRequest, type ValidationError, createErrorTranslator, decodeJwtSafely, getCookie, getCurrentUserEmail, getErrorMessage, handleCrudifyError, isTokenExpired, parseApiError, parseJavaScriptError, parseTransactionError, secureLocalStorage, secureSessionStorage, translateError, translateErrorCode, translateErrorCodes, useAuth, useCrudifyWithNotifications, useData, useGlobalNotification, useSession, useSessionContext, useUserData, useUserProfile };
package/dist/index.js CHANGED
@@ -46,13 +46,10 @@ __export(index_exports, {
46
46
  SessionStatus: () => SessionStatus,
47
47
  TokenStorage: () => TokenStorage,
48
48
  UserProfileDisplay: () => UserProfileDisplay_default,
49
- createCrudifyTheme: () => createCrudifyTheme,
50
49
  createErrorTranslator: () => createErrorTranslator,
51
50
  crudify: () => import_crudify_browser7.default,
52
51
  decodeJwtSafely: () => decodeJwtSafely,
53
- defaultCrudifyColors: () => defaultCrudifyColors,
54
52
  getCookie: () => getCookie,
55
- getCrudifyThemeFromCookies: () => getCrudifyThemeFromCookies,
56
53
  getCurrentUserEmail: () => getCurrentUserEmail,
57
54
  getErrorMessage: () => getErrorMessage,
58
55
  handleCrudifyError: () => handleCrudifyError,
@@ -412,17 +409,8 @@ var LoginStateProvider = ({
412
409
  cookieConfig.logo = decodedLogo;
413
410
  }
414
411
  }
415
- const colorsCookie = getCookie("colors");
416
- if (colorsCookie) {
417
- const decodedColorsString = decodeURIComponent(colorsCookie);
418
- const parsedColors = JSON.parse(decodedColorsString);
419
- cookieConfig.colors = { primaryColor: "#1066BA", ...parsedColors };
420
- } else {
421
- cookieConfig.colors = { primaryColor: "#1066BA" };
422
- }
423
412
  } catch (e) {
424
413
  console.error("Error reading configuration from cookies:", e);
425
- cookieConfig.colors = { primaryColor: "#1066BA" };
426
414
  }
427
415
  }
428
416
  return {
@@ -430,7 +418,6 @@ var LoginStateProvider = ({
430
418
  env: providedConfig?.env,
431
419
  appName: providedConfig?.appName,
432
420
  logo: providedConfig?.logo || cookieConfig.logo,
433
- colors: { ...cookieConfig.colors, ...providedConfig?.colors },
434
421
  loginActions: providedConfig?.loginActions
435
422
  };
436
423
  };
@@ -1652,7 +1639,6 @@ function InnerSessionProvider({
1652
1639
  let appName;
1653
1640
  let loginActions;
1654
1641
  let logo;
1655
- let colors;
1656
1642
  let configSource = "unknown";
1657
1643
  if (propConfig?.publicApiKey) {
1658
1644
  publicApiKey = propConfig.publicApiKey;
@@ -1670,16 +1656,12 @@ function InnerSessionProvider({
1670
1656
  if (propConfig?.logo) {
1671
1657
  logo = propConfig.logo;
1672
1658
  }
1673
- if (propConfig?.colors) {
1674
- colors = propConfig.colors;
1675
- }
1676
1659
  if (!publicApiKey) {
1677
1660
  const cookieApiKey = getCookie("publicApiKey");
1678
1661
  const cookieEnv = getCookie("environment");
1679
1662
  const cookieAppName = getCookie("appName");
1680
1663
  const cookieLoginActions = getCookie("loginActions");
1681
1664
  const cookieLogo = getCookie("logo");
1682
- const cookieColors = getCookie("colors");
1683
1665
  if (cookieApiKey) {
1684
1666
  publicApiKey = cookieApiKey;
1685
1667
  configSource = "cookies";
@@ -1695,23 +1677,13 @@ function InnerSessionProvider({
1695
1677
  loginActions = decodedActions.split(",").map((s) => s.trim()).filter(Boolean);
1696
1678
  }
1697
1679
  if (cookieLogo) logo = decodeURIComponent(cookieLogo);
1698
- if (cookieColors) {
1699
- try {
1700
- const decodedColors = decodeURIComponent(cookieColors);
1701
- colors = JSON.parse(decodedColors);
1702
- } catch (error) {
1703
- console.error("Error parsing colors from cookie:", error);
1704
- colors = {};
1705
- }
1706
- }
1707
1680
  }
1708
1681
  return {
1709
1682
  publicApiKey,
1710
1683
  env,
1711
1684
  appName,
1712
1685
  loginActions,
1713
- logo,
1714
- colors
1686
+ logo
1715
1687
  };
1716
1688
  }, [propConfig]);
1717
1689
  const sessionData = (0, import_react7.useMemo)(() => {
@@ -2935,226 +2907,6 @@ var CrudifyInitializer = ({ children, fallback }) => {
2935
2907
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children });
2936
2908
  };
2937
2909
 
2938
- // src/core/theme.ts
2939
- var import_styles = require("@mui/material/styles");
2940
- var defaultCrudifyColors = {
2941
- primary: {
2942
- main: "#c2d66c",
2943
- light: "#d4e289",
2944
- dark: "#a8c248",
2945
- contrastText: "#1a1a1a"
2946
- },
2947
- secondary: {
2948
- main: "#6cc2d6",
2949
- light: "#89d4e2",
2950
- dark: "#48a8c2",
2951
- contrastText: "#ffffff"
2952
- },
2953
- background: {
2954
- default: "#f8faf4",
2955
- paper: "#ffffff",
2956
- light: "#e8f0d8"
2957
- },
2958
- button: {
2959
- primary: {
2960
- background: "#c2d66c",
2961
- backgroundHover: "#a8c248",
2962
- border: "#a8c248",
2963
- borderHover: "#8fb03d",
2964
- text: "#1a1a1a",
2965
- textHover: "#1a1a1a"
2966
- },
2967
- secondary: {
2968
- background: "transparent",
2969
- backgroundHover: "#f8faf4",
2970
- border: "#c2d66c",
2971
- borderHover: "#a8c248",
2972
- text: "#c2d66c",
2973
- textHover: "#a8c248"
2974
- }
2975
- },
2976
- input: {
2977
- background: "#ffffff",
2978
- border: "#d1d5db",
2979
- borderFocus: "#c2d66c",
2980
- text: "#1a1a1a",
2981
- placeholder: "#6b7280"
2982
- },
2983
- text: {
2984
- primary: "#1a1a1a",
2985
- secondary: "#4b5563",
2986
- disabled: "#9ca3af"
2987
- },
2988
- divider: "#e5e7eb",
2989
- error: {
2990
- main: "#ef4444",
2991
- light: "#f87171",
2992
- dark: "#dc2626"
2993
- },
2994
- warning: {
2995
- main: "#f59e0b",
2996
- light: "#fbbf24",
2997
- dark: "#d97706"
2998
- },
2999
- success: {
3000
- main: "#10b981",
3001
- light: "#34d399",
3002
- dark: "#059669"
3003
- },
3004
- info: {
3005
- main: "#3b82f6",
3006
- light: "#60a5fa",
3007
- dark: "#2563eb"
3008
- }
3009
- };
3010
- var createCrudifyTheme = (colors = {}) => {
3011
- const themeColors = { ...defaultCrudifyColors, ...colors };
3012
- return (0, import_styles.createTheme)({
3013
- palette: {
3014
- primary: {
3015
- main: themeColors.primary.main,
3016
- light: themeColors.primary.light,
3017
- dark: themeColors.primary.dark,
3018
- contrastText: themeColors.primary.contrastText
3019
- },
3020
- secondary: {
3021
- main: themeColors.secondary.main,
3022
- light: themeColors.secondary.light,
3023
- dark: themeColors.secondary.dark,
3024
- contrastText: themeColors.secondary.contrastText
3025
- },
3026
- background: {
3027
- default: themeColors.background.default,
3028
- paper: themeColors.background.paper
3029
- },
3030
- text: {
3031
- primary: themeColors.text.primary,
3032
- secondary: themeColors.text.secondary,
3033
- disabled: themeColors.text.disabled
3034
- },
3035
- divider: themeColors.divider,
3036
- error: {
3037
- main: themeColors.error.main,
3038
- light: themeColors.error.light,
3039
- dark: themeColors.error.dark
3040
- },
3041
- warning: {
3042
- main: themeColors.warning.main,
3043
- light: themeColors.warning.light,
3044
- dark: themeColors.warning.dark
3045
- },
3046
- success: {
3047
- main: themeColors.success.main,
3048
- light: themeColors.success.light,
3049
- dark: themeColors.success.dark
3050
- },
3051
- info: {
3052
- main: themeColors.info.main,
3053
- light: themeColors.info.light,
3054
- dark: themeColors.info.dark
3055
- }
3056
- },
3057
- components: {
3058
- MuiButton: {
3059
- styleOverrides: {
3060
- contained: {
3061
- backgroundColor: themeColors.button.primary.background,
3062
- color: themeColors.button.primary.text,
3063
- border: `1px solid ${themeColors.button.primary.border}`,
3064
- "&:hover": {
3065
- backgroundColor: themeColors.button.primary.backgroundHover,
3066
- borderColor: themeColors.button.primary.borderHover,
3067
- color: themeColors.button.primary.textHover
3068
- }
3069
- },
3070
- outlined: {
3071
- backgroundColor: themeColors.button.secondary.background,
3072
- color: themeColors.button.secondary.text,
3073
- border: `1px solid ${themeColors.button.secondary.border}`,
3074
- "&:hover": {
3075
- backgroundColor: themeColors.button.secondary.backgroundHover,
3076
- borderColor: themeColors.button.secondary.borderHover,
3077
- color: themeColors.button.secondary.textHover
3078
- }
3079
- }
3080
- }
3081
- },
3082
- MuiTextField: {
3083
- styleOverrides: {
3084
- root: {
3085
- "& .MuiOutlinedInput-root": {
3086
- backgroundColor: themeColors.input.background,
3087
- "& fieldset": {
3088
- borderColor: themeColors.input.border
3089
- },
3090
- "&:hover fieldset": {
3091
- borderColor: themeColors.input.borderFocus
3092
- },
3093
- "&.Mui-focused fieldset": {
3094
- borderColor: themeColors.input.borderFocus
3095
- },
3096
- "& input": {
3097
- color: themeColors.input.text
3098
- },
3099
- "& input::placeholder": {
3100
- color: themeColors.input.placeholder,
3101
- opacity: 1
3102
- }
3103
- }
3104
- }
3105
- }
3106
- },
3107
- MuiInputBase: {
3108
- styleOverrides: {
3109
- input: {
3110
- "&::placeholder": {
3111
- color: themeColors.input.placeholder,
3112
- opacity: 1
3113
- }
3114
- }
3115
- }
3116
- },
3117
- MuiTypography: {
3118
- styleOverrides: {
3119
- h6: {
3120
- color: themeColors.text.primary
3121
- }
3122
- }
3123
- }
3124
- },
3125
- typography: {
3126
- fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif'
3127
- }
3128
- });
3129
- };
3130
- var getCrudifyThemeFromCookies = () => {
3131
- let themeColors = {};
3132
- if (typeof document !== "undefined") {
3133
- try {
3134
- const colorsCookie = document.cookie.split("; ").find((row) => row.startsWith("colors="));
3135
- if (colorsCookie) {
3136
- const decodedColors = decodeURIComponent(colorsCookie.split("=")[1]);
3137
- const parsedColors = JSON.parse(decodedColors);
3138
- if (parsedColors.primaryColor) {
3139
- themeColors.primary = {
3140
- ...defaultCrudifyColors.primary,
3141
- main: parsedColors.primaryColor
3142
- };
3143
- }
3144
- if (parsedColors.bgColor) {
3145
- themeColors.background = {
3146
- ...defaultCrudifyColors.background,
3147
- default: parsedColors.bgColor
3148
- };
3149
- }
3150
- }
3151
- } catch (error) {
3152
- console.error("Error parsing colors from cookie:", error);
3153
- }
3154
- }
3155
- return createCrudifyTheme(themeColors);
3156
- };
3157
-
3158
2910
  // src/components/CrudifyLogin/index.tsx
3159
2911
  var import_jsx_runtime11 = require("react/jsx-runtime");
3160
2912
  var CrudifyLoginInternal = ({
@@ -3248,8 +3000,7 @@ var CrudifyLogin = ({
3248
3000
  ...props
3249
3001
  }) => {
3250
3002
  const { config } = useSessionContext();
3251
- const theme = getCrudifyThemeFromCookies();
3252
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material7.ThemeProvider, { theme, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(I18nProvider, { translations, translationsUrl, language, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CrudifyProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoginStateProvider, { config, initialScreen, autoReadFromCookies, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CrudifyLoginInternal, { ...props }) }) }) }) });
3003
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(I18nProvider, { translations, translationsUrl, language, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CrudifyProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoginStateProvider, { config, initialScreen, autoReadFromCookies, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CrudifyLoginInternal, { ...props }) }) }) });
3253
3004
  };
3254
3005
  var CrudifyLogin_default = CrudifyLogin;
3255
3006
 
@@ -5142,13 +4893,10 @@ var useCrudifyWithNotifications = (options = {}) => {
5142
4893
  SessionStatus,
5143
4894
  TokenStorage,
5144
4895
  UserProfileDisplay,
5145
- createCrudifyTheme,
5146
4896
  createErrorTranslator,
5147
4897
  crudify,
5148
4898
  decodeJwtSafely,
5149
- defaultCrudifyColors,
5150
4899
  getCookie,
5151
- getCrudifyThemeFromCookies,
5152
4900
  getCurrentUserEmail,
5153
4901
  getErrorMessage,
5154
4902
  handleCrudifyError,
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { default as default2 } from "@nocios/crudify-browser";
3
3
  export * from "@nocios/crudify-browser";
4
4
 
5
5
  // src/components/CrudifyLogin/index.tsx
6
- import { Box as Box7, Typography as Typography6, ThemeProvider } from "@mui/material";
6
+ import { Box as Box7, Typography as Typography6 } from "@mui/material";
7
7
 
8
8
  // src/components/CrudifyLogin/context/I18nProvider.tsx
9
9
  import { createContext, useContext, useMemo } from "react";
@@ -336,17 +336,8 @@ var LoginStateProvider = ({
336
336
  cookieConfig.logo = decodedLogo;
337
337
  }
338
338
  }
339
- const colorsCookie = getCookie("colors");
340
- if (colorsCookie) {
341
- const decodedColorsString = decodeURIComponent(colorsCookie);
342
- const parsedColors = JSON.parse(decodedColorsString);
343
- cookieConfig.colors = { primaryColor: "#1066BA", ...parsedColors };
344
- } else {
345
- cookieConfig.colors = { primaryColor: "#1066BA" };
346
- }
347
339
  } catch (e) {
348
340
  console.error("Error reading configuration from cookies:", e);
349
- cookieConfig.colors = { primaryColor: "#1066BA" };
350
341
  }
351
342
  }
352
343
  return {
@@ -354,7 +345,6 @@ var LoginStateProvider = ({
354
345
  env: providedConfig?.env,
355
346
  appName: providedConfig?.appName,
356
347
  logo: providedConfig?.logo || cookieConfig.logo,
357
- colors: { ...cookieConfig.colors, ...providedConfig?.colors },
358
348
  loginActions: providedConfig?.loginActions
359
349
  };
360
350
  };
@@ -1576,7 +1566,6 @@ function InnerSessionProvider({
1576
1566
  let appName;
1577
1567
  let loginActions;
1578
1568
  let logo;
1579
- let colors;
1580
1569
  let configSource = "unknown";
1581
1570
  if (propConfig?.publicApiKey) {
1582
1571
  publicApiKey = propConfig.publicApiKey;
@@ -1594,16 +1583,12 @@ function InnerSessionProvider({
1594
1583
  if (propConfig?.logo) {
1595
1584
  logo = propConfig.logo;
1596
1585
  }
1597
- if (propConfig?.colors) {
1598
- colors = propConfig.colors;
1599
- }
1600
1586
  if (!publicApiKey) {
1601
1587
  const cookieApiKey = getCookie("publicApiKey");
1602
1588
  const cookieEnv = getCookie("environment");
1603
1589
  const cookieAppName = getCookie("appName");
1604
1590
  const cookieLoginActions = getCookie("loginActions");
1605
1591
  const cookieLogo = getCookie("logo");
1606
- const cookieColors = getCookie("colors");
1607
1592
  if (cookieApiKey) {
1608
1593
  publicApiKey = cookieApiKey;
1609
1594
  configSource = "cookies";
@@ -1619,23 +1604,13 @@ function InnerSessionProvider({
1619
1604
  loginActions = decodedActions.split(",").map((s) => s.trim()).filter(Boolean);
1620
1605
  }
1621
1606
  if (cookieLogo) logo = decodeURIComponent(cookieLogo);
1622
- if (cookieColors) {
1623
- try {
1624
- const decodedColors = decodeURIComponent(cookieColors);
1625
- colors = JSON.parse(decodedColors);
1626
- } catch (error) {
1627
- console.error("Error parsing colors from cookie:", error);
1628
- colors = {};
1629
- }
1630
- }
1631
1607
  }
1632
1608
  return {
1633
1609
  publicApiKey,
1634
1610
  env,
1635
1611
  appName,
1636
1612
  loginActions,
1637
- logo,
1638
- colors
1613
+ logo
1639
1614
  };
1640
1615
  }, [propConfig]);
1641
1616
  const sessionData = useMemo2(() => {
@@ -2859,226 +2834,6 @@ var CrudifyInitializer = ({ children, fallback }) => {
2859
2834
  return /* @__PURE__ */ jsx10(Fragment6, { children });
2860
2835
  };
2861
2836
 
2862
- // src/core/theme.ts
2863
- import { createTheme } from "@mui/material/styles";
2864
- var defaultCrudifyColors = {
2865
- primary: {
2866
- main: "#c2d66c",
2867
- light: "#d4e289",
2868
- dark: "#a8c248",
2869
- contrastText: "#1a1a1a"
2870
- },
2871
- secondary: {
2872
- main: "#6cc2d6",
2873
- light: "#89d4e2",
2874
- dark: "#48a8c2",
2875
- contrastText: "#ffffff"
2876
- },
2877
- background: {
2878
- default: "#f8faf4",
2879
- paper: "#ffffff",
2880
- light: "#e8f0d8"
2881
- },
2882
- button: {
2883
- primary: {
2884
- background: "#c2d66c",
2885
- backgroundHover: "#a8c248",
2886
- border: "#a8c248",
2887
- borderHover: "#8fb03d",
2888
- text: "#1a1a1a",
2889
- textHover: "#1a1a1a"
2890
- },
2891
- secondary: {
2892
- background: "transparent",
2893
- backgroundHover: "#f8faf4",
2894
- border: "#c2d66c",
2895
- borderHover: "#a8c248",
2896
- text: "#c2d66c",
2897
- textHover: "#a8c248"
2898
- }
2899
- },
2900
- input: {
2901
- background: "#ffffff",
2902
- border: "#d1d5db",
2903
- borderFocus: "#c2d66c",
2904
- text: "#1a1a1a",
2905
- placeholder: "#6b7280"
2906
- },
2907
- text: {
2908
- primary: "#1a1a1a",
2909
- secondary: "#4b5563",
2910
- disabled: "#9ca3af"
2911
- },
2912
- divider: "#e5e7eb",
2913
- error: {
2914
- main: "#ef4444",
2915
- light: "#f87171",
2916
- dark: "#dc2626"
2917
- },
2918
- warning: {
2919
- main: "#f59e0b",
2920
- light: "#fbbf24",
2921
- dark: "#d97706"
2922
- },
2923
- success: {
2924
- main: "#10b981",
2925
- light: "#34d399",
2926
- dark: "#059669"
2927
- },
2928
- info: {
2929
- main: "#3b82f6",
2930
- light: "#60a5fa",
2931
- dark: "#2563eb"
2932
- }
2933
- };
2934
- var createCrudifyTheme = (colors = {}) => {
2935
- const themeColors = { ...defaultCrudifyColors, ...colors };
2936
- return createTheme({
2937
- palette: {
2938
- primary: {
2939
- main: themeColors.primary.main,
2940
- light: themeColors.primary.light,
2941
- dark: themeColors.primary.dark,
2942
- contrastText: themeColors.primary.contrastText
2943
- },
2944
- secondary: {
2945
- main: themeColors.secondary.main,
2946
- light: themeColors.secondary.light,
2947
- dark: themeColors.secondary.dark,
2948
- contrastText: themeColors.secondary.contrastText
2949
- },
2950
- background: {
2951
- default: themeColors.background.default,
2952
- paper: themeColors.background.paper
2953
- },
2954
- text: {
2955
- primary: themeColors.text.primary,
2956
- secondary: themeColors.text.secondary,
2957
- disabled: themeColors.text.disabled
2958
- },
2959
- divider: themeColors.divider,
2960
- error: {
2961
- main: themeColors.error.main,
2962
- light: themeColors.error.light,
2963
- dark: themeColors.error.dark
2964
- },
2965
- warning: {
2966
- main: themeColors.warning.main,
2967
- light: themeColors.warning.light,
2968
- dark: themeColors.warning.dark
2969
- },
2970
- success: {
2971
- main: themeColors.success.main,
2972
- light: themeColors.success.light,
2973
- dark: themeColors.success.dark
2974
- },
2975
- info: {
2976
- main: themeColors.info.main,
2977
- light: themeColors.info.light,
2978
- dark: themeColors.info.dark
2979
- }
2980
- },
2981
- components: {
2982
- MuiButton: {
2983
- styleOverrides: {
2984
- contained: {
2985
- backgroundColor: themeColors.button.primary.background,
2986
- color: themeColors.button.primary.text,
2987
- border: `1px solid ${themeColors.button.primary.border}`,
2988
- "&:hover": {
2989
- backgroundColor: themeColors.button.primary.backgroundHover,
2990
- borderColor: themeColors.button.primary.borderHover,
2991
- color: themeColors.button.primary.textHover
2992
- }
2993
- },
2994
- outlined: {
2995
- backgroundColor: themeColors.button.secondary.background,
2996
- color: themeColors.button.secondary.text,
2997
- border: `1px solid ${themeColors.button.secondary.border}`,
2998
- "&:hover": {
2999
- backgroundColor: themeColors.button.secondary.backgroundHover,
3000
- borderColor: themeColors.button.secondary.borderHover,
3001
- color: themeColors.button.secondary.textHover
3002
- }
3003
- }
3004
- }
3005
- },
3006
- MuiTextField: {
3007
- styleOverrides: {
3008
- root: {
3009
- "& .MuiOutlinedInput-root": {
3010
- backgroundColor: themeColors.input.background,
3011
- "& fieldset": {
3012
- borderColor: themeColors.input.border
3013
- },
3014
- "&:hover fieldset": {
3015
- borderColor: themeColors.input.borderFocus
3016
- },
3017
- "&.Mui-focused fieldset": {
3018
- borderColor: themeColors.input.borderFocus
3019
- },
3020
- "& input": {
3021
- color: themeColors.input.text
3022
- },
3023
- "& input::placeholder": {
3024
- color: themeColors.input.placeholder,
3025
- opacity: 1
3026
- }
3027
- }
3028
- }
3029
- }
3030
- },
3031
- MuiInputBase: {
3032
- styleOverrides: {
3033
- input: {
3034
- "&::placeholder": {
3035
- color: themeColors.input.placeholder,
3036
- opacity: 1
3037
- }
3038
- }
3039
- }
3040
- },
3041
- MuiTypography: {
3042
- styleOverrides: {
3043
- h6: {
3044
- color: themeColors.text.primary
3045
- }
3046
- }
3047
- }
3048
- },
3049
- typography: {
3050
- fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif'
3051
- }
3052
- });
3053
- };
3054
- var getCrudifyThemeFromCookies = () => {
3055
- let themeColors = {};
3056
- if (typeof document !== "undefined") {
3057
- try {
3058
- const colorsCookie = document.cookie.split("; ").find((row) => row.startsWith("colors="));
3059
- if (colorsCookie) {
3060
- const decodedColors = decodeURIComponent(colorsCookie.split("=")[1]);
3061
- const parsedColors = JSON.parse(decodedColors);
3062
- if (parsedColors.primaryColor) {
3063
- themeColors.primary = {
3064
- ...defaultCrudifyColors.primary,
3065
- main: parsedColors.primaryColor
3066
- };
3067
- }
3068
- if (parsedColors.bgColor) {
3069
- themeColors.background = {
3070
- ...defaultCrudifyColors.background,
3071
- default: parsedColors.bgColor
3072
- };
3073
- }
3074
- }
3075
- } catch (error) {
3076
- console.error("Error parsing colors from cookie:", error);
3077
- }
3078
- }
3079
- return createCrudifyTheme(themeColors);
3080
- };
3081
-
3082
2837
  // src/components/CrudifyLogin/index.tsx
3083
2838
  import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
3084
2839
  var CrudifyLoginInternal = ({
@@ -3172,8 +2927,7 @@ var CrudifyLogin = ({
3172
2927
  ...props
3173
2928
  }) => {
3174
2929
  const { config } = useSessionContext();
3175
- const theme = getCrudifyThemeFromCookies();
3176
- return /* @__PURE__ */ jsx11(ThemeProvider, { theme, children: /* @__PURE__ */ jsx11(I18nProvider, { translations, translationsUrl, language, children: /* @__PURE__ */ jsx11(CrudifyProvider, { config, children: /* @__PURE__ */ jsx11(LoginStateProvider, { config, initialScreen, autoReadFromCookies, children: /* @__PURE__ */ jsx11(CrudifyLoginInternal, { ...props }) }) }) }) });
2930
+ return /* @__PURE__ */ jsx11(I18nProvider, { translations, translationsUrl, language, children: /* @__PURE__ */ jsx11(CrudifyProvider, { config, children: /* @__PURE__ */ jsx11(LoginStateProvider, { config, initialScreen, autoReadFromCookies, children: /* @__PURE__ */ jsx11(CrudifyLoginInternal, { ...props }) }) }) });
3177
2931
  };
3178
2932
  var CrudifyLogin_default = CrudifyLogin;
3179
2933
 
@@ -5124,13 +4878,10 @@ export {
5124
4878
  SessionStatus,
5125
4879
  TokenStorage,
5126
4880
  UserProfileDisplay_default as UserProfileDisplay,
5127
- createCrudifyTheme,
5128
4881
  createErrorTranslator,
5129
4882
  default2 as crudify,
5130
4883
  decodeJwtSafely,
5131
- defaultCrudifyColors,
5132
4884
  getCookie,
5133
- getCrudifyThemeFromCookies,
5134
4885
  getCurrentUserEmail,
5135
4886
  getErrorMessage,
5136
4887
  handleCrudifyError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",