shopify_app 13.2.0 → 20.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/ISSUE_TEMPLATE/bug-report.md +63 -0
  4. data/.github/ISSUE_TEMPLATE/config.yml +1 -0
  5. data/.github/ISSUE_TEMPLATE/feature-request.md +33 -0
  6. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  7. data/.github/workflows/build.yml +40 -0
  8. data/.github/workflows/cla.yml +22 -0
  9. data/.github/workflows/close-waiting-for-response-issues.yml +20 -0
  10. data/.github/workflows/release.yml +24 -0
  11. data/.github/workflows/remove-labels-on-activity.yml +16 -0
  12. data/.github/workflows/rubocop.yml +22 -0
  13. data/.github/workflows/stale.yml +31 -0
  14. data/.gitignore +1 -2
  15. data/.nvmrc +1 -1
  16. data/.rubocop.yml +2 -0
  17. data/.ruby-version +1 -1
  18. data/CHANGELOG.md +221 -0
  19. data/CONTRIBUTING.md +81 -0
  20. data/Gemfile +5 -2
  21. data/Gemfile.lock +248 -0
  22. data/README.md +74 -563
  23. data/Rakefile +4 -3
  24. data/SECURITY.md +59 -0
  25. data/app/assets/images/storage_access.svg +1 -2
  26. data/app/assets/javascripts/shopify_app/app_bridge_3.1.1.js +10 -0
  27. data/app/assets/javascripts/shopify_app/app_bridge_redirect.js +22 -0
  28. data/app/assets/javascripts/shopify_app/app_bridge_utils_3.1.1.js +1 -0
  29. data/app/assets/javascripts/shopify_app/post_redirect.js +9 -0
  30. data/app/assets/javascripts/shopify_app/redirect.js +10 -14
  31. data/app/assets/javascripts/shopify_app/storage_access.js +5 -10
  32. data/app/assets/javascripts/shopify_app/top_level_interaction.js +1 -1
  33. data/app/controllers/concerns/shopify_app/authenticated.rb +4 -0
  34. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +39 -0
  35. data/app/controllers/concerns/shopify_app/require_known_shop.rb +48 -0
  36. data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +40 -0
  37. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  38. data/app/controllers/shopify_app/callback_controller.rb +56 -77
  39. data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
  40. data/app/controllers/shopify_app/sessions_controller.rb +33 -117
  41. data/app/controllers/shopify_app/webhooks_controller.rb +5 -26
  42. data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
  43. data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
  44. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
  45. data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
  46. data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
  47. data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
  48. data/app/views/shopify_app/sessions/enable_cookies.html.erb +2 -7
  49. data/app/views/shopify_app/sessions/new.html.erb +38 -110
  50. data/app/views/shopify_app/sessions/request_storage_access.html.erb +12 -12
  51. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +21 -22
  52. data/app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb +13 -0
  53. data/app/views/shopify_app/shared/redirect.html.erb +2 -2
  54. data/config/locales/de.yml +11 -11
  55. data/config/locales/ja.yml +4 -4
  56. data/config/locales/nl.yml +2 -2
  57. data/config/locales/th.yml +4 -4
  58. data/config/locales/vi.yml +22 -0
  59. data/config/locales/zh-CN.yml +2 -2
  60. data/config/routes.rb +20 -12
  61. data/docs/Quickstart.md +19 -83
  62. data/docs/Releasing.md +18 -15
  63. data/docs/Troubleshooting.md +140 -5
  64. data/docs/Upgrading.md +247 -0
  65. data/docs/shopify_app/authentication.md +128 -0
  66. data/docs/shopify_app/content-security-policy.md +10 -0
  67. data/docs/shopify_app/engine.md +82 -0
  68. data/docs/shopify_app/generators.md +127 -0
  69. data/docs/shopify_app/handling-access-scopes-changes.md +24 -0
  70. data/docs/shopify_app/script-tags.md +28 -0
  71. data/docs/shopify_app/session-repository.md +88 -0
  72. data/docs/shopify_app/testing.md +38 -0
  73. data/docs/shopify_app/webhooks.md +72 -0
  74. data/karma.conf.js +1 -1
  75. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +10 -9
  76. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  77. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +4 -3
  78. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +15 -14
  79. data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt +9 -1
  80. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +7 -6
  81. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +2 -1
  82. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +1 -1
  83. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +4 -4
  84. data/lib/generators/shopify_app/controllers/controllers_generator.rb +5 -4
  85. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +27 -4
  86. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +12 -2
  87. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +74 -16
  88. data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +16 -0
  89. data/lib/generators/shopify_app/install/install_generator.rb +52 -40
  90. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +5 -2
  91. data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
  92. data/lib/generators/shopify_app/install/templates/session_store.rb +2 -1
  93. data/lib/generators/shopify_app/install/templates/shopify_app.js +1 -1
  94. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +43 -5
  95. data/lib/generators/shopify_app/install/templates/shopify_app_importmap.js +13 -0
  96. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
  97. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
  98. data/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb +4 -4
  99. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -0
  100. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +1 -1
  101. data/lib/generators/shopify_app/routes/routes_generator.rb +6 -5
  102. data/lib/generators/shopify_app/routes/templates/routes.rb +5 -5
  103. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +35 -7
  104. data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +5 -0
  105. data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
  106. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  107. data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +5 -0
  108. data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
  109. data/lib/generators/shopify_app/user_model/user_model_generator.rb +35 -7
  110. data/lib/generators/shopify_app/views/views_generator.rb +5 -4
  111. data/lib/shopify_app/access_scopes/noop_strategy.rb +13 -0
  112. data/lib/shopify_app/access_scopes/shop_strategy.rb +24 -0
  113. data/lib/shopify_app/access_scopes/user_strategy.rb +41 -0
  114. data/lib/shopify_app/configuration.rb +58 -11
  115. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +4 -4
  116. data/lib/shopify_app/controller_concerns/csrf_protection.rb +16 -0
  117. data/lib/shopify_app/controller_concerns/embedded_app.rb +6 -3
  118. data/lib/shopify_app/controller_concerns/ensure_billing.rb +243 -0
  119. data/lib/shopify_app/controller_concerns/frame_ancestors.rb +16 -0
  120. data/lib/shopify_app/controller_concerns/itp.rb +3 -3
  121. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  122. data/lib/shopify_app/controller_concerns/login_protection.rb +105 -90
  123. data/lib/shopify_app/controller_concerns/payload_verification.rb +25 -0
  124. data/lib/shopify_app/controller_concerns/redirect_for_embedded.rb +36 -0
  125. data/lib/shopify_app/controller_concerns/sanitized_params.rb +36 -0
  126. data/lib/shopify_app/controller_concerns/webhook_verification.rb +3 -18
  127. data/lib/shopify_app/engine.rb +26 -11
  128. data/lib/shopify_app/errors.rb +34 -0
  129. data/lib/shopify_app/jobs/scripttags_manager_job.rb +2 -2
  130. data/lib/shopify_app/jobs/webhooks_manager_job.rb +4 -5
  131. data/lib/shopify_app/managers/scripttags_manager.rb +12 -6
  132. data/lib/shopify_app/managers/webhooks_manager.rb +62 -42
  133. data/lib/shopify_app/middleware/jwt_middleware.rb +6 -3
  134. data/lib/shopify_app/session/in_memory_session_store.rb +2 -3
  135. data/lib/shopify_app/session/in_memory_shop_session_store.rb +10 -7
  136. data/lib/shopify_app/session/in_memory_user_session_store.rb +10 -7
  137. data/lib/shopify_app/session/jwt.rb +19 -16
  138. data/lib/shopify_app/session/null_user_session_store.rb +2 -1
  139. data/lib/shopify_app/session/session_repository.rb +40 -2
  140. data/lib/shopify_app/session/session_storage.rb +4 -6
  141. data/lib/shopify_app/session/shop_session_storage.rb +6 -6
  142. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +57 -0
  143. data/lib/shopify_app/session/user_session_storage.rb +20 -7
  144. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +71 -0
  145. data/lib/shopify_app/test_helpers/all.rb +2 -1
  146. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +4 -3
  147. data/lib/shopify_app/utils.rb +14 -7
  148. data/lib/shopify_app/version.rb +2 -1
  149. data/lib/shopify_app.rb +52 -29
  150. data/package.json +7 -8
  151. data/service.yml +1 -5
  152. data/shopify_app.gemspec +22 -20
  153. data/translation.yml +1 -1
  154. data/yarn.lock +2173 -2206
  155. metadata +110 -56
  156. data/.github/ISSUE_TEMPLATE.md +0 -14
  157. data/.github/probots.yml +0 -2
  158. data/.travis.yml +0 -28
  159. data/config/locales/hi.yml +0 -23
  160. data/config/locales/ms.yml +0 -22
  161. data/docs/install-on-dev-shop.png +0 -0
  162. data/docs/test-your-app.png +0 -0
  163. data/lib/generators/shopify_app/install/templates/omniauth.rb +0 -3
  164. data/lib/generators/shopify_app/install/templates/shopify_provider.rb +0 -20
  165. data/lib/generators/shopify_app/install/templates/user_agent.rb +0 -6
  166. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +0 -34
  167. data/package-lock.json +0 -7245
