shopify_app 8.1.0 → 8.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
  SHA1:
3
- metadata.gz: 4542a5b3f58a2e7a539c6de59632620df01c36f8
4
- data.tar.gz: '022092d414e237445b38a68476b03331362753c5'
3
+ metadata.gz: 638ecefa077fb7501468d89a5e84f6737c84a794
4
+ data.tar.gz: 960b0f8831db1fb97c04b30fc52f72b624b98387
5
5
  SHA512:
6
- metadata.gz: c63e25613286a63914472aba0e791502e683fb2a4b32715f8f69426c4edf48e6b63efe07880d91a33437ea0ae3fec96acd3cff4e9b2ec113a3e064532280dee0
7
- data.tar.gz: 9164dbf445acb30e6937cadea35bb2e4fa63a144cca5d97da8c4708e49b6122e5ccf850f400cd3963ed2c9aed0934b72fb68ba26aab841e17de65af0b8435458
6
+ metadata.gz: b29e463e3337b211e5e1ddf7c2c4e794db894235a05b39ee5ea6b7eabcd42ae095517c165165da3a98fdf0da17d5fb1bd03efe4efbab1ad1ad338b1923b2f466
7
+ data.tar.gz: 26854b97c8f6888c88c1950357a15a81352c4b18ad708436c6b5dd8bb40f25f196ee65084475a9ee6a2710ddaf0f84c88c9733bf78abc2f11bf90d17accb9756
data/CHANGELOG.md CHANGED
@@ -1,7 +1,12 @@
1
+ 8.2.0
2
+ -----
3
+ * Add `webhook_jobs_namespace` config option. [[#463]](https://github.com/Shopify/shopify_app/pull/463)
4
+ * Updates login page styles to match the [Polaris](https://polaris.shopify.com/) design system. [[#474]](https://github.com/Shopify/shopify_app/pull/474)
5
+
1
6
  8.1.0
2
7
  -----
3
8
  * Add support for per_user_authentication
4
- * Pass the shop param in the session for authentication instead of a url param (prevents csrf)
9
+ * Pass the shop param in the session for authentication instead of a url param (prevents csrf). If you are upgrading from an older version of the gem you will need to update your omniauth.rb initializer file. Check the example app for what it what it should look like.
5
10
 
6
11
  8.0.0
7
12
  -----
data/README.md CHANGED
@@ -182,14 +182,15 @@ Mounting the Engine will provide the basic routes to authenticating a shop with
182
182
  |GET |'/logout' |Logout |
183
183
  |POST |'/webhooks/:type' |Webhook Callback |
184
184
 
185
+ ### Nested Routes
185
186
 
186
- If required the engine can be mounted at a nested route, eg:
187
+ The engine may also be mounted at a nested route, for example:
187
188
 
188
189
  ```ruby
189
190
  mount ShopifyApp::Engine, at: '/nested'
190
191
  ```
191
192
 
192
- This will create the Shopify engine routes under the specified subpath. You'll also need to make some updates to your `shopify_app.rb` and `omniauth.rb` initializers. First update the shopify_app initializer to include a custom `root_url` e.g:
193
+ This will create the Shopify engine routes under the specified subpath. You'll also need to make some updates to your `shopify_app.rb` and `omniauth.rb` initializers. First update the shopify_app initializer to include a custom `root_url` e.g.:
193
194
 
194
195
  ```ruby
195
196
  ShopifyApp.configure do |config|
@@ -197,7 +198,7 @@ ShopifyApp.configure do |config|
197
198
  end
198
199
  ```
199
200
 
200
- then update the omniauth initializer to include a custom `callback_path` e.g:
201
+ then update the omniauth initializer to include a custom `callback_path` e.g.:
201
202
 
202
203
  ```ruby
203
204
  provider :shopify,
@@ -242,7 +243,7 @@ end
242
243
  WebhooksManager
243
244
  ---------------
244
245
 
245
- ShopifyApp can manage your app's webhooks for you by setting which webhooks you require in the initializer:
246
+ ShopifyApp can manage your app's webhooks for you if you set which webhooks you require in the initializer:
246
247
 
247
248
  ```ruby
248
249
  ShopifyApp.configure do |config|
@@ -254,7 +255,15 @@ end
254
255
 
255
256
  When the oauth callback is completed successfully ShopifyApp will queue a background job which will ensure all the specified webhooks exist for that shop. Because this runs on every oauth callback it means your app will always have the webhooks it needs even if the user uninstalls and re-installs the app.
256
257
 
257
- ShopifyApp also provides a WebhooksController that receives webhooks and queues a job based on the webhook url. For example if you register the webhook from above then all you need to do is create a job called `CartsUpdateJob`. The job will be queued with 2 params `shop_domain` and `webhook` which is the webhook body.
258
+ ShopifyApp also provides a WebhooksController that receives webhooks and queues a job based on the received topic. For example if you register the webhook from above then all you need to do is create a job called `CartsUpdateJob`. The job will be queued with 2 params: `shop_domain` and `webhook` (which is the webhook body).
259
+
260
+ If you would like to namespace your jobs you may set `webhook_jobs_namespace` in the config. For example if your app handles webhooks from other ecommerce applications as well, and you want Shopify cart update webhooks to be processed by a job living in `jobs/shopify/webhooks/carts_update_job.rb` rather than `jobs/carts_update_job.rb`):
261
+
262
+ ```ruby
263
+ ShopifyApp.configure do |config|
264
+ config.webhook_jobs_namespace = 'shopify/webhooks'
265
+ end
266
+ ```
258
267
 
259
268
  If you are only interested in particular fields, you can optionally filter the data sent by Shopify by specifying the `fields` parameter in `config/webhooks`. Note that you will still receive a webhook request from Shopify every time the resource is updated, but only the specified fields will be sent.
260
269
 
@@ -322,7 +331,7 @@ If your app needs to perform specific actions after it is installed ShopifyApp c
322
331
 
323
332
  ```ruby
324
333
  ShopifyApp.configure do |config|
325
- config.add_after_authenticate_job = { job: Shopify::AfterAuthenticateJob }
334
+ config.after_authenticate_job = { job: Shopify::AfterAuthenticateJob }
326
335
  end
327
336
  ```
328
337
 
@@ -330,7 +339,7 @@ If you need the job to run synchronously add the `inline` flag:
330
339
 
331
340
  ```ruby
332
341
  ShopifyApp.configure do |config|
333
- config.add_after_authenticate_job = { job: Shopify::AfterAuthenticateJob, inline: true }
342
+ config.after_authenticate_job = { job: Shopify::AfterAuthenticateJob, inline: true }
334
343
  end
335
344
  ```
336
345
 
@@ -18,11 +18,19 @@ module ShopifyApp
18
18
  end
19
19
 
20
20
  def webhook_job_klass
21
- "#{webhook_type.classify}Job".safe_constantize or raise ShopifyApp::MissingWebhookJobError
21
+ webhook_job_klass_name.safe_constantize or raise ShopifyApp::MissingWebhookJobError
22
+ end
23
+
24
+ def webhook_job_klass_name(type = webhook_type)
25
+ [webhook_namespace, "#{type}_job"].compact.join('/').classify
22
26
  end
23
27
 
24
28
  def webhook_type
25
29
  params[:type]
26
30
  end
31
+
32
+ def webhook_namespace
33
+ ShopifyApp.configuration.webhook_jobs_namespace
34
+ end
27
35
  end
28
36
  end
@@ -3,92 +3,111 @@
3
3
  <head>
4
4
  <title>Shopify App — Installation</title>
5
5
 
6
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+
6
9
  <style>
7
- html, body { padding: 0; margin: 0; }
10
+ * {
11
+ -moz-box-sizing: border-box;
12
+ -webkit-box-sizing: border-box;
13
+ box-sizing: border-box;
14
+ }
8
15
 
9
16
  body {
10
- font-family: "ProximaNovaLight", "Helvetica Neue", Helvetica, Arial, sans-serif;
11
- background-color: #f2f7fa;
17
+ padding: 2.5em 0;
18
+ color: #212b37;
19
+ font-family: -apple-system,BlinkMacSystemFont,San Francisco,Roboto,Segoe UI,Helvetica Neue,sans-serif;
12
20
  }
13
21
 
14
- h1 {
15
- font-weight: 300;
16
- font-size: 40px;
17
- margin-bottom: 10px;
22
+ .container {
23
+ width: 100%;
24
+ text-align: center;
25
+ margin-left: auto;
26
+ margin-right: auto;
18
27
  }
19
28
 
20
- .subhead {
21
- font-size: 17px;
22
- line-height: 32px;
23
- font-weight: 300;
24
- color: #969A9C;
29
+ @media screen and (min-width: 510px) {
30
+ .container {
31
+ width: 510px;
32
+ }
25
33
  }
26
34
 
27
- input {
28
- width: 300px;
29
- height: 50px;
30
- padding: 10px;
31
- border: 1px solid #479CCf;
32
- color: #575757;
33
- background-color: #ffffff;
34
- box-sizing: border-box;
35
- border-radius: 4px 0 0 4px;
36
- font-size: 18px;
37
- float: left;
35
+ .title {
36
+ font-size: 1.5em;
37
+ margin: 2em auto;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ word-break: break-all;
38
42
  }
39
43
 
40
- button {
41
- color: #ffffff;
42
- background-color: #3793cb;
43
- width: 100px;
44
- height: 50px;
45
- padding: 10px 20px 10px 20px;
46
- box-sizing: border-box;
47
- border: none;
48
- text-shadow: 0 1px 0 #3188bc;
49
- font-size: 18px;
50
- cursor: pointer;
51
- border-radius: 0 4px 4px 0;
52
- float: right;
44
+ .subtitle {
45
+ font-size: 0.8em;
46
+ font-weight: 500;
47
+ color: #64737f;
48
+ line-height: 2em;
53
49
  }
54
50
 
55
- button:hover {
56
- background-color: #479CCf;
51
+ input.marketing-input {
52
+ width: 100%;
53
+ height: 52px;
54
+ padding: 0 15px;
55
+ box-shadow: 0 0 0 1px #ddd;
56
+ border: 0;
57
+ border-radius: 5px;
58
+ background-color: #fff;
59
+ font-size: 1em;
60
+ margin-bottom: 15px;
57
61
  }
58
62
 
59
- form {
60
- display: block;
63
+ input.marketing-input:focus {
64
+ color: #000;
65
+ outline: 0;
66
+ box-shadow: 0 0 0 2px #5e6ebf;
61
67
  }
62
68
 
63
- .container {
69
+ button.marketing-button {
70
+ display: inline-block;
71
+ width: 100%;
72
+ padding: 1.0625em 1.875em;
73
+ background-color: #5e6ebf;
74
+ color: #fff;
75
+ font-weight: 700;
76
+ font-size: 1em;
64
77
  text-align: center;
65
- margin-top: 100px;
66
- padding: 20px;
78
+ outline: none;
79
+ border: 0 solid transparent;
80
+ border-radius: 5px;
81
+ cursor: pointer;
82
+ }
83
+
84
+ button.marketing-button:hover {
85
+ background: linear-gradient(to bottom, #5c6ac4, #4959bd);
86
+ border-color: #3f4eae;
67
87
  }
68
88
 
69
- .container__form {
70
- width: 400px;
71
- margin: auto;
89
+ button.marketing-button:focus {
90
+ box-shadow: 0 0 0.1875em 0.1875em rgba(94,110,191,0.5);
91
+ background-color: #223274;
92
+ color: #fff;
72
93
  }
73
94
  </style>
74
95
  </head>
75
96
  <body>
76
97
 
77
98
  <main class="container" role="main">
78
- <header>
79
- <% application_name = ShopifyApp.configuration.application_name %>
80
- <h1><%= application_name.presence || 'Shopify App – Installation' %></h1>
81
- <p class="subhead">
82
- <label for="shop">Enter your shop domain to log in or install this app.</label>
83
- </p>
84
- </header>
99
+ <% application_name = ShopifyApp.configuration.application_name %>
100
+ <h3 class="title">
101
+ <%= application_name.presence || 'Shopify App – Installation' %>
102
+ </h3>
103
+ <p class="subtitle">
104
+ <label for="shop">Enter your shop domain to log in or install this app.</label>
105
+ </p>
85
106
 
86
- <div class="container__form">
87
- <form method="GET" action="login">
88
- <input type="text" name="shop" id="shop" placeholder="example.myshopify.com"/>
89
- <button type="submit">Install</button>
90
- </form>
91
- </div>
107
+ <form method="GET" action="login">
108
+ <input id="shop" name="shop" type="text" autofocus="autofocus" placeholder="example.myshopify.com" class="marketing-input">
109
+ <button type="submit" class="marketing-button">Install</button>
110
+ </form>
92
111
  </main>
93
112
 
94
113
  </body>
@@ -25,6 +25,9 @@ module ShopifyApp
25
25
  # configure myshopify domain for local shopify development
26
26
  attr_accessor :myshopify_domain
27
27
 
28
+ # allow namespacing webhook jobs
29
+ attr_accessor :webhook_jobs_namespace
30
+
28
31
  def initialize
29
32
  @root_url = '/'
30
33
  @myshopify_domain = 'myshopify.com'
@@ -1,3 +1,3 @@
1
1
  module ShopifyApp
2
- VERSION = '8.1.0'
2
+ VERSION = '8.2.0'
3
3
  end
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: 8.1.0
4
+ version: 8.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails