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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b458ca32eeb9b1c13643fbb77333b744b7c95b015fec2a485e5fa4d3a18410c4
4
- data.tar.gz: 84c33e75b4862583968a4ee6abf13fc0f455ed3977db33e7e130420d14ebca6b
3
+ metadata.gz: d7f75f25ebd3015036f89240acd78fb1d38bd85c6c61c361df564e0eaa1e2195
4
+ data.tar.gz: 5b91f6dd61dd686a9cce74123a3b6de0498f683488204768542aa128e312f90f
5
5
  SHA512:
6
- metadata.gz: 3fde0d0d3c6e77a05afbad57a7db60866f738d5520453394027ab2bda81b31fb615ce0db59f0147327dce90ed1e0b6b9093129b49778d4f65550abfca7ad2c8d
7
- data.tar.gz: 475d5a91322c9f4e59a4b2977a781fc4f3c74db719142f9af06e6d51843fda44537993f1a4620e3db538760f16f7bf017eeab7126464826b1fe701bf8b222945
6
+ metadata.gz: 9119cf0bf9b9ad3a9f03c89877a7fc2337b99a98b36ec5ec01446b9a9ef15841e0bf7ba05631d15d827b5b32c535c1176f5b4b46227846ace43d27c9d55155cb
7
+ data.tar.gz: c084b5f9fd03727c865621a6615e2837179f262941b2ef3c5b083515d4e23b075e0d904f9cccee29140c78d117c2624fad4ef73c883aaa0ba087d0bc816a9685
@@ -1,3 +1,7 @@
1
+ 12.0.0
2
+ -----
3
+ * Updating shopify_api gem to 9.0.0
4
+
1
5
  11.7.1
2
6
  -----
3
7
  * Fix to allow SessionStorage to be flexible on what model names that the are used for storing shop and user data
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://cdn.shopify.com/s/assets/external/app.js?<%= Time.now.strftime('%Y%m%d%H') %>"></script>
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: ("https://#{ @shop_session.url }" if @shop_session),
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
- ShopifyApp.flashNotice(flashData.notice);
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
- ShopifyApp.flashError(flashData.error);
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
- ShopifyApp.init({
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
- debug: data.debug === 'true',
7
- forceRedirect: true
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
- session[:return_to] = "#{request.path}?#{sanitized_params.to_query}"
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
@@ -1,3 +1,3 @@
1
1
  module ShopifyApp
2
- VERSION = '11.7.1'.freeze
2
+ VERSION = '12.0.0'.freeze
3
3
  end
@@ -24,5 +24,5 @@
24
24
  "scripts": {
25
25
  "test": "./node_modules/.bin/karma start --browsers ChromeHeadless --single-run"
26
26
  },
27
- "version": "11.7.1"
27
+ "version": "12.0.0"
28
28
  }
@@ -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', '~> 8.0')
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: 11.7.1
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-21 00:00:00.000000000 Z
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: '8.0'
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: '8.0'
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
@@ -1,7 +0,0 @@
1
- <% content_for :javascript do %>
2
- <script type="text/javascript">
3
- ShopifyApp.ready(function(){
4
- ShopifyApp.Bar.initialize({ title: "Home" });
5
- });
6
- </script>
7
- <% end %>