@moontra/moonui-pro 2.32.29 → 2.32.31

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
@@ -103,7 +103,7 @@ var init_cli_token_reader = __esm({
103
103
  * Generate device fingerprint compatible with CLI format
104
104
  * Format: platform-hostname-username_hash (8 chars)
105
105
  */
106
- getDeviceFingerprint() {
106
+ async getDeviceFingerprint() {
107
107
  try {
108
108
  let platform2 = "unknown";
109
109
  if (typeof window !== "undefined") {
@@ -117,16 +117,14 @@ var init_cli_token_reader = __esm({
117
117
  platform2 = "linux";
118
118
  }
119
119
  }
120
- let hostname = "localhost";
121
- if (typeof window !== "undefined") {
122
- if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local")) {
123
- hostname = "localhost";
124
- } else {
120
+ let hostname = process.env.NEXT_PUBLIC_MOONUI_HOSTNAME || "localhost";
121
+ if (typeof window !== "undefined" && !process.env.NEXT_PUBLIC_MOONUI_HOSTNAME) {
122
+ if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1") {
125
123
  hostname = window.location.hostname;
126
124
  }
127
125
  }
128
126
  const username = process.env.NEXT_PUBLIC_MOONUI_USERNAME || "dev-user";
129
- const usernameHash = this.simpleHash(username).substring(0, 8);
127
+ const usernameHash = await this.sha256Hash(username);
130
128
  const fingerprint = `${platform2}-${hostname}-${usernameHash}`;
131
129
  console.log("[MoonUI Pro] Browser device fingerprint generated:", {
132
130
  platform: platform2,
@@ -143,9 +141,25 @@ var init_cli_token_reader = __esm({
143
141
  }
144
142
  }
145
143
  /**
146
- * Simple hash function for consistent hashing across environments
144
+ * SHA256 hash function for consistency with CLI
145
+ * Returns first 8 characters of SHA256 hex digest
146
+ */
147
+ async sha256Hash(str) {
148
+ if (typeof crypto !== "undefined" && crypto.subtle) {
149
+ const encoder = new TextEncoder();
150
+ const data = encoder.encode(str);
151
+ const hashBuffer = await crypto.subtle.digest("SHA-256", data);
152
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
153
+ const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
154
+ return hashHex.substring(0, 8);
155
+ }
156
+ console.warn("[MoonUI Pro] Using fallback hash - install crypto polyfill for production");
157
+ return this.fallbackHash(str);
158
+ }
159
+ /**
160
+ * Fallback hash for environments without Web Crypto API
147
161
  */
148
- simpleHash(str) {
162
+ fallbackHash(str) {
149
163
  let hash = 0;
150
164
  for (let i = 0; i < str.length; i++) {
151
165
  const char = str.charCodeAt(i);
@@ -216,7 +230,7 @@ var init_cli_token_reader = __esm({
216
230
  if (!tokenData) {
217
231
  return null;
218
232
  }
219
- const currentDeviceId = this.getDeviceFingerprint();
233
+ const currentDeviceId = await this.getDeviceFingerprint();
220
234
  const tokenDeviceId = tokenData.deviceId;
221
235
  console.log("[MoonUI Pro] Device validation check:", {
222
236
  currentDevice: currentDeviceId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.32.29",
3
+ "version": "2.32.31",
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",