@@ -1,37 +1,16 @@
1
1
  # frozen_string_literal: true
2
- module ShopifyApp
3
- class MissingWebhookJobError < StandardError; end
4
2
 
3
+ module ShopifyApp
5
4
  class WebhooksController < ActionController::Base
6
5
  include ShopifyApp::WebhookVerification
7
6
 
8
7
  def receive
9
8
  params.permit!
10
- job_args = { shop_domain: shop_domain, webhook: webhook_params.to_h }
11
- webhook_job_klass.perform_later(job_args)
12
- head(:ok)
13
- end
14
-
15
- private
16
-
17
- def webhook_params
18
- params.except(:controller, :action, :type)
19
- end
20
9
 
21
- def webhook_job_klass
22
- webhook_job_klass_name.safe_constantize || raise(ShopifyApp::MissingWebhookJobError)
23
- end
24
-
25
- def webhook_job_klass_name(type = webhook_type)
26
- [webhook_namespace, "#{type}_job"].compact.join('/').classify
27
- end
28
-
29
- def webhook_type
30
- params[:type]
31
- end
32
-
33
- def webhook_namespace
34
- ShopifyApp.configuration.webhook_jobs_namespace
10
+ ShopifyAPI::Webhooks::Registry.process(
11
+ ShopifyAPI::Webhooks::Request.new(raw_body: request.raw_post, headers: request.headers.to_h)
12
+ )
13
+ head(:ok)
35
14
  end
