shopify_app 13.0.0 → 17.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug-report.md +63 -0
  3. data/.github/ISSUE_TEMPLATE/config.yml +1 -0
  4. data/.github/ISSUE_TEMPLATE/feature-request.md +33 -0
  5. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  6. data/.github/workflows/build.yml +38 -0
  7. data/.github/workflows/release.yml +24 -0
  8. data/.github/workflows/rubocop.yml +22 -0
  9. data/.gitignore +0 -2
  10. data/.rubocop.yml +14 -6
  11. data/CHANGELOG.md +132 -0
  12. data/CONTRIBUTING.md +76 -0
  13. data/Gemfile +5 -0
  14. data/Gemfile.lock +256 -0
  15. data/README.md +72 -534
  16. data/Rakefile +1 -0
  17. data/SECURITY.md +59 -0
  18. data/app/assets/images/storage_access.svg +1 -2
  19. data/app/assets/javascripts/shopify_app/storage_access.js +2 -1
  20. data/app/assets/javascripts/shopify_app/top_level_interaction.js +1 -1
  21. data/app/controllers/concerns/shopify_app/authenticated.rb +1 -0
  22. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +26 -0
  23. data/app/controllers/concerns/shopify_app/require_known_shop.rb +39 -0
  24. data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +32 -0
  25. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  26. data/app/controllers/shopify_app/callback_controller.rb +105 -18
  27. data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
  28. data/app/controllers/shopify_app/sessions_controller.rb +22 -10
  29. data/app/controllers/shopify_app/webhooks_controller.rb +6 -5
  30. data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
  31. data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
  32. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
  33. data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
  34. data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
  35. data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
  36. data/app/views/shopify_app/sessions/enable_cookies.html.erb +2 -7
  37. data/app/views/shopify_app/sessions/new.html.erb +38 -110
  38. data/app/views/shopify_app/sessions/request_storage_access.html.erb +1 -1
  39. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +21 -22
  40. data/config/locales/de.yml +11 -11
  41. data/config/locales/fi.yml +1 -1
  42. data/config/locales/nl.yml +7 -7
  43. data/config/locales/th.yml +4 -4
  44. data/config/locales/vi.yml +22 -0
  45. data/config/locales/zh-CN.yml +1 -1
  46. data/config/routes.rb +1 -0
  47. data/docs/Quickstart.md +15 -87
  48. data/docs/Releasing.md +18 -14
  49. data/docs/Upgrading.md +110 -0
  50. data/docs/shopify_app/authentication.md +124 -0
  51. data/docs/shopify_app/engine.md +82 -0
  52. data/docs/shopify_app/generators.md +127 -0
  53. data/docs/shopify_app/handling-access-scopes-changes.md +8 -0
  54. data/docs/shopify_app/script-tags.md +28 -0
  55. data/docs/shopify_app/session-repository.md +88 -0
  56. data/docs/shopify_app/testing.md +38 -0
  57. data/docs/shopify_app/webhooks.md +72 -0
  58. data/karma.conf.js +1 -1
  59. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +5 -3
  60. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  61. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +2 -1
  62. data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +4 -4
  63. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +5 -4
  64. data/lib/generators/shopify_app/add_webhook/templates/{webhook_job.rb → webhook_job.rb.tt} +5 -0
  65. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +4 -3
  66. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +3 -3
  67. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +10 -9
  68. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +1 -1
  69. data/lib/generators/shopify_app/controllers/controllers_generator.rb +2 -1
  70. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +31 -3
  71. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +2 -0
  72. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +66 -16
  73. data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +11 -0
  74. data/lib/generators/shopify_app/install/install_generator.rb +46 -11
  75. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
  76. data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
  77. data/lib/generators/shopify_app/install/templates/omniauth.rb +3 -1
  78. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +25 -0
  79. data/lib/generators/shopify_app/install/templates/shopify_provider.rb.tt +8 -0
  80. data/lib/generators/shopify_app/install/templates/user_agent.rb +2 -1
  81. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
  82. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
  83. data/lib/generators/shopify_app/routes/routes_generator.rb +1 -0
  84. data/lib/generators/shopify_app/routes/templates/routes.rb +10 -9
  85. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +39 -7
  86. data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +5 -0
  87. data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
  88. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  89. data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +5 -0
  90. data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
  91. data/lib/generators/shopify_app/user_model/user_model_generator.rb +39 -7
  92. data/lib/generators/shopify_app/views/views_generator.rb +2 -1
  93. data/lib/shopify_app/access_scopes/noop_strategy.rb +13 -0
  94. data/lib/shopify_app/access_scopes/shop_strategy.rb +24 -0
  95. data/lib/shopify_app/access_scopes/user_strategy.rb +41 -0
  96. data/lib/shopify_app/configuration.rb +40 -8
  97. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -3
  98. data/lib/shopify_app/controller_concerns/csrf_protection.rb +15 -0
  99. data/lib/shopify_app/controller_concerns/embedded_app.rb +3 -2
  100. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  101. data/lib/shopify_app/controller_concerns/login_protection.rb +74 -16
  102. data/lib/shopify_app/controller_concerns/payload_verification.rb +24 -0
  103. data/lib/shopify_app/controller_concerns/webhook_verification.rb +3 -18
  104. data/lib/shopify_app/engine.rb +26 -0
  105. data/lib/shopify_app/jobs/scripttags_manager_job.rb +1 -1
  106. data/lib/shopify_app/jobs/webhooks_manager_job.rb +1 -1
  107. data/lib/shopify_app/managers/scripttags_manager.rb +4 -3
  108. data/lib/shopify_app/managers/webhooks_manager.rb +4 -3
  109. data/lib/shopify_app/middleware/jwt_middleware.rb +42 -0
  110. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +2 -1
  111. data/lib/shopify_app/omniauth/omniauth_configuration.rb +64 -0
  112. data/lib/shopify_app/session/in_memory_session_store.rb +7 -3
  113. data/lib/shopify_app/session/in_memory_shop_session_store.rb +12 -0
  114. data/lib/shopify_app/session/in_memory_user_session_store.rb +12 -0
  115. data/lib/shopify_app/session/jwt.rb +63 -0
  116. data/lib/shopify_app/session/null_user_session_store.rb +22 -0
  117. data/lib/shopify_app/session/session_repository.rb +13 -16
  118. data/lib/shopify_app/session/session_storage.rb +1 -0
  119. data/lib/shopify_app/session/shop_session_storage.rb +21 -9
  120. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +58 -0
  121. data/lib/shopify_app/session/user_session_storage.rb +19 -8
  122. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +58 -0
  123. data/lib/shopify_app/test_helpers/all.rb +2 -0
  124. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +17 -0
  125. data/lib/shopify_app/utils.rb +18 -5
  126. data/lib/shopify_app/version.rb +2 -1
  127. data/lib/shopify_app.rb +22 -5
  128. data/package.json +7 -8
  129. data/shopify_app.gemspec +13 -8
  130. data/translation.yml +1 -1
  131. data/yarn.lock +2120 -2168
  132. metadata +88 -16
  133. data/.github/ISSUE_TEMPLATE.md +0 -14
  134. data/.travis.yml +0 -27
  135. data/docs/install-on-dev-shop.png +0 -0
  136. data/docs/test-your-app.png +0 -0
  137. data/lib/generators/shopify_app/install/templates/shopify_app.rb +0 -15
  138. data/lib/generators/shopify_app/install/templates/shopify_provider.rb +0 -20
  139. data/package-lock.json +0 -7245
