shopify_app 13.0.0 → 17.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug-report.md +63 -0
  3. data/.github/ISSUE_TEMPLATE/config.yml +1 -0
  4. data/.github/ISSUE_TEMPLATE/feature-request.md +33 -0
  5. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  6. data/.github/workflows/build.yml +38 -0
  7. data/.github/workflows/release.yml +24 -0
  8. data/.github/workflows/rubocop.yml +22 -0
  9. data/.gitignore +0 -2
  10. data/.rubocop.yml +14 -6
  11. data/CHANGELOG.md +132 -0
  12. data/CONTRIBUTING.md +76 -0
  13. data/Gemfile +5 -0
  14. data/Gemfile.lock +256 -0
  15. data/README.md +72 -534
  16. data/Rakefile +1 -0
  17. data/SECURITY.md +59 -0
  18. data/app/assets/images/storage_access.svg +1 -2
  19. data/app/assets/javascripts/shopify_app/storage_access.js +2 -1
  20. data/app/assets/javascripts/shopify_app/top_level_interaction.js +1 -1
  21. data/app/controllers/concerns/shopify_app/authenticated.rb +1 -0
  22. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +26 -0
  23. data/app/controllers/concerns/shopify_app/require_known_shop.rb +39 -0
  24. data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +32 -0
  25. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  26. data/app/controllers/shopify_app/callback_controller.rb +105 -18
  27. data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
  28. data/app/controllers/shopify_app/sessions_controller.rb +22 -10
  29. data/app/controllers/shopify_app/webhooks_controller.rb +6 -5
  30. data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
  31. data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
  32. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
  33. data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
  34. data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
  35. data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
  36. data/app/views/shopify_app/sessions/enable_cookies.html.erb +2 -7
  37. data/app/views/shopify_app/sessions/new.html.erb +38 -110
  38. data/app/views/shopify_app/sessions/request_storage_access.html.erb +1 -1
  39. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +21 -22
  40. data/config/locales/de.yml +11 -11
  41. data/config/locales/fi.yml +1 -1
  42. data/config/locales/nl.yml +7 -7
  43. data/config/locales/th.yml +4 -4
  44. data/config/locales/vi.yml +22 -0
  45. data/config/locales/zh-CN.yml +1 -1
  46. data/config/routes.rb +1 -0
  47. data/docs/Quickstart.md +15 -87
  48. data/docs/Releasing.md +18 -14
  49. data/docs/Upgrading.md +110 -0
  50. data/docs/shopify_app/authentication.md +124 -0
  51. data/docs/shopify_app/engine.md +82 -0
  52. data/docs/shopify_app/generators.md +127 -0
  53. data/docs/shopify_app/handling-access-scopes-changes.md +8 -0
  54. data/docs/shopify_app/script-tags.md +28 -0
  55. data/docs/shopify_app/session-repository.md +88 -0
  56. data/docs/shopify_app/testing.md +38 -0
  57. data/docs/shopify_app/webhooks.md +72 -0
  58. data/karma.conf.js +1 -1
  59. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +5 -3
  60. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  61. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +2 -1
  62. data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +4 -4
  63. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +5 -4
  64. data/lib/generators/shopify_app/add_webhook/templates/{webhook_job.rb → webhook_job.rb.tt} +5 -0
  65. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +4 -3
  66. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +3 -3
  67. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +10 -9
  68. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +1 -1
  69. data/lib/generators/shopify_app/controllers/controllers_generator.rb +2 -1
  70. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +31 -3
  71. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +2 -0
  72. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +66 -16
  73. data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +11 -0
  74. data/lib/generators/shopify_app/install/install_generator.rb +46 -11
  75. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
  76. data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
  77. data/lib/generators/shopify_app/install/templates/omniauth.rb +3 -1
  78. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +25 -0
  79. data/lib/generators/shopify_app/install/templates/shopify_provider.rb.tt +8 -0
  80. data/lib/generators/shopify_app/install/templates/user_agent.rb +2 -1
  81. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
  82. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
  83. data/lib/generators/shopify_app/routes/routes_generator.rb +1 -0
  84. data/lib/generators/shopify_app/routes/templates/routes.rb +10 -9
  85. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +39 -7
  86. data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +5 -0
  87. data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
  88. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  89. data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +5 -0
  90. data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
  91. data/lib/generators/shopify_app/user_model/user_model_generator.rb +39 -7
  92. data/lib/generators/shopify_app/views/views_generator.rb +2 -1
  93. data/lib/shopify_app/access_scopes/noop_strategy.rb +13 -0
  94. data/lib/shopify_app/access_scopes/shop_strategy.rb +24 -0
  95. data/lib/shopify_app/access_scopes/user_strategy.rb +41 -0
  96. data/lib/shopify_app/configuration.rb +40 -8
  97. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -3
  98. data/lib/shopify_app/controller_concerns/csrf_protection.rb +15 -0
  99. data/lib/shopify_app/controller_concerns/embedded_app.rb +3 -2
  100. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  101. data/lib/shopify_app/controller_concerns/login_protection.rb +74 -16
  102. data/lib/shopify_app/controller_concerns/payload_verification.rb +24 -0
  103. data/lib/shopify_app/controller_concerns/webhook_verification.rb +3 -18
  104. data/lib/shopify_app/engine.rb +26 -0
  105. data/lib/shopify_app/jobs/scripttags_manager_job.rb +1 -1
  106. data/lib/shopify_app/jobs/webhooks_manager_job.rb +1 -1
  107. data/lib/shopify_app/managers/scripttags_manager.rb +4 -3
  108. data/lib/shopify_app/managers/webhooks_manager.rb +4 -3
  109. data/lib/shopify_app/middleware/jwt_middleware.rb +42 -0
  110. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +2 -1
  111. data/lib/shopify_app/omniauth/omniauth_configuration.rb +64 -0
  112. data/lib/shopify_app/session/in_memory_session_store.rb +7 -3
  113. data/lib/shopify_app/session/in_memory_shop_session_store.rb +12 -0
  114. data/lib/shopify_app/session/in_memory_user_session_store.rb +12 -0
  115. data/lib/shopify_app/session/jwt.rb +63 -0
  116. data/lib/shopify_app/session/null_user_session_store.rb +22 -0
  117. data/lib/shopify_app/session/session_repository.rb +13 -16
  118. data/lib/shopify_app/session/session_storage.rb +1 -0
  119. data/lib/shopify_app/session/shop_session_storage.rb +21 -9
  120. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +58 -0
  121. data/lib/shopify_app/session/user_session_storage.rb +19 -8
  122. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +58 -0
  123. data/lib/shopify_app/test_helpers/all.rb +2 -0
  124. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +17 -0
  125. data/lib/shopify_app/utils.rb +18 -5
  126. data/lib/shopify_app/version.rb +2 -1
  127. data/lib/shopify_app.rb +22 -5
  128. data/package.json +7 -8
  129. data/shopify_app.gemspec +13 -8
  130. data/translation.yml +1 -1
  131. data/yarn.lock +2120 -2168
  132. metadata +88 -16
  133. data/.github/ISSUE_TEMPLATE.md +0 -14
  134. data/.travis.yml +0 -27
  135. data/docs/install-on-dev-shop.png +0 -0
  136. data/docs/test-your-app.png +0 -0
  137. data/lib/generators/shopify_app/install/templates/shopify_app.rb +0 -15
  138. data/lib/generators/shopify_app/install/templates/shopify_provider.rb +0 -20
  139. data/package-lock.json +0 -7245
