shopify_app 14.4.2 → 16.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +5 -0
  3. data/.github/workflows/build.yml +38 -0
  4. data/.github/workflows/rubocop.yml +1 -7
  5. data/.gitignore +0 -2
  6. data/.rubocop.yml +1 -0
  7. data/CHANGELOG.md +20 -0
  8. data/Gemfile.lock +252 -0
  9. data/README.md +4 -4
  10. data/app/assets/images/storage_access.svg +1 -2
  11. data/app/controllers/shopify_app/callback_controller.rb +48 -21
  12. data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
  13. data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
  14. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
  15. data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
  16. data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
  17. data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
  18. data/app/views/shopify_app/sessions/enable_cookies.html.erb +1 -1
  19. data/app/views/shopify_app/sessions/new.html.erb +38 -110
  20. data/app/views/shopify_app/sessions/request_storage_access.html.erb +1 -1
  21. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +20 -15
  22. data/docs/Releasing.md +5 -4
  23. data/lib/generators/shopify_app/controllers/controllers_generator.rb +1 -1
  24. data/lib/generators/shopify_app/install/install_generator.rb +1 -1
  25. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +2 -2
  26. data/lib/generators/shopify_app/views/views_generator.rb +1 -1
  27. data/lib/shopify_app/controller_concerns/login_protection.rb +1 -1
  28. data/lib/shopify_app/engine.rb +21 -0
  29. data/lib/shopify_app/session/jwt.rb +3 -1
  30. data/lib/shopify_app/version.rb +1 -1
  31. data/package.json +1 -1
  32. metadata +5 -3
  33. data/.travis.yml +0 -27
@@ -49,7 +49,7 @@
49
49
  </div>
50
50
  </div>
51
51
  <div class="Polaris-Stack__Item">
52
- <div class="Polaris-Stack Polaris-Stack--distributionTrailing">
52
+ <div class="Polaris-Stack Polaris-Stack--distributionTrailing Polaris-Stack--distributionTrailingCustomSpacing">
53
53
  <div class="Polaris-Stack__Item">
54
54
  <button type="button" class="Polaris-Button Polaris-Button--primary" id="TriggerAllowCookiesPrompt">
55
55
  <span class="Polaris-Button__Content"><span><%= I18n.t('request_storage_access_action') %></span></span>
@@ -5,6 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <base target="_top">
7
7
  <title>Redirecting…</title>
8
+ <%= render 'shopify_app/partials/card_styles' %>
8
9
  <%= render 'shopify_app/partials/layout_styles' %>
9
10
  <%= render 'shopify_app/partials/typography_styles' %>
10
11
  <%= render 'shopify_app/partials/button_styles' %>
@@ -25,26 +26,30 @@
25
26
  <div class="Polaris-Layout__Section">
26
27
  <div class="Polaris-Stack Polaris-Stack--vertical">
27
28
  <div class="Polaris-Stack__Item">
28
- <div class="Polaris-EmptyState">
29
- <div class="Polaris-EmptyState__Section">
30
- <div class="Polaris-EmptyState__DetailsContainer">
31
- <div class="Polaris-EmptyState__Details">
32
- <div class="Polaris-TextContainer">
33
- <h1 class="Polaris-DisplayText Polaris-DisplayText--sizeMedium"><%= I18n.t('top_level_interaction_heading', app: ShopifyApp.configuration.application_name) %></h1>
34
- <div class="Polaris-EmptyState__Content">
35
- <p><%= I18n.t('top_level_interaction_body', app: ShopifyApp.configuration.application_name) %></p>
29
+ <div class="Polaris-Card">
30
+ <div class="Polaris-Card__Section">
31
+ <div class="Polaris-EmptyState">
32
+ <div class="Polaris-EmptyState__Section">
33
+ <div class="Polaris-EmptyState__DetailsContainer">
34
+ <div class="Polaris-EmptyState__Details">
35
+ <div class="Polaris-TextContainer">
36
+ <h1 class="Polaris-DisplayText Polaris-DisplayText--sizeSmall"><%= I18n.t('top_level_interaction_heading', app: ShopifyApp.configuration.application_name) %></h1>
37
+ <div class="Polaris-EmptyState__Content">
38
+ <p><%= I18n.t('top_level_interaction_body', app: ShopifyApp.configuration.application_name) %></p>
39
+ </div>
40
+ </div>
41
+ <div class="Polaris-EmptyState__Actions">
42
+ <div class="Polaris-Stack Polaris-Stack--alignmentCenter">
43
+ <div class="Polaris-Stack__Item"><button type="button" id="TopLevelInteractionButton" class="Polaris-Button Polaris-Button--primary Polaris-Button--sizeLarge"><span class="Polaris-Button__Content"><span class="Polaris-Button__Icon"></span><span><%= I18n.t('top_level_interaction_action') %></span></span></button></div>
44
+ </div>
45
+ </div>
36
46
  </div>
