@moneybar.online/moneybar 3.4.0 → 3.5.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.
@@ -91,17 +91,87 @@
91
91
  </div>
92
92
  </div>
93
93
 
94
- <!-- Import map for dependencies -->
95
- <script type="importmap">
96
- {
97
- "imports": {
98
- "@supabase/supabase-js": "https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2/+esm"
94
+ <!-- MoneyBar self-contained bundle (no import map needed) -->
95
+ <script type="module">
96
+ console.log('🚀 Loading MoneyBar...');
97
+
98
+ try {
99
+ const { MoneyBar } = await import('https://cdn.jsdelivr.net/npm/@moneybar.online/moneybar/dist/index.bundle.js');
100
+
101
+ // Use FEEDBACK_INTELLIGENCE_CONFIG by default (you can change this)
102
+ const config = {
103
+ actionFunction: 'runAnalysis',
104
+ appId: 'saas-analytics',
105
+ freeAttemptLimit: 3,
106
+ supabase: {
107
+ url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
108
+ anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFobHpka3djcnJqamNxdnVweWFhIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQzNDYyNTYsImV4cCI6MjA3OTkyMjI1Nn0.Qy-IsmGxakvZ6JBtSoEjFefeXMBsUuSD551f6hfIIZw'
109
+ },
110
+ payment: [{
111
+ provider: 'dodo',
112
+ productId: 'pdt_BSS7M6oKqRTEaxqgJfprq',
113
+ mode: 'test'
114
+ }],
115
+ feedback: {
116
+ form: {
117
+ title: 'Quick Feedback',
118
+ description: 'What stopped you from upgrading?',
119
+ option1: 'Too complex to implement',
120
+ option2: 'Not enough ROI for my team',
121
+ option3: 'Need more features first'
122
+ },
123
+ email: [
124
+ {
125
+ provider: 'resend',
126
+ apiKey: 'your-resend-api-key',
127
+ fromEmail: 'feedback@yourapp.com'
128
+ }
129
+ ]
130
+ },
131
+ theme: {
132
+ name: 'corporate',
133
+ primaryColor: '#0066cc'
134
+ },
135
+ titleBar: {
136
+ title: '📈 Analytics Tool',
137
+ links: [
138
+ { text: 'Features', url: '#features', target: '_self' },
139
+ { text: 'ROI Calculator', url: '#roi', target: '_self' }
140
+ ]
141
+ }
142
+ };
143
+
144
+ console.log('✅ Creating MoneyBar instance...');
145
+ const moneyBar = new MoneyBar(config);
146
+
147
+ console.log('✅ Attaching to button...');
148
+ moneyBar.attachToButton('#action-btn', runAnalysis);
149
+
150
+ console.log('🎉 MoneyBar loaded successfully!');
151
+
152
+ } catch (error) {
153
+ console.error('❌ MoneyBar failed to load:', error);
154
+ document.body.innerHTML += `<div style="background: red; color: white; padding: 1rem; margin: 1rem 0;">
155
+ <strong>Error:</strong> ${error.message}
156
+ </div>`;
99
157
  }
100
- }
101
- </script>
102
158
 
103
- <!-- Load MoneyBar configuration and initialization -->
104
- <script type="module" src="moneybar-config-template.js"></script>
159
+ // Action function for the demo
160
+ function runAnalysis(userContext) {
161
+ console.log('🎯 FEEDBACK INTELLIGENCE: Running analysis...');
162
+
163
+ if (userContext.isPremium) {
164
+ console.log('✅ Full analytics suite access');
165
+ alert('Complete analysis ready! Access to all metrics, exports, and AI insights.');
166
+ } else {
167
+ console.log(`📊 Basic analysis complete. ${userContext.remaining} attempts remaining`);
168
+ alert(`Analysis complete! Limited data shown. ${userContext.remaining} attempts left.`);
169
+ }
170
+ }
171
+
172
+ // Make function global for debugging
173
+ window.runAnalysis = runAnalysis;
174
+ </script>
105
175
 
106
176
  <div class="demo-section">
107
177
  <h2>📚 Setup Checklist</h2>
@@ -120,13 +190,74 @@
120
190
  <li><strong>Add</strong> the import map to your HTML</li>
121
191
  </ol>
122
192
 
123
- <h3>🎛️ Integration Options:</h3>
124
- <ul>
125
- <li><strong>CDN + Import Map</strong> - Simple, no build step (current demo)</li>
126
- <li><strong>Self-contained Bundle</strong> - No import map needed</li>
127
- <li><strong>NPM Install</strong> - For projects with bundlers</li>
128
- <li><strong>UMD Script Tags</strong> - Traditional non-module usage</li>
129
- </ul>
193
+ <h3>🎛️ Live Integration Examples:</h3>
194
+ <details>
195
+ <summary><strong>Method 1: CDN + Import Map</strong> (Current Demo)</summary>
196
+ <pre><code>&lt;script type="importmap"&gt;
197
+ {
198
+ "imports": {
199
+ "@supabase/supabase-js": "https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2/+esm"
200
+ }
201
+ }
202
+ &lt;/script&gt;
203
+ &lt;script type="module" src="moneybar-config-template.js"&gt;&lt;/script&gt;</code></pre>
204
+ </details>
205
+
206
+ <details>
207
+ <summary><strong>Method 2: Self-contained Bundle</strong> (No import map needed)</summary>
208
+ <pre><code>&lt;script type="module"&gt;
209
+ import { MoneyBar } from 'https://cdn.jsdelivr.net/npm/@moneybar.online/moneybar/dist/index.bundle.js';
210
+
211
+ const moneyBar = new MoneyBar({
212
+ actionFunction: 'generatePDF',
213
+ appId: 'pdf-generator',
214
+ freeAttemptLimit: 3,
215
+ supabase: {
216
+ url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
217
+ anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
218
+ },
219
+ payment: [{
220
+ provider: 'dodo',
221
+ productId: 'pdt_BSS7M6oKqRTEaxqgJfprq',
222
+ mode: 'test'
223
+ }]
224
+ });
225
+
226
+ moneyBar.attachToButton('#action-btn', generatePDF);
227
+
228
+ function generatePDF(userContext) {
229
+ if (userContext.isPremium) {
230
+ alert('Premium PDF generated!');
231
+ } else {
232
+ alert(`Basic PDF generated! ${userContext.remaining} attempts left.`);
233
+ }
234
+ }
235
+ &lt;/script&gt;</code></pre>
236
+ </details>
237
+
238
+ <details>
239
+ <summary><strong>Method 3: NPM Install</strong> (For projects with bundlers)</summary>
240
+ <pre><code>npm install @moneybar.online/moneybar
241
+
242
+ import { MoneyBar } from '@moneybar.online/moneybar';
243
+
244
+ const moneyBar = new MoneyBar({
245
+ actionFunction: 'generatePDF',
246
+ appId: 'pdf-generator',
247
+ freeAttemptLimit: 3,
248
+ supabase: {
249
+ url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
250
+ anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
251
+ },
252
+ payment: [{
253
+ provider: 'dodo',
254
+ productId: 'pdt_BSS7M6oKqRTEaxqgJfprq',
255
+ mode: 'test'
256
+ }]
257
+ });
258
+
259
+ moneyBar.attachToButton('#action-btn', generatePDF);</code></pre>
260
+ </details>
130
261
 
131
262
  <p><small>See <code>moneybar-config-template.js</code> for all integration options and detailed examples!</small></p>
132
263
  </div>
@@ -50,13 +50,14 @@ const VALUE_FIRST_CONFIG = {
50
50
  actionFunction: 'generatePDF',
51
51
  appId: 'pdf-generator',
52
52
  freeAttemptLimit: 3, // Give enough attempts to prove value
53
+
53
54
  supabase: {
54
- url: 'your-supabase-url',
55
- anonKey: 'your-anon-key'
55
+ url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
56
+ anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFobHpka3djcnJqamNxdnVweWFhIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQzNDYyNTYsImV4cCI6MjA3OTkyMjI1Nn0.Qy-IsmGxakvZ6JBtSoEjFefeXMBsUuSD551f6hfIIZw'
56
57
  },
57
58
  payment: [{
58
59
  provider: 'dodo',
59
- productId: 'your-product-id',
60
+ productId: 'pdt_BSS7M6oKqRTEaxqgJfprq',
60
61
  mode: 'test'
61
62
  }],
62
63
  theme: {
@@ -84,12 +85,12 @@ const FEEDBACK_INTELLIGENCE_CONFIG = {
84
85
  appId: 'saas-analytics',
85
86
  freeAttemptLimit: 3,
86
87
  supabase: {
87
- url: 'your-supabase-url',
88
- anonKey: 'your-anon-key'
88
+ url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
89
+ anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFobHpka3djcnJqamNxdnVweWFhIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQzNDYyNTYsImV4cCI6MjA3OTkyMjI1Nn0.Qy-IsmGxakvZ6JBtSoEjFefeXMBsUuSD551f6hfIIZw'
89
90
  },
90
91
  payment: [{
91
92
  provider: 'dodo',
92
- productId: 'your-product-id',
93
+ productId: 'pdt_BSS7M6oKqRTEaxqgJfprq',
93
94
  mode: 'test'
94
95
  }],
95
96
  // KEY FEATURE: Feedback collection on cancel/exit
@@ -135,12 +136,12 @@ const INSTANT_PAYMENT_CONFIG = {
135
136
  appId: 'template-creator',
136
137
  freeAttemptLimit: 5, // Lower to trigger payment faster
137
138
  supabase: {
138
- url: 'your-supabase-url',
139
- anonKey: 'your-anon-key'
139
+ url: 'https://qhlzdkwcrrjjcqvupyaa.supabase.co',
140
+ anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFobHpka3djcnJqamNxdnVweWFhIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQzNDYyNTYsImV4cCI6MjA3OTkyMjI1Nn0.Qy-IsmGxakvZ6JBtSoEjFefeXMBsUuSD551f6hfIIZw'
140
141
  },
141
142
  payment: [{
142
143
  provider: 'dodo',
143
- productId: 'your-product-id',
144
+ productId: 'pdt_BSS7M6oKqRTEaxqgJfprq',
144
145
  mode: 'test'
145
146
  }],
146
147
  theme: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneybar.online/moneybar",
3
- "version": "3.4.0",
3
+ "version": "3.5.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",