@@ -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>
@@ -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' %>
@@ -15,15 +16,9 @@
15
16
  }
16
17
  </style>
17
18
 
18
- <script>
19
- window.apiKey = "<%= ShopifyApp.configuration.api_key %>";
20
- window.shopOrigin = "https://<%= @shop %>";
21
- window.redirectUrl = "<%= @url %>";
22
- </script>
23
-
24
19
  <%= javascript_include_tag('shopify_app/top_level', crossorigin: 'anonymous', integrity: true) %>
25
20
  </head>
26
- <body>
21
+ <body data-api-key="<%= ShopifyApp.configuration.api_key %>" data-shop-origin="https://<%= @shop %>" data-redirect-url="<%= @url %>">
27
22
  <main id="TopLevelInteractionContent">
28
23
  <div class="Polaris-Page">
29
24
  <div class="Polaris-Page__Content">
@@ -31,26 +26,30 @@
31
26
  <div class="Polaris-Layout__Section">
32
27
  <div class="Polaris-Stack Polaris-Stack--vertical">
33
28
  <div class="Polaris-Stack__Item">
34
- <div class="Polaris-EmptyState">
35
- <div class="Polaris-EmptyState__Section">
36
- <div class="Polaris-EmptyState__DetailsContainer">
37
- <div class="Polaris-EmptyState__Details">
38
- <div class="Polaris-TextContainer">
39
- <h1 class="Polaris-DisplayText Polaris-DisplayText--sizeMedium"><%= I18n.t('top_level_interaction_heading', app: ShopifyApp.configuration.application_name) %></h1>
40
- <div class="Polaris-EmptyState__Content">
41
- <p><%= I18n.t('top_level_interaction_body', app: ShopifyApp.configuration.application_name) %></p>
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>
42
46
  </div>
