shopify-gold 3.1.1 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e78293868f6e71725d206a8702fa7a21b464a4e064b92e66b071438b167bea14
4
- data.tar.gz: 11b2059ff87e7cb99ad4773f72b1558da33f90e2208272c11ab53fe0219fc894
3
+ metadata.gz: 2e991f369eefa6ba3d1d16b0e813c66198a3f0e5917ffb12e0b67b579a2f83fd
4
+ data.tar.gz: 4ef62f22ca0ba627622e19fd28877efac6313d3d6ba2efff315b1186c0cba9b0
5
5
  SHA512:
6
- metadata.gz: d6c36f6b7843d26a206f3136b3fc15cd0e858fa4eccd8c60ca6b8c360da3796dcee0491098a91824704d7e1eff426267e341cf071ae25b92189ccf3d9bf985b3
7
- data.tar.gz: 3e792f82164acc2c22926eab91a8b59d924edb1b69944fc70ad07dbaeaad03cb80015408cab17b98e6482220a1d2e3d884533d9feb0b523827ef85994034eab8
6
+ metadata.gz: 2dcd354fbd85a74c4173421a6ce853e6e990a79b7d8a7311b0548a8f02533cf21e6180e71bb5a70af266a49f03c3fdf89bfc06514f5f2219ded53409c6720fc1
7
+ data.tar.gz: 1fd08c18c9f15b3eb210b831a66bce5a797475c78edea25795da4a79d42a90807f4b67251954c93ffd2f9b6ad071ef12ea8d99ef48dd5c952d14fa1659be26be
data/README.md CHANGED
@@ -124,6 +124,9 @@ Gold.configure do |config|
124
124
  # If Gold is allowed to cancel charges (paid -> free) automatically
125
125
  config.allow_automated_charge_cancellation = true
126
126
 
127
+ # Force Gold billing view's to redirect to iframe
128
+ config.force_embedded_redirect = false
129
+
127
130
  config.admin_credentials = {
128
131
  user: "admin",
129
132
  password: "password123"
@@ -27,4 +27,18 @@ function tierStep($form) {
27
27
 
28
28
  if ($tierForm) {
29
29
  tierStep($tierForm);
30
+ }
31
+
32
+ // When embedded
33
+ if (window.self !== window.top) {
34
+ var $confirmation = document.getElementById('confirmation-button');
35
+
36
+ if ($confirmation) {
37
+ $confirmation.addEventListener('click', function(e) {
38
+ e.preventDefault();
39
+ app.dispatch(actions.Redirect.toRemote({
40
+ url: $confirmation.getAttribute('href')
41
+ }));
42
+ });
43
+ }
30
44
  }
@@ -6,6 +6,8 @@ module Gold
6
6
 
7
7
  layout "application"
8
8
 
9
+ helper_method :billing
10
+
9
11
  private
10
12
 
11
13
  # Allows an action to stop processing (like `return`, but works even in
@@ -9,4 +9,6 @@
9
9
 
10
10
  <div style="height: 25px;"></div>
11
11
 
12
- <a class="Polaris-Button Polaris-Button--primary" href="<%= @confirmation_url %>">View charges</a>
12
+ <a class="Polaris-Button Polaris-Button--primary"
13
+ id="confirmation-button"
14
+ href="<%= @confirmation_url %>">View charges</a>
@@ -4,6 +4,26 @@
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
5
  <title><%= Gold.configuration.app_name %></title>
6
6
 
7
+ <% if ShopifyApp.configuration.embedded_app && Gold.configuration.force_embedded_redirect %>
8
+ <script>
9
+ if (window.self === window.top) {
10
+ location.href = "https://<%= billing.shop.shopify_domain %>/admin/apps/<%= ShopifyApp.configuration.api_key %>" + location.pathname;
11
+ }
12
+ </script>
13
+ <% end %>
14
+
15
+ <script src="https://unpkg.com/@shopify/app-bridge@1.6.6/umd/index.js"></script>
16
+
17
+ <script>
18
+ var AppBridge = window['app-bridge'];
19
+ var createApp = AppBridge.default;
20
+ var app = createApp({
21
+ apiKey: '<%= ShopifyApp.configuration.api_key %>',
22
+ shopOrigin: '<%= billing.shop.shopify_domain %>',
23
+ });
24
+ var actions = window['app-bridge'].actions;
25
+ </script>
26
+
7
27
  <%= stylesheet_link_tag "shopify/polaris" %>
8
28
  <%= stylesheet_link_tag "gold/billing" %>
9
29
 
@@ -6,6 +6,7 @@ class CreateGoldBilling < ActiveRecord::Migration[5.2]
6
6
  t.string :tier_id
7
7
  t.string :shopify_plan_override
8
8
  t.integer :discount_percentage, null: false, default: 0
9
+ t.timestamps null: false
9
10
  end
10
11
  end
11
12
  end
@@ -11,7 +11,8 @@ module Gold
11
11
  :allow_automated_charge_cancellation,
12
12
  :days_until_delinquent,
13
13
  :days_until_cleanup,
14
- :shop_domain_attribute
14
+ :shop_domain_attribute,
15
+ :force_embedded_redirect
15
16
 
16
17
  # Callbacks
17
18
  attr_accessor :on_terms,
@@ -52,6 +53,9 @@ module Gold
52
53
  # The URL to a plan comparison page for the app
53
54
  @plan_comparison_url = nil
54
55
 
56
+ # Force Gold billing view's to redirect to iframe
57
+ @force_embedded_redirect = false
58
+
55
59
  # Login credential's to Gold's backend
56
60
  @admin_credentials = {
57
61
  user: "admin",
data/lib/gold/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gold
2
- VERSION = "3.1.1".freeze
2
+ VERSION = "3.1.3".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-gold
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Smith