@@ -1,23 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
3
  class SessionRepository
3
4
  class ConfigurationError < StandardError; end
4
5
 
5
6
  class << self
6
- def shop_storage=(storage)
7
- @shop_storage = storage
7
+ attr_writer :shop_storage
8
8
 
9
- unless storage.nil? || self.shop_storage.respond_to?(:store) && self.shop_storage.respond_to?(:retrieve)
10
- raise ArgumentError, "shop storage must respond to :store and :retrieve"
11
- end
12
- end
13
-
14
- def user_storage=(storage)
15
- @user_storage = storage
16
-
17
- unless storage.nil? || self.user_storage.respond_to?(:store) && self.user_storage.respond_to?(:retrieve)
18
- raise ArgumentError, "user storage must respond to :store and :retrieve"
19
- end
20
- end
9
+ attr_writer :user_storage
21
10
 
22
11
  def retrieve_shop_session(id)
23
12
  shop_storage.retrieve(id)
@@ -27,6 +16,14 @@ module ShopifyApp
27
16
  user_storage.retrieve(id)
28
17
  end
29
18
 
19
+ def retrieve_shop_session_by_shopify_domain(shopify_domain)
20
+ shop_storage.retrieve_by_shopify_domain(shopify_domain)
21
+ end
22
+
23
+ def retrieve_user_session_by_shopify_user_id(user_id)
24
+ user_storage.retrieve_by_shopify_user_id(user_id)
25
+ end
26
+
30
27
  def store_shop_session(session)
