react-email-rails 0.8.0 → 0.9.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +9 -9
- data/lib/react_email_rails/action_mailer.rb +2 -2
- data/lib/react_email_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a57e71ae6b09c032c117a6e3cb0e30c2913340b91bf3ed1c3a8480ca8b04355
|
|
4
|
+
data.tar.gz: 1880d340ee6dc94daeafe63386b90d775c99b8eaedcbad9704d55a70b3854456
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60ce6e92fe530cd05aede3d905985d36e4aa08c8167c0a6248908f7453930dd30f0e32e14f4a6921cb9ad1fbcade89054a4c95b627df07282900e6a753542b14
|
|
7
|
+
data.tar.gz: b8a0ca20d81079a24a1c7c62400bd42d60b4c559a60189cdc948be8c61236016c56251999231825152c2a5ca11e266f572a8549b8e9fbd0f15d8d3224487f34e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
- **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`.
|
|
6
|
+
|
|
3
7
|
## 0.8.0
|
|
4
8
|
|
|
5
9
|
- **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 `
|
|
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
|
-
|
|
287
|
+
react_share app_name: "Acme"
|
|
288
288
|
|
|
289
|
-
|
|
289
|
+
react_share unread_count: -> { params[:account]&.unread_count }
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
react_share do
|
|
292
292
|
{ brand: { name: "Acme", url: marketing_url } }
|
|
293
293
|
end
|
|
294
294
|
end
|
|
@@ -310,14 +310,14 @@ Shared props work with `react:` hashes, `react: true`, and explicit `react: "com
|
|
|
310
310
|
|
|
311
311
|
### Conditional Shared Props
|
|
312
312
|
|
|
313
|
-
`
|
|
313
|
+
`react_share` accepts the same filter options as `before_action`: `only`, `except`, `if`, and `unless`.
|
|
314
314
|
|
|
315
315
|
```ruby
|
|
316
|
-
|
|
316
|
+
react_share only: [:welcome, :reactivation] do
|
|
317
317
|
{ promotion: params.fetch(:promotion) }
|
|
318
318
|
end
|
|
319
319
|
|
|
320
|
-
|
|
320
|
+
react_share if: :account_active? do
|
|
321
321
|
{ account: { name: params.fetch(:account).name } }
|
|
322
322
|
end
|
|
323
323
|
```
|
|
@@ -328,7 +328,7 @@ You can also share props inside an action before calling `mail`:
|
|
|
328
328
|
def welcome
|
|
329
329
|
account = params.fetch(:account)
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
react_share notice: "Thanks for joining!"
|
|
332
332
|
|
|
333
333
|
mail(
|
|
334
334
|
to: account.email,
|
|
@@ -345,7 +345,7 @@ Shared props are merged shallowly by default. That means a per-mail prop replace
|
|
|
345
345
|
Pass `deep_merge: true` to merge nested hashes instead:
|
|
346
346
|
|
|
347
347
|
```ruby
|
|
348
|
-
|
|
348
|
+
react_share do
|
|
349
349
|
{ settings: { theme: "light", locale: "en" } }
|
|
350
350
|
end
|
|
351
351
|
|
|
@@ -12,7 +12,7 @@ module ReactEmailRails::ActionMailer
|
|
|
12
12
|
self.react_email_use_instance_props = true
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def
|
|
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,7 +22,7 @@ module ReactEmailRails::ActionMailer
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def
|
|
25
|
+
def react_share(hash = nil, **props, &block)
|
|
26
26
|
react_email_append_shared(hash || props, block)
|
|
27
27
|
end
|
|
28
28
|
|