43
47
  </div>
44
- <div class="Polaris-EmptyState__Actions">
45
- <div class="Polaris-Stack Polaris-Stack--alignmentCenter">
46
- <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>
47
- </div>
48
+ <div class="Polaris-EmptyState__ImageContainer">
49
+ <%= image_tag 'storage_access.svg', role: "presentation", alt: "", class: "Polaris-EmptyState__Image" %>
48
50
  </div>
49
51
  </div>
50
52
  </div>
51
- <div class="Polaris-EmptyState__ImageContainer">
52
- <%= image_tag 'storage_access.svg', role: "presentation", alt: "", class: "Polaris-EmptyState__Image" %>
53
- </div>
54
53
  </div>
55
54
  </div>
56
55
  </div>
@@ -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: Sie müssen Cookies in diesem Browser manuell aktivieren, um
8
- %{app} in Shopify verwenden zu können.
9
- enable_cookies_footer: Mithilfe von Cookies kann die App Sie authentifizieren, indem
10
- Ihre Einstellungen und personenbezogenen Daten vorübergehend gespeichert werden.
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: Ihr Browser muss %{app} authentifizieren
14
- top_level_interaction_body: Ihr Browser verlangt, dass Apps wie %{app} Sie um Zugriff
15
- auf Cookies bitten, bevor Shopify sie für Sie öffnen kann.
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 Sie authentifizieren, indem Ihre
19
- Einstellungen und personenbezogenen Daten vorübergehend gespeichert werden. Klicken
20
- Sie auf "Weiter" und erlauben Sie den Cookies, die App zu verwenden.
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
@@ -15,6 +15,6 @@ fi:
15
15
  top_level_interaction_action: Jatka
16
16
  request_storage_access_heading: "%{app} edellyttää evästeiden käyttöä"
17
17
  request_storage_access_body: Näin sovellus voi todentaa sinut tallentamalla henkilötietosi
18
- tilapäisesti. Napsauta Jatka ja salli evästeet sovelluksen käyttämiseksi.
18
+ tilapäisesti. Klikkaa Jatka ja salli evästeet sovelluksen käyttämiseksi.
19
19
  request_storage_access_footer: Evästeet vanhenevat 30 päivän kuluttua.
20
20
  request_storage_access_action: Jatka
@@ -1,20 +1,20 @@
1
1
  ---
2
2
  nl:
