zendesk_apps_support 4.17.0 → 4.20.0

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
- SHA256:
3
- metadata.gz: b9e6c1b0f73a414798ff651dfa81572508499a30a54c4edf6e5fd09b13391424
4
- data.tar.gz: a889c5ccf500f94aae9bc6ab1cd13a64dbe9cb9b0f916dbf048e5367381a5187
2
+ SHA1:
3
+ metadata.gz: 05fdb1c1548cd1f0788f3c4f4e4acae77159f191
4
+ data.tar.gz: d7d7384f09edcd3973c01e9a688120e0484974f9
5
5
  SHA512:
6
- metadata.gz: 22f0f135b839ee5bba993f1907f713bfd0585272bbd928e79fbae9c47d1e0e5f0bdae08b91f85f5ab84aad223f1c6ea844b71a176ba29d7bbaa303ef5bdf77be
7
- data.tar.gz: 0e94c79424df86521f7887b40829e87704b923d43d22f439127740c25f4f566a990583b132a70acd7a551998e07bfc1b23da47f24af4342006017f19f6e61b06
6
+ metadata.gz: d1bdb5b392048f13c25fd596d6e491322d516c8c063ef6da1a4bf4c9aaa685e3ff46e9ad5f872fa6f0973fa769676fe6dfa671eac918c8ce1a7d43405677a22d
7
+ data.tar.gz: 9cecde83aab2cd520ba65d21235577ce1f5dc67cf2bba7ee016fe35b2a3a20f4eafc509ee916967e5bd3a4fd3c6c4cbbce02a1fcd2bad635a1a4fcff512afbb3
@@ -1,4 +1,5 @@
1
- # This file is generated by rake i18n:standardize. Do NOT edit it directly.
1
+ # This is a generated file. Do NOT edit directly.
2
+ # To update, run 'bundle exec rake i18n:standardize'.
2
3
  ---
3
4
  en:
4
5
  txt:
@@ -54,8 +55,8 @@ en:
54
55
  one: 'requirements.json contains an invalid type: %{invalid_types}'
55
56
  other: 'requirements.json contains invalid types: %{invalid_types}'
56
57
  unsupported_mime_type_detected:
57
- one: 'Unsupported MIME type detected in %{file_names}'
58
- other: 'Unsupported MIME types detected in %{file_names}'
58
+ one: Unsupported MIME type detected in %{file_names}.
59
+ other: Unsupported MIME types detected in %{file_names}.
59
60
  multiple_channel_integrations: Specifying multiple channel integrations
60
61
  in requirements.json is not supported.
61
62
  invalid_cr_schema_keys:
@@ -74,6 +75,8 @@ en:
74
75
  style_in_template: "<style> tag in %{template}. Use an app.css file instead."
75
76
  no_code_for_ifo_notemplate: Javascripts, stylesheets, and templates are
76
77
  not allowed when an iframe URI or noTemplate is specified
78
+ no_source_required_apps: Javascripts, stylesheets, and templates are not
79
+ required for marketingOnly or requirementsOnly apps
77
80
  invalid_default_locale: "%{default_locale} is not a valid default locale."
78
81
  missing_translation_file: 'Missing translation file for locale ''%{default_locale}''.
79
82
  Learn more: https://developer.zendesk.com/apps/docs/developer-guide/deploying#app-internationalization'
@@ -84,8 +87,6 @@ en:
84
87
  blank_location_uri: "%{location} location does not specify a URI."
85
88
  invalid_location_uri: "%{uri} is either an invalid location URI, refers
86
89
  to a missing asset, or does not use HTTPS."
87
- signed_setting_uri: The url (%{uri}) cannot use a setting because it is
88
- a signed url.
89
90
  name_as_parameter_name: Can't call a parameter 'name'
90
91
  invalid_hidden_parameter:
91
92
  one: "%{invalid_params} is set to hidden and cannot be required."