31
28
  shop_storage.store(session)
32
29
  end
@@ -36,7 +33,7 @@ module ShopifyApp
36
33
  end
37
34
 
38
35
  def shop_storage
39
- load_shop_storage || raise(ConfigurationError.new("ShopifySessionRepository.shop_storage is not configured!"))
36
+ load_shop_storage || raise(ConfigurationError, "ShopifySessionRepository.shop_storage is not configured!")
40
37
  end
41
38
 
42
39
  def user_storage
@@ -51,7 +48,7 @@ module ShopifyApp
51
48
  end
52
49
 
53
50
  def load_user_storage
54
- return unless @user_storage
51
+ return NullUserSessionStore unless @user_storage
55
52
  @user_storage.respond_to?(:safe_constantize) ? @user_storage.safe_constantize : @user_storage
56
53
  end
57
54
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
3
  module SessionStorage
3
4
  extend ActiveSupport::Concern
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
3
  module ShopSessionStorage
3
4
  extend ActiveSupport::Concern
@@ -8,7 +9,7 @@ module ShopifyApp
8
9
  end
9
10
 
10
11
  class_methods do
11
- def store(auth_session, *args)
12
+ def store(auth_session, *_args)
12
13
  shop = find_or_initialize_by(shopify_domain: auth_session.domain)
13
14
  shop.shopify_token = auth_session.token
14
15
  shop.save!
@@ -16,14 +17,25 @@ module ShopifyApp
16
17
  end
17
18
 
18
19
  def retrieve(id)
19
- return unless id
20
- if shop = self.find_by(id: id)
21
- ShopifyAPI::Session.new(
22
- domain: shop.shopify_domain,
23
- token: shop.shopify_token,
24
- api_version: shop.api_version
25
- )
26
- end
20
+ shop = find_by(id: id)
21
+ construct_session(shop)
22
+ end
23
+
24
+ def retrieve_by_shopify_domain(domain)
25
+ shop = find_by(shopify_domain: domain)
26
+ construct_session(shop)
27
+ end
28
+
29
+ private
30
+
31
+ def construct_session(shop)
32
+ return unless shop
33
+
34
+ ShopifyAPI::Session.new(
35
+ domain: shop.shopify_domain,
36
+ token: shop.shopify_token,
37
+ api_version: shop.api_version,
38
+ )
27
39
  end
28
40
  end
29
41
  end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ShopifyApp
4
+ module ShopSessionStorageWithScopes
5
+ extend ActiveSupport::Concern
6
+ include ::ShopifyApp::SessionStorage
7
+
8
+ included do
9
+ validates :shopify_domain, presence: true, uniqueness: { case_sensitive: false }
10
+ end
11
+
12
+ class_methods do
13
+ def store(auth_session, *_args)
14
+ shop = find_or_initialize_by(shopify_domain: auth_session.domain)
15
+ shop.shopify_token = auth_session.token
16
+ shop.access_scopes = auth_session.access_scopes
17
+
18
+ shop.save!
19
+ shop.id
20
+ end
21
+
22
+ def retrieve(id)
23
+ shop = find_by(id: id)
24
+ construct_session(shop)
25
+ end
26
+
27
+ def retrieve_by_shopify_domain(domain)
28
+ shop = find_by(shopify_domain: domain)
29
+ construct_session(shop)
30
+ end
31
+
32
+ private
33
+
34
+ def construct_session(shop)
35
+ return unless shop
36
+
37
+ ShopifyAPI::Session.new(
38
+ domain: shop.shopify_domain,
39
+ token: shop.shopify_token,
40
+ api_version: shop.api_version,
41
+ access_scopes: shop.access_scopes
42
+ )
43
+ end
44
+ end
45
+
46
+ def access_scopes=(scopes)
47
+ super(scopes)
48
+ rescue NotImplementedError, NoMethodError
49
+ raise NotImplementedError, "#access_scopes= must be defined to handle storing access scopes: #{scopes}"
50
+ end
51
+
52
+ def access_scopes
53
+ super
54
+ rescue NotImplementedError, NoMethodError
55
+ raise NotImplementedError, "#access_scopes= must be defined to hook into stored access scopes"
56
+ end
57
+ end
58
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
3
  module UserSessionStorage
