isomorfeus-mailer 2.5.5 → 22.9.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/isomorfeus/mailer/version.rb +1 -1
- data/lib/isomorfeus-mailer.rb +3 -5
- data/lib/lucid_mail.rb +12 -14
- metadata +26 -27
- data/lib/isomorfeus/mailer/imports.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac046c16205a3a9bfda4770b71f50a9011daf177f966972b4edca59337d657b
|
4
|
+
data.tar.gz: d764435de5da3a746516eb6542b39f6cada33d96d0867b5f76acc559b261c046
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bb5aae3aa4eea023f9f53a94e24d58c375aa061d33f94b99a57222221187d75b0f7bf1f90cff8af02e09fa9345507bbc63fec148e6c952210ef4c6badf9881b
|
7
|
+
data.tar.gz: 3e76a6aefebc8938ce499f4fe3682d1622a1790ef1465a35cc8911a52889f80509455583233dec9c3e6342430f7c34c1bafa7bce284e053f0edea8e971602d1d
|
data/README.md
CHANGED
@@ -27,14 +27,14 @@ Inline styles work in Mail Components too.
|
|
27
27
|
|
28
28
|
Example component:
|
29
29
|
```ruby
|
30
|
-
class EmailComponent < LucidApp
|
30
|
+
class EmailComponent < LucidApp
|
31
31
|
# the top level component must be a App component
|
32
32
|
# then other LucidComponent's can be used in the render block
|
33
33
|
|
34
34
|
prop :name
|
35
35
|
|
36
36
|
render do
|
37
|
-
DIV "Welcome #{props
|
37
|
+
DIV "Welcome #{props[:name]}!"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
```
|
@@ -72,7 +72,7 @@ For documentation about the Mail Object see the [Mail Documentation](https://git
|
|
72
72
|
#### Triggering mail from a client
|
73
73
|
LucidMail is available only on the server to prevent abuse. It can be wrapped in a operation to allow triggering the sending of mail from a client. Example:
|
74
74
|
```ruby
|
75
|
-
class MailOp < LucidQuickOp
|
75
|
+
class MailOp < LucidQuickOp
|
76
76
|
op do
|
77
77
|
LucidMail.new(component: 'EmailComponent',
|
78
78
|
from: 'me@test.com',
|
data/lib/isomorfeus-mailer.rb
CHANGED
@@ -2,12 +2,10 @@ require 'nokogiri'
|
|
2
2
|
require 'isomorfeus/html2text'
|
3
3
|
require 'mailhandler'
|
4
4
|
require 'isomorfeus-asset-manager'
|
5
|
+
require 'isomorfeus-transport'
|
5
6
|
require 'isomorfeus-redux'
|
6
7
|
require 'isomorfeus-preact'
|
7
|
-
require 'isomorfeus-transport'
|
8
8
|
require 'isomorfeus/mailer/config'
|
9
|
-
require 'isomorfeus/mailer/imports'
|
10
|
-
|
11
|
-
Isomorfeus::Mailer::Imports.add
|
12
|
-
|
13
9
|
require 'lucid_mail'
|
10
|
+
|
11
|
+
Isomorfeus.zeitwerk.push_dir(File.expand_path(File.join('app', 'mail_components')))
|
data/lib/lucid_mail.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class LucidMail
|
2
|
-
include
|
3
|
-
extend
|
2
|
+
include Preact::ViewHelper
|
3
|
+
extend Preact::PropDeclarationMixin
|
4
4
|
|
5
5
|
prop :from, class: String, required: true
|
6
6
|
prop :reply_to, class: String, required: false, allow_nil: true
|
@@ -15,12 +15,13 @@ class LucidMail
|
|
15
15
|
attr_reader :rendered_component
|
16
16
|
|
17
17
|
def initialize(**props)
|
18
|
-
@
|
18
|
+
@self_class = self.class
|
19
|
+
@props = @self_class.validated_props(props)
|
19
20
|
@mail = nil
|
20
21
|
@rendered_component = nil
|
21
|
-
@loc_h = if
|
22
|
+
@loc_h = if @self_class.const_defined?('::Isomorfeus::Puppetmaster')
|
22
23
|
"#{::Isomorfeus::Puppetmaster.served_app.host}:#{::Isomorfeus::Puppetmaster.served_app.port}"
|
23
|
-
elsif
|
24
|
+
elsif @self_class.const_defined?('::Iodine')
|
24
25
|
host = ::Iodine::DEFAULT_SETTINGS[:address]
|
25
26
|
host = 'localhost' unless host
|
26
27
|
"#{host}:#{::Iodine::DEFAULT_SETTINGS[:port]}"
|
@@ -30,8 +31,8 @@ class LucidMail
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def render_component
|
33
|
-
component_props = { location_host: @loc_h }.merge(props
|
34
|
-
rendered_tree = mount_component(props
|
34
|
+
component_props = { location_host: @loc_h }.merge(props[:props])
|
35
|
+
rendered_tree = mount_component(props[:component], component_props, use_ssr: true)
|
35
36
|
@rendered_component = <<~HTML
|
36
37
|
<!DOCTYPE html>
|
37
38
|
<html><head><style type="text/css">#{ssr_styles}</style></head><body>#{rendered_tree}</body></html>
|
@@ -44,10 +45,10 @@ class LucidMail
|
|
44
45
|
html_body = rendered_component
|
45
46
|
text_body = Html2Text.convert(rendered_component)
|
46
47
|
@mail = Mail.new
|
47
|
-
@mail.to(props
|
48
|
-
@mail.from(props
|
49
|
-
@mail.subject(props
|
50
|
-
@mail.reply_to(props
|
48
|
+
@mail.to(props[:to])
|
49
|
+
@mail.from(props[:from])
|
50
|
+
@mail.subject(props[:subject])
|
51
|
+
@mail.reply_to(props[:reply_to]) if props.key?(:reply_to)
|
51
52
|
@mail.text_part do
|
52
53
|
content_type 'text/plain; charset=UTF-8'
|
53
54
|
body text_body
|
@@ -62,11 +63,8 @@ class LucidMail
|
|
62
63
|
|
63
64
|
def send
|
64
65
|
s = Time.now
|
65
|
-
STDERR.puts "m #{s}"
|
66
66
|
build unless mail
|
67
|
-
STDERR.puts "mr #{Time.now - s}"
|
68
67
|
r = Isomorfeus.email_sender.send_email(mail)
|
69
|
-
STDERR.puts "ms #{Time.now - s}"
|
70
68
|
r
|
71
69
|
end
|
72
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 22.9.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.0.
|
19
|
+
version: 7.0.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.0.
|
26
|
+
version: 7.0.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mail
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,42 +58,42 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.13.
|
61
|
+
version: 1.13.8
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.13.
|
68
|
+
version: 1.13.8
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: oj
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.13.
|
75
|
+
version: 3.13.21
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.13.
|
82
|
+
version: 3.13.21
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: opal
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.5.
|
89
|
+
version: 1.5.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.5.
|
96
|
+
version: 1.5.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: opal-activesupport
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,70 +114,70 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.15.1
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.15.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: isomorfeus-preact
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 22.9.0.rc1
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 22.9.0.rc1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: isomorfeus-redux
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 22.9.0.rc1
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 22.9.0.rc1
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: isomorfeus-transport
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - '='
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 22.9.0.rc1
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - '='
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 22.9.0.rc1
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: isomorfeus
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - '='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 22.9.0.rc1
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - '='
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 22.9.0.rc1
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rake
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,7 +217,6 @@ files:
|
|
217
217
|
- lib/isomorfeus-mailer.rb
|
218
218
|
- lib/isomorfeus/html2text.rb
|
219
219
|
- lib/isomorfeus/mailer/config.rb
|
220
|
-
- lib/isomorfeus/mailer/imports.rb
|
221
220
|
- lib/isomorfeus/mailer/version.rb
|
222
221
|
- lib/lucid_mail.rb
|
223
222
|
homepage: https://isomorfeus.com
|
@@ -237,9 +236,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
236
|
version: '0'
|
238
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
238
|
requirements:
|
240
|
-
- - "
|
239
|
+
- - ">"
|
241
240
|
- !ruby/object:Gem::Version
|
242
|
-
version:
|
241
|
+
version: 1.3.1
|
243
242
|
requirements: []
|
244
243
|
rubygems_version: 3.3.7
|
245
244
|
signing_key:
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Isomorfeus
|
2
|
-
module Mailer
|
3
|
-
module Imports
|
4
|
-
def self.add
|
5
|
-
Isomorfeus.assets['mail.js'].add_js_import('redux', 'Redux', '*')
|
6
|
-
Isomorfeus.assets['mail.js'].add_js_import('preact', 'Preact', '*')
|
7
|
-
Isomorfeus.assets['mail.js'].add_js_import('preact/hooks', 'PreactHooks', '*')
|
8
|
-
Isomorfeus.assets['mail.js'].add_js_import('wouter-preact', nil, ['Router', 'Link', 'Redirect', 'Route', 'Switch'])
|
9
|
-
Isomorfeus.assets['mail.js'].add_js_import('preact-render-to-string', 'Preact', ['render'], nil, 'renderToString')
|
10
|
-
Isomorfeus.assets['mail.js'].add_js_import('wouter-preact/static-location', 'staticLocationHook')
|
11
|
-
Isomorfeus.assets['mail.js'].add_js_import('ws', 'WebSocket')
|
12
|
-
if Dir.exist?(Isomorfeus.app_root)
|
13
|
-
Isomorfeus.assets['mail.js'].add_ruby_import('mail_loader') if File.exist?(File.join(Isomorfeus.app_root, 'mail_loader.rb'))
|
14
|
-
Isomorfeus.assets['mail.js'].add_ruby_import('isomorfeus/preact/ssr/top_level')
|
15
|
-
Isomorfeus.assets['mail.js'].add_ruby_import('isomorfeus/preact/ssr/render_core')
|
16
|
-
Isomorfeus.assets['mail.js'].add_ruby_import('isomorfeus/preact/ssr/history')
|
17
|
-
Isomorfeus.assets['mail.js'].add_ruby_import('isomorfeus/transport/ssr_login')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|