workarea-one_theme 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +20 -0
  3. data/.eslintignore +1 -0
  4. data/.eslintrc +25 -0
  5. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  6. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  7. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  8. data/.github/workflows/ci.yml +60 -0
  9. data/.gitignore +21 -0
  10. data/.rubocop.yml +3 -0
  11. data/.stylelintrc.json +8 -0
  12. data/CHANGELOG.md +267 -0
  13. data/CODE_OF_CONDUCT.md +3 -0
  14. data/CONTRIBUTING.md +3 -0
  15. data/Gemfile +20 -0
  16. data/LICENSE.md +3 -0
  17. data/README.md +173 -0
  18. data/Rakefile +63 -0
  19. data/app/assets/fonts/workarea/storefront/Hind/hind_bold_webfont.woff +0 -0
  20. data/app/assets/fonts/workarea/storefront/Hind/hind_bold_webfont.woff2 +0 -0
  21. data/app/assets/fonts/workarea/storefront/Hind/hind_regular_webfont.woff +0 -0
  22. data/app/assets/fonts/workarea/storefront/Hind/hind_regular_webfont.woff2 +0 -0
  23. data/app/assets/fonts/workarea/storefront/Muli/muli_bold_webfont.woff +0 -0
  24. data/app/assets/fonts/workarea/storefront/Muli/muli_bold_webfont.woff2 +0 -0
  25. data/app/assets/fonts/workarea/storefront/Muli/muli_bolditalic_webfont.woff +0 -0
  26. data/app/assets/fonts/workarea/storefront/Muli/muli_bolditalic_webfont.woff2 +0 -0
  27. data/app/assets/fonts/workarea/storefront/Muli/muli_italic_webfont.woff +0 -0
  28. data/app/assets/fonts/workarea/storefront/Muli/muli_italic_webfont.woff2 +0 -0
  29. data/app/assets/fonts/workarea/storefront/Muli/muli_regular_webfont.woff +0 -0
  30. data/app/assets/fonts/workarea/storefront/Muli/muli_regular_webfont.woff2 +0 -0
  31. data/app/assets/fonts/workarea/storefront/Playfair_Display/playfairdisplay_bold_webfont.woff +0 -0
  32. data/app/assets/fonts/workarea/storefront/Playfair_Display/playfairdisplay_bold_webfont.woff2 +0 -0
  33. data/app/assets/fonts/workarea/storefront/Playfair_Display/playfairdisplay_bolditalic_webfont.woff +0 -0
  34. data/app/assets/fonts/workarea/storefront/Playfair_Display/playfairdisplay_bolditalic_webfont.woff2 +0 -0
  35. data/app/assets/fonts/workarea/storefront/Playfair_Display/playfairdisplay_italic_webfont.woff +0 -0
  36. data/app/assets/fonts/workarea/storefront/Playfair_Display/playfairdisplay_italic_webfont.woff2 +0 -0
  37. data/app/assets/fonts/workarea/storefront/Playfair_Display/playfairdisplay_regular_webfont.woff +0 -0
  38. data/app/assets/fonts/workarea/storefront/Playfair_Display/playfairdisplay_regular_webfont.woff2 +0 -0
  39. data/app/assets/fonts/workarea/storefront/Source_Serif_Pro/source_serif_pro_bold_webfont.woff +0 -0
  40. data/app/assets/fonts/workarea/storefront/Source_Serif_Pro/source_serif_pro_bold_webfont.woff2 +0 -0
  41. data/app/assets/fonts/workarea/storefront/Source_Serif_Pro/source_serif_pro_regular_webfont.woff +0 -0
  42. data/app/assets/fonts/workarea/storefront/Source_Serif_Pro/source_serif_pro_regular_webfont.woff2 +0 -0
  43. data/app/assets/fonts/workarea/storefront/lora/lora_bold_webfont.woff +0 -0
  44. data/app/assets/fonts/workarea/storefront/lora/lora_bold_webfont.woff2 +0 -0
  45. data/app/assets/fonts/workarea/storefront/lora/lora_bolditalic_webfont.woff +0 -0
  46. data/app/assets/fonts/workarea/storefront/lora/lora_bolditalic_webfont.woff2 +0 -0
  47. data/app/assets/fonts/workarea/storefront/lora/lora_italic_webfont.woff +0 -0
  48. data/app/assets/fonts/workarea/storefront/lora/lora_italic_webfont.woff2 +0 -0
  49. data/app/assets/fonts/workarea/storefront/lora/lora_regular_webfont.woff +0 -0
  50. data/app/assets/fonts/workarea/storefront/lora/lora_regular_webfont.woff2 +0 -0
  51. data/app/assets/fonts/workarea/storefront/roboto/roboto_bold_webfont.woff +0 -0
  52. data/app/assets/fonts/workarea/storefront/roboto/roboto_bold_webfont.woff2 +0 -0
  53. data/app/assets/fonts/workarea/storefront/roboto/roboto_italic_webfont.woff +0 -0
  54. data/app/assets/fonts/workarea/storefront/roboto/roboto_italic_webfont.woff2 +0 -0
  55. data/app/assets/fonts/workarea/storefront/roboto/roboto_regular_webfont.woff +0 -0
  56. data/app/assets/fonts/workarea/storefront/roboto/roboto_regular_webfont.woff2 +0 -0
  57. data/app/assets/images/workarea/admin/content_block_types/hero_slider.svg +1 -0
  58. data/app/assets/images/workarea/admin/content_block_types/taxonomy_with_category_summary.svg +1 -0
  59. data/app/assets/images/workarea/admin/content_block_types/taxonomy_with_products.svg +1 -0
  60. data/app/assets/images/workarea/storefront/dialog_close.svg +1 -0
  61. data/app/assets/images/workarea/storefront/icons/account.svg +1 -0
  62. data/app/assets/images/workarea/storefront/icons/arrow_left.svg +1 -0
  63. data/app/assets/images/workarea/storefront/icons/arrow_right.svg +1 -0
  64. data/app/assets/images/workarea/storefront/icons/cart.svg +1 -0
  65. data/app/assets/images/workarea/storefront/icons/chevron_down.svg +1 -0
  66. data/app/assets/images/workarea/storefront/icons/chevron_right.svg +1 -0
  67. data/app/assets/images/workarea/storefront/icons/search.svg +1 -0
  68. data/app/assets/images/workarea/storefront/logo.png +0 -0
  69. data/app/assets/javascripts/workarea/storefront/application.js.erb +147 -0
  70. data/app/assets/javascripts/workarea/storefront/clothing/modules/product_details_color_buttons.js +86 -0
  71. data/app/assets/javascripts/workarea/storefront/dependencies/jquery.payment.js +655 -0
  72. data/app/assets/javascripts/workarea/storefront/modules/address_region_fields.js +93 -0
  73. data/app/assets/javascripts/workarea/storefront/modules/cart_indicator.js +35 -0
  74. data/app/assets/javascripts/workarea/storefront/modules/checkout_primary_payments.js +136 -0
  75. data/app/assets/javascripts/workarea/storefront/modules/header_search_ui.js +64 -0
  76. data/app/assets/javascripts/workarea/storefront/modules/mobile_filters.js +79 -0
  77. data/app/assets/javascripts/workarea/storefront/modules/mobile_nav_button.js +137 -0
  78. data/app/assets/javascripts/workarea/storefront/modules/quantity_control.js +56 -0
  79. data/app/assets/javascripts/workarea/storefront/modules/utility_nav_dropdown.js +43 -0
  80. data/app/assets/javascripts/workarea/storefront/one_theme/config.js +20 -0
  81. data/app/assets/javascripts/workarea/storefront/product_quickview/templates/quickview_button.jst.ejs +3 -0
  82. data/app/assets/javascripts/workarea/storefront/reviews/modules/product_reviews_sort_menus.js +82 -0
  83. data/app/assets/javascripts/workarea/storefront/reviews/templates/sort_by_property.jst.ejs +19 -0
  84. data/app/assets/javascripts/workarea/storefront/templates/log_out_link.jst.ejs +1 -0
  85. data/app/assets/javascripts/workarea/storefront/templates/saved_addresses_property.jst.ejs +23 -0
  86. data/app/assets/stylesheets/jquery_ui/storefront/_ui_autocomplete.scss +17 -0
  87. data/app/assets/stylesheets/jquery_ui/storefront/_ui_dialog.scss +150 -0
  88. data/app/assets/stylesheets/jquery_ui/storefront/_ui_menu.scss +42 -0
  89. data/app/assets/stylesheets/one_theme/.keep +0 -0
  90. data/app/assets/stylesheets/workarea/storefront/base/_forms.scss +197 -0
  91. data/app/assets/stylesheets/workarea/storefront/base/_tables.scss +32 -0
  92. data/app/assets/stylesheets/workarea/storefront/blog/components/_blog_entry.scss +139 -0
  93. data/app/assets/stylesheets/workarea/storefront/blog/components/_blog_entry_summary.scss +90 -0
  94. data/app/assets/stylesheets/workarea/storefront/clothing/components/_color_options.scss +57 -0
  95. data/app/assets/stylesheets/workarea/storefront/clothing/components/_size_options.scss +123 -0
  96. data/app/assets/stylesheets/workarea/storefront/components/_account_dashboard.scss +33 -0
  97. data/app/assets/stylesheets/workarea/storefront/components/_box.scss +45 -0
  98. data/app/assets/stylesheets/workarea/storefront/components/_breadcrumbs.scss +27 -0
  99. data/app/assets/stylesheets/workarea/storefront/components/_button.scss +72 -0
  100. data/app/assets/stylesheets/workarea/storefront/components/_button_property.scss +41 -0
  101. data/app/assets/stylesheets/workarea/storefront/components/_cart.scss +26 -0
  102. data/app/assets/stylesheets/workarea/storefront/components/_category_summary_content_block.scss +78 -0
  103. data/app/assets/stylesheets/workarea/storefront/components/_checkout_addresses.scss +21 -0
  104. data/app/assets/stylesheets/workarea/storefront/components/_checkout_payment.scss +58 -0
  105. data/app/assets/stylesheets/workarea/storefront/components/_checkout_progress.scss +47 -0
  106. data/app/assets/stylesheets/workarea/storefront/components/_checkout_shipping.scss +15 -0
  107. data/app/assets/stylesheets/workarea/storefront/components/_checkout_step_summary.scss +47 -0
  108. data/app/assets/stylesheets/workarea/storefront/components/_color_box.scss +48 -0
  109. data/app/assets/stylesheets/workarea/storefront/components/_data_card.scss +70 -0
  110. data/app/assets/stylesheets/workarea/storefront/components/_hamburger.scss +107 -0
  111. data/app/assets/stylesheets/workarea/storefront/components/_header.scss +31 -0
  112. data/app/assets/stylesheets/workarea/storefront/components/_hero_slider_content_block.scss +75 -0
  113. data/app/assets/stylesheets/workarea/storefront/components/_loading.scss +92 -0
  114. data/app/assets/stylesheets/workarea/storefront/components/_mobile_filters.scss +42 -0
  115. data/app/assets/stylesheets/workarea/storefront/components/_mobile_nav.scss +146 -0
  116. data/app/assets/stylesheets/workarea/storefront/components/_option_button.scss +45 -0
  117. data/app/assets/stylesheets/workarea/storefront/components/_order_help_menu.scss +33 -0
  118. data/app/assets/stylesheets/workarea/storefront/components/_order_summary.scss +19 -0
  119. data/app/assets/stylesheets/workarea/storefront/components/_page_container.scss +31 -0
  120. data/app/assets/stylesheets/workarea/storefront/components/_page_content.scss +30 -0
  121. data/app/assets/stylesheets/workarea/storefront/components/_page_footer.scss +96 -0
  122. data/app/assets/stylesheets/workarea/storefront/components/_page_header.scss +188 -0
  123. data/app/assets/stylesheets/workarea/storefront/components/_page_messages.scss +36 -0
  124. data/app/assets/stylesheets/workarea/storefront/components/_page_sub_footer.scss +39 -0
  125. data/app/assets/stylesheets/workarea/storefront/components/_pagination.scss +10 -0
  126. data/app/assets/stylesheets/workarea/storefront/components/_payment_icon.scss +29 -0
  127. data/app/assets/stylesheets/workarea/storefront/components/_primary_nav.scss +99 -0
  128. data/app/assets/stylesheets/workarea/storefront/components/_product_detail_container.scss +19 -0
  129. data/app/assets/stylesheets/workarea/storefront/components/_product_details.scss +94 -0
  130. data/app/assets/stylesheets/workarea/storefront/components/_product_list.scss +182 -0
  131. data/app/assets/stylesheets/workarea/storefront/components/_product_list_content_block.scss +20 -0
  132. data/app/assets/stylesheets/workarea/storefront/components/_product_media.scss +109 -0
  133. data/app/assets/stylesheets/workarea/storefront/components/_product_prices.scss +45 -0
  134. data/app/assets/stylesheets/workarea/storefront/components/_product_summary.scss +92 -0
  135. data/app/assets/stylesheets/workarea/storefront/components/_promo_code_accordion.scss +13 -0
  136. data/app/assets/stylesheets/workarea/storefront/components/_property.scss +68 -0
  137. data/app/assets/stylesheets/workarea/storefront/components/_quantity_control.scss +77 -0
  138. data/app/assets/stylesheets/workarea/storefront/components/_result_filters.scss +57 -0
  139. data/app/assets/stylesheets/workarea/storefront/components/_select_menu.scss +68 -0
  140. data/app/assets/stylesheets/workarea/storefront/components/_svg_icon.scss +78 -0
  141. data/app/assets/stylesheets/workarea/storefront/components/_taxonomy_content_block.scss +173 -0
  142. data/app/assets/stylesheets/workarea/storefront/components/_text_box.scss +57 -0
  143. data/app/assets/stylesheets/workarea/storefront/components/_text_button.scss +19 -0
  144. data/app/assets/stylesheets/workarea/storefront/components/_utility_nav.scss +49 -0
  145. data/app/assets/stylesheets/workarea/storefront/components/_value.scss +51 -0
  146. data/app/assets/stylesheets/workarea/storefront/email/_settings.scss +23 -0
  147. data/app/assets/stylesheets/workarea/storefront/generic/_fonts.scss.erb +11 -0
  148. data/app/assets/stylesheets/workarea/storefront/objects/_content_wrapper.scss +23 -0
  149. data/app/assets/stylesheets/workarea/storefront/product_quickview/components/_quickview_button.scss +33 -0
  150. data/app/assets/stylesheets/workarea/storefront/reviews/components/_reviews.scss +66 -0
  151. data/app/assets/stylesheets/workarea/storefront/reviews/components/_write_review.scss +71 -0
  152. data/app/assets/stylesheets/workarea/storefront/settings/_colors.scss.erb +21 -0
  153. data/app/assets/stylesheets/workarea/storefront/settings/_font_families.scss.erb +6 -0
  154. data/app/assets/stylesheets/workarea/storefront/settings/_global.scss +39 -0
  155. data/app/assets/stylesheets/workarea/storefront/settings/_typography.scss +8 -0
  156. data/app/assets/stylesheets/workarea/storefront/settings/_z_indexes.scss +43 -0
  157. data/app/assets/stylesheets/workarea/storefront/share/components/_share_buttons.scss +22 -0
  158. data/app/assets/stylesheets/workarea/storefront/slick_slider/components/_slick_slider.scss +171 -0
  159. data/app/assets/stylesheets/workarea/storefront/swatches/components/_swatch_facet.scss +26 -0
  160. data/app/assets/stylesheets/workarea/storefront/swatches/components/_swatch_options.scss +55 -0
  161. data/app/assets/stylesheets/workarea/storefront/theme_config/_midnight_color_scheme.scss +110 -0
  162. data/app/assets/stylesheets/workarea/storefront/theme_config/_one_color_scheme.scss +104 -0
  163. data/app/assets/stylesheets/workarea/storefront/theme_config/_workarea_color_scheme.scss +105 -0
  164. data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_hind.scss +19 -0
  165. data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_lora.scss +33 -0
  166. data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_muli.scss +33 -0
  167. data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_playfair_display.scss +33 -0
  168. data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_roboto.scss +26 -0
  169. data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_source_serif_pro.scss +19 -0
  170. data/app/assets/stylesheets/workarea/storefront/tools/_checkout_section.scss +12 -0
  171. data/app/assets/stylesheets/workarea/storefront/tools/_full_bleed_container.scss +15 -0
  172. data/app/assets/stylesheets/workarea/storefront/typography/_headings.scss +81 -0
  173. data/app/assets/stylesheets/workarea/storefront/typography/_links.scss +27 -0
  174. data/app/assets/stylesheets/workarea/storefront/typography/_text.scss +30 -0
  175. data/app/helpers/workarea/storefront/one_theme_helper.rb +71 -0
  176. data/app/seeds/workarea/browse_navigation_seeds.rb +35 -0
  177. data/app/seeds/workarea/content_block_page_seeds.rb +22 -0
  178. data/app/seeds/workarea/theme_home_page_seeds.rb +58 -0
  179. data/app/seeds/workarea/theme_layout_content_seeds.rb +41 -0
  180. data/app/view_models/workarea/storefront/content_blocks/category_summary_view_model.decorator +21 -0
  181. data/app/view_models/workarea/storefront/content_blocks/hero_slider_block_view_model.rb +44 -0
  182. data/app/view_models/workarea/storefront/content_blocks/product_list_view_model.decorator +50 -0
  183. data/app/view_models/workarea/storefront/content_blocks/taxonomy_with_category_view_model.rb +49 -0
  184. data/app/view_models/workarea/storefront/content_blocks/taxonomy_with_products_view_model.rb +21 -0
  185. data/app/view_models/workarea/storefront/product_view_model.decorator +11 -0
  186. data/app/views/layouts/workarea/storefront/_wish_lists_link.html.haml +4 -0
  187. data/app/views/layouts/workarea/storefront/application.html.haml +211 -0
  188. data/app/views/layouts/workarea/storefront/checkout.html.haml +97 -0
  189. data/app/views/workarea/storefront/blog_comments/index.html.haml +31 -0
  190. data/app/views/workarea/storefront/blog_entries/_summary.html.haml +26 -0
  191. data/app/views/workarea/storefront/blog_entries/show.html.haml +85 -0
  192. data/app/views/workarea/storefront/blogs/_blog_navigation.html.haml +7 -0
  193. data/app/views/workarea/storefront/blogs/index.html.haml +47 -0
  194. data/app/views/workarea/storefront/cart_items/create.html.haml +66 -0
  195. data/app/views/workarea/storefront/carts/show.html.haml +175 -0
  196. data/app/views/workarea/storefront/categories/show.html.haml +105 -0
  197. data/app/views/workarea/storefront/checkouts/_gift_card_payment.html.haml +38 -0
  198. data/app/views/workarea/storefront/checkouts/_summary.html.haml +102 -0
  199. data/app/views/workarea/storefront/checkouts/addresses.html.haml +56 -0
  200. data/app/views/workarea/storefront/checkouts/confirmation.html.haml +58 -0
  201. data/app/views/workarea/storefront/checkouts/payment.html.haml +186 -0
  202. data/app/views/workarea/storefront/checkouts/shipping.html.haml +38 -0
  203. data/app/views/workarea/storefront/content_blocks/_blog_entry.html.haml +19 -0
  204. data/app/views/workarea/storefront/content_blocks/_category_summary.html.haml +20 -0
  205. data/app/views/workarea/storefront/content_blocks/_hero_slider.html.haml +15 -0
  206. data/app/views/workarea/storefront/content_blocks/_product_list.html.haml +11 -0
  207. data/app/views/workarea/storefront/content_blocks/_social_networks.html.haml +17 -0
  208. data/app/views/workarea/storefront/content_blocks/_taxonomy_with_category_summary.html.haml +26 -0
  209. data/app/views/workarea/storefront/content_blocks/_taxonomy_with_products.html.haml +26 -0
  210. data/app/views/workarea/storefront/menus/index.html.haml +17 -0
  211. data/app/views/workarea/storefront/orders/_summary.html.haml +286 -0
  212. data/app/views/workarea/storefront/products/_media.html.haml +22 -0
  213. data/app/views/workarea/storefront/products/_media_carousel.html.haml +25 -0
  214. data/app/views/workarea/storefront/products/_pricing.html.haml +40 -0
  215. data/app/views/workarea/storefront/products/_reviews.html.haml +27 -0
  216. data/app/views/workarea/storefront/products/_subscription_fields.html.haml +15 -0
  217. data/app/views/workarea/storefront/products/_summary.html.haml +16 -0
  218. data/app/views/workarea/storefront/products/_swatch_summary.html.haml +17 -0
  219. data/app/views/workarea/storefront/products/package_show.html.haml +46 -0
  220. data/app/views/workarea/storefront/products/show.html.haml +53 -0
  221. data/app/views/workarea/storefront/products/templates/_generic.html.haml +61 -0
  222. data/app/views/workarea/storefront/products/templates/_gift_card.html.haml +68 -0
  223. data/app/views/workarea/storefront/products/templates/_option_selects.html.haml +61 -0
  224. data/app/views/workarea/storefront/products/templates/_option_thumbnails.html.haml +67 -0
  225. data/app/views/workarea/storefront/products/templates/_swatches.html.haml +78 -0
  226. data/app/views/workarea/storefront/reviews/new.html.haml +72 -0
  227. data/app/views/workarea/storefront/searches/content.html.haml +78 -0
  228. data/app/views/workarea/storefront/searches/show.html.haml +97 -0
  229. data/app/views/workarea/storefront/shared/_address_fields.html.haml +109 -0
  230. data/app/views/workarea/storefront/shares/_share_buttons.html.haml +17 -0
  231. data/app/views/workarea/storefront/style_guides/base/_forms.html.haml +91 -0
  232. data/app/views/workarea/storefront/style_guides/components/_breadcrumbs.html.haml +13 -0
  233. data/app/views/workarea/storefront/style_guides/components/_button.html.haml +69 -0
  234. data/app/views/workarea/storefront/style_guides/components/_category_summary_content_block.html.haml +54 -0
  235. data/app/views/workarea/storefront/style_guides/components/_header.html.haml +18 -0
  236. data/app/views/workarea/storefront/style_guides/components/_hero_slider_content_block.html.haml +46 -0
  237. data/app/views/workarea/storefront/style_guides/components/_mobile_filters.html.haml +17 -0
  238. data/app/views/workarea/storefront/style_guides/components/_product_list_content_block.html.haml +46 -0
  239. data/app/views/workarea/storefront/style_guides/components/_product_summary.html.haml +47 -0
  240. data/app/views/workarea/storefront/style_guides/components/_svg_icon.html.haml +63 -0
  241. data/app/views/workarea/storefront/style_guides/components/_taxonomy_with_category_summary_content_block.html.haml +33 -0
  242. data/app/views/workarea/storefront/style_guides/components/_taxonomy_with_products_content_block.html.haml +33 -0
  243. data/app/views/workarea/storefront/style_guides/components/_text_box.html.haml +63 -0
  244. data/app/views/workarea/storefront/style_guides/settings/_color_variables.html.haml +79 -0
  245. data/app/views/workarea/storefront/style_guides/settings/color_schemes/_midnight_color_scheme.html.haml +7 -0
  246. data/app/views/workarea/storefront/style_guides/settings/color_schemes/_one_color_scheme.html.haml +7 -0
  247. data/app/views/workarea/storefront/style_guides/settings/color_schemes/_workarea_color_scheme.html.haml +8 -0
  248. data/app/views/workarea/storefront/style_guides/typography/_headings.html.haml +47 -0
  249. data/app/views/workarea/storefront/style_guides/typography/_links.html.haml +27 -0
  250. data/app/views/workarea/storefront/users/accounts/_wish_list_summary.html.haml +16 -0
  251. data/app/views/workarea/storefront/users/accounts/edit.html.haml +41 -0
  252. data/app/views/workarea/storefront/users/accounts/show.html.haml +118 -0
  253. data/app/views/workarea/storefront/users/credit_cards/edit.html.haml +74 -0
  254. data/app/views/workarea/storefront/users/credit_cards/new.html.haml +66 -0
  255. data/app/views/workarea/storefront/users/orders/index.html.haml +22 -0
  256. data/app/views/workarea/storefront/users/orders/show.html.haml +31 -0
  257. data/app/views/workarea/storefront/users/wish_lists/show.html.haml +136 -0
  258. data/app/views/workarea/storefront/wish_lists/show.html.haml +99 -0
  259. data/bin/rails +20 -0
  260. data/config/initializers/appends.rb +62 -0
  261. data/config/initializers/configuration.rb +9 -0
  262. data/config/initializers/content_block_types.rb +91 -0
  263. data/config/initializers/dragonfly.rb +50 -0
  264. data/config/initializers/seeds.rb +5 -0
  265. data/config/initializers/theme.rb +16 -0
  266. data/config/initializers/workarea.rb +3 -0
  267. data/config/locales/en.yml +26 -0
  268. data/config/routes.rb +2 -0
  269. data/lib/tasks/one_theme_tasks.rake +4 -0
  270. data/lib/workarea/one_theme.rb +24 -0
  271. data/lib/workarea/one_theme/engine.rb +13 -0
  272. data/lib/workarea/one_theme/version.rb +5 -0
  273. data/package.json +9 -0
  274. data/test/dummy/Rakefile +6 -0
  275. data/test/dummy/app/assets/config/manifest.js +4 -0
  276. data/test/dummy/app/assets/images/.keep +0 -0
  277. data/test/dummy/app/assets/javascripts/application.js +13 -0
  278. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  279. data/test/dummy/app/controllers/application_controller.rb +3 -0
  280. data/test/dummy/app/controllers/concerns/.keep +0 -0
  281. data/test/dummy/app/helpers/application_helper.rb +2 -0
  282. data/test/dummy/app/jobs/application_job.rb +2 -0
  283. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  284. data/test/dummy/app/models/concerns/.keep +0 -0
  285. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  286. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  287. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  288. data/test/dummy/bin/bundle +3 -0
  289. data/test/dummy/bin/rails +4 -0
  290. data/test/dummy/bin/rake +4 -0
  291. data/test/dummy/bin/setup +38 -0
  292. data/test/dummy/bin/update +29 -0
  293. data/test/dummy/bin/yarn +11 -0
  294. data/test/dummy/config.ru +5 -0
  295. data/test/dummy/config/application.rb +29 -0
  296. data/test/dummy/config/boot.rb +5 -0
  297. data/test/dummy/config/cable.yml +10 -0
  298. data/test/dummy/config/environment.rb +5 -0
  299. data/test/dummy/config/environments/development.rb +54 -0
  300. data/test/dummy/config/environments/production.rb +91 -0
  301. data/test/dummy/config/environments/test.rb +44 -0
  302. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  303. data/test/dummy/config/initializers/assets.rb +14 -0
  304. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  305. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  306. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  307. data/test/dummy/config/initializers/inflections.rb +16 -0
  308. data/test/dummy/config/initializers/mime_types.rb +4 -0
  309. data/test/dummy/config/initializers/workarea.rb +5 -0
  310. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  311. data/test/dummy/config/locales/en.yml +33 -0
  312. data/test/dummy/config/puma.rb +56 -0
  313. data/test/dummy/config/routes.rb +5 -0
  314. data/test/dummy/config/secrets.yml +32 -0
  315. data/test/dummy/config/spring.rb +6 -0
  316. data/test/dummy/db/seeds.rb +2 -0
  317. data/test/dummy/lib/assets/.keep +0 -0
  318. data/test/dummy/log/.keep +0 -0
  319. data/test/dummy/package.json +5 -0
  320. data/test/helpers/workarea/storefront/reviews_helper_test.decorator +11 -0
  321. data/test/integration/workarea/blog/wordpress_import_integration_test.decorator +27 -0
  322. data/test/integration/workarea/storefront/sharing_integration_test.decorator +40 -0
  323. data/test/integration/workarea/storefront/swatches_integration_test.decorator +28 -0
  324. data/test/system/workarea/admin/guest_browsing_system_test.decorator +40 -0
  325. data/test/system/workarea/storefront/analytics_system_test.decorator +51 -0
  326. data/test/system/workarea/storefront/browse_swatches_system_test.decorator +48 -0
  327. data/test/system/workarea/storefront/cart_items_system_test.decorator +98 -0
  328. data/test/system/workarea/storefront/categories_system_test.decorator +100 -0
  329. data/test/system/workarea/storefront/content_search_autocomplete_system_test.decorator +33 -0
  330. data/test/system/workarea/storefront/content_search_system_test.decorator +21 -0
  331. data/test/system/workarea/storefront/content_system_test.decorator +21 -0
  332. data/test/system/workarea/storefront/guest_checkout_system_test.decorator +37 -0
  333. data/test/system/workarea/storefront/logged_in_checkout_system_test.decorator +34 -0
  334. data/test/system/workarea/storefront/login_system_test.decorator +94 -0
  335. data/test/system/workarea/storefront/navigation_system_test.decorator +28 -0
  336. data/test/system/workarea/storefront/passwords_system_test.decorator +59 -0
  337. data/test/system/workarea/storefront/review_system_test.decorator +23 -0
  338. data/test/system/workarea/storefront/search_autocomplete_system_test.decorator +46 -0
  339. data/test/system/workarea/storefront/search_system_test.decorator +71 -0
  340. data/test/teaspoon_env.rb +6 -0
  341. data/test/test_helper.rb +10 -0
  342. data/test/view_models/workarea/storefront/taxonomy_with_category_view_model_test.rb +35 -0
  343. data/test/view_models/workarea/storefront/taxonomy_with_products_view_model_test.rb +28 -0
  344. data/workarea-one_theme.gemspec +33 -0
  345. data/yarn.lock +3290 -0
  346. metadata +582 -0
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @namespace WORKAREA.productDetailsColorButtons
3
+ */
4
+ WORKAREA.registerModule('productDetailsColorButtons', (function () {
5
+ 'use strict';
6
+
7
+ var selectSizeButton = function ($selectedButton, $newProductDetails) {
8
+ var $newSelectedButton,
9
+ selectedSize;
10
+
11
+ if (_.isEmpty($selectedButton)) { return; }
12
+
13
+ selectedSize = $selectedButton.data('productDetailsSizeButton').size;
14
+
15
+ $newSelectedButton = $(
16
+ '[data-product-details-size-button]', $newProductDetails
17
+ ).filter(function (index, button) {
18
+ return $(button).data('productDetailsSizeButton').size === selectedSize;
19
+ });
20
+
21
+ $newSelectedButton
22
+ .prop('checked', true)
23
+ .trigger('change');
24
+ },
25
+
26
+ replaceProductDetails = function ($productDetails, newView) {
27
+ var $selectedButton = $('[name=sku]:checked', $productDetails),
28
+ $newProductDetails = $(newView)
29
+ .find('.product-details')
30
+ .addBack('.product-details');
31
+
32
+ $productDetails.replaceWith($newProductDetails);
33
+
34
+ WORKAREA.initModules($newProductDetails);
35
+
36
+ selectSizeButton($selectedButton, $newProductDetails);
37
+ },
38
+
39
+ loadImage = function ($productDetails, $button, newProductDetails) {
40
+ var imageSrc = $('.product-media__primary-image-link:first', newProductDetails).attr('href'),
41
+ gettingImage = WORKAREA.image.get(imageSrc);
42
+
43
+ WORKAREA.loading.createLoadingIndicator(gettingImage, {
44
+ container: $button,
45
+ cssModifiers: 'loading--fill-relative-container',
46
+ delay: 0
47
+ });
48
+
49
+ gettingImage.always(_.partial(replaceProductDetails, $productDetails, newProductDetails));
50
+ },
51
+
52
+ fallbackToUrl = function (endpoint) {
53
+ window.location = endpoint;
54
+ },
55
+
56
+ handleColorButtonClick = function (event) {
57
+ var $button = $(event.currentTarget),
58
+ $productDetails = $button.closest('.product-details'),
59
+ $quantity = $productDetails.find('[name=quantity]'),
60
+
61
+ endpoint = $button.attr('href'),
62
+ gettingProductDetails = $.get(endpoint, {
63
+ quantity: $quantity.val()
64
+ });
65
+
66
+ event.preventDefault();
67
+
68
+ gettingProductDetails
69
+ .done(_.partial(loadImage, $productDetails, $button))
70
+ .fail(_.partial(fallbackToUrl, endpoint));
71
+ },
72
+
73
+ /**
74
+ * @method
75
+ * @name init
76
+ * @memberof WORKAREA.productDetailsColorButtons
77
+ */
78
+ init = function ($scope) {
79
+ $('[data-product-details-color-button]', $scope)
80
+ .on('click', handleColorButtonClick);
81
+ };
82
+
83
+ return {
84
+ init: init
85
+ };
86
+ }()));
@@ -0,0 +1,655 @@
1
+ // Generated by CoffeeScript 1.7.1
2
+ (function () {
3
+ var $, cardFromNumber, cardFromType, cards, defaultFormat, formatBackCardNumber, formatBackExpiry, formatCardNumber, formatExpiry, formatForwardExpiry, formatForwardSlashAndSpace, hasTextSelected, luhnCheck, reFormatCVC, reFormatCardNumber, reFormatExpiry, reFormatNumeric, replaceFullWidthChars, restrictCVC, restrictCardNumber, restrictExpiry, restrictNumeric, safeVal, setCardType,
4
+ __slice = [].slice,
5
+ __indexOf = [].indexOf || function (item) {
6
+ for (var i = 0, l = this.length; i < l; i++) {
7
+ if (i in this && this[i] === item) return i;
8
+ }
9
+ return -1;
10
+ };
11
+
12
+ $ = window.jQuery || window.Zepto || window.$;
13
+
14
+ $.payment = {};
15
+
16
+ $.payment.fn = {};
17
+
18
+ $.fn.payment = function () {
19
+ var args, method;
20
+ method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
21
+ return $.payment.fn[method].apply(this, args);
22
+ };
23
+
24
+ defaultFormat = /(\d{1,4})/g;
25
+
26
+ $.payment.cards = cards = [{
27
+ type: 'maestro',
28
+ patterns: [5018, 502, 503, 506, 56, 58, 639, 6220, 67],
29
+ format: defaultFormat,
30
+ length: [12, 13, 14, 15, 16, 17, 18, 19],
31
+ cvcLength: [3],
32
+ luhn: true
33
+ }, {
34
+ type: 'forbrugsforeningen',
35
+ patterns: [600],
36
+ format: defaultFormat,
37
+ length: [16],
38
+ cvcLength: [3],
39
+ luhn: true
40
+ }, {
41
+ type: 'dankort',
42
+ patterns: [5019],
43
+ format: defaultFormat,
44
+ length: [16],
45
+ cvcLength: [3],
46
+ luhn: true
47
+ }, {
48
+ type: 'visa',
49
+ patterns: [4],
50
+ format: defaultFormat,
51
+ length: [13, 16],
52
+ cvcLength: [3],
53
+ luhn: true
54
+ }, {
55
+ type: 'mastercard',
56
+ patterns: [51, 52, 53, 54, 55, 22, 23, 24, 25, 26, 27],
57
+ format: defaultFormat,
58
+ length: [16],
59
+ cvcLength: [3],
60
+ luhn: true
61
+ }, {
62
+ type: 'amex',
63
+ patterns: [34, 37],
64
+ format: /(\d{1,4})(\d{1,6})?(\d{1,5})?/,
65
+ length: [15],
66
+ cvcLength: [3, 4],
67
+ luhn: true
68
+ }, {
69
+ type: 'dinersclub',
70
+ patterns: [30, 36, 38, 39],
71
+ format: /(\d{1,4})(\d{1,6})?(\d{1,4})?/,
72
+ length: [14],
73
+ cvcLength: [3],
74
+ luhn: true
75
+ }, {
76
+ type: 'discover',
77
+ patterns: [60, 64, 65, 622],
78
+ format: defaultFormat,
79
+ length: [16],
80
+ cvcLength: [3],
81
+ luhn: true
82
+ }, {
83
+ type: 'unionpay',
84
+ patterns: [62, 88],
85
+ format: defaultFormat,
86
+ length: [16, 17, 18, 19],
87
+ cvcLength: [3],
88
+ luhn: false
89
+ }, {
90
+ type: 'jcb',
91
+ patterns: [35],
92
+ format: defaultFormat,
93
+ length: [16],
94
+ cvcLength: [3],
95
+ luhn: true
96
+ }];
97
+
98
+ cardFromNumber = function (num) {
99
+ var card, p, pattern, _i, _j, _len, _len1, _ref;
100
+ num = (num + '').replace(/\D/g, '');
101
+ for (_i = 0, _len = cards.length; _i < _len; _i++) {
102
+ card = cards[_i];
103
+ _ref = card.patterns;
104
+ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
105
+ pattern = _ref[_j];
106
+ p = pattern + '';
107
+ if (num.substr(0, p.length) === p) {
108
+ return card;
109
+ }
110
+ }
111
+ }
112
+ };
113
+
114
+ cardFromType = function (type) {
115
+ var card, _i, _len;
116
+ for (_i = 0, _len = cards.length; _i < _len; _i++) {
117
+ card = cards[_i];
118
+ if (card.type === type) {
119
+ return card;
120
+ }
121
+ }
122
+ };
123
+
124
+ luhnCheck = function (num) {
125
+ var digit, digits, odd, sum, _i, _len;
126
+ odd = true;
127
+ sum = 0;
128
+ digits = (num + '').split('').reverse();
129
+ for (_i = 0, _len = digits.length; _i < _len; _i++) {
130
+ digit = digits[_i];
131
+ digit = parseInt(digit, 10);
132
+ if ((odd = !odd)) {
133
+ digit *= 2;
134
+ }
135
+ if (digit > 9) {
136
+ digit -= 9;
137
+ }
138
+ sum += digit;
139
+ }
140
+ return sum % 10 === 0;
141
+ };
142
+
143
+ hasTextSelected = function ($target) {
144
+ var _ref;
145
+ if (($target.prop('selectionStart') != null) && $target.prop('selectionStart') !== $target.prop('selectionEnd')) {
146
+ return true;
147
+ }
148
+ if ((typeof document !== "undefined" && document !== null ? (_ref = document.selection) != null ? _ref.createRange : void 0 : void 0) != null) {
149
+ if (document.selection.createRange().text) {
150
+ return true;
151
+ }
152
+ }
153
+ return false;
154
+ };
155
+
156
+ safeVal = function (value, $target) {
157
+ var currPair, cursor, digit, error, last, prevPair;
158
+ try {
159
+ cursor = $target.prop('selectionStart');
160
+ } catch (_error) {
161
+ error = _error;
162
+ cursor = null;
163
+ }
164
+ last = $target.val();
165
+ $target.val(value);
166
+ if (cursor !== null && $target.is(":focus")) {
167
+ if (cursor === last.length) {
168
+ cursor = value.length;
169
+ }
170
+ if (last !== value) {
171
+ prevPair = last.slice(cursor - 1, +cursor + 1 || 9e9);
172
+ currPair = value.slice(cursor - 1, +cursor + 1 || 9e9);
173
+ digit = value[cursor];
174
+ if (/\d/.test(digit) && prevPair === ("" + digit + " ") && currPair === (" " + digit)) {
175
+ cursor = cursor + 1;
176
+ }
177
+ }
178
+ $target.prop('selectionStart', cursor);
179
+ return $target.prop('selectionEnd', cursor);
180
+ }
181
+ };
182
+
183
+ replaceFullWidthChars = function (str) {
184
+ var chars, chr, fullWidth, halfWidth, idx, value, _i, _len;
185
+ if (str == null) {
186
+ str = '';
187
+ }
188
+ fullWidth = '\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19';
189
+ halfWidth = '0123456789';
190
+ value = '';
191
+ chars = str.split('');
192
+ for (_i = 0, _len = chars.length; _i < _len; _i++) {
193
+ chr = chars[_i];
194
+ idx = fullWidth.indexOf(chr);
195
+ if (idx > -1) {
196
+ chr = halfWidth[idx];
197
+ }
198
+ value += chr;
199
+ }
200
+ return value;
201
+ };
202
+
203
+ reFormatNumeric = function (e) {
204
+ var $target;
205
+ $target = $(e.currentTarget);
206
+ return setTimeout(function () {
207
+ var value;
208
+ value = $target.val();
209
+ value = replaceFullWidthChars(value);
210
+ value = value.replace(/\D/g, '');
211
+ return safeVal(value, $target);
212
+ });
213
+ };
214
+
215
+ reFormatCardNumber = function (e) {
216
+ var $target;
217
+ $target = $(e.currentTarget);
218
+ return setTimeout(function () {
219
+ var value;
220
+ value = $target.val();
221
+ value = replaceFullWidthChars(value);
222
+ value = $.payment.formatCardNumber(value);
223
+ return safeVal(value, $target);
224
+ });
225
+ };
226
+
227
+ formatCardNumber = function (e) {
228
+ var $target, card, digit, length, re, upperLength, value;
229
+ digit = String.fromCharCode(e.which);
230
+ if (!/^\d+$/.test(digit)) {
231
+ return;
232
+ }
233
+ $target = $(e.currentTarget);
234
+ value = $target.val();
235
+ card = cardFromNumber(value + digit);
236
+ length = (value.replace(/\D/g, '') + digit).length;
237
+ upperLength = 16;
238
+ if (card) {
239
+ upperLength = card.length[card.length.length - 1];
240
+ }
241
+ if (length >= upperLength) {
242
+ return;
243
+ }
244
+ if (($target.prop('selectionStart') != null) && $target.prop('selectionStart') !== value.length) {
245
+ return;
246
+ }
247
+ if (card && card.type === 'amex') {
248
+ re = /^(\d{4}|\d{4}\s\d{6})$/;
249
+ } else {
250
+ re = /(?:^|\s)(\d{4})$/;
251
+ }
252
+ if (re.test(value)) {
253
+ e.preventDefault();
254
+ return setTimeout(function () {
255
+ return $target.val(value + ' ' + digit);
256
+ });
257
+ } else if (re.test(value + digit)) {
258
+ e.preventDefault();
259
+ return setTimeout(function () {
260
+ return $target.val(value + digit + ' ');
261
+ });
262
+ }
263
+ };
264
+
265
+ formatBackCardNumber = function (e) {
266
+ var $target, value;
267
+ $target = $(e.currentTarget);
268
+ value = $target.val();
269
+ if (e.which !== 8) {
270
+ return;
271
+ }
272
+ if (($target.prop('selectionStart') != null) && $target.prop('selectionStart') !== value.length) {
273
+ return;
274
+ }
275
+ if (/\d\s$/.test(value)) {
276
+ e.preventDefault();
277
+ return setTimeout(function () {
278
+ return $target.val(value.replace(/\d\s$/, ''));
279
+ });
280
+ } else if (/\s\d?$/.test(value)) {
281
+ e.preventDefault();
282
+ return setTimeout(function () {
283
+ return $target.val(value.replace(/\d$/, ''));
284
+ });
285
+ }
286
+ };
287
+
288
+ reFormatExpiry = function (e) {
289
+ var $target;
290
+ $target = $(e.currentTarget);
291
+ return setTimeout(function () {
292
+ var value;
293
+ value = $target.val();
294
+ value = replaceFullWidthChars(value);
295
+ value = $.payment.formatExpiry(value);
296
+ return safeVal(value, $target);
297
+ });
298
+ };
299
+
300
+ formatExpiry = function (e) {
301
+ var $target, digit, val;
302
+ digit = String.fromCharCode(e.which);
303
+ if (!/^\d+$/.test(digit)) {
304
+ return;
305
+ }
306
+ $target = $(e.currentTarget);
307
+ val = $target.val() + digit;
308
+ if (/^\d$/.test(val) && (val !== '0' && val !== '1')) {
309
+ e.preventDefault();
310
+ return setTimeout(function () {
311
+ return $target.val("0" + val + " / ");
312
+ });
313
+ } else if (/^\d\d$/.test(val)) {
314
+ e.preventDefault();
315
+ return setTimeout(function () {
316
+ var m1, m2;
317
+ m1 = parseInt(val[0], 10);
318
+ m2 = parseInt(val[1], 10);
319
+ if (m2 > 2 && m1 !== 0) {
320
+ return $target.val("0" + m1 + " / " + m2);
321
+ } else {
322
+ return $target.val("" + val + " / ");
323
+ }
324
+ });
325
+ }
326
+ };
327
+
328
+ formatForwardExpiry = function (e) {
329
+ var $target, digit, val;
330
+ digit = String.fromCharCode(e.which);
331
+ if (!/^\d+$/.test(digit)) {
332
+ return;
333
+ }
334
+ $target = $(e.currentTarget);
335
+ val = $target.val();
336
+ if (/^\d\d$/.test(val)) {
337
+ return $target.val("" + val + " / ");
338
+ }
339
+ };
340
+
341
+ formatForwardSlashAndSpace = function (e) {
342
+ var $target, val, which;
343
+ which = String.fromCharCode(e.which);
344
+ if (!(which === '/' || which === ' ')) {
345
+ return;
346
+ }
347
+ $target = $(e.currentTarget);
348
+ val = $target.val();
349
+ if (/^\d$/.test(val) && val !== '0') {
350
+ return $target.val("0" + val + " / ");
351
+ }
352
+ };
353
+
354
+ formatBackExpiry = function (e) {
355
+ var $target, value;
356
+ $target = $(e.currentTarget);
357
+ value = $target.val();
358
+ if (e.which !== 8) {
359
+ return;
360
+ }
361
+ if (($target.prop('selectionStart') != null) && $target.prop('selectionStart') !== value.length) {
362
+ return;
363
+ }
364
+ if (/\d\s\/\s$/.test(value)) {
365
+ e.preventDefault();
366
+ return setTimeout(function () {
367
+ return $target.val(value.replace(/\d\s\/\s$/, ''));
368
+ });
369
+ }
370
+ };
371
+
372
+ reFormatCVC = function (e) {
373
+ var $target;
374
+ $target = $(e.currentTarget);
375
+ return setTimeout(function () {
376
+ var value;
377
+ value = $target.val();
378
+ value = replaceFullWidthChars(value);
379
+ value = value.replace(/\D/g, '').slice(0, 4);
380
+ return safeVal(value, $target);
381
+ });
382
+ };
383
+
384
+ restrictNumeric = function (e) {
385
+ var input;
386
+ if (e.metaKey || e.ctrlKey) {
387
+ return true;
388
+ }
389
+ if (e.which === 32) {
390
+ return false;
391
+ }
392
+ if (e.which === 0) {
393
+ return true;
394
+ }
395
+ if (e.which < 33) {
396
+ return true;
397
+ }
398
+ input = String.fromCharCode(e.which);
399
+ return !!/[\d\s]/.test(input);
400
+ };
401
+
402
+ restrictCardNumber = function (e) {
403
+ var $target, card, digit, value;
404
+ $target = $(e.currentTarget);
405
+ digit = String.fromCharCode(e.which);
406
+ if (!/^\d+$/.test(digit)) {
407
+ return;
408
+ }
409
+ if (hasTextSelected($target)) {
410
+ return;
411
+ }
412
+ value = ($target.val() + digit).replace(/\D/g, '');
413
+ card = cardFromNumber(value);
414
+ if (card) {
415
+ return value.length <= card.length[card.length.length - 1];
416
+ } else {
417
+ return value.length <= 16;
418
+ }
419
+ };
420
+
421
+ restrictExpiry = function (e) {
422
+ var $target, digit, value;
423
+ $target = $(e.currentTarget);
424
+ digit = String.fromCharCode(e.which);
425
+ if (!/^\d+$/.test(digit)) {
426
+ return;
427
+ }
428
+ if (hasTextSelected($target)) {
429
+ return;
430
+ }
431
+ value = $target.val() + digit;
432
+ value = value.replace(/\D/g, '');
433
+ if (value.length > 6) {
434
+ return false;
435
+ }
436
+ };
437
+
438
+ restrictCVC = function (e) {
439
+ var $target, digit, val;
440
+ $target = $(e.currentTarget);
441
+ digit = String.fromCharCode(e.which);
442
+ if (!/^\d+$/.test(digit)) {
443
+ return;
444
+ }
445
+ if (hasTextSelected($target)) {
446
+ return;
447
+ }
448
+ val = $target.val() + digit;
449
+ return val.length <= 4;
450
+ };
451
+
452
+ setCardType = function (e) {
453
+ var $target, allTypes, card, cardType, val;
454
+ $target = $(e.currentTarget);
455
+ val = $target.val();
456
+ cardType = $.payment.cardType(val) || 'unknown';
457
+ if (!$target.hasClass(cardType)) {
458
+ allTypes = (function () {
459
+ var _i, _len, _results;
460
+ _results = [];
461
+ for (_i = 0, _len = cards.length; _i < _len; _i++) {
462
+ card = cards[_i];
463
+ _results.push(card.type);
464
+ }
465
+ return _results;
466
+ })();
467
+ $target.removeClass('unknown');
468
+ $target.removeClass(allTypes.join(' '));
469
+ $target.addClass(cardType);
470
+ $target.toggleClass('identified', cardType !== 'unknown');
471
+ return $target.trigger('payment.cardType', cardType);
472
+ }
473
+ };
474
+
475
+ $.payment.fn.formatCardCVC = function () {
476
+ this.on('keypress', restrictNumeric);
477
+ this.on('keypress', restrictCVC);
478
+ this.on('paste', reFormatCVC);
479
+ this.on('change', reFormatCVC);
480
+ this.on('input', reFormatCVC);
481
+ return this;
482
+ };
483
+
484
+ $.payment.fn.formatCardExpiry = function () {
485
+ this.on('keypress', restrictNumeric);
486
+ this.on('keypress', restrictExpiry);
487
+ this.on('keypress', formatExpiry);
488
+ this.on('keypress', formatForwardSlashAndSpace);
489
+ this.on('keypress', formatForwardExpiry);
490
+ this.on('keydown', formatBackExpiry);
491
+ this.on('change', reFormatExpiry);
492
+ this.on('input', reFormatExpiry);
493
+ return this;
494
+ };
495
+
496
+ $.payment.fn.formatCardNumber = function () {
497
+ this.on('keypress', restrictNumeric);
498
+ this.on('keypress', restrictCardNumber);
499
+ this.on('keypress', formatCardNumber);
500
+ this.on('keydown', formatBackCardNumber);
501
+ this.on('keyup', setCardType);
502
+ this.on('paste', reFormatCardNumber);
503
+ this.on('change', reFormatCardNumber);
504
+ this.on('input', reFormatCardNumber);
505
+ this.on('input', setCardType);
506
+ return this;
507
+ };
508
+
509
+ $.payment.fn.restrictNumeric = function () {
510
+ this.on('keypress', restrictNumeric);
511
+ this.on('paste', reFormatNumeric);
512
+ this.on('change', reFormatNumeric);
513
+ this.on('input', reFormatNumeric);
514
+ return this;
515
+ };
516
+
517
+ $.payment.fn.cardExpiryVal = function () {
518
+ return $.payment.cardExpiryVal($(this).val());
519
+ };
520
+
521
+ $.payment.cardExpiryVal = function (value) {
522
+ var month, prefix, year, _ref;
523
+ _ref = value.split(/[\s\/]+/, 2), month = _ref[0], year = _ref[1];
524
+ if ((year != null ? year.length : void 0) === 2 && /^\d+$/.test(year)) {
525
+ prefix = (new Date).getFullYear();
526
+ prefix = prefix.toString().slice(0, 2);
527
+ year = prefix + year;
528
+ }
529
+ month = parseInt(month, 10);
530
+ year = parseInt(year, 10);
531
+ return {
532
+ month: month,
533
+ year: year
534
+ };
535
+ };
536
+
537
+ $.payment.validateCardNumber = function (num) {
538
+ var card, _ref;
539
+ num = (num + '').replace(/\s+|-/g, '');
540
+ if (!/^\d+$/.test(num)) {
541
+ return false;
542
+ }
543
+ card = cardFromNumber(num);
544
+ if (!card) {
545
+ return false;
546
+ }
547
+ return (_ref = num.length, __indexOf.call(card.length, _ref) >= 0) && (card.luhn === false || luhnCheck(num));
548
+ };
549
+
550
+ $.payment.validateCardExpiry = function (month, year) {
551
+ var currentTime, expiry, _ref;
552
+ if (typeof month === 'object' && 'month' in month) {
553
+ _ref = month, month = _ref.month, year = _ref.year;
554
+ }
555
+ if (!(month && year)) {
556
+ return false;
557
+ }
558
+ month = $.trim(month);
559
+ year = $.trim(year);
560
+ if (!/^\d+$/.test(month)) {
561
+ return false;
562
+ }
563
+ if (!/^\d+$/.test(year)) {
564
+ return false;
565
+ }
566
+ if (!((1 <= month && month <= 12))) {
567
+ return false;
568
+ }
569
+ if (year.length === 2) {
570
+ if (year < 70) {
571
+ year = "20" + year;
572
+ } else {
573
+ year = "19" + year;
574
+ }
575
+ }
576
+ if (year.length !== 4) {
577
+ return false;
578
+ }
579
+ expiry = new Date(year, month);
580
+ currentTime = new Date;
581
+ expiry.setMonth(expiry.getMonth() - 1);
582
+ expiry.setMonth(expiry.getMonth() + 1, 1);
583
+ return expiry > currentTime;
584
+ };
585
+
586
+ $.payment.validateCardCVC = function (cvc, type) {
587
+ var card, _ref;
588
+ cvc = $.trim(cvc);
589
+ if (!/^\d+$/.test(cvc)) {
590
+ return false;
591
+ }
592
+ card = cardFromType(type);
593
+ if (card != null) {
594
+ return _ref = cvc.length, __indexOf.call(card.cvcLength, _ref) >= 0;
595
+ } else {
596
+ return cvc.length >= 3 && cvc.length <= 4;
597
+ }
598
+ };
599
+
600
+ $.payment.cardType = function (num) {
601
+ var _ref;
602
+ if (!num) {
603
+ return null;
604
+ }
605
+ return ((_ref = cardFromNumber(num)) != null ? _ref.type : void 0) || null;
606
+ };
607
+
608
+ $.payment.formatCardNumber = function (num) {
609
+ var card, groups, upperLength, _ref;
610
+ num = num.replace(/\D/g, '');
611
+ card = cardFromNumber(num);
612
+ if (!card) {
613
+ return num;
614
+ }
615
+ upperLength = card.length[card.length.length - 1];
616
+ num = num.slice(0, upperLength);
617
+ if (card.format.global) {
618
+ return (_ref = num.match(card.format)) != null ? _ref.join(' ') : void 0;
619
+ } else {
620
+ groups = card.format.exec(num);
621
+ if (groups == null) {
622
+ return;
623
+ }
624
+ groups.shift();
625
+ groups = $.grep(groups, function (n) {
626
+ return n;
627
+ });
628
+ return groups.join(' ');
629
+ }
630
+ };
631
+
632
+ $.payment.formatExpiry = function (expiry) {
633
+ var mon, parts, sep, year;
634
+ parts = expiry.match(/^\D*(\d{1,2})(\D+)?(\d{1,4})?/);
635
+ if (!parts) {
636
+ return '';
637
+ }
638
+ mon = parts[1] || '';
639
+ sep = parts[2] || '';
640
+ year = parts[3] || '';
641
+ if (year.length > 0) {
642
+ sep = ' / ';
643
+ } else if (sep === ' /') {
644
+ mon = mon.substring(0, 1);
645
+ sep = '';
646
+ } else if (mon.length === 2 || sep.length > 0) {
647
+ sep = ' / ';
648
+ } else if (mon.length === 1 && (mon !== '0' && mon !== '1')) {
649
+ mon = "0" + mon;
650
+ sep = ' / ';
651
+ }
652
+ return mon + sep + year;
653
+ };
654
+
655
+ }).call(this);