shopify_app 15.0.0 → 17.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +38 -0
- data/.github/workflows/release.yml +20 -0
- data/.github/workflows/rubocop.yml +1 -7
- data/.gitignore +0 -2
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +256 -0
- data/README.md +36 -15
- data/app/assets/images/storage_access.svg +1 -2
- data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +22 -0
- data/app/controllers/shopify_app/callback_controller.rb +0 -6
- data/app/controllers/shopify_app/sessions_controller.rb +1 -15
- data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
- data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
- data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
- data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
- data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
- data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
- data/app/views/shopify_app/sessions/enable_cookies.html.erb +1 -1
- data/app/views/shopify_app/sessions/new.html.erb +38 -110
- data/app/views/shopify_app/sessions/request_storage_access.html.erb +1 -1
- data/app/views/shopify_app/sessions/top_level_interaction.html.erb +20 -15
- data/config/locales/de.yml +11 -11
- data/config/locales/vi.yml +22 -0
- data/config/locales/zh-CN.yml +1 -1
- data/docs/Releasing.md +9 -6
- data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +16 -7
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +10 -10
- data/lib/generators/shopify_app/install/install_generator.rb +6 -1
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +15 -12
- data/lib/shopify_app/configuration.rb +3 -0
- data/lib/shopify_app/controller_concerns/itp.rb +0 -2
- data/lib/shopify_app/controller_concerns/login_protection.rb +3 -13
- data/lib/shopify_app/session/jwt.rb +3 -1
- data/lib/shopify_app/version.rb +1 -1
- data/package.json +1 -1
- data/shopify_app.gemspec +1 -1
- data/translation.yml +1 -1
- metadata +14 -3
- data/.travis.yml +0 -27
@@ -35,7 +35,7 @@
|
|
35
35
|
min-height:100%;
|
36
36
|
margin:0;
|
37
37
|
padding:0;
|
38
|
-
background-color:#
|
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--
|
20
|
-
font-size:
|
19
|
+
.Polaris-DisplayText--sizeSmall {
|
20
|
+
font-size:1.6rem;
|
21
21
|
font-weight:400;
|
22
|
-
line-height:2.
|
22
|
+
line-height:2.4rem;
|
23
23
|
}
|
24
24
|
|
25
25
|
@media (min-width: 40em) {
|
26
|
-
.Polaris-DisplayText--
|
27
|
-
font-size:
|
28
|
-
line-height:
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
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>
|
@@ -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>
|
@@ -5,6 +5,7 @@
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
6
6
|
<base target="_top">
|
7
7
|
<title>Redirecting…</title>
|
8
|
+
<%= render 'shopify_app/partials/card_styles' %>
|
8
9
|
<%= render 'shopify_app/partials/layout_styles' %>
|
9
10
|
<%= render 'shopify_app/partials/typography_styles' %>
|
10
11
|
<%= render 'shopify_app/partials/button_styles' %>
|
@@ -25,26 +26,30 @@
|
|
25
26
|
<div class="Polaris-Layout__Section">
|
26
27
|
<div class="Polaris-Stack Polaris-Stack--vertical">
|
27
28
|
<div class="Polaris-Stack__Item">
|
28
|
-
<div class="Polaris-
|
29
|
-
<div class="Polaris-
|
30
|
-
<div class="Polaris-
|
31
|
-
<div class="Polaris-
|
32
|
-
<div class="Polaris-
|
33
|
-
<
|
34
|
-
|
35
|
-
|
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>
|
36
46
|
</div>
|
37
47
|
</div>
|
38
|
-
<div class="Polaris-
|
39
|
-
|
40
|
-
<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>
|
41
|
-
</div>
|
48
|
+
<div class="Polaris-EmptyState__ImageContainer">
|
49
|
+
<%= image_tag 'storage_access.svg', role: "presentation", alt: "", class: "Polaris-EmptyState__Image" %>
|
42
50
|
</div>
|
43
51
|
</div>
|
44
52
|
</div>
|
45
|
-
<div class="Polaris-EmptyState__ImageContainer">
|
46
|
-
<%= image_tag 'storage_access.svg', role: "presentation", alt: "", class: "Polaris-EmptyState__Image" %>
|
47
|
-
</div>
|
48
53
|
</div>
|
49
54
|
</div>
|
50
55
|
</div>
|
data/config/locales/de.yml
CHANGED
@@ -4,19 +4,19 @@ de:
|
|
4
4
|
could_not_log_in: Shopify Store Login fehlgeschlagen
|
5
5
|
invalid_shop_url: Ungültige Shop-Domain
|
6
6
|
enable_cookies_heading: Cookies von %{app} aktivieren
|
7
|
-
enable_cookies_body:
|
8
|
-
|
9
|
-
enable_cookies_footer: Mithilfe von Cookies kann die App
|
10
|
-
|
11
|
-
Sie laufen nach 30 Tagen ab.
|
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
12
|
enable_cookies_action: Cookies aktivieren
|
13
|
-
top_level_interaction_heading:
|
14
|
-
top_level_interaction_body:
|
15
|
-
auf Cookies bitten, bevor Shopify sie für
|
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
16
|
top_level_interaction_action: Weiter
|
17
17
|
request_storage_access_heading: "%{app} braucht Zugriff auf Cookies"
|
18
|
-
request_storage_access_body: Damit kann die App
|
19
|
-
Einstellungen und personenbezogenen Daten vorübergehend gespeichert werden.
|
20
|
-
|
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
21
|
request_storage_access_footer: Cookies laufen nach 30 Tagen ab.
|
22
22
|
request_storage_access_action: Weiter
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
vi:
|
3
|
+
logged_out: Đã đăng xuất thành công
|
4
|
+
could_not_log_in: Không thể đăng nhập vào cửa hàng trên Shopify
|
5
|
+
invalid_shop_url: Miền cửa hàng không hợp lệ
|
6
|
+
enable_cookies_heading: Bật cookie từ %{app}
|
7
|
+
enable_cookies_body: Bạn phải bật cookie trong trình duyệt này theo cách thủ công
|
8
|
+
để sử dụng %{app} trong Shopify.
|
9
|
+
enable_cookies_footer: Cookie cho phép ứng dụng xác thực bạn bằng cách tạm thời
|
10
|
+
lưu trữ tùy chọn và thông tin cá nhân của bạn. Những thông tin này sẽ hết hạn
|
11
|
+
sau 30 ngày.
|
12
|
+
enable_cookies_action: Bật cookie
|
13
|
+
top_level_interaction_heading: Trình duyệt của bạn cần xác thực %{app}
|
14
|
+
top_level_interaction_body: Trình duyệt của bạn cần các ứng dụng như %{app} để yêu
|
15
|
+
cầu quyền truy cập vào cookie thì Shopify mới có thể mở giúp bạn.
|
16
|
+
top_level_interaction_action: Tiếp tục
|
17
|
+
request_storage_access_heading: "%{app} cần quyền truy cập cookie"
|
18
|
+
request_storage_access_body: Nhờ vậy, ứng dụng có thể xác thực bạn bằng cách tạm
|
19
|
+
thời lưu trữ thông tin cá nhân của bạn. Nhấp vào tiếp tục và cho phép cookie sử
|
20
|
+
dụng ứng dụng.
|
21
|
+
request_storage_access_footer: Cookie sẽ hết hạn sau 30 ngày.
|
22
|
+
request_storage_access_action: Tiếp tục
|
data/config/locales/zh-CN.yml
CHANGED
@@ -8,7 +8,7 @@ zh-CN:
|
|
8
8
|
enable_cookies_footer: Cookie 使此应用能够通过暂时存储您的偏好设置和个人信息来验证您的身份。这些信息将在 30 天后过期。
|
9
9
|
enable_cookies_action: 启用 Cookie
|
10
10
|
top_level_interaction_heading: 您的浏览器需要对 %{app} 进行验证
|
11
|
-
top_level_interaction_body: 您的浏览器要求类似 %{app}
|
11
|
+
top_level_interaction_body: 您的浏览器要求类似 %{app} 的应用向您申请访问 Cookie,之后 Shopify 才能为您打开它。
|
12
12
|
top_level_interaction_action: 继续
|
13
13
|
request_storage_access_heading: "%{app} 需要访问 Cookie"
|
14
14
|
request_storage_access_body: 这使此应用能够通过暂时存储您的个人信息来验证您的身份。单击继续并启用 Cookie 以使用此应用。
|
data/docs/Releasing.md
CHANGED
@@ -1,18 +1,21 @@
|
|
1
|
-
Releasing ShopifyApp
|
1
|
+
# Releasing ShopifyApp
|
2
2
|
|
3
|
-
1.
|
3
|
+
1. Make the code changes in a separate PR that doesn't modify the version.
|
4
|
+
1. After that is merged, check the Semantic Versioning page for info on how to version the new release: http://semver.org
|
4
5
|
1. Create a pull request with the following changes:
|
5
6
|
- Update the version of ShopifyApp in lib/shopify_app/version.rb
|
6
7
|
- Update the version of shopify_app in package.json
|
8
|
+
- Run `bundle` to update `Gemfile.lock`
|
7
9
|
- Add a CHANGELOG entry for the new release with the date
|
8
10
|
- Change the title of the PR to something like: "Packaging for release X.Y.Z"
|
9
11
|
1. Merge your pull request
|
10
12
|
1. Checkout and pull from master so you have the latest version of the shopify_app
|
11
13
|
1. Tag the HEAD with the version
|
12
|
-
```bash
|
13
|
-
$ git tag -f vX.Y.Z && git push --tags --force
|
14
|
-
```
|
14
|
+
```bash
|
15
|
+
$ git tag -f vX.Y.Z && git push --tags --force
|
16
|
+
```
|
17
|
+
1. Check that Create Release workflow successfully runs
|
15
18
|
1. Use Shipit to build and push the gem
|
16
19
|
|
17
|
-
If you see an error like 'You need to create the vX.Y.X tag first', clear
|
20
|
+
If you see an error like 'You need to create the vX.Y.X tag first', clear git
|
18
21
|
cache in Shipit settings
|
@@ -6,16 +6,15 @@ module ShopifyApp
|
|
6
6
|
class HomeControllerGenerator < Rails::Generators::Base
|
7
7
|
source_root File.expand_path('../templates', __FILE__)
|
8
8
|
|
9
|
-
class_option :
|
9
|
+
class_option :with_cookie_authentication, type: :boolean, default: false
|
10
|
+
class_option :embedded, type: :string, default: 'true'
|
10
11
|
|
11
12
|
def create_home_controller
|
12
|
-
@with_session_token = options['with_session_token']
|
13
|
-
|
14
13
|
template(home_controller_template, 'app/controllers/home_controller.rb')
|
15
14
|
end
|
16
15
|
|
17
16
|
def create_products_controller
|
18
|
-
generate("shopify_app:products_controller")
|
17
|
+
generate("shopify_app:products_controller") unless with_cookie_authentication?
|
19
18
|
end
|
20
19
|
|
21
20
|
def create_home_index_view
|
@@ -28,16 +27,26 @@ module ShopifyApp
|
|
28
27
|
|
29
28
|
private
|
30
29
|
|
30
|
+
def embedded?
|
31
|
+
options['embedded'] == 'true'
|
32
|
+
end
|
33
|
+
|
31
34
|
def embedded_app?
|
32
35
|
ShopifyApp.configuration.embedded_app?
|
33
36
|
end
|
34
37
|
|
35
|
-
def
|
36
|
-
|
38
|
+
def with_cookie_authentication?
|
39
|
+
options['with_cookie_authentication']
|
37
40
|
end
|
38
41
|
|
39
42
|
def home_controller_template
|
40
|
-
|
43
|
+
return 'unauthenticated_home_controller.rb' unless authenticated_home_controller_required?
|
44
|
+
|
45
|
+
'home_controller.rb'
|
46
|
+
end
|
47
|
+
|
48
|
+
def authenticated_home_controller_required?
|
49
|
+
with_cookie_authentication? || !embedded? || !embedded_app?
|
41
50
|
end
|
42
51
|
end
|
43
52
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
rel="stylesheet"
|
8
8
|
href="https://unpkg.com/@shopify/polaris@4.25.0/styles.min.css"
|
9
9
|
/>
|
10
|
-
<%
|
10
|
+
<% unless with_cookie_authentication? %> <script>
|
11
11
|
document.addEventListener("DOMContentLoaded", async function() {
|
12
12
|
var SessionToken = window["app-bridge"].actions.SessionToken
|
13
13
|
var app = window.app;
|
@@ -47,7 +47,7 @@
|
|
47
47
|
<% end %> </head>
|
48
48
|
<body>
|
49
49
|
<h2>Products</h2>
|
50
|
-
<%
|
50
|
+
<% unless with_cookie_authentication? %> <div id="products"><br>Loading...</div><% else %>
|
51
51
|
<ul>
|
52
52
|
<%% @products.each do |product| %>
|
53
53
|
<li><%%= link_to product.title, "https://#{@current_shopify_session.domain}/admin/products/#{product.id}", target: "_top" %></li>
|
@@ -55,17 +55,17 @@
|
|
55
55
|
</ul>
|
56
56
|
|
57
57
|
<hr>
|
58
|
-
|
58
|
+
<% end %>
|
59
59
|
<h2>Webhooks</h2>
|
60
60
|
|
61
61
|
<%% if @webhooks.present? %>
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
<ul>
|
63
|
+
<%% @webhooks.each do |webhook| %>
|
64
|
+
<li><%%= webhook.topic %> : <%%= webhook.address %></li>
|
65
|
+
<%% end %>
|
66
|
+
</ul>
|
67
67
|
<%% else %>
|
68
|
-
|
69
|
-
<%% end
|
68
|
+
<p>This app has not created any webhooks for this Shop. Add webhooks to your ShopifyApp initializer if you need webhooks</p>
|
69
|
+
<%% end %>
|
70
70
|
</body>
|
71
71
|
</html>
|