@moontra/moonui-pro 2.37.14 → 2.37.16

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,13 +146,32 @@ 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
+ }
149
170
  /**
150
171
  * MoonUI Auth Provider - Centralized authentication state
151
172
  * This provider ensures only ONE API call is made for all components
152
173
  */
153
- declare function MoonUIAuthProvider({ children }: {
154
- children: ReactNode;
155
- }): react_jsx_runtime.JSX.Element;
174
+ declare function MoonUIAuthProvider({ children, environment, licenseKey, forceProduction }: MoonUIAuthProviderProps): react_jsx_runtime.JSX.Element;
156
175
  /**
157
176
  * Hook to use auth context
158
177
  * Falls back to direct API call if context is not available
package/dist/index.mjs CHANGED
@@ -2118,7 +2118,12 @@ var AuthContext = createContext(void 0);
2118
2118
  var authPromise = null;
2119
2119
  var lastFetchTime = 0;
2120
2120
  var FETCH_COOLDOWN = 5e3;
2121
- function MoonUIAuthProvider({ children }) {
2121
+ function MoonUIAuthProvider({
2122
+ children,
2123
+ environment = "development",
2124
+ licenseKey,
2125
+ forceProduction = false
2126
+ }) {
2122
2127
  const [state, setState] = useState({
2123
2128
  isLoading: true,
2124
2129
  hasProAccess: false,
@@ -2185,20 +2190,15 @@ function MoonUIAuthProvider({ children }) {
2185
2190
  authPromise = (async () => {
2186
2191
  try {
2187
2192
  lastFetchTime = now;
2188
- const vercelEnv = process.env.VERCEL_ENV;
2189
- const isVercel = process.env.VERCEL === "1";
2190
- const licenseKey = 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;
2191
- const isProduction = vercelEnv === "production" || licenseKey && licenseKey.length > 0 || isVercel && vercelEnv !== "development";
2193
+ const isProduction = forceProduction || environment === "production";
2192
2194
  const isDevelopment = !isProduction;
2195
+ const hasLicenseKey = !!licenseKey;
2193
2196
  console.log("[MoonUI Auth] Environment Detection:", {
2194
- VERCEL_ENV: vercelEnv,
2195
- VERCEL: process.env.VERCEL,
2196
- CI: process.env.CI,
2197
- NODE_ENV: "development",
2198
- hasLicenseKey: !!licenseKey,
2197
+ environment,
2198
+ forceProduction,
2199
+ hasLicenseKey,
2199
2200
  isProduction,
2200
- isDevelopment,
2201
- environment: isProduction ? "PRODUCTION" : "DEVELOPMENT"
2201
+ isDevelopment
2202
2202
  });
2203
2203
  if (isDevelopment) {
2204
2204
  let response;
@@ -2240,8 +2240,7 @@ function MoonUIAuthProvider({ children }) {
2240
2240
  }
2241
2241
  }
2242
2242
  if (isProduction) {
2243
- const licenseKey2 = 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;
2244
- if (licenseKey2) {
2243
+ if (licenseKey) {
2245
2244
  console.log("[MoonUI Auth] Production mode - validating license key...");
2246
2245
  try {
2247
2246
  const currentDomain = typeof window !== "undefined" ? window.location.hostname : process.env.VERCEL_URL || process.env.NEXT_PUBLIC_VERCEL_URL || "";
@@ -2252,7 +2251,7 @@ function MoonUIAuthProvider({ children }) {
2252
2251
  "Content-Type": "application/json"
2253
2252
  },
2254
2253
  body: JSON.stringify({
2255
- licenseKey: licenseKey2,
2254
+ licenseKey,
2256
2255
  domain: currentDomain
2257
2256
  })
2258
2257
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.37.14",
3
+ "version": "2.37.16",
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",