zendesk_apps_support 4.29.0 → 4.29.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/config/locales/en.yml +5 -1
- data/config/locales/translations/zendesk_apps_support.yml +4 -0
- data/lib/zendesk_apps_support/location.rb +2 -1
- data/lib/zendesk_apps_support/package.rb +18 -18
- data/lib/zendesk_apps_support/validations/manifest.rb +64 -35
- metadata +19 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a106bcae90806c793735bbc559eb47fec0daaf4b
|
4
|
+
data.tar.gz: 54de16ed4176064fdf01ed8b11efcdf1a91901be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a591b02c1fb89fcac0ef7817a51697a186cc68643820c8e3ba68dc9284638190f8f51e7631cc00938605e06ae7fc8d78c7c8919f11bc3018a5745085b881c1de
|
7
|
+
data.tar.gz: a4ddc50586ad3c6a523581b9fc23b736aa670b3ee15802d911fec5e0a3b5fc2aac1050bb0d37b9e0aea2398016561c7e0fc13c4daeb8c4b05a4a46e8a4082d01
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ This project uses Rspec, which can be run with `bundle exec rake`.
|
|
22
22
|
|
23
23
|
## Contribute
|
24
24
|
* Put up a PR into the master branch.
|
25
|
-
* CC and get two +1 from @zendesk/vegemite.
|
25
|
+
* CC and get two +1 from @zendesk/dingo, @zendesk/wattle, or @zendesk/vegemite.
|
26
26
|
|
27
27
|
## Bugs
|
28
28
|
Bugs can be reported as an issue here on github, or submitted to support@zendesk.com. By mentioning this project it will assigned to the right team.
|
data/config/locales/en.yml
CHANGED
@@ -62,7 +62,7 @@ en:
|
|
62
62
|
other: Unsupported MIME types detected in %{file_names}.
|
63
63
|
multiple_channel_integrations: Specifying multiple channel integrations
|
64
64
|
in requirements.json is not supported.
|
65
|
-
|
65
|
+
oauth_parameter_required: "Please upgrade to our new oauth format. Learn more: %{link}"
|
66
66
|
invalid_cr_schema_keys:
|
67
67
|
one: 'Custom resources schema contains an invalid key: %{invalid_keys}'
|
68
68
|
other: 'Custom resources schema contains invalid keys: %{invalid_keys}'
|
@@ -78,6 +78,8 @@ en:
|
|
78
78
|
missing:
|
79
79
|
one: 'Missing required oauth field in manifest: %{missing_keys}'
|
80
80
|
other: 'Missing required oauth fields in manifest: %{missing_keys}'
|
81
|
+
too_many_oauth_parameters: 'Too many parameters with type ''oauth'': one
|
82
|
+
permitted'
|
81
83
|
missing_source: Could not find app.js
|
82
84
|
style_in_template: "<style> tag in %{template}. Use an app.css file instead."
|
83
85
|
no_code_for_ifo_notemplate: Javascripts, stylesheets, and templates are
|
@@ -139,6 +141,8 @@ en:
|
|
139
141
|
invalid_v1_location:
|
140
142
|
one: "%{invalid_locations} is an invalid location in framework v1."
|
141
143
|
other: "%{invalid_locations} are invalid locations in framework v1."
|
144
|
+
oauth_parameter_cannot_be_secure: oauth parameter cannot be set to be
|
145
|
+
secure.
|
142
146
|
warning:
|
143
147
|
app_build:
|
144
148
|
deprecated_version: You are targeting a deprecated version of the framework.
|
@@ -399,3 +399,7 @@ parts:
|
|
399
399
|
key: "txt.apps.admin.error.app_build.invalid_v1_location.other"
|
400
400
|
title: "The locations listed are not available in framework v1."
|
401
401
|
value: "%{invalid_locations} are invalid locations in framework v1."
|
402
|
+
- translation:
|
403
|
+
key: "txt.apps.admin.error.app_build.oauth_parameter_cannot_be_secure"
|
404
|
+
title: "oauth parameter cannot be set to be secure."
|
405
|
+
value: "oauth parameter cannot be set to be secure."
|
@@ -64,7 +64,8 @@ module ZendeskAppsSupport
|
|
64
64
|
Location.new(id: 22, name: 'note_editor', product_code: Product::SELL.code, visible: true),
|
65
65
|
Location.new(id: 23, name: 'call_log_editor', product_code: Product::SELL.code, visible: true),
|
66
66
|
Location.new(id: 24, name: 'email_editor', product_code: Product::SELL.code, visible: true),
|
67
|
-
Location.new(id: 25, name: 'top_bar', product_code: Product::SELL.code, visible: true)
|
67
|
+
Location.new(id: 25, name: 'top_bar', product_code: Product::SELL.code, visible: true),
|
68
|
+
Location.new(id: 26, name: 'visit_editor', product_code: Product::SELL.code, visible: true)
|
68
69
|
].freeze
|
69
70
|
end
|
70
71
|
end
|
@@ -278,6 +278,24 @@ module ZendeskAppsSupport
|
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
281
|
+
def location_icons
|
282
|
+
Hash.new { |h, k| h[k] = {} }.tap do |location_icons|
|
283
|
+
manifest.location_options.each do |location_options|
|
284
|
+
# no location information in the manifest
|
285
|
+
next unless location_options.location
|
286
|
+
|
287
|
+
product = location_options.location.product
|
288
|
+
location_name = location_options.location.name
|
289
|
+
# the location on the product does not support icons
|
290
|
+
next unless LOCATIONS_WITH_ICONS_PER_PRODUCT.fetch(product, []).include?(location_name)
|
291
|
+
|
292
|
+
host = location_options.location.product.name
|
293
|
+
product_directory = manifest.products.count > 1 ? "#{host}/" : ''
|
294
|
+
location_icons[host][location_name] = build_location_icons_hash(location_name, product_directory)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
281
299
|
private
|
282
300
|
|
283
301
|
def generate_logo_hash(products)
|
@@ -321,24 +339,6 @@ module ZendeskAppsSupport
|
|
321
339
|
has_file?('assets/banner.png')
|
322
340
|
end
|
323
341
|
|
324
|
-
def location_icons
|
325
|
-
Hash.new { |h, k| h[k] = {} }.tap do |location_icons|
|
326
|
-
manifest.location_options.each do |location_options|
|
327
|
-
# no location information in the manifest
|
328
|
-
next unless location_options.location
|
329
|
-
|
330
|
-
product = location_options.location.product
|
331
|
-
location_name = location_options.location.name
|
332
|
-
# the location on the product does not support icons
|
333
|
-
next unless LOCATIONS_WITH_ICONS_PER_PRODUCT.fetch(product, []).include?(location_name)
|
334
|
-
|
335
|
-
host = location_options.location.product.name
|
336
|
-
product_directory = manifest.products.count > 1 ? "#{host}/" : ''
|
337
|
-
location_icons[host][location_name] = build_location_icons_hash(location_name, product_directory)
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|
341
|
-
|
342
342
|
def build_location_icons_hash(location, product_directory)
|
343
343
|
inactive_png = "icon_#{location}_inactive.png"
|
344
344
|
if has_file?("assets/#{product_directory}icon_#{location}.svg")
|
@@ -10,6 +10,7 @@ module ZendeskAppsSupport
|
|
10
10
|
REQUIRED_MANIFEST_FIELDS = RUBY_TO_JSON.select { |k| %i[author default_locale].include? k }.freeze
|
11
11
|
OAUTH_REQUIRED_FIELDS = %w[client_id client_secret authorize_uri access_token_uri].freeze
|
12
12
|
PARAMETER_TYPES = ZendeskAppsSupport::Manifest::Parameter::TYPES
|
13
|
+
OAUTH_MANIFEST_LINK = 'https://developer.zendesk.com/apps/docs/developer-guide/manifest#oauth'
|
13
14
|
|
14
15
|
class << self
|
15
16
|
def call(package)
|
@@ -33,51 +34,71 @@ module ZendeskAppsSupport
|
|
33
34
|
def collate_manifest_errors(package)
|
34
35
|
manifest = package.manifest
|
35
36
|
|
36
|
-
errors = [
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
errors = [
|
38
|
+
missing_keys_error(manifest),
|
39
|
+
type_checks(manifest),
|
40
|
+
oauth_error(manifest),
|
41
|
+
default_locale_error(manifest, package),
|
42
|
+
validate_parameters(manifest),
|
43
|
+
if manifest.requirements_only? || manifest.marketing_only?
|
44
|
+
[ ban_location(manifest),
|
45
|
+
ban_framework_version(manifest) ]
|
46
|
+
else
|
47
|
+
[ validate_location(package),
|
48
|
+
missing_framework_version(manifest),
|
49
|
+
invalid_version_error(manifest) ]
|
50
|
+
end,
|
51
|
+
ban_no_template(manifest)
|
52
|
+
]
|
53
|
+
errors.flatten.compact
|
54
|
+
end
|
41
55
|
|
56
|
+
def validate_location(package)
|
57
|
+
manifest = package.manifest
|
58
|
+
[
|
59
|
+
missing_location_error(package),
|
60
|
+
invalid_location_error(package),
|
61
|
+
invalid_v1_location(package),
|
62
|
+
location_framework_mismatch(manifest)
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def validate_parameters(manifest)
|
42
67
|
if manifest.marketing_only?
|
43
|
-
|
68
|
+
marketing_only_errors(manifest)
|
44
69
|
else
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
70
|
+
[
|
71
|
+
parameters_error(manifest),
|
72
|
+
invalid_hidden_parameter_error(manifest),
|
73
|
+
invalid_type_error(manifest),
|
74
|
+
too_many_oauth_parameters(manifest),
|
75
|
+
oauth_cannot_be_secure(manifest),
|
76
|
+
name_as_parameter_name_error(manifest)
|
77
|
+
]
|
50
78
|
end
|
79
|
+
end
|
51
80
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
errors << invalid_location_error(package)
|
58
|
-
errors << invalid_v1_location(package)
|
59
|
-
errors << missing_framework_version(manifest)
|
60
|
-
errors << location_framework_mismatch(manifest)
|
61
|
-
errors << invalid_version_error(manifest)
|
81
|
+
def oauth_cannot_be_secure(manifest)
|
82
|
+
manifest.parameters.map do |parameter|
|
83
|
+
if parameter.type == 'oauth' && parameter.secure
|
84
|
+
return ValidationError.new('oauth_parameter_cannot_be_secure')
|
85
|
+
end
|
62
86
|
end
|
63
|
-
|
64
|
-
errors << ban_no_template(manifest) if manifest.iframe_only?
|
65
|
-
|
66
|
-
errors.flatten.compact
|
67
87
|
end
|
68
88
|
|
69
89
|
def marketing_only_errors(manifest)
|
70
|
-
[
|
71
|
-
|
72
|
-
|
73
|
-
|
90
|
+
[
|
91
|
+
ban_parameters(manifest),
|
92
|
+
private_marketing_app_error(manifest)
|
93
|
+
]
|
74
94
|
end
|
75
95
|
|
76
96
|
def type_checks(manifest)
|
77
|
-
errors = [
|
78
|
-
|
79
|
-
|
80
|
-
|
97
|
+
errors = [
|
98
|
+
boolean_error(manifest),
|
99
|
+
string_error(manifest),
|
100
|
+
no_template_format_error(manifest)
|
101
|
+
]
|
81
102
|
unless manifest.experiments.is_a?(Hash)
|
82
103
|
errors << ValidationError.new(
|
83
104
|
:unacceptable_hash,
|
@@ -152,6 +173,7 @@ module ZendeskAppsSupport
|
|
152
173
|
end
|
153
174
|
|
154
175
|
def ban_no_template(manifest)
|
176
|
+
return unless manifest.iframe_only?
|
155
177
|
no_template_migration_link = 'https://developer.zendesk.com/apps/docs/apps-v2/manifest#location'
|
156
178
|
if manifest.no_template? || !manifest.no_template_locations.empty?
|
157
179
|
ValidationError.new(:no_template_deprecated_in_v2, link: no_template_migration_link)
|
@@ -176,14 +198,21 @@ module ZendeskAppsSupport
|
|
176
198
|
|
177
199
|
def oauth_error(manifest)
|
178
200
|
return unless manifest.oauth
|
179
|
-
|
201
|
+
oauth_errors = []
|
180
202
|
missing = OAUTH_REQUIRED_FIELDS.select do |key|
|
181
203
|
manifest.oauth[key].nil? || manifest.oauth[key].empty?
|
182
204
|
end
|
183
205
|
|
184
206
|
if missing.any?
|
185
|
-
|
207
|
+
oauth_errors << \
|
208
|
+
ValidationError.new('oauth_keys.missing', missing_keys: missing.join(', '), count: missing.length)
|
209
|
+
end
|
210
|
+
|
211
|
+
unless manifest.parameters.any? { |param| param.type == 'oauth' }
|
212
|
+
oauth_errors << ValidationError.new('oauth_parameter_required',
|
213
|
+
link: OAUTH_MANIFEST_LINK)
|
186
214
|
end
|
215
|
+
oauth_errors
|
187
216
|
end
|
188
217
|
|
189
218
|
def parameters_error(manifest)
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_apps_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.29.
|
4
|
+
version: 4.29.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James A. Rosen
|
8
8
|
- Likun Liu
|
9
9
|
- Sean Caffery
|
10
10
|
- Daniel Ribeiro
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|
@@ -73,16 +73,16 @@ dependencies:
|
|
73
73
|
name: image_size
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- - "
|
76
|
+
- - "~>"
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
78
|
+
version: 2.0.2
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- - "
|
83
|
+
- - "~>"
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: 2.0.2
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: erubis
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,16 +115,22 @@ dependencies:
|
|
115
115
|
name: nokogiri
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
|
-
- - "
|
118
|
+
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: 1.8.5
|
121
|
+
- - "<"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 1.11.0
|
121
124
|
type: :runtime
|
122
125
|
prerelease: false
|
123
126
|
version_requirements: !ruby/object:Gem::Requirement
|
124
127
|
requirements:
|
125
|
-
- - "
|
128
|
+
- - ">="
|
126
129
|
- !ruby/object:Gem::Version
|
127
130
|
version: 1.8.5
|
131
|
+
- - "<"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.11.0
|
128
134
|
- !ruby/object:Gem::Dependency
|
129
135
|
name: rb-inotify
|
130
136
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,7 +310,7 @@ homepage: http://github.com/zendesk/zendesk_apps_support
|
|
304
310
|
licenses:
|
305
311
|
- Apache License Version 2.0
|
306
312
|
metadata: {}
|
307
|
-
post_install_message:
|
313
|
+
post_install_message:
|
308
314
|
rdoc_options: []
|
309
315
|
require_paths:
|
310
316
|
- lib
|
@@ -319,8 +325,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
319
325
|
- !ruby/object:Gem::Version
|
320
326
|
version: 1.3.6
|
321
327
|
requirements: []
|
322
|
-
|
323
|
-
|
328
|
+
rubyforge_project:
|
329
|
+
rubygems_version: 2.6.8
|
330
|
+
signing_key:
|
324
331
|
specification_version: 4
|
325
332
|
summary: Support to help you develop Zendesk Apps.
|
326
333
|
test_files: []
|