@@ -111,6 +112,8 @@ en:
111
112
  for %{product}: %{missing_key}'
112
113
  products_do_not_match_manifest_products: Products in manifest (%{manifest_products})
113
114
  do not match products in translations (%{translation_products})
115
+ insecure_token_parameter_in_manifest: 'Make sure to set secure to true
116
+ when using keys in Settings. Learn more: %{link}'
114
117
  stylesheet_error: 'Sass error: %{sass_error}'
115
118
  invalid_type_parameter:
116
119
  one: "%{invalid_types} is an invalid parameter type."
@@ -144,6 +147,6 @@ en:
144
147
  other: Possible secrets found in %{files}. Consider reviewing the contents
145
148
  of these files before submitting your app.
146
149
  insecure_http_request: Possible insecure HTTP request to %{uri} in %{file}.
147
- Consider instead using the HTTPS protocol.
150
+ Consider using the HTTPS protocol instead.
148
151
  application_secret: Possible %{secret_type} found in %{file}. Consider
149
152
  reviewing the contents of this file before submitting your app.
@@ -15,10 +15,12 @@ parts:
15
15
  key: "txt.apps.admin.error.app_build.jshint.one"
16
16
  title: "App builder job: JSHint error message"
17
17
  value: "JSHint error in %{file}: %{errors}"
18
+ obsolete: "2019-11-01"
18
19
  - translation:
19
20
  key: "txt.apps.admin.error.app_build.jshint.other"
20
21
  title: "App builder job: JSHint error messages"
21
22
  value: "JSHint errors in %{file}: %{errors}"
23
+ obsolete: "2019-11-01"
22
24
  - translation:
23
25
  key: "txt.apps.admin.error.app_build.no_template_deprecated_in_v2"
24
26
  title: "App builder job: prevent using noTemplate in v2 apps and give advice on how to migrate. Leave noTemplate and autoHide as is (do not localize)"
@@ -167,6 +169,7 @@ parts:
167
169
  key: "txt.apps.admin.error.app_build.missing_source"
168
170
  title: "App builder job: missing app.js error"
169
171
  value: "Could not find app.js"
172
+ obsolete: "2019-11-01"
170
173
  - translation:
171
174
  key: "txt.apps.admin.error.app_build.style_in_template"
172
175
  title: "App builder job: <style> tags in template error"
@@ -175,6 +178,12 @@ parts:
175
178
  key: "txt.apps.admin.error.app_build.no_code_for_ifo_notemplate"
176
179
  title: "App builder job: code included for a type of app that shouldn't have code"
177
180
  value: "Javascripts, stylesheets, and templates are not allowed when an iframe URI or noTemplate is specified"
181
+ obsolete: "2019-11-01"
182
+ - translation:
183
+ key: "txt.apps.admin.error.app_build.no_source_required_apps"
184
+ title: "Inform users that no source files are required when uploading marketingOnly and requirementsOnly apps. Do not translate 'marketingOnly' and 'requirementsOnly', these are Manifest properties (https://developer.zendesk.com/apps/docs/developer-guide/manifest). Also refer to https://en.wikipedia.org/wiki/Style_sheet_(web_development) for stylesheets."
185
+ value: "Javascripts, stylesheets, and templates are not required for marketingOnly or requirementsOnly apps"
186
+ screenshot: "https://drive.google.com/open?id=12B7CMtErshVxI2b-Eo-DjexOqer27oxV"
178
187
  - translation:
179
188
  key: "txt.apps.admin.error.app_build.invalid_default_locale"
180
189
  title: "App builder job: invalid default locale"
@@ -203,12 +212,6 @@ parts:
203
212
  key: "txt.apps.admin.error.app_build.invalid_location_uri"
204
213
  title: "App builder job: invalid URI for an iframe in the manifest"
205
214
  value: "%{uri} is either an invalid location URI, refers to a missing asset, or does not use HTTPS."
