zendesk_apps_support 3.3.2 → 3.3.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
  SHA1:
3
- metadata.gz: c18dad0a88a0050882a95ef6dab859c2a986771e
4
- data.tar.gz: 581026a5b94705833c2aa8730768cbf1f0d41fb6
3
+ metadata.gz: 8760acb02112cebac8b8daca8460f1faedad4e64
4
+ data.tar.gz: 17b865646f23c21bcdc07a91e9b045107952e3ae
5
5
  SHA512:
6
- metadata.gz: 55bcb995135adb86d47c323b1240930e8f6635be741fbc5a3953f88cdf3e18e655181c291134978f162c3c6218728fa933ab78e63fd9e73c642cd527e14d82d5
7
- data.tar.gz: 2043571958b3add67fdbd1047ab18093a05cef6cb94642c2751fed978c21d9d604ecf2a3f0909c53114c87408dac4dc7396a59a1731fda45221aaa2bb05b78c7
6
+ metadata.gz: 63f2b79999d8f52ffb0653a3d59788dbb286c34ab8d7c346a03123997deb602459be6e99e5b7df86f82723775bdbde6cfaec33beffdc469a2f6fcdd4dc694a83
7
+ data.tar.gz: 884dca14e438507f1034090774b9c51d5bce8b9079769095db5302cbb4f340868757e57e0e525a9e8bb53d85dbbc81fd63cb74f3127fd5fd9df0f06cc4899741
@@ -17,8 +17,8 @@ parts:
17
17
  value: "JSHint errors in %{file}: %{errors}"
18
18
  - translation:
19
19
  key: "txt.apps.admin.error.app_build.no_template_deprecated_in_v2"
20
- title: "App builder job: prevent using noTemplate in v2 apps and give advice on how to migrate"
21
- value: "noTemplate is deprecated and cannot be used with frameworkVersion 2 or above. Set the autoLoad or autoHide property for each specific location instead. Learn more: %{link}."
20
+ 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)"
21
+ value: "noTemplate is deprecated and cannot be used with framework version 2 or above. Set the autoLoad or autoHide property for each specific location instead. Learn more: %{link}."
22
22
  - translation:
23
23
  key: "txt.apps.admin.error.app_build.no_parameters_required"
24
24
  title: "App builder job: prevent adding parameters while marketing only"
@@ -3,6 +3,7 @@ require 'erubis'
3
3
 
4
4
  module ZendeskAppsSupport
5
5
  class Installed
6
+ extend Gem::Deprecate
6
7
  INSTALLED_TEMPLATE = Erubis::Eruby.new(File.read(File.expand_path('../assets/installed.js.erb', __FILE__)))
7
8
 
8
9
  def initialize(appsjs, installations = [])
@@ -10,7 +11,7 @@ module ZendeskAppsSupport
10
11
  @installations = installations
11
12
  end
12
13
 
13
- def compile_js(options = {})
14
+ def compile(options = {})
14
15
  installation_order = options.fetch(:installation_orders, {})
15
16
 
16
17
  INSTALLED_TEMPLATE.result(
@@ -19,5 +20,8 @@ module ZendeskAppsSupport
19
20
  installation_orders: installation_order
20
21
  )
21
22
  end
23
+
24
+ alias compile_js compile
25
+ deprecate :compile_js, :compile, 2017, 1
22
26
  end
23
27
  end
@@ -99,7 +99,8 @@ module ZendeskAppsSupport
99
99
  files.select { |f| f =~ %r{^translations/} }
100
100
  end
101
101
 
102
- def compile_js(options)
102
+ # this is not really compile_js, it compiles the whole app including scss for v1 apps
103
+ def compile(options)
103
104
  begin
104
105
  app_id = options.fetch(:app_id)
105
106
  asset_url_prefix = options.fetch(:assets_dir)
@@ -132,6 +133,9 @@ module ZendeskAppsSupport
132
133
  )
133
134
  end
134
135
 
136
+ alias compile_js compile
137
+ deprecate :compile_js, :compile, 2017, 1
138
+
135
139
  def manifest_json
