disco_app 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +37 -0
  3. data/app/assets/images/disco_app/icon.svg +1 -0
  4. data/app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx +29 -0
  5. data/app/assets/javascripts/disco_app/components.js +5 -0
  6. data/app/assets/javascripts/disco_app/disco_app.js +7 -0
  7. data/app/assets/javascripts/disco_app/frame.js +152 -0
  8. data/app/assets/javascripts/disco_app/shopify-turbolinks.js +7 -0
  9. data/app/assets/stylesheets/disco_app/bootstrap/_custom.scss +54 -0
  10. data/app/assets/stylesheets/disco_app/bootstrap/_variables.scss +872 -0
  11. data/app/assets/stylesheets/disco_app/disco/_buttons.scss +31 -0
  12. data/app/assets/stylesheets/disco_app/disco/_cards.scss +51 -0
  13. data/app/assets/stylesheets/disco_app/disco/_forms.scss +23 -0
  14. data/app/assets/stylesheets/disco_app/disco/_grid.scss +58 -0
  15. data/app/assets/stylesheets/disco_app/disco/_sections.scss +61 -0
  16. data/app/assets/stylesheets/disco_app/disco/_tables.scss +57 -0
  17. data/app/assets/stylesheets/disco_app/disco/_tabs.scss +61 -0
  18. data/app/assets/stylesheets/disco_app/disco/_type.scss +39 -0
  19. data/app/assets/stylesheets/disco_app/disco/mixins/_flexbox.scss +394 -0
  20. data/app/assets/stylesheets/disco_app/disco_app.scss +16 -0
  21. data/app/assets/stylesheets/disco_app/frame/_buttons.scss +54 -0
  22. data/app/assets/stylesheets/disco_app/frame/_forms.scss +26 -0
  23. data/app/assets/stylesheets/disco_app/frame/_layout.scss +77 -0
  24. data/app/assets/stylesheets/disco_app/frame/_type.scss +32 -0
  25. data/app/assets/stylesheets/disco_app/frame.scss +9 -0
  26. data/app/controllers/disco_app/app_proxy_controller.rb +41 -0
  27. data/app/controllers/disco_app/authenticated_controller.rb +44 -0
  28. data/app/controllers/disco_app/carrier_request_controller.rb +28 -0
  29. data/app/controllers/disco_app/charges_controller.rb +30 -0
  30. data/app/controllers/disco_app/frame_controller.rb +9 -0
  31. data/app/controllers/disco_app/install_controller.rb +26 -0
  32. data/app/controllers/disco_app/webhooks_controller.rb +42 -0
  33. data/app/helpers/disco_app/application_helper.rb +28 -0
  34. data/app/jobs/disco_app/app_installed_job.rb +3 -0
  35. data/app/jobs/disco_app/app_uninstalled_job.rb +3 -0
  36. data/app/jobs/disco_app/concerns/app_installed_job.rb +22 -0
  37. data/app/jobs/disco_app/concerns/app_uninstalled_job.rb +23 -0
  38. data/app/jobs/disco_app/concerns/shop_update_job.rb +16 -0
  39. data/app/jobs/disco_app/concerns/synchronise_carrier_service_job.rb +51 -0
  40. data/app/jobs/disco_app/concerns/synchronise_webhooks_job.rb +53 -0
  41. data/app/jobs/disco_app/shop_job.rb +27 -0
  42. data/app/jobs/disco_app/shop_update_job.rb +3 -0
  43. data/app/jobs/disco_app/synchronise_carrier_service_job.rb +3 -0
  44. data/app/jobs/disco_app/synchronise_webhooks_job.rb +3 -0
  45. data/app/models/disco_app/concerns/plan.rb +14 -0
  46. data/app/models/disco_app/concerns/shop.rb +71 -0
  47. data/app/models/disco_app/concerns/subscription.rb +14 -0
  48. data/app/models/disco_app/plan.rb +3 -0
  49. data/app/models/disco_app/session_storage.rb +18 -0
  50. data/app/models/disco_app/shop.rb +3 -0
  51. data/app/models/disco_app/subscription.rb +3 -0
  52. data/app/services/disco_app/charges_service.rb +73 -0
  53. data/app/services/disco_app/subscription_service.rb +25 -0
  54. data/app/services/disco_app/webhook_service.rb +30 -0
  55. data/app/views/disco_app/charges/activate.html.erb +1 -0
  56. data/app/views/disco_app/charges/create.html.erb +1 -0
  57. data/app/views/disco_app/charges/new.html.erb +45 -0
  58. data/app/views/disco_app/frame/frame.html.erb +36 -0
  59. data/app/views/disco_app/install/installing.html.erb +7 -0
  60. data/app/views/disco_app/install/uninstalling.html.erb +1 -0
  61. data/app/views/disco_app/proxy_errors/404.html.erb +1 -0
  62. data/app/views/disco_app/shared/_card.html.erb +14 -0
  63. data/app/views/disco_app/shared/_section.html.erb +17 -0
  64. data/app/views/layouts/application.html.erb +18 -0
  65. data/app/views/layouts/embedded_app.html.erb +41 -0
  66. data/app/views/layouts/embedded_app_modal.html.erb +17 -0
  67. data/app/views/sessions/new.html.erb +26 -0
  68. data/config/routes.rb +26 -0
  69. data/db/migrate/20150525000000_create_shops_if_not_existent.rb +15 -0
  70. data/db/migrate/20150525162112_add_status_to_shops.rb +5 -0
  71. data/db/migrate/20150525171422_add_meta_to_shops.rb +11 -0
  72. data/db/migrate/20150629210346_add_charge_status_to_shop.rb +5 -0
  73. data/db/migrate/20150814214025_add_more_meta_to_shops.rb +15 -0
  74. data/db/migrate/20151017231302_create_disco_app_plans.rb +13 -0
  75. data/db/migrate/20151017232027_create_disco_app_subscriptions.rb +15 -0
  76. data/db/migrate/20151017234409_move_shop_to_disco_app_engine.rb +5 -0
  77. data/db/migrate/20160112233706_create_disco_app_sessions.rb +12 -0
  78. data/db/migrate/20160113194418_add_shop_id_to_disco_app_sessions.rb +6 -0
  79. data/lib/disco_app/engine.rb +25 -0
  80. data/lib/disco_app/session.rb +12 -0
  81. data/lib/disco_app/support/file_fixtures.rb +23 -0
  82. data/lib/disco_app/test_help.rb +11 -0
  83. data/lib/disco_app/version.rb +3 -0
  84. data/lib/disco_app.rb +4 -0
  85. data/lib/generators/disco_app/USAGE +5 -0
  86. data/lib/generators/disco_app/disco_app_generator.rb +161 -0
  87. data/lib/generators/disco_app/mailify/mailify_generator.rb +54 -0
  88. data/lib/generators/disco_app/reactify/reactify_generator.rb +45 -0
  89. data/lib/generators/disco_app/rollbarify/rollbarify_generator.rb +26 -0
  90. data/lib/generators/disco_app/rollbarify/templates/initializers/rollbar.rb +12 -0
  91. data/lib/generators/disco_app/templates/assets/javascripts/application.js +17 -0
  92. data/lib/generators/disco_app/templates/assets/stylesheets/application.scss +5 -0
  93. data/lib/generators/disco_app/templates/config/puma.rb +15 -0
  94. data/lib/generators/disco_app/templates/controllers/home_controller.rb +7 -0
  95. data/lib/generators/disco_app/templates/initializers/disco_app.rb +1 -0
  96. data/lib/generators/disco_app/templates/initializers/session_store.rb +2 -0
  97. data/lib/generators/disco_app/templates/initializers/shopify_app.rb +7 -0
  98. data/lib/generators/disco_app/templates/initializers/shopify_session_repository.rb +7 -0
  99. data/lib/generators/disco_app/templates/root/Procfile +2 -0
  100. data/lib/generators/disco_app/templates/views/home/index.html.erb +2 -0
  101. data/lib/tasks/carrier_service.rake +10 -0
  102. data/lib/tasks/sessions.rake +9 -0
  103. data/lib/tasks/start.rake +3 -0
  104. data/lib/tasks/webhooks.rake +10 -0
  105. data/test/controllers/disco_app/install_controller_test.rb +50 -0
  106. data/test/controllers/disco_app/webhooks_controller_test.rb +58 -0
  107. data/test/controllers/home_controller_test.rb +61 -0
  108. data/test/disco_app_test.rb +7 -0
  109. data/test/dummy/Rakefile +6 -0
  110. data/test/dummy/app/assets/javascripts/application.js +17 -0
  111. data/test/dummy/app/assets/stylesheets/application.scss +5 -0
  112. data/test/dummy/app/controllers/application_controller.rb +6 -0
  113. data/test/dummy/app/controllers/home_controller.rb +7 -0
  114. data/test/dummy/app/helpers/application_helper.rb +2 -0
  115. data/test/dummy/app/jobs/disco_app/app_uninstalled_job.rb +11 -0
  116. data/test/dummy/app/models/disco_app/shop.rb +15 -0
  117. data/test/dummy/app/views/home/index.html.erb +2 -0
  118. data/test/dummy/bin/bundle +3 -0
  119. data/test/dummy/bin/rails +4 -0
  120. data/test/dummy/bin/rake +4 -0
  121. data/test/dummy/bin/setup +29 -0
  122. data/test/dummy/config/application.rb +41 -0
  123. data/test/dummy/config/boot.rb +5 -0
  124. data/test/dummy/config/database.yml +25 -0
  125. data/test/dummy/config/environment.rb +5 -0
  126. data/test/dummy/config/environments/development.rb +41 -0
  127. data/test/dummy/config/environments/production.rb +85 -0
  128. data/test/dummy/config/environments/test.rb +42 -0
  129. data/test/dummy/config/initializers/assets.rb +11 -0
  130. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  131. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  132. data/test/dummy/config/initializers/disco_app.rb +1 -0
  133. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  134. data/test/dummy/config/initializers/inflections.rb +16 -0
  135. data/test/dummy/config/initializers/mime_types.rb +4 -0
  136. data/test/dummy/config/initializers/omniauth.rb +9 -0
  137. data/test/dummy/config/initializers/session_store.rb +2 -0
  138. data/test/dummy/config/initializers/shopify_app.rb +7 -0
  139. data/test/dummy/config/initializers/shopify_session_repository.rb +7 -0
  140. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  141. data/test/dummy/config/locales/en.yml +23 -0
  142. data/test/dummy/config/routes.rb +8 -0
  143. data/test/dummy/config/secrets.yml +22 -0
  144. data/test/dummy/config.ru +4 -0
  145. data/test/dummy/db/schema.rb +81 -0
  146. data/test/dummy/public/404.html +67 -0
  147. data/test/dummy/public/422.html +67 -0
  148. data/test/dummy/public/500.html +66 -0
  149. data/test/dummy/public/favicon.ico +0 -0
  150. data/test/fixtures/api/widget_store/shop.json +46 -0
  151. data/test/fixtures/api/widget_store/webhooks.json +1 -0
  152. data/test/fixtures/disco_app/plans.yml +32 -0
  153. data/test/fixtures/disco_app/shops.yml +10 -0
  154. data/test/fixtures/disco_app/subscriptions.yml +26 -0
  155. data/test/fixtures/webhooks/app_uninstalled.json +46 -0
  156. data/test/integration/navigation_test.rb +10 -0
  157. data/test/jobs/disco_app/app_installed_job_test.rb +30 -0
  158. data/test/jobs/disco_app/app_uninstalled_job_test.rb +32 -0
  159. data/test/models/disco_app/plan_test.rb +5 -0
  160. data/test/models/disco_app/session_test.rb +31 -0
  161. data/test/models/disco_app/shop_test.rb +26 -0
  162. data/test/models/disco_app/subscription_test.rb +6 -0
  163. data/test/services/disco_app/subscription_service_test.rb +28 -0
  164. data/test/support/test_file_fixtures.rb +29 -0
  165. data/test/test_helper.rb +51 -0
  166. metadata +507 -0