37
47
  </div>
38
- <div class="Polaris-EmptyState__Actions">
39
- <div class="Polaris-Stack Polaris-Stack--alignmentCenter">
40
- <div class="Polaris-Stack__Item"><button type="button" id="TopLevelInteractionButton" class="Polaris-Button Polaris-Button--primary Polaris-Button--sizeLarge"><span class="Polaris-Button__Content"><span class="Polaris-Button__Icon"></span><span><%= I18n.t('top_level_interaction_action') %></span></span></button></div>
41
- </div>
48
+ <div class="Polaris-EmptyState__ImageContainer">
49
+ <%= image_tag 'storage_access.svg', role: "presentation", alt: "", class: "Polaris-EmptyState__Image" %>
42
50
  </div>
43
51
  </div>
44
52
  </div>
45
- <div class="Polaris-EmptyState__ImageContainer">
46
- <%= image_tag 'storage_access.svg', role: "presentation", alt: "", class: "Polaris-EmptyState__Image" %>
47
- </div>
48
53
  </div>
49
54
  </div>
50
55
  </div>
@@ -1,6 +1,7 @@
1
- Releasing ShopifyApp
1
+ # Releasing ShopifyApp
2
2
 
3
- 1. Check the Semantic Versioning page for info on how to version the new release: http://semver.org
3
+ 1. Make the code changes in a separate PR that doesn't modify the version.
4
+ 1. After that is merged, check the Semantic Versioning page for info on how to version the new release: http://semver.org
4
5
  1. Create a pull request with the following changes:
5
6
  - Update the version of ShopifyApp in lib/shopify_app/version.rb
6
7
  - Update the version of shopify_app in package.json
@@ -8,11 +9,11 @@ Releasing ShopifyApp
8
9
  - Change the title of the PR to something like: "Packaging for release X.Y.Z"
9
10
  1. Merge your pull request
10
11
  1. Checkout and pull from master so you have the latest version of the shopify_app
11
- 1. Tag the HEAD with the version
12
+ 1. Tag the HEAD with the version
12
13
  ```bash
13
14
  $ git tag -f vX.Y.Z && git push --tags --force
14
15
  ```
15
16
  1. Use Shipit to build and push the gem
16
17
 
17
- If you see an error like 'You need to create the vX.Y.X tag first', clear GIT
18
+ If you see an error like 'You need to create the vX.Y.X tag first', clear git
18
19
  cache in Shipit settings
@@ -8,7 +8,7 @@ module ShopifyApp
8
8
 
9
9
  def create_controllers
10
10
  controllers.each do |controller|
11
- copy_file controller
11
+ copy_file(controller)
12
12
  end
13
13
  end
14
14
 
@@ -64,7 +64,7 @@ module ShopifyApp
64
64
  def insert_hosts_into_development_config
65
65
  inject_into_file(
66
66
  'config/environments/development.rb',
67
- " config.hosts = (config.hosts rescue []) << /\\h+.ngrok.io/\n",
67
+ " config.hosts = (config.hosts rescue []) << /\\w+\\.ngrok\\.io/\n",
68
68
  after: "Rails.application.configure do\n"
69
69
  )
70
70
  end
@@ -1,7 +1,7 @@
1
1
  ShopifyApp.configure do |config|
2
2
  config.application_name = "<%= @application_name %>"
3
- config.api_key = ENV['SHOPIFY_API_KEY']
4
- config.secret = ENV['SHOPIFY_API_SECRET']
3
+ config.api_key = ENV.fetch('SHOPIFY_API_KEY', '').presence || raise('Missing SHOPIFY_API_KEY')
4
+ config.secret = ENV.fetch('SHOPIFY_API_SECRET', '').presence || raise('Missing SHOPIFY_API_SECRET')
5
5
  config.old_secret = "<%= @old_secret %>"
6
6
  config.scope = "<%= @scope %>" # Consult this page for more scope options:
7
7
  # https://help.shopify.com/en/api/getting-started/authentication/oauth/scopes
@@ -8,7 +8,7 @@ module ShopifyApp
8
8
 
9
9
  def create_views
10
10
  views.each do |view|
11
- copy_file view
11
+ copy_file(view)
12
12
  end
13
13
  end
14
14
 
@@ -100,7 +100,7 @@ module ShopifyApp
100
100
  end
101
101
 
102
102
  def signal_access_token_required
