shopify_app 7.2.0 → 17.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +5 -5
  2. data/.babelrc +5 -0
  3. data/.github/CODEOWNERS +1 -0
  4. data/.github/ISSUE_TEMPLATE/bug-report.md +63 -0
  5. data/.github/ISSUE_TEMPLATE/config.yml +1 -0
  6. data/.github/ISSUE_TEMPLATE/feature-request.md +33 -0
  7. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  8. data/.github/probots.yml +2 -0
  9. data/.github/workflows/build.yml +38 -0
  10. data/.github/workflows/release.yml +24 -0
  11. data/.github/workflows/rubocop.yml +22 -0
  12. data/.gitignore +4 -1
  13. data/.nvmrc +1 -0
  14. data/.rubocop.yml +18 -0
  15. data/.ruby-version +1 -0
  16. data/CHANGELOG.md +465 -0
  17. data/CONTRIBUTING.md +76 -0
  18. data/Gemfile +7 -0
  19. data/Gemfile.lock +256 -0
  20. data/README.md +73 -288
  21. data/Rakefile +1 -0
  22. data/SECURITY.md +59 -0
  23. data/app/assets/images/storage_access.svg +1 -0
  24. data/app/assets/javascripts/shopify_app/enable_cookies.js +3 -0
  25. data/app/assets/javascripts/shopify_app/itp_helper.js +40 -0
  26. data/app/assets/javascripts/shopify_app/partition_cookies.js +8 -0
  27. data/app/assets/javascripts/shopify_app/redirect.js +33 -0
  28. data/app/assets/javascripts/shopify_app/request_storage_access.js +3 -0
  29. data/app/assets/javascripts/shopify_app/storage_access.js +154 -0
  30. data/app/assets/javascripts/shopify_app/storage_access_redirect.js +17 -0
  31. data/app/assets/javascripts/shopify_app/top_level.js +2 -0
  32. data/app/assets/javascripts/shopify_app/top_level_interaction.js +11 -0
  33. data/app/controllers/concerns/shopify_app/authenticated.rb +16 -0
  34. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +26 -0
  35. data/app/controllers/concerns/shopify_app/require_known_shop.rb +39 -0
  36. data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +32 -0
  37. data/app/controllers/shopify_app/authenticated_controller.rb +5 -5
  38. data/app/controllers/shopify_app/callback_controller.rb +196 -0
  39. data/app/controllers/shopify_app/extension_verification_controller.rb +15 -0
  40. data/app/controllers/shopify_app/sessions_controller.rb +190 -2
  41. data/app/controllers/shopify_app/webhooks_controller.rb +16 -7
  42. data/app/views/shopify_app/partials/_button_styles.html.erb +109 -0
  43. data/app/views/shopify_app/partials/_card_styles.html.erb +33 -0
  44. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +98 -0
  45. data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
  46. data/app/views/shopify_app/partials/_layout_styles.html.erb +182 -0
  47. data/app/views/shopify_app/partials/_typography_styles.html.erb +35 -0
  48. data/app/views/shopify_app/sessions/enable_cookies.html.erb +70 -0
  49. data/app/views/shopify_app/sessions/new.html.erb +39 -83
  50. data/app/views/shopify_app/sessions/request_storage_access.html.erb +68 -0
  51. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +63 -0
  52. data/app/views/shopify_app/shared/redirect.html.erb +23 -0
  53. data/config/locales/cs.yml +23 -0
  54. data/config/locales/da.yml +20 -0
  55. data/config/locales/de.yml +22 -0
  56. data/config/locales/en.yml +12 -1
  57. data/config/locales/es.yml +21 -3
  58. data/config/locales/fi.yml +20 -0
  59. data/config/locales/fr.yml +23 -0
  60. data/config/locales/hi.yml +23 -0
  61. data/config/locales/it.yml +21 -0
  62. data/config/locales/ja.yml +17 -0
  63. data/config/locales/ko.yml +19 -0
  64. data/config/locales/ms.yml +22 -0
  65. data/config/locales/nb.yml +21 -0
  66. data/config/locales/nl.yml +21 -0
  67. data/config/locales/pl.yml +21 -0
  68. data/config/locales/pt-BR.yml +21 -0
  69. data/config/locales/pt-PT.yml +22 -0
  70. data/config/locales/sv.yml +21 -0
  71. data/config/locales/th.yml +20 -0
  72. data/config/locales/tr.yml +22 -0
  73. data/config/locales/vi.yml +22 -0
  74. data/config/locales/zh-CN.yml +16 -0
  75. data/config/locales/zh-TW.yml +16 -0
  76. data/config/routes.rb +12 -1
  77. data/docs/Quickstart.md +31 -0
  78. data/docs/Releasing.md +21 -0
  79. data/docs/Troubleshooting.md +16 -0
  80. data/docs/Upgrading.md +110 -0
  81. data/docs/shopify_app/authentication.md +124 -0
  82. data/docs/shopify_app/engine.md +82 -0
  83. data/docs/shopify_app/generators.md +127 -0
  84. data/docs/shopify_app/handling-access-scopes-changes.md +8 -0
  85. data/docs/shopify_app/script-tags.md +28 -0
  86. data/docs/shopify_app/session-repository.md +88 -0
  87. data/docs/shopify_app/testing.md +38 -0
  88. data/docs/shopify_app/webhooks.md +72 -0
  89. data/karma.conf.js +44 -0
  90. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +47 -0
  91. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +11 -0
  92. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +40 -0
  93. data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +62 -0
  94. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +5 -4
  95. data/lib/generators/shopify_app/add_webhook/templates/{webhook_job.rb → webhook_job.rb.tt} +5 -0
  96. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +4 -3
  97. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +3 -3
  98. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +10 -9
  99. data/lib/generators/shopify_app/app_proxy_controller/templates/index.html.erb +2 -2
  100. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +15 -0
  101. data/lib/generators/shopify_app/authenticated_controller/templates/authenticated_controller.rb +5 -0
  102. data/lib/generators/shopify_app/controllers/controllers_generator.rb +2 -1
  103. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +31 -9
  104. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +6 -1
  105. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +70 -6
  106. data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +11 -0
  107. data/lib/generators/shopify_app/install/install_generator.rb +78 -27
  108. data/lib/generators/shopify_app/install/templates/_flash_messages.html.erb +1 -13
  109. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +12 -11
  110. data/lib/generators/shopify_app/install/templates/flash_messages.js +24 -0
  111. data/lib/generators/shopify_app/install/templates/omniauth.rb +3 -1
  112. data/lib/generators/shopify_app/install/templates/session_store.rb +4 -0
  113. data/lib/generators/shopify_app/install/templates/shopify_app.js +15 -0
  114. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +25 -0
  115. data/lib/generators/shopify_app/install/templates/shopify_app_index.js +2 -0
  116. data/lib/generators/shopify_app/install/templates/shopify_provider.rb.tt +8 -0
  117. data/lib/generators/shopify_app/install/templates/user_agent.rb +6 -0
  118. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
  119. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
  120. data/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb +16 -0
  121. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +17 -0
  122. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +42 -0
  123. data/lib/generators/shopify_app/routes/routes_generator.rb +1 -0
  124. data/lib/generators/shopify_app/routes/templates/routes.rb +10 -9
  125. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +42 -14
  126. data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +5 -0
  127. data/lib/generators/shopify_app/shop_model/templates/db/migrate/{create_shops.rb → create_shops.erb} +1 -1
  128. data/lib/generators/shopify_app/shop_model/templates/shop.rb +6 -2
  129. data/lib/generators/shopify_app/shopify_app_generator.rb +5 -3
  130. data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +5 -0
  131. data/lib/generators/shopify_app/user_model/templates/db/migrate/create_users.erb +16 -0
  132. data/lib/generators/shopify_app/user_model/templates/user.rb +8 -0
  133. data/lib/generators/shopify_app/user_model/templates/users.yml +4 -0
  134. data/lib/generators/shopify_app/user_model/user_model_generator.rb +70 -0
  135. data/lib/generators/shopify_app/views/views_generator.rb +2 -1
  136. data/lib/shopify_app/access_scopes/noop_strategy.rb +13 -0
  137. data/lib/shopify_app/access_scopes/shop_strategy.rb +24 -0
  138. data/lib/shopify_app/access_scopes/user_strategy.rb +41 -0
  139. data/lib/shopify_app/configuration.rb +69 -5
  140. data/lib/shopify_app/{app_proxy_verification.rb → controller_concerns/app_proxy_verification.rb} +4 -9
  141. data/lib/shopify_app/controller_concerns/csrf_protection.rb +15 -0
  142. data/lib/shopify_app/controller_concerns/embedded_app.rb +20 -0
  143. data/lib/shopify_app/controller_concerns/itp.rb +45 -0
  144. data/lib/shopify_app/controller_concerns/localization.rb +23 -0
  145. data/lib/shopify_app/controller_concerns/login_protection.rb +244 -0
  146. data/lib/shopify_app/controller_concerns/payload_verification.rb +24 -0
  147. data/lib/shopify_app/controller_concerns/webhook_verification.rb +23 -0
  148. data/lib/shopify_app/engine.rb +40 -0
  149. data/lib/shopify_app/jobs/scripttags_manager_job.rb +16 -0
  150. data/lib/shopify_app/{webhooks_manager_job.rb → jobs/webhooks_manager_job.rb} +3 -2
  151. data/lib/shopify_app/{scripttags_manager.rb → managers/scripttags_manager.rb} +25 -8
  152. data/lib/shopify_app/{webhooks_manager.rb → managers/webhooks_manager.rb} +6 -5
  153. data/lib/shopify_app/middleware/jwt_middleware.rb +42 -0
  154. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +34 -0
  155. data/lib/shopify_app/omniauth/omniauth_configuration.rb +64 -0
  156. data/lib/shopify_app/session/in_memory_session_store.rb +31 -0
  157. data/lib/shopify_app/session/in_memory_shop_session_store.rb +16 -0
  158. data/lib/shopify_app/session/in_memory_user_session_store.rb +16 -0
  159. data/lib/shopify_app/session/jwt.rb +63 -0
  160. data/lib/shopify_app/session/null_user_session_store.rb +22 -0
  161. data/lib/shopify_app/session/session_repository.rb +56 -0
  162. data/lib/shopify_app/session/session_storage.rb +20 -0
  163. data/lib/shopify_app/session/shop_session_storage.rb +42 -0
  164. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +58 -0
  165. data/lib/shopify_app/session/user_session_storage.rb +42 -0
  166. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +58 -0
  167. data/lib/shopify_app/test_helpers/all.rb +2 -0
  168. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +17 -0
  169. data/lib/shopify_app/utils.rb +24 -4
  170. data/lib/shopify_app/version.rb +2 -1
  171. data/lib/shopify_app.rb +65 -24
  172. data/package.json +27 -0
  173. data/service.yml +7 -0
  174. data/shipit.rubygems.yml +3 -0
  175. data/shopify_app.gemspec +20 -9
  176. data/translation.yml +7 -0
  177. data/webpack.config.js +24 -0
  178. data/yarn.lock +5215 -0
  179. metadata +274 -43
  180. data/.travis.yml +0 -17
  181. data/Gemfile.rails50 +0 -5
  182. data/Gemfile.ruby22 +0 -6
  183. data/Gemfile.ruby22.rails50 +0 -9
  184. data/ISSUE_TEMPLATE.md +0 -14
  185. data/QUICKSTART.md +0 -72
  186. data/RELEASING +0 -13
  187. data/lib/generators/shopify_app/home_controller/templates/shopify_app_ready_script.html.erb +0 -11
  188. data/lib/generators/shopify_app/install/templates/shopify_app.rb +0 -9
  189. data/lib/generators/shopify_app/install/templates/shopify_provider.rb +0 -4
  190. data/lib/generators/shopify_app/install/templates/shopify_session_repository.rb +0 -23
  191. data/lib/generators/shopify_app/shop_model/templates/shopify_session_repository.rb +0 -7
  192. data/lib/shopify_app/in_memory_session_store.rb +0 -25
  193. data/lib/shopify_app/login_protection.rb +0 -103
  194. data/lib/shopify_app/scripttags_manager_job.rb +0 -15
  195. data/lib/shopify_app/session_storage.rb +0 -23
  196. data/lib/shopify_app/sessions_concern.rb +0 -101
  197. data/lib/shopify_app/shop.rb +0 -15
  198. data/lib/shopify_app/shopify_session_repository.rb +0 -34
  199. data/lib/shopify_app/webhook_verification.rb +0 -39