3
4
  extend ActiveSupport::Concern
@@ -17,14 +18,24 @@ module ShopifyApp
17
18
  end
18
19
 
19
20
  def retrieve(id)
20
- return unless id
21
- if user = find_by(id: id)
22
- ShopifyAPI::Session.new(
23
- domain: user.shopify_domain,
24
- token: user.shopify_token,
25
- api_version: user.api_version
26
- )
27
- end
21
+ user = find_by(id: id)
22
+ construct_session(user)
23
+ end
24
+
25
+ def retrieve_by_shopify_user_id(user_id)
26
+ user = find_by(shopify_user_id: user_id)
27
+ construct_session(user)
28
+ end
29
+
30
+ private
31
+
32
+ def construct_session(user)
33
+ return unless user
34
+ ShopifyAPI::Session.new(
35
+ domain: user.shopify_domain,
36
+ token: user.shopify_token,
37
+ api_version: user.api_version,
38
+ )
28
39
  end
29
40
  end
30
41
  end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ module ShopifyApp
3
+ module UserSessionStorageWithScopes
4
+ extend ActiveSupport::Concern
5
+ include ::ShopifyApp::SessionStorage
6
+
7
+ included do
8
+ validates :shopify_domain, presence: true
9
+ end
10
+
11
+ class_methods do
12
+ def store(auth_session, user)
13
+ user = find_or_initialize_by(shopify_user_id: user[:id])
14
+ user.shopify_token = auth_session.token
15
+ user.shopify_domain = auth_session.domain
16
+ user.access_scopes = auth_session.access_scopes
17
+
18
+ user.save!
19
+ user.id
20
+ end
21
+
22
+ def retrieve(id)
23
+ user = find_by(id: id)
24
+ construct_session(user)
25
+ end
26
+
27
+ def retrieve_by_shopify_user_id(user_id)
28
+ user = find_by(shopify_user_id: user_id)
29
+ construct_session(user)
30
+ end
31
+
32
+ private
33
+
34
+ def construct_session(user)
35
+ return unless user
36
+
37
+ ShopifyAPI::Session.new(
38
+ domain: user.shopify_domain,
39
+ token: user.shopify_token,
40
+ api_version: user.api_version,
41
+ access_scopes: user.access_scopes
42
+ )
43
+ end
44
+ end
45
+
46
+ def access_scopes=(scopes)
47
+ super(scopes)
48
+ rescue NotImplementedError, NoMethodError
49
+ raise NotImplementedError, "#access_scopes= must be defined to handle storing access scopes: #{scopes}"
50
+ end
51
+
52
+ def access_scopes
53
+ super
54
+ rescue NotImplementedError, NoMethodError
55
+ raise NotImplementedError, "#access_scopes= must be defined to hook into stored access scopes"
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,2 @@
1
+ # frozen_string_literal: true
2
+ require 'shopify_app/test_helpers/webhook_verification_helper'
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ module ShopifyApp
3
+ module TestHelpers
4
+ module WebhookVerificationHelper
5
+ def authorized_webhook_verification_headers!(params = {})
6
+ digest = OpenSSL::Digest.new('sha256')
7
+ secret = ShopifyApp.configuration.secret
8
+ valid_hmac = Base64.encode64(OpenSSL::HMAC.digest(digest, secret, params.to_query)).strip
9
+ @request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = valid_hmac
10
+ end
11
+
12
+ def unauthorized_webhook_verification_headers!
13
+ @request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = "invalid_hmac"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,13 +1,14 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
3
  module Utils
3
-
4
4
  def self.sanitize_shop_domain(shop_domain)
5
+ myshopify_domain = ShopifyApp.configuration.myshopify_domain
5
6
  name = shop_domain.to_s.downcase.strip
