disco_app 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (367) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +37 -0
  3. data/app/assets/components/disco_app/buttons/model-destroy-button.es6.jsx +31 -0
  4. data/app/assets/components/disco_app/forms/model-form.es6.jsx +64 -0
  5. data/app/assets/components/embedded_app/bar.es6.jsx +31 -0
  6. data/app/assets/components/shopify/buttons/_buttons.scss +546 -0
  7. data/app/assets/components/shopify/buttons/button.es6.jsx +15 -0
  8. data/app/assets/components/shopify/card/_card.scss +342 -0
  9. data/app/assets/components/shopify/card/card-header.es6.jsx +34 -0
  10. data/app/assets/components/shopify/card/card-section.es6.jsx +26 -0
  11. data/app/assets/components/shopify/card/card.es6.jsx +16 -0
  12. data/app/assets/components/shopify/typography/_typography.scss +23 -0
  13. data/app/assets/components/shopify/typography/ui-heading.es6.jsx +16 -0
  14. data/app/assets/components/shopify/ui-layout/_ui-layout.scss +157 -0
  15. data/app/assets/components/shopify/ui-layout/ui-annotated-section.es6.jsx +29 -0
  16. data/app/assets/components/shopify/ui-layout/ui-empty-state.es6.jsx +35 -0
  17. data/app/assets/components/shopify/ui-layout/ui-footer-help.es6.jsx +13 -0
  18. data/app/assets/components/shopify/ui-layout/ui-layout-item.es6.jsx +11 -0
  19. data/app/assets/components/shopify/ui-layout/ui-layout-section.es6.jsx +19 -0
  20. data/app/assets/components/shopify/ui-layout/ui-layout-sections.es6.jsx +11 -0
  21. data/app/assets/components/shopify/ui-layout/ui-layout.es6.jsx +11 -0
  22. data/app/assets/components/shopify/ui-layout/ui-page-actions.es6.jsx +13 -0
  23. data/app/assets/components/shopify/ui-layout/ui-page-actions__buttons.es6.jsx +27 -0
  24. data/app/assets/components/shopify/ui-stack/_ui-stack.scss +39 -0
  25. data/app/assets/components/shopify/ui-stack/ui-stack-item.es6.jsx +21 -0
  26. data/app/assets/components/shopify/ui-stack/ui-stack.es6.jsx +24 -0
  27. data/app/assets/images/disco_app/icon.svg +1 -0
  28. data/app/assets/images/disco_app/icons.svg +0 -0
  29. data/app/assets/javascripts/disco_app/components/custom/filterable_shop_list.js.jsx +61 -0
  30. data/app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx +59 -0
  31. data/app/assets/javascripts/disco_app/components/custom/rules-editor.es6.jsx +432 -0
  32. data/app/assets/javascripts/disco_app/components/custom/shop_filter_query.js.jsx +13 -0
  33. data/app/assets/javascripts/disco_app/components/custom/shop_filter_tab.js.jsx +34 -0
  34. data/app/assets/javascripts/disco_app/components/custom/shop_filter_tabs.js.jsx +21 -0
  35. data/app/assets/javascripts/disco_app/components/custom/shop_list.js.jsx +142 -0
  36. data/app/assets/javascripts/disco_app/components/custom/shop_row.js.jsx +43 -0
  37. data/app/assets/javascripts/disco_app/components/custom/shopify_admin_link.js.jsx +29 -0
  38. data/app/assets/javascripts/disco_app/components/ui-kit/forms/base_form.es6.jsx +72 -0
  39. data/app/assets/javascripts/disco_app/components/ui-kit/forms/base_input.es6.jsx +20 -0
  40. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-checkbox.es6.jsx +30 -0
  41. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-radio.es6.jsx +30 -0
  42. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-select.es6.jsx +45 -0
  43. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-text.es6.jsx +69 -0
  44. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-textarea.es6.jsx +48 -0
  45. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-time.es6.jsx +7 -0
  46. data/app/assets/javascripts/disco_app/components/ui-kit/forms/ui-form__element.es6.jsx +17 -0
  47. data/app/assets/javascripts/disco_app/components/ui-kit/forms/ui-form__group.es6.jsx +11 -0
  48. data/app/assets/javascripts/disco_app/components/ui-kit/forms/ui-form__section.es6.jsx +11 -0
  49. data/app/assets/javascripts/disco_app/components/ui-kit/icons/icon-chevron.es6.jsx +33 -0
  50. data/app/assets/javascripts/disco_app/components/ui-kit/icons/next-icon.es6.jsx +18 -0
  51. data/app/assets/javascripts/disco_app/components/ui-kit/input_select.es6.jsx +21 -0
  52. data/app/assets/javascripts/disco_app/components/ui-kit/tables/table.es6.jsx +27 -0
  53. data/app/assets/javascripts/disco_app/components.js +3 -0
  54. data/app/assets/javascripts/disco_app/disco_app.js +9 -0
  55. data/app/assets/javascripts/disco_app/frame.js +152 -0
  56. data/app/assets/javascripts/disco_app/shopify-turbolinks.js +7 -0
  57. data/app/assets/javascripts/disco_app/ui-kit.js +1 -0
  58. data/app/assets/stylesheets/disco_app/admin/_header.scss +75 -0
  59. data/app/assets/stylesheets/disco_app/admin/_layout.scss +32 -0
  60. data/app/assets/stylesheets/disco_app/admin/_nav.scss +184 -0
  61. data/app/assets/stylesheets/disco_app/admin.scss +11 -0
  62. data/app/assets/stylesheets/disco_app/disco_app.scss +24 -0
  63. data/app/assets/stylesheets/disco_app/frame/_buttons.scss +54 -0
  64. data/app/assets/stylesheets/disco_app/frame/_forms.scss +26 -0
  65. data/app/assets/stylesheets/disco_app/frame/_layout.scss +77 -0
  66. data/app/assets/stylesheets/disco_app/frame/_type.scss +25 -0
  67. data/app/assets/stylesheets/disco_app/frame.scss +10 -0
  68. data/app/assets/stylesheets/disco_app/mixins/_flexbox.scss +400 -0
  69. data/app/assets/stylesheets/disco_app/ui-kit/_ui-forms.scss +69 -0
  70. data/app/assets/stylesheets/disco_app/ui-kit/_ui-icons.scss +28 -0
  71. data/app/assets/stylesheets/disco_app/ui-kit/_ui-kit.scss +5116 -0
  72. data/app/assets/stylesheets/disco_app/ui-kit/_ui-layout.scss +15 -0
  73. data/app/assets/stylesheets/disco_app/ui-kit/_ui-tabs.scss +75 -0
  74. data/app/assets/stylesheets/disco_app/ui-kit/_ui-type.scss +13 -0
  75. data/app/controllers/disco_app/admin/app_settings_controller.rb +3 -0
  76. data/app/controllers/disco_app/admin/application_controller.rb +3 -0
  77. data/app/controllers/disco_app/admin/concerns/app_settings_controller.rb +24 -0
  78. data/app/controllers/disco_app/admin/concerns/authenticated_controller.rb +20 -0
  79. data/app/controllers/disco_app/admin/concerns/plans_controller.rb +54 -0
  80. data/app/controllers/disco_app/admin/concerns/shops_controller.rb +7 -0
  81. data/app/controllers/disco_app/admin/concerns/subscriptions_controller.rb +29 -0
  82. data/app/controllers/disco_app/admin/plans_controller.rb +3 -0
  83. data/app/controllers/disco_app/admin/resources/shops_controller.rb +3 -0
  84. data/app/controllers/disco_app/admin/shops_controller.rb +3 -0
  85. data/app/controllers/disco_app/admin/subscriptions_controller.rb +3 -0
  86. data/app/controllers/disco_app/charges_controller.rb +47 -0
  87. data/app/controllers/disco_app/concerns/app_proxy_controller.rb +40 -0
  88. data/app/controllers/disco_app/concerns/authenticated_controller.rb +56 -0
  89. data/app/controllers/disco_app/concerns/carrier_request_controller.rb +35 -0
  90. data/app/controllers/disco_app/frame_controller.rb +9 -0
  91. data/app/controllers/disco_app/install_controller.rb +27 -0
  92. data/app/controllers/disco_app/subscriptions_controller.rb +32 -0
  93. data/app/controllers/disco_app/webhooks_controller.rb +46 -0
  94. data/app/controllers/sessions_controller.rb +28 -0
  95. data/app/helpers/disco_app/application_helper.rb +68 -0
  96. data/app/jobs/disco_app/app_installed_job.rb +3 -0
  97. data/app/jobs/disco_app/app_uninstalled_job.rb +3 -0
  98. data/app/jobs/disco_app/concerns/app_installed_job.rb +39 -0
  99. data/app/jobs/disco_app/concerns/app_uninstalled_job.rb +20 -0
  100. data/app/jobs/disco_app/concerns/render_asset_group_job.rb +8 -0
  101. data/app/jobs/disco_app/concerns/shop_update_job.rb +13 -0
  102. data/app/jobs/disco_app/concerns/subscription_changed_job.rb +7 -0
  103. data/app/jobs/disco_app/concerns/synchronise_carrier_service_job.rb +55 -0
  104. data/app/jobs/disco_app/concerns/synchronise_resources_job.rb +12 -0
  105. data/app/jobs/disco_app/concerns/synchronise_webhooks_job.rb +52 -0
  106. data/app/jobs/disco_app/render_asset_group_job.rb +3 -0
  107. data/app/jobs/disco_app/shop_job.rb +27 -0
  108. data/app/jobs/disco_app/shop_update_job.rb +3 -0
  109. data/app/jobs/disco_app/subscription_changed_job.rb +3 -0
  110. data/app/jobs/disco_app/synchronise_carrier_service_job.rb +3 -0
  111. data/app/jobs/disco_app/synchronise_resources_job.rb +3 -0
  112. data/app/jobs/disco_app/synchronise_webhooks_job.rb +3 -0
  113. data/app/models/disco_app/app_settings.rb +3 -0
  114. data/app/models/disco_app/application_charge.rb +18 -0
  115. data/app/models/disco_app/concerns/app_settings.rb +7 -0
  116. data/app/models/disco_app/concerns/can_be_liquified.rb +45 -0
  117. data/app/models/disco_app/concerns/has_metafields.rb +48 -0
  118. data/app/models/disco_app/concerns/plan.rb +26 -0
  119. data/app/models/disco_app/concerns/plan_code.rb +15 -0
  120. data/app/models/disco_app/concerns/renders_assets.rb +166 -0
  121. data/app/models/disco_app/concerns/shop.rb +84 -0
  122. data/app/models/disco_app/concerns/subscription.rb +60 -0
  123. data/app/models/disco_app/concerns/synchronises.rb +58 -0
  124. data/app/models/disco_app/concerns/taggable.rb +16 -0
  125. data/app/models/disco_app/plan.rb +3 -0
  126. data/app/models/disco_app/plan_code.rb +3 -0
  127. data/app/models/disco_app/recurring_application_charge.rb +18 -0
  128. data/app/models/disco_app/session_storage.rb +18 -0
  129. data/app/models/disco_app/shop.rb +3 -0
  130. data/app/models/disco_app/subscription.rb +3 -0
  131. data/app/resources/disco_app/admin/resources/concerns/shop_resource.rb +100 -0
  132. data/app/resources/disco_app/admin/resources/shop_resource.rb +4 -0
  133. data/app/services/disco_app/carrier_request_service.rb +15 -0
  134. data/app/services/disco_app/charges_service.rb +81 -0
  135. data/app/services/disco_app/proxy_service.rb +17 -0
  136. data/app/services/disco_app/subscription_service.rb +46 -0
  137. data/app/services/disco_app/webhook_service.rb +30 -0
  138. data/app/views/disco_app/admin/app_settings/edit.html.erb +5 -0
  139. data/app/views/disco_app/admin/plans/_form.html.erb +72 -0
  140. data/app/views/disco_app/admin/plans/_plan_code_fields.html.erb +15 -0
  141. data/app/views/disco_app/admin/plans/edit.html.erb +7 -0
  142. data/app/views/disco_app/admin/plans/index.html.erb +43 -0
  143. data/app/views/disco_app/admin/plans/new.html.erb +7 -0
  144. data/app/views/disco_app/admin/shops/index.html.erb +13 -0
  145. data/app/views/disco_app/admin/subscriptions/edit.html.erb +33 -0
  146. data/app/views/disco_app/charges/activate.html.erb +1 -0
  147. data/app/views/disco_app/charges/create.html.erb +1 -0
  148. data/app/views/disco_app/charges/new.html.erb +23 -0
  149. data/app/views/disco_app/frame/frame.html.erb +36 -0
  150. data/app/views/disco_app/install/installing.html.erb +22 -0
  151. data/app/views/disco_app/install/uninstalling.html.erb +1 -0
  152. data/app/views/disco_app/proxy_errors/404.html.erb +1 -0
  153. data/app/views/disco_app/shared/_card.html.erb +14 -0
  154. data/app/views/disco_app/shared/_icons.html.erb +1 -0
  155. data/app/views/disco_app/shared/_section.html.erb +17 -0
  156. data/app/views/disco_app/subscriptions/new.html.erb +25 -0
  157. data/app/views/layouts/admin/_nav_items.erb +20 -0
  158. data/app/views/layouts/admin.html.erb +67 -0
  159. data/app/views/layouts/application.html.erb +18 -0
  160. data/app/views/layouts/embedded_app.html.erb +50 -0
  161. data/app/views/layouts/embedded_app_modal.html.erb +28 -0
  162. data/app/views/sessions/new.html.erb +28 -0
  163. data/config/routes.rb +63 -0
  164. data/db/migrate/20150525000000_create_shops_if_not_existent.rb +15 -0
  165. data/db/migrate/20150525162112_add_status_to_shops.rb +5 -0
  166. data/db/migrate/20150525171422_add_meta_to_shops.rb +11 -0
  167. data/db/migrate/20150629210346_add_charge_status_to_shop.rb +5 -0
  168. data/db/migrate/20150814214025_add_more_meta_to_shops.rb +15 -0
  169. data/db/migrate/20151017231302_create_disco_app_plans.rb +13 -0
  170. data/db/migrate/20151017232027_create_disco_app_subscriptions.rb +15 -0
  171. data/db/migrate/20151017234409_move_shop_to_disco_app_engine.rb +5 -0
  172. data/db/migrate/20160112233706_create_disco_app_sessions.rb +12 -0
  173. data/db/migrate/20160113194418_add_shop_id_to_disco_app_sessions.rb +6 -0
  174. data/db/migrate/20160223111044_create_disco_app_settings.rb +8 -0
  175. data/db/migrate/20160301223215_update_plans.rb +22 -0
  176. data/db/migrate/20160301224558_update_subscriptions.rb +13 -0
  177. data/db/migrate/20160302104816_create_disco_app_recurring_application_charges.rb +14 -0
  178. data/db/migrate/20160302105259_create_disco_app_application_charges.rb +14 -0
  179. data/db/migrate/20160302134728_drop_charge_status_from_shops.rb +5 -0
  180. data/db/migrate/20160302142941_add_shopify_attributes_to_charges.rb +8 -0
  181. data/db/migrate/20160331093148_create_disco_app_plan_codes.rb +14 -0
  182. data/db/migrate/20160401044420_add_status_to_plan_codes.rb +5 -0
  183. data/db/migrate/20160401045551_add_amount_and_plan_code_to_disco_app_subscriptions.rb +7 -0
  184. data/db/migrate/20160425205211_add_source_to_disco_app_subscriptions.rb +5 -0
  185. data/db/migrate/20160426033520_add_trial_period_days_to_disco_app_subscriptions.rb +5 -0
  186. data/db/migrate/20160513140727_add_name_to_disco_app_shops.rb +5 -0
  187. data/db/migrate/20160521135510_move_shop_to_synchronises.rb +61 -0
  188. data/lib/disco_app/configuration.rb +45 -0
  189. data/lib/disco_app/constants.rb +4 -0
  190. data/lib/disco_app/engine.rb +26 -0
  191. data/lib/disco_app/session.rb +14 -0
  192. data/lib/disco_app/support/file_fixtures.rb +23 -0
  193. data/lib/disco_app/test_help.rb +11 -0
  194. data/lib/disco_app/version.rb +3 -0
  195. data/lib/disco_app.rb +7 -0
  196. data/lib/generators/disco_app/USAGE +5 -0
  197. data/lib/generators/disco_app/disco_app_generator.rb +239 -0
  198. data/lib/generators/disco_app/templates/assets/javascripts/application.js +17 -0
  199. data/lib/generators/disco_app/templates/assets/javascripts/components.js +3 -0
  200. data/lib/generators/disco_app/templates/assets/stylesheets/application.scss +5 -0
  201. data/lib/generators/disco_app/templates/config/database.yml.tt +20 -0
  202. data/lib/generators/disco_app/templates/config/newrelic.yml +26 -0
  203. data/lib/generators/disco_app/templates/config/puma.rb +15 -0
  204. data/lib/generators/disco_app/templates/controllers/home_controller.rb +7 -0
  205. data/lib/generators/disco_app/templates/initializers/disco_app.rb +28 -0
  206. data/lib/generators/disco_app/templates/initializers/rollbar.rb +19 -0
  207. data/lib/generators/disco_app/templates/initializers/session_store.rb +2 -0
  208. data/lib/generators/disco_app/templates/initializers/shopify_app.rb +7 -0
  209. data/lib/generators/disco_app/templates/initializers/shopify_session_repository.rb +7 -0
  210. data/lib/generators/disco_app/templates/root/CHECKS +4 -0
  211. data/lib/generators/disco_app/templates/root/Procfile +2 -0
  212. data/lib/generators/disco_app/templates/views/home/index.html.erb +2 -0
  213. data/lib/tasks/carrier_service.rake +10 -0
  214. data/lib/tasks/database.rake +8 -0
  215. data/lib/tasks/sessions.rake +9 -0
  216. data/lib/tasks/shops.rake +10 -0
  217. data/lib/tasks/start.rake +3 -0
  218. data/lib/tasks/webhooks.rake +10 -0
  219. data/test/controllers/disco_app/admin/shops_controller_test.rb +54 -0
  220. data/test/controllers/disco_app/charges_controller_test.rb +99 -0
  221. data/test/controllers/disco_app/install_controller_test.rb +50 -0
  222. data/test/controllers/disco_app/subscriptions_controller_test.rb +68 -0
  223. data/test/controllers/disco_app/webhooks_controller_test.rb +58 -0
  224. data/test/controllers/home_controller_test.rb +92 -0
  225. data/test/controllers/proxy_controller_test.rb +42 -0
  226. data/test/disco_app_test.rb +7 -0
  227. data/test/dummy/Rakefile +6 -0
  228. data/test/dummy/app/assets/javascripts/application.js +17 -0
  229. data/test/dummy/app/assets/stylesheets/application.scss +5 -0
  230. data/test/dummy/app/controllers/application_controller.rb +6 -0
  231. data/test/dummy/app/controllers/carrier_request_controller.rb +10 -0
  232. data/test/dummy/app/controllers/disco_app/admin/shops_controller.rb +8 -0
  233. data/test/dummy/app/controllers/home_controller.rb +7 -0
  234. data/test/dummy/app/controllers/proxy_controller.rb +8 -0
  235. data/test/dummy/app/helpers/application_helper.rb +2 -0
  236. data/test/dummy/app/jobs/carts_update_job.rb +7 -0
  237. data/test/dummy/app/jobs/disco_app/app_installed_job.rb +16 -0
  238. data/test/dummy/app/jobs/disco_app/app_uninstalled_job.rb +11 -0
  239. data/test/dummy/app/jobs/products_create_job.rb +7 -0
  240. data/test/dummy/app/jobs/products_delete_job.rb +7 -0
  241. data/test/dummy/app/jobs/products_update_job.rb +7 -0
  242. data/test/dummy/app/models/cart.rb +24 -0
  243. data/test/dummy/app/models/disco_app/shop.rb +15 -0
  244. data/test/dummy/app/models/js_configuration.rb +8 -0
  245. data/test/dummy/app/models/product.rb +9 -0
  246. data/test/dummy/app/models/widget_configuration.rb +10 -0
  247. data/test/dummy/app/views/assets/script_tag.js.erb +1 -0
  248. data/test/dummy/app/views/assets/test.js.erb +1 -0
  249. data/test/dummy/app/views/assets/widget.js.erb +2 -0
  250. data/test/dummy/app/views/assets/widget.scss.erb +3 -0
  251. data/test/dummy/app/views/home/index.html.erb +2 -0
  252. data/test/dummy/app/views/snippets/widget.liquid.erb +1 -0
  253. data/test/dummy/bin/bundle +3 -0
  254. data/test/dummy/bin/rails +4 -0
  255. data/test/dummy/bin/rake +4 -0
  256. data/test/dummy/bin/setup +29 -0
  257. data/test/dummy/config/application.rb +38 -0
  258. data/test/dummy/config/boot.rb +5 -0
  259. data/test/dummy/config/database.codeship.yml +23 -0
  260. data/test/dummy/config/database.gitlab-ci.yml +24 -0
  261. data/test/dummy/config/database.yml +20 -0
  262. data/test/dummy/config/environment.rb +5 -0
  263. data/test/dummy/config/environments/development.rb +41 -0
  264. data/test/dummy/config/environments/production.rb +85 -0
  265. data/test/dummy/config/environments/test.rb +42 -0
  266. data/test/dummy/config/initializers/assets.rb +11 -0
  267. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  268. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  269. data/test/dummy/config/initializers/disco_app.rb +28 -0
  270. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  271. data/test/dummy/config/initializers/inflections.rb +16 -0
  272. data/test/dummy/config/initializers/mime_types.rb +4 -0
  273. data/test/dummy/config/initializers/omniauth.rb +9 -0
  274. data/test/dummy/config/initializers/session_store.rb +2 -0
  275. data/test/dummy/config/initializers/shopify_app.rb +7 -0
  276. data/test/dummy/config/initializers/shopify_session_repository.rb +7 -0
  277. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  278. data/test/dummy/config/locales/en.yml +23 -0
  279. data/test/dummy/config/routes.rb +11 -0
  280. data/test/dummy/config/secrets.yml +22 -0
  281. data/test/dummy/config.ru +4 -0
  282. data/test/dummy/db/migrate/20160307182229_create_products.rb +11 -0
  283. data/test/dummy/db/migrate/20160530160739_create_asset_models.rb +19 -0
  284. data/test/dummy/db/migrate/20161105054746_create_carts.rb +13 -0
  285. data/test/dummy/db/schema.rb +152 -0
  286. data/test/dummy/public/404.html +67 -0
  287. data/test/dummy/public/422.html +67 -0
  288. data/test/dummy/public/500.html +66 -0
  289. data/test/dummy/public/favicon.ico +0 -0
  290. data/test/fixtures/api/widget_store/assets/create_script_tag_js_request.json +6 -0
  291. data/test/fixtures/api/widget_store/assets/create_script_tag_js_response.json +12 -0
  292. data/test/fixtures/api/widget_store/assets/create_script_tag_request.json +6 -0
  293. data/test/fixtures/api/widget_store/assets/create_script_tag_response.json +10 -0
  294. data/test/fixtures/api/widget_store/assets/create_test_js_request.json +6 -0
  295. data/test/fixtures/api/widget_store/assets/create_test_js_response.json +12 -0
  296. data/test/fixtures/api/widget_store/assets/create_widget_js_request.json +6 -0
  297. data/test/fixtures/api/widget_store/assets/create_widget_js_response.json +12 -0
  298. data/test/fixtures/api/widget_store/assets/create_widget_liquid_request.json +6 -0
  299. data/test/fixtures/api/widget_store/assets/create_widget_liquid_response.json +12 -0
  300. data/test/fixtures/api/widget_store/assets/create_widget_scss_request.json +6 -0
  301. data/test/fixtures/api/widget_store/assets/create_widget_scss_response.json +12 -0
  302. data/test/fixtures/api/widget_store/assets/get_script_tags_empty_request.json +1 -0
  303. data/test/fixtures/api/widget_store/assets/get_script_tags_empty_response.json +1 -0
  304. data/test/fixtures/api/widget_store/assets/get_script_tags_preexisting_request.json +1 -0
  305. data/test/fixtures/api/widget_store/assets/get_script_tags_preexisting_response.json +12 -0
  306. data/test/fixtures/api/widget_store/assets/update_script_tag_request.json +10 -0
  307. data/test/fixtures/api/widget_store/assets/update_script_tag_response.json +10 -0
  308. data/test/fixtures/api/widget_store/carrier_services.json +1 -0
  309. data/test/fixtures/api/widget_store/carrier_services_create.json +8 -0
  310. data/test/fixtures/api/widget_store/charges/activate_application_charge_request.json +16 -0
  311. data/test/fixtures/api/widget_store/charges/activate_application_charge_response.json +1 -0
  312. data/test/fixtures/api/widget_store/charges/activate_recurring_application_charge_request.json +20 -0
  313. data/test/fixtures/api/widget_store/charges/activate_recurring_application_charge_response.json +1 -0
  314. data/test/fixtures/api/widget_store/charges/create_application_charge_request.json +9 -0
  315. data/test/fixtures/api/widget_store/charges/create_application_charge_response.json +16 -0
  316. data/test/fixtures/api/widget_store/charges/create_recurring_application_charge_request.json +9 -0
  317. data/test/fixtures/api/widget_store/charges/create_recurring_application_charge_response.json +20 -0
  318. data/test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_request.json +9 -0
  319. data/test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_response.json +20 -0
  320. data/test/fixtures/api/widget_store/charges/get_accepted_application_charge_response.json +16 -0
  321. data/test/fixtures/api/widget_store/charges/get_accepted_recurring_application_charge_response.json +20 -0
  322. data/test/fixtures/api/widget_store/charges/get_declined_application_charge_response.json +16 -0
  323. data/test/fixtures/api/widget_store/charges/get_declined_recurring_application_charge_response.json +20 -0
  324. data/test/fixtures/api/widget_store/charges/get_pending_application_charge_response.json +16 -0
  325. data/test/fixtures/api/widget_store/charges/get_pending_recurring_application_charge_response.json +20 -0
  326. data/test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_request.json +31 -0
  327. data/test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_response.json +1 -0
  328. data/test/fixtures/api/widget_store/products/write_metafields_single_namespace_request.json +19 -0
  329. data/test/fixtures/api/widget_store/products/write_metafields_single_namespace_response.json +1 -0
  330. data/test/fixtures/api/widget_store/shop.json +46 -0
  331. data/test/fixtures/api/widget_store/webhooks.json +1 -0
  332. data/test/fixtures/assets/test.js +1 -0
  333. data/test/fixtures/assets/test.min.js +1 -0
  334. data/test/fixtures/carts.yml +5 -0
  335. data/test/fixtures/disco_app/application_charges.yml +11 -0
  336. data/test/fixtures/disco_app/plan_codes.yml +13 -0
  337. data/test/fixtures/disco_app/plans.yml +37 -0
  338. data/test/fixtures/disco_app/recurring_application_charges.yml +11 -0
  339. data/test/fixtures/disco_app/shops.yml +10 -0
  340. data/test/fixtures/disco_app/subscriptions.yml +22 -0
  341. data/test/fixtures/js_configurations.yml +3 -0
  342. data/test/fixtures/liquid/model.liquid +8 -0
  343. data/test/fixtures/products.yml +4 -0
  344. data/test/fixtures/webhooks/app_uninstalled.json +46 -0
  345. data/test/fixtures/webhooks/cart_updated.json +28 -0
  346. data/test/fixtures/webhooks/product_created.json +167 -0
  347. data/test/fixtures/webhooks/product_deleted.json +3 -0
  348. data/test/fixtures/webhooks/product_updated.json +167 -0
  349. data/test/fixtures/widget_configurations.yml +4 -0
  350. data/test/integration/synchronises_test.rb +62 -0
  351. data/test/jobs/disco_app/app_installed_job_test.rb +57 -0
  352. data/test/jobs/disco_app/app_uninstalled_job_test.rb +30 -0
  353. data/test/jobs/disco_app/synchronise_carrier_service_job_test.rb +25 -0
  354. data/test/jobs/disco_app/synchronise_webhooks_job_test.rb +30 -0
  355. data/test/models/disco_app/can_be_liquified_test.rb +55 -0
  356. data/test/models/disco_app/has_metafields_test.rb +40 -0
  357. data/test/models/disco_app/plan_test.rb +5 -0
  358. data/test/models/disco_app/renders_assets_test.rb +109 -0
  359. data/test/models/disco_app/session_test.rb +31 -0
  360. data/test/models/disco_app/shop_test.rb +43 -0
  361. data/test/models/disco_app/subscription_test.rb +19 -0
  362. data/test/services/disco_app/charges_service_test.rb +112 -0
  363. data/test/services/disco_app/subscription_service_test.rb +60 -0
  364. data/test/support/test_file_fixtures.rb +29 -0
  365. data/test/support/test_shopify_api.rb +16 -0
  366. data/test/test_helper.rb +55 -0
  367. metadata +893 -0
