rails_tipjar 0.2.1 โ†’ 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb45f6dbcb30df4e79a71f533760d0fa1c5d2a904c0065ae774c675998d19585
4
- data.tar.gz: c0f1ea549ffb2fb0fbd3f48b36e81621697de38af2e622aa57eaec01d0c61cca
3
+ metadata.gz: 0dad170082ce372bad125b49719b0cffb1e6b81575161042feb724d33e5ab8d6
4
+ data.tar.gz: 6db6495061f0f76370133fd8a31f32e6c0610df1155309aef0f2ef50b3eb5c24
5
5
  SHA512:
6
- metadata.gz: 6bd013f51e770763b1b6305ee094e42e90359d17306b03a78497996efe34cec2cc5c1c2cf3c12ad4b7f4ab5992cd7fad73f88c9e2f428ad82baf6f8d0434c278
7
- data.tar.gz: b60050b28b9686dd14e0dba7323cec9eed49b709288a59d6a6f3ffb5b3f6a9827d4a8f818db65958711cf7c2bd11cfdb291af85652854c8304a741a68473c03f
6
+ metadata.gz: c20a0b31e0f00b467b392fff0884fadd941f0704a52c140db0fc52e9fdb2d682190cabbb74a985fa0fee6b805c0c38182d3f9aa67aaed1edfadabc6273897371
7
+ data.tar.gz: 4d557ecd1a09c866de21acff09aa98b40be0545a03eb8c1abc23db17a3ca363a0a2b740023796497630acd6c40c8877ca3af7a03d09551fe0a9895476ad60155
data/README.md CHANGED
@@ -1,37 +1,41 @@
1
1
  # RailsTipjar
2
2
 
3
- A reusable, customizable tip jar feature for Rails applications using Stripe Payment Links. Add a beautiful tip jar to any Rails app with just a few lines of code!
3
+ A reusable, customizable tip jar feature for Rails applications. Add a beautiful tip jar to any Rails app with just a few lines of code! Works with any payment provider - Stripe, PayPal, Buy Me a Coffee, Ko-fi, or any custom payment link.
4
4
 
5
5
  ## Features
6
6
 
7
- - ๐ŸŽจ Customizable floating button with multiple icon options
8
- - ๐Ÿ’ณ Stripe Payment Links integration (no backend payment processing needed)
9
- - ๐Ÿ“ฑ Fully responsive design
10
- - ๐ŸŽฏ Multiple positioning options
11
- - ๐ŸŒ™ Light/Dark theme support
7
+ - ๐ŸŽจ Customizable floating button with multiple icon options (coffee, heart, star, dollar, jar)
8
+ - ๐ŸŽจ Custom color theming with configurable background and text colors
9
+ - ๐Ÿ’ซ Optional pulsing animation effect
10
+ - ๐Ÿ’ณ Works with any payment provider (Stripe, PayPal, Ko-fi, Buy Me a Coffee, etc.)
11
+ - ๐Ÿ“ฑ Fully responsive design with inline styles (no CSS dependencies)
12
+ - ๐ŸŽฏ Multiple positioning options (bottom-right, bottom-left, top-right, top-left)
13
+ - ๐ŸŒ™ Light/Dark theme support for modal
12
14
  - ๐Ÿ“Š Built-in analytics tracking
13
15
  - โšก Stimulus.js powered interactions
14
16
  - ๐Ÿ”ง Zero configuration to get started
17
+ - ๐Ÿš€ Simple mode: Direct link without modal
18
+ - โœจ Fully self-contained (v0.2.0+)
15
19
 
16
- ## Why Stripe Payment Links?
20
+ ## Why Use Payment Links?
17
21
 
18
22
  - **No payment code** in your Rails apps
19
- - **PCI compliant** automatically
20
- - **No monthly fees** - pay only 2.9% + 30ยข per transaction
21
- - **International support** with multi-currency
22
- - **Professional checkout** experience
23
- - **Automatic receipts** and tax handling
23
+ - **No PCI compliance concerns** - handled by your payment provider
24
+ - **Multiple provider options** - use Stripe, PayPal, Ko-fi, Buy Me a Coffee, or any service
25
+ - **International support** - most providers support multiple currencies
26
+ - **Professional checkout** experience managed by the provider
27
+ - **Automatic receipts** and tax handling by the payment provider
24
28
 
