shopify_app 8.3.2 → 8.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.babelrc +5 -0
  3. data/.github/CODEOWNERS +1 -0
  4. data/.github/probots.yml +2 -0
  5. data/.gitignore +1 -0
  6. data/.nvmrc +1 -0
  7. data/.travis.yml +24 -3
  8. data/CHANGELOG.md +5 -0
  9. data/README.md +1 -0
  10. data/app/assets/images/storage_access.svg +2 -0
  11. data/app/assets/javascripts/shopify_app/enable_cookies.js +3 -0
  12. data/app/assets/javascripts/shopify_app/itp_helper.js +40 -0
  13. data/app/assets/javascripts/shopify_app/partition_cookies.js +7 -0
  14. data/app/assets/javascripts/shopify_app/request_storage_access.js +3 -0
  15. data/app/assets/javascripts/shopify_app/storage_access.js +116 -0
  16. data/app/assets/javascripts/shopify_app/storage_access_redirect.js +17 -0
  17. data/app/assets/javascripts/shopify_app/top_level.js +2 -0
  18. data/app/assets/javascripts/shopify_app/top_level_interaction.js +11 -0
  19. data/app/controllers/shopify_app/callback_controller.rb +92 -0
  20. data/app/controllers/shopify_app/sessions_controller.rb +57 -84
  21. data/app/views/shopify_app/partials/_button_styles.html.erb +104 -0
  22. data/app/views/shopify_app/partials/_card_styles.html.erb +33 -0
  23. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +129 -0
  24. data/app/views/shopify_app/partials/_layout_styles.html.erb +167 -0
  25. data/app/views/shopify_app/partials/_typography_styles.html.erb +35 -0
  26. data/app/views/shopify_app/sessions/enable_cookies.html.erb +7 -334
  27. data/app/views/shopify_app/sessions/request_storage_access.html.erb +67 -0
  28. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +63 -0
  29. data/config/locales/de.yml +10 -0
  30. data/config/locales/en.yml +7 -0
  31. data/config/locales/es.yml +10 -0
  32. data/config/locales/fr.yml +11 -0
  33. data/config/locales/it.yml +11 -0
  34. data/config/locales/ja.yml +8 -0
  35. data/config/locales/pt-BR.yml +10 -0
  36. data/config/routes.rb +10 -1
  37. data/karma.conf.js +43 -0
  38. data/lib/shopify_app.rb +1 -0
  39. data/lib/shopify_app/controller_concerns/itp.rb +45 -0
  40. data/lib/shopify_app/controller_concerns/login_protection.rb +7 -11
  41. data/lib/shopify_app/engine.rb +4 -1
  42. data/lib/shopify_app/utils.rb +1 -1
  43. data/lib/shopify_app/version.rb +1 -1
  44. data/package-lock.json +23 -0
  45. data/package.json +28 -0
  46. data/service.yml +7 -0
  47. data/shipit.rubygems.yml +2 -0
  48. data/shopify_app.gemspec +1 -0
  49. data/webpack.config.js +24 -0
  50. data/yarn.lock +4594 -0
  51. metadata +44 -3
  52. data/app/assets/javascripts/shopify_app/itp_polyfill.js +0 -30
@@ -2,350 +2,23 @@
2
2
  <html lang="<%= I18n.locale %>">
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
+ <base target="_top">
6
+ <title>Redirecting…</title>
7
+ <%= render 'shopify_app/partials/layout_styles' %>
8
+ <%= render 'shopify_app/partials/typography_styles' %>
9
+ <%= render 'shopify_app/partials/card_styles' %>
10
+ <%= render 'shopify_app/partials/button_styles' %>
5
11
  <style>
