@moontra/moonui-pro 2.37.16 → 2.37.18

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.ts CHANGED
@@ -146,32 +146,13 @@ interface AuthContextType extends AuthState {
146
146
  refreshAuth: () => Promise<void>;
147
147
  clearAuth: () => void;
148
148
  }
149
- interface MoonUIAuthProviderProps {
150
- children: ReactNode;
151
- /**
152
- * Environment mode - defaults to 'development' if not provided
153
- * In Next.js: environment={process.env.NODE_ENV}
154
- * In Vite: environment={import.meta.env.MODE}
155
- * In CRA: environment={process.env.NODE_ENV}
156
- */
157
- environment?: 'development' | 'production' | 'test';
158
- /**
159
- * License key for production environments
160
- * In Next.js: licenseKey={process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY}
161
- * In Vite: licenseKey={import.meta.env.VITE_MOONUI_LICENSE_KEY}
162
- * In CRA: licenseKey={process.env.REACT_APP_MOONUI_LICENSE_KEY}
163
- */
164
- licenseKey?: string;
165
- /**
166
- * Force production mode (useful for testing)
167
- */
168
- forceProduction?: boolean;
169
- }
170
149
  /**
171
150
  * MoonUI Auth Provider - Centralized authentication state
172
151
  * This provider ensures only ONE API call is made for all components
173
152
  */
174
- declare function MoonUIAuthProvider({ children, environment, licenseKey, forceProduction }: MoonUIAuthProviderProps): react_jsx_runtime.JSX.Element;
153
+ declare function MoonUIAuthProvider({ children }: {
154
+ children: ReactNode;
155
+ }): react_jsx_runtime.JSX.Element;
175
156
  /**
176
157
  * Hook to use auth context
177
158
  * Falls back to direct API call if context is not available
package/dist/index.mjs CHANGED
@@ -2118,12 +2118,7 @@ var AuthContext = createContext(void 0);
2118
2118
  var authPromise = null;
2119
2119
  var lastFetchTime = 0;
2120
2120
  var FETCH_COOLDOWN = 5e3;
2121
- function MoonUIAuthProvider({
2122
- children,
2123
- environment = "development",
2124
- licenseKey,
2125
- forceProduction = false
2126
- }) {
2121
+ function MoonUIAuthProvider({ children }) {
2127
2122
  const [state, setState] = useState({
2128
2123
  isLoading: true,
2129
2124
  hasProAccess: false,
@@ -2190,16 +2185,30 @@ function MoonUIAuthProvider({
2190
2185
  authPromise = (async () => {
2191
2186
  try {
2192
2187
  lastFetchTime = now;
2193
- const isProduction = forceProduction || environment === "production";
2194
- const isDevelopment = !isProduction;
2195
- const hasLicenseKey = !!licenseKey;
2196
- console.log("[MoonUI Auth] Environment Detection:", {
2197
- environment,
2198
- forceProduction,
2199
- hasLicenseKey,
2200
- isProduction,
2201
- isDevelopment
2202
- });
2188
+ let isProduction = false;
2189
+ let isDevelopment = true;
2190
+ let environmentInfo = {};
2191
+ try {
2192
+ const envResponse = await fetch("/api/environment", {
2193
+ method: "GET",
2194
+ cache: "no-store"
2195
+ });
2196
+ if (envResponse.ok) {
2197
+ environmentInfo = await envResponse.json();
2198
+ isProduction = environmentInfo.isProduction;
2199
+ isDevelopment = environmentInfo.isDevelopment;
2200
+ console.log("[MoonUI Auth] Runtime Environment Detection:", {
2201
+ ...environmentInfo.debug,
2202
+ environment: environmentInfo.environment,
2203
+ isProduction,
2204
+ isDevelopment
2205
+ });
2206
+ } else {
2207
+ console.warn("[MoonUI Auth] Failed to fetch environment info, falling back to development mode");
2208
+ }
2209
+ } catch (error) {
2210
+ console.warn("[MoonUI Auth] Error fetching environment info:", error);
2211
+ }
2203
2212
  if (isDevelopment) {
2204
2213
  let response;
2205
2214
  const authServerUrl = typeof window !== "undefined" ? process.env.NEXT_PUBLIC_MOONUI_AUTH_SERVER || "http://localhost:7878" : "http://localhost:7878";
@@ -2240,6 +2249,7 @@ function MoonUIAuthProvider({
2240
2249
  }
2241
2250
  }
2242
2251
  if (isProduction) {
2252
+ const licenseKey = environmentInfo.hasLicenseKey ? process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY || process.env.MOONUI_LICENSE_KEY || process.env.VITE_MOONUI_LICENSE_KEY || process.env.REACT_APP_MOONUI_LICENSE_KEY || "check-server" : null;
2243
2253
  if (licenseKey) {
2244
2254
  console.log("[MoonUI Auth] Production mode - validating license key...");
2245
2255
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.37.16",
3
+ "version": "2.37.18",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",