36
15
  end
37
16
  end
@@ -1,6 +1,5 @@
1
1
  <style>
2
2
  .Polaris-Button {
3
- fill:#637381;
4
3
  position:relative;
5
4
  display:-webkit-inline-box;
6
5
  display:-ms-inline-flexbox;
@@ -15,12 +14,14 @@
15
14
  min-width:3.6rem;
16
15
  margin:0;
17
16
  padding:0.7rem 1.6rem;
18
- background:linear-gradient(to bottom, white, #f9fafb);
19
- border:1px solid #c4cdd5;
20
- box-shadow:0 1px 0 0 rgba(22, 29, 37, 0.05);
21
- border-radius:3px;
17
+ background-color:#ffffff;
18
+ border:1px solid #babfc3;
19
+ border-top-color: #c9cccf;
20
+ border-bottom-color: #babfc4;
21
+ box-shadow:0 1px 0 0 rgba(0, 0, 0, 0.05);
22
+ border-radius:4px;
22
23
  line-height:1;
23
- color:#212b36;
24
+ color:#202223;
24
25
  text-align:center;
25
26
  cursor:pointer;
26
27
  -webkit-user-select:none;
@@ -29,30 +30,44 @@
29
30
  user-select:none;
30
31
  text-decoration:none;
31
32
  transition-property:background, border, box-shadow;
32
- transition-duration:200ms;
33
+ transition-duration:100ms;
33
34
  transition-timing-function:cubic-bezier(0.64, 0, 0.35, 1);
34
35
  }
35
36
 
36
37
  .Polaris-Button:hover {
37
- background:linear-gradient(to bottom, #f9fafb, #f4f6f8);
38
- border-color:#c4cdd5;
38
+ background-color:#f6f6f7;
39
39
  }
40
40
 
41
41
  .Polaris-Button:focus {
42
- border-color:#5c6ac4;
43
42
  outline:0;
44
- box-shadow:0 0 0 1px #5c6ac4;
43
+ }
44
+
45
+ .Polaris-Button:focus:after {
46
+ box-shadow:0 0 0 .2rem #448fff;
47
+ }
48
+
49
+ .Polaris-Button:after {
50
+ content:'';
51
+ position:absolute;
52
+ z-index:1;
53
+ top:-.2rem;
54
+ right:-.2rem;
55
+ bottom:-.2rem;
56
+ left:-.2rem;
57
+ display:block;
58
+ pointer-events:none;
59
+ box-shadow:0 0 0 -.2rem #448fff;
60
+ transition:box-shadow 100ms cubic-bezier(0.64, 0, 0.35, 1);
61
+ border-radius:5px;
45
62
  }
46
63
 
47
64
  .Polaris-Button:active {
48
- background:linear-gradient(to bottom, #f4f6f8, #f4f6f8);
49
- border-color:#c4cdd5;
50
- box-shadow:0 0 0 0 transparent, inset 0 1px 1px 0 rgba(99, 115, 129, 0.1), inset 0 1px 4px 0 rgba(99, 115, 129, 0.2);
65
+ background-color:#f1f2f3);
51
66
  }
52
67
 
53
68
  .Polaris-Button__Content {
54
- font-size:1.5rem;
55
- font-weight:400;
69
+ font-size:1.4rem;
70
+ font-weight:500;
56
71
  line-height:1.6rem;
57
72
  text-transform:initial;
58
73
  letter-spacing:initial;
@@ -70,35 +85,25 @@
70
85
  min-height:1px;
71
86
  }
72
87
 
73
- @media (min-width: 40em) {
74
- .Polaris-Button__Content {
75
- font-size:1.4rem;
76
- }
77
- }
78
-
79
88
  .Polaris-Button--primary {
80
- background:linear-gradient(to bottom, #6371c7, #5563c1);
81
- border-color:#3f4eae;
82
- box-shadow:inset 0 1px 0 0 #6774c8, 0 1px 0 0 rgba(22, 29, 37, 0.05), 0 0 0 0 transparent;
89
+ background-color:#008060;
90
+ border-color:transparent;
91
+ border-width:0;
83
92
  color:white;
84
- fill:white;
85
93
  }
86
94
 
87
95
  .Polaris-Button--primary:hover {
88
- background:linear-gradient(to bottom, #5c6ac4, #4959bd);
89
- border-color:#3f4eae;
96
+ background-color:#006e52;
97
+ border-color:transparent;
90
98
  color:white;
91
- text-decoration:none;
92
99
  }
93
100
 
94
- .Polaris-Button--primary:focus {
95
- border-color:#202e78;
96
- box-shadow:inset 0 1px 0 0 #6f7bcb, 0 1px 0 0 rgba(22, 29, 37, 0.05), 0 0 0 1px #202e78;
101
+ .Polaris-Button--primary:active {
102
+ background-color:#005e46;
103
+ border-color:transparent;
97
104
  }
98
105
 
99
- .Polaris-Button--primary:active {
100
- background:linear-gradient(to bottom, #3f4eae, #3f4eae);
101
- border-color:#38469b;
102
- box-shadow:inset 0 0 0 0 transparent, 0 1px 0 0 rgba(22, 29, 37, 0.05), 0 0 1px 0 #38469b;
106
+ .Polaris-Button--sizeLarge {
107
+ padding:1.1rem 2.4rem;
103
108
  }
104
109
  </style>
@@ -11,7 +11,7 @@
11
11
 
12
12
  @media (min-width: 30.625em) {
13
13
  .Polaris-Card {
14
- border-radius:3px;
14
+ border-radius:8px;
15
15
  }
16
16
  }
17
17
 
@@ -24,10 +24,10 @@
24
24
  }
25
25
 
26
26
  .Polaris-Card__Section + .Polaris-Card__Section {
27
- border-top:1px solid #dfe3e8;
27
+ border-top:.1rem solid #e4e5e7;
28
28
  }
29
29
 
30
30
  .Polaris-Card__Section--subdued {
31
- background-color:#f9fafb;
31
+ background-color:#fafbfb;
32
32
  }
33
33
  </style>
@@ -11,8 +11,8 @@
11
11
  -ms-flex-align:center;
12
12
  align-items:center;
13
13
  width:100%;
14
- margin:2rem auto 0 auto;
15
- padding:2rem 0;
14
+ margin:0 auto;
15
+ padding:2rem 0 6rem;
16
16
  max-width:99.8rem;
17
17
  }
18
18
 
@@ -24,33 +24,22 @@
24
24
  }
25
25
 
26
26
  .Polaris-EmptyState__Section {
27
- position:relative;
28
27
  display:-webkit-box;
29
28
  display:-ms-flexbox;
30
29
  display:flex;
31
30
  -webkit-box-orient:vertical;
32
- -webkit-box-direction:normal;
33
- -ms-flex-direction:column;
34
- flex-direction:column;
31
+ -webkit-box-direction:reverse;
32
+ -ms-flex-direction:column-reverse;
33
+ flex-direction:column-reverse;
35
34
  -webkit-box-flex:1;
36
35
  -ms-flex:1 1 auto;
37
36
  flex:1 1 auto;
37
+ -webkit-box-align:center;
38
+ -ms-flex-align:center;
39
+ align-items:center;
38
40
  width:100%;
39
41
  }
40
42
 
41
- @media (min-width: 46.5em) {
42
- .Polaris-EmptyState__Section {
43
- left:2rem;
44
- -webkit-box-orient:horizontal;
45
- -webkit-box-direction:normal;
46
- -ms-flex-direction:row;
47
- flex-direction:row;
48
- -webkit-box-align:center;
49
- -ms-flex-align:center;
50
- align-items:center;
51
- }
52
- }
53
-
54
43
  .Polaris-EmptyState__ImageContainer,
55
44
  .Polaris-EmptyState__DetailsContainer {
56
45
  -webkit-box-flex:1;
@@ -58,6 +47,7 @@
58
47
  flex:1 1 auto;
59
48
  padding:0;
60
49
  margin:0;
50
+ text-align:center;
61
51
  }
62
52
 
63
53
  @media (min-width: 46.5em) {
@@ -68,37 +58,32 @@
68
58
  }
69
59
  }
70
60
 
71
- @media (max-width: 30.625em) {
72
- .Polaris-EmptyState__ImageContainer,
73
- .Polaris-EmptyState__DetailsContainer {
74
- overflow-x:hidden;
75
- }
76
- }
77
-
78
61
  .Polaris-EmptyState__Details {
79
- position:relative;
80
- z-index:10;
81
- padding:0 1.6rem;
82
- width:33.6rem;
83
- }
84
-
85
- @media (min-width: 30.625em) {
86
- .Polaris-EmptyState__Details {
87
- padding:0;
88
- }
62
+ max-width:40rem;
63
+ display:-webkit-box;
64
+ display:-ms-flexbox;
65
+ display: flex;
66
+ -webkit-box-orient:vertical;
67
+ -webkit-box-direction:normal;
68
+ -ms-flex-direction:column;
69
+ flex-direction: column;
70
+ -webkit-box-align:center;
71
+ -ms-flex-align:center;
72
+ align-items: center;
89
73
  }
90
74
 
91
75
  .Polaris-EmptyState__Content {
92
- font-size:1.6rem;
76
+ margin-top: 1.6rem;
77
+ font-size:1.5rem;
93
78
  font-weight:400;
94
- line-height:2.4rem;
95
- color:#637381;
79
+ line-height:2rem;
80
+ color:#6d7175;
81
+ padding-bottom: .8rem;
96
82
  }
97
83
 
98
84
  @media (min-width: 40em) {
99
85
  .Polaris-EmptyState__Content {
100
- font-size:2rem;
101
- line-height:2.8rem;
86
+ font-size:1.4rem;
102
87
  }
103
88
  }
104
89
 
@@ -107,23 +92,7 @@
107
92
  }
108
93
 
109
94
  .Polaris-EmptyState__Image {
110
- display: none;
111
- }
112
-
113
- @media (min-width: 30.625em) {
114
- .Polaris-EmptyState__Image {
115
- display: block;
116
- margin-left:-60%;
117
- margin-top:-30%;
118
- width:200%;
119
- }
120
- }
121
-
122
- @media (min-width: 46.5em) {
123
- .Polaris-EmptyState__Image {
124
- margin-top:0;
125
- margin-left:-90%;
126
- width:200%;
127
- }
95
+ margin: 0;
96
+ width: auto;
128
97
  }
129
98
  </style>
@@ -0,0 +1,56 @@
1
+ <style>
2
+ .Polaris-Label {
3
+ margin-bottom:.4rem;
4
+ }
5
+
6
+ .Polaris-Label__Text {
7
+ -webkit-tap-highlight-color:transparent;
8
+ }
9
+
10
+ .Polaris-TextField {
11
+ position:relative;
12
+ margin-bottom:1.6rem;
13
+ }
14
+
15
+ .Polaris-TextField--InlineError {
16
+ margin-bottom:.4rem;
17
+ }
18
+
19
+ .Polaris-TextField__Input {
20
+ width:100%;
21
+ padding:.5rem 1.2rem;
22
+ border:1px solid #c9cccf;
23
+ border-top-color:#aeb4b9;
24
+ border-radius:4px;
25
+ box-shadow:none;
26
+ line-height:2.4rem;
27
+ }
28
+
29
+ .Polaris-TextField__Input:focus {
30
+ outline:none;
31
+ }
32
+
33
+ .Polaris-TextField__Backdrop:after {
34
+ content:'';
35
+ position:absolute;
36
+ z-index:1;
37
+ top:-.2rem;
38
+ right:-.2rem;
39
+ bottom:-.2rem;
40
+ left:-.2rem;
41
+ display:block;
42
+ pointer-events:none;
43
+ box-shadow:0 0 0 -.2rem #448fff;
44
+ transition:box-shadow .1s cubic-bezier(0.64, 0, 0.35, 1);
45
+ border-radius:5px;
46
+ }
47
+
48
+ .Polaris-TextField__Input:focus~.Polaris-TextField__Backdrop:after {
49
+ box-shadow:0 0 0 .2rem #448fff;
50
+ }
51
+
52
+ .Polaris-InlineError {
53
+ color:#d72c0d;
54
+ margin-bottom:1.6rem;
55
+ }
56
+ </style>
@@ -35,7 +35,7 @@
35
35
  min-height:100%;
36
36
  margin:0;
37
37
  padding:0;
38
- background-color:#f4f6f8;
38
+ background-color:#f6f6f7;
39
39
  }
40
40
 
41
41
  *,
@@ -61,6 +61,10 @@
61
61
  max-width:99.8rem;
62
62
  }
63
63
 
64
+ .Polaris-Page--InstallApp {
65
+ max-width: 70rem;
66
+ }
67
+
64
68
  @media (min-width: 30.625em) {
65
69
  .Polaris-Page {
66
70
  padding:0 2rem;
@@ -73,6 +77,7 @@
73
77
  }
74
78
 
75
79
  .Polaris-Page__Content {
80
+ width: 100%;
76
81
  margin:2rem 0;
77
82
  }
78
83
 
@@ -158,6 +163,16 @@
158
163
  justify-content:flex-end;
159
164
  }
160
165
 
166
+ .Polaris-Stack--distributionTrailingCustomSpacing {
167
+ margin-right:2rem;
168
+ }
169
+
170
+ @media (min-width: 30.625em) {
171
+ .Polaris-Stack--distributionTrailingCustomSpacing {
172
+ margin-right:0;
173
+ }
174
+ }
175
+
161
176
  .Polaris-Stack--vertical {
162
177
  -webkit-box-orient:vertical;
163
178
  -webkit-box-direction:normal;
@@ -16,16 +16,16 @@
16
16
  margin:0;
17
17
  }
18
18
 
19
- .Polaris-DisplayText--sizeMedium {
20
- font-size:2.1rem;
19
+ .Polaris-DisplayText--sizeSmall {
20
+ font-size:1.6rem;
21
21
  font-weight:400;
22
- line-height:2.8rem;
22
+ line-height:2.4rem;
23
23
  }
24
24
 
25
25
  @media (min-width: 40em) {
26
- .Polaris-DisplayText--sizeMedium {
27
- font-size:2.6rem;
28
- line-height:3.2rem;
26
+ .Polaris-DisplayText--sizeSmall {
27
+ font-size:2rem;
28
+ line-height:2.8rem;
29
29
  }
30
30
  }
31
31
 
@@ -14,15 +14,10 @@
14
14
  display: none;
15
15
  }
16
16
  </style>
17
- <script>
18
- window.apiKey = "<%= ShopifyApp.configuration.api_key %>";
19
- window.shopOrigin = "https://<%= @shop %>";
20
- window.returnTo = "<%= params[:return_to] %>"
21
- </script>
22
17
 
23
18
  <%= javascript_include_tag('shopify_app/enable_cookies', crossorigin: 'anonymous', integrity: true) %>
24
19
  </head>
25
- <body>
20
+ <body data-api-key="<%= ShopifyApp.configuration.api_key %>" data-shop-origin="<%= @shop %>" data-redirect-url="<%= @url %>" data-host="<%= params[:host] %>" data-return-to="<%= params[:return_to] %>">
26
21
  <%=
27
22
  content_tag(
28
23
  :div, nil,
@@ -57,7 +52,7 @@
57
52
  </div>
58
53
  </div>
59
54
  <div class="Polaris-Stack__Item">
60
- <div class="Polaris-Stack Polaris-Stack--distributionTrailing">
55
+ <div class="Polaris-Stack Polaris-Stack--distributionTrailing Polaris-Stack--distributionTrailingCustomSpacing">
61
56
  <div class="Polaris-Stack__Item">
62
57
  <button type="button" class="Polaris-Button Polaris-Button--primary" id="AcceptCookies">
63
58
  <span class="Polaris-Button__Content"><span><%= I18n.t('enable_cookies_action') %></span></span>
@@ -5,119 +5,47 @@
5
5
 
6
6
  <meta http-equiv="x-ua-compatible" content="ie=edge">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
-
9
- <style>
10
- * {
11
- -moz-box-sizing: border-box;
12
- -webkit-box-sizing: border-box;
13
- box-sizing: border-box;
14
- }
15
-
16
- body {
17
- padding: 2.5em 0;
18
- color: #212b37;
19
- font-family: -apple-system,BlinkMacSystemFont,San Francisco,Roboto,Segoe UI,Helvetica Neue,sans-serif;
20
- }
21
-
22
- .container {
23
- width: 100%;
24
- text-align: center;
25
- margin-left: auto;
26
- margin-right: auto;
27
- }
28
-
29
- @media screen and (min-width: 510px) {
30
- .container {
31
- width: 510px;
32
- }
33
- }
34
-
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;
42
- }
43
-
44
- .subtitle {
45
- font-size: 0.8em;
46
- font-weight: 500;
47
- color: #64737f;
48
- line-height: 2em;
49
- }
50
-
51
- .error {
52
- line-height: 1em;
53
- padding: 0.5em;
54
- color: red;
55
- }
56
-
57
- input.marketing-input {
58
- width: 100%;
59
- height: 52px;
60
- padding: 0 15px;
61
- box-shadow: 0 0 0 1px #ddd;
62
- border: 0;
63
- border-radius: 5px;
64
- background-color: #fff;
65
- font-size: 1em;
66
- margin-bottom: 15px;
67
- }
68
-
69
- input.marketing-input:focus {
70
- color: #000;
71
- outline: 0;
72
- box-shadow: 0 0 0 2px #5e6ebf;
73
- }
74
-
75
- button.marketing-button {
76
- display: inline-block;
77
- width: 100%;
78
- padding: 1.0625em 1.875em;
79
- background-color: #5e6ebf;
80
- color: #fff;
81
- font-weight: 700;
82
- font-size: 1em;
83
- text-align: center;
84
- outline: none;
85
- border: 0 solid transparent;
86
- border-radius: 5px;
87
- cursor: pointer;
88
- }
89
-
90
- button.marketing-button:hover {
91
- background: linear-gradient(to bottom, #5c6ac4, #4959bd);
92
- border-color: #3f4eae;
93
- }
94
-
95
- button.marketing-button:focus {
96
- box-shadow: 0 0 0.1875em 0.1875em rgba(94,110,191,0.5);
97
- background-color: #223274;
98
- color: #fff;
99
- }
100
- </style>
8
+ <%= render 'shopify_app/partials/layout_styles' %>
9
+ <%= render 'shopify_app/partials/typography_styles' %>
10
+ <%= render 'shopify_app/partials/card_styles' %>
11
+ <%= render 'shopify_app/partials/button_styles' %>
12
+ <%= render 'shopify_app/partials/form_styles' %>
101
13
  </head>
102
14
  <body>
103
-
104
15
  <main class="container" role="main">
105
- <% application_name = ShopifyApp.configuration.application_name %>
106
- <h3 class="title">
107
- <%= application_name.presence || 'Shopify App – Installation' %>
108
- </h3>
109
- <p class="subtitle">
110
- <label for="shop">Enter your shop domain to log in or install this app.</label>
111
- </p>
112
-
113
- <%= form_tag login_path do %>
114
- <% if flash[:error] %>
115
- <div class="error"><%= flash[:error] %></div>
116
- <% end %>
117
- <input id="shop" name="shop" type="text" autofocus="autofocus" placeholder="example.myshopify.com" class="marketing-input">
118
- <button type="submit" class="marketing-button">Install</button>
119
- <% end %>
16
+ <div class="Polaris-Page Polaris-Page--InstallApp">
17
+ <div class="Polaris-Page__Content">
18
+ <div class="Polaris-Layout">
19
+ <div class="Polaris-Layout__Section">
20
+ <div class="Polaris-Card">
21
+ <div class="Polaris-Card__Header">
22
+ <% application_name = ShopifyApp.configuration.application_name %>
23
+ <h1 class="Polaris-Heading">
24
+ <%= application_name.presence || 'Shopify App – Installation' %>
25
+ </h1>
26
+ </div>
27
+ <div class="Polaris-Card__Section">
28
+ <%= form_tag login_path do %>
29
+ <div class="Polaris-Label">
30
+ <label class="Polaris-Label__Text" for="shop">Enter your shop domain to log in or install this app.</label>
31
+ </div>
32
+ <div class="Polaris-TextField <%= 'Polaris-TextField--InlineError' if flash[:error]%>">
33
+ <input id="shop" name="shop" type="text" autofocus="autofocus" placeholder="example.myshopify.com" class="Polaris-TextField__Input">
34
+ <div class="Polaris-TextField__Backdrop"></div>
35
+ </div>
36
+ <% if flash[:error] %>
37
+ <div class="Polaris-InlineError"><%= flash[:error] %></div>
38
+ <% end %>
39
+ <button type="submit" class="Polaris-Button Polaris-Button--primary Polaris-Button--sizeLarge">
40
+ <span class="Polaris-Button__Content"><span>Install app</span>
41
+ </button>
42
+ <% end %>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
120
49
  </main>
121
-
122
50
  </body>
123
51
  </html>
@@ -15,19 +15,19 @@
15
15
  }
16
16
  </style>
17
17
  </head>
18
- <body>
18
+ <body data-api-key="<%= ShopifyApp.configuration.api_key %>" data-shop-origin="<%= current_shopify_domain %>" data-host="<%= params[:host] %>" data-return-to="<%= params[:return_to] %>">
19
19
  <%=
20
20
  content_tag(:div, nil,
21
- id: 'redirection-target',
22
- data: {
23
- target: {
24
- myshopifyUrl: "https://#{current_shopify_domain}",
25
- hasStorageAccessUrl: "#{has_storage_access_url}",
26
- doesNotHaveStorageAccessUrl: "#{does_not_have_storage_access_url}",
27
- appTargetUrl: "#{app_target_url}"
28
- },
29
- },
30
- )
21
+ id: 'redirection-target',
22
+ data: {
23
+ target: {
24
+ myshopifyUrl: "https://#{current_shopify_domain}",
25
+ hasStorageAccessUrl: "#{has_storage_access_url}",
26
+ doesNotHaveStorageAccessUrl: "#{does_not_have_storage_access_url}",
27
+ appTargetUrl: "#{app_target_url}"
28
+ },
29
+ },
30
+ )
31
31
  %>
32
32
  <main id="RequestStorageAccess">
33
33
  <div class="Polaris-Page">
@@ -49,7 +49,7 @@
49
49
  </div>
50
50
  </div>
51
51
  <div class="Polaris-Stack__Item">
52
- <div class="Polaris-Stack Polaris-Stack--distributionTrailing">
52
+ <div class="Polaris-Stack Polaris-Stack--distributionTrailing Polaris-Stack--distributionTrailingCustomSpacing">
53
53
  <div class="Polaris-Stack__Item">
54
54
  <button type="button" class="Polaris-Button Polaris-Button--primary" id="TriggerAllowCookiesPrompt">
55
55
  <span class="Polaris-Button__Content"><span><%= I18n.t('request_storage_access_action') %></span></span>