@@ -0,0 +1,31 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin buttons.
3
+ // --------------------------------------------------
4
+
5
+ .btn {
6
+ line-height: 1;
7
+ padding: 8.5px 15px;
8
+ }
9
+
10
+ .btn-default {
11
+ &:hover, &:focus, &:active, &.active {
12
+ border-color: #d3dbe2;
13
+ background-color: #f5f6f7;
14
+ }
15
+ }
16
+
17
+ .btn-primary {
18
+ &:hover, &:focus, &:active, &.active {
19
+ border-color: #4293c2;
20
+ background-color: #4293c2;
21
+ }
22
+ }
23
+
24
+ .btn-disabled {
25
+ &, &:hover, &:focus, &:active {
26
+ cursor: default;
27
+ background: #fafbfc;
28
+ color: #c3cfd8;
29
+ border: 1px solid #d3dbe2;
30
+ }
31
+ }
@@ -0,0 +1,51 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin cards.
3
+ // --------------------------------------------------
4
+
5
+ .next-card {
6
+ background-color: #ffffff;
7
+ border-radius: 3px;
8
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
9
+ }
10
+
11
+ .next-card ~ .next-card {
12
+ margin-top: 20px;
13
+ }
14
+
15
+ .next-card__header {
16
+ padding: 20px 20px 0;
17
+
18
+ h1, h2, h3 {
19
+ margin-bottom: 0;
20
+ font-size: 18px;
21
+ line-height: 1.2em;
22
+ }
23
+ }
24
+
25
+ .next-card__footer {
26
+ padding: 0 20px 20px;
27
+ }
28
+
29
+ .next-card__section {
30
+ padding: 20px;
31
+ }
32
+
33
+ .next-card__section ~ .next-card__section {
34
+ border-top: 1px solid #ebeef0;
35
+ }
36
+
37
+ .next-card__section--no-bottom-padding {
38
+ padding-bottom: 0;
39
+ }
40
+
41
+ .next-card--aside,
42
+ .next-card--disabled {
43
+ background-color: #f5f6f7;
44
+ }
45
+
46
+ .next-card--disabled {
47
+ .next-card__header,
48
+ .next-card__section {
49
+ color: #777777;
50
+ }
51
+ }
@@ -0,0 +1,23 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin forms.
3
+ // --------------------------------------------------
4
+
5
+ .form-control {
6
+ -webkit-box-shadow: none;
7
+ box-shadow: none;
8
+
9
+ font-size: 15px;
10
+ line-height: 20px;
11
+
12
+ &:focus {
13
+ -webkit-box-shadow: none;
14
+ box-shadow: none;
15
+ }
16
+ }
17
+
18
+ .help-block {
19
+ font-style: italic;
20
+ font-size: 13px;
21
+ color: #95a7b7;
22
+ margin-top: 5px;
23
+ }
@@ -0,0 +1,58 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin grid.
3
+ // --------------------------------------------------
4
+
5
+ .next-grid {
6
+ display: flex;
7
+ width: calc(100% - 20px);
8
+ margin: 0 auto;
9
+ box-sizing: border-box;
10
+ padding-top: 10px;
11
+
12
+ &:last-of-type {
13
+ padding-bottom: 10px;
14
+ }
15
+ }
16
+
17
+ .next-grid--no-padding {
18
+ width: 100%;
19
+
20
+ &:first-of-type, &:last-of-type {
21
+ padding: 0;
22
+ }
23
+
24
+ > .next-grid__cell {
25
+ padding: 0;
26
+ }
27
+ }
28
+
29
+ .next-grid--center-aligned, .next-grid--center-both {
30
+ -webkit-box-pack: center;
31
+ -webkit-justify-content: center;
32
+ -ms-flex-pack: center;
33
+ justify-content: center;
34
+ }
35
+
36
+ .next-grid--right-aligned {
37
+ -webkit-box-pack: end;
38
+ -webkit-justify-content: flex-end;
39
+ -ms-flex-pack: end;
40
+ justify-content: flex-end;
41
+ }
42
+
43
+ .next-grid__cell {
44
+ @include flex(1, 1, 0%);
45
+ padding: 10px;
46
+ box-sizing: border-box;
47
+ max-width: 100%;
48
+ min-width: 0;
49
+ }
50
+
51
+ .next-grid__cell--third {
52
+ @include flex(0, 0, 33.333%);
53
+ max-width: 33.333%;
54
+ }
55
+
56
+ .next-grid__cell--no-flex {
57
+ @include flex(0 0 auto);
58
+ }
@@ -0,0 +1,61 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin sections
3
+ // and flexbox layout.
4
+ // --------------------------------------------------
5
+
6
+
7
+ //== Layout
8
+ //
9
+ //## Simple Flexbox layout utilities.
10
+
11
+ .layout-content {
12
+ display: flex;
13
+ }
14
+
15
+ .layout-content__sidebar {
16
+ padding: 20px;
17
+ @include flex(1, 1, 25%);
18
+ max-width: 25%
19
+ }
20
+
21
+ .layout-content__main {
22
+ padding: 20px;
23
+ @include flex(1, 1, 0%);
24
+ }
25
+
26
+ .layout-content__first {
27
+ padding-right: 0;
28
+ }
29
+
30
+
31
+ //== Section
32
+ //
33
+ //## Simple Flexbox layout utilities.
34
+
35
+ //** Main section wrapper.
36
+ .section {
37
+ margin: 0;
38
+ padding: 0;
39
+ border-bottom: 1px solid #e6e6e6;
40
+ }
41
+
42
+ //** Section "summary" to the left of the section.
43
+ .section-summary {
44
+ padding: 20px 20px 20px 30px;
45
+
46
+ h1, h2 {
47
+ line-height: 1.325;
48
+ margin-top: -4px;
49
+ font-size: 18px;
50
+ margin-bottom: 10px;
51
+ }
52
+
53
+ p {
54
+ color: #798c9c;
55
+ margin-bottom: 15px;
56
+
57
+ &:last-child {
58
+ margin-bottom: 0;
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,57 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin tables.
3
+ // --------------------------------------------------
4
+
5
+ table {
6
+ width: 100%;
7
+ border-collapse: separate;
8
+ border-spacing: 0;
9
+
10
+ &.expanded td {
11
+ padding-top: 8px;
12
+ padding-bottom: 8px;
13
+ }
14
+ }
15
+
16
+ th {
17
+ font-weight: 400;
18
+ text-align: left;
19
+ color: #31373d;
20
+ padding: 8px 10px;
21
+ border-bottom: 1px solid #ebeef0;
22
+
23
+ &.is-sortable {
24
+ cursor: pointer;
25
+
26
+ &:hover {
27
+ background: #eff9fd;
28
+ color: #479ccf;
29
+ }
30
+ }
31
+ }
32
+
33
+ td {
34
+ border-bottom: 1px solid #ebeef0;
35
+ padding: 6px 10px;
36
+ background: transparent;
37
+ }
38
+
39
+ th, td {
40
+ &.right-aligned {
41
+ text-align: right;
42
+ }
43
+
44
+ &.center-aligned {
45
+ text-align: center;
46
+ }
47
+ }
48
+
49
+ tr:last-child > td {
50
+ border-bottom: none;
51
+ }
52
+
53
+ .table-hover {
54
+ tr:hover td {
55
+ background: #eff9fd;
56
+ }
57
+ }
@@ -0,0 +1,61 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin tabs.
3
+ // --------------------------------------------------
4
+
5
+ .next-tab__list {
6
+ padding: 0;
7
+ margin: 0;
8
+ list-style: none;
9
+ background-color: #f5f6f7;
10
+ overflow: visible;
11
+ border-radius: 3px 3px 0 0;
12
+
13
+ flex-wrap: nowrap;
14
+ display: flex;
15
+ align-items: stretch;
16
+
17
+ > li {
18
+ position: relative;
19
+ flex-grow: 0;
20
+ flex-shrink: 0;
21
+ display: flex;
22
+ align-items: stretch;
23
+
24
+ &:first-child .next-tab {
25
+ border-top-left-radius: 3px;
26
+ }
27
+ }
28
+ }
29
+
30
+ .next-tab {
31
+ padding: 15px 20px;
32
+ text-decoration: none;
33
+ color: #798c9c;
34
+ border-right: 1px solid #ebeef0;
35
+ border-bottom: 1px solid #ebeef0;
36
+ text-align: center;
37
+ line-height: 1;
38
+ cursor: pointer;
39
+ position: relative;
40
+ font-size: 13px;
41
+ flex-grow: 1;
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+
46
+ &:focus,
47
+ &:hover {
48
+ outline: none;
49
+ background-color: #fafbfc;
50
+ color: #479ccf;
51
+ text-decoration: none;
52
+ }
53
+
54
+ &.next-tab--is-active {
55
+ background-color: #ffffff;
56
+ color: #31373d;
57
+ border-bottom-color: #ffffff;
58
+ cursor: default;
59
+ text-decoration: none;
60
+ }
61
+ }
@@ -0,0 +1,39 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin typography.
3
+ // --------------------------------------------------
4
+
5
+
6
+ //== Headings
7
+ //
8
+ //## Heading styles.
9
+
10
+ h1, .h1,
11
+ h2, .h2,
12
+ h3, .h3,
13
+ h4, .h4,
14
+ h5, .h5,
15
+ h6, .h6 {
16
+ margin: 0 0 20px 0;
17
+ }
18
+
19
+ p {
20
+ margin: 0;
21
+ }
22
+
23
+
24
+ //== Type
25
+ //
26
+ //## Type modifiers.
27
+
28
+ .type--subdued {
29
+ color: #798c9c;
30
+ }
31
+
32
+ a.type--subdued {
33
+ color: inherit;
34
+ text-decoration: underline;
35
+
36
+ &:hover {
37
+ color: #272c30;
38
+ }
39
+ }