206
- - translation:
207
- key: "txt.apps.admin.error.app_build.signed_setting_uri"
208
- title: "App builder job: invalid URI for an iframe in the manifest. The `manifest` is a setting file, the `signed url` is https://cloud.google.com/storage/docs/access-control/signed-urls"
209
- value: "The url (%{uri}) cannot use a setting because it is a signed url."
210
- screenshot: "https://drive.google.com/open?id=1oQmBeGfNT5EDaEH3oEQoNjaCzBw5XAvL"
211
- obsolete: '2019-04-10'
212
215
  - translation:
213
216
  key: "txt.apps.admin.error.app_build.name_as_parameter_name"
214
217
  title: "App builder job: error message when developer names a parameter 'name'"
@@ -224,7 +227,8 @@ parts:
224
227
  - translation:
225
228
  key: "txt.apps.admin.warning.app_build.deprecated_version"
226
229
  title: "App builder job: deprecated version specified"
227
- value: 'You are targeting a deprecated version of the framework. Your app will work, but it might break when the new framework version is deployed.'
230
+ value: "You are targeting a deprecated version of the framework. Your app will work, but it might break when the new framework version is deployed."
231
+ obsolete: "2019-11-01"
228
232
  - translation:
229
233
  key: "txt.apps.admin.warning.app_build.sanitised_svg"
230
234
  title: "App builder job: warning that contents of svg have been sanitised and overwritten"
@@ -246,7 +250,7 @@ parts:
246
250
  - translation:
247
251
  key: "txt.apps.admin.warning.app_build.insecure_http_request"
248
252
  title: "App builder job: warning on detecting an insecure http request call in app source files"
249
- value: "Possible insecure HTTP request to %{uri} in %{file}. Consider instead using the HTTPS protocol."
253
+ value: "Possible insecure HTTP request to %{uri} in %{file}. Consider using the HTTPS protocol instead."
250
254
  screenshot: "https://drive.google.com/file/d/1V-lXrVoAXAZEtBoekq7XLyetomUZRqY-"
251
255
  - translation:
252
256
  key: "txt.apps.admin.error.app_build.blocked_request"
@@ -278,6 +282,7 @@ parts:
278
282
  key: "txt.apps.admin.error.app_build.old_version"
279
283
  title: "App builder job: old framework version"
280
284
  value: "Iframe Only apps must target framework versions 2.0 or greater."
285
+ obsolete: "2019-11-01"
281
286
  - translation:
282
287
  key: "txt.apps.admin.error.app_build.parameters_not_an_array"
283
288
  title: "App builder job: app parameters must be an array"
@@ -319,6 +324,11 @@ parts:
319
324
  key: "txt.apps.admin.error.app_build.translation.products_do_not_match_manifest_products"
320
325
  title: "App builder job: products specified in translation file don't match products in manifest"
321
326
  value: "Products in manifest (%{manifest_products}) do not match products in translations (%{translation_products})"
327
+ - translation:
328
+ key: "txt.apps.admin.error.app_build.translation.insecure_token_parameter_in_manifest"
329
+ title: "Validation message to indicate missing secure(true) field in manifest's token parameter. Do not translate 'secure' and 'true'. Secure(true) in manifest refers to https://developer.zendesk.com/apps/docs/developer-guide/using_sdk#using-secure-settings"
330
+ value: "Make sure to set secure to true when using keys in Settings. Learn more: %{link}"
331
+ screenshot: "https://drive.google.com/open?id=1ss3nNN2RG29R7StjCtiH8qjuwFBlRApJ"
322
332
  - translation:
323
333
  key: "txt.apps.admin.error.app_build.stylesheet_error"
324
334
  title: "App builder job: invalid stylesheet syntax"
@@ -26,9 +26,9 @@ module ZendeskAppsSupport
26
26
  autoload :Source, 'zendesk_apps_support/validations/source'
27
27
  autoload :Templates, 'zendesk_apps_support/validations/templates'