@@ -0,0 +1,182 @@
1
+ <style>
2
+ html,
3
+ body {
4
+ min-height:100%;
5
+ height:100%;
6
+ font-size:1.5rem;
7
+ font-weight:400;
8
+ line-height:2rem;
9
+ text-transform:initial;
10
+ letter-spacing:initial;
11
+ font-weight:400;
12
+ color:#212b36;
13
+ font-family:-apple-system, BlinkMacSystemFont, San Francisco, Roboto, Segoe UI, Helvetica Neue, sans-serif;
14
+ }
15
+
16
+ @media (min-width: 40em) {
17
+ html,
18
+ body {
19
+ font-size:1.4rem;
20
+ }
21
+ }
22
+
23
+ html {
24
+ position:relative;
25
+ font-size:62.5%;
26
+ -webkit-font-smoothing:antialiased;
27
+ -moz-osx-font-smoothing:grayscale;
28
+ -webkit-text-size-adjust:100%;
29
+ -ms-text-size-adjust:100%;
30
+ text-size-adjust:100%;
31
+ text-rendering:optimizeLegibility;
32
+ }
33
+
34
+ body {
35
+ min-height:100%;
36
+ margin:0;
37
+ padding:0;
38
+ background-color:#f6f6f7;
39
+ }
40
+
41
+ *,
42
+ *::before,
43
+ *::after{
44
+ box-sizing:border-box; }
45
+
46
+ h1,
47
+ h2,
48
+ h3,
49
+ h4,
50
+ h5,
51
+ h6,
52
+ p {
53
+ margin:0;
54
+ font-size:1em;
55
+ font-weight:400;
56
+ }
57
+
58
+ .Polaris-Page {
59
+ margin:0 auto;
60
+ padding:0;
61
+ max-width:99.8rem;
62
+ }
63
+
64
+ .Polaris-Page--InstallApp {
65
+ max-width: 70rem;
66
+ }
67
+
68
+ @media (min-width: 30.625em) {
69
+ .Polaris-Page {
70
+ padding:0 2rem;
71
+ }
72
+ }
73
+ @media (min-width: 46.5em) {
74
+ .Polaris-Page {
75
+ padding:0 3.2rem;
76
+ }
77
+ }
78
+
79
+ .Polaris-Page__Content {
80
+ width: 100%;
81
+ margin:2rem 0;
82
+ }
83
+
84
+ @media (min-width: 46.5em) {
85
+ .Polaris-Page__Content {
86
+ margin-top:2rem;
87
+ }
88
+ }
89
+
90
+ @media (min-width: 46.5em) {
91
+ .Polaris-Page {
92
+ display: flex;
93
+ justify-content: center;
94
+ align-items: center;
95
+ height: 100vh;
96
+ }
97
+ }
98
+
99
+ .Polaris-Layout {
100
+ display:-webkit-box;
101
+ display:-ms-flexbox;
102
+ display:flex;
103
+ -ms-flex-wrap:wrap;
104
+ flex-wrap:wrap;
105
+ -webkit-box-pack:center;
106
+ -ms-flex-pack:center;
107
+ justify-content:center;
108
+ -webkit-box-align:start;
109
+ -ms-flex-align:start;
110
+ align-items:flex-start;
111
+ margin-top:-2rem;
112
+ margin-left:-2rem;
113
+ }
114
+
115
+ .Polaris-Layout__Section {
116
+ -webkit-box-flex:2;
117
+ -ms-flex:2 2 48rem;
118
+ flex:2 2 48rem;
119
+ min-width:51%;
120
+ }
121
+
122
+ .Polaris-Layout__Section--fullWidth {
123
+ -webkit-box-flex:1;
124
+ -ms-flex:1 1 100%;
125
+ flex:1 1 100%;
126
+ }
127
+
128
+ .Polaris-Layout__Section {
129
+ max-width:calc(100% - 2rem);
130
+ margin-top:2rem;
131
+ margin-left:2rem;
132
+ }
133
+
134
+ .Polaris-Stack {
135
+ margin-top:-1.6rem;
136
+ margin-left:-1.6rem;
137
+ display:-webkit-box;
138
+ display:-ms-flexbox;
139
+ display:flex;
140
+ -ms-flex-wrap:wrap;
141
+ flex-wrap:wrap;
142
+ -webkit-box-align:stretch;
143
+ -ms-flex-align:stretch;
144
+ align-items:stretch;
145
+ }
146
+
147
+ .Polaris-Stack > .Polaris-Stack__Item {
148
+ margin-top:1.6rem;
149
+ margin-left:1.6rem;
150
+ max-width:calc(100% - 1.6rem);
151
+ }
152
+
153
+ .Polaris-Stack__Item {
154
+ -webkit-box-flex:0;
155
+ -ms-flex:0 0 auto;
156
+ flex:0 0 auto;
157
+ min-width:0;
158
+ }
159
+
160
+ .Polaris-Stack--distributionTrailing {
161
+ -webkit-box-pack:end;
162
+ -ms-flex-pack:end;
163
+ justify-content:flex-end;
164
+ }
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
+
176
+ .Polaris-Stack--vertical {
177
+ -webkit-box-orient:vertical;
178
+ -webkit-box-direction:normal;
179
+ -ms-flex-direction:column;
180
+ flex-direction:column;
181
+ }
182
+ </style>
@@ -0,0 +1,35 @@
1
+ <style>
2
+ .Polaris-Heading {
3
+ font-size:1.7rem;
4
+ font-weight:600;
5
+ line-height:2.4rem;
6
+ margin:0;
7
+ }
8
+
9
+ @media (min-width: 40em) {
10
+ .Polaris-Heading {
11
+ font-size:1.6rem;
12
+ }
13
+ }
14
+
15
+ .Polaris-DisplayText {
16
+ margin:0;
17
+ }
18
+
19
+ .Polaris-DisplayText--sizeSmall {
20
+ font-size:1.6rem;
21
+ font-weight:400;
22
+ line-height:2.4rem;
23
+ }
24
+
25
+ @media (min-width: 40em) {
26
+ .Polaris-DisplayText--sizeSmall {
27
+ font-size:2rem;
28
+ line-height:2.8rem;
29
+ }
30
+ }
31
+
32
+ .Polaris-TextContainer > * + * {
33
+ margin-top:1.6rem;
34
+ }
35
+ </style>
@@ -0,0 +1,70 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%= I18n.locale %>">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <base target="_top">
7
+ <title>Redirecting…</title>
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
+ <style>
13
+ #CookiePartitionPrompt {
14
+ display: none;
15
+ }
16
+ </style>
17
+
18
+ <%= javascript_include_tag('shopify_app/enable_cookies', crossorigin: 'anonymous', integrity: true) %>
19
+ </head>
20
+ <body data-api-key="<%= ShopifyApp.configuration.api_key %>" data-shop-origin="https://<%= @shop %>" data-redirect-url="<%= @url %>">
21
+ <%=
22
+ content_tag(
23
+ :div, nil,
24
+ id: 'redirection-target',
25
+ data: {
26
+ target: {
27
+ myshopifyUrl: "https://#{current_shopify_domain}",
28
+ hasStorageAccessUrl: "#{has_storage_access_url}",
29
+ doesNotHaveStorageAccessUrl: "#{does_not_have_storage_access_url}",
30
+ appTargetUrl: "#{app_target_url}"
31
+ },
32
+ },
33
+ )
34
+ %>
35
+ <main id="CookiePartitionPrompt">
36
+ <div class="Polaris-Page">
37
+ <div class="Polaris-Page__Content">
38
+ <div class="Polaris-Layout">
39
+ <div class="Polaris-Layout__Section">
40
+ <div class="Polaris-Stack Polaris-Stack--vertical">
41
+ <div class="Polaris-Stack__Item">
42
+ <div class="Polaris-Card">
43
+ <div class="Polaris-Card__Header">
44
+ <h1 class="Polaris-Heading"><%= I18n.t('enable_cookies_heading', app: ShopifyApp.configuration.application_name) %></h1>
45
+ </div>
46
+ <div class="Polaris-Card__Section">
47
+ <p><%= I18n.t('enable_cookies_body', app: ShopifyApp.configuration.application_name) %></p>
48
+ </div>
49
+ <div class="Polaris-Card__Section Polaris-Card__Section--subdued">
50
+ <p><%= I18n.t('enable_cookies_footer') %></p>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <div class="Polaris-Stack__Item">
55
+ <div class="Polaris-Stack Polaris-Stack--distributionTrailing Polaris-Stack--distributionTrailingCustomSpacing">
56
+ <div class="Polaris-Stack__Item">
57
+ <button type="button" class="Polaris-Button Polaris-Button--primary" id="AcceptCookies">
58
+ <span class="Polaris-Button__Content"><span><%= I18n.t('enable_cookies_action') %></span></span>
59
+ </button>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </main>
69
+ </body>
70
+ </html>
@@ -3,93 +3,49 @@
3
3
  <head>