136
140
  @manifest_json ||= read_json(MANIFEST_FILENAME)
137
141
  end
@@ -158,7 +162,7 @@ module ZendeskAppsSupport
158
162
 
159
163
  def compiled_templates(app_id, asset_url_prefix)
160
164
  compiler = ZendeskAppsSupport::StylesheetCompiler.new(DEFAULT_SCSS + app_css, app_id, asset_url_prefix)
161
- compiled_css = compiler.compile
165
+ compiled_css = compiler.compile(sassc: manifest.enabled_experiments.include?('newCssCompiler'))
162
166
 
163
167
  layout = templates['layout'] || DEFAULT_LAYOUT.result
164
168
 
@@ -19,3 +19,24 @@ module Sass::Script::Functions
19
19
 
20
20
  include AppAssetUrl
21
21
  end
22
+
23
+ require 'sassc'
24
+
25
+ module SassC::Script::Functions
26
+ module AppAssetUrl
27
+ def app_asset_url(name)
28
+ raise ArgumentError, "Expected #{name} to be a string" unless name.is_a? Sass::Script::Value::String
29
+ result = %{url("#{app_asset_url_helper(name)}")}
30
+ SassC::Script::String.new(result)
31
+ end
32
+
33
+ private
34
+
35
+ def app_asset_url_helper(name)
36
+ url_builder = options[:app_asset_url_builder]
37
+ url_builder.app_asset_url(name.value)
38
+ end
39
+ end
40
+
41
+ include AppAssetUrl
42
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'sass'
3
+ require 'sassc'
3
4
  require 'zendesk_apps_support/sass_functions'
4
5
 
5
6
  module ZendeskAppsSupport
@@ -10,8 +11,17 @@ module ZendeskAppsSupport
10
11
  @url_prefix = url_prefix
11
12
  end
12
13
 
13
- def compile
14
- Sass::Engine.new(wrapped_source, syntax: :scss, app_asset_url_builder: self).render
14
+ def compile(sassc: false)
15
+ options = {
16
+ syntax: :scss, app_asset_url_builder: self
17
+ }
18
+ if sassc
19
+ compiler_class = SassC
20
+ options[:style] = :compressed
21
+ else
22
+ compiler_class = Sass
23
+ end
24
+ compiler_class::Engine.new(wrapped_source.dup, options).render
15
25
  end
16
26
 
17
27
  def app_asset_url(name)
@@ -2,7 +2,7 @@
2
2
  module ZendeskAppsSupport
3
3
  module Validations
4
4
  module Marketplace
5
- WHITELISTED_EXPERIMENTS = ['hashParams'].freeze
5
+ WHITELISTED_EXPERIMENTS = %w(hashParams newCssCompiler).freeze
6
6
 
7
7
  class << self
8
8
  def call(package)
@@ -15,9 +15,8 @@ module ZendeskAppsSupport
15
15
  sub: true,
16
16
 
17
17
  # predefined globals:
18
- predef: %w(_ console services helpers alert confirm window document self
19
- JSON Base64 clearInterval clearTimeout setInterval setTimeout
20
- require module exports top frames parent moment),
18
+ predef: %w(_ console services helpers alert confirm self
19
+ JSON Base64 require module exports moment),
21
20
 
22
21
  browser: true
23
22
  }.freeze
@@ -16,7 +16,7 @@ module ZendeskAppsSupport
16
16
  compiler = ZendeskAppsSupport::StylesheetCompiler.new(css, nil, nil)
17
17
  begin
18
18
  compiler.compile
19
- rescue Sass::SyntaxError => e
19
+ rescue SassC::SyntaxError, Sass::SyntaxError => e
20
20
  return ValidationError.new(:stylesheet_error, sass_error: e.message)
21
21
  end
22
22
  nil
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: 3.3.2
4
+ version: 3.3.3
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: 2016-12-16 00:00:00.000000000 Z
14
+ date: 2016-12-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -27,6 +27,20 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: sassc
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: 1.11.0
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: 1.11.0
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: sass
32
46
  requirement: !ruby/object:Gem::Requirement