6
- name += ".#{ShopifyApp.configuration.myshopify_domain}" if !name.include?("#{ShopifyApp.configuration.myshopify_domain}") && !name.include?(".")
7
+ name += ".#{myshopify_domain}" if !name.include?(myshopify_domain.to_s) && !name.include?(".")
7
8
  name.sub!(%r|https?://|, '')
8
9
 
9
10
  u = URI("http://#{name}")
10
- u.host if u.host&.match(/^[a-z0-9][a-z0-9\-]*[a-z0-9]\.#{Regexp.escape(ShopifyApp.configuration.myshopify_domain)}$/)
11
+ u.host if u.host&.match(/^[a-z0-9][a-z0-9\-]*[a-z0-9]\.#{Regexp.escape(myshopify_domain)}$/)
11
12
  rescue URI::InvalidURIError
12
13
  nil
13
14
  end
@@ -16,8 +17,20 @@ module ShopifyApp
16
17
  Rails.logger.info("[ShopifyAPI::ApiVersion] Fetching known Admin API Versions from Shopify...")
17
18
  ShopifyAPI::ApiVersion.fetch_known_versions
18
19
  Rails.logger.info("[ShopifyAPI::ApiVersion] Known API Versions: #{ShopifyAPI::ApiVersion.versions.keys}")
19
- rescue ActiveResource::ConnectionError
20
- logger.error( "[ShopifyAPI::ApiVersion] Unable to fetch api_versions from Shopify")
20
+ rescue ActiveResource::ConnectionError
21
+ logger.error("[ShopifyAPI::ApiVersion] Unable to fetch api_versions from Shopify")
22
+ end
23
+
24
+ def self.shop_login_url(shop:, return_to:)
25
+ return ShopifyApp.configuration.login_url unless shop
26
+ url = URI(ShopifyApp.configuration.login_url)
27
+
28
+ url.query = URI.encode_www_form(
29
+ shop: shop,
30
+ return_to: return_to,
31
+ )
32
+
33
+ url.to_s
21
34
  end
22
35
  end
23
36
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
- VERSION = '13.0.0'.freeze
3
+ VERSION = '17.1.0'
3
4
  end
data/lib/shopify_app.rb CHANGED
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  require 'shopify_app/version'
2
3
 
3
4
  # deps
4
5
  require 'shopify_api'
5
6
  require 'omniauth-shopify-oauth2'
7
+ require 'redirect_safely'
6
8
 
7
9
  module ShopifyApp
8
10
  def self.rails6?
@@ -25,12 +27,14 @@ module ShopifyApp
25
27
  require 'shopify_app/utils'
26
28
 
27
29
  # controller concerns
30
+ require 'shopify_app/controller_concerns/csrf_protection'
28
31
  require 'shopify_app/controller_concerns/localization'
29
32
  require 'shopify_app/controller_concerns/itp'
30
33
  require 'shopify_app/controller_concerns/login_protection'
31
34
  require 'shopify_app/controller_concerns/embedded_app'
32
- require 'shopify_app/controller_concerns/webhook_verification'
35
+ require 'shopify_app/controller_concerns/payload_verification'
33
36
  require 'shopify_app/controller_concerns/app_proxy_verification'
37
+ require 'shopify_app/controller_concerns/webhook_verification'
34
38
 
35
39
  # jobs
36
40
  require 'shopify_app/jobs/webhooks_manager_job'
@@ -41,14 +45,27 @@ module ShopifyApp
41
45
  require 'shopify_app/managers/scripttags_manager'
42
46
 
43
47
  # middleware
48
+ require 'shopify_app/middleware/jwt_middleware'
44
49
  require 'shopify_app/middleware/same_site_cookie_middleware'
45
50
 
46
51
  # session
47
- require 'shopify_app/session/session_storage'
48
- require 'shopify_app/session/shop_session_storage'
49
- require 'shopify_app/session/user_session_storage'
50
- require 'shopify_app/session/session_repository'
51
52
  require 'shopify_app/session/in_memory_session_store'
52
53
  require 'shopify_app/session/in_memory_shop_session_store'
53
54
  require 'shopify_app/session/in_memory_user_session_store'
55
+ require 'shopify_app/session/jwt'
56
+ require 'shopify_app/session/null_user_session_store'
57
+ require 'shopify_app/session/session_repository'
58
+ require 'shopify_app/session/session_storage'
59
+ require 'shopify_app/session/shop_session_storage'
60
+ require 'shopify_app/session/shop_session_storage_with_scopes'
61
+ require 'shopify_app/session/user_session_storage'
62
+ require 'shopify_app/session/user_session_storage_with_scopes'
63
+
64
+ # access scopes strategies
65
+ require 'shopify_app/access_scopes/shop_strategy'
66
+ require 'shopify_app/access_scopes/user_strategy'
67
+ require 'shopify_app/access_scopes/noop_strategy'
68
+
69
+ # omniauth_configuration
70
+ require 'shopify_app/omniauth/omniauth_configuration'
54
71
  end
data/package.json CHANGED
@@ -1,26 +1,25 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "13.0.0",
3
+ "version": "17.1.0",
4
4
  "repository": "git@github.com:Shopify/shopify_app.git",
5
5
  "author": "Shopify",
6
6
  "license": "MIT",
7
7
  "dependencies": {},
8
8
  "devDependencies": {
9
9
  "babel-loader": "^8.0.6",
10
- "babel-preset-shopify": "^20.0.0",
10
+ "babel-preset-shopify": "^21.0.0",
11
11
  "chai": "^4.1.2",
12
- "karma": "^4.0.1",
12
+ "karma": "^5.2.1",
13
13
  "karma-chai-sinon": "^0.1.5",
14
14
  "karma-chrome-launcher": "^3.1.0",
15
15
  "karma-cli": "^2.0.0",
16
- "karma-mocha": "^1.3.0",
16
+ "karma-mocha": "^2.0.1",
17
17
  "karma-mocha-clean-reporter": "^0.0.1",
18
- "karma-mocha-debug": "^0.1.2",
19
18
  "karma-webpack": "^4.0.2",
20
- "mocha-debug": "^0.0.1",
21
- "sinon": "^7.4.2",
19
+ "mocha": "^8.1.3",
20
+ "sinon": "^9.0.3",
22
21
  "sinon-chai": "^3.2.0",
23
- "webpack": "^4.41.3"
22
+ "webpack": "^4.44.1"
24
23
  },
25
24
  "scripts": {
26
25
  "test": "./node_modules/.bin/karma start --browsers ChromeHeadless --single-run"
data/shopify_app.gemspec CHANGED
@@ -1,4 +1,5 @@
1
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+ $LOAD_PATH.push(File.expand_path('../lib', __FILE__))
2
3
  require "shopify_app/version"
3
4
 
4
5
  Gem::Specification.new do |s|
@@ -6,14 +7,18 @@ Gem::Specification.new do |s|
6
7
  s.version = ShopifyApp::VERSION
7
8
  s.platform = Gem::Platform::RUBY
8
9
  s.author = "Shopify"
9
- s.summary = %q{This gem is used to get quickly started with the Shopify API}
10
+ s.summary = 'This gem is used to get quickly started with the Shopify API'
10
11
 
11
- s.required_ruby_version = ">= 2.3.1"
12
+ s.required_ruby_version = ">= 2.5"
12
13
 
13
- s.add_runtime_dependency('browser_sniffer', '~> 1.2.0')
14
- s.add_runtime_dependency('rails', '> 5.2.1')
15
- s.add_runtime_dependency('shopify_api', '~> 9.0.2')
14
+ s.metadata['allowed_push_host'] = 'https://rubygems.org'
15
+
16
+ s.add_runtime_dependency('browser_sniffer', '~> 1.2.2')
17
+ s.add_runtime_dependency('rails', '> 5.2.1', '< 6.1')
18
+ s.add_runtime_dependency('shopify_api', '~> 9.4')
16
19
  s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.2')
20
+ s.add_runtime_dependency('jwt', '~> 2.2.1')
21
+ s.add_runtime_dependency('redirect_safely', '~> 1.0')
17
22
 
18
23
  s.add_development_dependency('rake')
19
24
  s.add_development_dependency('byebug')
@@ -26,7 +31,7 @@ Gem::Specification.new do |s|
26
31
  s.add_development_dependency('mocha')
27
32
  s.add_development_dependency('webmock')
28
33
 
29
- s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(test|example)/}) }
30
- s.test_files = `git ls-files -- {test}/*`.split("\n")
34
+ s.files = %x(git ls-files).split("\n").reject { |f| f.match(%r{^(test|example)/}) }
35
+ s.test_files = %x(git ls-files -- {test}/*).split("\n")
31
36
  s.require_paths = ["lib"]
32
37
  end