shopify_app 11.7.1 → 12.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -0
- data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +0 -6
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +2 -2
- data/lib/generators/shopify_app/install/templates/flash_messages.js +11 -2
- data/lib/generators/shopify_app/install/templates/shopify_app.js +9 -3
- data/lib/shopify_app/controller_concerns/login_protection.rb +7 -1
- data/lib/shopify_app/version.rb +1 -1
- data/package.json +1 -1
- data/shopify_app.gemspec +1 -1
- metadata +4 -5
- data/lib/generators/shopify_app/home_controller/templates/shopify_app_ready_script.html.erb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7f75f25ebd3015036f89240acd78fb1d38bd85c6c61c361df564e0eaa1e2195
|
4
|
+
data.tar.gz: 5b91f6dd61dd686a9cce74123a3b6de0498f683488204768542aa128e312f90f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9119cf0bf9b9ad3a9f03c89877a7fc2337b99a98b36ec5ec01446b9a9ef15841e0bf7ba05631d15d827b5b32c535c1176f5b4b46227846ace43d27c9d55155cb
|
7
|
+
data.tar.gz: c084b5f9fd03727c865621a6615e2837179f262941b2ef3c5b083515d4e23b075e0d904f9cccee29140c78d117c2624fad4ef73c883aaa0ba087d0bc816a9685
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -439,6 +439,11 @@ end
|
|
439
439
|
Create your app proxy url in the [Shopify Partners' Dashboard][dashboard], making sure to point it to `https://your_app_website.com/app_proxy`.
|
440
440
|
![Creating an App Proxy](/images/app-proxy-screenshot.png)
|
441
441
|
|
442
|
+
App Bridge
|
443
|
+
---
|
444
|
+
|
445
|
+
A basic example of using [App Bridge][app-bridge] is included in the install generator. An app instance is automatically initialized in [shopify_app.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/shopify_app.js) and [flash_messages.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/flash_messages.js) converts Rails [flash messages](https://api.rubyonrails.org/classes/ActionDispatch/Flash.html) to App Bridge Toast actions automatically. By default, this library is included via [unpkg in the embedded_app layout](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/embedded_app.html.erb#L27). For more advanced uses it is recommended to [install App Bridge via npm or yarn](https://help.shopify.com/en/api/embedded-apps/app-bridge/getting-started#set-up-shopify-app-bridge-in-your-app).
|
446
|
+
|
442
447
|
Troubleshooting
|
443
448
|
---------------
|
444
449
|
|
@@ -537,3 +542,4 @@ is changed to
|
|
537
542
|
You will need to also follow the ShopifyAPI [upgrade guide](https://github.com/Shopify/shopify_api/blob/master/README.md#-breaking-change-notice-for-version-700-) to ensure your app is ready to work with api versioning.
|
538
543
|
|
539
544
|
[dashboard]:https://partners.shopify.com
|
545
|
+
[app-bridge]:https://help.shopify.com/en/api/embedded-apps/app-bridge
|
@@ -11,12 +11,6 @@ module ShopifyApp
|
|
11
11
|
|
12
12
|
def create_home_index_view
|
13
13
|
copy_file 'index.html.erb', 'app/views/home/index.html.erb'
|
14
|
-
if embedded_app?
|
15
|
-
prepend_to_file(
|
16
|
-
'app/views/home/index.html.erb',
|
17
|
-
File.read(File.expand_path(find_in_source_paths('shopify_app_ready_script.html.erb')))
|
18
|
-
)
|
19
|
-
end
|
20
14
|
end
|
21
15
|
|
22
16
|
def add_home_index_route
|
@@ -24,11 +24,11 @@
|
|
24
24
|
|
25
25
|
<%= render 'layouts/flash_messages' %>
|
26
26
|
|
27
|
-
<script src="https://
|
27
|
+
<script src="https://unpkg.com/@shopify/app-bridge"></script>
|
28
28
|
|
29
29
|
<%= content_tag(:div, nil, id: 'shopify-app-init', data: {
|
30
30
|
api_key: ShopifyApp.configuration.api_key,
|
31
|
-
shop_origin: (
|
31
|
+
shop_origin: (@shop_session.domain if @shop_session),
|
32
32
|
debug: Rails.env.development?
|
33
33
|
} ) %>
|
34
34
|
|
@@ -4,12 +4,21 @@ if (!document.documentElement.hasAttribute("data-turbolinks-preview")) {
|
|
4
4
|
document.addEventListener(eventName, function flash() {
|
5
5
|
var flashData = JSON.parse(document.getElementById('shopify-app-flash').dataset.flash);
|
6
6
|
|
7
|
+
var Toast = window['app-bridge'].actions.Toast;
|
8
|
+
|
7
9
|
if (flashData.notice) {
|
8
|
-
|
10
|
+
Toast.create(app, {
|
11
|
+
message: flashData.notice,
|
12
|
+
duration: 5000,
|
13
|
+
}).dispatch(Toast.Action.SHOW);
|
9
14
|
}
|
10
15
|
|
11
16
|
if (flashData.error) {
|
12
|
-
|
17
|
+
Toast.create(app, {
|
18
|
+
message: flashData.error,
|
19
|
+
duration: 5000,
|
20
|
+
isError: true,
|
21
|
+
}).dispatch(Toast.Action.SHOW);
|
13
22
|
}
|
14
23
|
|
15
24
|
document.removeEventListener(eventName, flash)
|
@@ -1,9 +1,15 @@
|
|
1
1
|
document.addEventListener('DOMContentLoaded', () => {
|
2
2
|
var data = document.getElementById('shopify-app-init').dataset;
|
3
|
-
|
3
|
+
var AppBridge = window['app-bridge'];
|
4
|
+
var createApp = AppBridge.default;
|
5
|
+
window.app = createApp({
|
4
6
|
apiKey: data.apiKey,
|
5
7
|
shopOrigin: data.shopOrigin,
|
6
|
-
|
7
|
-
|
8
|
+
});
|
9
|
+
|
10
|
+
var actions = AppBridge.actions;
|
11
|
+
var TitleBar = actions.TitleBar;
|
12
|
+
TitleBar.create(app, {
|
13
|
+
title: data.page,
|
8
14
|
});
|
9
15
|
});
|
@@ -63,8 +63,14 @@ module ShopifyApp
|
|
63
63
|
head :unauthorized
|
64
64
|
else
|
65
65
|
if request.get?
|
66
|
-
|
66
|
+
path = request.path
|
67
|
+
query = sanitized_params.to_query
|
68
|
+
else
|
69
|
+
referer = URI(request.referer || "/")
|
70
|
+
path = referer.path
|
71
|
+
query = "#{referer.query}&#{sanitized_params.to_query}"
|
67
72
|
end
|
73
|
+
session[:return_to] = "#{path}?#{query}"
|
68
74
|
redirect_to(login_url_with_optional_shop)
|
69
75
|
end
|
70
76
|
end
|
data/lib/shopify_app/version.rb
CHANGED
data/package.json
CHANGED
data/shopify_app.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.add_runtime_dependency('browser_sniffer', '~> 1.1.3')
|
14
14
|
s.add_runtime_dependency('rails', '> 5.2.1')
|
15
|
-
s.add_runtime_dependency('shopify_api', '~>
|
15
|
+
s.add_runtime_dependency('shopify_api', '~> 9.0')
|
16
16
|
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.0')
|
17
17
|
|
18
18
|
s.add_development_dependency('rake')
|
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:
|
4
|
+
version: 12.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-01-
|
11
|
+
date: 2020-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser_sniffer
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '9.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '9.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: omniauth-shopify-oauth2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -298,7 +298,6 @@ files:
|
|
298
298
|
- lib/generators/shopify_app/home_controller/home_controller_generator.rb
|
299
299
|
- lib/generators/shopify_app/home_controller/templates/home_controller.rb
|
300
300
|
- lib/generators/shopify_app/home_controller/templates/index.html.erb
|
301
|
-
- lib/generators/shopify_app/home_controller/templates/shopify_app_ready_script.html.erb
|
302
301
|
- lib/generators/shopify_app/install/install_generator.rb
|
303
302
|
- lib/generators/shopify_app/install/templates/_flash_messages.html.erb
|
304
303
|
- lib/generators/shopify_app/install/templates/embedded_app.html.erb
|