3
- logged_out: u bent afgemeld
3
+ logged_out: Je bent afgemeld
4
4
  could_not_log_in: Kon niet aanmelden bij Shopify-winkel
5
5
  invalid_shop_url: Ongeldig winkeldomein
6
6
  enable_cookies_heading: Schakel cookies in van %{app}
7
- enable_cookies_body: U moet cookies in deze browser handmatig inschakelen om %{app}
7
+ enable_cookies_body: Je moet cookies in deze browser handmatig inschakelen om %{app}
8
8
  binnen Shopify te gebruiken.
9
- enable_cookies_footer: Met cookies kan de app u verifiëren door uw voorkeuren en
9
+ enable_cookies_footer: Met cookies kan de app je verifiëren door je voorkeuren en
10
10
  persoonlijke informatie tijdelijk op te slaan. Ze vervallen na 30 dagen.
11
11
  enable_cookies_action: Schakel cookies in
12
- top_level_interaction_heading: Uw browser moet %{app} verifiëren
13
- top_level_interaction_body: Uw browser heeft apps nodig zoals %{app} om u toegang
14
- te vragen tot cookies voordat Shopify het voor u kan openen.
12
+ top_level_interaction_heading: Je browser moet %{app} verifiëren
13
+ top_level_interaction_body: Je browser heeft apps nodig zoals %{app} om je toegang
14
+ te vragen tot cookies voordat Shopify het voor je kan openen.
15
15
  top_level_interaction_action: Doorgaan
16
16
  request_storage_access_heading: "%{app} heeft toegang tot cookies nodig"
17
- request_storage_access_body: Hiermee kan de app u verifiëren door uw persoonlijke
17
+ request_storage_access_body: Hiermee kan de app je verifiëren door je persoonlijke
18
18
  gegevens tijdelijk op te slaan. Klik op Doorgaan en sta cookies toe om de app
19
19
  te gebruiken.
20
20
  request_storage_access_footer: Cookies verlopen na 30 dagen.
@@ -3,12 +3,12 @@ th:
3
3
  logged_out: ออกจากระบบสำเร็จ
4
4
  could_not_log_in: ไม่สามารถเข้าสู่ระบบร้านค้า Shopify ได้
5
5
  invalid_shop_url: โดเมนร้านค้าไม่ถูกต้อง
6
- enable_cookies_heading: เปิดใช้งานคุกกี้จาก %{app}
7
- enable_cookies_body: คุณต้องเปิดใช้งานคุกกี้ด้วยตนเองในเบราว์เซอร์นี้เพื่อใช้งาน
8
- %{app} ภายใน Shopify
6
+ enable_cookies_heading: เปิดใช้คุกกี้จาก %{app}
7
+ enable_cookies_body: คุณต้องเปิดใช้คุกกี้ด้วยตนเองในเบราว์เซอร์นี้เพื่อใช้งาน %{app}
8
+ ภายใน Shopify
9
9
  enable_cookies_footer: คุกกี้ช่วยให้แอปตรวจสอบความถูกต้องของคุณด้วยการจัดเก็บความชื่นชอบและข้อมูลส่วนตัวของคุณชั่วคราว
10
10
  คุกกี้จะหมดอายุหลังจาก 30 วัน
11
- enable_cookies_action: เปิดใช้งานคุกกี้
11
+ enable_cookies_action: เปิดใช้คุกกี้
12
12
  top_level_interaction_heading: เบราว์เซอร์ของคุณต้องรับรองความถูกต้องของ %{app}
13
13
  top_level_interaction_body: เบราว์เซอร์ของคุณต้องการแอปอย่าง %{app} เพื่อขอให้คุณเข้าถึงคุกกี้ก่อนที่
14
14
  Shopify จะสามารถเปิดมันให้คุณได้
@@ -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
@@ -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} 的应用向您请求访问 Cookie,之后 Shopify 才能为您打开它。
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/config/routes.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  ShopifyApp::Engine.routes.draw do
2
3
  controller :sessions do