28
28
  autoload :Translations, 'zendesk_apps_support/validations/translations'
29
- autoload :JSHintValidationError, 'zendesk_apps_support/validations/validation_error'
30
29
  autoload :Stylesheets, 'zendesk_apps_support/validations/stylesheets'
31
30
  autoload :Requirements, 'zendesk_apps_support/validations/requirements'
31
+ autoload :Requests, 'zendesk_apps_support/validations/requests'
32
32
  autoload :Banner, 'zendesk_apps_support/validations/banner'
33
33
  autoload :Svg, 'zendesk_apps_support/validations/svg'
34
34
  end
@@ -49,7 +49,13 @@ module ZendeskAppsSupport
49
49
  Location.new(id: 13, name: 'system_top_bar',
50
50
  product_code: Product::STANDALONE_CHAT.code, v2_only: false),
51
51
  Location.new(id: 14, name: 'background',
52
- product_code: Product::CHAT.code)
52
+ product_code: Product::CHAT.code),
53
+ Location.new(id: 15, name: 'deal_card', product_code: Product::SELL.code, collapsible: true),
54
+ Location.new(id: 16, name: 'contact_card', product_code: Product::SELL.code, collapsible: true),
55
+ Location.new(id: 17, name: 'lead_card', product_code: Product::SELL.code, collapsible: true),
56
+ Location.new(id: 18, name: 'background', product_code: Product::SELL.code),
57
+ Location.new(id: 19, name: 'modal', product_code: Product::SELL.code),
58
+ Location.new(id: 20, name: 'dashboard', product_code: Product::SELL.code)
53
59
  ].freeze
54
60
  end
55
61
  end
@@ -37,6 +37,7 @@ module ZendeskAppsSupport
37
37
  errors << Validations::Source.call(self)
38
38
  errors << Validations::Translations.call(self, skip_marketplace_translations: skip_marketplace_translations)
39
39
  errors << Validations::Requirements.call(self)
40
+ errors << Validations::Requests.call(self)
40
41
 
41
42
  unless manifest.requirements_only? || manifest.marketing_only? || manifest.iframe_only?
42
43
  errors << Validations::Templates.call(self)
@@ -94,7 +95,11 @@ module ZendeskAppsSupport
94
95
  end
95
96
 
96
97
  def js_files
97
- @js_files ||= files.select { |f| f =~ %r{^(app|lib\/.*)\.js$} }
98
+ @js_files ||= files.select { |f| f =~ %r{^.*\.jsx?$} }
99
+ end
100
+
101
+ def html_files
102
+ @html_files ||= files.select { |f| f =~ %r{.*\.html?$} }
98
103
  end
99
104
 
100
105
  def lib_files
@@ -19,11 +19,13 @@ module ZendeskAppsSupport
19
19
  PRODUCTS_AVAILABLE = [
20
20
  Product.new(code: 1, name: 'support', legacy_name: 'zendesk'),
21
21
  Product.new(code: 2, name: 'chat', legacy_name: 'zopim'),
22
- Product.new(code: 3, name: 'standalone_chat', legacy_name: 'lotus_box')
22
+ Product.new(code: 3, name: 'standalone_chat', legacy_name: 'lotus_box'),
23
+ Product.new(code: 4, name: 'sell', legacy_name: 'sell')
23
24
  ].freeze
24
25
 
25
26
  SUPPORT = find_by!(name: 'support')
26
27
  CHAT = find_by!(name: 'chat')
27
28
  STANDALONE_CHAT = find_by!(name: 'standalone_chat')
29
+ SELL = find_by!(name: 'sell')
28
30
  end
29
31
  end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ipaddress_2'
