zendesk_apps_support 4.29.1 → 4.29.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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/sass_functions.rb +2 -2
- data/lib/zendesk_apps_support/validations/manifest.rb +64 -35
- metadata +18 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e89ddab1603d8b47a42131aa838533db345d7b25
|
4
|
+
data.tar.gz: 581fed15b75d31626cfbd0dcbd6fa954a9fb22e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9408e37d495fec69e354bb0859ca60b2ec1f06c94094815f8f37b5c0fa1302d0b51cd7aa4cd410ba4b643b2decba2c3e56762f33c161b34fc8317447a93f707
|
7
|
+
data.tar.gz: f015c41838160e6ecb4de15e8ab46961948b9dd776bbcab4ba33d794794f26682830f6de69f626979326449a4bf80969a66330cf46a2e5473945104c6a6b3125
|
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
|
@@ -26,9 +26,9 @@ require 'sassc'
|
|
26
26
|
module SassC::Script::Functions
|
27
27
|
module AppAssetUrl
|
28
28
|
def app_asset_url(name)
|
29
|
-
raise ArgumentError, "Expected #{name} to be a string" unless name.is_a?
|
29
|
+
raise ArgumentError, "Expected #{name} to be a string" unless name.is_a? SassC::Script::Value::String
|
30
30
|
result = %{url("#{app_asset_url_helper(name)}")}
|
31
|
-
SassC::Script::String.new(result)
|
31
|
+
SassC::Script::Value::String.new(result)
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
@@ -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,7 +1,7 @@
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James A. Rosen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-12-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|
@@ -31,16 +31,16 @@ dependencies:
|
|
31
31
|
name: sassc
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- - "
|
34
|
+
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: '0'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: '0'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: sass
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|