shopify_app 11.2.0 → 11.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/CHANGELOG.md +30 -0
- data/README.md +116 -101
- data/app/controllers/concerns/shopify_app/authenticated.rb +1 -1
- data/app/controllers/shopify_app/callback_controller.rb +8 -2
- data/config/locales/de.yml +3 -3
- data/config/locales/nl.yml +7 -7
- data/config/locales/pt-BR.yml +5 -5
- data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +39 -0
- data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +66 -0
- data/lib/generators/shopify_app/install/install_generator.rb +20 -9
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +5 -1
- data/lib/generators/shopify_app/install/templates/shopify_app_index.js +2 -0
- data/lib/generators/shopify_app/install/templates/shopify_provider.rb +1 -0
- data/lib/generators/shopify_app/user_model/templates/db/migrate/create_users.erb +16 -0
- data/lib/generators/shopify_app/user_model/templates/user.rb +7 -0
- data/lib/generators/shopify_app/user_model/templates/users.yml +4 -0
- data/lib/generators/shopify_app/user_model/user_model_generator.rb +38 -0
- data/lib/shopify_app.rb +46 -29
- data/lib/shopify_app/configuration.rb +8 -0
- data/lib/shopify_app/controller_concerns/login_protection.rb +22 -3
- data/lib/shopify_app/controllers/extension_verification_controller.rb +18 -0
- data/lib/shopify_app/session/in_memory_session_store.rb +1 -1
- data/lib/shopify_app/session/session_repository.rb +2 -2
- data/lib/shopify_app/session/session_storage.rb +14 -15
- data/lib/shopify_app/session/storage_strategies/shop_storage_strategy.rb +24 -0
- data/lib/shopify_app/session/storage_strategies/user_storage_strategy.rb +26 -0
- data/lib/shopify_app/version.rb +1 -1
- data/package-lock.json +1218 -1221
- data/package.json +1 -2
- data/service.yml +1 -1
- data/shopify_app.gemspec +5 -2
- data/yarn.lock +14 -14
- metadata +56 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ba7612b4db7acb35c0fa91209e7b4421f90cefa6b95d52b433218e9be5a8703
|
4
|
+
data.tar.gz: 9db8d74d1f2bebd2b4fe8856bb8c2d0a3e7108cfb5a940521a70ca67b1f6e1fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b73cda40e6980ab59c5f5d40bcb09c93cfeb7e0fcfd8ff8cd953509e1d43eb45073f80e987aea8e7f585c28f50328613e5956d4d1de9e264908e3fc0265d670
|
7
|
+
data.tar.gz: 349bbdfea89e30efd696f50572d09af4e421caa8a3ce89f539e5b1a05b956c0b35af1651482fc20bfdfc7d451874ffebecf15ed4ee86bb9bb885cab358a1d707
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
11.5.0
|
2
|
+
-----
|
3
|
+
* Modularizes durable session storage
|
4
|
+
* Introduces per-user token support and user session management
|
5
|
+
|
6
|
+
11.4.0
|
7
|
+
-----
|
8
|
+
* Remove `dotenv-rails` dependency. [#835](https://github.com/Shopify/shopify_app/pull/835)
|
9
|
+
|
10
|
+
11.3.2
|
11
|
+
-----
|
12
|
+
* Fix hosts generator in Rails 5 [#823](https://github.com/Shopify/shopify_app/pull/823)
|
13
|
+
|
14
|
+
11.3.1
|
15
|
+
-----
|
16
|
+
* Bump browser_sniffer version to 1.1.3 [#824](https://github.com/Shopify/shopify_app/pull/824)
|
17
|
+
|
18
|
+
11.3.0
|
19
|
+
-----
|
20
|
+
* Update assets to be compatible with Rails 6 [#808](https://github.com/Shopify/shopify_app/pull/808)
|
21
|
+
|
22
|
+
11.2.1
|
23
|
+
-----
|
24
|
+
* Adds ngrok whitelist in development [#802](https://github.com/Shopify/shopify_app/pull/802)
|
25
|
+
|
26
|
+
11.2.0
|
27
|
+
-----
|
28
|
+
|
29
|
+
* Bump omniauth-shopify-oauth2 gem to v2.2.0
|
30
|
+
|
1
31
|
11.1.0
|
2
32
|
-----
|
3
33
|
|
data/README.md
CHANGED
@@ -12,61 +12,35 @@ Shopify Application Rails engine and generator
|
|
12
12
|
|
13
13
|
Table of Contents
|
14
14
|
-----------------
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
* [**Authenticated**](#authenticated)
|
34
|
-
* [**AppProxyVerification**](#appproxyverification)
|
35
|
-
* [Recommended Usage](#recommended-usage)
|
36
|
-
* [**Upgrading from 8.6 to 9.0.0**](#upgrading-from-86-to-900)
|
37
|
-
* [**Troubleshooting**](#troubleshooting)
|
38
|
-
* [Generator shopify_app:install hangs](#generator-shopify_appinstall-hangs)
|
39
|
-
* [**Testing an embedded app outside the Shopify admin**](#testing-an-embedded-app-outside-the-shopify-admin)
|
40
|
-
* [**Questions or problems?**](#questions-or-problems)
|
41
|
-
|
42
|
-
|
43
|
-
Description
|
15
|
+
- [Introduction](#introduction)
|
16
|
+
- [Becoming a Shopify App Developer](#becoming-a-shopify-app-developer)
|
17
|
+
- [Installation](#installation)
|
18
|
+
- [Generators](#generators)
|
19
|
+
- [Mounting the Engine](#mounting-the-engine)
|
20
|
+
- [Authentication](#authentication)
|
21
|
+
- [WebhooksManager](#webhooksmanager)
|
22
|
+
- [ScripttagsManager](#scripttagsmanager)
|
23
|
+
- [RotateShopifyTokenJob](#rotateshopifytokenjob)
|
24
|
+
- [App Tunneling](#app-tunneling)
|
25
|
+
- [AppProxyVerification](#appproxyverification)
|
26
|
+
- [Troubleshooting](#troubleshooting)
|
27
|
+
- [Testing an embedded app outside the Shopify admin](#testing-an-embedded-app-outside-the-shopify-admin)
|
28
|
+
- [Questions or problems?](#questions-or-problems-)
|
29
|
+
- [Rails 6 Compatibility](#rails-6-compatibility)
|
30
|
+
- [Upgrading from 8.6 to 9.0.0](#upgrading-from-86-to-900)
|
31
|
+
|
32
|
+
Introduction
|
44
33
|
-----------
|
45
34
|
This gem includes a Rails Engine and generators for writing Rails applications using the Shopify API. The Engine provides a SessionsController and all the required code for authenticating with a shop via Oauth (other authentication methods are not supported).
|
46
35
|
|
47
36
|
*Note: It's recommended to use this on a new Rails project, so that the generator won't overwrite/delete some of your files.*
|
48
37
|
|
49
|
-
|
50
|
-
Quickstart
|
51
|
-
----------
|
52
|
-
|
53
38
|
Check out this screencast on how to create and deploy a new Shopify App to Heroku in 5 minutes:
|
54
39
|
|
55
40
|
[https://www.youtube.com/watch?v=yGxeoAHlQOg](https://www.youtube.com/watch?v=yGxeoAHlQOg)
|
56
41
|
|
57
42
|
Or if you prefer text instructions the steps in the video are written out [here](https://github.com/Shopify/shopify_app/blob/master/docs/Quickstart.md)
|
58
43
|
|
59
|
-
App Tunneling
|
60
|
-
-------------
|
61
|
-
|
62
|
-
Your local app needs to be accessible from the public Internet in order to install it on a shop, use the [App Proxy Controller](#app-proxy-controller-generator) or receive Webhooks. Use a tunneling service like [ngrok](https://ngrok.com/), [Forward](https://forwardhq.com/), [Beeceptor](https://beeceptor.com/), [Mockbin](http://mockbin.org/), [Hookbin](https://hookbin.com/), etc.
|
63
|
-
|
64
|
-
For example with [ngrok](https://ngrok.com/), run this command to set up proxying to Rails' default port:
|
65
|
-
|
66
|
-
```sh
|
67
|
-
ngrok http 3000
|
68
|
-
```
|
69
|
-
|
70
44
|
Becoming a Shopify App Developer
|
71
45
|
--------------------------------
|
72
46
|
If you don't have a Shopify Partner account yet head over to http://shopify.com/partners to create one, you'll need it before you can start developing apps.
|
@@ -106,7 +80,7 @@ The default generator will run the `install`, `shop`, and `home_controller` gene
|
|
106
80
|
$ rails generate shopify_app
|
107
81
|
```
|
108
82
|
|
109
|
-
After running the generator, you will need to run `
|
83
|
+
After running the generator, you will need to run `rails db:migrate` to add tables to your database. You can start your app with `bundle exec rails server` and install your app by visiting localhost.
|
110
84
|
|
111
85
|
### API Keys
|
112
86
|
|
@@ -143,17 +117,6 @@ The generator adds ShopifyApp and the required initializers to the host Rails ap
|
|
143
117
|
After running the `install` generator, you can start your app with `bundle exec rails server` and install your app by visiting localhost.
|
144
118
|
|
145
119
|
|
146
|
-
### Shop Model Generator
|
147
|
-
|
148
|
-
```sh
|
149
|
-
$ rails generate shopify_app:shop_model
|
150
|
-
```
|
151
|
-
|
152
|
-
The `install` generator doesn't create any database tables or models for you. If you are starting a new app its quite likely that you will want a shops table and model to store the tokens when your app is installed (most of our internally developed apps do!). This generator creates a shop model and a migration. This model includes the `ShopifyApp::SessionStorage` concern which adds two methods to make it compatible as a `SessionRepository`. After running this generator you'll notice the `session_repository` in your `config/initializers/shopify_app.rb` will be set to the `Shop` model. This means that internally ShopifyApp will try and load tokens from this model.
|
153
|
-
|
154
|
-
*Note that you will need to run rake db:migrate after this generator*
|
155
|
-
|
156
|
-
|
157
120
|
### Home Controller Generator
|
158
121
|
|
159
122
|
```sh
|
@@ -171,6 +134,13 @@ $ rails generate shopify_app:app_proxy_controller
|
|
171
134
|
|
172
135
|
This optional generator, not included with the default generator, creates the app proxy controller to handle proxy requests to the app from your shop storefront, modifies 'config/routes.rb' with a namespace route, and an example view which displays current shop information using the LiquidAPI
|
173
136
|
|
137
|
+
### Marketing Extension Generator
|
138
|
+
|
139
|
+
```sh
|
140
|
+
$ rails generate shopify_app:add_marketing_activity_extension
|
141
|
+
```
|
142
|
+
|
143
|
+
This will create a controller with the endpoints required to build a [marketing activities extension](https://help.shopify.com/en/api/embedded-apps/app-extensions/shopify-admin/marketing-activities). The extension will be generated with a base url at `/marketing_activities`, which should also be configured in partners.
|
174
144
|
|
175
145
|
### Controllers, Routes and Views
|
176
146
|
|
@@ -238,21 +208,82 @@ ShopifyApp.configure do |config|
|
|
238
208
|
end
|
239
209
|
```
|
240
210
|
|
241
|
-
|
242
|
-
|
243
|
-
|
211
|
+
Authentication
|
212
|
+
--------------
|
213
|
+
|
214
|
+
### ShopifyApp::SessionRepository
|
215
|
+
|
216
|
+
`ShopifyApp::SessionRepository` allows you as a developer to define how your sessions are stored and retrieved for shops. The `SessionRepository` is configured in the `config/initializers/shopify_app.rb` file and can be set to any object that implements `self.store(auth_session)` which stores the session and returns a unique identifier and `self.retrieve(id)` which returns a `ShopifyAPI::Session` for the passed id. See either the `ShopifyApp::InMemorySessionStore` class or the `ShopifyApp::SessionStorage` concern for details.
|
217
|
+
|
218
|
+
If you only run the install generator then by default you will have an in memory store but it **won't work** on multi-server environments including Heroku. For multi-server environments, implement one of the following token-storage strategies.
|
219
|
+
|
220
|
+
#### Shop-based token storage
|
221
|
+
Storing tokens on the store model means that any user login associated to the store will have equal access levels to whatever the original user granted the app.
|
222
|
+
```sh
|
223
|
+
$ rails generate shopify_app:shop_model
|
224
|
+
```
|
225
|
+
This will generate a shop model which will be the storage for the tokens necessary for authentication.
|
226
|
+
|
227
|
+
#### User-based token storage
|
228
|
+
A more granular control over level of access per user on an app might be necessary, to which the shop-based token strategy is not sufficient. Shopify supports a user-based token storage strategy where a unique token to each user can be managed.
|
229
|
+
```sh
|
230
|
+
$ rails generate shopify_app:user_model
|
231
|
+
```
|
232
|
+
This will generate a user model which will be the storage for the tokens necessary for authentication.
|
233
|
+
|
234
|
+
The current Shopify user will be stored in the rails session at `session[:shopify_user]`
|
235
|
+
|
236
|
+
This will change the type of token that Shopify returns and it will only be valid for a short time. Read more about `Online access` [here](https://help.shopify.com/api/getting-started/authentication/oauth). Note that this means you won't be able to use this token to respond to Webhooks.
|
237
|
+
|
238
|
+
#### Migrating from shop-based to user-based token strategy
|
239
|
+
After running the generator, ensure that configuration settings are successfully changed:
|
244
240
|
|
245
241
|
```ruby
|
242
|
+
# In the `omniauth.rb` initializer:
|
246
243
|
provider :shopify,
|
247
244
|
ShopifyApp.configuration.api_key,
|
248
245
|
ShopifyApp.configuration.secret,
|
249
246
|
scope: ShopifyApp.configuration.scope,
|
250
247
|
per_user_permissions: true
|
248
|
+
|
249
|
+
# In the `shopify_app.rb` initializer:
|
250
|
+
config.session_repository = User
|
251
|
+
config.per_user_tokens = true
|
251
252
|
```
|
252
253
|
|
253
|
-
|
254
|
+
### Authenticated
|
254
255
|
|
255
|
-
|
256
|
+
The engine provides a `ShopifyApp::Authenticated` concern which should be included in any controller that is intended to be behind Shopify OAuth. It adds `before_action`s to ensure that the user is authenticated and will redirect to the Shopify login page if not. It is best practice to include this concern in a base controller inheriting from your `ApplicationController`, from which all controllers that require Shopify authentication inherit.
|
257
|
+
|
258
|
+
For backwards compatibility, the engine still provides a controller called `ShopifyApp::AuthenticatedController` which includes the `ShopifyApp::Authenticated` concern. Note that it inherits directly from `ActionController::Base`, so you will not be able to share functionality between it and your application's `ApplicationController`.
|
259
|
+
|
260
|
+
### AfterAuthenticate Job
|
261
|
+
|
262
|
+
If your app needs to perform specific actions after the user is authenticated successfully (i.e. every time a new session is created), ShopifyApp can queue or run a job of your choosing (note that we already provide support for automatically creating Webhooks and Scripttags). To configure the after authenticate job update your initializer as follows:
|
263
|
+
|
264
|
+
```ruby
|
265
|
+
ShopifyApp.configure do |config|
|
266
|
+
config.after_authenticate_job = { job: "Shopify::AfterAuthenticateJob" }
|
267
|
+
end
|
268
|
+
```
|
269
|
+
|
270
|
+
The job can be configured as either a class or a class name string.
|
271
|
+
|
272
|
+
If you need the job to run synchronously add the `inline` flag:
|
273
|
+
|
274
|
+
```ruby
|
275
|
+
ShopifyApp.configure do |config|
|
276
|
+
config.after_authenticate_job = { job: Shopify::AfterAuthenticateJob, inline: true }
|
277
|
+
end
|
278
|
+
```
|
279
|
+
|
280
|
+
We've also provided a generator which creates a skeleton job and updates the initializer for you:
|
281
|
+
|
282
|
+
```
|
283
|
+
bin/rails g shopify_app:add_after_authenticate_job
|
284
|
+
```
|
285
|
+
|
286
|
+
If you want to perform that action only once, e.g. send a welcome email to the user when they install the app, you should make sure that this action is idempotent, meaning that it won't have an impact if run multiple times.
|
256
287
|
|
257
288
|
|
258
289
|
WebhooksManager
|
@@ -346,36 +377,6 @@ Scripttags are created in the same way as the Webhooks, with a background job wh
|
|
346
377
|
|
347
378
|
If `src` responds to `call` its return value will be used as the scripttag's source. It will be called on scripttag creation and deletion.
|
348
379
|
|
349
|
-
AfterAuthenticate Job
|
350
|
-
---------------------
|
351
|
-
|
352
|
-
If your app needs to perform specific actions after the user is authenticated successfully (i.e. every time a new session is created), ShopifyApp can queue or run a job of your choosing (note that we already provide support for automatically creating Webhooks and Scripttags). To configure the after authenticate job update your initializer as follows:
|
353
|
-
|
354
|
-
```ruby
|
355
|
-
ShopifyApp.configure do |config|
|
356
|
-
config.after_authenticate_job = { job: "Shopify::AfterAuthenticateJob" }
|
357
|
-
end
|
358
|
-
```
|
359
|
-
|
360
|
-
The job can be configured as either a class or a class name string.
|
361
|
-
|
362
|
-
If you need the job to run synchronously add the `inline` flag:
|
363
|
-
|
364
|
-
```ruby
|
365
|
-
ShopifyApp.configure do |config|
|
366
|
-
config.after_authenticate_job = { job: Shopify::AfterAuthenticateJob, inline: true }
|
367
|
-
end
|
368
|
-
```
|
369
|
-
|
370
|
-
We've also provided a generator which creates a skeleton job and updates the initializer for you:
|
371
|
-
|
372
|
-
```
|
373
|
-
bin/rails g shopify_app:add_after_authenticate_job
|
374
|
-
```
|
375
|
-
|
376
|
-
If you want to perform that action only once, e.g. send a welcome email to the user when they install the app, you should make sure that this action is idempotent, meaning that it won't have an impact if run multiple times.
|
377
|
-
|
378
|
-
|
379
380
|
RotateShopifyTokenJob
|
380
381
|
---------------------
|
381
382
|
|
@@ -402,19 +403,16 @@ The generated rake task will be found at `lib/tasks/shopify/rotate_shopify_token
|
|
402
403
|
strategy.options[:old_client_secret] = ShopifyApp.configuration.old_secret
|
403
404
|
```
|
404
405
|
|
405
|
-
|
406
|
-
-----------------------------
|
407
|
-
|
408
|
-
`ShopifyApp::SessionRepository` allows you as a developer to define how your sessions are retrieved and stored for shops. The `SessionRepository` is configured in the `config/initializers/shopify_app.rb` file and can be set to any object that implements `self.store(shopify_session)` which stores the session and returns a unique identifier and `self.retrieve(id)` which returns a `ShopifyAPI::Session` for the passed id. See either the `ShopifyApp::InMemorySessionStore` class or the `ShopifyApp::SessionStorage` concern for examples.
|
409
|
-
|
410
|
-
If you only run the install generator then by default you will have an in memory store but it **won't work** on multi-server environments including Heroku. If you ran all the generators including the shop_model generator then the `Shop` model itself will be the `SessionRepository`. If you look at the implementation of the generated shop model you'll see that this gem provides a concern for the `SessionRepository`. You can use this concern on any model that responds to `shopify_domain`, `shopify_token` and `api_version`.
|
411
|
-
|
412
|
-
Authenticated
|
406
|
+
App Tunneling
|
413
407
|
-------------
|
414
408
|
|
415
|
-
|
409
|
+
Your local app needs to be accessible from the public Internet in order to install it on a shop, use the [App Proxy Controller](#app-proxy-controller-generator) or receive Webhooks. Use a tunneling service like [ngrok](https://ngrok.com/), [Forward](https://forwardhq.com/), [Beeceptor](https://beeceptor.com/), [Mockbin](http://mockbin.org/), [Hookbin](https://hookbin.com/), etc.
|
416
410
|
|
417
|
-
For
|
411
|
+
For example with [ngrok](https://ngrok.com/), run this command to set up proxying to Rails' default port:
|
412
|
+
|
413
|
+
```sh
|
414
|
+
ngrok http 3000
|
415
|
+
```
|
418
416
|
|
419
417
|
AppProxyVerification
|
420
418
|
--------------------
|
@@ -457,6 +455,23 @@ Questions or problems?
|
|
457
455
|
- [Ask questions!](https://ecommerce.shopify.com/c/shopify-apis-and-technology)
|
458
456
|
- [Read the docs!](https://help.shopify.com/api/guides)
|
459
457
|
|
458
|
+
Rails 6 Compatibility
|
459
|
+
---------------------
|
460
|
+
|
461
|
+
### Disable Webpacker
|
462
|
+
If you are using sprockets in rails 6 or want to generate a shopify_app without webpacker run the install task by running
|
463
|
+
|
464
|
+
```
|
465
|
+
SHOPIFY_APP_DISABLE_WEBPACKER=1 rails generate shopify_app
|
466
|
+
```
|
467
|
+
|
468
|
+
and then in your ShopifyApp configuration block, add
|
469
|
+
|
470
|
+
```
|
471
|
+
ShopifyApp.configure do |config|
|
472
|
+
config.disable_webpacker = true
|
473
|
+
end
|
474
|
+
```
|
460
475
|
|
461
476
|
Upgrading from 8.6 to 9.0.0
|
462
477
|
---------------------------
|
@@ -8,7 +8,7 @@ module ShopifyApp
|
|
8
8
|
include ShopifyApp::Localization
|
9
9
|
include ShopifyApp::LoginProtection
|
10
10
|
include ShopifyApp::EmbeddedApp
|
11
|
-
before_action :
|
11
|
+
before_action :login_again_if_different_user_or_shop
|
12
12
|
around_action :shopify_session
|
13
13
|
end
|
14
14
|
end
|
@@ -55,10 +55,16 @@ module ShopifyApp
|
|
55
55
|
token: token,
|
56
56
|
api_version: ShopifyApp.configuration.api_version
|
57
57
|
)
|
58
|
-
|
59
|
-
session[:shopify] = ShopifyApp::SessionRepository.store(session_store)
|
58
|
+
session[:shopify] = ShopifyApp::SessionRepository.store(session_store, user: associated_user)
|
60
59
|
session[:shopify_domain] = shop_name
|
61
60
|
session[:shopify_user] = associated_user
|
61
|
+
|
62
|
+
if ShopifyApp.configuration.per_user_tokens?
|
63
|
+
# Adds the user_session to the session to determine if the logged in user has changed
|
64
|
+
user_session = auth_hash&.extra&.session
|
65
|
+
raise IndexError, "Missing user session signature" if user_session.nil?
|
66
|
+
session[:user_session] = user_session
|
67
|
+
end
|
62
68
|
end
|
63
69
|
|
64
70
|
def install_webhooks
|
data/config/locales/de.yml
CHANGED
@@ -7,7 +7,7 @@ de:
|
|
7
7
|
enable_cookies_body: Sie müssen Cookies in diesem Browser manuell aktivieren, um
|
8
8
|
%{app} in Shopify verwenden zu können.
|
9
9
|
enable_cookies_footer: Mithilfe von Cookies kann die App Sie authentifizieren, indem
|
10
|
-
Ihre Einstellungen und
|
10
|
+
Ihre Einstellungen und personenbezogenen Daten vorübergehend gespeichert werden.
|
11
11
|
Sie laufen nach 30 Tagen ab.
|
12
12
|
enable_cookies_action: Cookies aktivieren
|
13
13
|
top_level_interaction_heading: Ihr Browser muss %{app} authentifizieren
|
@@ -16,7 +16,7 @@ de:
|
|
16
16
|
top_level_interaction_action: Weiter
|
17
17
|
request_storage_access_heading: "%{app} braucht Zugriff auf Cookies"
|
18
18
|
request_storage_access_body: Damit kann die App Sie authentifizieren, indem Ihre
|
19
|
-
Einstellungen und
|
20
|
-
|
19
|
+
Einstellungen und personenbezogenen Daten vorübergehend gespeichert werden. Klicken
|
20
|
+
Sie auf "Weiter" und erlauben Sie den Cookies, die App zu verwenden.
|
21
21
|
request_storage_access_footer: Cookies laufen nach 30 Tagen ab.
|
22
22
|
request_storage_access_action: Weiter
|
data/config/locales/nl.yml
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
---
|
2
2
|
nl:
|
3
|
-
logged_out:
|
3
|
+
logged_out: u bent afgemeld
|
4
4
|
could_not_log_in: Kon niet aanmelden bij Shopify-winkel
|
5
5
|
invalid_shop_url: Ongeldig winkeldomein
|
6
6
|
enable_cookies_heading: Schakel cookies in van %{app}
|
7
|
-
enable_cookies_body:
|
7
|
+
enable_cookies_body: U moet cookies in deze browser handmatig inschakelen om %{app}
|
8
8
|
binnen Shopify te gebruiken.
|
9
|
-
enable_cookies_footer: Met cookies kan de app
|
9
|
+
enable_cookies_footer: Met cookies kan de app u verifiëren door uw voorkeuren en
|
10
10
|
persoonlijke informatie tijdelijk op te slaan. Ze vervallen na 30 dagen.
|
11
11
|
enable_cookies_action: Schakel cookies in
|
12
|
-
top_level_interaction_heading:
|
13
|
-
top_level_interaction_body:
|
14
|
-
te vragen tot cookies voordat Shopify het voor
|
12
|
+
top_level_interaction_heading: Uw browser moet %{app} verifiëren
|
13
|
+
top_level_interaction_body: Uw browser heeft apps nodig zoals %{app} om u toegang
|
14
|
+
te vragen tot cookies voordat Shopify het voor u kan openen.
|
15
15
|
top_level_interaction_action: Doorgaan
|
16
16
|
request_storage_access_heading: "%{app} heeft toegang tot cookies nodig"
|
17
|
-
request_storage_access_body: Hiermee kan de app
|
17
|
+
request_storage_access_body: Hiermee kan de app u verifiëren door uw persoonlijke
|
18
18
|
gegevens tijdelijk op te slaan. Klik op Doorgaan en sta cookies toe om de app
|
19
19
|
te gebruiken.
|
20
20
|
request_storage_access_footer: Cookies verlopen na 30 dagen.
|
data/config/locales/pt-BR.yml
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
---
|
2
2
|
pt-BR:
|
3
|
-
logged_out: Você saiu
|
3
|
+
logged_out: Você saiu.
|
4
4
|
could_not_log_in: Não foi possível fazer login na Shopify store
|
5
5
|
invalid_shop_url: Domínio de loja inválido
|
6
|
-
enable_cookies_heading:
|
7
|
-
enable_cookies_body: Você deve
|
8
|
-
usar %{app} dentro da Shopify.
|
6
|
+
enable_cookies_heading: Habilitar cookies de %{app}
|
7
|
+
enable_cookies_body: Você deve habilitar manualmente os cookies neste navegador
|
8
|
+
para usar %{app} dentro da Shopify.
|
9
9
|
enable_cookies_footer: Os cookies permitem que o app o autentique armazenando temporariamente
|
10
10
|
suas preferências e dados pessoais. Eles expiram depois de 30 dias.
|
11
|
-
enable_cookies_action:
|
11
|
+
enable_cookies_action: Habilitar cookies
|
12
12
|
top_level_interaction_heading: Seu navegador precisa autenticar %{app}
|
13
13
|
top_level_interaction_body: Seu navegador exige que apps como o %{app} consultem
|
14
14
|
você sobre o acesso a cookies antes que a Shopify os abra.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module ShopifyApp
|
4
|
+
module Generators
|
5
|
+
class AddMarketingActivityExtensionGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def generate_app_extension
|
9
|
+
template "marketing_activities_controller.rb", "app/controllers/marketing_activities_controller.rb"
|
10
|
+
generate_routes
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def generate_routes
|
16
|
+
inject_into_file(
|
17
|
+
'config/routes.rb',
|
18
|
+
optimize_indentation(routes, 2),
|
19
|
+
after: "root :to => 'home#index'\n"
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def routes
|
24
|
+
<<~EOS
|
25
|
+
|
26
|
+
resource :marketing_activities, only: [:create, :update] do
|
27
|
+
patch :resume
|
28
|
+
patch :pause
|
29
|
+
patch :delete
|
30
|
+
post :republish
|
31
|
+
post :preload_form_data
|
32
|
+
post :preview
|
33
|
+
post :errors
|
34
|
+
end
|
35
|
+
EOS
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|