4
+ require 'uri'
5
+
6
+ module ZendeskAppsSupport
7
+ module Validations
8
+ module Requests
9
+ class << self
10
+ IP_ADDRESS = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
11
+
12
+ def call(package)
13
+ errors = []
14
+ files = package.js_files + package.html_files
15
+
16
+ files.each do |file|
17
+ file_content = file.read
18
+
19
+ http_protocol_urls = find_address_containing_http(file_content)
20
+ if http_protocol_urls.any?
21
+ package.warnings << I18n.t(
22
+ 'txt.apps.admin.warning.app_build.insecure_http_request',
23
+ uri: http_protocol_urls.join(I18n.t('txt.apps.admin.error.app_build.listing_comma')),
24
+ file: file.relative_path
25
+ )
26
+ end
27
+
28
+ ip_addresses = file_content.scan(IP_ADDRESS)
29
+ if ip_addresses.any?
30
+ errors << blocked_ips_validation(file.relative_path, ip_addresses)
31
+ end
32
+ end
33
+
34
+ errors
35
+ end
36
+
37
+ private
38
+
39
+ def blocked_ips_validation(file_path, ip_addresses)
40
+ ip_addresses.each_with_object([]) do |ip_address, error_messages|
41
+ blocked_type = blocked_ip_type(ip_address)
42
+ next unless blocked_type
43
+
44
+ error_messages << I18n.t(
45
+ 'txt.apps.admin.error.app_build.blocked_request',
46
+ type: blocked_type,
47
+ uri: ip_address,
48
+ file: file_path
49
+ )
50
+ end
51
+ end
52
+
53
+ def blocked_ip_type(ip_address)
54
+ block_type =
55
+ case IPAddress.parse(ip_address)
56
+ when proc(&:private?) then 'private'
57
+ when proc(&:loopback?) then 'loopback'
58
+ when proc(&:link_local?) then 'link_local'
59
+ end
60
+
61
+ block_type && I18n.t("txt.apps.admin.error.app_build.blocked_request_#{block_type}")
62
+ end
63
+
64
+ def find_address_containing_http(file_content)
65
+ file_content.scan(URI.regexp(['http'])).map(&:compact).map(&:last)
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -1,68 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'jshintrb'
4
-
5
3
  module ZendeskAppsSupport
6
4
  module Validations
7
5
  module Source
8
- LINTER_OPTIONS = {
9
- # enforcing options:
10
- noarg: true,
11
- undef: true,
12
-
13
- # relaxing options:
14
- eqnull: true,
15
- laxcomma: true,
16
- sub: true,
17
-
18
- # predefined globals:
19
- predef: %w[_ console services helpers alert confirm self
20
- JSON Base64 require module exports moment],
21
-
22
- browser: true
23
- }.freeze
24
-
25
- class <<self
6
+ class << self
26
7
  def call(package)
27
- files = package.js_files
28
- app = files.find { |file| file.relative_path == 'app.js' }
29
-
30
- if package_needs_app_js?(package)
31
- return [ ValidationError.new(:missing_source) ] unless app
32
- else
33
- return (package_has_code?(package) ? [ ValidationError.new(:no_code_for_ifo_notemplate) ] : [])
8
+ if app_doesnt_require_source?(package.manifest) && contain_source_files?(package)
9
+ ValidationError.new(:no_code_for_ifo_notemplate)
34
10
  end
35
-
36
- jshint_errors(files).flatten!
37
11
  end
38
12
 
39
13
  private
40
14
 
41
- def package_has_code?(package)
42
- !(package.js_files.empty? && package.template_files.empty? && package.app_css.empty?)
43
- end
44
-
45
- def package_needs_app_js?(package)
46
- return false if package.manifest.marketing_only?
47
- return false if package.manifest.requirements_only?
48
- return false if package.manifest.iframe_only?
49
- true
50
- end
51
-
52
- def jshint_error(file)
53
- errors = linter.lint(file.read)
54
- [JSHintValidationError.new(file.relative_path, errors)] if errors.any?
55
- end
56
-
57
- def jshint_errors(files)
58
- files.each_with_object([]) do |file, errors|
59
- error = jshint_error(file)
60
- errors << error unless error.nil?
61
- end
15
+ def contain_source_files?(package)
16
+ package.js_files.any? || package.template_files.any? || !package.app_css.empty?
62
17
  end