103
- response.set_header(ACCESS_TOKEN_REQUIRED_HEADER, true)
103
+ response.set_header(ACCESS_TOKEN_REQUIRED_HEADER, "true")
104
104
  end
105
105
 
106
106
  protected
@@ -1,5 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
  module ShopifyApp
3
+ module RedactJobParams
4
+ private
5
+
6
+ def args_info(job)
7
+ log_disabled_classes = %w(ShopifyApp::ScripttagsManagerJob ShopifyApp::WebhooksManagerJob)
8
+ return "" if log_disabled_classes.include?(job.class.name)
9
+ super
10
+ end
11
+ end
12
+
3
13
  class Engine < Rails::Engine
4
14
  engine_name 'shopify_app'
5
15
  isolate_namespace ShopifyApp
@@ -21,5 +31,16 @@ module ShopifyApp
21
31
  app.config.middleware.insert_after(ShopifyApp::SameSiteCookieMiddleware, ShopifyApp::JWTMiddleware)
22
32
  end
23
33
  end
34
+
35
+ initializer "shopify_app.redact_job_params" do
36
+ ActiveSupport.on_load(:active_job) do
37
+ if ActiveJob::Base.respond_to?(:log_arguments?)
38
+ WebhooksManagerJob.log_arguments = false
39
+ ScripttagsManagerJob.log_arguments = false
40
+ elsif ActiveJob::Logging::LogSubscriber.private_method_defined?(:args_info)
41
+ ActiveJob::Logging::LogSubscriber.prepend(RedactJobParams)
42
+ end
43
+ end
44
+ end
24
45
  end
25
46
  end
@@ -2,7 +2,9 @@
2
2
  module ShopifyApp
3
3
  class JWT
4
4
  class InvalidDestinationError < StandardError; end
5
+
5
6
  class MismatchedHostsError < StandardError; end
7
+
6
8
  class InvalidAudienceError < StandardError; end
7
9
 
8
10
  WARN_EXCEPTIONS = [
@@ -25,7 +27,7 @@ module ShopifyApp
25
27
  end
26
28
 
27
29
  def shopify_user_id
28
- @payload && @payload['sub']
30
+ @payload['sub'].to_i if @payload && @payload['sub']
29
31
  end
30
32
 
31
33
  private
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ShopifyApp
3
- VERSION = '14.4.2'
3
+ VERSION = '16.0.0'
4
4
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "14.4.2",
3
+ "version": "16.0.0",
4
4
  "repository": "git@github.com:Shopify/shopify_app.git",
5
5
  "author": "Shopify",
6
6
  "license": "MIT",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.4.2
4
+ version: 16.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-22 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser_sniffer
@@ -245,14 +245,15 @@ files:
245
245
  - ".github/ISSUE_TEMPLATE.md"
246
246
  - ".github/PULL_REQUEST_TEMPLATE.md"
247
247
  - ".github/probots.yml"
248
+ - ".github/workflows/build.yml"
248
249
  - ".github/workflows/rubocop.yml"
249
250
  - ".gitignore"
250
251
  - ".nvmrc"
251
252
  - ".rubocop.yml"
252
253
  - ".ruby-version"
253
- - ".travis.yml"
254
254
  - CHANGELOG.md
255
255
  - Gemfile
256
+ - Gemfile.lock
256
257
  - LICENSE
257
258
  - README.md
258
259
  - Rakefile
@@ -277,6 +278,7 @@ files:
277
278
  - app/views/shopify_app/partials/_button_styles.html.erb
278
279
  - app/views/shopify_app/partials/_card_styles.html.erb
279
280
  - app/views/shopify_app/partials/_empty_state_styles.html.erb
281
+ - app/views/shopify_app/partials/_form_styles.html.erb
280
282
  - app/views/shopify_app/partials/_layout_styles.html.erb
281
283
  - app/views/shopify_app/partials/_typography_styles.html.erb
282
284
  - app/views/shopify_app/sessions/enable_cookies.html.erb
@@ -1,27 +0,0 @@
1
- sudo: required
2
- dist: trusty
3
- addons:
4
- chrome: stable
5
- before_script:
6
- - "sudo chown root /opt/google/chrome/chrome-sandbox"
7
- - "sudo chmod 4755 /opt/google/chrome/chrome-sandbox"
8
- language: ruby
9
- cache:
10
- bundler: true
11
- directories:
12
- - node_modules
13
- yarn: true
14
-
15
- rvm:
16
- - 2.5
17
- - 2.6
18
- - 2.7
19
-
20
- install:
21
- - bundle install
22
- - nvm install node
23
- - yarn
24
-
25
- script:
26
- - yarn test
27
- - bundle exec rake test