6
- html,
7
- body {
8
- min-height:100%;
9
- height:100%;
10
- font-size:1.5rem;
11
- font-weight:400;
12
- line-height:2rem;
13
- text-transform:initial;
14
- letter-spacing:initial;
15
- font-weight:400;
16
- color:#212b36;
17
- font-family:-apple-system, BlinkMacSystemFont, San Francisco, Roboto, Segoe UI, Helvetica Neue, sans-serif;
18
- }
19
-
20
- @media (min-width: 40em) {
21
- html,
22
- body {
23
- font-size:1.4rem;
24
- }
25
- }
26
-
27
- html {
28
- position:relative;
29
- font-size:62.5%;
30
- -webkit-font-smoothing:antialiased;
31
- -moz-osx-font-smoothing:grayscale;
32
- -webkit-text-size-adjust:100%;
33
- -ms-text-size-adjust:100%;
34
- text-size-adjust:100%;
35
- text-rendering:optimizeLegibility;
36
- }
37
-
38
- body {
39
- min-height:100%;
40
- margin:0;
41
- padding:0;
42
- background-color:#f4f6f8;
43
- }
44
-
45
- *,
46
- *::before,
47
- *::after{
48
- box-sizing:border-box; }
49
-
50
- h1,
51
- h2,
52
- h3,
53
- h4,
54
- h5,
55
- h6,
56
- p {
57
- margin:0;
58
- font-size:1em;
59
- font-weight:400;
60
- }
61
-
62
12
  #CookiePartitionPrompt {
63
13
  display: none;
64
14
  }