3
4
  get 'login' => :new, :as => :login
data/docs/Quickstart.md CHANGED
@@ -1,103 +1,31 @@
1
- Quickstart
2
- ==========
1
+ # Quickstart
3
2
 
4
- Get started building and deploying a new Shopify App to Heroku in just a few minutes. This guide assumes you have Ruby/Rails installed on your computer already; if you haven't done that already start with [this guide.](https://guides.rubyonrails.org/v5.0/getting_started.html#installing-rails)
3
+ This guide assumes you have completed the steps to create a new Rails app using the Shopify App gem found in the [*Usage*](/README.md#usage) section of the project's [*README*](/README.md).
5
4
 
6
- 1. New Rails App (with postgres)
7
- --------------------------------
5
+ #### Table of contents
8
6
 
9
- To create a new Rails app and use this generator, open your terminal and run the following commands:
7
+ [Make your app available to the internet](#make-your-app-available-to-the-internet)
10
8
 
11
- ```sh
12
- $ rails new test-app --database=postgresql
13
- $ cd test-app
14
- $ git init
15
- $ git add .
16
- $ git commit -m 'new rails app'
17
- ```
18
-
19
- 2. Create a new Heroku app
20
- --------------------------
21
-
22
- The next step is to create a new Heroku app to host your application. If you haven't got a Heroku account yet, create a free account [here](https://www.heroku.com/).
23
-
24
- Head to the Heroku dashboard and create a new app, or run the following commands with the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli#download-and-install) installed, substituting `name` for the name of your own app:
25
-
26
- CLI:
27
- ```sh
28
- $ heroku create name
29
- $ heroku git:remote -a name
30
- ```
31
-
32
- Once you have created an app on Heroku, we need to let Git know where the Heroku server is so we can deploy to it later. Copy the app's name from your Heroku dashboard and substitute `appname.git` with the name you chose earlier:
9
+ [Use Shopify App Bridge to embed your app in the Shopify Admin](#use-shopify-app-bridge-to-embed-your-app-in-the-shopify-admin)
33
10
 
34
- web:
35
- ```sh
36
- # https://dashboard.heroku.com/new
37
- $ git remote add heroku git@heroku.com:appname.git
38
- ```
11
+ ## Make your app available to the internet
39
12
 
40
- 3. Create a new App in the Shopify Partner dashboard
41
- -----------------------------------------
42
- * Create a Shopify app in the [Partners dashboard](https://partner.shopify.com). For this tutorial, you can choose either a public or custom app, but you can [learn about App Types here.](https://help.shopify.com/en/manual/apps/app-types)
43
- [https://app.shopify.com/services/partners/api_clients](https://app.shopify.com/services/partners/api_clients)
44
- * Set the callback url to `https://<appname>.herokuapp.com/`
45
- * Choose an embedded app
46
- * Set the app's `redirect_uri` to `https://<appname>.herokuapp.com/auth/shopify/callback`
13
+ Your local app needs to be accessible from the public Internet in order to install it on a Shopify store, to use the [App Proxy Controller](/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb) or receive [webhooks](/docs/shopify_app/webhooks.md).
47
14
 
48
- 4. Add ShopifyApp to Gemfile
49
- ----------------------------
15
+ Use a tunneling service like [ngrok](https://ngrok.com/), [Beeceptor](https://beeceptor.com/), [Mockbin](http://mockbin.org/), or [Hookbin](https://hookbin.com/) to make your development environment accessible to the internet.
50
16
 
51
- Run these commands to add the `shopify_app` Gem to your app:
17
+ For example with [ngrok](https://ngrok.com/), run this command to set up a tunnel proxy to Rails' default port:
52
18
 
53
19
  ```sh
54
- $ echo "gem 'shopify_app'" >> Gemfile
55
- $ bundle install
20
+ ngrok http 3000
56
21
  ```
57
22
 
58
- **Note:** we recommend using the latest version of Shopify Gem. Check the [Git tags](https://github.com/Shopify/shopify_app/tags) to see the latest release version and then add it to your Gemfile e.g `gem 'shopify_app', '~> 7.0.0'`
59
-
60
- 5. Run the ShopifyApp generator
61
- -------------------------------
62
-
63
- Generate the code for your app by running these commands:
64
-
65
- ```sh
66
- # Use the keys from your app you created in the partners area
67
- $ rails generate shopify_app --api_key <shopify_api_key> --secret <shopify_api_secret>
68
- $ git add .
69
- $ git commit -m 'generated shopify app'
70
- ```
71
-
72
- If you forget to set your keys or redirect uri above, you will find them in the shopify_app initializer at: `/config/initializers/shopify_app.rb`.
73
-
74
- We recommend adding a gem or utilizing environment variables (`.env`) to handle your keys before releasing your app. [Learn more about using environment variables.](https://www.honeybadger.io/blog/ruby-guide-environment-variables/)
75
-
76
- 6. Deploy your app
77
- ---------
78
-
79
- Once you've generated your app, push it into your Heroku environment to see it up and running:
80
- ```sh
81
- $ git push heroku
82
- $ heroku run rake db:migrate
83
- ```
84
-
85
- 7. Install the App!
86
- -------------------
87
-
88
- Ensure you have created a [development store](https://help.shopify.com/en/api/getting-started/making-your-first-request#create-a-development-store) using the Shopify Partner Dashboard. If you don't already have one, [create one by following these instructions](https://help.shopify.com/en/api/getting-started/making-your-first-request#create-a-development-store).
89
-
90
- ##### Note: The following step will cause your store to become `transfer-disabled.` Read more about store transfer and why it's important [here](https://help.shopify.com/en/api/guides/store-transfers#transfer-disabled-stores). This is an irreversible change, so be sure you don't plan to transfer this store to a merchant.
91
-
92
- Install the app onto your new development store using the Partner Dashboard. Log in to your account, visit the apps page, click the app you created earlier, and looking for the `Test your app` instructions where you can select a store to install your app on.
93
-
94
- ![Installing an app on the partners dashboard dropdown](/docs/install-on-dev-shop.png)
23
+ See the [*Embed the app in Shopify*](https://shopify.dev/tutorials/build-rails-react-app-that-uses-app-bridge-authentication#embed-the-app-in-shopify) section of [*Build a Shopify app with Rails, React, and App Bridge*](https://shopify.dev/tutorials/build-rails-react-app-that-uses-app-bridge-authentication) to learn more.
95
24
 
96
- ### OR
25
+ ## Use Shopify App Bridge to embed your app in the Shopify Admin
97
26
 
98
- ![Installing an app on the partners dashboard card](/docs/test-your-app.png)
27
+ A basic example of using [*Shopify App Bridge*](https://shopify.dev/tools/app-bridge) is included in the install generator. An instance Shopify App Bridge is automatically initialized in [shopify_app.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/shopify_app.js).
99
28
 
100
- 8. Great work!
101
- -------------------
29
+ The [flash_messages.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/flash_messages.js) file converts Rails [flash messages](https://api.rubyonrails.org/classes/ActionDispatch/Flash.html) to App Bridge Toast actions automatically. By default, this library is included via [unpkg in the embedded_app layout](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/embedded_app.html.erb#L27).
102
30
 
103
- You're done creating your first app on Shopify. Keep going and learn more by [diving into our full documentation](https://help.shopify.com/en/api/getting-started), or join our [community of developers.](https://community.shopify.com/c/Shopify-Apps/bd-p/shopify-apps)
31
+ For more advanced uses it is recommended to [install App Bridge via npm or yarn](https://help.shopify.com/en/api/embedded-apps/app-bridge/getting-started#set-up-shopify-app-bridge-in-your-app).