shopify_app 21.6.0 → 21.8.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/workflows/build.yml +1 -1
- data/CHANGELOG.md +17 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +3 -3
- data/README.md +1 -1
- data/app/assets/javascripts/shopify_app/app_bridge_3.7.8.js +10 -0
- data/app/assets/javascripts/shopify_app/app_bridge_redirect.js +2 -2
- data/app/assets/javascripts/shopify_app/redirect.js +1 -2
- data/app/controllers/shopify_app/callback_controller.rb +14 -3
- data/docs/shopify_app/authentication.md +62 -57
- data/docs/shopify_app/controller-concerns.md +35 -15
- data/docs/shopify_app/sessions.md +250 -0
- data/docs/shopify_app/webhooks.md +38 -4
- data/karma.conf.js +6 -1
- data/lib/generators/shopify_app/{add_gdpr_jobs/add_gdpr_jobs_generator.rb → add_privacy_jobs/add_privacy_jobs_generator.rb} +1 -1
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +2 -1
- data/lib/generators/shopify_app/shopify_app_generator.rb +1 -1
- data/lib/shopify_app/configuration.rb +3 -1
- data/lib/shopify_app/controller_concerns/ensure_billing.rb +3 -0
- data/lib/shopify_app/controller_concerns/localization.rb +11 -8
- data/lib/shopify_app/managers/webhooks_manager.rb +4 -2
- data/lib/shopify_app/session/in_memory_user_session_store.rb +1 -1
- data/lib/shopify_app/session/session_repository.rb +37 -3
- data/lib/shopify_app/version.rb +1 -1
- data/package.json +5 -6
- data/shopify_app.gemspec +1 -1
- data/yarn.lock +2087 -3882
- metadata +11 -13
- data/.github/workflows/stale.yml +0 -43
- data/app/assets/javascripts/shopify_app/app_bridge_3.1.1.js +0 -10
- data/app/assets/javascripts/shopify_app/app_bridge_utils_3.1.1.js +0 -1
- data/docs/shopify_app/session-repository.md +0 -79
- /data/lib/generators/shopify_app/{add_gdpr_jobs → add_privacy_jobs}/templates/customers_data_request_job.rb.tt +0 -0
- /data/lib/generators/shopify_app/{add_gdpr_jobs → add_privacy_jobs}/templates/customers_redact_job.rb.tt +0 -0
- /data/lib/generators/shopify_app/{add_gdpr_jobs → add_privacy_jobs}/templates/shop_redact_job.rb.tt +0 -0
@@ -136,6 +136,7 @@ module ShopifyApp
|
|
136
136
|
},
|
137
137
|
},
|
138
138
|
returnUrl: return_url,
|
139
|
+
trialDays: ShopifyApp.configuration.billing.trial_days,
|
139
140
|
test: ShopifyApp.configuration.billing.test,
|
140
141
|
},
|
141
142
|
)
|
@@ -208,12 +209,14 @@ module ShopifyApp
|
|
208
209
|
$name: String!
|
209
210
|
$lineItems: [AppSubscriptionLineItemInput!]!
|
210
211
|
$returnUrl: URL!
|
212
|
+
$trialDays: Int
|
211
213
|
$test: Boolean
|
212
214
|
) {
|
213
215
|
appSubscriptionCreate(
|
214
216
|
name: $name
|
215
217
|
lineItems: $lineItems
|
216
218
|
returnUrl: $returnUrl
|
219
|
+
trialDays: $trialDays
|
217
220
|
test: $test
|
218
221
|
) {
|
219
222
|
confirmationUrl
|
@@ -5,20 +5,23 @@ module ShopifyApp
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
-
|
8
|
+
around_action :set_locale
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
-
def set_locale
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
def set_locale(&action)
|
14
|
+
locale = params[:locale] || I18n.default_locale
|
15
|
+
|
16
|
+
# Fallback to the 2 letter language code if the requested locale unavailable
|
17
|
+
unless I18n.available_locales.include?(locale.to_sym)
|
18
|
+
locale = locale.split("-").first
|
18
19
|
end
|
19
|
-
|
20
|
+
|
21
|
+
session[:locale] = locale
|
22
|
+
I18n.with_locale(session[:locale], &action)
|
20
23
|
rescue I18n::InvalidLocale
|
21
|
-
I18n.
|
24
|
+
I18n.with_locale(I18n.default_locale, &action)
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
@@ -26,6 +26,7 @@ module ShopifyApp
|
|
26
26
|
|
27
27
|
ShopifyApp::Logger.debug("Recreating webhooks")
|
28
28
|
add_registrations
|
29
|
+
create_webhooks(session: session)
|
29
30
|
end
|
30
31
|
|
31
32
|
def destroy_webhooks(session:)
|
@@ -43,12 +44,13 @@ module ShopifyApp
|
|
43
44
|
ShopifyApp::Logger.debug("Adding registrations to webhooks")
|
44
45
|
ShopifyApp.configuration.webhooks.each do |attributes|
|
45
46
|
webhook_path = path(attributes)
|
47
|
+
delivery_method = attributes[:delivery_method] || :http
|
46
48
|
|
47
49
|
ShopifyAPI::Webhooks::Registry.add_registration(
|
48
50
|
topic: attributes[:topic],
|
49
|
-
delivery_method:
|
51
|
+
delivery_method: delivery_method,
|
50
52
|
path: webhook_path,
|
51
|
-
handler: webhook_job_klass(webhook_path),
|
53
|
+
handler: delivery_method == :http ? webhook_job_klass(webhook_path) : nil,
|
52
54
|
fields: attributes[:fields],
|
53
55
|
)
|
54
56
|
end
|
@@ -34,7 +34,8 @@ module ShopifyApp
|
|
34
34
|
def shop_storage
|
35
35
|
load_shop_storage || raise(
|
36
36
|
::ShopifyApp::ConfigurationError,
|
37
|
-
"
|
37
|
+
"ShopifyApp::Configuration.shop_session_repository is not configured!\n
|
38
|
+
See docs here: https://github.com/Shopify/shopify_app/blob/main/docs/shopify_app/sessions.md#sessions",
|
38
39
|
)
|
39
40
|
end
|
40
41
|
|
@@ -92,13 +93,46 @@ module ShopifyApp
|
|
92
93
|
def load_shop_storage
|
93
94
|
return unless @shop_storage
|
94
95
|
|
95
|
-
|
96
|
+
shop_storage_class =
|
97
|
+
@shop_storage.respond_to?(:safe_constantize) ? @shop_storage.safe_constantize : @shop_storage
|
98
|
+
|
99
|
+
[
|
100
|
+
:store,
|
101
|
+
:retrieve,
|
102
|
+
:retrieve_by_shopify_domain,
|
103
|
+
].each do |method|
|
104
|
+
raise(
|
105
|
+
::ShopifyApp::ConfigurationError,
|
106
|
+
missing_method_message("shop", method.to_s),
|
107
|
+
) unless shop_storage_class.respond_to?(method)
|
108
|
+
end
|
109
|
+
|
110
|
+
shop_storage_class
|
96
111
|
end
|
97
112
|
|
98
113
|
def load_user_storage
|
99
114
|
return NullUserSessionStore unless @user_storage
|
100
115
|
|
101
|
-
|
116
|
+
user_storage_class =
|
117
|
+
@user_storage.respond_to?(:safe_constantize) ? @user_storage.safe_constantize : @user_storage
|
118
|
+
|
119
|
+
[
|
120
|
+
:store,
|
121
|
+
:retrieve,
|
122
|
+
:retrieve_by_shopify_user_id,
|
123
|
+
].each do |method|
|
124
|
+
raise(
|
125
|
+
::ShopifyApp::ConfigurationError,
|
126
|
+
missing_method_message("user", method.to_s),
|
127
|
+
) unless user_storage_class.respond_to?(method)
|
128
|
+
end
|
129
|
+
|
130
|
+
user_storage_class
|
131
|
+
end
|
132
|
+
|
133
|
+
def missing_method_message(type, method)
|
134
|
+
"Missing method - '#{method}' implementation for #{type}_storage_repository\n
|
135
|
+
See docs here: https://github.com/Shopify/shopify_app/blob/main/docs/shopify_app/sessions.md#sessions"
|
102
136
|
end
|
103
137
|
end
|
104
138
|
end
|
data/lib/shopify_app/version.rb
CHANGED
data/package.json
CHANGED
@@ -1,25 +1,24 @@
|
|
1
1
|
{
|
2
2
|
"name": "shopify_app",
|
3
|
-
"version": "21.
|
3
|
+
"version": "21.8.0",
|
4
4
|
"repository": "git@github.com:Shopify/shopify_app.git",
|
5
5
|
"author": "Shopify",
|
6
6
|
"license": "MIT",
|
7
|
-
"dependencies": {},
|
8
7
|
"devDependencies": {
|
9
8
|
"babel-loader": "^8.0.6",
|
10
9
|
"babel-preset-shopify": "^21.0.0",
|
11
10
|
"chai": "^4.1.2",
|
12
|
-
"karma": "^
|
11
|
+
"karma": "^6.4.2",
|
13
12
|
"karma-chai-sinon": "^0.1.5",
|
14
13
|
"karma-chrome-launcher": "^3.1.0",
|
15
14
|
"karma-cli": "^2.0.0",
|
16
15
|
"karma-mocha": "^2.0.1",
|
17
16
|
"karma-mocha-clean-reporter": "^0.0.1",
|
18
|
-
"karma-webpack": "^
|
19
|
-
"mocha": "^
|
17
|
+
"karma-webpack": "^5.0.0",
|
18
|
+
"mocha": "^10.2.0",
|
20
19
|
"sinon": "^9.0.3",
|
21
20
|
"sinon-chai": "^3.2.0",
|
22
|
-
"webpack": "^
|
21
|
+
"webpack": "^5.89.0"
|
23
22
|
},
|
24
23
|
"scripts": {
|
25
24
|
"test": "./node_modules/.bin/karma start --browsers ChromeHeadless --single-run"
|
data/shopify_app.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_runtime_dependency("jwt", ">= 2.2.3")
|
21
21
|
s.add_runtime_dependency("rails", "> 5.2.1")
|
22
22
|
s.add_runtime_dependency("redirect_safely", "~> 1.0")
|
23
|
-
s.add_runtime_dependency("shopify_api", "~> 13.
|
23
|
+
s.add_runtime_dependency("shopify_api", "~> 13.3")
|
24
24
|
s.add_runtime_dependency("sprockets-rails", ">= 2.0.0")
|
25
25
|
|
26
26
|
s.add_development_dependency("byebug")
|