@@ -0,0 +1,43 @@
1
+ <% provide(:title, 'Plans') %>
2
+
3
+ <div class="next-grid">
4
+ <div class="next-grid__cell">
5
+ <div class="next-card">
6
+ <% unless @plans.empty? %>
7
+ <table class="table">
8
+ <thead>
9
+ <tr>
10
+ <th>Name</th>
11
+ <th>Status</th>
12
+ <th>Plan Type</th>
13
+ <th>Trial Period</th>
14
+ <th>Amount</th>
15
+ <th>Currency</th>
16
+ <th>Interval</th>
17
+ <th>Interval Count</th>
18
+ <th></th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <% @plans.each do |plan| %>
23
+ <tr>
24
+ <td><%= link_to(plan.name, edit_admin_plan_path(plan)) %></td>
25
+ <td><%= plan.status %></td>
26
+ <td><%= plan.plan_type %></td>
27
+ <td><%= plan.trial_period_days %></td>
28
+ <td><%= plan.amount %></td>
29
+ <td><%= plan.currency %></td>
30
+ <td><%= plan.interval %></td>
31
+ <td><%= plan.interval_count %></td>
32
+ <td><%= link_to 'Delete', admin_plan_path(plan), action: 'destroy', method: :delete, data: {confirm: "About to delete plan: #{plan.name}. Are you sure?"} %></td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ <% end %>
38
+ </div>
39
+ <hr/>
40
+ <%= link_to 'Create new plan', new_admin_plan_path, { class: 'btn btn-primary' } %>
41
+ </div>
42
+ </div>
43
+
@@ -0,0 +1,7 @@
1
+ <% provide(:title, 'New Plan') %>
2
+
3
+ <%= form_for(@plan, url: admin_plans_path) do |f| %>
4
+ <%= render 'form', f: f %>
5
+ <% end %>
6
+
7
+ <%= link_to 'Back', admin_plans_path, { class: 'btn btn-default' } %>
@@ -0,0 +1,13 @@
1
+ <% provide(:title, 'Shops') %>
2
+
3
+ <div class="next-grid">
4
+ <div class="next-grid__cell">
5
+
6
+ <%= react_component('FilterableShopList', {
7
+ shopsUrl: admin_resources_shops_path(format: :json),
8
+ editShopUrl: edit_admin_shop_path(':id'),
9
+ editSubscriptionUrl: edit_admin_shop_subscription_path(':shop_id', ':id')
10
+ }) %>
11
+
12
+ </div>
13
+ </div>
@@ -0,0 +1,33 @@
1
+ <% provide(:breadcrumb, 'Shops') %>
2
+ <% provide(:breadcrumb_url, admin_shops_path) %>
3
+ <% provide(:title, 'Edit subscription') %>
4
+
5
+ <div class="next-grid">
6
+ <div class="next-grid__cell">
7
+
8
+ <%= form_for(@subscription, url: admin_shop_subscription_path(@subscription.shop, @subscription)) do |f| %>
9
+
10
+ <%= f.label(:amount) %>
11
+ <%= f.number_field(:amount) %>
12
+
13
+ <%= f.label(:trial_period_days) %>
14
+ <%= f.number_field(:trial_period_days) %>
15
+
16
+ <p>
17
+ Note that adjusting the amount or trial days of the subscription will
18
+ clear any charge previously authorized by the user, and they'll be asked
19
+ to re-authorize the next time they open the application.
20
+ </p>
21
+
22
+ <p>
23
+ If you're changing the amount of a subscription for an existing user and
24
+ don't want them to get another trial period, make sure to set "Trial
25
+ period days" to zero.
26
+ </p>
27
+
28
+ <%= f.submit 'Save', { class: 'btn btn-primary' } %>
29
+
30
+ <% end %>
31
+
32
+ </div>
33
+ </div>
@@ -0,0 +1 @@
1
+ activate_charge
@@ -0,0 +1 @@
1
+ create_charge
@@ -0,0 +1,23 @@
1
+ <% provide(:title, 'Thankyou') %>
2
+
3
+ <p>
4
+ Thanks for installing <%= DiscoApp.configuration.app_name %>!
5
+ </p>
6
+ <p id="account-warning"></p>
7
+
8
+ <%= form_tag disco_app.subscription_charges_path(@subscription), id: 'install-ok', method: 'POST', target: '_parent' do %>
9
+ <%= submit_tag 'Okay', class: 'form-input' %>
10
+ <% end %>
11
+
12
+ <script>
13
+ ShopifyApp.ready(function(){
14
+ var container = document.getElementById('account-warning');
15
+ if (ShopifyApp.User.current.accountAccess === "Account owner") {
16
+ container.innerHTML = "Before we start setting things up, we need you to authorize a charge for the application."
17
+ } else {
18
+ container.innerHTML = "Since you're not the account owner, you won't be able to setup a charge. Ask the account owner to install the app."
19
+ var okButton = document.getElementById('install-ok');
20
+ okButton.parentElement.removeChild(okButton);
21
+ }
22
+ });
23
+ </script>
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dev Frame</title>
5
+ <%= stylesheet_link_tag 'disco_app/frame', media: 'all' %>
6
+ <%= javascript_include_tag 'disco_app/frame' %>
7
+ </head>
8
+ <body>
9
+ <!-- Left Sidebar -->
10
+ <aside id="sidebar"></aside>
11
+
12
+ <!-- Header Bar -->
13
+ <header id="header">
14
+ <h1 id="header-title">
15
+ <img id="header-title-icon" src="<%= image_path('disco_app/icon.svg') %>" width="20" height="20" />
16
+ Shopify Dev Frame
17
+ </h1>
18
+ <div id="header-actions">
19
+ <!-- No action. -->
20
+ </div>
21
+ </header>
22
+
23
+ <!-- Content iFrame -->
24
+ <section id="content-wrapper">
25
+ <iframe id="content" src="/"></iframe>
26
+ </section>
27
+
28
+ <!-- Setup FrameApp. -->
29
+ <script type="text/javascript">
30
+ FrameApp.init({
31
+ debug: true,
32
+ iframe: document.getElementById('content')
33
+ });
34
+ </script>
35
+ </body>
36
+ </html>
@@ -0,0 +1,22 @@
1
+ <% content_for :extra_head do %>
2
+ <meta http-equiv="refresh" content="5">
3
+ <% end %>
4
+
5
+ <div class="ui-empty-state">
6
+ <section class="ui-empty-state__section">
7
+ <div class="ui-empty-state__subsection">
8
+ <h1 class="ui-empty-state__title">Installing <%= DiscoApp.configuration.app_name %></h1>
9
+ <h2 class="ui-empty-state__subtitle">Please wait...</h2>
10
+ </div>
11
+ </section>
12
+ </div>
13
+
14
+ <div class="ui-footer-help">
15
+ <div class="ui-footer-help__content">
16
+ <div>
17
+ <p>
18
+ Stuck on this page? <a href="mailto:help@discolabs.com?subject=<%= DiscoApp.configuration.app_name %> not installing for <%= @shop.shopify_domain %>!">Email us</a>.
19
+ </p>
20
+ </div>
21
+ </div>
22
+ </div>
@@ -0,0 +1 @@
1
+ uninstalling
@@ -0,0 +1 @@
1
+ 404 Not Found
@@ -0,0 +1,14 @@
1
+ <% disabled ||= false %>
2
+ <div class="next-card <% if disabled %>next-card--disabled<% end %>">
3
+ <% if content_for?(:card_header) %>
4
+ <header class="next-card__header">
5
+ <%= content_for :card_header %>
6
+ </header>
7
+ <% end %>
8
+ <%= content_for :card_content %>
9
+ <% if content_for?(:card_footer) %>
10
+ <footer class="next-card__footer">
11
+ <%= content_for :card_footer %>
12
+ </footer>
13
+ <% end %>
14
+ </div>
@@ -0,0 +1 @@
1
+ <div id="global-icon-symbols" style="display: none;"><svg xmlns="http://www.w3.org/2000/svg"><symbol id="next-products" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" enable-background="new 0 0 24 24"><path d="M21.8 1h-7c-.8 0-1.5.3-2 .8L1.4 13.2c-.5.5-.5 1.3 0 1.8L9 22.7c.5.5 1.3.5 1.8 0l11.3-11.4c.5-.5.8-1.3.8-2v-7c.1-.7-.4-1.3-1.1-1.3zm-4 7.6c-1.3 0-2.3-1.1-2.3-2.3C15.5 5 16.6 4 17.8 4c1.3 0 2.3 1.1 2.3 2.3 0 1.3-1 2.3-2.3 2.3z"></path></svg></symbol><symbol id="next-help-circle" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm-.1 20c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5c.827 0 1.5.67 1.5 1.5s-.673 1.5-1.5 1.5zm1.766-6.996c-.22.087-.39.367-.39.602V14c0 .55-.45 1-1 1h-.67c-.55 0-1-.448-1-1v-.87c0-1.18.805-2.16 1.92-2.55.44-.157.824-.456 1.08-.844.938-1.415-.248-3.07-1.665-3.07-.87 0-1.61.555-1.89 1.327-.14.4-.51.674-.94.674h-.7c-.644 0-1.144-.608-.974-1.23.622-2.28 2.936-3.87 5.502-3.333h.007c1.496.312 2.758 1.39 3.326 2.808 1.01 2.527-.32 5.182-2.6 6.092z"></path></svg></symbol><symbol id="next-website" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M9.4 2c-.2 0-.3.3-.2.4l1.4 1.4-3.8 3.9c-.2.2-.2.6 0 .8l.8.8c.2.2.6.2.8 0l3.8-3.8 1.4 1.4c.2.2.4 0 .4-.2v-4.2c0-.3-.2-.5-.5-.5h-4.1zm.6 0h-6c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2v-6 2h-2v3c0 .6-.5 1-1 1h-6c-.6 0-1-.5-1-1v-6c0-.6.5-1 1-1h3v-2h2z"></path></svg></symbol><symbol id="next-search-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><path d="M0 5.667c0 3.125 2.542 5.667 5.667 5.667 1.202 0 2.315-.38 3.233-1.02l.455.456c-.07.5.082 1.025.466 1.41l3.334 3.332c.326.325.753.488 1.18.488.425 0 .852-.163 1.177-.488.652-.65.652-1.706 0-2.357L12.18 9.822c-.384-.384-.91-.536-1.41-.466l-.454-.456c.64-.918 1.02-2.03 1.02-3.233C11.333 2.542 8.79 0 5.666 0S0 2.542 0 5.667zm2 0C2 3.645 3.645 2 5.667 2s3.667 1.645 3.667 3.667-1.646 3.666-3.667 3.666S2 7.688 2 5.667z"></path></svg></symbol><symbol id="loading-circle" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1_copy" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve"><g><circle fill="#202428" cx="15" cy="8" r="1"></circle><circle fill="#22262A" cx="14.971" cy="8.637" r="1"></circle><circle fill="#24282D" cx="14.887" cy="9.258" r="1"></circle><circle fill="#262A2F" cx="14.75" cy="9.86" r="1"></circle><circle fill="#282D31" cx="14.563" cy="10.441" r="1"></circle><circle fill="#2A2F34" cx="14.327" cy="10.999" r="1"></circle><circle fill="#2C3136" cx="14.045" cy="11.531" r="1"></circle><circle fill="#2E3338" cx="13.721" cy="12.035" r="1"></circle><circle fill="#2F353B" cx="13.356" cy="12.508" r="1"></circle><circle fill="#31373D" cx="12.952" cy="12.947" r="1"></circle><circle fill="#33393F" cx="12.513" cy="13.351" r="1"></circle><circle fill="#353C42" cx="12.04" cy="13.717" r="1"></circle><circle fill="#373E44" cx="11.537" cy="14.042" r="1"></circle><circle fill="#394046" cx="11.005" cy="14.324" r="1"></circle><circle fill="#3B4249" cx="10.447" cy="14.56" r="1"></circle><circle fill="#3D444B" cx="9.866" cy="14.748" r="1"></circle><circle fill="#3F464D" cx="9.264" cy="14.886" r="1"></circle><circle fill="#414950" cx="8.644" cy="14.971" r="1"></circle><circle fill="#434B52" cx="8.007" cy="15" r="1"></circle><circle fill="#454D54" cx="7.37" cy="14.972" r="1"></circle><circle fill="#474F57" cx="6.749" cy="14.889" r="1"></circle><circle fill="#495159" cx="6.147" cy="14.752" r="1"></circle><circle fill="#4B535B" cx="5.565" cy="14.565" r="1"></circle><circle fill="#4C555E" cx="5.007" cy="14.33" r="1"></circle><circle fill="#4E5860" cx="4.474" cy="14.049" r="1"></circle><circle fill="#505A62" cx="3.97" cy="13.725" r="1"></circle><circle fill="#525C65" cx="3.497" cy="13.36" r="1"></circle><circle fill="#545E67" cx="3.057" cy="12.957" r="1"></circle><circle fill="#566069" cx="2.653" cy="12.518" r="1"></circle><circle fill="#58626C" cx="2.287" cy="12.045" r="1"></circle><circle fill="#5A646E" cx="1.961" cy="11.542" r="1"></circle><circle fill="#5C6770" cx="1.679" cy="11.011" r="1"></circle><circle fill="#5E6972" cx="1.442" cy="10.453" r="1"></circle><circle fill="#606B75" cx="1.253" cy="9.873" r="1"></circle><circle fill="#626D77" cx="1.115" cy="9.271" r="1"></circle><circle fill="#646F79" cx="1.03" cy="8.65" r="1"></circle><circle fill="#66717C" cx="1" cy="8.014" r="1"></circle><circle fill="#68737E" cx="1.027" cy="7.377" r="1"></circle><circle fill="#6A7680" cx="1.11" cy="6.756" r="1"></circle><circle fill="#6B7883" cx="1.246" cy="6.153" r="1"></circle><circle fill="#6D7A85" cx="1.433" cy="5.571" r="1"></circle><circle fill="#6F7C87" cx="1.668" cy="5.013" r="1"></circle><circle fill="#717E8A" cx="1.948" cy="4.48" r="1"></circle><circle fill="#73808C" cx="2.272" cy="3.976" r="1"></circle><circle fill="#75828E" cx="2.636" cy="3.502" r="1"></circle><circle fill="#778591" cx="3.039" cy="3.062" r="1"></circle><circle fill="#798793" cx="3.477" cy="2.657" r="1"></circle><circle fill="#7B8995" cx="3.949" cy="2.29" r="1"></circle><circle fill="#7D8B98" cx="4.452" cy="1.964" r="1"></circle><circle fill="#7F8D9A" cx="4.983" cy="1.682" r="1"></circle><circle fill="#818F9C" cx="5.54" cy="1.444" r="1"></circle><circle fill="#83929F" cx="6.121" cy="1.255" r="1"></circle><circle fill="#8594A1" cx="6.723" cy="1.116" r="1"></circle><circle fill="#8796A3" cx="7.343" cy="1.03" r="1"></circle><circle fill="#8898A6" cx="7.979" cy="1" r="1"></circle><circle fill="#8A9AA8" cx="8.609" cy="1.027" r="1"></circle><circle fill="#8C9CAA" cx="9.226" cy="1.109" r="1"></circle><circle fill="#8E9EAD" cx="9.827" cy="1.245" r="1"></circle><circle fill="#90A1AF" cx="10.408" cy="1.429" r="1"></circle><circle fill="#92A3B1" cx="10.967" cy="1.66" r="1"></circle><circle fill="#94A5B4" cx="11.498" cy="1.935" r="1"></circle><circle fill="#96A7B6" cx="12" cy="2.25" r="1"></circle></g></svg></symbol><symbol id="clear" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" baseProfile="tiny" width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" fill="#BFBFBF" d="M12.234 3.766c-2.334-2.334-6.119-2.334-8.453 0s-2.334 6.119 0 8.453 6.119 2.334 8.453 0 2.334-6.119 0-8.453zm-1.06 6.329l-1.056 1.056-2.11-2.112-2.111 2.111-1.056-1.056 2.111-2.111-2.111-2.11 1.056-1.056 2.111 2.111 2.111-2.111 1.056 1.056-2.112 2.111 2.111 2.111z"></path></svg></symbol><symbol id="next-remove" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" enable-background="new 0 0 24 24"><path d="M19.5 22c-.2 0-.5-.1-.7-.3L12 14.9l-6.8 6.8c-.2.2-.4.3-.7.3-.2 0-.5-.1-.7-.3l-1.6-1.6c-.1-.2-.2-.4-.2-.6 0-.2.1-.5.3-.7L9.1 12 2.3 5.2C2.1 5 2 4.8 2 4.5c0-.2.1-.5.3-.7l1.6-1.6c.2-.1.4-.2.6-.2.3 0 .5.1.7.3L12 9.1l6.8-6.8c.2-.2.4-.3.7-.3.2 0 .5.1.7.3l1.6 1.6c.1.2.2.4.2.6 0 .2-.1.5-.3.7L14.9 12l6.8 6.8c.2.2.3.4.3.7 0 .2-.1.5-.3.7l-1.6 1.6c-.2.1-.4.2-.6.2z"></path></svg></symbol><symbol id="next-info" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" enable-background="new 0 0 24 24"><g><path d="M13.5 7h-2c-.8 0-1.5.7-1.5 1.5v14c0 .8.7 1.5 1.5 1.5h2c.8 0 1.5-.7 1.5-1.5v-14c0-.8-.7-1.5-1.5-1.5z"></path><circle cx="12.5" cy="2.5" r="2.5"></circle></g></svg></symbol><symbol id="next-dashboard-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><g><path d="M8.43 3.445c-.248-.21-.612-.21-.86 0L2.353 7.86C2.13 8.05 2 8.33 2 8.624v6.71c0 .366.3.666.667.666h2.667C5.7 16 6 15.7 6 15.333v-3c0-.183.15-.333.333-.333h3.333c.184 0 .334.15.334.333v3c0 .367.3.667.667.667h2.667c.366 0 .666-.3.666-.667v-6.71c0-.294-.13-.573-.354-.763L8.43 3.445zM15.764 6.158L8.944.39C8.692.14 8.357 0 8 0c-.357 0-.692.14-.902.354L.236 6.158c-.28.238-.316.66-.078.94.132.156.32.236.51.236.15 0 .304-.052.43-.158L7.6 1.638c.238-.178.56-.18.797-.003 1.468 1.1 6.505 5.54 6.505 5.54.28.237.702.203.94-.078.238-.28.203-.7-.078-.94z"></path></g></svg></symbol><symbol id="next-orders-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><g><path d="M13.992 0H2.1C.94 0 0 .94 0 2.1v12.244C0 15.305.785 16 1.75 16H14.34c.964 0 1.658-.694 1.658-1.658V2.1C16 .94 15.15 0 13.992 0zM14 2v8h-1.757C11.28 10 10 11.28 10 12.243v.7c0 .193.337.057.144.057H5.247c-.193 0-.247.136-.247-.057v-.7C5 11.28 4.113 10 3.148 10H2V2h12zM7.117 9.963c.167.16.437.16.603.002l5.17-5.042c.165-.16.165-.422 0-.583l-.604-.583c-.166-.16-.437-.16-.603 0L7.42 7.924 5.694 6.24c-.166-.16-.437-.16-.603 0l-.604.582c-.166.162-.166.423 0 .584l2.63 2.557z"></path></g></svg></symbol><symbol id="next-chevron-nav" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.6,6 L8.2,8 L12,12 L8.2,16 L10.6,18 L15.3,13 C15.8,12.4 15.8,11.6 15.3,11 L10.6,6 L10.6,6 Z"></path></svg></symbol><symbol id="next-products-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><path d="M15.087 0H10.01c-.554 0-1.085.235-1.476.627L.3 8.87c-.37.368-.37.965 0 1.327l5.553 5.556c.362.368.955.37 1.323 0L15.4 7.52c.39-.392.6-.922.6-1.476V.967C16 .45 15.604 0 15.087 0zm-2.89 5.56c-.94 0-1.702-.764-1.702-1.703 0-.94.763-1.702 1.702-1.702.94 0 1.702.763 1.702 1.702 0 .94-.764 1.702-1.703 1.702z"></path></svg></symbol><symbol id="next-customers-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><g><path d="M13.08 8.26c-.68-.275-.674-.732-.674-1.007 0-.274.29-.657.566-.903.48-.423.777-1.04.777-1.737 0-1.206-1.018-2.21-2.224-2.257-.896-.03-1.658.41-2.062 1.1-.088.15-.03.337.127.415 1.12.555 1.873 1.69 1.873 3.03 0 .87-.32 1.698-.894 2.332-.128.14-.077.362.094.442.663.31 2.044.745 2.598 1.462.055.07.134-.136.224-.136h1.657c.473 0 .857.116.857-.358v-.12c0-1.308-1.93-1.85-2.92-2.263zM5.398 9.232c-.542-.603-.827-1.39-.827-2.304 0-1.348.74-2.53 1.863-3.08.16-.077.22-.267.128-.418-.5-.816-1.523-1.265-2.634-.993-1.006.24-1.64 1.17-1.64 2.21 0 .698.223 1.28.71 1.704.273.247.6.63.6.904s-.035.73-.715 1.006C1.89 8.67 0 9.214 0 10.522v.12c0 .474.384.358.857.358h1.656c.09 0 .17.206.226.133.544-.716 1.905-1.277 2.56-1.59.167-.078.222-.173.098-.31zM9.867 10.546c-.68-.278-.78-.735-.78-1.006 0-.274.234-.656.508-.9.483-.426.754-1.046.754-1.74 0-1.492-1.39-2.55-2.957-2.184-1.018.237-1.672 1.168-1.672 2.212 0 .695.223 1.286.706 1.71.274.246.596.628.596.902 0 .27-.248.728-.927 1.006C5.11 10.954 3 11.5 3 12.806v.122C3 13.4 3.812 14 4.286 14h7.43c.472 0 1.284-.6 1.284-1.072v-.122c0-1.307-2.147-1.852-3.133-2.26z"></path></g></svg></symbol><symbol id="next-reports-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><g><path d="M4 9.667C4 9.297 3.702 9 3.333 9H1.667C1.297 9 1 9.298 1 9.667v5.667c0 .368.298.666.667.666h1.667c.368 0 .666-.298.666-.667V9.667zM8 3.667C8 3.297 7.702 3 7.333 3H5.667C5.297 3 5 3.298 5 3.667v11.667c0 .368.298.666.667.666h1.667c.368 0 .666-.298.666-.667V3.667zM12 .667c0-.37-.298-.667-.667-.667H9.667C9.297 0 9 .298 9 .667v14.667c0 .368.298.666.667.666h1.667c.368 0 .666-.298.666-.667V.667zM16 6.667c0-.37-.298-.667-.667-.667h-1.667c-.368 0-.666.298-.666.667v8.667c0 .368.298.666.667.666h1.667c.368 0 .666-.298.666-.667V6.667z"></path></g></svg></symbol><symbol id="next-discounts-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><g><path d="M9 13.333C9 13.15 8.85 13 8.667 13H6.333c-.184 0-.333.15-.333.333v.333c0 .185.15.334.333.334h2.333c.185 0 .334-.15.334-.333v-.334zM13 13.333c0-.184-.15-.333-.333-.333h-2.333c-.185 0-.334.15-.334.333v.333c0 .185.15.334.333.334h2.333c.185 0 .334-.15.334-.333v-.334zM16 8.333C16 8.15 15.85 8 15.667 8h-.333c-.185 0-.334.15-.334.333v2.333c0 .185.15.334.333.334h.333c.185 0 .334-.15.334-.333V8.333zM11.3 9.2L7.272 5.902 11.3 2.607l-.013-.016c-.692-.845-1.94-.97-2.786-.278l-2.808 2.3-1.18-.966c.096-.254.155-.526.155-.813C4.667 1.547 3.62.5 2.333.5S0 1.547 0 2.833s1.047 2.333 2.333 2.333c.255 0 .495-.05.725-.127l1.055.862-.93.763c-.265-.103-.55-.165-.85-.165C1.047 6.5 0 7.547 0 8.833s1.047 2.333 2.333 2.333 2.333-1.047 2.333-2.333c0-.246-.05-.478-.12-.7l1.145-.938L8.5 9.493c.846.692 2.094.568 2.786-.28L11.3 9.2zM1.333 2.832c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.448-1-1zm1 7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1c0 .552-.448 1-1 1zM13 5.333C13 5.15 12.85 5 12.667 5h-2.333c-.185 0-.334.15-.334.333v.333c0 .185.15.334.333.334h2.333c.185 0 .334-.15.334-.333v-.334zM15.5 5h-1c-.276 0-.5 0-.5.5s.224.5.5.5h.5v.48c0 .275 0 .5.5.5s.5-.225.5-.5V5.5c0-.276-.063-.5-.5-.5zM3.5 14h1c.276 0 .5 0 .5-.5s-.224-.5-.5-.5H4v-.5c0-.276 0-.5-.5-.5s-.5.224-.5.5v.98c0 .275.062.52.5.52zM16 13.49v-1c0-.276 0-.5-.5-.5s-.5.224-.5.5V13h-.49c-.276 0-.5 0-.5.5s.224.5.5.5h.98c.276 0 .51-.073.51-.51z"></path></g></svg></symbol><symbol id="next-add-circle-outline" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M12 24c6.627 0 12-5.373 12-12s-5.373-12-12-12-12 5.373-12 12 5.373 12 12 12zm0-2.667c-5.155 0-9.333-4.179-9.333-9.333 0-5.155 4.179-9.333 9.333-9.333 5.155 0 9.333 4.179 9.333 9.333 0 5.155-4.179 9.333-9.333 9.333z"></path><path d="M12.623 13.337h3.663c.394 0 .714-.32.714-.714v-1.246c0-.394-.32-.714-.714-.714h-3.663l.714.714v-3.663c0-.394-.32-.714-.714-.714h-1.246c-.394 0-.714.32-.714.714v3.663l.714-.714h-3.663c-.394 0-.714.32-.714.714v1.246c0 .394.32.714.714.714h3.663l-.714-.714v3.663c0 .394.32.714.714.714h1.246c.394 0 .714-.32.714-.714v-3.663l-.714.714z"></path></g></svg></symbol><symbol id="next-online-store-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.1c-3.4 0-6.1-2.7-6.1-6.1 0-.9.2-1.8.6-2.6v.3c0 .2.3.5.3.7 0 .3.2.5.4.7.3.1.6.2.8.4.2.2.4.3.7.2.2.2.1.4 0 .6-.2.2-.3.4-.3.5-.1.3-.1.6.2.8.2.1.3.3.3.5s.2.4.3.5c.4.2.4.6.5 1 .1.8.7 2 .9 1.6.2-.3.6-.9.8-1.1.1-.1.2-.2.2-.3.1-.2.2-.4.4-.5.1-.1.2-.2.2-.3 0-.4.2-.8.4-1.1.4-.5.2-.8-.4-1-.3-.1-.7-.3-1.1-.1v-.2c.1-.5 0-.6-.5-.8-.2-.2-.4-.3-.6-.4-.2-.1-.5 0-.8-.1-.3.1-.2-.4-.5-.5-.6-.6.3-.8.7-.6.1.1.5-.5 1.3-1 .2 0 .1-1 .3-1-1.7-1-2-1.4-2-1.4h-.2c.9-.6 2-.9 3.2-.9h.6l-.1.1s-.5.3.1 1c.2.2.7.8.6.9 0 .2 1.4-.1 1.6-.1.4 0 .3.6 0 .7 0 .1-1.8.3-1.9.3-.3.4-.3.3-.2.7 0 .2-.1.3-.1.6.2.2.4.5.6.8.3.3.5.8.8.7.1 0 .2-.1.4-.2.1.1.3.4.5.5-.1.3 0 .5.2.8.1.1 0 .8-.1.9-.1.2 0 .6.2 1s.7.4.9 0l.7-1.9c.2-.4.5-.7.9-.9l.3-.1V8c.1 3.4-2.6 6.1-6 6.1z"></path></svg></symbol><symbol id="next-apps-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><path d="M12.383 9.734c.59.41.882 1.044.87 1.675-.004.29.357.43.563.226l1.894-1.894c.387-.387.387-1.015 0-1.402l-2.498-2.498c-.167-.167-.115-.463.11-.54.397-.133.76-.396 1.02-.798.432-.662.416-1.56-.04-2.204-.734-1.033-2.175-1.123-3.03-.268-.216.216-.37.47-.463.74-.08.23-.387.28-.56.108L7.767.397C7.38.01 6.75.01 6.364.397L4.472 2.29c-.215.214-.05.565.257.565.504 0 1.013.192 1.4.58.87.87.765 2.34-.316 3.06-.663.443-1.568.435-2.216-.028-.576-.412-.86-1.04-.855-1.664.01-.29-.355-.43-.56-.224L.29 6.47c-.387.388-.387 1.016 0 1.403l2.498 2.498c.167.168.115.464-.11.54-.397.134-.76.397-1.02.8-.432.66-.416 1.56.04 2.203.734 1.033 2.175 1.123 3.03.268.216-.215.37-.47.463-.74.08-.23.387-.28.56-.107l2.483 2.484c.387.387 1.015.387 1.402 0l1.892-1.892c.215-.215.05-.564-.254-.563-.508 0-1.016-.193-1.404-.582-.86-.86-.768-2.304.278-3.037.658-.462 1.574-.466 2.235-.01z"></path></svg></symbol><symbol id="next-settings-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><path d="M15.733 6.767l-1.77-.36c-.117-.025-.21-.112-.245-.227-.102-.323-.232-.636-.39-.935-.056-.107-.053-.234.013-.335l1-1.51c.086-.13.07-.304-.042-.415L13.02 1.707c-.114-.114-.292-.132-.426-.043l-1.504.995c-.1.066-.228.07-.335.013-.3-.158-.61-.288-.935-.39-.114-.037-.202-.13-.226-.247l-.36-1.77C9.2.113 9.063 0 8.906 0H7.093c-.158 0-.295.11-.326.267l-.36 1.77c-.025.117-.113.21-.227.245-.323.102-.636.232-.935.39-.107.056-.234.053-.335-.013l-1.504-.996c-.134-.09-.312-.07-.426.043L1.702 2.985c-.11.11-.128.284-.042.415l1 1.51c.066.1.07.228.012.335-.158.3-.288.612-.39.935-.036.114-.128.202-.246.226l-1.77.36C.113 6.8 0 6.937 0 7.094v1.813c0 .158.11.295.267.327l1.77.36c.117.025.21.112.245.227.102.323.232.636.39.935.056.107.053.234-.013.335l-.996 1.504c-.09.134-.07.312.043.426l1.273 1.273c.114.114.292.132.426.043l1.504-.995c.1-.066.228-.07.335-.012.3.158.61.288.935.39.115.036.202.128.226.246l.36 1.77c.032.155.17.266.327.266h1.813c.158 0 .295-.11.327-.267l.36-1.77c.025-.117.112-.21.227-.245.323-.102.636-.232.935-.39.107-.056.234-.053.335.013l1.504.996c.134.09.312.07.426-.043l1.273-1.273c.114-.114.132-.292.043-.426l-.995-1.504c-.066-.1-.07-.228-.012-.335.158-.3.288-.61.39-.935.036-.115.128-.202.246-.226l1.77-.36c.155-.032.266-.17.266-.327V7.093c0-.158-.112-.295-.267-.326zM10.667 8c0 1.473-1.193 2.667-2.667 2.667S5.333 9.473 5.333 8c0-1.473 1.193-2.667 2.667-2.667S10.667 6.527 10.667 8z"></path></svg></symbol><symbol id="next-menu-16" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><path d="M7 9H1c-.552 0-1-.114-1-.667v-.666C0 7.114.448 7 1 7h14c.552 0 1 .114 1 .667v.667c0 .552-.448.666-1 .666H7zM7 4H1c-.552 0-1-.114-1-.667v-.666C0 2.114.448 2 1 2h14c.552 0 1 .114 1 .667v.667c0 .552-.448.666-1 .666H7zM7 14H1c-.552 0-1-.114-1-.667v-.667C0 12.114.448 12 1 12h14c.552 0 1 .114 1 .667v.667c0 .552-.448.666-1 .666H7z"></path></svg></symbol><symbol id="next-delete" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" enable-background="new 0 0 12 12"><path d="M12 2c0 .5-.4 1-.8 1H.8C.4 3 0 2.5 0 2s.4-1 .8-1H4c0-.5.7-1 1.2-1h1.6C7.3 0 8 .6 8 1h3.2c.4 0 .8.5.8 1zm-1 2.6v6.6c0 .4-.8.8-1.2.8H2.2c-.4 0-1.2-.3-1.2-.8V4.6c0-.1.5-.6.7-.6h8.7c.1 0 .6.5.6.6zM5 6.4c0-.2-.2-.4-.4-.4h-.2c-.2 0-.4.2-.4.4v3.2c0 .2.2.4.4.4h.2c.2 0 .4-.2.4-.4V6.4zm3 0c0-.2-.2-.4-.4-.4h-.2c-.2 0-.4.2-.4.4v3.2c0 .2.2.4.4.4h.2c.2 0 .4-.2.4-.4V6.4z"></path></svg></symbol><symbol id="next-checkmark" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" enable-background="new 0 0 24 24"><path d="M23.6 5L22 3.4c-.5-.4-1.2-.4-1.7 0L8.5 15l-4.8-4.7c-.5-.4-1.2-.4-1.7 0L.3 11.9c-.5.4-.5 1.2 0 1.6l7.3 7.1c.5.4 1.2.4 1.7 0l14.3-14c.5-.4.5-1.1 0-1.6z"></path></svg></symbol><symbol id="next-subtract" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" enable-background="new 0 0 12 12"><path d="M6 0"></path><path d="M.8 7C.3 7 0 6.7 0 6.2v-.4c0-.5.3-.8.8-.8h10.5c.4 0 .7.3.7.8v.5c0 .4-.3.7-.8.7H.8z"></path></svg></symbol><symbol id="next-chevron" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 4l9 8-9 8 2 2 11-10L8 2 6 4" fill="currentColor"></path></svg></symbol><symbol id="next-chevron-down" class="icon-symbol--loaded"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" enable-background="new 0 0 24 24"><path d="M21 5.176l-9.086 9.353-8.914-9.353-2.314 2.471 11.314 11.735 11.314-11.735-2.314-2.471z"></path></svg></symbol></svg></div>
@@ -0,0 +1,17 @@
1
+ <section class="section">
2
+ <div class="layout-content">
3
+
4
+ <aside class="layout-content__sidebar layout-content__first">
5
+ <% if content_for?(:section_summary) %>
6
+ <div class="section-summary">
7
+ <%= content_for :section_summary %>
8
+ </div>
9
+ <% end %>
10
+ </aside>
11
+
12
+ <section class="layout-content__main">
13
+ <%= content_for :section_content %>
14
+ </section>
15
+
16
+ </div>
17
+ </section>
@@ -0,0 +1,25 @@
1
+ <% if @shop.current_subscription? %>
2
+ <p>
3
+ You are currently on the <%= @shop.current_subscription.plan.name %> plan.
4
+ </p>
5
+ <p>
6
+ Choose a new plan:
7
+ </p>
8
+ <% else %>
9
+ <p>
10
+ Welcome!
11
+ </p>
12
+ <p>
13
+ Choose a plan below to get started:
14
+ </p>
15
+ <% end %>
16
+
17
+ <% for plan in DiscoApp::Plan.available %>
18
+
19
+ <h2><%= plan.name %></h2>
20
+ <%= form_for(@subscription) do |f| %>
21
+ <%= f.hidden_field :plan, value: plan.id %>
22
+ <%= f.submit %>
23
+ <% end %>
24
+
25
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <li class="next-nav__item">
2
+ <a href="<%= admin_shops_path %>" class="next-nav__link <%= active_link_to_class(admin_shops_path, class_active: 'next-nav__link--is-selected', active: :inclusive) %>">
3
+ <svg class="next-icon next-icon--size-16 next-icon--no-nudge" role="img" aria-labelledby="next-dashboard-16-17dbedf316126bf9bd81f6c6b7626199-title"><title id="next-dashboard-16-17dbedf316126bf9bd81f6c6b7626199-title">Home</title><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#next-dashboard-16"></use></svg>
4
+ <span class="next-nav__text">Shops</span>
5
+ </a>
6
+ </li>
7
+
8
+ <li class="next-nav__item">
9
+ <a href="<%= admin_plans_path %>" class="next-nav__link <%= active_link_to_class(admin_plans_path, class_active: 'next-nav__link--is-selected', active: :inclusive) %>">
10
+ <svg class="next-icon next-icon--size-16 next-icon--no-nudge" role="img" aria-labelledby="next-dashboard-16-17dbedf316126bf9bd81f6c6b7626199-title"><title id="next-dashboard-16-17dbedf316126bf9bd81f6c6b7626199-title">Home</title><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#next-dashboard-16"></use></svg>
11
+ <span class="next-nav__text">Plans</span>
12
+ </a>
13
+ </li>
14
+
15
+ <li class="next-nav__item">
16
+ <a href="<%= edit_admin_app_settings_path %>" class="next-nav__link <%= active_link_to_class(edit_admin_app_settings_path, class_active: 'next-nav__link--is-selected', active: :inclusive) %>">
17
+ <svg class="next-icon next-icon--size-16 next-icon--no-nudge" role="img" aria-labelledby="next-dashboard-16-17dbedf316126bf9bd81f6c6b7626199-title"><title id="next-dashboard-16-17dbedf316126bf9bd81f6c6b7626199-title">Home</title><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#next-dashboard-16"></use></svg>
18
+ <span class="next-nav__text">Settings</span>
19
+ </a>
20
+ </li>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= yield(:title) %></title>
5
+ <%= stylesheet_link_tag 'disco_app/admin', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+
8
+ <%= csrf_meta_tags %>
9
+ </head>
10
+ <body class="next-ui">
11
+
12
+ <div class="nav-drawer">
13
+ <div class="next-nav next-nav--is-expanded">
14
+ <div class="next-nav__panel next-nav__panel--primary">
15
+ <header role="banner" class="next-nav__logo next-nav__logo--shopify">
16
+ <h1>
17
+ <a href="/admin">
18
+ <span role="img" class="ui-inline-svg">
19
+ <svg class="next-nav__svg-logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0" y="0" viewBox="0 0 609 177" xml:space="preserve" enable-background="new 0 0 609 177"><style type="text/css">
20
+ .st0{fill:#231F20;}
21
+ .st1{fill:#FBAF41;}
22
+ .st2{fill:#8676D5;}
23
+ .st3{fill:#9CCC6B;}
24
+ .st4{fill:#FBCC6B;}
25
+ .st5{fill:#9CCCD5;}
26
+ .st6{fill:#FFFFFF;}
27
+ </style><path id="XMLID_36_" class="st0" d="M80.9 176l-37.2-21.5L6.4 133V90 47l37.2-21.5L80.9 4l37.2 21.5L155.4 47v43 43l-37.2 21.5L80.9 176z"/><polygon id="XMLID_13_" class="st1" points="16 52.5 16 127.5 145.9 127.5 "/><polygon id="XMLID_12_" class="st2" points="16 127.5 145.9 127.5 145.9 52.5 "/><polygon id="XMLID_11_" class="st3" points="145.9 127.5 80.9 15.1 16 127.5 "/><polygon id="XMLID_10_" class="st4" points="48.5 71.3 16 127.5 145.9 127.5 "/><polygon id="XMLID_9_" class="st5" points="16 127.5 145.9 127.5 113.4 71.3 "/><polygon id="XMLID_8_" class="st6" points="80.9 90 16 127.5 80.9 165 145.9 127.5 "/><g id="XMLID_17_"><path id="XMLID_27_" class="st6" d="M205.4 125.4V55h27.7c22 0 37.3 14 37.3 35.1 0 21.3-15.3 35.2-37.2 35.2H205.4zM255.2 90.2c0-12.3-7.6-21.9-21.9-21.9h-12.9v44h12.8C247.1 112.2 255.2 102.2 255.2 90.2z"/><path id="XMLID_25_" class="st6" d="M286.4 125.4V55h15v70.3H286.4z"/><path id="XMLID_23_" class="st6" d="M315.7 115.5l8.2-11.7c5 5.2 12.7 9.6 22.4 9.6 8.3 0 12.2-3.7 12.2-7.8 0-12.2-40.5-3.7-40.5-30.2 0-11.7 10.1-21.4 26.7-21.4 11.2 0 20.5 3.4 27.4 9.8L363.8 75c-5.7-5.3-13.3-7.7-20.5-7.7 -6.3 0-9.9 2.7-9.9 7 0 11.1 40.4 3.6 40.4 29.8 0 12.9-9.3 22.6-28.2 22.6C332.1 126.7 322.4 122.1 315.7 115.5z"/><path id="XMLID_21_" class="st6" d="M385.8 90.3c0-21.7 16.3-36.4 37.5-36.4 15.4 0 24.4 8.3 29.3 17.2l-12.9 6.3c-3-5.7-9.3-10.2-16.5-10.2 -12.9 0-22.1 9.8-22.1 23.1 0 13.3 9.3 23.1 22.1 23.1 7.2 0 13.5-4.5 16.5-10.2l12.9 6.2c-5 8.8-13.9 17.3-29.3 17.3C402.1 126.7 385.8 111.9 385.8 90.3z"/><path id="XMLID_18_" class="st6" d="M463.5 90.3c0-21.2 15.5-36.4 36.8-36.4 21.2 0 36.7 15.2 36.7 36.4 0 21.2-15.5 36.4-36.7 36.4C479 126.7 463.5 111.5 463.5 90.3zM521.6 90.3c0-13.2-8.3-23.1-21.3-23.1 -13.1 0-21.4 9.9-21.4 23.1 0 13.1 8.3 23.1 21.4 23.1C513.2 113.4 521.6 103.3 521.6 90.3z"/></g></svg>
28
+ </span>
29
+ </a>
30
+ </h1>
31
+ </header>
32
+ <nav role="navigation">
33
+ <ol class="next-nav__list next-nav__list--primary">
34
+ <%= render 'layouts/admin/nav_items' %>
35
+ </ol>
36
+ </nav>
37
+ </div>
38
+ </div>
39
+ </div>
40
+
41
+ <main id="content" role="main">
42
+ <div class="header-row">
43
+ <header class="header">
44
+ <h1 class="header__main">
45
+ <svg class="next-icon next-icon--size-20 next-icon--header">
46
+ <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#next-collections"></use>
47
+ </svg>
48
+ <% if content_for?(:breadcrumb) %>
49
+ <span class="breadcrumb">
50
+ <a href="<%= yield(:breadcrumb_url) %>"><%= yield(:breadcrumb) %></a>
51
+ /
52
+ </span>
53
+ <% end %>
54
+ <span>
55
+ <%= yield(:title) %>
56
+ </span>
57
+ </h1>
58
+ </header>
59
+ </div>
60
+
61
+ <div class="page">
62
+ <%= yield %>
63
+ </div>
64
+ </main>
65
+
66
+ </body>
67
+ </html>
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= yield(:title) %></title>
5
+
6
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
7
+
8
+ <%= csrf_meta_tags %>
9
+
10
+ <%= yield :extra_head %>
11
+ </head>
12
+ <body>
13
+
14
+ <%= yield %>
15
+
16
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
17
+ </body>
18
+ </html>
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= yield(:title) %></title>
5
+
6
+ <script src="//cdn.shopify.com/s/assets/external/app.js?<%= Time.now.strftime('%Y%m%d%H') %>"></script>
7
+ <script type="text/javascript">
8
+ // Initialise the Shopify App.
9
+ ShopifyApp.init({
10
+ "apiKey": "<%= ShopifyApp.configuration.api_key %>",
11
+ "shopOrigin": "<%= "https://#{ @shop_session.url }" if @shop_session %>",
12
+ "debug": <%= Rails.env.development? ? 'true' : 'false' %>
13
+ });
14
+ </script>
15
+
16
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
17
+
18
+ <%= csrf_meta_tags %>
19
+
20
+ <%= yield :extra_head %>
21
+ </head>
22
+ <body>
23
+ <script type="text/javascript">
24
+ window.DiscoApp = {
25
+ INITIAL_TITLE: "<%= yield(:title) %>",
26
+ INITIAL_ICON: "<%= image_url("disco_app/icon.svg") %>",
27
+ INITIAL_BUTTONS: <%= content_for?(:buttons) ? content_for(:buttons) : '{}' %>,
28
+ INITIAL_BREADCRUMB: <%= content_for?(:breadcrumb) ? content_for(:breadcrumb) : 'undefined' %>
29
+ };
30
+ ShopifyApp.Bar.initialize({
31
+ title: DiscoApp.INITIAL_TITLE,
32
+ icon: DiscoApp.INITIAL_ICON,
33
+ buttons: DiscoApp.INITIAL_BUTTONS,
34
+ breadcrumb: DiscoApp.INITIAL_BREADCRUMB
35
+ });
36
+ </script>
37
+
38
+ <%= yield %>
39
+
40
+ <% flash.each do |key, message| %>
41
+ <script type="text/javascript">
42
+ ShopifyApp.flash<%= (key == 'error') ? 'Error' : 'Notice' %>('<%= message %>');
43
+ </script>
44
+ <% end %>
45
+
46
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true, 'data-turbolinks-eval' => false %>
47
+
48
+ <%= render 'disco_app/shared/icons' %>
49
+ </body>
50
+ </html>
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= yield(:title) %></title>
5
+ <script src="//cdn.shopify.com/s/assets/external/app.js?<%= Time.now.strftime('%Y%m%d%H') %>"></script>
6
+ <script type="text/javascript">
7
+ // Initialise the Shopify App.
8
+ ShopifyApp.init({
9
+ "apiKey": "<%= ShopifyApp.configuration.api_key %>",
10
+ "shopOrigin": "<%= "https://#{ @shop_session.url }" if @shop_session %>",
11
+ "debug": <%= Rails.env.development? ? 'true' : 'false' %>,
12
+ "forceRedirect": false
13
+ });
14
+ </script>
15
+
16
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
17
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
18
+
19
+ <%= csrf_meta_tags %>
20
+
21
+ <%= yield :extra_head %>
22
+ </head>
23
+ <body>
24
+
25
+ <%= yield %>
26
+
27
+ </body>
28
+ </html>
@@ -0,0 +1,28 @@
1
+ <% provide(:title, "Install #{DiscoApp.configuration.app_name}") %>
2
+
3
+ <%= form_tag shopify_app.login_path do %>
4
+ <div class="ui-empty-state">
5
+ <section class="ui-empty-state__section">
6
+ <div class="ui-empty-state__subsection">
7
+ <h1 class="ui-empty-state__title">Install <%= DiscoApp.configuration.app_name %></h1>
8
+ <h2 class="ui-empty-state__subtitle">Enter your Shopify store name below to get started.</h2>
9
+ </div>
10
+ <div class="ui-empty-state__subsection">
11
+ <div class="next-grid">
12
+ <div class="next-grid__cell" style="text-align: right;">
13
+ <label for="shop" class="next-input__help-text">https://</label>
14
+ </div>
15
+ <div class="next-grid__cell">
16
+ <input type="text" class="form-control" id="shop" name="shop" placeholder="your-store" autocomplete="off" autofocus="on" />
17
+ </div>
18
+ <div class="next-grid__cell" style="text-align: left;">
19
+ <label for="shop" class="next-input__help-text">.myshopify.com</label>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <div class="ui-empty-state__subsection">
24
+ <button type="submit" class="btn btn-large btn-primary">Install</button>
25
+ </div>
26
+ </section>
27
+ </div>
28
+ <% end %>
data/config/routes.rb ADDED
@@ -0,0 +1,63 @@
1
+ require 'sidekiq/web'
2
+
3
+ DiscoApp::Engine.routes.draw do
4
+
5
+ get 'ref', to: '/sessions#referral'
6
+
7
+ controller :webhooks do
8
+ post 'webhooks' => :process_webhook, as: :webhooks
9
+ end
10
+
11
+ resources :subscriptions, only: [:new, :create] do
12
+ resources :charges, only: [:new, :create] do
13
+ member do
14
+ get 'activate'
15
+ end
16
+ end
17
+ end
18
+
19
+ controller :install do
20
+ get 'install' => :install, as: :install
21
+ get 'installing' => :installing, as: :installing
22
+ get 'uninstalling' => :uninstalling, as: :uninstalling
23
+ end
24
+
25
+ controller 'admin' do
26
+ get 'admin', to: redirect('/admin/shops')
27
+ get 'admin/shops' => 'admin/shops#index'
28
+ end
29
+
30
+ namespace :admin do
31
+ resources :shops, only: [:index, :edit, :update] do
32
+ resources :subscriptions, only: [:edit, :update]
33
+ end
34
+ resources :plans
35
+ resource :app_settings, only: [:edit, :update]
36
+
37
+ # JSON-API resources for admins.
38
+ namespace :resources do
39
+ jsonapi_resources :shops
40
+ end
41
+ end
42
+
43
+ # Make the Sidekiq Web UI accessible using the same credentials as the admin.
44
+ if Rails.env.production?
45
+ Sidekiq::Web.use Rack::Auth::Basic do |username, password|
46
+ [
47
+ ENV['ADMIN_APP_USERNAME'].present?,
48
+ ENV['ADMIN_APP_USERNAME'] == username,
49
+ ENV['ADMIN_APP_PASSWORD'].present?,
50
+ ENV['ADMIN_APP_PASSWORD'] == password,
51
+ ].all?
52
+ end
53
+ mount Sidekiq::Web, at: '/sidekiq'
54
+ end
55
+
56
+ # Make the embedded app frame emulator available in development.
57
+ if Rails.env.development?
58
+ controller :frame do
59
+ get 'frame' => :frame, as: :frame
60
+ end
61
+ end
62
+
63
+ end
@@ -0,0 +1,15 @@
1
+ class CreateShopsIfNotExistent < ActiveRecord::Migration
2
+
3
+ def change
4
+ unless table_exists? :shops or table_exists? :disco_app_shops
5
+ create_table :shops do |t|
6
+ t.string :shopify_domain, null: false
7
+ t.string :shopify_token, null: false
8
+ t.timestamps null: false
9
+ end
10
+
11
+ add_index :shops, :shopify_domain, unique: true
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,5 @@
1
+ class AddStatusToShops < ActiveRecord::Migration
2
+ def change
3
+ add_column :shops, :status, :integer, default: 0
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class AddMetaToShops < ActiveRecord::Migration
2
+ def change
3
+ add_column :shops, :email, :string
4
+ add_column :shops, :country_name, :string
5
+ add_column :shops, :currency, :string
6
+ add_column :shops, :money_format, :string
7
+ add_column :shops, :money_with_currency_format, :string
8
+ add_column :shops, :domain, :string
9
+ add_column :shops, :plan_name, :string
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddChargeStatusToShop < ActiveRecord::Migration
2
+ def change
3
+ add_column :shops, :charge_status, :integer, default: 6
4
+ end
5
+ end