spree_frontend 4.1.0 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (314) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +120 -0
  3. data/.codeclimate.yml +36 -0
  4. data/.deepsource.toml +19 -0
  5. data/.editorconfig +22 -0
  6. data/.eslintignore +7 -0
  7. data/.eslintrc +36 -0
  8. data/.gem_release.yml +7 -0
  9. data/.github/CONTRIBUTING.md +1 -0
  10. data/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
  11. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  12. data/.github/ISSUE_TEMPLATE.md +39 -0
  13. data/.github/dependabot.yml +32 -0
  14. data/.gitignore +58 -0
  15. data/.rubocop.yml +197 -0
  16. data/.solargraph.yml +20 -0
  17. data/.stylelintignore +4 -0
  18. data/.stylelintrc +6 -0
  19. data/CODE_OF_CONDUCT.md +22 -0
  20. data/Gemfile +57 -3
  21. data/LICENSE +1 -1
  22. data/README.md +89 -0
  23. data/Rakefile +1 -1
  24. data/SECURITY.md +1 -0
  25. data/app/assets/config/spree_frontend_manifest.js +5 -0
  26. data/app/assets/images/arrow-down.svg +12 -0
  27. data/app/assets/images/arrow-right-circle-fill.svg +3 -0
  28. data/app/assets/images/card-image.svg +4 -0
  29. data/app/assets/images/edit.svg +1 -1
  30. data/app/assets/images/favicon.ico +0 -0
  31. data/app/assets/images/file-image.svg +4 -0
  32. data/app/assets/images/global.svg +1 -0
  33. data/app/assets/images/image.svg +4 -0
  34. data/app/assets/images/info.svg +7 -0
  35. data/app/assets/images/logo/spree_50.png +0 -0
  36. data/app/assets/images/logo-spree.png +0 -0
  37. data/app/assets/images/logo.png +0 -0
  38. data/app/assets/images/logo.svg +10 -1
  39. data/app/assets/images/logo@2x.png +0 -0
  40. data/app/assets/images/logo@3x.png +0 -0
  41. data/app/assets/images/noimage/large.png +0 -0
  42. data/app/assets/images/noimage/mini.png +0 -0
  43. data/app/assets/images/noimage/plp.png +0 -0
  44. data/app/assets/images/noimage/plp.svg +16 -0
  45. data/app/assets/images/noimage/product.png +0 -0
  46. data/app/assets/images/noimage/small.png +0 -0
  47. data/app/assets/images/pagination-arrow-right.svg +3 -10
  48. data/app/assets/images/pagination-double-arrow-right.svg +6 -13
  49. data/app/assets/images/plus.svg +1 -1
  50. data/app/assets/images/search.svg +1 -1
  51. data/app/assets/javascripts/spree/frontend/account.js +1 -1
  52. data/app/assets/javascripts/spree/frontend/api/main.js +36 -0
  53. data/app/assets/javascripts/spree/frontend/api/storefront/cart.js +49 -0
  54. data/app/assets/javascripts/spree/frontend/cart.js +24 -2
  55. data/app/assets/javascripts/spree/frontend/checkout/address.js +78 -52
  56. data/app/assets/javascripts/spree/frontend/checkout/address_book.js +38 -40
  57. data/app/assets/javascripts/spree/frontend/checkout/payment.js +63 -23
  58. data/app/assets/javascripts/spree/frontend/checkout/shipment.js +15 -2
  59. data/app/assets/javascripts/spree/frontend/checkout.js +17 -1
  60. data/app/assets/javascripts/spree/frontend/coupon_manager.js +1 -1
  61. data/app/assets/javascripts/spree/frontend/currency.js +44 -0
  62. data/app/assets/javascripts/spree/frontend/locale.es6 +12 -0
  63. data/app/assets/javascripts/spree/frontend/login.js +5 -0
  64. data/app/assets/javascripts/spree/frontend/main.js +78 -0
  65. data/app/assets/javascripts/spree/frontend/main_nav_bar.js +86 -0
  66. data/app/assets/javascripts/spree/frontend/{turbolinks_scroll_fix.js → turbo_scroll_fix.js} +3 -3
  67. data/app/assets/javascripts/spree/frontend/views/spree/home/product_carousels.js +4 -4
  68. data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +3 -3
  69. data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +67 -18
  70. data/app/assets/javascripts/spree/frontend/views/spree/products/description.js +1 -1
  71. data/app/assets/javascripts/spree/frontend/views/spree/products/index.js +76 -15
  72. data/app/assets/javascripts/spree/frontend/views/spree/products/price_filters.es6 +46 -0
  73. data/app/assets/javascripts/spree/frontend/views/spree/shared/mobile_navigation.js +9 -10
  74. data/app/assets/javascripts/spree/frontend/views/spree/shared/product_added_modal.js +7 -0
  75. data/app/assets/javascripts/spree/frontend/views/spree/shared/variant_select.js +93 -0
  76. data/app/assets/javascripts/spree/frontend.js +68 -11
  77. data/app/assets/stylesheets/spree/frontend/application.scss +5 -2
  78. data/app/assets/stylesheets/spree/frontend/components-bootstrap/button.scss +8 -0
  79. data/app/assets/stylesheets/spree/frontend/components-bootstrap/carousel.scss +4 -0
  80. data/app/assets/stylesheets/spree/frontend/components-custom/inputs.scss +80 -1
  81. data/app/assets/stylesheets/spree/frontend/flags/_flag-icon-base.scss +23 -0
  82. data/app/assets/stylesheets/spree/frontend/flags/_flag-icon-list.scss +265 -0
  83. data/app/assets/stylesheets/spree/frontend/flags/_variables.scss +2 -0
  84. data/app/assets/stylesheets/spree/frontend/flags/flag-icon.scss +3 -0
  85. data/app/assets/stylesheets/spree/frontend/functions.scss +1 -0
  86. data/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss +48 -0
  87. data/app/assets/stylesheets/spree/frontend/variables/bootstrap-overrides.scss +2 -2
  88. data/app/assets/stylesheets/spree/frontend/variables/helper-variables.scss +1 -0
  89. data/app/assets/stylesheets/spree/frontend/variables/variables.scss +54 -0
  90. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/confirm.scss +27 -26
  91. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/delivery.scss +6 -0
  92. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +24 -10
  93. data/app/assets/stylesheets/spree/frontend/views/spree/cms_sections/_index.scss +1 -0
  94. data/app/assets/stylesheets/spree/frontend/views/spree/cms_sections/product_buy_bar.scss +20 -0
  95. data/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss +54 -67
  96. data/app/assets/stylesheets/spree/frontend/views/spree/orders/edit.scss +4 -3
  97. data/app/assets/stylesheets/spree/frontend/views/spree/orders/show.scss +3 -0
  98. data/app/assets/stylesheets/spree/frontend/views/spree/products/cart_form.scss +8 -0
  99. data/app/assets/stylesheets/spree/frontend/views/spree/products/gallery_modal.scss +7 -0
  100. data/app/assets/stylesheets/spree/frontend/views/spree/products/index.scss +55 -26
  101. data/app/assets/stylesheets/spree/frontend/views/spree/products/show.scss +7 -0
  102. data/app/assets/stylesheets/spree/frontend/views/spree/shared/_color_select.scss +10 -9
  103. data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/single.scss +1 -1
  104. data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/thumbnails.scss +1 -0
  105. data/app/assets/stylesheets/spree/frontend/views/spree/shared/cart.scss +9 -4
  106. data/app/assets/stylesheets/spree/frontend/views/spree/shared/category_nav_bar.scss +3 -3
  107. data/app/assets/stylesheets/spree/frontend/views/spree/shared/change_store.scss +7 -0
  108. data/app/assets/stylesheets/spree/frontend/views/spree/shared/footer.scss +4 -0
  109. data/app/assets/stylesheets/spree/frontend/views/spree/shared/main_nav_bar.scss +42 -26
  110. data/app/assets/stylesheets/spree/frontend/views/spree/shared/mobile_navigation.scss +34 -3
  111. data/app/assets/stylesheets/spree/frontend/views/spree/shared/nav_bar.scss +24 -7
  112. data/app/assets/stylesheets/spree/frontend/views/spree/shared/quantity_select.scss +9 -12
  113. data/app/assets/stylesheets/spree/frontend/views/spree/shared/search_form.scss +12 -0
  114. data/app/assets/stylesheets/spree/frontend/views/spree/users/show.scss +7 -13
  115. data/app/assets/stylesheets/spree/frontend.css +0 -1
  116. data/app/controllers/concerns/spree/checkout/address_book.rb +9 -7
  117. data/app/controllers/concerns/spree/locale_urls.rb +21 -0
  118. data/app/controllers/spree/addresses_controller.rb +16 -33
  119. data/app/controllers/spree/checkout_controller.rb +15 -13
  120. data/app/controllers/spree/cms_pages_controller.rb +29 -0
  121. data/app/controllers/spree/content_controller.rb +0 -2
  122. data/app/controllers/spree/currency_controller.rb +17 -0
  123. data/app/controllers/spree/errors_controller.rb +11 -0
  124. data/app/controllers/spree/home_controller.rb +38 -1
  125. data/app/controllers/spree/locale_controller.rb +35 -6
  126. data/app/controllers/spree/orders_controller.rb +12 -10
  127. data/app/controllers/spree/products_controller.rb +46 -28
  128. data/app/controllers/spree/store_controller.rb +77 -12
  129. data/app/controllers/spree/taxons_controller.rb +16 -8
  130. data/app/helpers/spree/addresses_helper.rb +64 -12
  131. data/app/helpers/spree/cache_helper.rb +7 -0
  132. data/app/helpers/spree/cms_pages_helper.rb +23 -0
  133. data/app/helpers/spree/frontend_helper.rb +170 -18
  134. data/app/helpers/spree/navigation_helper.rb +81 -4
  135. data/app/helpers/spree/products_filters_helper.rb +168 -0
  136. data/app/helpers/spree/store_helper.rb +41 -0
  137. data/app/helpers/spree/structured_data_helper.rb +6 -2
  138. data/app/helpers/spree/taxons_helper.rb +2 -2
  139. data/app/services/spree/build_localized_redirect_url.rb +141 -0
  140. data/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb +3 -3
  141. data/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb +2 -2
  142. data/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb +3 -3
  143. data/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb +3 -3
  144. data/app/views/kaminari/twitter-bootstrap-4/_page.html.erb +2 -2
  145. data/app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb +2 -2
  146. data/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb +3 -3
  147. data/app/views/spree/address/_form.html.erb +26 -27
  148. data/app/views/spree/addresses/_form.html.erb +15 -6
  149. data/app/views/spree/addresses/edit.html.erb +13 -8
  150. data/app/views/spree/addresses/new.html.erb +8 -4
  151. data/app/views/spree/checkout/_address.html.erb +19 -23
  152. data/app/views/spree/checkout/_confirm.html.erb +1 -75
  153. data/app/views/spree/checkout/_credit_card.html.erb +3 -2
  154. data/app/views/spree/checkout/_delivery.html.erb +11 -4
  155. data/app/views/spree/checkout/_delivery_informations.html.erb +51 -0
  156. data/app/views/spree/checkout/_payment.html.erb +5 -24
  157. data/app/views/spree/checkout/_payment_sources.html.erb +17 -0
  158. data/app/views/spree/checkout/_summary.html.erb +22 -19
  159. data/app/views/spree/checkout/edit.html.erb +22 -2
  160. data/app/views/spree/checkout/payment/_gateway.html.erb +2 -2
  161. data/app/views/spree/checkout/registration.html.erb +3 -3
  162. data/app/views/spree/cms_pages/show.html.erb +16 -0
  163. data/app/views/spree/errors/not_found.html.erb +2 -2
  164. data/app/views/spree/home/index.html.erb +17 -123
  165. data/app/views/spree/layouts/checkout.html.erb +3 -1
  166. data/app/views/spree/layouts/spree_application.html.erb +3 -2
  167. data/app/views/spree/locale/index.html.erb +1 -0
  168. data/app/views/spree/orders/_coupon_code.html.erb +3 -4
  169. data/app/views/spree/orders/_line_item.html.erb +4 -4
  170. data/app/views/spree/orders/_line_item_data.html.erb +3 -3
  171. data/app/views/spree/orders/edit.html.erb +2 -3
  172. data/app/views/spree/orders/show.html.erb +2 -72
  173. data/app/views/spree/products/_cart_form.html.erb +5 -2
  174. data/app/views/spree/products/_color_option_type.html.erb +14 -14
  175. data/app/views/spree/products/_description.html.erb +19 -14
  176. data/app/views/spree/products/_filters_desktop.html.erb +80 -40
  177. data/app/views/spree/products/_filters_mobile.html.erb +47 -15
  178. data/app/views/spree/products/_gallery.html.erb +4 -6
  179. data/app/views/spree/products/_gallery_modal.html.erb +4 -6
  180. data/app/views/spree/products/_option_type.html.erb +1 -3
  181. data/app/views/spree/products/_product.html.erb +1 -1
  182. data/app/views/spree/products/_properties.html.erb +6 -4
  183. data/app/views/spree/products/_sort_desktop.html.erb +20 -14
  184. data/app/views/spree/products/_sort_mobile.html.erb +24 -8
  185. data/app/views/spree/products/_thumbnails.html.erb +2 -2
  186. data/app/views/spree/products/index.html.erb +7 -4
  187. data/app/views/spree/products/related.html.erb +11 -5
  188. data/app/views/spree/products/show.html.erb +2 -3
  189. data/app/views/spree/shared/_breadcrumbs.html.erb +2 -2
  190. data/app/views/spree/shared/_carousel_4_products.html.erb +14 -20
  191. data/app/views/spree/shared/_cart.html.erb +1 -1
  192. data/app/views/spree/shared/_checkout_header.html.erb +22 -21
  193. data/app/views/spree/shared/_color_select.html.erb +3 -3
  194. data/app/views/spree/shared/_copyright.html.erb +1 -10
  195. data/app/views/spree/shared/_currency_dropdown.html.erb +13 -0
  196. data/app/views/spree/shared/_delete_address_popup.html.erb +1 -2
  197. data/app/views/spree/shared/_error_messages.html.erb +2 -2
  198. data/app/views/spree/shared/_footer.html.erb +31 -21
  199. data/app/views/spree/shared/_get_started.html.erb +32 -0
  200. data/app/views/spree/shared/_head.html.erb +8 -5
  201. data/app/views/spree/shared/_header.html.erb +4 -4
  202. data/app/views/spree/shared/_internationalization_options.html.erb +31 -0
  203. data/app/views/spree/shared/_line_item.html.erb +3 -3
  204. data/app/views/spree/shared/_link_to_account.html.erb +7 -4
  205. data/app/views/spree/shared/_link_to_cart.html.erb +1 -2
  206. data/app/views/spree/shared/_locale_and_currency.html.erb +6 -0
  207. data/app/views/spree/shared/_locale_dropdown.html.erb +13 -0
  208. data/app/views/spree/shared/_login.html.erb +5 -5
  209. data/app/views/spree/shared/_main_nav_bar.html.erb +69 -45
  210. data/app/views/spree/shared/_mobile_internationalization_options.html.erb +37 -0
  211. data/app/views/spree/shared/_mobile_navigation.html.erb +48 -63
  212. data/app/views/spree/shared/_nav_bar.html.erb +9 -19
  213. data/app/views/spree/shared/_no_product_available.html.erb +1 -1
  214. data/app/views/spree/shared/_option_values.html.erb +2 -21
  215. data/app/views/spree/shared/_order_details.html.erb +117 -174
  216. data/app/views/spree/shared/_paths.html.erb +8 -0
  217. data/app/views/spree/shared/_payment.html.erb +2 -2
  218. data/app/views/spree/shared/_payment_sources.html.erb +2 -2
  219. data/app/views/spree/shared/_product_added_modal.html.erb +3 -3
  220. data/app/views/spree/shared/_properties.html.erb +4 -0
  221. data/app/views/spree/shared/_quantity_select.html.erb +2 -2
  222. data/app/views/spree/shared/_search.html.erb +9 -13
  223. data/app/views/spree/shared/_translations.html.erb +8 -7
  224. data/app/views/spree/shared/carousel/_single.html.erb +9 -14
  225. data/app/views/spree/shared/carousel/_thumbnails.html.erb +35 -39
  226. data/app/views/spree/shared/cms/pages/_edit_mode.html.erb +13 -0
  227. data/app/views/spree/shared/cms/sections/_featured_article.html.erb +27 -0
  228. data/app/views/spree/shared/cms/sections/_hero_image.html.erb +60 -0
  229. data/app/views/spree/shared/cms/sections/_image_gallery.html.erb +171 -0
  230. data/app/views/spree/shared/cms/sections/_product_carousel.html.erb +5 -0
  231. data/app/views/spree/shared/cms/sections/_rich_text_content.html.erb +3 -0
  232. data/app/views/spree/shared/cms/sections/_side_by_side_images.html.erb +118 -0
  233. data/app/views/spree/taxons/_header.html.erb +7 -2
  234. data/app/views/spree/users/_address.html.erb +16 -24
  235. data/app/views/spree/users/_address_controls.html.erb +10 -0
  236. data/app/views/spree/users/show.html.erb +21 -16
  237. data/config/initializers/admin_actions.rb +18 -0
  238. data/config/initializers/assets.rb +4 -13
  239. data/config/initializers/canonical_rails.rb +1 -1
  240. data/config/routes.rb +30 -26
  241. data/lib/generators/spree/frontend/copy_storefront/copy_storefront_generator.rb +1 -7
  242. data/lib/generators/spree/frontend/install/install_generator.rb +34 -0
  243. data/lib/generators/spree/frontend/install/templates/app/assets/config/manifest.js +2 -0
  244. data/lib/generators/spree/frontend/install/templates/vendor/assets/javascripts/spree/frontend/all.js +8 -0
  245. data/lib/generators/spree/frontend/install/templates/vendor/assets/stylesheets/spree/frontend/all.css +9 -0
  246. data/lib/spree/frontend/configuration.rb +18 -0
  247. data/lib/spree/frontend/engine.rb +3 -1
  248. data/lib/spree/frontend/version.rb +9 -0
  249. data/lib/spree/frontend.rb +8 -4
  250. data/license.md +13 -0
  251. data/spec/fixtures/files/store_favicon.ico +0 -0
  252. data/spree_frontend.gemspec +26 -14
  253. data/vendor/assets/javascripts/cleave.js +8 -0
  254. data/vendor/assets/javascripts/fetch.umd.js +531 -0
  255. data/vendor/assets/javascripts/jquery.payment.js +652 -0
  256. data/vendor/assets/javascripts/jsuri.js +458 -0
  257. data/vendor/assets/javascripts/polyfill.min.js +1 -0
  258. metadata +224 -86
  259. data/app/assets/images/homepage/big_category_banner.jpg +0 -0
  260. data/app/assets/images/homepage/big_category_banner_mobile.jpg +0 -0
  261. data/app/assets/images/homepage/big_category_banner_tablet_landscape.jpg +0 -0
  262. data/app/assets/images/homepage/big_category_banner_tablet_portrait.jpg +0 -0
  263. data/app/assets/images/homepage/category_banner_lower.jpg +0 -0
  264. data/app/assets/images/homepage/category_banner_lower_mobile.jpg +0 -0
  265. data/app/assets/images/homepage/category_banner_lower_tablet_landscape.jpg +0 -0
  266. data/app/assets/images/homepage/category_banner_lower_tablet_portrait.jpg +0 -0
  267. data/app/assets/images/homepage/category_banner_upper.jpg +0 -0
  268. data/app/assets/images/homepage/category_banner_upper_mobile.jpg +0 -0
  269. data/app/assets/images/homepage/category_banner_upper_tablet_landscape.jpg +0 -0
  270. data/app/assets/images/homepage/category_banner_upper_tablet_portrait.jpg +0 -0
  271. data/app/assets/images/homepage/main_banner.jpg +0 -0
  272. data/app/assets/images/homepage/main_banner_mobile.jpg +0 -0
  273. data/app/assets/images/homepage/main_banner_tablet_landscape.jpg +0 -0
  274. data/app/assets/images/homepage/main_banner_tablet_portrait.jpg +0 -0
  275. data/app/assets/images/homepage/promo_banner_left.jpg +0 -0
  276. data/app/assets/images/homepage/promo_banner_left_mobile.jpg +0 -0
  277. data/app/assets/images/homepage/promo_banner_left_tablet_landscape.jpg +0 -0
  278. data/app/assets/images/homepage/promo_banner_left_tablet_portrait.jpg +0 -0
  279. data/app/assets/images/homepage/promo_banner_right.jpg +0 -0
  280. data/app/assets/images/homepage/promo_banner_right_mobile.jpg +0 -0
  281. data/app/assets/images/homepage/promo_banner_right_tablet_landscape.jpg +0 -0
  282. data/app/assets/images/homepage/promo_banner_right_tablet_portrait.jpg +0 -0
  283. data/app/assets/images/meganav/promo_banner_left-first-category.jpg +0 -0
  284. data/app/assets/images/meganav/promo_banner_left-second-category.jpg +0 -0
  285. data/app/assets/images/meganav/promo_banner_left-third-category.jpg +0 -0
  286. data/app/assets/images/meganav/promo_banner_right-first-category.jpg +0 -0
  287. data/app/assets/images/meganav/promo_banner_right-second-category.jpg +0 -0
  288. data/app/assets/images/meganav/promo_banner_right-third-category.jpg +0 -0
  289. data/app/assets/images/noimage/big_category_banner.jpg +0 -0
  290. data/app/assets/images/noimage/big_category_banner_mobile.jpg +0 -0
  291. data/app/assets/images/noimage/big_category_banner_tablet_landscape.jpg +0 -0
  292. data/app/assets/images/noimage/big_category_banner_tablet_portrait.jpg +0 -0
  293. data/app/assets/images/noimage/category_banner.jpg +0 -0
  294. data/app/assets/images/noimage/category_banner_mobile.jpg +0 -0
  295. data/app/assets/images/noimage/category_banner_plp.jpg +0 -0
  296. data/app/assets/images/noimage/category_banner_tablet_landscape.jpg +0 -0
  297. data/app/assets/images/noimage/category_banner_tablet_portrait.jpg +0 -0
  298. data/app/assets/images/noimage/main_banner.jpg +0 -0
  299. data/app/assets/images/noimage/main_banner_mobile.jpg +0 -0
  300. data/app/assets/images/noimage/main_banner_tablet_landscape.jpg +0 -0
  301. data/app/assets/images/noimage/main_banner_tablet_portrait.jpg +0 -0
  302. data/app/assets/images/noimage/product_photo.jpg +0 -0
  303. data/app/assets/images/noimage/promo_banner.jpg +0 -0
  304. data/app/assets/images/noimage/promo_banner_megamenu.jpg +0 -0
  305. data/app/assets/images/noimage/promo_banner_mobile.jpg +0 -0
  306. data/app/assets/images/noimage/promo_banner_tablet_landscape.jpg +0 -0
  307. data/app/assets/images/noimage/promo_banner_tablet_portrait.jpg +0 -0
  308. data/app/assets/images/spark-logo@3x.png +0 -0
  309. data/app/assets/stylesheets/spree/frontend/_glyphicons_urls_fix.scss +0 -10
  310. data/app/assets/stylesheets/spree/frontend/address_book.scss +0 -8
  311. data/app/models/spree/frontend_configuration.rb +0 -7
  312. data/app/views/spree/shared/_taxonomies.html.erb +0 -16
  313. /data/app/views/spree/{shared → errors}/forbidden.html.erb +0 -0
  314. /data/app/views/spree/{shared → errors}/unauthorized.html.erb +0 -0
