react-email-rails 0.8.0 → 0.10.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: cf2e6b94aa19f4ccec30037d5eefb38b1b98ba2f070ede1a89c99818e47b2eec
4
- data.tar.gz: 26710f44d94a84d1df7a73a0759973c37fc9b3ec031c143ae902aed890ebb2d2
3
+ metadata.gz: 2d0666badbedb79a20a1fec50afc5aedde5398a3777620f5c2f6c2e080a2a5e2
4
+ data.tar.gz: f19f1dba07f2ad62bf5737e3fab859c33a526305963ee239a1eb63d3048cc7f9
5
5
  SHA512:
6
- metadata.gz: 911446dcf37e32e420bef4e0f02cdf8c30c6076854dba593737ae552138e139473f355d1ef14328bf50cf77943e5b376e82300185b8d23ea34fb41a1a3deaaaf
7
- data.tar.gz: 708ac8a7339f5133be74caccce59a1f30dc890f6da95adeb5385a5117b894295fd8e3e5748a50e8a46d0cdd6bcc1abc6d3943abf9bf146dd2b57163c3d0c94a5
6
+ metadata.gz: 3905f2042d9932512be861bd7bf0be13f7dde1e9f481dae3ebbbe36f676f8562ecc29532a91649e1e64102454427057599d10baa47866ed9bbab6699163546a8
7
+ data.tar.gz: 6236d1b78f000473a2bb696bbf204ce72143bd62abdc1008a0ce0fa05be88777ca2416101107894f92feaea79d16fbc7f9fc4e13d4c00e8b52ca31dff289fa64
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0
4
+
5
+ - **Breaking:** Remove the instance-level `react_share` helper (calling `react_share` from within an action before `mail`). Pass per-mail props directly in the `react:` hash instead; use the class-level `react_share` (with `only`/`except`/`if`/`unless`) for conditional sharing.
6
+
7
+ ## 0.9.0
8
+
9
+ - **Breaking:** Rename `react_email_share` to `react_share`, matching the `react:` key used in `mail`. Update any `react_email_share` calls in your mailers to `react_share`.
10
+
3
11
  ## 0.8.0
4
12
 
5
13
  - **Breaking:** Remove `@react-email/editor` document rendering to focus the library on component-based Action Mailer emails. `ReactEmailRails.compose`, `ReactEmailRails.parse`, the `documents` Vite plugin option, and the `react-email-rails/document` module are gone, along with the `@react-email/editor`, `@tiptap/core`, `@tiptap/html`, `happy-dom`, and `marked` optional peer dependencies.
data/README.md CHANGED
@@ -280,15 +280,15 @@ To change naming globally, override `component_path_resolver` in your [Rails con
280
280
 
281
281
  ### Shared Props
282
282
 
283
- Use `react_email_share` to merge props into every `react:` email for a mailer and its subclasses:
283
+ Use `react_share` to merge props into every `react:` email for a mailer and its subclasses:
284
284
 
285
285
  ```ruby
286
286
  class MarketingMailer < ApplicationMailer
287
- react_email_share app_name: "Acme"
287
+ react_share app_name: "Acme"
288
288
 
289
- react_email_share unread_count: -> { params[:account]&.unread_count }
289
+ react_share unread_count: -> { params[:account]&.unread_count }
290
290
 
291
- react_email_share do
291
+ react_share do
292
292
  { brand: { name: "Acme", url: marketing_url } }
293
293
  end
294
294
  end
@@ -310,34 +310,18 @@ Shared props work with `react:` hashes, `react: true`, and explicit `react: "com
310
310
 
311
311
  ### Conditional Shared Props
312
312
 
313
- `react_email_share` accepts the same filter options as `before_action`: `only`, `except`, `if`, and `unless`.
313
+ `react_share` accepts the same filter options as `before_action`: `only`, `except`, `if`, and `unless`.
314
314
 
315
315
  ```ruby
316
- react_email_share only: [:welcome, :reactivation] do
316
+ react_share only: [:welcome, :reactivation] do
317
317
  { promotion: params.fetch(:promotion) }
318
318
  end
319
319
 
320
- react_email_share if: :account_active? do
320
+ react_share if: :account_active? do
321
321
  { account: { name: params.fetch(:account).name } }
322
322
  end
323
323
  ```
324
324
 
325
- You can also share props inside an action before calling `mail`:
326
-
327
- ```ruby
328
- def welcome
329
- account = params.fetch(:account)
330
-
331
- react_email_share notice: "Thanks for joining!"
332
-
333
- mail(
334
- to: account.email,
335
- subject: "Welcome",
336
- react: { account: account.as_json(only: [:name]) },
337
- )
338
- end
339
- ```
340
-
341
325
  ### Deep Merging Shared Props
342
326
 
343
327
  Shared props are merged shallowly by default. That means a per-mail prop replaces a shared prop with the same name.
@@ -345,7 +329,7 @@ Shared props are merged shallowly by default. That means a per-mail prop replace
345
329
  Pass `deep_merge: true` to merge nested hashes instead:
346
330
 
347
331
  ```ruby
348
- react_email_share do
332
+ react_share do
349
333
  { settings: { theme: "light", locale: "en" } }
350
334
  end
351
335
 
@@ -12,7 +12,7 @@ module ReactEmailRails::ActionMailer
12
12
  self.react_email_use_instance_props = true
13
13
  end
14
14
 
15
- def react_email_share(hash = nil, **props, &block)
15
+ def react_share(hash = nil, **props, &block)
16
16
  options = props.slice(*SHARED_FILTER_OPTIONS)
17
17
  data = hash || props.except(*SHARED_FILTER_OPTIONS)
18
18
 
@@ -22,10 +22,6 @@ module ReactEmailRails::ActionMailer
22
22
  end
23
23
  end
24
24
 
25
- def react_email_share(hash = nil, **props, &block)
26
- react_email_append_shared(hash || props, block)
27
- end
28
-
29
25
  def mail(headers = {}, &block)
30
26
  return super unless headers.is_a?(Hash)
31
27
  return super if headers.empty? && @_mail_was_called
@@ -1,3 +1,3 @@
1
1
  module ReactEmailRails
2
- VERSION = "0.8.0"
2
+ VERSION = "0.10.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react-email-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Supertape