envoy-hooks 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 823a05c8d454becc1b2cb7921832436a790c3d99b0a7b370ab98fe4335ead22a
4
- data.tar.gz: 16eb2a0e6f82a4915c66ca5a0f59c9335bb004738f78510bfeaa923e13f8618e
3
+ metadata.gz: 22909d2d61ea631aa5c416510ccb95440a7265f5c793bf0794221c2f2dd50b18
4
+ data.tar.gz: 3706f19b970c11c6d67a679edf2464e804af878f1209746e59e12b78a5930c81
5
5
  SHA512:
6
- metadata.gz: b83df03d0fbc601589785e4a96972ec0aa4cc48ea7a41d724494b35dbb408112f3b6b1eda0bc9ebb5cd00b1046c2fb11aade9978685a59ae8a16c148f5afc750
7
- data.tar.gz: 4bfa3ce0f3616690a4ed80efae2f2fc1809bc47accb9518c574202808c648d3089a447b285ec5e136ab828992fde42ae416187c514053a588cc64adaad7ed5bf
6
+ metadata.gz: 1c665b82b32b50af42d6363aacff26326ed4ae47cde23a044ef5a0dee3f17152153b928a7641d3a0ed564f1a95f8f2e0674bd5fb42a60b6835bbcab4d4e60118
7
+ data.tar.gz: '09ad5daf753fd75807c3cfad4ccf21bd3624cd5e00f66e3a11e34b0f1e3e8c07995a2312184a0f3761d2e690d25094b655b4ada9e8f6154cbe4da6c4ecec791b'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- envoy-hooks (0.9.2)
4
+ envoy-hooks (0.9.3)
5
5
  faraday (~> 0.15.4)
6
6
  faraday-net_http (~> 1.0)
7
7
  faraday_middleware (~> 0.12.2)
data/README.md CHANGED
@@ -10,6 +10,7 @@ It has the following three API methods regarding UI Hooks and their subscription
10
10
 
11
11
  * `upsertSubscription`
12
12
  * `triggerUIHooks`
13
+ * `triggerZoneUIHooks`
13
14
  * `subscribedUIHooks`
14
15
 
15
16
  These are the methods listed in [the Jira ticket](https://envoycom.atlassian.net/jira/software/c/projects/DEVP/boards/131?modal=detail&selectedIssue=DEVP-829) describing what's required for the email customization screen and the dynamic email sender.
@@ -171,6 +172,32 @@ hooksService.triggerUIHooks(
171
172
  )
172
173
  ```
173
174
 
175
+ The return value will be an array of objects. Each object will contain a lot of information, but the most important part is `response` - that will contain the HTML or JSON from the UI Hooks, which will then be used to create the UI.
176
+ ### **`triggerZoneUIHooks`**
177
+
178
+ This is how we fetch custom UI at a Connect zone. The name "trigger Zone UI Hooks" comes from the fact that we are getting the custom UI from potentially multiple UI Hooks, and we "trigger" them in order to fetch the data.
179
+
180
+ This will act to fetch the custom UI, which we will receive in the response.
181
+
182
+ ```rb
183
+ hooksService.triggerZoneUIHooks(
184
+ # REQUIRED
185
+ zoneIds: [3],
186
+ triggerName: "welcome_email", # The UI Hook name to invoke (deprecated)
187
+ triggerNames: ["welcome_email"], # The list of UI Hook extension names to invoke (triggerName or triggerNames required)
188
+ responseType: "JSON", # only other option is HTML. Determines whether you get Component JSON or prerendered HTML.
189
+
190
+ # XOR REQUIRED
191
+ resourceId: 341153, # the ID of the invite we are working with
192
+ resourceIds: [341153, 341153] # array of IDs of the invites we are working with
193
+
194
+ # OPTIONAL
195
+ previewMode: false, # Whether or not to run in preview mode. Preview mode makes it so you do not need to send in a resourceId
196
+ accentColor: "#123DEF", # Override the default Envoy accent color on applicable UI components. Currently only in emails, but that could change.
197
+ uiHookIds: [2954, 8271], # The specific UI hooks to invoke. If you don't include it, _all_ UI Hook subscriptions that match the locationId and triggerName will trigger.
198
+ )
199
+ ```
200
+
174
201
  The return value will be an array of objects. Each object will contain a lot of information, but the most important part is `response` - that will contain the HTML or JSON from the UI Hooks, which will then be used to create the UI.
175
202
  ## Client Config
176
203
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Envoy
4
4
  class Hooks
5
- VERSION = '0.9.2'
5
+ VERSION = '0.9.3'
6
6
  end
7
7
  end
data/lib/envoy/hooks.rb CHANGED
@@ -72,18 +72,19 @@ module Envoy
72
72
  })
73
73
  end
74
74
 
75
- def triggerZoneUIHooks(responseType:, zoneIds: [], triggerNames: [], resourceId: nil,
75
+ def triggerZoneUIHooks(responseType:, zoneIds:, triggerNames: [], resourceId: nil, resourceIds: [],
76
76
  resourceType: nil, accentColor: nil, previewMode: false, uiHookIds: [])
77
77
 
78
78
  validateEnum('responseType', responseType, %w[HTML JSON])
79
79
 
80
80
  validateEnum('resourceType', resourceType, %w[INVITE ENTRY]) unless resourceType.nil?
81
81
 
82
+ resource_ids = Array(resourceId || resourceIds)
82
83
  faraday.post('/rest/v1/zones/hooks/ui/trigger', {
83
84
  zoneIds: zoneIds,
84
85
  triggerNames: triggerNames,
85
86
  responseType: responseType,
86
- resourceId: resourceId,
87
+ resourceIds: resource_ids,
87
88
  resourceType: resourceType,
88
89
  accentColor: accentColor,
89
90
  previewMode: previewMode,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envoy-hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey-Biles-Envoy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-03-07 00:00:00.000000000 Z
12
+ date: 2023-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday