workarea-storefront 3.5.15 → 3.5.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 289c18606364caedb6713122b572dcb4040526a2082fd67e6628a8565c39d253
4
- data.tar.gz: d4fb9525f5269f1525ee8a544f334103fc41ad6ae82ab20aa8f7e3cc7b65d000
3
+ metadata.gz: 0c50360a4f45c6c0829ee7946aaddb42f7750ae952a6cd34b0ed318a136081e5
4
+ data.tar.gz: b674fc2b3f89fcd4d77847a49c02a897b565f8067e6c260a435d3f91d75b7b37
5
5
  SHA512:
6
- metadata.gz: d9a4f0962e3c17621d771949e9dc3e2bd92ef59fa02d916670a2104ab7a0158254a66e4e0b93ec28270846e2163e7990ac6cbc9cb8bbd07b3bb9171d8dd02d43
7
- data.tar.gz: 441493667de93080551f774b54cb0295a223711e80d6cc9df186fc9b5b9f6e0b8336c5522a9181de303babace951522add351d5a2279f306612f8b5b18bd8150
6
+ metadata.gz: 90a4da3fb29ab3d04be5561dc3879fc453225b7a386f41862c61a4e4de361ff70695e5ddff0601aa76e3c676bd881685ad32136ee901e6b97e0c30177d128507
7
+ data.tar.gz: d0e50e28fb52a9149d9446ab698fd3aebcc350b8b632d66bd0c3474005f2988f8e12d317295d29039ce915c7e6bb5c885f94a09155fa297aad59367921c88e62
@@ -70,9 +70,11 @@ WORKAREA.registerModule('adminToolbar', (function () {
70
70
  },
71
71
 
72
72
  shouldDisplay = function (user) {
73
+ var disable = WORKAREA.url.parse(window.location).queryKey.disable_admin_toolbar;
74
+
73
75
  return user.impersonating
74
76
  || user.browsing_as_guest
75
- || (user.admin && user.logged_in);
77
+ || (user.admin && user.logged_in && disable !== 'true');
76
78
  },
77
79
 
78
80
  create = function (user) {
@@ -61,11 +61,8 @@ module Workarea
61
61
  params[:credit_card].permit(
62
62
  :first_name,
63
63
  :last_name,
64
- :number,
65
- :month,
66
- :year,
67
- :cvv,
68
- :default
64
+ :default,
65
+ *Workarea.config.credit_card_attributes
69
66
  )
70
67
  end
71
68
 
@@ -9,7 +9,13 @@ module Workarea
9
9
  end
10
10
 
11
11
  def subjects
12
- Workarea.config.inquiry_subjects.map { |k, v| [v, k] }
12
+ Workarea.config.inquiry_subjects.map do |key, default_value|
13
+ [
14
+ I18n.t('workarea.inquiry.subjects')[key.optionize.to_sym].presence ||
15
+ default_value,
16
+ key
17
+ ]
18
+ end
13
19
  end
14
20
 
15
21
  private
@@ -164,8 +164,6 @@
164
164
  %tr
165
165
  %td= link_to t('workarea.storefront.orders.download'), download_url(item.token)
166
166
 
167
- = append_partials('storefront.order_summary_item_details', item: item)
168
-
169
167
  = append_partials('storefront.order_mailer_summary_order_details', item: item)
170
168
 
171
169
  - if item.total_adjustments.many?
@@ -123,6 +123,84 @@ module Workarea
123
123
 
124
124
  assert(response.ok?)
125
125
  end
126
+
127
+ def test_metrics_tracking
128
+ super_admin = create_user(password: 'W3bl1nc!', super_admin: true)
129
+ customer = create_user(email: 'bcrouse@workarea.com', password: 'W3bl1nc!')
130
+ product = create_product
131
+ create_shipping_service(
132
+ name: 'Ground',
133
+ tax_code: '001',
134
+ rates: [{ price: 7.to_m }]
135
+ )
136
+
137
+ post storefront.login_path,
138
+ params: { email: super_admin.email, password: 'W3bl1nc!' }
139
+
140
+ admin_current_email_cookie = cookies[:email]
141
+
142
+ post admin.impersonations_path,
143
+ params: { user_id: customer.id }
144
+
145
+ refute_equal(admin_current_email_cookie, cookies[:email])
146
+ customer_current_email_cookie = cookies[:email]
147
+
148
+ post storefront.cart_items_path,
149
+ params: {
150
+ product_id: product.id,
151
+ sku: product.skus.first,
152
+ quantity: 2
153
+ }
154
+
155
+ patch storefront.checkout_addresses_path,
156
+ params: {
157
+ billing_address: {
158
+ first_name: 'Ben',
159
+ last_name: 'Crouse',
160
+ street: '12 N. 3rd St.',
161
+ city: 'Philadelphia',
162
+ region: 'PA',
163
+ postal_code: '19106',
164
+ country: 'US',
165
+ phone_number: '2159251800'
166
+ },
167
+ shipping_address: {
168
+ first_name: 'Ben',
169
+ last_name: 'Crouse',
170
+ street: '22 S. 3rd St.',
171
+ city: 'Philadelphia',
172
+ region: 'PA',
173
+ postal_code: '19106',
174
+ country: 'US',
175
+ phone_number: '2159251800'
176
+ }
177
+ }
178
+
179
+ assert_equal(customer_current_email_cookie, cookies[:email])
180
+
181
+ patch storefront.checkout_place_order_path,
182
+ params: {
183
+ payment: 'new_card',
184
+ credit_card: {
185
+ number: '1',
186
+ month: 1,
187
+ year: next_year,
188
+ cvv: '999'
189
+ }
190
+ }
191
+
192
+ assert_equal(customer_current_email_cookie, cookies[:email])
193
+ delete admin.impersonations_path
194
+ assert_equal(admin_current_email_cookie, cookies[:email])
195
+
196
+ super_admin_metrics = Metrics::User.find(super_admin.email)
197
+ assert_equal(0, super_admin_metrics.orders)
198
+ assert_equal(0, super_admin_metrics.revenue)
199
+
200
+ customer_metrics = Metrics::User.find(customer.email)
201
+ assert_equal(1, customer_metrics.orders)
202
+ assert(customer_metrics.revenue.positive?)
203
+ end
126
204
  end
127
205
  end
128
206
  end
@@ -3,7 +3,9 @@ require 'test_helper'
3
3
  module Workarea
4
4
  module Storefront
5
5
  class PlaceOrderIntegrationTest < Workarea::IntegrationTest
6
- setup do
6
+ setup :setup_checkout
7
+
8
+ def setup_checkout
7
9
  create_tax_category(
8
10
  name: 'Sales Tax',
9
11
  code: '001',
@@ -5,7 +5,9 @@ module Workarea
5
5
  class StoreCreditIntegrationTest < Workarea::IntegrationTest
6
6
  include Storefront::IntegrationTest
7
7
 
8
- def setup
8
+ setup :setup_supporting_data
9
+
10
+ def setup_supporting_data
9
11
  @user = create_user(email: 'bcrouse@workarea.com', password: 'W3bl1nc!')
10
12
 
11
13
  @tax = create_tax_category(
@@ -113,7 +113,7 @@ module Workarea
113
113
  assert(page.has_content?('foo bar'))
114
114
 
115
115
  resize_window_to('medium')
116
- refute(page.has_content?('foo bar'))
116
+ refute_text('foo bar')
117
117
 
118
118
  resize_window_to('wide')
119
119
  assert(page.has_content?('foo bar'))
@@ -69,7 +69,7 @@ module Workarea
69
69
  click_button t('workarea.storefront.forms.save')
70
70
  end
71
71
 
72
- refute(page.has_content?('Success'))
72
+ refute_text('Success')
73
73
  assert(page.has_content?(I18n.t('workarea.payment.store_credit_card_failure')))
74
74
  end
75
75
  end
@@ -54,7 +54,7 @@ module Workarea
54
54
  assert_current_path(storefront.root_path)
55
55
 
56
56
  page.execute_script("$('body').trigger('click');")
57
- refute(page.has_content?('Foo'))
57
+ refute_text('Foo')
58
58
  end
59
59
 
60
60
  def test_left_navigation
@@ -66,7 +66,7 @@ module Workarea
66
66
 
67
67
  secondary.navigable.update_attributes!(active: false)
68
68
  visit storefront.page_path(primary.navigable)
69
- refute(page.has_content?('Foo'))
69
+ refute_text('Foo')
70
70
  end
71
71
  end
72
72
  end
@@ -59,7 +59,7 @@ module Workarea
59
59
 
60
60
  scroll_to_bottom
61
61
 
62
- refute(page.has_content?(t('workarea.storefront.pagination.next_page')))
62
+ refute_text(t('workarea.storefront.pagination.next_page'))
63
63
  click_link t('workarea.storefront.pagination.load_more')
64
64
 
65
65
  assert_current_path(storefront.category_path(category))
@@ -70,7 +70,7 @@ module Workarea
70
70
  assert(page.has_content?('Product 5'))
71
71
  assert(page.has_content?('Product 6'))
72
72
 
73
- refute(page.has_content?(t('workarea.storefront.pagination.load_more')))
73
+ refute_text(t('workarea.storefront.pagination.load_more'))
74
74
 
75
75
  find('a', text: 'Product 6').click
76
76
  page.execute_script("history.back()")
@@ -79,7 +79,7 @@ module Workarea
79
79
 
80
80
  wait_for_xhr
81
81
 
82
- refute(page.has_content?(t('workarea.storefront.pagination.load_more')))
82
+ refute_text(t('workarea.storefront.pagination.load_more'))
83
83
 
84
84
  assert_match(/PROD1.*PROD2.*PROD3.*PROD4.*PROD5.*PROD6/m, page.html)
85
85
  end
@@ -95,7 +95,7 @@ module Workarea
95
95
 
96
96
  scroll_to_bottom
97
97
 
98
- refute(page.has_content?(t('workarea.storefront.pagination.next_page')))
98
+ refute_text(t('workarea.storefront.pagination.next_page'))
99
99
  click_link t('workarea.storefront.pagination.load_more')
100
100
 
101
101
  assert_current_path(storefront.search_path(q: 'Product'))
@@ -106,7 +106,7 @@ module Workarea
106
106
  assert(page.has_content?('Product 5'))
107
107
  assert(page.has_content?('Product 6'))
108
108
 
109
- refute(page.has_content?(t('workarea.storefront.pagination.load_more')))
109
+ refute_text(t('workarea.storefront.pagination.load_more'))
110
110
 
111
111
  find('a', text: 'Product 6').click
112
112
  page.execute_script("history.back()")
@@ -115,7 +115,7 @@ module Workarea
115
115
 
116
116
  wait_for_xhr
117
117
 
118
- refute(page.has_content?(t('workarea.storefront.pagination.load_more')))
118
+ refute_text(t('workarea.storefront.pagination.load_more'))
119
119
 
120
120
  assert(page.has_content?('Product 1'))
121
121
  assert(page.has_content?('Product 2'))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-storefront
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.15
4
+ version: 3.5.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-07 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.5.15
19
+ version: 3.5.20
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.5.15
26
+ version: 3.5.20
27
27
  description: Provides user-facing ecommerce storefront functionality for the Workarea
28
28
  Commerce Platform.
29
29
  email: