@moneybar.online/moneybar 3.9.0 → 4.0.0

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.
@@ -19,6 +19,7 @@ import { MoneyBar } from 'https://cdn.jsdelivr.net/npm/@moneybar.online/moneybar
19
19
  const VALUE_FIRST_CONFIG = {
20
20
  actionFunction: 'generatePDF',
21
21
  appId: 'pdf-generator',
22
+ security_key: 'sk_YOUR_SECURITY_KEY_HERE', // 🔐 Add your security key from Supabase
22
23
  freeAttemptLimit: 3,
23
24
  supabase: {
24
25
  url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
@@ -50,6 +51,7 @@ const VALUE_FIRST_CONFIG = {
50
51
  const FEEDBACK_INTELLIGENCE_CONFIG = {
51
52
  actionFunction: 'runAnalysis',
52
53
  appId: 'saas-analytics',
54
+ security_key: 'sk_YOUR_SECURITY_KEY_HERE', // 🔐 Add your security key from Supabase
53
55
  freeAttemptLimit: 3,
54
56
  supabase: {
55
57
  url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
@@ -90,6 +92,7 @@ const FEEDBACK_INTELLIGENCE_CONFIG = {
90
92
  const INSTANT_PAYMENT_CONFIG = {
91
93
  actionFunction: 'createTemplate',
92
94
  appId: 'template-creator',
95
+ security_key: 'sk_YOUR_SECURITY_KEY_HERE', // 🔐 Add your security key from Supabase
93
96
  freeAttemptLimit: 5,
94
97
  supabase: {
95
98
  url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneybar.online/moneybar",
3
- "version": "3.9.0",
3
+ "version": "4.0.0",
4
4
  "description": "The navbar of monetization. Fix the 3 money-blocking stages: forced sign-ins, silent drop-offs, and broken payment flows. Turn browsers into buyers.",
5
5
  "main": "dist/index.esm.js",
6
6
  "module": "dist/index.esm.js",
package/src/index.ts CHANGED
@@ -3143,7 +3143,7 @@ User Agent: ${feedbackData.userAgent}
3143
3143
  },
3144
3144
  body: JSON.stringify({
3145
3145
  fingerprint: this.userFingerprint,
3146
- app_id: this.config.appId,
3146
+ security_key: this.config.security_key,
3147
3147
  action: 'check'
3148
3148
  })
3149
3149
  });
@@ -3156,7 +3156,21 @@ User Agent: ${feedbackData.userAgent}
3156
3156
  } else {
3157
3157
  // Handle auth errors (401/403) as connection failures
3158
3158
  if (response.status === 401 || response.status === 403) {
3159
- console.warn(`Supabase authentication failed: ${response.status} - Invalid anon key`);
3159
+ // Try to get the actual error message from response
3160
+ try {
3161
+ const errorData = await response.json();
3162
+ const errorMsg = errorData.error || errorData.message || 'Authentication failed';
3163
+
3164
+ // Check if it's a security key validation error
3165
+ if (errorMsg.toLowerCase().includes('security key')) {
3166
+ console.error(`❌ Security Key Validation Failed: ${errorMsg}`);
3167
+ console.error(`💡 Please check your security_key in the MoneyBar configuration`);
3168
+ } else {
3169
+ console.warn(`Supabase authentication failed: ${response.status} - ${errorMsg}`);
3170
+ }
3171
+ } catch (e) {
3172
+ console.warn(`Supabase authentication failed: ${response.status} - Unable to parse error`);
3173
+ }
3160
3174
  this.supabaseConnectionFailed = true;
3161
3175
  }
3162
3176
  }
@@ -3182,7 +3196,7 @@ User Agent: ${feedbackData.userAgent}
3182
3196
 
3183
3197
  const requestBody = {
3184
3198
  fingerprint: this.userFingerprint,
3185
- app_id: this.config.appId,
3199
+ security_key: this.config.security_key,
3186
3200
  action: 'increment'
3187
3201
  };
3188
3202
 
@@ -3214,7 +3228,21 @@ User Agent: ${feedbackData.userAgent}
3214
3228
  } else {
3215
3229
  // Handle auth errors (401/403) as connection failures
3216
3230
  if (response.status === 401 || response.status === 403) {
3217
- console.warn(`Supabase authentication failed: ${response.status} - Invalid anon key`);
3231
+ // Try to get the actual error message from response
3232
+ try {
3233
+ const errorData = await response.json();
3234
+ const errorMsg = errorData.error || errorData.message || 'Authentication failed';
3235
+
3236
+ // Check if it's a security key validation error
3237
+ if (errorMsg.toLowerCase().includes('security key')) {
3238
+ console.error(`❌ Security Key Validation Failed: ${errorMsg}`);
3239
+ console.error(`💡 Please check your security_key in the MoneyBar configuration`);
3240
+ } else {
3241
+ console.warn(`Supabase authentication failed: ${response.status} - ${errorMsg}`);
3242
+ }
3243
+ } catch (e) {
3244
+ console.warn(`Supabase authentication failed: ${response.status} - Unable to parse error`);
3245
+ }
3218
3246
  this.supabaseConnectionFailed = true;
3219
3247
  }
3220
3248
  }
package/src/types.ts CHANGED
@@ -2,6 +2,9 @@ export interface MoneyBarConfig {
2
2
  /** Unique identifier for your app (e.g., 'gif-maker', 'pdf-creator') */
3
3
  appId: string;
4
4
 
5
+ /** Security key for domain-based authentication (REQUIRED) */
6
+ security_key: string;
7
+
5
8
  /** Number of free attempts allowed before paywall */
6
9
  freeAttemptLimit: number;
7
10