shopify_app 14.4.3 → 16.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +5 -0
  3. data/.github/workflows/build.yml +38 -0
  4. data/.github/workflows/rubocop.yml +1 -7
  5. data/.gitignore +0 -2
  6. data/.rubocop.yml +1 -0
  7. data/CHANGELOG.md +21 -0
  8. data/Gemfile.lock +252 -0
  9. data/README.md +22 -6
  10. data/app/assets/images/storage_access.svg +1 -2
  11. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +22 -0
  12. data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
  13. data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
  14. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
  15. data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
  16. data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
  17. data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
  18. data/app/views/shopify_app/sessions/enable_cookies.html.erb +1 -1
  19. data/app/views/shopify_app/sessions/new.html.erb +38 -110
  20. data/app/views/shopify_app/sessions/request_storage_access.html.erb +1 -1
  21. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +20 -15
  22. data/docs/Releasing.md +6 -4
  23. data/lib/generators/shopify_app/controllers/controllers_generator.rb +1 -1
  24. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +16 -7
  25. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +10 -10
  26. data/lib/generators/shopify_app/install/install_generator.rb +6 -1
  27. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +4 -3
  28. data/lib/generators/shopify_app/views/views_generator.rb +1 -1
  29. data/lib/shopify_app/configuration.rb +3 -0
  30. data/lib/shopify_app/controller_concerns/login_protection.rb +3 -1
  31. data/lib/shopify_app/engine.rb +21 -0
  32. data/lib/shopify_app/session/jwt.rb +3 -1
  33. data/lib/shopify_app/version.rb +1 -1
  34. data/package.json +1 -1
  35. metadata +6 -3
  36. data/.travis.yml +0 -27
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ShopifyApp
4
+ module EnsureAuthenticatedLinks
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ before_action :redirect_to_splash_page, if: :missing_expected_jwt?
9
+ end
10
+
11
+ private
12
+
13
+ def redirect_to_splash_page
14
+ splash_page_path = root_path(return_to: request.fullpath, shop: current_shopify_domain)
15
+ redirect_to(splash_page_path)
16
+ end
17
+
18
+ def missing_expected_jwt?
19
+ jwt_shopify_domain.blank?
20
+ end
21
+ end
22
+ 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
 
@@ -52,7 +52,7 @@
52
52
  </div>
53
53
  </div>
54
54
  <div class="Polaris-Stack__Item">
55
- <div class="Polaris-Stack Polaris-Stack--distributionTrailing">
55
+ <div class="Polaris-Stack Polaris-Stack--distributionTrailing Polaris-Stack--distributionTrailingCustomSpacing">
56
56
  <div class="Polaris-Stack__Item">
57
57
  <button type="button" class="Polaris-Button Polaris-Button--primary" id="AcceptCookies">
58
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>