4
4
  <title>Shopify App — Installation</title>
5
5
 
6
- <style>
7
- html, body { padding: 0; margin: 0; }
8
-
9
- body {
10
- font-family: "ProximaNovaLight", "Helvetica Neue", Helvetica, Arial, sans-serif;
11
- background-color: #f2f7fa;
12
- }
13
-
14
- h1 {
15
- font-weight: 300;
16
- font-size: 40px;
17
- margin-bottom: 10px;
18
- }
19
-
20
- .subhead {
21
- font-size: 17px;
22
- line-height: 32px;
23
- font-weight: 300;
24
- color: #969A9C;
25
- }
26
-
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;
38
- }
39
-
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;
53
- }
54
-
55
- button:hover {
56
- background-color: #479CCf;
57
- }
58
-
59
- form {
60
- display: block;
61
- }
62
-
63
- .container {
64
- text-align: center;
65
- margin-top: 100px;
66
- padding: 20px;
67
- }
68
-
69
- .container__form {
70
- width: 400px;
71
- margin: auto;
72
- }
73
- </style>
6
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
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' %>
74
13
  </head>
75
14
  <body>
76
-
77
15
  <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>
85
-
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>
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>
91
48
  </div>
92
49
  </main>
93
-
94
50
  </body>
95
51
  </html>
