shopify_app 13.2.0 → 20.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/ISSUE_TEMPLATE/bug-report.md +63 -0
- data/.github/ISSUE_TEMPLATE/config.yml +1 -0
- data/.github/ISSUE_TEMPLATE/feature-request.md +33 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
- data/.github/workflows/build.yml +40 -0
- data/.github/workflows/cla.yml +22 -0
- data/.github/workflows/close-waiting-for-response-issues.yml +20 -0
- data/.github/workflows/release.yml +24 -0
- data/.github/workflows/remove-labels-on-activity.yml +16 -0
- data/.github/workflows/rubocop.yml +22 -0
- data/.github/workflows/stale.yml +31 -0
- data/.gitignore +1 -2
- data/.nvmrc +1 -1
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +221 -0
- data/CONTRIBUTING.md +81 -0
- data/Gemfile +5 -2
- data/Gemfile.lock +248 -0
- data/README.md +74 -563
- data/Rakefile +4 -3
- data/SECURITY.md +59 -0
- data/app/assets/images/storage_access.svg +1 -2
- data/app/assets/javascripts/shopify_app/app_bridge_3.1.1.js +10 -0
- data/app/assets/javascripts/shopify_app/app_bridge_redirect.js +22 -0
- data/app/assets/javascripts/shopify_app/app_bridge_utils_3.1.1.js +1 -0
- data/app/assets/javascripts/shopify_app/post_redirect.js +9 -0
- data/app/assets/javascripts/shopify_app/redirect.js +10 -14
- data/app/assets/javascripts/shopify_app/storage_access.js +5 -10
- data/app/assets/javascripts/shopify_app/top_level_interaction.js +1 -1
- data/app/controllers/concerns/shopify_app/authenticated.rb +4 -0
- data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +39 -0
- data/app/controllers/concerns/shopify_app/require_known_shop.rb +48 -0
- data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +40 -0
- data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
- data/app/controllers/shopify_app/callback_controller.rb +56 -77
- data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
- data/app/controllers/shopify_app/sessions_controller.rb +33 -117
- data/app/controllers/shopify_app/webhooks_controller.rb +5 -26
- data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
- data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
- data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
- data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
- data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
- data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
- data/app/views/shopify_app/sessions/enable_cookies.html.erb +2 -7
- data/app/views/shopify_app/sessions/new.html.erb +38 -110
- data/app/views/shopify_app/sessions/request_storage_access.html.erb +12 -12
- data/app/views/shopify_app/sessions/top_level_interaction.html.erb +21 -22
- data/app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb +13 -0
- data/app/views/shopify_app/shared/redirect.html.erb +2 -2
- data/config/locales/de.yml +11 -11
- data/config/locales/ja.yml +4 -4
- data/config/locales/nl.yml +2 -2
- data/config/locales/th.yml +4 -4
- data/config/locales/vi.yml +22 -0
- data/config/locales/zh-CN.yml +2 -2
- data/config/routes.rb +20 -12
- data/docs/Quickstart.md +19 -83
- data/docs/Releasing.md +18 -15
- data/docs/Troubleshooting.md +140 -5
- data/docs/Upgrading.md +247 -0
- data/docs/shopify_app/authentication.md +128 -0
- data/docs/shopify_app/content-security-policy.md +10 -0
- data/docs/shopify_app/engine.md +82 -0
- data/docs/shopify_app/generators.md +127 -0
- data/docs/shopify_app/handling-access-scopes-changes.md +24 -0
- data/docs/shopify_app/script-tags.md +28 -0
- data/docs/shopify_app/session-repository.md +88 -0
- data/docs/shopify_app/testing.md +38 -0
- data/docs/shopify_app/webhooks.md +72 -0
- data/karma.conf.js +1 -1
- data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +10 -9
- data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
- data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +4 -3
- data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +15 -14
- data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt +9 -1
- data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +7 -6
- data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +2 -1
- data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +1 -1
- data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +4 -4
- data/lib/generators/shopify_app/controllers/controllers_generator.rb +5 -4
- data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +27 -4
- data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +12 -2
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +74 -16
- data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +16 -0
- data/lib/generators/shopify_app/install/install_generator.rb +52 -40
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +5 -2
- data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
- data/lib/generators/shopify_app/install/templates/session_store.rb +2 -1
- data/lib/generators/shopify_app/install/templates/shopify_app.js +1 -1
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +43 -5
- data/lib/generators/shopify_app/install/templates/shopify_app_importmap.js +13 -0
- data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
- data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
- data/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb +4 -4
- data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -0
- data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +1 -1
- data/lib/generators/shopify_app/routes/routes_generator.rb +6 -5
- data/lib/generators/shopify_app/routes/templates/routes.rb +5 -5
- data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +35 -7
- data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +5 -0
- data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
- data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
- data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +5 -0
- data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
- data/lib/generators/shopify_app/user_model/user_model_generator.rb +35 -7
- data/lib/generators/shopify_app/views/views_generator.rb +5 -4
- data/lib/shopify_app/access_scopes/noop_strategy.rb +13 -0
- data/lib/shopify_app/access_scopes/shop_strategy.rb +24 -0
- data/lib/shopify_app/access_scopes/user_strategy.rb +41 -0
- data/lib/shopify_app/configuration.rb +58 -11
- data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +4 -4
- data/lib/shopify_app/controller_concerns/csrf_protection.rb +16 -0
- data/lib/shopify_app/controller_concerns/embedded_app.rb +6 -3
- data/lib/shopify_app/controller_concerns/ensure_billing.rb +243 -0
- data/lib/shopify_app/controller_concerns/frame_ancestors.rb +16 -0
- data/lib/shopify_app/controller_concerns/itp.rb +3 -3
- data/lib/shopify_app/controller_concerns/localization.rb +1 -0
- data/lib/shopify_app/controller_concerns/login_protection.rb +105 -90
- data/lib/shopify_app/controller_concerns/payload_verification.rb +25 -0
- data/lib/shopify_app/controller_concerns/redirect_for_embedded.rb +36 -0
- data/lib/shopify_app/controller_concerns/sanitized_params.rb +36 -0
- data/lib/shopify_app/controller_concerns/webhook_verification.rb +3 -18
- data/lib/shopify_app/engine.rb +26 -11
- data/lib/shopify_app/errors.rb +34 -0
- data/lib/shopify_app/jobs/scripttags_manager_job.rb +2 -2
- data/lib/shopify_app/jobs/webhooks_manager_job.rb +4 -5
- data/lib/shopify_app/managers/scripttags_manager.rb +12 -6
- data/lib/shopify_app/managers/webhooks_manager.rb +62 -42
- data/lib/shopify_app/middleware/jwt_middleware.rb +6 -3
- data/lib/shopify_app/session/in_memory_session_store.rb +2 -3
- data/lib/shopify_app/session/in_memory_shop_session_store.rb +10 -7
- data/lib/shopify_app/session/in_memory_user_session_store.rb +10 -7
- data/lib/shopify_app/session/jwt.rb +19 -16
- data/lib/shopify_app/session/null_user_session_store.rb +2 -1
- data/lib/shopify_app/session/session_repository.rb +40 -2
- data/lib/shopify_app/session/session_storage.rb +4 -6
- data/lib/shopify_app/session/shop_session_storage.rb +6 -6
- data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +57 -0
- data/lib/shopify_app/session/user_session_storage.rb +20 -7
- data/lib/shopify_app/session/user_session_storage_with_scopes.rb +71 -0
- data/lib/shopify_app/test_helpers/all.rb +2 -1
- data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +4 -3
- data/lib/shopify_app/utils.rb +14 -7
- data/lib/shopify_app/version.rb +2 -1
- data/lib/shopify_app.rb +52 -29
- data/package.json +7 -8
- data/service.yml +1 -5
- data/shopify_app.gemspec +22 -20
- data/translation.yml +1 -1
- data/yarn.lock +2173 -2206
- metadata +110 -56
- data/.github/ISSUE_TEMPLATE.md +0 -14
- data/.github/probots.yml +0 -2
- data/.travis.yml +0 -28
- data/config/locales/hi.yml +0 -23
- data/config/locales/ms.yml +0 -22
- data/docs/install-on-dev-shop.png +0 -0
- data/docs/test-your-app.png +0 -0
- data/lib/generators/shopify_app/install/templates/omniauth.rb +0 -3
- data/lib/generators/shopify_app/install/templates/shopify_provider.rb +0 -20
- data/lib/generators/shopify_app/install/templates/user_agent.rb +0 -6
- data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +0 -34
- data/package-lock.json +0 -7245
data/lib/shopify_app/version.rb
CHANGED
data/lib/shopify_app.rb
CHANGED
@@ -1,59 +1,82 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "shopify_app/version"
|
3
4
|
|
4
5
|
# deps
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require 'redirect_safely'
|
6
|
+
require "shopify_api"
|
7
|
+
require "redirect_safely"
|
8
8
|
|
9
9
|
module ShopifyApp
|
10
10
|
def self.rails6?
|
11
11
|
Rails::VERSION::MAJOR >= 6
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.rails7?
|
15
|
+
Rails::VERSION::MAJOR >= 7
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.use_importmap?
|
19
|
+
rails7? && File.exist?("config/importmap.rb")
|
20
|
+
end
|
21
|
+
|
14
22
|
def self.use_webpacker?
|
15
23
|
rails6? &&
|
16
|
-
defined?(Webpacker) ==
|
24
|
+
defined?(Webpacker) == "constant" &&
|
17
25
|
!configuration.disable_webpacker
|
18
26
|
end
|
19
27
|
|
20
28
|
# config
|
21
|
-
require
|
29
|
+
require "shopify_app/configuration"
|
22
30
|
|
23
31
|
# engine
|
24
|
-
require
|
32
|
+
require "shopify_app/engine"
|
25
33
|
|
26
34
|
# utils
|
27
|
-
require
|
35
|
+
require "shopify_app/utils"
|
36
|
+
|
37
|
+
# errors
|
38
|
+
require "shopify_app/errors"
|
28
39
|
|
29
40
|
# controller concerns
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
41
|
+
require "shopify_app/controller_concerns/csrf_protection"
|
42
|
+
require "shopify_app/controller_concerns/localization"
|
43
|
+
require "shopify_app/controller_concerns/frame_ancestors"
|
44
|
+
require "shopify_app/controller_concerns/itp"
|
45
|
+
require "shopify_app/controller_concerns/sanitized_params"
|
46
|
+
require "shopify_app/controller_concerns/redirect_for_embedded"
|
47
|
+
require "shopify_app/controller_concerns/login_protection"
|
48
|
+
require "shopify_app/controller_concerns/ensure_billing"
|
49
|
+
require "shopify_app/controller_concerns/embedded_app"
|
50
|
+
require "shopify_app/controller_concerns/payload_verification"
|
51
|
+
require "shopify_app/controller_concerns/app_proxy_verification"
|
52
|
+
require "shopify_app/controller_concerns/webhook_verification"
|
36
53
|
|
37
54
|
# jobs
|
38
|
-
require
|
39
|
-
require
|
55
|
+
require "shopify_app/jobs/webhooks_manager_job"
|
56
|
+
require "shopify_app/jobs/scripttags_manager_job"
|
40
57
|
|
41
58
|
# managers
|
42
|
-
require
|
43
|
-
require
|
59
|
+
require "shopify_app/managers/webhooks_manager"
|
60
|
+
require "shopify_app/managers/scripttags_manager"
|
44
61
|
|
45
62
|
# middleware
|
46
|
-
require
|
47
|
-
require 'shopify_app/middleware/same_site_cookie_middleware'
|
63
|
+
require "shopify_app/middleware/jwt_middleware"
|
48
64
|
|
49
65
|
# session
|
50
|
-
require
|
51
|
-
require
|
52
|
-
require
|
53
|
-
require
|
54
|
-
require
|
55
|
-
require
|
56
|
-
require
|
57
|
-
require
|
58
|
-
require
|
66
|
+
require "shopify_app/session/in_memory_session_store"
|
67
|
+
require "shopify_app/session/in_memory_shop_session_store"
|
68
|
+
require "shopify_app/session/in_memory_user_session_store"
|
69
|
+
require "shopify_app/session/jwt"
|
70
|
+
require "shopify_app/session/null_user_session_store"
|
71
|
+
require "shopify_app/session/session_repository"
|
72
|
+
require "shopify_app/session/session_storage"
|
73
|
+
require "shopify_app/session/shop_session_storage"
|
74
|
+
require "shopify_app/session/shop_session_storage_with_scopes"
|
75
|
+
require "shopify_app/session/user_session_storage"
|
76
|
+
require "shopify_app/session/user_session_storage_with_scopes"
|
77
|
+
|
78
|
+
# access scopes strategies
|
79
|
+
require "shopify_app/access_scopes/shop_strategy"
|
80
|
+
require "shopify_app/access_scopes/user_strategy"
|
81
|
+
require "shopify_app/access_scopes/noop_strategy"
|
59
82
|
end
|
data/package.json
CHANGED
@@ -1,26 +1,25 @@
|
|
1
1
|
{
|
2
2
|
"name": "shopify_app",
|
3
|
-
"version": "
|
3
|
+
"version": "20.2.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": "^
|
10
|
+
"babel-preset-shopify": "^21.0.0",
|
11
11
|
"chai": "^4.1.2",
|
12
|
-
"karma": "^
|
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": "^
|
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
|
21
|
-
"sinon": "^
|
19
|
+
"mocha": "^8.1.3",
|
20
|
+
"sinon": "^9.0.3",
|
22
21
|
"sinon-chai": "^3.2.0",
|
23
|
-
"webpack": "^4.
|
22
|
+
"webpack": "^4.44.1"
|
24
23
|
},
|
25
24
|
"scripts": {
|
26
25
|
"test": "./node_modules/.bin/karma start --browsers ChromeHeadless --single-run"
|
data/service.yml
CHANGED
data/shopify_app.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
$LOAD_PATH.push(File.expand_path("../lib", __FILE__))
|
3
4
|
require "shopify_app/version"
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
@@ -7,29 +8,30 @@ Gem::Specification.new do |s|
|
|
7
8
|
s.version = ShopifyApp::VERSION
|
8
9
|
s.platform = Gem::Platform::RUBY
|
9
10
|
s.author = "Shopify"
|
10
|
-
s.summary =
|
11
|
+
s.summary = "This gem is used to get quickly started with the Shopify API"
|
11
12
|
|
12
|
-
s.required_ruby_version = ">= 2.
|
13
|
+
s.required_ruby_version = ">= 2.7"
|
13
14
|
|
14
|
-
s.metadata[
|
15
|
+
s.metadata["allowed_push_host"] = "https://rubygems.org"
|
15
16
|
|
16
|
-
s.add_runtime_dependency(
|
17
|
-
s.add_runtime_dependency(
|
18
|
-
s.add_runtime_dependency(
|
19
|
-
s.add_runtime_dependency(
|
20
|
-
s.add_runtime_dependency(
|
21
|
-
s.add_runtime_dependency(
|
17
|
+
s.add_runtime_dependency("activeresource") # TODO: Remove this once all active resource dependencies are removed
|
18
|
+
s.add_runtime_dependency("browser_sniffer", "~> 2.0")
|
19
|
+
s.add_runtime_dependency("jwt", ">= 2.2.3")
|
20
|
+
s.add_runtime_dependency("rails", "> 5.2.1")
|
21
|
+
s.add_runtime_dependency("redirect_safely", "~> 1.0")
|
22
|
+
s.add_runtime_dependency("shopify_api", "~> 11.1")
|
23
|
+
s.add_runtime_dependency("sprockets-rails", ">= 2.0.0")
|
22
24
|
|
23
|
-
s.add_development_dependency(
|
24
|
-
s.add_development_dependency(
|
25
|
-
s.add_development_dependency(
|
26
|
-
s.add_development_dependency(
|
27
|
-
s.add_development_dependency(
|
28
|
-
s.add_development_dependency(
|
29
|
-
s.add_development_dependency(
|
30
|
-
s.add_development_dependency(
|
31
|
-
s.add_development_dependency(
|
32
|
-
s.add_development_dependency(
|
25
|
+
s.add_development_dependency("byebug")
|
26
|
+
s.add_development_dependency("minitest")
|
27
|
+
s.add_development_dependency("mocha")
|
28
|
+
s.add_development_dependency("pry")
|
29
|
+
s.add_development_dependency("pry-nav")
|
30
|
+
s.add_development_dependency("pry-stack_explorer")
|
31
|
+
s.add_development_dependency("rake")
|
32
|
+
s.add_development_dependency("rb-readline")
|
33
|
+
s.add_development_dependency("sqlite3", "~> 1.4")
|
34
|
+
s.add_development_dependency("webmock")
|
33
35
|
|
34
36
|
s.files = %x(git ls-files).split("\n").reject { |f| f.match(%r{^(test|example)/}) }
|
35
37
|
s.test_files = %x(git ls-files -- {test}/*).split("\n")
|
data/translation.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
source_language: en
|
2
|
-
target_languages: [cs, da, de, es, fi, fr,
|
2
|
+
target_languages: [cs, da, de, es, fi, fr, it, ja, ko, nb, nl, pl, pt-BR, pt-PT, sv, th, tr, vi, zh-CN, zh-TW]
|
3
3
|
components:
|
4
4
|
- name: 'merchant'
|
5
5
|
paths:
|