25
29
  ## Installation
26
30
 
27
31
  Add this gem to your Rails application's Gemfile:
28
32
 
29
33
  ```ruby
30
- # From GitHub (recommended during development)
31
- gem 'rails_tipjar', git: 'https://github.com/justinpaulson/rails_tipjar'
32
-
33
- # Or from RubyGems (when published)
34
+ # From RubyGems
34
35
  gem 'rails_tipjar'
36
+
37
+ # Or from GitHub for latest features
38
+ gem 'rails_tipjar', git: 'https://github.com/justinpaulson/rails_tipjar'
35
39
  ```
36
40
 
37
41
  Then execute:
@@ -43,12 +47,18 @@ rails generate tipjar:install
43
47
 
44
48
  ## Quick Start
45
49
 
46
- ### 1. Create Stripe Payment Links
50
+ ### 1. Create Payment Links
51
+
52
+ Choose your preferred payment provider and create payment links:
47
53
 
48
- 1. Go to [Stripe Dashboard](https://dashboard.stripe.com/payment-links)
49
- 2. Create payment links for different tip amounts
50
- 3. Set them to "Donation" mode
51
- 4. Copy the generated URLs
54
+ **Popular Options:**
55
+ - **Stripe**: [dashboard.stripe.com/payment-links](https://dashboard.stripe.com/payment-links)
56
+ - **PayPal**: [paypal.com/paypalme](https://paypal.com/paypalme)
57
+ - **Ko-fi**: [ko-fi.com](https://ko-fi.com)
58
+ - **Buy Me a Coffee**: [buymeacoffee.com](https://buymeacoffee.com)
59
+ - **GitHub Sponsors**: [github.com/sponsors](https://github.com/sponsors)
60
+
61
+ Create links for different amounts or use a single link that accepts custom amounts.
52
62
 
53
63
  ### 2. Configure the Gem
54
64
 
@@ -56,10 +66,14 @@ Edit `config/initializers/tipjar.rb`:
56
66
 
57
67
  ```ruby
58
68
  RailsTipjar.configure do |config|
69
+ # Simple mode: just one link (no modal)
70
+ config.payment_link = "https://your-payment-provider.com/your-link"
71
+
72
+ # Or use modal mode with multiple amounts
59
73
  config.payment_links = {
60
- small: "https://buy.stripe.com/your-5-dollar-link",
61
- medium: "https://buy.stripe.com/your-10-dollar-link",
62
- large: "https://buy.stripe.com/your-25-dollar-link"
74
+ small: "https://your-provider.com/tip-5",
75
+ medium: "https://your-provider.com/tip-10",
76
+ large: "https://your-provider.com/tip-25"
63
77
  }
64
78
 
65
79
  config.position = :bottom_right
@@ -93,23 +107,34 @@ That's it! You now have a working tip jar on your site.
93
107
 
94
108
  ```ruby
95
109
  RailsTipjar.configure do |config|
96
- # Payment Links (required)
110
+ # Simple mode - just one payment link (no modal)
111
+ config.payment_link = "https://your-payment-link.com"
112
+
113
+ # Modal mode - multiple payment links
97
114
  config.payment_links = {
98
115
  small: "...",
99
116
  medium: "...",
100
117
  large: "...",
101
118
  custom: "..." # Optional: for custom amounts
102
119
  }
120
+ config.use_modal = true # Force modal even with single link
103
121
 
104
122
  # Button position
105
123
  # Options: :bottom_right, :bottom_left, :top_right, :top_left
106
124
  config.position = :bottom_right
107
125
 
108
126
  # Button icon
109
- # Options: :coffee, :heart, :star, :dollar, or custom SVG string
127
+ # Options: :coffee, :heart, :star, :dollar, :jar, or custom SVG string
110
128
  config.icon = :coffee
111
129
 
112
- # Theme
130
+ # Button colors (hex values)
131
+ config.color = "#3b82f6" # Background color (default: blue)
132
+ config.text_color = "#ffffff" # Text color (default: white)
133
+
134
+ # Pulsing animation
135
+ config.pulse = false # Set to true to enable pulsing effect
136
+
137
+ # Theme for modal
113
138
  # Options: :light, :dark, :auto
114
139
  config.theme = :light
115
140
 
@@ -171,8 +196,19 @@ end
171
196
 
172
197
  ## Styling
173
198
 
174
- The gem includes default styles that work with most Rails applications. You can override styles by targeting these CSS classes:
199
+ As of v0.2.0, the gem is fully self-contained with inline styles - no external CSS required! The button works out of the box without any app-side styling.
175
200
 
201
+ ### Customization Options
202
+
203
+ 1. **Via Configuration** (Recommended):
204
+ ```ruby
205
+ config.color = "#10b981" # Green background
206
+ config.text_color = "#000000" # Black text
207
+ config.pulse = true # Enable pulsing animation
208
+ config.button_class = "custom" # Add custom CSS classes
209
+ ```
210
+
211
+ 2. **Via CSS Classes** (for modal mode):
176
212
  ```css
177
213
  /* Button */
178
214
  .tipjar-button { }
@@ -217,6 +253,25 @@ To test in a Rails app, add to your Gemfile:
217
253
  gem 'rails_tipjar', path: '../path/to/rails_tipjar'
218
254
  ```
219
255
 
256
+ ## Icon Options
257
+
258
+ The gem includes 5 built-in icons:
259
+ - `:coffee` - Coffee cup (default)
260
+ - `:heart` - Heart shape
261
+ - `:star` - Star
262
+ - `:dollar` - Dollar sign in circle
263
+ - `:jar` - Tip jar with animated coin
264
+
265
+ You can also provide a custom SVG string for complete customization.
266
+
267
+ ## Version History
268
+
269
+ - **v0.3.0** - Made payment provider agnostic (works with any payment link service)
270
+ - **v0.2.2** - Added color customization and pulse animation control
271
+ - **v0.2.1** - Fixed button circular shape when icon only displayed
272
+ - **v0.2.0** - Made gem fully self-contained with inline styles
273
+ - **v0.1.0** - Initial release
274
+
220
275
  ## Troubleshooting
221
276
 
222
277
  ### Button not appearing
@@ -225,15 +280,15 @@ gem 'rails_tipjar', path: '../path/to/rails_tipjar'
225
280
  2. Verify Stimulus is working in your app
226
281
  3. Check browser console for JavaScript errors
227
282
 
228
- ### Modal not opening
283
+ ### Modal not opening (modal mode only)
229
284
 
230
285
  1. Ensure Stimulus controller is registered
231
- 2. Check that tipjar.css is being loaded
232
- 3. Verify no z-index conflicts with your existing styles
286
+ 2. Verify no z-index conflicts with your existing styles
287
+ 3. Make sure `use_modal = true` if using single payment_link
233
288
 
234
289
  ### Payment links not working
235
290
 
236
- 1. Ensure your Stripe Payment Links are active
291
+ 1. Ensure your payment links are active with your provider
237
292
  2. Check that URLs are correctly configured in initializer
238
293
  3. Test links directly in browser
239
294
 
@@ -23,7 +23,6 @@
23
23
  background-color: #2563eb;
24
24
  transform: scale(1.05);
25
25
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
26
- padding: 0.75rem 1rem;
27
26
  }
28
27
 
29
28
  .tipjar-button:focus {
@@ -144,30 +143,30 @@
144
143
  background-color: #1f2937;
145
144
  color: #f3f4f6;
146
145
  }
147
-
146
+
148
147
  .tipjar-modal-header h3 {
149
148
  color: #f3f4f6;
150
149
  }
151
-
150
+
152
151
  .tipjar-modal-header p {
153
152
  color: #9ca3af;
154
153
  }
155
-
154
+
156
155
  .tipjar-amount-button {
157
156
  background-color: #374151;
158
157
  border-color: #4b5563;
159
158
  color: #f3f4f6;
160
159
  }
161
-
160
+
162
161
  .tipjar-amount-button:hover {
163
162
  background-color: #4b5563;
164
163
  border-color: #60a5fa;
165
164
  }
166
-
165
+
167
166
  .tipjar-modal-close {
168
167
  color: #9ca3af;
169
168
  }
170
-
169
+
171
170
  .tipjar-modal-close:hover {
172
171
  color: #f3f4f6;
173
172
  }
@@ -181,21 +180,21 @@
181
180
  min-width: 2.5rem;
182
181
  min-height: 2.5rem;
183
182
  }
184
-
183
+
185
184
  .tipjar-button:hover {
186
185
  padding: 0.625rem 0.875rem;
187
186
  }
188
-
187
+
189
188
  .tipjar-button-icon {
190
189
  width: 1.25rem;
191
190
  height: 1.25rem;
192
191
  }
193
-
192
+
194
193
  .tipjar-modal-content {
195
194
  margin: 1rem;
196
195
  max-width: calc(100% - 2rem);
197
196
  }
198
-
197
+
199
198
  .tipjar-modal-amounts .grid {
200
199
  grid-template-columns: 1fr;
201
200
  }
@@ -220,4 +219,4 @@
220
219
 
221
220
  .top-4 {
222
221
  top: 1rem;
223
- }
222
+ }
@@ -1,30 +1,33 @@
1
1
  module TipjarHelper
2
2
  def tipjar_button(options = {})
3
3
  config = RailsTipjar.config
4
-
4
+
5
5
  position = options[:position] || config.position
6
6
  custom_class = options[:class] || config.button_class
7
7
  z_index = options[:z_index] || config.z_index
8
-
8
+
9
9
  # Inject CSS styles into the page once
10
10
  tipjar_styles + tipjar_button_html(config, position, custom_class, z_index)
11
11
  end
12
-
12
+
13
13
  private
14
-
14
+
15
15
  def tipjar_button_html(config, position, custom_class, z_index)
16
16
  # Simple direct link mode when payment_link is set
17
17
  if config.payment_link && !config.use_modal
18
18
  position_style = position_inline_styles(position)
19
- button_style = "#{position_style} z-index: #{z_index}; display: flex; align-items: center; padding: 0.75rem 1rem; background-color: #3b82f6; color: white; border-radius: 9999px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; cursor: pointer; border: none; font-size: 0.875rem; font-weight: 500; text-decoration: none; animation: tipjar-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;"
20
-
19
+ animation_style = config.pulse ? "animation: tipjar-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;" : ""
20
+ button_style = "#{position_style} z-index: #{z_index}; display: flex; align-items: center; padding: 0.75rem; background-color: #{config.color}; color: #{config.text_color}; border-radius: 9999px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; cursor: pointer; border: none; font-size: 0.875rem; font-weight: 500; text-decoration: none; #{animation_style}"
21
+
22
+ hover_color = darken_color(config.color)
23
+
21
24
  link_to config.payment_link,
22
25
  target: "_blank",
23
26
  rel: "noopener",
24
27
  class: "tipjar-button #{custom_class}",
25
28
  style: button_style,
26
- onmouseover: "this.style.backgroundColor='#2563eb'; this.style.transform='scale(1.05)'; this.querySelector('.tipjar-button-text').style.maxWidth='200px'; this.querySelector('.tipjar-button-text').style.marginLeft='0.5rem';",
27
- onmouseout: "this.style.backgroundColor='#3b82f6'; this.style.transform='scale(1)'; this.querySelector('.tipjar-button-text').style.maxWidth='0'; this.querySelector('.tipjar-button-text').style.marginLeft='0';" do
29
+ onmouseover: "this.style.backgroundColor='#{hover_color}'; this.style.transform='scale(1.05)'; this.querySelector('.tipjar-button-text').style.maxWidth='200px'; this.querySelector('.tipjar-button-text').style.marginLeft='0.5rem';",
30
+ onmouseout: "this.style.backgroundColor='#{config.color}'; this.style.transform='scale(1)'; this.querySelector('.tipjar-button-text').style.maxWidth='0'; this.querySelector('.tipjar-button-text').style.marginLeft='0';" do
28
31
  content_tag(:span, style: "display: flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem;") do
29
32
  raw config.icon_svg
30
33
  end +
@@ -32,9 +35,9 @@ module TipjarHelper
32
35
  end
33
36
  else
34
37
  # Original modal mode - would need more work to be fully inline
35
- content_tag :div,
38
+ content_tag :div,
36
39
  class: "tipjar-container",
37
- data: {
40
+ data: {
38
41
  controller: "tipjar",
39
42
  tipjar_payment_links_value: config.payment_links.to_json,
40
43
  tipjar_theme_value: config.theme,
@@ -52,44 +55,21 @@ module TipjarHelper
52
55
  end
53
56
  end
54
57
  end
55
-
58
+
56
59
  def tipjar_styles
57
60
  return "" if @tipjar_styles_injected
58
61
  @tipjar_styles_injected = true
59
-
62
+
60
63
  content_tag :style do
61
64
  <<~CSS.html_safe
62
65
  @keyframes tipjar-pulse {
63
66
  0%, 100% { opacity: 1; }
64
67
  50% { opacity: 0.8; }
65
68
  }
66
-
67
- @keyframes tipjar-coin-drop {
68
- 0% {
69
- transform: translateY(0) rotate(0deg);
70
- opacity: 0;
71
- }
72
- 20% {
73
- opacity: 1;
74
- }
75
- 80% {
76
- transform: translateY(7px) rotate(180deg);
77
- opacity: 1;
78
- }
79
- 100% {
80
- transform: translateY(9px) rotate(180deg);
81
- opacity: 0;
82
- }
83
- }
84
-
85
- .tipjar-coin-animation {
86
- animation: tipjar-coin-drop 2s ease-in-out infinite;
87
- transform-origin: center;
88
- }
89
69
  CSS
90
70
  end
91
71
  end
92
-
72
+
93
73
  def position_inline_styles(position)
94
74
  case position
95
75
  when :bottom_right
@@ -104,18 +84,18 @@ module TipjarHelper
104
84
  "position: fixed; bottom: 1rem; right: 1rem;"
105
85
  end
106
86
  end
107
-
87
+
108
88
  def tipjar_link(text = nil, options = {})
109
89
  config = RailsTipjar.config
110
90
  text ||= config.button_text
111
91
  amount = options[:amount] || :medium
112
-
92
+
113
93
  link_url = if amount.is_a?(Symbol)
114
94
  config.payment_links[amount]
115
95
  else
116
96
  config.payment_links[:custom] || config.payment_links[:medium]
117
97
  end
118
-
98
+
119
99
  link_options = {
120
100
  target: "_blank",
121
101
  rel: "noopener",
@@ -125,19 +105,19 @@ module TipjarHelper
125
105
  tipjar_analytics: config.analytics_enabled
126
106
  }
127
107
  }
128
-
108
+
129
109
  link_to text, link_url, link_options.merge(options.except(:amount, :class))
130
110
  end
131
-
111
+
132
112
  def tipjar_modal(options = {})
133
113
  config = RailsTipjar.config
134
-
114
+
135
115
  render partial: "tipjar/modal", locals: {
136
116
  config: config,
137
117
  options: options
138
118
  }
139
119
  end
140
-
120
+
141
121
  def config_position_classes(position)
142
122
  case position
143
123
  when :bottom_right
@@ -152,4 +132,22 @@ module TipjarHelper
152
132
  "fixed bottom-4 right-4"
153
133
  end
154
134
  end
155
- end
135
+
136
+ def darken_color(hex_color)
137
+ # Remove # if present
138
+ hex = hex_color.gsub('#', '')
139
+
140
+ # Convert to RGB
141
+ r = hex[0..1].to_i(16)
142
+ g = hex[2..3].to_i(16)
143
+ b = hex[4..5].to_i(16)
144
+
145
+ # Darken by 20%
146
+ r = (r * 0.8).to_i
147
+ g = (g * 0.8).to_i
148
+ b = (b * 0.8).to_i
149
+
150
+ # Convert back to hex
151
+ "#%02x%02x%02x" % [r, g, b]
152
+ end
153
+ end
@@ -63,10 +63,10 @@
63
63
  Continue to Payment
64
64
  </button>
65
65
 
66
- <!-- Powered by Stripe -->
66
+ <!-- Footer -->
67
67
  <div class="tipjar-modal-footer mt-4 text-center">
68
68
  <p class="text-xs text-gray-500">
69
- Secure payment powered by Stripe
69
+ Secure payment processing
70
70
  </p>
71
71
  </div>
72
72
  </div>
@@ -68,17 +68,21 @@ module Tipjar
68
68
  say "RailsTipjar has been successfully installed!", :green
69
69
  say "\n"
70
70
  say "Next steps:", :yellow
71
- say "1. Create Stripe Payment Links at https://dashboard.stripe.com/payment-links", :yellow
71
+ say "1. Create payment links with your preferred provider (Stripe, PayPal, Ko-fi, etc.)", :yellow
72
72
  say "2. Configure your payment links in config/initializers/tipjar.rb", :yellow
73
73
  say "3. Add <%= tipjar_button %> to your layout file", :yellow
74
74
  say "\n"
75
75
  say "Example configuration:", :cyan
76
76
  say <<~CONFIG
77
77
  RailsTipjar.configure do |config|
78
+ # Simple mode - just one link:
79
+ config.payment_link = "https://your-payment-provider.com/tip"
80
+
81
+ # Or modal mode with multiple amounts:
78
82
  config.payment_links = {
79
- small: "https://buy.stripe.com/your-link-1",
80
- medium: "https://buy.stripe.com/your-link-2",
81
- large: "https://buy.stripe.com/your-link-3"
83
+ small: "https://your-provider.com/tip-5",
84
+ medium: "https://your-provider.com/tip-10",
85
+ large: "https://your-provider.com/tip-25"
82
86
  }
83
87
  config.position = :bottom_right
84
88
  config.icon = :coffee
@@ -1,16 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RailsTipjar.configure do |config|
4
- # Configure your Stripe Payment Links
5
- # Create payment links at: https://dashboard.stripe.com/payment-links
4
+ # Configure your payment links
5
+ # Works with any payment provider: Stripe, PayPal, Ko-fi, Buy Me a Coffee, etc.
6
6
  #
7
- # You can create different links for different amounts, or use a single
8
- # link that allows custom amounts
7
+ # Simple mode - just one payment link:
8
+ # config.payment_link = "https://your-payment-provider.com/your-link"
9
+ #
10
+ # Modal mode - multiple payment links for different amounts:
9
11
  config.payment_links = {
10
- small: "https://buy.stripe.com/test_REPLACE_WITH_YOUR_LINK",
11
- medium: "https://buy.stripe.com/test_REPLACE_WITH_YOUR_LINK",
12
- large: "https://buy.stripe.com/test_REPLACE_WITH_YOUR_LINK",
13
- custom: "https://buy.stripe.com/test_REPLACE_WITH_YOUR_LINK"
12
+ small: "https://REPLACE_WITH_YOUR_PAYMENT_LINK",
13
+ medium: "https://REPLACE_WITH_YOUR_PAYMENT_LINK",
14
+ large: "https://REPLACE_WITH_YOUR_PAYMENT_LINK",
15
+ custom: "https://REPLACE_WITH_YOUR_PAYMENT_LINK"
14
16
  }
15
17
 
16
18
  # Position of the tip jar button
@@ -50,4 +52,13 @@ RailsTipjar.configure do |config|
50
52
  # Tracks: button clicks, modal opens, amount selections, and successful tips
51
53
  # Works with Google Analytics 4 and Plausible out of the box
52
54
  config.analytics_enabled = false
55
+
56
+ # Customize button colors (hex values)
57
+ # Default: blue background (#3b82f6) with white text (#ffffff)
58
+ # config.color = "#3b82f6"
59
+ # config.text_color = "#ffffff"
60
+
61
+ # Enable pulsing animation on the button
62
+ # Default: false (no animation)
63
+ # config.pulse = true
53
64
  end
@@ -3,7 +3,7 @@ module RailsTipjar
3
3
  attr_accessor :payment_links, :position, :icon, :theme, :button_text,
4
4
  :modal_title, :modal_description, :custom_amounts,
5
5
  :button_class, :z_index, :analytics_enabled, :payment_link,
6
- :use_modal
6
+ :use_modal, :color, :text_color, :pulse
7
7
 
8
8
  def initialize
9
9
  # Simple mode - just one link
@@ -27,6 +27,9 @@ module RailsTipjar
27
27
  @button_class = ""
28
28
  @z_index = 1000
29
29
  @analytics_enabled = false
30
+ @color = "#3b82f6" # Default blue color
31
+ @text_color = "#ffffff" # Default white text color
32
+ @pulse = false # Default no pulsing animation
30
33
  end
31
34
 
32
35
  def position_classes
@@ -48,7 +51,46 @@ module RailsTipjar
48
51
  case @icon
49
52
  when :coffee
50
53
  '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
51
- <path stroke-linecap="round" stroke-linejoin="round" d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25v7.5c0 2.485 2.099 4.5 4.688 4.5 1.935 0 3.597-1.126 4.313-2.733.715 1.607 2.377 2.733 4.313 2.733 2.588 0 4.687-2.015 4.687-4.5v-7.5z" />
54
+ <defs>
55
+ <style>
56
+ @keyframes steam1 {
57
+ 0% { opacity: 0; transform: translateY(0) translateX(0); }
58
+ 20% { opacity: 0.8; }
59
+ 50% { opacity: 0.6; transform: translateY(-3px) translateX(1px); }
60
+ 80% { opacity: 0.3; }
61
+ 100% { opacity: 0; transform: translateY(-8px) translateX(-1px); }
62
+ }
63
+ @keyframes steam2 {
64
+ 0% { opacity: 0; transform: translateY(0) translateX(0); }
65
+ 15% { opacity: 0.7; }
66
+ 45% { opacity: 0.5; transform: translateY(-4px) translateX(-1px); }
67
+ 75% { opacity: 0.2; }
68
+ 100% { opacity: 0; transform: translateY(-9px) translateX(1px); }
69
+ }
70
+ @keyframes steam3 {
71
+ 0% { opacity: 0; transform: translateY(0) translateX(0); }
72
+ 25% { opacity: 0.6; }
73
+ 55% { opacity: 0.4; transform: translateY(-3px) translateX(0.5px); }
74
+ 85% { opacity: 0.1; }
75
+ 100% { opacity: 0; transform: translateY(-7px) translateX(-0.5px); }
76
+ }
77
+ .steam1 { animation: steam1 3s ease-out infinite; }
78
+ .steam2 { animation: steam2 3s ease-out infinite 0.5s; }
79
+ .steam3 { animation: steam3 3s ease-out infinite 1s; }
80
+ </style>
81
+ </defs>
82
+ <!-- Steam wisps with wavy paths -->
83
+ <path class="steam1" d="M8 9c0.5-0.5 0.5-1 0-1.5s-0.5-1 0-1.5s0.5-1 0-1.5" stroke-linecap="round" fill="none" opacity="0"/>
84
+ <path class="steam2" d="M12 8.5c-0.3-0.4 -0.3-0.8 0-1.2s0.3-0.8 0-1.2s-0.3-0.8 0-1.2" stroke-linecap="round" fill="none" opacity="0"/>
85
+ <path class="steam3" d="M15.5 9c0.4-0.3 0.4-0.7 0-1s-0.4-0.7 0-1s0.4-0.7 0-1" stroke-linecap="round" fill="none" opacity="0"/>
86
+ <!-- Coffee cup body -->
87
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 10h12v7a3 3 0 01-3 3H9a3 3 0 01-3-3v-7z"/>
88
+ <!-- Cup handle -->
89
+ <path stroke-linecap="round" stroke-linejoin="round" d="M18 10h1.5a2.5 2.5 0 010 5H18"/>
90
+ <!-- Saucer -->
91
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4 20h16"/>
92
+ <!-- Coffee surface detail -->
93
+ <path stroke-linecap="round" stroke-linejoin="round" d="M8 12h8" opacity="0.3"/>
52
94
  </svg>'
53
95
  when :heart
54
96
  '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
@@ -64,20 +106,61 @@ module RailsTipjar
64
106
  </svg>'
65
107
  when :jar
66
108
  '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
109
+ <defs>
110
+ <style>
111
+ @keyframes tipjar-coin-drop-new {
112
+ 0% {
113
+ transform: translateY(0px);
114
+ opacity: 0;
115
+ }
116
+ 10% {
117
+ opacity: 1;
118
+ transform: translateY(2px);
119
+ }
120
+ 30% {
121
+ transform: translateY(6px);
122
+ }
123
+ 50% {
124
+ transform: translateY(10px);
125
+ opacity: 1;
126
+ }
127
+ 70% {
128
+ transform: translateY(15.5px);
129
+ opacity: 1;
130
+ }
131
+ 75% {
132
+ transform: translateY(16.3px);
133
+ opacity: 1;
134
+ }
135
+ 80% {
136
+ transform: translateY(15.8px);
137
+ opacity: 0.8;
138
+ }
139
+ 100% {
140
+ transform: translateY(16.3px);
141
+ opacity: 0;
142
+ }
143
+ }
144
+ .tipjar-coin-drop-new {
145
+ animation: tipjar-coin-drop-new 2.5s ease-in-out infinite;
146
+ }
147
+ </style>
148
+ </defs>
67
149
  <!-- Jar lid -->
68
- <rect x="8.5" y="3" width="7" height="1.5" rx="0.25" stroke-linecap="round" stroke-linejoin="round"/>
150
+ <rect x="9.5" y="3" width="5" height="1" rx="0.25" stroke-linecap="round" stroke-linejoin="round"/>
69
151
  <!-- Jar threads/neck -->
70
- <path stroke-linecap="round" stroke-linejoin="round" d="M9 4.5v1.5M15 4.5v1.5"/>
71
- <!-- Jar body with taper -->
72
- <path stroke-linecap="round" stroke-linejoin="round" d="M9 6c0 0 -1 0.5 -1 1.5v11.5a2 2 0 002 2h4a2 2 0 002-2V7.5c0-1 -1-1.5 -1-1.5"/>
73
- <!-- Coins at bottom -->
152
+ <path stroke-linecap="round" stroke-linejoin="round" d="M10 4v0.8M14 4v0.8"/>
153
+ <!-- Jar body - much fatter with short taper -->
154
+ <path stroke-linecap="round" stroke-linejoin="round" d="M10 4.8h4M9 5.5c-1 0 -2 0.5 -2 1v12.5a2 2 0 002 2h6a2 2 0 002-2V6.5c0-0.5 -1-1 -2-1"/>
155
+ <!-- Coins at bottom - pile -->
74
156
  <ellipse cx="10.5" cy="18.5" rx="1.5" ry="0.5" stroke-linecap="round"/>
75
- <ellipse cx="14" cy="18" rx="1.5" ry="0.5" stroke-linecap="round"/>
76
- <ellipse cx="12" cy="17.5" rx="1.5" ry="0.5" stroke-linecap="round"/>
77
- <!-- Falling coin -->
78
- <g class="tipjar-coin-animation">
79
- <ellipse cx="12" cy="10" rx="1.5" ry="0.5" stroke-linecap="round"/>
80
- <path stroke-linecap="round" d="M12 10v1.5"/>
157
+ <ellipse cx="13.5" cy="18.3" rx="1.5" ry="0.5" stroke-linecap="round"/>
158
+ <ellipse cx="12" cy="17.8" rx="1.5" ry="0.5" stroke-linecap="round"/>
159
+ <ellipse cx="11" cy="19" rx="1.3" ry="0.4" stroke-linecap="round"/>
160
+ <ellipse cx="13" cy="19" rx="1.3" ry="0.4" stroke-linecap="round"/>
161
+ <!-- Falling coin - starts above jar outside -->
162
+ <g class="tipjar-coin-drop-new">
163
+ <ellipse cx="12" cy="1.5" rx="1.5" ry="0.5" stroke-linecap="round"/>
81
164
  </g>
82
165
  </svg>'
83
166
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsTipjar
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_tipjar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Paulson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-11 00:00:00.000000000 Z
11
+ date: 2025-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,8 +38,8 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
- description: Easily add a customizable tip jar to any Rails application using Stripe
42
- Payment Links
41
+ description: Easily add a customizable tip jar to any Rails application. Works with
42
+ any payment provider.
43
43
  email:
44
44
  - justinapaulson@gmail.com
45
45
  executables: []
@@ -60,7 +60,6 @@ files:
60
60
  - lib/rails_tipjar/configuration.rb
61
61
  - lib/rails_tipjar/engine.rb
62
62
  - lib/rails_tipjar/version.rb
63
- - rails_tipjar-0.1.0.gem
64
63
  - sig/rails_tipjar.rbs
65
64
  homepage: https://github.com/justinpaulson/rails_tipjar
66
65
  licenses: []
Binary file