@@ -0,0 +1,68 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%= I18n.locale %>">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <base target="_top">
7
+ <title>Redirecting…</title>
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
+ <style>
13
+ #RequestStorageAccess {
14
+ display: none;
15
+ }
16
+ </style>
17
+ </head>
18
+ <body>
19
+ <%=
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
+ )
31
+ %>
32
+ <main id="RequestStorageAccess">
33
+ <div class="Polaris-Page">
34
+ <div class="Polaris-Page__Content">
35
+ <div class="Polaris-Layout">
36
+ <div class="Polaris-Layout__Section">
37
+ <div class="Polaris-Stack Polaris-Stack--vertical">
38
+ <div class="Polaris-Stack__Item">
39
+ <div class="Polaris-Card">
40
+ <div class="Polaris-Card__Header">
41
+ <h1 class="Polaris-Heading"><%= I18n.t('request_storage_access_heading', app: ShopifyApp.configuration.application_name) %></h1>
42
+ </div>
43
+ <div class="Polaris-Card__Section">
44
+ <p><%= I18n.t('request_storage_access_body', app: ShopifyApp.configuration.application_name) %></p>
45
+ </div>
46
+ <div class="Polaris-Card__Section Polaris-Card__Section--subdued">
47
+ <p><%= I18n.t('request_storage_access_footer') %></p>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <div class="Polaris-Stack__Item">
52
+ <div class="Polaris-Stack Polaris-Stack--distributionTrailing Polaris-Stack--distributionTrailingCustomSpacing">
53
+ <div class="Polaris-Stack__Item">
54
+ <button type="button" class="Polaris-Button Polaris-Button--primary" id="TriggerAllowCookiesPrompt">
55
+ <span class="Polaris-Button__Content"><span><%= I18n.t('request_storage_access_action') %></span></span>
56
+ </button>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </main>
66
+ <%= javascript_include_tag('shopify_app/request_storage_access', crossorigin: 'anonymous', integrity: true) %>
67
+ </body>
68
+ </html>
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%= I18n.locale %>">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <base target="_top">
7
+ <title>Redirecting…</title>
8
+ <%= render 'shopify_app/partials/card_styles' %>
9
+ <%= render 'shopify_app/partials/layout_styles' %>
10
+ <%= render 'shopify_app/partials/typography_styles' %>
11
+ <%= render 'shopify_app/partials/button_styles' %>
12
+ <%= render 'shopify_app/partials/empty_state_styles' %>
13
+ <style>
14
+ #TopLevelInteractionContent {
15
+ display: none;
16
+ }
17
+ </style>
18
+
19
+ <%= javascript_include_tag('shopify_app/top_level', crossorigin: 'anonymous', integrity: true) %>
20
+ </head>
21
+ <body data-api-key="<%= ShopifyApp.configuration.api_key %>" data-shop-origin="https://<%= @shop %>" data-redirect-url="<%= @url %>">
22
+ <main id="TopLevelInteractionContent">
23
+ <div class="Polaris-Page">
24
+ <div class="Polaris-Page__Content">
25
+ <div class="Polaris-Layout">
26
+ <div class="Polaris-Layout__Section">
27
+ <div class="Polaris-Stack Polaris-Stack--vertical">
28
+ <div class="Polaris-Stack__Item">
29
+ <div class="Polaris-Card">
30
+ <div class="Polaris-Card__Section">
31
+ <div class="Polaris-EmptyState">
32
+ <div class="Polaris-EmptyState__Section">
33
+ <div class="Polaris-EmptyState__DetailsContainer">
34
+ <div class="Polaris-EmptyState__Details">
35
+ <div class="Polaris-TextContainer">
36
+ <h1 class="Polaris-DisplayText Polaris-DisplayText--sizeSmall"><%= I18n.t('top_level_interaction_heading', app: ShopifyApp.configuration.application_name) %></h1>
37
+ <div class="Polaris-EmptyState__Content">
38
+ <p><%= I18n.t('top_level_interaction_body', app: ShopifyApp.configuration.application_name) %></p>
39
+ </div>
40
+ </div>
41
+ <div class="Polaris-EmptyState__Actions">
42
+ <div class="Polaris-Stack Polaris-Stack--alignmentCenter">
43
+ <div class="Polaris-Stack__Item"><button type="button" id="TopLevelInteractionButton" class="Polaris-Button Polaris-Button--primary Polaris-Button--sizeLarge"><span class="Polaris-Button__Content"><span class="Polaris-Button__Icon"></span><span><%= I18n.t('top_level_interaction_action') %></span></span></button></div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <div class="Polaris-EmptyState__ImageContainer">
49
+ <%= image_tag 'storage_access.svg', role: "presentation", alt: "", class: "Polaris-EmptyState__Image" %>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </main>
62
+ </body>
63
+ </html>
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <base target="_top">
7
+ <title>Redirecting…</title>
8
+ <%= javascript_include_tag('shopify_app/redirect', crossorigin: 'anonymous', integrity: true) %>
9
+ </head>
10
+ <body>
11
+ <%=
12
+ content_tag(:div, nil,
13
+ id: 'redirection-target',
14
+ data: {
15
+ target: {
16
+ myshopifyUrl: "https://#{current_shopify_domain}",
17
+ url: url,
18
+ },
19
+ },
20
+ )
21
+ %>
22
+ </body>
23
+ </html>
@@ -0,0 +1,23 @@
1
+ ---
2
+ cs:
3
+ logged_out: Odhlášení proběhlo úspěšně
4
+ could_not_log_in: Nelze se přihlásit do obchodu Shopify
5
+ invalid_shop_url: Neplatná doména obchodu
6
+ enable_cookies_heading: Zapnout soubory cookie z aplikace %{app}
7
+ enable_cookies_body: Pokud chcete v Shopify používat aplikaci %{app}, musíte soubory
8
+ cookie v tomto prohlížeči povolit ručně.
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
+ enable_cookies_action: Povolit soubory cookie
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
+ otevře.
16
+ top_level_interaction_action: Pokračovat
17
+ request_storage_access_heading: Aplikace %{app} potřebuje získat přístup k souborům
18
+ 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
+ request_storage_access_footer: Platnost souborů cookie vyprší po 30 dnech.
23
+ request_storage_access_action: Pokračovat
@@ -0,0 +1,20 @@
1
+ ---
2
+ da:
3
+ logged_out: Logget ud
4
+ could_not_log_in: Kunne ikke logge ind på Shopify-butik
5
+ invalid_shop_url: Ugyldig butiksdomæne
6
+ enable_cookies_heading: Aktivér cookies fra %{app}
7
+ enable_cookies_body: Du skal manuelt aktivere cookies i denne browser for at kunne
8
+ bruge %{app} i Shopify.
9
+ enable_cookies_footer: Cookies lader appen godkende dig ved at gemme dine præferencer
10
+ og personlige oplysninger midlertidigt. De udløber efter 30 dage.
11
+ enable_cookies_action: Aktivér cookies
12
+ top_level_interaction_heading: Din browser skal godkende %{app}
13
+ top_level_interaction_body: Din browser kræver, at apps som f.eks. %{app} spørger
14
+ dig om adgang til cookies, inden Shopify kan åbne den for dig.
15
+ top_level_interaction_action: Fortsæt
16
+ request_storage_access_heading: "%{app} skal have adgang til cookies"
17
+ request_storage_access_body: Det lader appen godkende dig ved at gemme dine personlige
18
+ oplysninger midlertidigt. Klik på forsæt, og tillad cookies for at bruge appen.
19
+ request_storage_access_footer: Cookies udløber efter 30 dage.
20
+ request_storage_access_action: Fortsæt
@@ -0,0 +1,22 @@
1
+ ---
2
+ de:
3
+ logged_out: Erfolgreich ausgelogt
4
+ could_not_log_in: Shopify Store Login fehlgeschlagen
5
+ invalid_shop_url: Ungültige Shop-Domain
6
+ enable_cookies_heading: Cookies von %{app} aktivieren
7
+ enable_cookies_body: Du musst Cookies in diesem Browser manuell aktivieren, um %{app}
8
+ in Shopify verwenden zu können.
9
+ enable_cookies_footer: Mithilfe von Cookies kann die App dich authentifizieren,
10
+ indem deine Einstellungen und personenbezogenen Daten vorübergehend gespeichert
11
+ werden. Sie laufen nach 30 Tagen ab.
12
+ enable_cookies_action: Cookies aktivieren
13
+ top_level_interaction_heading: Dein Browser muss %{app} authentifizieren
14
+ top_level_interaction_body: Dein Browser verlangt, dass Apps wie %{app} dich um
15
+ Zugriff auf Cookies bitten, bevor Shopify sie für dich öffnen kann.
16
+ top_level_interaction_action: Weiter
17
+ request_storage_access_heading: "%{app} braucht Zugriff auf Cookies"
18
+ request_storage_access_body: Damit kann die App dich authentifizieren, indem deine
19
+ Einstellungen und personenbezogenen Daten vorübergehend gespeichert werden. Klicke
20
+ auf "Weiter" und erlaube Cookies, um die App zu verwenden.
21
+ request_storage_access_footer: Cookies laufen nach 30 Tagen ab.
22
+ request_storage_access_action: Weiter
@@ -1,4 +1,15 @@
1
1
  en:
2
- logged_in: 'Logged In'
3
2
  logged_out: 'Successfully logged out'
4
3
  could_not_log_in: 'Could not log in to Shopify store'
4
+ invalid_shop_url: 'Invalid shop domain'
5
+ enable_cookies_heading: "Enable cookies from %{app}"
6
+ enable_cookies_body: "You must manually enable cookies in this browser in order to use %{app} within Shopify."
7
+ enable_cookies_footer: 'Cookies let the app authenticate you by temporarily storing your preferences and personal information. They expire after 30 days.'
8
+ enable_cookies_action: 'Enable cookies'
9
+ top_level_interaction_heading: "Your browser needs to authenticate %{app}"
10
+ top_level_interaction_body: "Your browser requires apps like %{app} to ask you for access to cookies before Shopify can open it for you."
11
+ top_level_interaction_action: 'Continue'
12
+ request_storage_access_heading: "%{app} needs access to cookies"
13
+ request_storage_access_body: "This lets the app authenticate you by temporarily storing your personal information. Click continue and allow cookies to use the app."
14
+ request_storage_access_footer: 'Cookies expire after 30 days.'
15
+ request_storage_access_action: 'Continue'