workarea-storefront 3.5.16 → 3.5.21

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: 34dae4a866fa8dc6c2bed7e2c9da094199bdfda6f2859ea718e77310756bc875
4
- data.tar.gz: 572eeb5fa03e1a3dba3683c83eb21844e372e1c1a4cb65dc771a8babe48970b6
3
+ metadata.gz: 3c4ad1aaf7be7a71400270c6e992c091d55f4af22e66b268e14996390e693515
4
+ data.tar.gz: '0190a6d6af19f3714776e50619d52fd221a2d482295ef620a38526e1ec4f1f78'
5
5
  SHA512:
6
- metadata.gz: c7a9687e4759d591490c9d109ba617c09d88727d0412a51e611d4d5aad60c31f4da51b01fc677dde2b1c3db2f89856b880e7ad30a001898e9e14968895e43a9c
7
- data.tar.gz: 323651e9ccedecab9d6be53a4dc2040ec8d6f8b8af4d2968cc34e82d66f15651937a83ac6ba42a6606363d773dfc8efde346874ce6d9ecd2dfefd3a8ab1283a3
6
+ metadata.gz: 826e30a3e84c4a8e706102d853a9b8bf81404951466219fa7f94e77b04ca8d54025d9e3ce8edb631d3b66d52c4a21ef212d7464c505a3e1008b3ebcffe9795b3
7
+ data.tar.gz: b63c0a4ccc114ee99f491a334c76a4cc32ae4676c8aa0a4e2aa0a4b2a8b0723fb3b0f2411d28c9aec983b522cc231b43dc1d442ba8d4ef9ae7fbe8c46d37ab4a
@@ -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) {
@@ -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
@@ -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.16
4
+ version: 3.5.21
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-22 00:00:00.000000000 Z
11
+ date: 2020-10-14 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.16
19
+ version: 3.5.21
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.16
26
+ version: 3.5.21
27
27
  description: Provides user-facing ecommerce storefront functionality for the Workarea
28
28
  Commerce Platform.
29
29
  email: