@moontra/moonui-pro 2.33.19 → 2.33.21

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.mjs CHANGED
@@ -2835,6 +2835,64 @@ function createAIProvider(provider, config) {
2835
2835
 
2836
2836
  // src/index.ts
2837
2837
  init_use_subscription();
2838
+ async function sha256(message) {
2839
+ const msgBuffer = new TextEncoder().encode(message);
2840
+ const hashBuffer = await crypto.subtle.digest("SHA-256", msgBuffer);
2841
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
2842
+ const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
2843
+ return hashHex;
2844
+ }
2845
+ async function generateStableBrowserFingerprint() {
2846
+ const components = [];
2847
+ try {
2848
+ const canvas = document.createElement("canvas");
2849
+ canvas.width = 200;
2850
+ canvas.height = 50;
2851
+ const ctx = canvas.getContext("2d");
2852
+ if (ctx) {
2853
+ ctx.textBaseline = "top";
2854
+ ctx.font = "14px Arial";
2855
+ ctx.textAlign = "center";
2856
+ ctx.fillStyle = "#f60";
2857
+ ctx.fillRect(125, 1, 62, 20);
2858
+ ctx.fillStyle = "#069";
2859
+ ctx.fillText("\u{1F510}MoonUI", 50, 25);
2860
+ ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
2861
+ ctx.fillText("\u{1F510}MoonUI", 100, 25);
2862
+ const canvasData = canvas.toDataURL();
2863
+ const canvasHash = await sha256(canvasData);
2864
+ components.push(canvasHash.slice(0, 8));
2865
+ }
2866
+ const canvas2 = document.createElement("canvas");
2867
+ const gl = canvas2.getContext("webgl") || canvas2.getContext("experimental-webgl");
2868
+ if (gl) {
2869
+ const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
2870
+ if (debugInfo) {
2871
+ const vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
2872
+ const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
2873
+ const glHash = await sha256(`${vendor}|${renderer}`);
2874
+ components.push(glHash.slice(0, 8));
2875
+ } else {
2876
+ const vendor = gl.getParameter(gl.VENDOR);
2877
+ const renderer = gl.getParameter(gl.RENDERER);
2878
+ const glHash = await sha256(`${vendor}|${renderer}`);
2879
+ components.push(glHash.slice(0, 8));
2880
+ }
2881
+ }
2882
+ const screenData = `${window.screen.width}x${window.screen.height}x${window.screen.colorDepth}`;
2883
+ const screenHash = await sha256(screenData);
2884
+ components.push(screenHash.slice(0, 8));
2885
+ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
2886
+ const language = navigator.language;
2887
+ const localeHash = await sha256(`${timezone}|${language}`);
2888
+ components.push(localeHash.slice(0, 6));
2889
+ } catch (error) {
2890
+ console.error("[MoonUI Pro] Error generating browser fingerprint:", error);
2891
+ const fallbackHash = await sha256(`${Date.now()}-${Math.random()}`);
2892
+ components.push(fallbackHash.slice(0, 8));
2893
+ }
2894
+ return `browser-${components.join("-")}`;
2895
+ }
2838
2896
  var CACHE_KEY2 = "moonui_license_cache";
2839
2897
  var CLI_AUTH_CACHE_KEY2 = "moonui_cli_auth_cache";
2840
2898
  var CACHE_DURATION = !process.env.VERCEL ? 1 * 60 * 1e3 : 24 * 60 * 60 * 1e3;
@@ -2856,9 +2914,13 @@ function SubscriptionProvider({ children }) {
2856
2914
  if (browserToken) {
2857
2915
  return browserToken;
2858
2916
  }
2917
+ console.log("[MoonUI Pro v2.33.20] Checking for CLI environment variables...");
2859
2918
  const devToken = process.env.NEXT_PUBLIC_MOONUI_DEV_TOKEN;
2860
2919
  const deviceId = process.env.NEXT_PUBLIC_MOONUI_DEVICE_ID;
2920
+ console.log("[MoonUI Pro v2.33.20] DevToken exists:", !!devToken);
2921
+ console.log("[MoonUI Pro v2.33.20] DeviceId exists:", !!deviceId);
2861
2922
  if (devToken && deviceId) {
2923
+ console.log("[MoonUI Pro v2.33.20] CLI tokens found, proceeding with authentication...");
2862
2924
  const cachedAuth = localStorage.getItem(CLI_AUTH_CACHE_KEY2);
2863
2925
  if (cachedAuth) {
2864
2926
  try {
@@ -2879,18 +2941,19 @@ function SubscriptionProvider({ children }) {
2879
2941
  try {
2880
2942
  const decoded = JSON.parse(atob(devToken));
2881
2943
  const jwtToken = decoded.token;
2882
- const hostname = window.location.hostname.replace(/\./g, "");
2883
- const userHash = deviceId.split("-")[2];
2884
- const browserHash = Math.random().toString(36).substring(2, 8);
2944
+ const browserFingerprint = await generateStableBrowserFingerprint();
2885
2945
  const requestBody = {
2886
2946
  deviceId,
2887
- browserDeviceId: `browser-${hostname}-${userHash}-${browserHash}`,
2947
+ browserDeviceId: browserFingerprint,
2888
2948
  timestamp: Date.now(),
2889
- validationType: "hybrid-strict"
2949
+ validationType: "hybrid-browser-register",
2950
+ action: "registerBrowserIfNeeded"
2890
2951
  };
2891
- console.log("[MoonUI Pro] Sending request to moonui.dev/api/cli/validate-session");
2892
- console.log("[MoonUI Pro] DeviceId:", deviceId);
2893
- console.log("[MoonUI Pro] Request body:", requestBody);
2952
+ console.log("[MoonUI Pro v2.33.20] Starting CLI authentication...");
2953
+ console.log("[MoonUI Pro v2.33.20] Sending request to moonui.dev/api/cli/validate-session");
2954
+ console.log("[MoonUI Pro v2.33.20] DeviceId:", deviceId);
2955
+ console.log("[MoonUI Pro v2.33.20] Browser fingerprint:", browserFingerprint);
2956
+ console.log("[MoonUI Pro v2.33.20] Request body:", requestBody);
2894
2957
  const response = await fetch("https://moonui.dev/api/cli/validate-session", {
2895
2958
  method: "POST",
2896
2959
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.33.19",
3
+ "version": "2.33.21",
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",