shopify-gold 4.1.1 → 4.2.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: fc3de898120461b0d5ea6dc6fa8147159567c2ed350aebfc59b2eeea30a0a83b
4
- data.tar.gz: b9c36b007cad3d7f25470b150c3daab8b1f041fd5e1177f23cdb02c798e1d1c9
3
+ metadata.gz: ad7514ffdfb66670043eac39bffbd3f1db861f45c6befd38bb92e570bcd4fd95
4
+ data.tar.gz: f03dc8cad6c26749cd70d8357e2019695102d944ddfb4300ce33e55937c5d224
5
5
  SHA512:
6
- metadata.gz: 94e3a447a5693bce00e7848a6968ae7799af0a40d15cfd639cdce123c25b8731a53a7cdabdd0e45d9039464feaf8817c76d6960cd60445550bed5419a27debce
7
- data.tar.gz: f9114585d4d95d47fec91637a3223d3a81cec05e7dd72e92549b34c897e07dec6eccf6afad5ddb78ba3746bd25977add8bb5d3c104ebcb1a520774adb9d2067e
6
+ metadata.gz: bddd6866e01bc82889115697f3cd3eb5cedf472942640e7c13ed3cc9678feac878179fbd20f027854de47d471dfa65bd548fd8fbb9d489cbede3bb63c81b77f4
7
+ data.tar.gz: 3db49c76d9554f994852112ce046040b8a7c2ee09b43c5588d75209b5361ac029e7372cb8db431c59f6fab4e5b9dde49d4449fb51dd0798c7fcecf2297361b3b
data/README.md CHANGED
@@ -183,6 +183,11 @@ To add tiers to your app, add a `config/tiers.yml` file. Here's an example file:
183
183
  max_customers: 1000
184
184
  ```
185
185
 
186
+ Any tier that is visible will appear in the list of choices. If it is hidden, you
187
+ can link to it either directly (/tier?id=basic) or indirectly (/start?tier=basic).
188
+ The later will route to the app listing page before selecting this option on the
189
+ tier page.
190
+
186
191
  ## Controller and views
187
192
  Ok, so it's time to get paid. Let's add our module to show merchants tier choices.
188
193
 
@@ -262,11 +267,4 @@ which you can do on Mac via Homebrew with `brew install graphviz`
262
267
 
263
268
  ## Release
264
269
  To release gem, run `gem release`, which depends on having `gem-release` installed
265
- on your system.
266
-
267
- ## Changelog
268
- Version 4.0.0
269
- - Added referral affiliates
270
-
271
- Version 3.2.0
272
- - Removed `force_embedded_redirect` config option
270
+ on your system.
@@ -44,16 +44,19 @@ module Gold
44
44
 
45
45
  apply_referral_cookie unless billing.tier
46
46
 
47
+ params[:id] = cookies[:gold_tier_id] if cookies[:gold_tier_id].present?
48
+
47
49
  @tiers = Tier.visible
48
50
  end
49
51
 
50
52
  # Process a tier selection.
51
53
  def select_tier
52
54
  @tiers = Tier.visible
53
- @tier = Tier.find(params[:tier])
55
+ @tier = Tier.find(params[:tier])
54
56
  outcome = SelectTierOp.new(billing, @tier).call
55
57
  case outcome
56
58
  when SameTier, TierApplied
59
+ cookies.delete(:gold_tier_id)
57
60
  redirect_to main_app.root_url
58
61
  when CannotSelectTier
59
62
  flash.now[:error] = "Your shop is not eligible for this plan"
@@ -6,7 +6,7 @@ module Gold
6
6
 
7
7
  cookies[:gold_referral_id] = { value: referral.id, expires: 30.days } if referral
8
8
 
9
- redirect_to Gold.configuration.referral_redirect_url
9
+ redirect_to Gold.configuration.app_listing_url
10
10
  end
11
11
  end
12
12
  end
@@ -0,0 +1,9 @@
1
+ module Gold
2
+ class SetupController < ApplicationController
3
+ def new
4
+ tier = Tier.find(params[:tier])
5
+ cookies[:gold_tier_id] = { value: tier.id, expires: 7.days } if tier
6
+ redirect_to Gold.configuration.app_listing_url
7
+ end
8
+ end
9
+ end
data/config/routes.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  Gold::Engine.routes.draw do
2
+ get "/start", to: "setup#new"
3
+
2
4
  get "/terms", to: "billing#terms", as: "terms"
3
5
  put "/terms", to: "billing#process_terms"
4
6
 
@@ -13,7 +13,7 @@ module Gold
13
13
  :days_until_cleanup,
14
14
  :shop_domain_attribute,
15
15
  :force_embedded_redirect,
16
- :referral_redirect_url
16
+ :app_listing_url
17
17
 
18
18
  # Callbacks
19
19
  attr_accessor :on_terms,
@@ -71,7 +71,7 @@ module Gold
71
71
 
72
72
  # The URL to follow after a referral code is tracked
73
73
  # (e.g. https://apps.shopify.com/customr)
74
- @referral_redirect_url = "/"
74
+ @app_listing_url = "https://apps.shopify.com/"
75
75
  end
76
76
 
77
77
  def shop_class
data/lib/gold/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gold
2
- VERSION = "4.1.1".freeze
2
+ VERSION = "4.2.0".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: 4.1.1
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-02-04 00:00:00.000000000 Z
12
+ date: 2020-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -219,6 +219,7 @@ files:
219
219
  - app/controllers/gold/billing_controller.rb
220
220
  - app/controllers/gold/concerns/merchant_facing.rb
221
221
  - app/controllers/gold/referrals_controller.rb
222
+ - app/controllers/gold/setup_controller.rb
222
223
  - app/jobs/gold/after_authenticate_job.rb
223
224
  - app/jobs/gold/app_uninstalled_job.rb
224
225
  - app/jobs/gold/application_job.rb