shopify_app 11.1.0 → 11.4.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: 5efea1849894001dd33e89e8beaab22dc7630f383a263b1638b2e316478c4927
4
- data.tar.gz: f6b8fb40731e82c83ebb57548814a9ea6aa5691691606c50fa986191b00f092f
3
+ metadata.gz: '097ed8c5a4e2712571c38ab110dba580e6c80dd6af95d04414d489e16366653f'
4
+ data.tar.gz: 7f95f2cd5100b9952cef6a40b68cb778bfa4be6753f9693f7c6ff6df18615014
5
5
  SHA512:
6
- metadata.gz: 7d278a7a7dc385940cbfdaa832d7e05f69f31c5bb57ce007f0a776ed1d926682fb36f88de490b63d9208ccca50b39e30057c3c14d3056d80301fed95468484c4
7
- data.tar.gz: ec1ebf4b962a4cfde1abf6d771caa0e7910ef04cbaade77961f97234799b3db4a21d799434bf20d12b3d00653b59f923871fe03d6132efa880d092d7f2ebb9be
6
+ metadata.gz: '08c2495dac07fc430e8583c196e06af804905b3de7d6e7d7eed4bcc29a131d635caacc82f4a0619b7f7170be77d2069df6602379d413eb1f273a64dd9c79486d'
7
+ data.tar.gz: 3a559f4426151c91fd16eb1125a8b910a68ac4abe1b6601a5234a1e3c91969d4227eca31acae7a27171c0c0004cd8af1e17f6e9aebac60957119f4f211d895b4
@@ -1,3 +1,28 @@
1
+ 11.4.0
2
+ -----
3
+ * Remove `dotenv-rails` dependency. [#835](https://github.com/Shopify/shopify_app/pull/835)
4
+
5
+ 11.3.2
6
+ -----
7
+ * Fix hosts generator in Rails 5 [#823](https://github.com/Shopify/shopify_app/pull/823)
8
+
9
+ 11.3.1
10
+ -----
11
+ * Bump browser_sniffer version to 1.1.3 [#824](https://github.com/Shopify/shopify_app/pull/824)
12
+
13
+ 11.3.0
14
+ -----
15
+ * Update assets to be compatible with Rails 6 [#808](https://github.com/Shopify/shopify_app/pull/808)
16
+
17
+ 11.2.1
18
+ -----
19
+ * Adds ngrok whitelist in development [#802](https://github.com/Shopify/shopify_app/pull/802)
20
+
21
+ 11.2.0
22
+ -----
23
+
24
+ * Bump omniauth-shopify-oauth2 gem to v2.2.0
25
+
1
26
  11.1.0
2
27
  -----
3
28
 
data/README.md CHANGED
@@ -457,6 +457,23 @@ Questions or problems?
457
457
  - [Ask questions!](https://ecommerce.shopify.com/c/shopify-apis-and-technology)
458
458
  - [Read the docs!](https://help.shopify.com/api/guides)
459
459
 
460
+ Rails 6 Compatibility
461
+ ---------------------------
462
+
463
+ ### Disable Webpacker
464
+ If you are using sprockets in rails 6 or want to generate a shopify_app without webpacker run the install task by running
465
+
466
+ ```
467
+ SHOPIFY_APP_DISABLE_WEBPACKER=1 rails generate shopify_app
468
+ ```
469
+
470
+ and then in your ShopifyApp configuration block, add
471
+
472
+ ```
473
+ ShopifyApp.configure do |config|
474
+ config.disable_webpacker = true
475
+ end
476
+ ```
460
477
 
461
478
  Upgrading from 8.6 to 9.0.0
462
479
  ---------------------------
@@ -4,20 +4,20 @@ cs:
4
4
  could_not_log_in: Nelze se přihlásit do obchodu Shopify
5
5
  invalid_shop_url: Neplatná doména obchodu
6
6
  enable_cookies_heading: Zapnout soubory cookie z aplikace %{app}
7
- enable_cookies_body: Pokud chceš v Shopify používat aplikaci %{app}, musíš soubory
7
+ enable_cookies_body: Pokud chcete v Shopify používat aplikaci %{app}, musíte soubory
8
8
  cookie v tomto prohlížeči povolit ručně.
9
- enable_cookies_footer: Soubory cookie umožňují, aby aplikace ověřila pomocí dočasného
10
- uchování preferencí a osobních údajů. Jejich platnost vyprší po 30 dnech.
9
+ enable_cookies_footer: Soubory cookie umožňují, aby vás aplikace ověřila pomocí
10
+ dočasného uchování preferencí a osobních údajů. Jejich platnost vyprší po 30 dnech.
11
11
  enable_cookies_action: Povolit soubory cookie
12
- top_level_interaction_heading: Tvůj prohlížeč potřebuje ověřit aplikaci %{app}
13
- top_level_interaction_body: Tvůj prohlížeč vyžaduje, aby si od tebe aplikace, jako
14
- je %{app}, nejdřív vyžádaly přístup k souborům cookie, než je pro tebe Shopify
12
+ top_level_interaction_heading: Váš prohlížeč potřebuje ověřit aplikaci %{app}
13
+ top_level_interaction_body: Váš prohlížeč vyžaduje, aby si od vás aplikace, jako
14
+ je %{app}, nejdřív vyžádaly přístup k souborům cookie, než je pro vás Shopify
15
15
  otevře.
16
16
  top_level_interaction_action: Pokračovat
17
17
  request_storage_access_heading: Aplikace %{app} potřebuje získat přístup k souborům
18
18
  cookie
19
- request_storage_access_body: Tato aplikace ti umožní ověření prostřednictvím dočasného
20
- uchování tvých osobních údajů. Pokud chceš používat tuto aplikaci, klikni na tlačítko
21
- Pokračovat a povol soubory cookie.
19
+ request_storage_access_body: Tato aplikace vám umožní ověření prostřednictvím dočasného
20
+ uchování vašich osobních údajů. Pokud chcete používat tuto aplikaci, klikněte
21
+ na tlačítko Pokračovat a povolte soubory cookie.
22
22
  request_storage_access_footer: Platnost souborů cookie vyprší po 30 dnech.
23
23
  request_storage_access_action: Pokračovat
@@ -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 persönlichen Informationen vorübergehend gespeichert werden.
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 persönlichen Informationen vorübergehend gespeichert werden.
20
- Klicken Sie auf "Weiter" und erlauben Sie den Cookies, die App zu verwenden.
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
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  es:
3
3
  logged_out: Cerrar sesión
4
- could_not_log_in: No se pudo iniciar sesión en tu tienda de Shopify
4
+ could_not_log_in: No se pudo iniciar sesión en tu tienda Shopify
5
5
  invalid_shop_url: Dominio de tienda inválido
6
6
  enable_cookies_heading: Habilitar cookies de %{app}
7
7
  enable_cookies_body: Debes habilitar manualmente las cookies en este navegador para
@@ -4,17 +4,17 @@ nl:
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: Je moet cookies in deze browser handmatig inschakelen om %{app}
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 je verifiëren door je voorkeuren en
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: Je browser moet %{app} verifiëren
13
- top_level_interaction_body: Je browser heeft apps nodig zoals %{app} om je toegang
14
- te vragen tot cookies voordat Shopify het voor je kan openen.
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 je verifiëren door je persoonlijke
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.
@@ -1,15 +1,14 @@
1
1
  ---
2
2
  pt-BR:
3
- logged_out: Você saiu com sucesso
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: Ativar cookies de %{app}
7
- enable_cookies_body: Você deve ativar manualmente os cookies neste navegador para
8
- usar %{app} dentro da Shopify.
9
- enable_cookies_footer: Os cookies permitem que o aplicativo o autentique armazenando
10
- temporariamente suas preferências e informações pessoais. Eles expiram depois
11
- de 30 dias.
12
- enable_cookies_action: Ativar cookies
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
+ enable_cookies_footer: Os cookies permitem que o app o autentique armazenando temporariamente
10
+ suas preferências e dados pessoais. Eles expiram depois de 30 dias.
11
+ enable_cookies_action: Habilitar cookies
13
12
  top_level_interaction_heading: Seu navegador precisa autenticar %{app}
14
13
  top_level_interaction_body: Seu navegador exige que apps como o %{app} consultem
15
14
  você sobre o acesso a cookies antes que a Shopify os abra.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  zh-CN:
3
- logged_out: 已成功注销
3
+ logged_out: 已成功退出
4
4
  could_not_log_in: 无法登录到 Shopify 商店
5
5
  invalid_shop_url: 商店域名无效
6
6
  enable_cookies_heading: 从 %{app} 启用 Cookie
@@ -26,6 +26,7 @@ module.exports = function(config) {
26
26
  preprocessors: {
27
27
  'test/javascripts/**/*test.js': ['webpack'],
28
28
  },
29
+ webpack: {},
29
30
  reporters: karmaReporters,
30
31
  port: 9876,
31
32
  colors: true,
@@ -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
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ class MarketingActivitiesController < ExtensionVerificationController
4
+ def preload_form_data
5
+ preload_data = {
6
+ "form_data": {
7
+ "budget": {
8
+ "currency": "USD",
9
+ }
10
+ }
11
+ }
12
+ render(json: preload_data, status: :ok)
13
+ end
14
+
15
+ def update
16
+ render(json: {}, status: :accepted)
17
+ end
18
+
19
+ def pause
20
+ render(json: {}, status: :accepted)
21
+ end
22
+
23
+ def resume
24
+ render(json: {}, status: :accepted)
25
+ end
26
+
27
+ def delete
28
+ render(json: {}, status: :accepted)
29
+ end
30
+
31
+ def preview
32
+ placeholder_img = "https://cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_small.png"
33
+ preview_response = {
34
+ "desktop": {
35
+ "preview_url": placeholder_img,
36
+ "content_type": "text/html",
37
+ "width": 360,
38
+ "height": 200
39
+ },
40
+ "mobile": {
41
+ "preview_url": placeholder_img,
42
+ "content_type": "text/html",
43
+ "width": 360,
44
+ "height": 200
45
+ }
46
+ }
47
+ render(json: preview_response, status: :ok)
48
+ end
49
+
50
+ def create
51
+ render(json: {}, status: :ok)
52
+ end
53
+
54
+ def republish
55
+ render(json: {}, status: :accepted)
56
+ end
57
+
58
+ def errors
59
+ request_id = params[:request_id]
60
+ message = params[:message]
61
+
62
+ Rails.logger.info("[Marketing Activity App Error Feedback] Request id: #{request_id}, message: #{message}")
63
+
64
+ render(json: {}, status: :ok)
65
+ end
66
+ end
@@ -40,12 +40,19 @@ module ShopifyApp
40
40
  end
41
41
 
42
42
  def create_embedded_app_layout
43
- if embedded_app?
44
- copy_file 'embedded_app.html.erb', 'app/views/layouts/embedded_app.html.erb'
43
+ return unless embedded_app?
44
+
45
+ copy_file 'embedded_app.html.erb', 'app/views/layouts/embedded_app.html.erb'
46
+ copy_file '_flash_messages.html.erb', 'app/views/layouts/_flash_messages.html.erb'
47
+
48
+ if ShopifyApp.use_webpacker?
49
+ copy_file('shopify_app.js', 'app/javascript/shopify_app/shopify_app.js')
50
+ copy_file('flash_messages.js', 'app/javascript/shopify_app/flash_messages.js')
51
+ copy_file('shopify_app_index.js', 'app/javascript/shopify_app/index.js')
52
+ append_to_file('app/javascript/packs/application.js', 'require("shopify_app")')
53
+ else
45
54
  copy_file('shopify_app.js', 'app/assets/javascripts/shopify_app.js')
46
- copy_file '_flash_messages.html.erb', 'app/views/layouts/_flash_messages.html.erb'
47
- copy_file('flash_messages.js',
48
- 'app/assets/javascripts/flash_messages.js')
55
+ copy_file('flash_messages.js', 'app/assets/javascripts/flash_messages.js')
49
56
  end
50
57
  end
51
58
 
@@ -57,6 +64,14 @@ module ShopifyApp
57
64
  route "mount ShopifyApp::Engine, at: '/'"
58
65
  end
59
66
 
67
+ def insert_hosts_into_development_config
68
+ inject_into_file(
69
+ 'config/environments/development.rb',
70
+ " config.hosts = (config.hosts rescue []) << /\\h+.ngrok.io/\n",
71
+ after: "Rails.application.configure do\n"
72
+ )
73
+ end
74
+
60
75
  private
61
76
 
62
77
  def embedded_app?
@@ -5,7 +5,11 @@
5
5
  <% application_name = ShopifyApp.configuration.application_name %>
6
6
  <title><%= application_name %></title>
7
7
  <%= stylesheet_link_tag 'application' %>
8
- <%= javascript_include_tag 'application', "data-turbolinks-track" => true %>
8
+ <% if ShopifyApp.use_webpacker? %>
9
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
10
+ <% else %>
11
+ <%= javascript_include_tag 'application', "data-turbolinks-track" => true %>
12
+ <% end %>
9
13
  <%= csrf_meta_tags %>
10
14
  </head>
11
15
 
@@ -0,0 +1,2 @@
1
+ require('./shopify_app')
2
+ require('./flash_messages')
@@ -4,32 +4,47 @@ require 'shopify_app/version'
4
4
  require 'shopify_api'
5
5
  require 'omniauth-shopify-oauth2'
6
6
 
7
- # config
8
- require 'shopify_app/configuration'
9
-
10
- # engine
11
- require 'shopify_app/engine'
12
-
13
- # utils
14
- require 'shopify_app/utils'
15
-
16
- # controller concerns
17
- require 'shopify_app/controller_concerns/localization'
18
- require 'shopify_app/controller_concerns/itp'
19
- require 'shopify_app/controller_concerns/login_protection'
20
- require 'shopify_app/controller_concerns/embedded_app'
21
- require 'shopify_app/controller_concerns/webhook_verification'
22
- require 'shopify_app/controller_concerns/app_proxy_verification'
23
-
24
- # jobs
25
- require 'shopify_app/jobs/webhooks_manager_job'
26
- require 'shopify_app/jobs/scripttags_manager_job'
27
-
28
- # managers
29
- require 'shopify_app/managers/webhooks_manager'
30
- require 'shopify_app/managers/scripttags_manager'
31
-
32
- # session
33
- require 'shopify_app/session/session_storage'
34
- require 'shopify_app/session/session_repository'
35
- require 'shopify_app/session/in_memory_session_store'
7
+ module ShopifyApp
8
+ def self.rails6?
9
+ Rails::VERSION::MAJOR >= 6
10
+ end
11
+
12
+ def self.use_webpacker?
13
+ rails6? &&
14
+ defined?(Webpacker) == 'constant' &&
15
+ !configuration.disable_webpacker
16
+ end
17
+
18
+ # config
19
+ require 'shopify_app/configuration'
20
+
21
+ # engine
22
+ require 'shopify_app/engine'
23
+
24
+ # utils
25
+ require 'shopify_app/utils'
26
+
27
+ # controllers
28
+ require 'shopify_app/controllers/extension_verification_controller'
29
+
30
+ # controller concerns
31
+ require 'shopify_app/controller_concerns/localization'
32
+ require 'shopify_app/controller_concerns/itp'
33
+ require 'shopify_app/controller_concerns/login_protection'
34
+ require 'shopify_app/controller_concerns/embedded_app'
35
+ require 'shopify_app/controller_concerns/webhook_verification'
36
+ require 'shopify_app/controller_concerns/app_proxy_verification'
37
+
38
+ # jobs
39
+ require 'shopify_app/jobs/webhooks_manager_job'
40
+ require 'shopify_app/jobs/scripttags_manager_job'
41
+
42
+ # managers
43
+ require 'shopify_app/managers/webhooks_manager'
44
+ require 'shopify_app/managers/scripttags_manager'
45
+
46
+ # session
47
+ require 'shopify_app/session/session_storage'
48
+ require 'shopify_app/session/session_repository'
49
+ require 'shopify_app/session/in_memory_session_store'
50
+ end
@@ -28,6 +28,9 @@ module ShopifyApp
28
28
  # configure myshopify domain for local shopify development
29
29
  attr_accessor :myshopify_domain
30
30
 
31
+ # ability to have webpacker installed but not used in this gem and the generators
32
+ attr_accessor :disable_webpacker
33
+
31
34
  # allow namespacing webhook jobs
32
35
  attr_accessor :webhook_jobs_namespace
33
36
 
@@ -36,6 +39,7 @@ module ShopifyApp
36
39
  @myshopify_domain = 'myshopify.com'
37
40
  @scripttags_manager_queue_name = Rails.application.config.active_job.queue_name
38
41
  @webhooks_manager_queue_name = Rails.application.config.active_job.queue_name
42
+ @disable_webpacker = ENV['SHOPIFY_APP_DISABLE_WEBPACKER'].present?
39
43
  end
40
44
 
41
45
  def login_url