65
-
66
- .Polaris-Page {
67
- margin:0 auto;
68
- padding:0;
69
- max-width:99.8rem;
70
- }
71
-
72
- @media (min-width: 30.625em) {
73
- .Polaris-Page {
74
- padding:0 2rem;
75
- }
76
- }
77
- @media (min-width: 46.5em) {
78
- .Polaris-Page {
79
- padding:0 3.2rem;
80
- }
81
- }
82
-
83
- .Polaris-Page__Content {
84
- margin:2rem 0;
85
- }
86
-
87
- @media (min-width: 46.5em) {
88
- .Polaris-Page__Content {
89
- margin-top:2rem;
90
- }
91
- }
92
-
93
- @media (min-width: 46.5em) {
94
- .Polaris-Page {
95
- display: flex;
96
- justify-content: center;
97
- align-items: center;
98
- height: 100vh;
99
- }
100
- }
101
-
102
- .Polaris-Layout {
103
- display:-webkit-box;
104
- display:-ms-flexbox;
105
- display:flex;
106
- -ms-flex-wrap:wrap;
107
- flex-wrap:wrap;
108
- -webkit-box-pack:center;
109
- -ms-flex-pack:center;
110
- justify-content:center;
111
- -webkit-box-align:start;
112
- -ms-flex-align:start;
113
- align-items:flex-start;
114
- margin-top:-2rem;
115
- margin-left:-2rem;
116
- }
117
-
118
- .Polaris-Layout__Section {
119
- -webkit-box-flex:2;
120
- -ms-flex:2 2 48rem;
121
- flex:2 2 48rem;
122
- min-width:51%;
123
- }
124
-
125
- .Polaris-Layout__Section--fullWidth {
126
- -webkit-box-flex:1;
127
- -ms-flex:1 1 100%;
128
- flex:1 1 100%;
129
- }
130
-
131
- .Polaris-Layout__Section {
132
- max-width:calc(100% - 2rem);
133
- margin-top:2rem;
134
- margin-left:2rem;
135
- }
136
-
137
- .Polaris-Stack {
138
- margin-top:-1.6rem;
139
- margin-left:-1.6rem;
140
- display:-webkit-box;
141
- display:-ms-flexbox;
142
- display:flex;
143
- -ms-flex-wrap:wrap;
144
- flex-wrap:wrap;
145
- -webkit-box-align:stretch;
146
- -ms-flex-align:stretch;
147
- align-items:stretch;
148
- }
149
-
150
- .Polaris-Stack > .Polaris-Stack__Item {
151
- margin-top:1.6rem;
152
- margin-left:1.6rem;
153
- max-width:calc(100% - 1.6rem);
154
- }
155
-
156
- .Polaris-Stack__Item {
157
- -webkit-box-flex:0;
158
- -ms-flex:0 0 auto;
159
- flex:0 0 auto;
160
- min-width:0;
161
- }
162
-
163
- .Polaris-Heading {
164
- font-size:1.7rem;
165
- font-weight:600;
166
- line-height:2.4rem;
167
- margin:0;
168
- }
169
-
170
- @media (min-width: 40em) {
171
- .Polaris-Heading {
172
- font-size:1.6rem;
173
- }
174
- }
175
-
176
- .Polaris-Card {
177
- overflow:hidden;
178
- background-color:white;
179
- box-shadow:0 0 0 1px rgba(63, 63, 68, 0.05), 0 1px 3px 0 rgba(63, 63, 68, 0.15);
180
- }
181
-
182
- .Polaris-Card + .Polaris-Card {
183
- margin-top:2rem;
184
- }
185
-
186
- @media (min-width: 30.625em) {
187
- .Polaris-Card {
188
- border-radius:3px;
189
- }
190
- }
191
-
192
- .Polaris-Card__Header {
193
- padding:2rem 2rem 0;
194
- }
195
-
196
- .Polaris-Card__Section {
197
- padding:2rem;
198
- }
199
-
200
- .Polaris-Card__Section + .Polaris-Card__Section {
201
- border-top:1px solid #dfe3e8;
202
- }
203
-
204
- .Polaris-Card__Section--subdued {
205
- background-color:#f9fafb;
206
- }
207
-
208
-
209
- .Polaris-Stack--distributionTrailing {
210
- -webkit-box-pack:end;
211
- -ms-flex-pack:end;
212
- justify-content:flex-end;
213
- }
214
-
215
- .Polaris-Stack--vertical {
216
- -webkit-box-orient:vertical;
217
- -webkit-box-direction:normal;
218
- -ms-flex-direction:column;
219
- flex-direction:column;
220
- }
221
-
222
- .Polaris-Button {
223
- fill:#637381;
224
- position:relative;
225
- display:-webkit-inline-box;
226
- display:-ms-inline-flexbox;
227
- display:inline-flex;
228
- -webkit-box-align:center;
229
- -ms-flex-align:center;
230
- align-items:center;
231
- -webkit-box-pack:center;
232
- -ms-flex-pack:center;
233
- justify-content:center;
234
- min-height:3.6rem;
235
- min-width:3.6rem;
236
- margin:0;
237
- padding:0.7rem 1.6rem;
238
- background:linear-gradient(to bottom, white, #f9fafb);
239
- border:1px solid #c4cdd5;
240
- box-shadow:0 1px 0 0 rgba(22, 29, 37, 0.05);
241
- border-radius:3px;
242
- line-height:1;
243
- color:#212b36;
244
- text-align:center;
245
- cursor:pointer;
246
- -webkit-user-select:none;
247
- -moz-user-select:none;
248
- -ms-user-select:none;
249
- user-select:none;
250
- text-decoration:none;
251
- transition-property:background, border, box-shadow;
252
- transition-duration:200ms;
253
- transition-timing-function:cubic-bezier(0.64, 0, 0.35, 1);
254
- }
255
-
256
- .Polaris-Button:hover {
257
- background:linear-gradient(to bottom, #f9fafb, #f4f6f8);
258
- border-color:#c4cdd5;
259
- }
260
-
261
- .Polaris-Button:focus {
262
- border-color:#5c6ac4;
263
- outline:0;
264
- box-shadow:0 0 0 1px #5c6ac4;
265
- }
266
-
267
- .Polaris-Button:active {
268
- background:linear-gradient(to bottom, #f4f6f8, #f4f6f8);
269
- border-color:#c4cdd5;
270
- 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);
271
- }
272
-
273
- .Polaris-Button.Polaris-Button--disabled {
274
- fill:#919eab;
275
- transition:none;
276
- background:linear-gradient(to bottom, #f4f6f8, #f4f6f8);
277
- color:#919eab;
278
- }
279
-
280
- .Polaris-Button__Content {
281
- font-size:1.5rem;
282
- font-weight:400;
283
- line-height:1.6rem;
284
- text-transform:initial;
285
- letter-spacing:initial;
286
- position:relative;
287
- display:-webkit-box;
288
- display:-ms-flexbox;
289
- display:flex;
290
- -webkit-box-pack:center;
291
- -ms-flex-pack:center;
292
- justify-content:center;
293
- -webkit-box-align:center;
294
- -ms-flex-align:center;
295
- align-items:center;
296
- min-width:1px;
297
- min-height:1px;
298
- }
299
-
300
- @media (min-width: 40em) {
301
- .Polaris-Button__Content {
302
- font-size:1.4rem;
303
- }
304
- }
305
-
306
- .Polaris-Button--primary {
307
- background:linear-gradient(to bottom, #6371c7, #5563c1);
308
- border-color:#3f4eae;
309
- box-shadow:inset 0 1px 0 0 #6774c8, 0 1px 0 0 rgba(22, 29, 37, 0.05), 0 0 0 0 transparent;
310
- color:white;
311
- fill:white;
312
- }
313
-
314
- .Polaris-Button--primary:hover {
315
- background:linear-gradient(to bottom, #5c6ac4, #4959bd);
316
- border-color:#3f4eae;
317
- color:white;
318
- text-decoration:none;
319
- }
320
-
321
- .Polaris-Button--primary:focus {
322
- border-color:#202e78;
323
- box-shadow:inset 0 1px 0 0 #6f7bcb, 0 1px 0 0 rgba(22, 29, 37, 0.05), 0 0 0 1px #202e78;
324
- }
325
-
326
- .Polaris-Button--primary:active {
327
- background:linear-gradient(to bottom, #3f4eae, #3f4eae);
328
- border-color:#38469b;
329
- box-shadow:inset 0 0 0 0 transparent, 0 1px 0 0 rgba(22, 29, 37, 0.05), 0 0 1px 0 #38469b;
330
- }
331
-
332
- .Polaris-Button--primary.Polaris-Button--disabled {
333
- fill:white;
334
- background:linear-gradient(to bottom, #bac0e6, #bac0e6);
335
- border-color:#a7aedf;
336
- box-shadow:none;
337
- color:white;
338
- }
339
15
  </style>
340
- <base target="_top">
341
- <title>Redirecting…</title>
342
-
343
16
  <script>
344
17
  window.apiKey = "<%= ShopifyApp.configuration.api_key %>";
345
18
  window.shopOrigin = "https://<%= @shop %>";
346
19
  </script>
347
20
 
348
- <%= javascript_include_tag('shopify_app/itp_polyfill', crossorigin: 'anonymous', integrity: true) %>
21
+ <%= javascript_include_tag('shopify_app/enable_cookies', crossorigin: 'anonymous', integrity: true) %>
349
22
  </head>
350
23
  <body>
351
24
  <main id="CookiePartitionPrompt">
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%= I18n.locale %>">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <base target="_top">
6
+ <title>Redirecting…</title>
7
+ <%= render 'shopify_app/partials/layout_styles' %>
8
+ <%= render 'shopify_app/partials/typography_styles' %>
9
+ <%= render 'shopify_app/partials/card_styles' %>
10
+ <%= render 'shopify_app/partials/button_styles' %>
11
+ <style>
12
+ #RequestStorageAccess {
13
+ display: none;
14
+ }
15
+ </style>
16
+ </head>
17
+ <body>
18
+ <%=
19
+ content_tag(:div, nil,
20
+ id: 'redirection-target',
21
+ data: {
22
+ target: {
23
+ myshopifyUrl: "https://#{current_shopify_domain}",
24
+ hasStorageAccessUrl: "#{has_storage_access_url}",
25
+ doesNotHaveStorageAccessUrl: "#{does_not_have_storage_access_url}",
26
+ appHomeUrl: "#{app_home_url}"
27
+ },
28
+ },
29
+ )
30
+ %>
31
+ <main id="RequestStorageAccess">
32
+ <div class="Polaris-Page">
33
+ <div class="Polaris-Page__Content">
34
+ <div class="Polaris-Layout">
35
+ <div class="Polaris-Layout__Section">
36
+ <div class="Polaris-Stack Polaris-Stack--vertical">
37
+ <div class="Polaris-Stack__Item">
38
+ <div class="Polaris-Card">
39
+ <div class="Polaris-Card__Header">
40
+ <h1 class="Polaris-Heading"><%= I18n.t('request_storage_access_heading', app: ShopifyApp.configuration.application_name) %></h1>
41
+ </div>
42
+ <div class="Polaris-Card__Section">
43
+ <p><%= I18n.t('request_storage_access_body', app: ShopifyApp.configuration.application_name) %></p>
44
+ </div>
45
+ <div class="Polaris-Card__Section Polaris-Card__Section--subdued">
46
+ <p><%= I18n.t('request_storage_access_footer') %></p>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ <div class="Polaris-Stack__Item">
51
+ <div class="Polaris-Stack Polaris-Stack--distributionTrailing">
52
+ <div class="Polaris-Stack__Item">
53
+ <button type="button" class="Polaris-Button Polaris-Button--primary" id="TriggerAllowCookiesPrompt">
54
+ <span class="Polaris-Button__Content"><span><%= I18n.t('request_storage_access_action') %></span></span>
55
+ </button>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </main>
65
+ <%= javascript_include_tag('shopify_app/request_storage_access', crossorigin: 'anonymous', integrity: true) %>
66
+ </body>
67
+ </html>
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%= I18n.locale %>">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <base target="_top">
6
+ <title>Redirecting…</title>
7
+ <%= render 'shopify_app/partials/layout_styles' %>
8
+ <%= render 'shopify_app/partials/typography_styles' %>
9
+ <%= render 'shopify_app/partials/button_styles' %>
10
+ <%= render 'shopify_app/partials/empty_state_styles' %>
11
+ <style>
12
+ #TopLevelInteractionContent {
13
+ display: none;
14
+ }
15
+ </style>
16
+
17
+ <script>
18
+ window.apiKey = "<%= ShopifyApp.configuration.api_key %>";
19
+ window.shopOrigin = "https://<%= @shop %>";
20
+ window.redirectUrl = "<%= @url %>";
21
+ </script>
22
+
23
+ <%= javascript_include_tag('shopify_app/top_level', crossorigin: 'anonymous', integrity: true) %>
24
+ </head>
25
+ <body>
26
+ <main id="TopLevelInteractionContent">
27
+ <div class="Polaris-Page">
28
+ <div class="Polaris-Page__Content">
29
+ <div class="Polaris-Layout">
30
+ <div class="Polaris-Layout__Section">
31
+ <div class="Polaris-Stack Polaris-Stack--vertical">
32
+ <div class="Polaris-Stack__Item">
33
+ <div class="Polaris-EmptyState">
34
+ <div class="Polaris-EmptyState__Section">
35
+ <div class="Polaris-EmptyState__DetailsContainer">
36
+ <div class="Polaris-EmptyState__Details">
37
+ <div class="Polaris-TextContainer">
38
+ <h1 class="Polaris-DisplayText Polaris-DisplayText--sizeMedium"><%= I18n.t('top_level_interaction_heading', app: ShopifyApp.configuration.application_name) %></h1>
39
+ <div class="Polaris-EmptyState__Content">
40
+ <p><%= I18n.t('top_level_interaction_body', app: ShopifyApp.configuration.application_name) %></p>
41
+ </div>
42
+ </div>
43
+ <div class="Polaris-EmptyState__Actions">
44
+ <div class="Polaris-Stack Polaris-Stack--alignmentCenter">
45
+ <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>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ <div class="Polaris-EmptyState__ImageContainer">
51
+ <%= image_tag 'storage_access.svg', role: "presentation", alt: "", class: "Polaris-EmptyState__Image" %>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </main>
62
+ </body>
63
+ </html>