flux-analytics-sdk 1.0.1 → 1.0.6

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/README.md CHANGED
@@ -18,16 +18,11 @@ import Flux from 'flux-analytics-sdk';
18
18
 
19
19
  Flux.init(
20
20
  'YOUR_APP_ID', // UUID (Application ID from Dashboard)
21
- 'YOUR_FIRM_ID', // UUID (Firm/Workspace ID)
22
- {
23
- // Optional: Only needed if you are self-hosting or using a proxy
24
- // baseUrl: 'https://your-proxy.com',
25
- debug: true // Set to true to see logs in console
26
- }
21
+ 'YOUR_FIRM_ID' // UUID (Firm/Workspace ID)
27
22
  );
28
23
  ```
29
24
 
30
- > **Note:** The SDK comes pre-configured with the default Flux Cloud credentials. You do not need to provide an API Key unless you are using a custom instance.
25
+ > **Note:** The SDK comes pre-configured with the default Flux Cloud credentials. You do not need to provide an API Key.
31
26
 
32
27
  ### 2. Track Events
33
28
  Track any custom event with optional metadata.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flux-analytics-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.6",
4
4
  "description": "Flux Analytics SDK for JavaScript/Web",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/Flux.js CHANGED
@@ -316,11 +316,12 @@ const Flux = (function () {
316
316
 
317
317
  // 2xx success, 409 conflict (duplicate) is also success
318
318
  if (response.ok || response.status === 409) {
319
+ if (_debug) console.log(`%c[Flux SDK] ✓ Sent to ${endpoint}`, 'color: #10b981; font-weight: bold;');
319
320
  return true;
320
321
  } else {
321
- if (_debug) console.error(`Flux Error: ${response.status} - ${response.statusText}`);
322
322
  const text = await response.text();
323
- if (_debug) console.error('Response:', text);
323
+ // Always log errors even if debug is off, but make them prominent if debug is on
324
+ console.error(`%c[Flux SDK] ✗ Error: ${response.status} - ${response.statusText}`, 'color: #ef4444; font-weight: bold;', text);
324
325
  return false;
325
326
  }
326
327
 
@@ -432,7 +433,9 @@ const Flux = (function () {
432
433
  created_at: new Date().toISOString()
433
434
  };
434
435
 
435
- if (_debug) console.log(`Flux Tracked: ${eventName}`, payload);
436
+ if (_debug) {
437
+ console.log(`%c[Flux SDK] ⚡ Event Tracked: ${eventName}`, 'color: #6366f1; font-weight: bold; font-size: 12px;', payload);
438
+ }
436
439
 
437
440
  await _addToQueue('events', payload);
438
441
  }