@moneybar.online/moneybar 3.1.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.
@@ -0,0 +1,109 @@
1
+ // MoneyBar Configuration Template
2
+ // Copy this file and customize for your project
3
+
4
+ // Option 1: Browser CDN Usage (Recommended for simple projects)
5
+ // Use this import and add the import map to your HTML
6
+ /*
7
+ Add to your HTML:
8
+ <script type="importmap">
9
+ {
10
+ "imports": {
11
+ "@supabase/supabase-js": "https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2/+esm"
12
+ }
13
+ }
14
+ </script>
15
+ */
16
+
17
+ import { MoneyBar } from 'https://cdn.jsdelivr.net/npm/@moneybar.online/moneybar/dist/index.browser.js';
18
+
19
+ // Option 2: Self-contained bundle (No import map needed)
20
+ // import { MoneyBar } from 'https://cdn.jsdelivr.net/npm/@moneybar.online/moneybar/dist/index.bundle.js';
21
+
22
+ // Option 3: NPM install usage (for projects with bundlers)
23
+ // import { MoneyBar } from '@moneybar.online/moneybar';
24
+
25
+ const moneyBar = new MoneyBar({
26
+ // REQUIRED: Your unique app identifier
27
+ appId: 'my-app',
28
+
29
+ // REQUIRED: Number of free attempts before paywall
30
+ freeDownloadLimit: 3,
31
+
32
+ // REQUIRED: Supabase configuration
33
+ supabase: {
34
+ url: 'your-supabase-project-url',
35
+ anonKey: 'your-supabase-anon-key'
36
+ },
37
+
38
+ // REQUIRED: Payment configuration
39
+ payment: {
40
+ productId: 'your-dodo-payments-product-id',
41
+ mode: 'test' // Change to 'live' for production
42
+ },
43
+
44
+ // OPTIONAL: UI Theme (29 themes available)
45
+ theme: {
46
+ name: 'dark', // cyberpunk, emerald, corporate, etc.
47
+ primaryColor: '#7c3aed'
48
+ },
49
+
50
+ // OPTIONAL: Title bar configuration
51
+ titleBar: {
52
+ title: 'My App',
53
+ titleImage: './logo.png',
54
+ links: [
55
+ { text: 'Home', url: '/', target: '_self' },
56
+ { text: 'Pricing', url: '/pricing', target: '_self' }
57
+ ]
58
+ },
59
+
60
+ // OPTIONAL: Success modal
61
+ successMessage: {
62
+ enabled: true,
63
+ title: 'Success!',
64
+ message: 'Your action completed successfully!'
65
+ },
66
+
67
+ // OPTIONAL: Feedback collection
68
+ feedback: {
69
+ form: {
70
+ title: 'Quick Feedback',
71
+ description: 'What stopped you from upgrading?',
72
+ option1: 'Too expensive',
73
+ option2: 'Need more features',
74
+ option3: 'Just testing'
75
+ },
76
+ email: {
77
+ resendApiKey: 'your-resend-api-key',
78
+ fromEmail: 'hello@yourapp.com'
79
+ }
80
+ }
81
+ });
82
+
83
+ // Attach to button with your business logic
84
+ moneyBar.attachToButton('#your-button-id', (userContext) => {
85
+ // Your app's functionality here
86
+ console.log('User context:', userContext);
87
+
88
+ if (userContext.isPremium) {
89
+ console.log('Premium user - unlock all features');
90
+ // Premium functionality
91
+ } else {
92
+ console.log(`Free user - ${userContext.remaining} uses remaining`);
93
+ // Free tier functionality
94
+ }
95
+
96
+ // Example: Your app logic
97
+ // generatePDF();
98
+ // downloadFile();
99
+ // processData();
100
+ });
101
+
102
+ // Global function for easy HTML usage
103
+ window.myAction = function(userContext) {
104
+ if (userContext.isPremium) {
105
+ alert('Premium features unlocked!');
106
+ } else {
107
+ alert(`Free trial: ${userContext.remaining} uses left`);
108
+ }
109
+ };
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@moneybar.online/moneybar",
3
+ "version": "3.1.0",
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
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.esm.js",
7
+ "browser": "dist/index.browser.js",
8
+ "unpkg": "dist/index.umd.js",
9
+ "types": "dist/index.d.ts",
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.esm.js",
14
+ "require": "./dist/index.cjs.js",
15
+ "browser": "./dist/index.browser.js",
16
+ "types": "./dist/index.d.ts"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist/",
21
+ "src/",
22
+ "README.md",
23
+ "moneybar-config-template.js",
24
+ "example-template.html"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "bundle": "rollup -c",
29
+ "build:all": "rm -rf dist && npm run build && npm run bundle",
30
+ "dev": "tsc --watch",
31
+ "prepublishOnly": "npm run build:all",
32
+ "test": "echo \"Error: no test specified\" && exit 1",
33
+ "clean": "rm -rf dist"
34
+ },
35
+ "keywords": [
36
+ "moneybar",
37
+ "monetization",
38
+ "paywall",
39
+ "revenue",
40
+ "conversion",
41
+ "trial-to-paid",
42
+ "freemium",
43
+ "payment-flow",
44
+ "user-feedback",
45
+ "google-auth",
46
+ "indie-hackers",
47
+ "saas-monetization"
48
+ ],
49
+ "author": "Ravi Cloudworks <ravi@cloudworks.com>",
50
+ "license": "MIT",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "https://github.com/ravi-cloudworks/moneybar"
54
+ },
55
+ "bugs": {
56
+ "url": "https://github.com/ravi-cloudworks/moneybar/issues"
57
+ },
58
+ "homepage": "https://moneybar.online",
59
+ "dependencies": {
60
+ "@supabase/supabase-js": "^2.86.0"
61
+ },
62
+ "devDependencies": {
63
+ "@rollup/plugin-commonjs": "^29.0.0",
64
+ "@rollup/plugin-node-resolve": "^16.0.3",
65
+ "@rollup/plugin-typescript": "^12.3.0",
66
+ "@types/node": "^20.0.0",
67
+ "rollup": "^2.79.2",
68
+ "rollup-plugin-terser": "^7.0.2",
69
+ "typescript": "^5.0.0"
70
+ },
71
+ "engines": {
72
+ "node": ">=16.0.0"
73
+ }
74
+ }