shopify_app 11.3.2 → 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: 7a2e346cf0c508085dd5d60b57b0cd7d64447560c1e65bbcaf95ea9de8f4ddbb
4
- data.tar.gz: dbcd5d391c0d9a35c431991f3485a9b38176d77769d9b1037662de038bc054dd
3
+ metadata.gz: '097ed8c5a4e2712571c38ab110dba580e6c80dd6af95d04414d489e16366653f'
4
+ data.tar.gz: 7f95f2cd5100b9952cef6a40b68cb778bfa4be6753f9693f7c6ff6df18615014
5
5
  SHA512:
6
- metadata.gz: '094aded9b3d41dede60d7deb2f63646c04e0c16a65ac56f7a65b15764bf3fe3e391d21cbc797022320747360a564810c8c43404893a725c90b1e53159aa15001'
7
- data.tar.gz: 2b674e58c2a0862651cc4415d726fc34eb2b82255b1b9432c1351c32a7a38c13aee82a30ad41eb209a32d86895be699ebe3fa9639ddeeb55b71fc00f09183679
6
+ metadata.gz: '08c2495dac07fc430e8583c196e06af804905b3de7d6e7d7eed4bcc29a131d635caacc82f4a0619b7f7170be77d2069df6602379d413eb1f273a64dd9c79486d'
7
+ data.tar.gz: 3a559f4426151c91fd16eb1125a8b910a68ac4abe1b6601a5234a1e3c91969d4227eca31acae7a27171c0c0004cd8af1e17f6e9aebac60957119f4f211d895b4
@@ -1,3 +1,7 @@
1
+ 11.4.0
2
+ -----
3
+ * Remove `dotenv-rails` dependency. [#835](https://github.com/Shopify/shopify_app/pull/835)
4
+
1
5
  11.3.2
2
6
  -----
3
7
  * Fix hosts generator in Rails 5 [#823](https://github.com/Shopify/shopify_app/pull/823)
@@ -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.
@@ -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
@@ -24,6 +24,9 @@ module ShopifyApp
24
24
  # utils
25
25
  require 'shopify_app/utils'
26
26
 
27
+ # controllers
28
+ require 'shopify_app/controllers/extension_verification_controller'
29
+
27
30
  # controller concerns
28
31
  require 'shopify_app/controller_concerns/localization'
29
32
  require 'shopify_app/controller_concerns/itp'
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ExtensionVerificationController < ActionController::Base
4
+ before_action :verify_request
5
+
6
+ private
7
+
8
+ def verify_request
9
+ hmac_header = request.headers['HTTP_X_SHOPIFY_HMAC_SHA256']
10
+ request_body = request.body.read
11
+ secret = ShopifyApp.configuration.secret
12
+ digest = OpenSSL::Digest.new('sha256')
13
+
14
+ expected_hmac = Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret, request_body))
15
+ head(:unauthorized) unless ActiveSupport::SecurityUtils.secure_compare(expected_hmac, hmac_header)
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module ShopifyApp
2
- VERSION = '11.3.2'.freeze
2
+ VERSION = '11.4.0'.freeze
3
3
  end
@@ -14,7 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.add_runtime_dependency('rails', '> 5.2.1')
15
15
  s.add_runtime_dependency('shopify_api', '~> 8.0')
16
16
  s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.0')
17
- s.add_runtime_dependency('dotenv-rails', '~> 2.7.5')
18
17
 
19
18
  s.add_development_dependency('rake')
20
19
  s.add_development_dependency('byebug')
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: 11.3.2
4
+ version: 11.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-21 00:00:00.000000000 Z
11
+ date: 2019-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser_sniffer
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.2.0
69
- - !ruby/object:Gem::Dependency
70
- name: dotenv-rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 2.7.5
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 2.7.5
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rake
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -253,6 +239,8 @@ files:
253
239
  - karma.conf.js
254
240
  - lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb
255
241
  - lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb
242
+ - lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
243
+ - lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb
256
244
  - lib/generators/shopify_app/add_webhook/add_webhook_generator.rb
257
245
  - lib/generators/shopify_app/add_webhook/templates/webhook_job.rb
258
246
  - lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb
@@ -296,6 +284,7 @@ files:
296
284
  - lib/shopify_app/controller_concerns/localization.rb
297
285
  - lib/shopify_app/controller_concerns/login_protection.rb
298
286
  - lib/shopify_app/controller_concerns/webhook_verification.rb
287
+ - lib/shopify_app/controllers/extension_verification_controller.rb
299
288
  - lib/shopify_app/engine.rb
300
289
  - lib/shopify_app/jobs/scripttags_manager_job.rb
301
290
  - lib/shopify_app/jobs/webhooks_manager_job.rb