@@ -0,0 +1,531 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (factory((global.WHATWGFetch = {})));
5
+ }(this, (function (exports) { 'use strict';
6
+
7
+ var support = {
8
+ searchParams: 'URLSearchParams' in self,
9
+ iterable: 'Symbol' in self && 'iterator' in Symbol,
10
+ blob:
11
+ 'FileReader' in self &&
12
+ 'Blob' in self &&
13
+ (function() {
14
+ try {
15
+ new Blob();
16
+ return true
17
+ } catch (e) {
18
+ return false
19
+ }
20
+ })(),
21
+ formData: 'FormData' in self,
22
+ arrayBuffer: 'ArrayBuffer' in self
23
+ };
24
+
25
+ function isDataView(obj) {
26
+ return obj && DataView.prototype.isPrototypeOf(obj)
27
+ }
28
+
29
+ if (support.arrayBuffer) {
30
+ var viewClasses = [
31
+ '[object Int8Array]',
32
+ '[object Uint8Array]',
33
+ '[object Uint8ClampedArray]',
34
+ '[object Int16Array]',
35
+ '[object Uint16Array]',
36
+ '[object Int32Array]',
37
+ '[object Uint32Array]',
38
+ '[object Float32Array]',
39
+ '[object Float64Array]'
40
+ ];
41
+
42
+ var isArrayBufferView =
43
+ ArrayBuffer.isView ||
44
+ function(obj) {
45
+ return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
46
+ };
47
+ }
48
+
49
+ function normalizeName(name) {
50
+ if (typeof name !== 'string') {
51
+ name = String(name);
52
+ }
53
+ if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
54
+ throw new TypeError('Invalid character in header field name')
55
+ }
56
+ return name.toLowerCase()
57
+ }
58
+
59
+ function normalizeValue(value) {
60
+ if (typeof value !== 'string') {
61
+ value = String(value);
62
+ }
63
+ return value
64
+ }
65
+
66
+ // Build a destructive iterator for the value list
67
+ function iteratorFor(items) {
68
+ var iterator = {
69
+ next: function() {
70
+ var value = items.shift();
71
+ return {done: value === undefined, value: value}
72
+ }
73
+ };
74
+
75
+ if (support.iterable) {
76
+ iterator[Symbol.iterator] = function() {
77
+ return iterator
78
+ };
79
+ }
80
+
81
+ return iterator
82
+ }
83
+
84
+ function Headers(headers) {
85
+ this.map = {};
86
+
87
+ if (headers instanceof Headers) {
88
+ headers.forEach(function(value, name) {
89
+ this.append(name, value);
90
+ }, this);
91
+ } else if (Array.isArray(headers)) {
92
+ headers.forEach(function(header) {
93
+ this.append(header[0], header[1]);
94
+ }, this);
95
+ } else if (headers) {
96
+ Object.getOwnPropertyNames(headers).forEach(function(name) {
97
+ this.append(name, headers[name]);
98
+ }, this);
99
+ }
100
+ }
101
+
102
+ Headers.prototype.append = function(name, value) {
103
+ name = normalizeName(name);
104
+ value = normalizeValue(value);
105
+ var oldValue = this.map[name];
106
+ this.map[name] = oldValue ? oldValue + ', ' + value : value;
107
+ };
108
+
109
+ Headers.prototype['delete'] = function(name) {
110
+ delete this.map[normalizeName(name)];
111
+ };
112
+
113
+ Headers.prototype.get = function(name) {
114
+ name = normalizeName(name);
115
+ return this.has(name) ? this.map[name] : null
116
+ };
117
+
118
+ Headers.prototype.has = function(name) {
119
+ return this.map.hasOwnProperty(normalizeName(name))
120
+ };
121
+
122
+ Headers.prototype.set = function(name, value) {
123
+ this.map[normalizeName(name)] = normalizeValue(value);
124
+ };
125
+
126
+ Headers.prototype.forEach = function(callback, thisArg) {
127
+ for (var name in this.map) {
128
+ if (this.map.hasOwnProperty(name)) {
129
+ callback.call(thisArg, this.map[name], name, this);
130
+ }
131
+ }
132
+ };
133
+
134
+ Headers.prototype.keys = function() {
135
+ var items = [];
136
+ this.forEach(function(value, name) {
137
+ items.push(name);
138
+ });
139
+ return iteratorFor(items)
140
+ };
141
+
142
+ Headers.prototype.values = function() {
143
+ var items = [];
144
+ this.forEach(function(value) {
145
+ items.push(value);
146
+ });
147
+ return iteratorFor(items)
148
+ };
149
+
150
+ Headers.prototype.entries = function() {
151
+ var items = [];
152
+ this.forEach(function(value, name) {
153
+ items.push([name, value]);
154
+ });
155
+ return iteratorFor(items)
156
+ };
157
+
158
+ if (support.iterable) {
159
+ Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
160
+ }
161
+
162
+ function consumed(body) {
163
+ if (body.bodyUsed) {
164
+ return Promise.reject(new TypeError('Already read'))
165
+ }
166
+ body.bodyUsed = true;
167
+ }
168
+
169
+ function fileReaderReady(reader) {
170
+ return new Promise(function(resolve, reject) {
171
+ reader.onload = function() {
172
+ resolve(reader.result);
173
+ };
174
+ reader.onerror = function() {
175
+ reject(reader.error);
176
+ };
177
+ })
178
+ }
179
+
180
+ function readBlobAsArrayBuffer(blob) {
181
+ var reader = new FileReader();
182
+ var promise = fileReaderReady(reader);
183
+ reader.readAsArrayBuffer(blob);
184
+ return promise
185
+ }
186
+
187
+ function readBlobAsText(blob) {
188
+ var reader = new FileReader();
189
+ var promise = fileReaderReady(reader);
190
+ reader.readAsText(blob);
191
+ return promise
192
+ }
193
+
194
+ function readArrayBufferAsText(buf) {
195
+ var view = new Uint8Array(buf);
196
+ var chars = new Array(view.length);
197
+
198
+ for (var i = 0; i < view.length; i++) {
199
+ chars[i] = String.fromCharCode(view[i]);
200
+ }
201
+ return chars.join('')
202
+ }
203
+
204
+ function bufferClone(buf) {
205
+ if (buf.slice) {
206
+ return buf.slice(0)
207
+ } else {
208
+ var view = new Uint8Array(buf.byteLength);
209
+ view.set(new Uint8Array(buf));
210
+ return view.buffer
211
+ }
212
+ }
213
+
214
+ function Body() {
215
+ this.bodyUsed = false;
216
+
217
+ this._initBody = function(body) {
218
+ this._bodyInit = body;
219
+ if (!body) {
220
+ this._bodyText = '';
221
+ } else if (typeof body === 'string') {
222
+ this._bodyText = body;
223
+ } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
224
+ this._bodyBlob = body;
225
+ } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
226
+ this._bodyFormData = body;
227
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
228
+ this._bodyText = body.toString();
229
+ } else if (support.arrayBuffer && support.blob && isDataView(body)) {
230
+ this._bodyArrayBuffer = bufferClone(body.buffer);
231
+ // IE 10-11 can't handle a DataView body.
232
+ this._bodyInit = new Blob([this._bodyArrayBuffer]);
233
+ } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
234
+ this._bodyArrayBuffer = bufferClone(body);
235
+ } else {
236
+ this._bodyText = body = Object.prototype.toString.call(body);
237
+ }
238
+
239
+ if (!this.headers.get('content-type')) {
240
+ if (typeof body === 'string') {
241
+ this.headers.set('content-type', 'text/plain;charset=UTF-8');
242
+ } else if (this._bodyBlob && this._bodyBlob.type) {
243
+ this.headers.set('content-type', this._bodyBlob.type);
244
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
245
+ this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
246
+ }
247
+ }
248
+ };
249
+
250
+ if (support.blob) {
251
+ this.blob = function() {
252
+ var rejected = consumed(this);
253
+ if (rejected) {
254
+ return rejected
255
+ }
256
+
257
+ if (this._bodyBlob) {
258
+ return Promise.resolve(this._bodyBlob)
259
+ } else if (this._bodyArrayBuffer) {
260
+ return Promise.resolve(new Blob([this._bodyArrayBuffer]))
261
+ } else if (this._bodyFormData) {
262
+ throw new Error('could not read FormData body as blob')
263
+ } else {
264
+ return Promise.resolve(new Blob([this._bodyText]))
265
+ }
266
+ };
267
+
268
+ this.arrayBuffer = function() {
269
+ if (this._bodyArrayBuffer) {
270
+ return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
271
+ } else {
272
+ return this.blob().then(readBlobAsArrayBuffer)
273
+ }
274
+ };
275
+ }
276
+
277
+ this.text = function() {
278
+ var rejected = consumed(this);
279
+ if (rejected) {
280
+ return rejected
281
+ }
282
+
283
+ if (this._bodyBlob) {
284
+ return readBlobAsText(this._bodyBlob)
285
+ } else if (this._bodyArrayBuffer) {
286
+ return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
287
+ } else if (this._bodyFormData) {
288
+ throw new Error('could not read FormData body as text')
289
+ } else {
290
+ return Promise.resolve(this._bodyText)
291
+ }
292
+ };
293
+
294
+ if (support.formData) {
295
+ this.formData = function() {
296
+ return this.text().then(decode)
297
+ };
298
+ }
299
+
300
+ this.json = function() {
301
+ return this.text().then(JSON.parse)
302
+ };
303
+
304
+ return this
305
+ }
306
+
307
+ // HTTP methods whose capitalization should be normalized
308
+ var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
309
+
310
+ function normalizeMethod(method) {
311
+ var upcased = method.toUpperCase();
312
+ return methods.indexOf(upcased) > -1 ? upcased : method
313
+ }
314
+
315
+ function Request(input, options) {
316
+ options = options || {};
317
+ var body = options.body;
318
+
319
+ if (input instanceof Request) {
320
+ if (input.bodyUsed) {
321
+ throw new TypeError('Already read')
322
+ }
323
+ this.url = input.url;
324
+ this.credentials = input.credentials;
325
+ if (!options.headers) {
326
+ this.headers = new Headers(input.headers);
327
+ }
328
+ this.method = input.method;
329
+ this.mode = input.mode;
330
+ this.signal = input.signal;
331
+ if (!body && input._bodyInit != null) {
332
+ body = input._bodyInit;
333
+ input.bodyUsed = true;
334
+ }
335
+ } else {
336
+ this.url = String(input);
337
+ }
338
+
339
+ this.credentials = options.credentials || this.credentials || 'same-origin';
340
+ if (options.headers || !this.headers) {
341
+ this.headers = new Headers(options.headers);
342
+ }
343
+ this.method = normalizeMethod(options.method || this.method || 'GET');
344
+ this.mode = options.mode || this.mode || null;
345
+ this.signal = options.signal || this.signal;
346
+ this.referrer = null;
347
+
348
+ if ((this.method === 'GET' || this.method === 'HEAD') && body) {
349
+ throw new TypeError('Body not allowed for GET or HEAD requests')
350
+ }
351
+ this._initBody(body);
352
+ }
353
+
354
+ Request.prototype.clone = function() {
355
+ return new Request(this, {body: this._bodyInit})
356
+ };
357
+
358
+ function decode(body) {
359
+ var form = new FormData();
360
+ body
361
+ .trim()
362
+ .split('&')
363
+ .forEach(function(bytes) {
364
+ if (bytes) {
365
+ var split = bytes.split('=');
366
+ var name = split.shift().replace(/\+/g, ' ');
367
+ var value = split.join('=').replace(/\+/g, ' ');
368
+ form.append(decodeURIComponent(name), decodeURIComponent(value));
369
+ }
370
+ });
371
+ return form
372
+ }
373
+
374
+ function parseHeaders(rawHeaders) {
375
+ var headers = new Headers();
376
+ // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
377
+ // https://tools.ietf.org/html/rfc7230#section-3.2
378
+ var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
379
+ preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
380
+ var parts = line.split(':');
381
+ var key = parts.shift().trim();
382
+ if (key) {
383
+ var value = parts.join(':').trim();
384
+ headers.append(key, value);
385
+ }
386
+ });
387
+ return headers
388
+ }
389
+
390
+ Body.call(Request.prototype);
391
+
392
+ function Response(bodyInit, options) {
393
+ if (!options) {
394
+ options = {};
395
+ }
396
+
397
+ this.type = 'default';
398
+ this.status = options.status === undefined ? 200 : options.status;
399
+ this.ok = this.status >= 200 && this.status < 300;
400
+ this.statusText = 'statusText' in options ? options.statusText : 'OK';
401
+ this.headers = new Headers(options.headers);
402
+ this.url = options.url || '';
403
+ this._initBody(bodyInit);
404
+ }
405
+
406
+ Body.call(Response.prototype);
407
+
408
+ Response.prototype.clone = function() {
409
+ return new Response(this._bodyInit, {
410
+ status: this.status,
411
+ statusText: this.statusText,
412
+ headers: new Headers(this.headers),
413
+ url: this.url
414
+ })
415
+ };
416
+
417
+ Response.error = function() {
418
+ var response = new Response(null, {status: 0, statusText: ''});
419
+ response.type = 'error';
420
+ return response
421
+ };
422
+
423
+ var redirectStatuses = [301, 302, 303, 307, 308];
424
+
425
+ Response.redirect = function(url, status) {
426
+ if (redirectStatuses.indexOf(status) === -1) {
427
+ throw new RangeError('Invalid status code')
428
+ }
429
+
430
+ return new Response(null, {status: status, headers: {location: url}})
431
+ };
432
+
433
+ exports.DOMException = self.DOMException;
434
+ try {
435
+ new exports.DOMException();
436
+ } catch (err) {
437
+ exports.DOMException = function(message, name) {
438
+ this.message = message;
439
+ this.name = name;
440
+ var error = Error(message);
441
+ this.stack = error.stack;
442
+ };
443
+ exports.DOMException.prototype = Object.create(Error.prototype);
444
+ exports.DOMException.prototype.constructor = exports.DOMException;
445
+ }
446
+
447
+ function fetch(input, init) {
448
+ return new Promise(function(resolve, reject) {
449
+ var request = new Request(input, init);
450
+
451
+ if (request.signal && request.signal.aborted) {
452
+ return reject(new exports.DOMException('Aborted', 'AbortError'))
453
+ }
454
+
455
+ var xhr = new XMLHttpRequest();
456
+
457
+ function abortXhr() {
458
+ xhr.abort();
459
+ }
460
+
461
+ xhr.onload = function() {
462
+ var options = {
463
+ status: xhr.status,
464
+ statusText: xhr.statusText,
465
+ headers: parseHeaders(xhr.getAllResponseHeaders() || '')
466
+ };
467
+ options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
468
+ var body = 'response' in xhr ? xhr.response : xhr.responseText;
469
+ resolve(new Response(body, options));
470
+ };
471
+
472
+ xhr.onerror = function() {
473
+ reject(new TypeError('Network request failed'));
474
+ };
475
+
476
+ xhr.ontimeout = function() {
477
+ reject(new TypeError('Network request failed'));
478
+ };
479
+
480
+ xhr.onabort = function() {
481
+ reject(new exports.DOMException('Aborted', 'AbortError'));
482
+ };
483
+
484
+ xhr.open(request.method, request.url, true);
485
+
486
+ if (request.credentials === 'include') {
487
+ xhr.withCredentials = true;
488
+ } else if (request.credentials === 'omit') {
489
+ xhr.withCredentials = false;
490
+ }
491
+
492
+ if ('responseType' in xhr && support.blob) {
493
+ xhr.responseType = 'blob';
494
+ }
495
+
496
+ request.headers.forEach(function(value, name) {
497
+ xhr.setRequestHeader(name, value);
498
+ });
499
+
500
+ if (request.signal) {
501
+ request.signal.addEventListener('abort', abortXhr);
502
+
503
+ xhr.onreadystatechange = function() {
504
+ // DONE (success or failure)
505
+ if (xhr.readyState === 4) {
506
+ request.signal.removeEventListener('abort', abortXhr);
507
+ }
508
+ };
509
+ }
510
+
511
+ xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
512
+ })
513
+ }
514
+
515
+ fetch.polyfill = true;
516
+
517
+ if (!self.fetch) {
518
+ self.fetch = fetch;
519
+ self.Headers = Headers;
520
+ self.Request = Request;
521
+ self.Response = Response;
522
+ }
523
+
524
+ exports.Headers = Headers;
525
+ exports.Request = Request;
526
+ exports.Response = Response;
527
+ exports.fetch = fetch;
528
+
529
+ Object.defineProperty(exports, '__esModule', { value: true });
530
+
531
+ })));