63
18
 
64
- def linter
65
- Jshintrb::Lint.new(LINTER_OPTIONS)
19
+ def app_doesnt_require_source?(manifest)
20
+ manifest.requirements_only? || manifest.marketing_only?
66
21
  end
67
22
  end
68
23
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'jshintrb'
4
3
  require 'json'
5
4
 
6
5
  module ZendeskAppsSupport
@@ -73,32 +73,5 @@ module ZendeskAppsSupport
73
73
  end
74
74
  end
75
75
  end
76
-
77
- class JSHintValidationError < ValidationError
78
- attr_reader :filename, :jshint_errors
79
-
80
- def self.vivify(hash)
81
- new(hash['filename'], hash['jshint_errors'])
82
- end
83
-
84
- def initialize(filename, jshint_errors)
85
- errors = jshint_errors.compact.map { |err| "\n L#{err['line']}: #{err['reason']}" }.join('')
86
- @filename = filename
87
- @jshint_errors = jshint_errors
88
- super(:jshint, {
89
- file: filename,
90
- errors: errors,
91
- count: jshint_errors.length
92
- })
93
- end
94
-
95
- def as_json(*)
96
- {
97
- 'class' => self.class.to_s,
98
- 'filename' => filename,
99
- 'jshint_errors' => jshint_errors
100
- }
101
- end
102
- end
103
76
  end
104
77
  end
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.17.0
4
+ version: 4.20.0
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: 2019-06-26 00:00:00.000000000 Z
14
+ date: 2019-07-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -97,20 +97,6 @@ dependencies:
97
97
  - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
- - !ruby/object:Gem::Dependency
101
- name: jshintrb
102
- requirement: !ruby/object:Gem::Requirement
103
- requirements:
104
- - - "~>"
105
- - !ruby/object:Gem::Version
106
- version: 0.3.0
107
- type: :runtime
108
- prerelease: false
109
- version_requirements: !ruby/object:Gem::Requirement
110
- requirements:
111
- - - "~>"
112
- - !ruby/object:Gem::Version
113
- version: 0.3.0
114
100
  - !ruby/object:Gem::Dependency
115
101
  name: loofah
116
102
  requirement: !ruby/object:Gem::Requirement
@@ -167,6 +153,20 @@ dependencies:
167
153
  - - "~>"
168
154
  - !ruby/object:Gem::Version
169
155
  version: 0.3.3
156
+ - !ruby/object:Gem::Dependency
157
+ name: ipaddress_2
158
+ requirement: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - "~>"
161
+ - !ruby/object:Gem::Version
162
+ version: 0.13.0
163
+ type: :runtime
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - "~>"
168
+ - !ruby/object:Gem::Version
169
+ version: 0.13.0
170
170
  - !ruby/object:Gem::Dependency
171
171
  name: rspec
172
172
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +276,7 @@ files:
276
276
  - lib/zendesk_apps_support/validations/manifest.rb
277
277
  - lib/zendesk_apps_support/validations/marketplace.rb
278
278
  - lib/zendesk_apps_support/validations/mime.rb
279
+ - lib/zendesk_apps_support/validations/requests.rb
279
280
  - lib/zendesk_apps_support/validations/requirements.rb
280
281
  - lib/zendesk_apps_support/validations/secrets.rb
281
282
  - lib/zendesk_apps_support/validations/source.rb
@@ -304,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
305
  version: 1.3.6
305
306
  requirements: []
306
307
  rubyforge_project:
307
- rubygems_version: 2.7.6
308
+ rubygems_version: 2.6.8
308
309
  signing_key:
309
310
  specification_version: 4
310
311
  summary: Support to help you develop Zendesk Apps.