spree_core 5.0.5 → 5.1.0.beta

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/logo.png +0 -0
  3. data/app/finders/spree/products/find.rb +28 -1
  4. data/app/finders/spree/taxons/find.rb +1 -1
  5. data/app/helpers/spree/base_helper.rb +1 -6
  6. data/app/helpers/spree/images_helper.rb +12 -13
  7. data/app/helpers/spree/integrations_helper.rb +15 -0
  8. data/app/helpers/spree/mail_helper.rb +3 -4
  9. data/app/javascript/spree/core/controllers/disable_submit_button_controller.js +19 -0
  10. data/app/mailers/spree/invitation_mailer.rb +24 -0
  11. data/app/models/concerns/spree/integrations_concern.rb +11 -0
  12. data/app/models/concerns/spree/product_scopes.rb +6 -6
  13. data/app/models/concerns/spree/translatable_resource.rb +4 -0
  14. data/app/models/concerns/spree/translatable_resource_scopes.rb +17 -3
  15. data/app/models/concerns/spree/unique_name.rb +2 -0
  16. data/app/models/concerns/spree/user_management.rb +33 -0
  17. data/app/models/concerns/spree/user_methods.rb +19 -0
  18. data/app/models/concerns/spree/user_roles.rb +43 -17
  19. data/app/models/spree/ability.rb +8 -6
  20. data/app/models/spree/asset.rb +1 -6
  21. data/app/models/spree/base.rb +1 -0
  22. data/app/models/spree/base_analytics_event_handler.rb +7 -2
  23. data/app/models/spree/classification.rb +13 -0
  24. data/app/models/spree/credit_card.rb +24 -2
  25. data/app/models/spree/custom_domain.rb +2 -1
  26. data/app/models/spree/export.rb +1 -1
  27. data/app/models/spree/integration.rb +63 -0
  28. data/app/models/spree/invitation.rb +153 -0
  29. data/app/models/spree/invitations/store.rb +6 -0
  30. data/app/models/spree/option_value.rb +2 -2
  31. data/app/models/spree/order.rb +16 -5
  32. data/app/models/spree/order_merger.rb +7 -5
  33. data/app/models/spree/page_sections/featured_posts.rb +0 -4
  34. data/app/models/spree/payment.rb +1 -2
  35. data/app/models/spree/payment_source.rb +0 -21
  36. data/app/models/spree/post.rb +0 -1
  37. data/app/models/spree/product_property.rb +1 -1
  38. data/app/models/spree/property.rb +3 -1
  39. data/app/models/spree/reports/sales_total.rb +5 -1
  40. data/app/models/spree/role.rb +16 -0
  41. data/app/models/spree/role_user.rb +32 -1
  42. data/app/models/spree/shipment_handler.rb +1 -0
  43. data/app/models/spree/shipping_method.rb +2 -2
  44. data/app/models/spree/store.rb +9 -4
  45. data/app/models/spree/store_credit_category.rb +4 -0
  46. data/app/models/spree/taxon.rb +4 -7
  47. data/app/models/spree/theme.rb +1 -1
  48. data/app/models/spree/wishlist.rb +0 -7
  49. data/app/services/spree/country_to_timezone.rb +273 -0
  50. data/app/services/spree/products/prepare_nested_attributes.rb +2 -9
  51. data/app/services/spree/seeds/admin_user.rb +4 -2
  52. data/app/services/spree/seeds/all.rb +3 -1
  53. data/app/services/spree/seeds/digital_delivery.rb +20 -0
  54. data/app/services/spree/seeds/returns_environment.rb +27 -0
  55. data/app/services/spree/seeds/tax_categories.rb +12 -0
  56. data/app/services/spree/stores/settings_defaults_by_country.rb +38 -0
  57. data/app/services/spree/tags/bulk_add.rb +13 -7
  58. data/app/views/spree/invitation_mailer/invitation_accepted.html.erb +12 -0
  59. data/app/views/spree/invitation_mailer/invitation_email.html.erb +21 -0
  60. data/app/views/spree/shared/_payment.html.erb +0 -9
  61. data/config/locales/en.yml +48 -20
  62. data/db/migrate/20250407085228_create_spree_integrations.rb +12 -0
  63. data/db/migrate/20250410061306_create_spree_invitations.rb +20 -0
  64. data/db/migrate/20250418174652_add_resource_to_spree_role_users.rb +8 -0
  65. data/db/migrate/20250508060800_add_selected_locale_to_spree_admin_users.rb +8 -0
  66. data/db/migrate/20250509143831_add_session_id_to_spree_assets.rb +5 -0
  67. data/lib/generators/spree/authentication/devise/devise_generator.rb +5 -2
  68. data/lib/generators/spree/authentication/devise/templates/authentication_helpers.rb.tt +3 -3
  69. data/lib/generators/spree/install/install_generator.rb +5 -0
  70. data/lib/spree/core/controller_helpers/auth.rb +15 -14
  71. data/lib/spree/core/controller_helpers/currency.rb +11 -0
  72. data/lib/spree/core/controller_helpers/strong_parameters.rb +3 -2
  73. data/lib/spree/core/engine.rb +13 -3
  74. data/lib/spree/core/version.rb +1 -1
  75. data/lib/spree/core.rb +1 -0
  76. data/lib/spree/permitted_attributes.rb +111 -13
  77. data/lib/spree/testing_support/factories/integration_factory.rb +7 -0
  78. data/lib/spree/testing_support/factories/invitation_factory.rb +6 -0
  79. data/lib/spree/testing_support/factories/page_section_factory.rb +0 -4
  80. data/lib/spree/testing_support/factories/payment_factory.rb +0 -5
  81. data/lib/spree/testing_support/factories/payment_method_factory.rb +0 -5
  82. data/lib/spree/testing_support/factories/promotion_action_factory.rb +4 -0
  83. data/lib/spree/testing_support/factories/user_factory.rb +14 -1
  84. data/lib/spree/translation_migrations.rb +27 -15
  85. data/lib/tasks/core.rake +8 -0
  86. metadata +41 -7
  87. data/app/models/concerns/spree/payment_source_concern.rb +0 -39
  88. data/app/models/spree/gateway/custom_payment_source_method.rb +0 -33
  89. data/lib/spree/testing_support/factories/payment_source_factory.rb +0 -5
@@ -2,38 +2,65 @@ module Spree
2
2
  module PermittedAttributes
3
3
  ATTRIBUTES = [
4
4
  :address_attributes,
5
+ :asset_attributes,
5
6
  :checkout_attributes,
6
7
  :classification_attributes,
7
8
  :cms_page_attributes,
8
9
  :cms_section_attributes,
10
+ :custom_domain_attributes,
9
11
  :customer_return_attributes,
10
12
  :digital_attributes,
11
13
  :digital_link_attributes,
14
+ :export_attributes,
12
15
  :image_attributes,
16
+ :integration_attributes,
13
17
  :inventory_unit_attributes,
18
+ :invitation_attributes,
14
19
  :line_item_attributes,
15
20
  :menu_attributes,
16
21
  :menu_item_attributes,
17
22
  :option_type_attributes,
18
23
  :option_value_attributes,
24
+ :page_attributes,
25
+ :page_link_attributes,
26
+ :page_section_attributes,
19
27
  :payment_attributes,
28
+ :payment_method_attributes,
20
29
  :product_attributes,
30
+ :promotion_attributes,
31
+ :promotion_rule_attributes,
32
+ :promotion_action_attributes,
21
33
  :product_properties_attributes,
22
34
  :property_attributes,
35
+ :refund_attributes,
36
+ :refund_reason_attributes,
37
+ :reimbursement_attributes,
38
+ :reimbursement_type_attributes,
39
+ :report_attributes,
23
40
  :return_authorization_attributes,
41
+ :return_authorization_reason_attributes,
42
+ :role_attributes,
24
43
  :shipment_attributes,
44
+ :shipping_method_attributes,
45
+ :shipping_category_attributes,
25
46
  :source_attributes,
26
47
  :stock_item_attributes,
27
48
  :stock_location_attributes,
28
49
  :stock_movement_attributes,
50
+ :stock_transfer_attributes,
29
51
  :store_attributes,
30
52
  :store_credit_attributes,
53
+ :store_credit_category_attributes,
54
+ :tax_rate_attributes,
55
+ :tax_category_attributes,
31
56
  :taxon_attributes,
32
57
  :taxonomy_attributes,
58
+ :theme_attributes,
33
59
  :user_attributes,
34
60
  :variant_attributes,
35
61
  :wishlist_attributes,
36
- :wished_item_attributes
62
+ :wished_item_attributes,
63
+ :zone_attributes
37
64
  ]
38
65
 
39
66
  mattr_reader(*ATTRIBUTES)
@@ -47,6 +74,8 @@ module Spree
47
74
  state: [:name, :abbr] }
48
75
  ]
49
76
 
77
+ @@asset_attributes = [:type, :viewable_id, :viewable_type, :attachment, :alt, :position]
78
+
50
79
  @@checkout_attributes = [
51
80
  :coupon_code, :email, :shipping_method_id, :special_instructions, :use_billing, :use_shipping,
52
81
  :user_id, :bill_address_id, :ship_address_id, :accept_marketing, :signup_for_an_account
@@ -60,6 +89,8 @@ module Spree
60
89
 
61
90
  @@cms_section_attributes = [:name, :cms_page_id, :fit, :destination, { content: {}, settings: {} }]
62
91
 
92
+ @@custom_domain_attributes = [:url, :default]
93
+
63
94
  @@customer_return_attributes = [:stock_location_id, {
64
95
  return_items_attributes: [:id, :inventory_unit_id, :return_authorization_id, :returned, :pre_tax_amount,
65
96
  :acceptance_status, :exchange_variant_id, :resellable]
@@ -69,24 +100,39 @@ module Spree
69
100
 
70
101
  @@digital_link_attributes = [:access_counter]
71
102
 
103
+ @@export_attributes = [:type, :format, :record_selection, search_params: {}]
104
+
72
105
  @@image_attributes = [:alt, :attachment, :position, :viewable_type, :viewable_id]
73
106
 
107
+ @@integration_attributes = [:type, :active]
108
+
74
109
  @@inventory_unit_attributes = [:shipment, :shipment_id, :variant_id]
75
110
 
111
+ @@invitation_attributes = [:email, :expires_at, :role_id]
112
+
76
113
  @@line_item_attributes = [:id, :variant_id, :quantity]
77
114
 
78
115
  @@menu_attributes = [:name, :locale, :location]
79
116
 
80
- @@menu_item_attributes = [:name, :subtite, :destination, :new_window, :item_type,
117
+ @@menu_item_attributes = [:name, :subtitle, :destination, :new_window, :item_type,
81
118
  :linked_resource_type, :linked_resource_id, :code, :menu_id]
82
119
 
83
- @@option_type_attributes = [:name, :presentation, :option_values_attributes]
120
+ @@option_type_attributes = [:name, :presentation, :position, :filterable,
121
+ option_values_attributes: [:id, :name, :presentation, :position, :_destroy]]
122
+
123
+ @@option_value_attributes = [:name, :presentation, :position]
124
+
125
+ @@page_attributes = [:name, :slug, :meta_title, :meta_description, :meta_keywords]
126
+
127
+ @@page_link_attributes = [:linkable_id, :linkable_type, :position, :label, :url]
84
128
 
85
- @@option_value_attributes = [:name, :presentation]
129
+ @@page_section_attributes = [:type, :name, :position, :asset]
86
130
 
87
131
  @@payment_attributes = [:amount, :payment_method_id, :payment_method]
88
132
 
89
- @@product_properties_attributes = [:property_name, :value, :position]
133
+ @@payment_method_attributes = [:name, :type, :description, :active, :display_on, :auto_capture, :position]
134
+
135
+ @@product_properties_attributes = [:property_name, :property_id, :value, :position, :_destroy]
90
136
 
91
137
  @@product_attributes = [
92
138
  :name, :description, :available_on, :make_active_at, :discontinue_on, :permalink, :meta_description,
@@ -94,24 +140,60 @@ module Spree
94
140
  :option_values_hash, :weight, :height, :width, :depth,
95
141
  :shipping_category_id, :tax_category_id,
96
142
  :cost_currency, :cost_price, :compare_at_price,
97
- :slug,
143
+ :slug, :track_inventory, :backorderable, :barcode, :status,
144
+ :weight_unit, :dimensions_unit,
98
145
  {
99
146
  tag_list: [],
147
+ label_list: [],
100
148
  option_type_ids: [],
101
- taxon_ids: []
149
+ taxon_ids: [],
150
+ store_ids: [],
151
+ product_option_types_attributes: [:id, :option_type_id, :position, :_destroy]
102
152
  }
103
153
  ]
104
154
 
105
- @@property_attributes = [:name, :presentation, :position]
155
+ @@promotion_attributes = [:name, :description, :starts_at, :expires_at, :code, :usage_limit, :path, :match_policy,
156
+ :advertise, :promotion_category_id, :code_prefix, :kind, :number_of_codes, :multi_codes, store_ids: []]
157
+
158
+ @@promotion_rule_attributes = [:type, :preferred_match_policy, user_ids_to_add: [], product_ids_to_add: [], taxon_ids_to_add: []]
159
+
160
+ @@promotion_action_attributes = [:type, :calculator_type, calculator_attributes: {}, promotion_action_line_items_attributes: [:id, :promotion_action_id, :variant_id, :quantity, :_destroy]]
161
+
162
+ @@property_attributes = [:name, :presentation, :position, :kind, :display_on]
163
+
164
+ @@refund_attributes = [:amount, :refund_reason_id]
165
+
166
+ @@refund_reason_attributes = [:name, :active, :mutable]
167
+
168
+ @@reimbursement_attributes = [return_items_attributes: [:id, :override_reimbursement_type_id, :pre_tax_amount, :exchange_variant_id]]
169
+
170
+ @@reimbursement_type_attributes = [:name, :active]
171
+
172
+ @@report_attributes = [:type, :date_from, :date_to, :currency]
106
173
 
107
174
  @@return_authorization_attributes = [:amount, :memo, :stock_location_id, :inventory_units_attributes,
108
- :return_authorization_reason_id]
175
+ :return_authorization_reason_id, {
176
+ return_items_attributes: [:id, :inventory_unit_id, :return_authorization_id, :returned, :pre_tax_amount,
177
+ :acceptance_status, :exchange_variant_id, :resellable]
178
+ }]
179
+
180
+ @@return_authorization_reason_attributes = [:name, :active]
181
+
182
+ @@return_item_attributes = [:inventory_unit_id, :return_authorization_id, :returned, :pre_tax_amount, :acceptance_status, :exchange_variant_id, :resellable]
183
+
184
+ @@role_attributes = [:name]
109
185
 
110
186
  @@shipment_attributes = [
111
187
  :order, :special_instructions, :stock_location_id, :id,
112
188
  :tracking, :address, :inventory_units, :selected_shipping_rate_id
113
189
  ]
114
190
 
191
+ @@shipping_category_attributes = [:name]
192
+
193
+ @@shipping_method_attributes = [:name, :code,:tracking_url, :tax_category_id, :display_on,
194
+ :estimated_transit_business_days_min, :estimated_transit_business_days_max,
195
+ :calculator_type, :preferences, zone_ids: [], shipping_category_ids: [], calculator_attributes: {}]
196
+
115
197
  # month / year may be provided by some sources, or others may elect to use one field
116
198
  @@source_attributes = [
117
199
  :id, :number, :month, :year, :expiry, :verification_value,
@@ -119,7 +201,7 @@ module Spree
119
201
  :gateway_payment_profile_id, :last_digits, :name, :encrypted_data
120
202
  ]
121
203
 
122
- @@stock_item_attributes = [:variant, :stock_location, :backorderable, :variant_id]
204
+ @@stock_item_attributes = [:variant_id, :stock_location_id, :backorderable, :count_on_hand]
123
205
 
124
206
  @@stock_location_attributes = [
125
207
  :name, :active, :address1, :address2, :city, :zipcode,
@@ -131,6 +213,9 @@ module Spree
131
213
  :quantity, :stock_item, :stock_item_id, :originator, :action
132
214
  ]
133
215
 
216
+ @@stock_transfer_attributes = [:source_location_id, :destination_location_id, :reference,
217
+ stock_movements_attributes: [:variant_id, :quantity, :originator_id, :stock_item_id]]
218
+
134
219
  @@store_attributes = [:name, :url, :seo_title, :code, :meta_keywords,
135
220
  :meta_description, :default_currency, :mail_from_address,
136
221
  :customer_support_email, :description, :address, :contact_phone,
@@ -148,25 +233,36 @@ module Spree
148
233
 
149
234
  @@store_credit_attributes = %i[amount currency category_id memo]
150
235
 
236
+ @@store_credit_category_attributes = [:name]
237
+
151
238
  @@taxonomy_attributes = [:name]
152
239
 
240
+ @@tax_category_attributes = [:name, :tax_code,:description, :is_default]
241
+
242
+ @@tax_rate_attributes = [:name, :amount, :zone_id, :tax_category_id, :included_in_price, :show_rate_in_label, :calculator_type, calculator_attributes: {}]
243
+
153
244
  @@taxon_attributes = [
154
245
  :name, :parent_id, :position, :icon, :description, :permalink, :hide_from_nav,
155
- :taxonomy_id, :meta_description, :meta_keywords, :meta_title, :child_index
246
+ :taxonomy_id, :meta_description, :meta_keywords, :meta_title, :child_index,
247
+ :automatic, :rules_match_policy, :sort_order,
248
+ :image, :square_image, :description,
249
+ taxon_rules_attributes: [:id, :type, :value, :match_policy, :_destroy],
156
250
  ]
157
251
 
252
+ @@theme_attributes = [:name, :type, :default]
253
+
158
254
  @@user_attributes = [:email, :bill_address_id, :ship_address_id, :password, :first_name, :last_name,
159
255
  :password_confirmation, :selected_locale, :avatar, :accepts_email_marketing, :phone,
160
256
  { public_metadata: {}, private_metadata: {}, tag_list: [] }]
161
257
 
162
258
  @@variant_attributes = [
163
259
  :name, :presentation, :cost_price, :discontinue_on, :lock_version,
164
- :position, :track_inventory,
260
+ :position, :track_inventory, :tax_category_id,
165
261
  :product_id, :product, :option_values_attributes, :price, :compare_at_price,
166
262
  :weight, :height, :width, :depth, :sku, :barcode, :cost_currency,
167
263
  :weight_unit, :dimensions_unit,
168
264
  {
169
- options: [:id, :name, :option_value_presentation, :option_value_name, :position, :_destroy],
265
+ options: [:id, :name, :value, :position, :_destroy],
170
266
  stock_items_attributes: [:id, :count_on_hand, :stock_location_id, :backorderable, :_destroy],
171
267
  prices_attributes: [:id, :amount, :compare_at_amount, :currency, :_destroy],
172
268
  price: {},
@@ -178,5 +274,7 @@ module Spree
178
274
  @@wishlist_attributes = [:name, :is_default, :is_private]
179
275
 
180
276
  @@wished_item_attributes = [:variant_id, :quantity]
277
+
278
+ @@zone_attributes = [:name, :description, :default_tax, :kind, :states_country_id, country_ids: [], state_ids: []]
181
279
  end
182
280
  end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :integration, class: Spree::Integration do
3
+ type { 'Spree::Integration' }
4
+ store { Spree::Store.default }
5
+ active { true }
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :invitation, class: Spree::Invitation do
3
+ email { FFaker::Internet.email }
4
+ inviter { create(:admin_user) }
5
+ end
6
+ end
@@ -20,9 +20,5 @@ FactoryBot.define do
20
20
  factory :newsletter_page_section, class: Spree::PageSections::Newsletter
21
21
 
22
22
  factory :video_page_section, class: Spree::PageSections::Video
23
-
24
- factory :image_with_text_page_section, class: Spree::PageSections::ImageWithText
25
-
26
- factory :featured_posts_page_section, class: Spree::PageSections::FeaturedPosts
27
23
  end
28
24
  end
@@ -14,11 +14,6 @@ FactoryBot.define do
14
14
  create(:refund, amount: 5, payment: payment)
15
15
  end
16
16
  end
17
-
18
- factory :custom_payment, class: Spree::Payment do
19
- payment_method { create(:custom_payment_method, stores: [order.store]) }
20
- source { create(:payment_source, user: order.user, payment_method: payment_method) }
21
- end
22
17
  end
23
18
 
24
19
  factory :check_payment, class: Spree::Payment do
@@ -37,9 +37,4 @@ FactoryBot.define do
37
37
  active { true }
38
38
  auto_capture { true }
39
39
  end
40
-
41
- factory :custom_payment_method, parent: :payment_method, class: Spree::Gateway::CustomPaymentSourceMethod do
42
- type { 'Spree::Gateway::CustomPaymentSourceMethod' }
43
- name { 'Custom' }
44
- end
45
40
  end
@@ -7,4 +7,8 @@ FactoryBot.define do
7
7
  association :promotion
8
8
  association :calculator, factory: :flat_rate_calculator
9
9
  end
10
+
11
+ factory :promotion_action_create_line_items, class: Spree::Promotion::Actions::CreateLineItems do
12
+ association :promotion
13
+ end
10
14
  end
@@ -30,6 +30,19 @@ FactoryBot.define do
30
30
  first_name { FFaker::Name.first_name }
31
31
  last_name { FFaker::Name.last_name }
32
32
 
33
- spree_roles { [Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin')] }
33
+ transient do
34
+ without_admin_role { false }
35
+ end
36
+
37
+ trait :without_admin_role do
38
+ without_admin_role { true }
39
+ end
40
+
41
+ after(:create) do |user, evaluator|
42
+ unless evaluator.without_admin_role
43
+ admin_role = Spree::Role.default_admin_role
44
+ create(:role_user, user: user, role: admin_role) unless user.has_spree_role?(admin_role.name)
45
+ end
46
+ end
34
47
  end
35
48
  end
@@ -12,14 +12,24 @@ module Spree
12
12
  nullify_translatable_fields = @resource_class.translatable_fields.map { |f| "#{f}=null" }.join(', ')
13
13
 
14
14
  unless @resource_class::Translation.exists?
15
- ActiveRecord::Base.connection.execute("
16
- INSERT INTO #{@translations_table} (#{@translatable_fields}, #{@foreign_key}, locale, created_at, updated_at)
17
- SELECT #{@translatable_fields}, id, '#{@default_locale}' as locale, created_at, updated_at FROM #{@resource_class.table_name};
18
- ")
19
- ActiveRecord::Base.connection.execute("
20
- UPDATE #{@resource_class.table_name}
21
- SET #{nullify_translatable_fields};
22
- ")
15
+ # Copy data from main table to translations table
16
+ @resource_class.find_each do |resource|
17
+ translation_attrs = @resource_class.translatable_fields.each_with_object({}) do |field, attrs|
18
+ attrs[field] = resource[field]
19
+ end
20
+
21
+ @resource_class::Translation.create!(
22
+ translation_attrs.merge(
23
+ @foreign_key => resource.id,
24
+ locale: @default_locale,
25
+ created_at: resource.created_at,
26
+ updated_at: resource.updated_at
27
+ )
28
+ )
29
+ end
30
+
31
+ # Nullify translatable fields in main table
32
+ @resource_class.update_all(nullify_translatable_fields)
23
33
  end
24
34
  end
25
35
 
@@ -27,14 +37,16 @@ module Spree
27
37
  translation_table_fields = @resource_class.translatable_fields.map { |f| "#{@translations_table}.#{f}" }.join(', ')
28
38
  row_expression = @resource_class.translatable_fields.count == 1 ? 'ROW' : ''
29
39
 
30
- ActiveRecord::Base.connection.execute("
31
- UPDATE #{@resource_class.table_name}
32
- SET (#{@translatable_fields}) = #{row_expression}(#{translation_table_fields})
33
- FROM #{@translations_table}
34
- WHERE #{@translations_table}.#{@foreign_key} = #{@resource_class.table_name}.id
35
- ")
40
+ # Update main table with translations
41
+ @resource_class::Translation.find_each do |translation|
42
+ resource = @resource_class.find(translation[@foreign_key])
43
+ @resource_class.translatable_fields.each do |field|
44
+ resource.update_column(field, translation[field])
45
+ end
46
+ end
36
47
 
37
- ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{@translations_table}")
48
+ # Clear translations table
49
+ @resource_class::Translation.delete_all
38
50
  end
39
51
  end
40
52
  end
data/lib/tasks/core.rake CHANGED
@@ -184,6 +184,14 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
184
184
  end
185
185
  end
186
186
  end
187
+
188
+ task migrate_admin_users_to_role_users: :environment do |_t, _args|
189
+ Spree.admin_user_class.all.each do |admin_user|
190
+ Spree::Store.all.each do |store|
191
+ store.add_user(admin_user)
192
+ end
193
+ end
194
+ end
187
195
  end
188
196
 
189
197
  namespace :core do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5
4
+ version: 5.1.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-06-30 00:00:00.000000000 Z
13
+ date: 2025-05-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n-tasks
@@ -526,6 +526,20 @@ dependencies:
526
526
  - - "~>"
527
527
  - !ruby/object:Gem::Version
528
528
  version: 0.3.2
529
+ - !ruby/object:Gem::Dependency
530
+ name: safely_block
531
+ requirement: !ruby/object:Gem::Requirement
532
+ requirements:
533
+ - - "~>"
534
+ - !ruby/object:Gem::Version
535
+ version: '0.4'
536
+ type: :runtime
537
+ prerelease: false
538
+ version_requirements: !ruby/object:Gem::Requirement
539
+ requirements:
540
+ - - "~>"
541
+ - !ruby/object:Gem::Version
542
+ version: '0.4'
529
543
  description: Spree Models, Helpers, Services and core libraries
530
544
  email: hello@spreecommerce.org
531
545
  executables: []
@@ -536,6 +550,7 @@ files:
536
550
  - Rakefile
537
551
  - app/assets/config/spree_core_manifest.js
538
552
  - app/assets/images/google_on_white_hdpi.png
553
+ - app/assets/images/logo.png
539
554
  - app/controllers/spree/base_controller.rb
540
555
  - app/finders/concerns/spree/product_filterable.rb
541
556
  - app/finders/spree/addresses/find.rb
@@ -558,11 +573,13 @@ files:
558
573
  - app/helpers/spree/base_helper.rb
559
574
  - app/helpers/spree/currency_helper.rb
560
575
  - app/helpers/spree/images_helper.rb
576
+ - app/helpers/spree/integrations_helper.rb
561
577
  - app/helpers/spree/locale_helper.rb
562
578
  - app/helpers/spree/mail_helper.rb
563
579
  - app/helpers/spree/products_helper.rb
564
580
  - app/javascript/spree/core/controllers/address_autocomplete_controller.js
565
581
  - app/javascript/spree/core/controllers/address_form_controller.js
582
+ - app/javascript/spree/core/controllers/disable_submit_button_controller.js
566
583
  - app/javascript/spree/core/controllers/enable_button_controller.js
567
584
  - app/javascript/spree/core/helpers/address_autocomplete/google_places_suggestions_provider.js
568
585
  - app/javascript/spree/core/helpers/debounce.js
@@ -581,6 +598,7 @@ files:
581
598
  - app/jobs/spree/variants/remove_line_item_job.rb
582
599
  - app/mailers/spree/base_mailer.rb
583
600
  - app/mailers/spree/export_mailer.rb
601
+ - app/mailers/spree/invitation_mailer.rb
584
602
  - app/mailers/spree/report_mailer.rb
585
603
  - app/mailers/spree/test_mailer.rb
586
604
  - app/models/action_text/rich_text_decorator.rb
@@ -595,6 +613,7 @@ files:
595
613
  - app/models/concerns/spree/has_one_link.rb
596
614
  - app/models/concerns/spree/has_page_links.rb
597
615
  - app/models/concerns/spree/image_methods.rb
616
+ - app/models/concerns/spree/integrations_concern.rb
598
617
  - app/models/concerns/spree/memoized_data.rb
599
618
  - app/models/concerns/spree/metadata.rb
600
619
  - app/models/concerns/spree/multi_searchable.rb
@@ -603,7 +622,6 @@ files:
603
622
  - app/models/concerns/spree/number_as_param.rb
604
623
  - app/models/concerns/spree/number_identifier.rb
605
624
  - app/models/concerns/spree/parameterizable_name.rb
606
- - app/models/concerns/spree/payment_source_concern.rb
607
625
  - app/models/concerns/spree/previewable.rb
608
626
  - app/models/concerns/spree/product_scopes.rb
609
627
  - app/models/concerns/spree/ransackable_attributes.rb
@@ -615,6 +633,7 @@ files:
615
633
  - app/models/concerns/spree/translatable_resource_slug.rb
616
634
  - app/models/concerns/spree/unique_name.rb
617
635
  - app/models/concerns/spree/user_address.rb
636
+ - app/models/concerns/spree/user_management.rb
618
637
  - app/models/concerns/spree/user_methods.rb
619
638
  - app/models/concerns/spree/user_payment_source.rb
620
639
  - app/models/concerns/spree/user_reporting.rb
@@ -667,11 +686,13 @@ files:
667
686
  - app/models/spree/gateway.rb
668
687
  - app/models/spree/gateway/bogus.rb
669
688
  - app/models/spree/gateway/bogus_simple.rb
670
- - app/models/spree/gateway/custom_payment_source_method.rb
671
689
  - app/models/spree/gateway_customer.rb
672
690
  - app/models/spree/image.rb
673
691
  - app/models/spree/image/configuration/active_storage.rb
692
+ - app/models/spree/integration.rb
674
693
  - app/models/spree/inventory_unit.rb
694
+ - app/models/spree/invitation.rb
695
+ - app/models/spree/invitations/store.rb
675
696
  - app/models/spree/legacy_user.rb
676
697
  - app/models/spree/line_item.rb
677
698
  - app/models/spree/log_entry.rb
@@ -943,6 +964,7 @@ files:
943
964
  - app/services/spree/checkout/update.rb
944
965
  - app/services/spree/classifications/reposition.rb
945
966
  - app/services/spree/compare_line_items.rb
967
+ - app/services/spree/country_to_timezone.rb
946
968
  - app/services/spree/coupon_codes/bulk_generate.rb
947
969
  - app/services/spree/coupon_codes/coupon_codes_handler.rb
948
970
  - app/services/spree/credit_cards/destroy.rb
@@ -969,13 +991,16 @@ files:
969
991
  - app/services/spree/seeds/all.rb
970
992
  - app/services/spree/seeds/countries.rb
971
993
  - app/services/spree/seeds/default_reimbursement_types.rb
994
+ - app/services/spree/seeds/digital_delivery.rb
972
995
  - app/services/spree/seeds/payment_methods.rb
996
+ - app/services/spree/seeds/returns_environment.rb
973
997
  - app/services/spree/seeds/roles.rb
974
998
  - app/services/spree/seeds/shipping_categories.rb
975
999
  - app/services/spree/seeds/states.rb
976
1000
  - app/services/spree/seeds/stock_locations.rb
977
1001
  - app/services/spree/seeds/store_credit_categories.rb
978
1002
  - app/services/spree/seeds/stores.rb
1003
+ - app/services/spree/seeds/tax_categories.rb
979
1004
  - app/services/spree/seeds/zones.rb
980
1005
  - app/services/spree/shipments/add_item.rb
981
1006
  - app/services/spree/shipments/change_state.rb
@@ -984,6 +1009,7 @@ files:
984
1009
  - app/services/spree/shipments/remove_item.rb
985
1010
  - app/services/spree/shipments/update.rb
986
1011
  - app/services/spree/stock_locations/stock_items/create.rb
1012
+ - app/services/spree/stores/settings_defaults_by_country.rb
987
1013
  - app/services/spree/tags/bulk_add.rb
988
1014
  - app/services/spree/tags/bulk_remove.rb
989
1015
  - app/services/spree/taxons/add_products.rb
@@ -1009,6 +1035,8 @@ files:
1009
1035
  - app/views/spree/addresses/_form.html.erb
1010
1036
  - app/views/spree/addresses/_suggestions_box.erb
1011
1037
  - app/views/spree/export_mailer/export_done.html.erb
1038
+ - app/views/spree/invitation_mailer/invitation_accepted.html.erb
1039
+ - app/views/spree/invitation_mailer/invitation_email.html.erb
1012
1040
  - app/views/spree/report_mailer/report_done.html.erb
1013
1041
  - app/views/spree/shared/_base_mailer_footer.html.erb
1014
1042
  - app/views/spree/shared/_base_mailer_header.html.erb
@@ -1126,6 +1154,11 @@ files:
1126
1154
  - db/migrate/20250313104226_add_user_type_to_spree_role_users.rb
1127
1155
  - db/migrate/20250313175830_add_unique_index_on_promotion_action_line_items.rb
1128
1156
  - db/migrate/20250314144210_create_spree_taggings_and_spree_tags.rb
1157
+ - db/migrate/20250407085228_create_spree_integrations.rb
1158
+ - db/migrate/20250410061306_create_spree_invitations.rb
1159
+ - db/migrate/20250418174652_add_resource_to_spree_role_users.rb
1160
+ - db/migrate/20250508060800_add_selected_locale_to_spree_admin_users.rb
1161
+ - db/migrate/20250509143831_add_session_id_to_spree_assets.rb
1129
1162
  - db/seeds.rb
1130
1163
  - lib/friendly_id/paranoia.rb
1131
1164
  - lib/generators/spree/authentication/custom/custom_generator.rb
@@ -1218,7 +1251,9 @@ files:
1218
1251
  - lib/spree/testing_support/factories/gateway_customer_factory.rb
1219
1252
  - lib/spree/testing_support/factories/google_data_feed_factory.rb
1220
1253
  - lib/spree/testing_support/factories/image_factory.rb
1254
+ - lib/spree/testing_support/factories/integration_factory.rb
1221
1255
  - lib/spree/testing_support/factories/inventory_unit_factory.rb
1256
+ - lib/spree/testing_support/factories/invitation_factory.rb
1222
1257
  - lib/spree/testing_support/factories/line_item_factory.rb
1223
1258
  - lib/spree/testing_support/factories/log_entry_factory.rb
1224
1259
  - lib/spree/testing_support/factories/options_factory.rb
@@ -1231,7 +1266,6 @@ files:
1231
1266
  - lib/spree/testing_support/factories/payment_capture_event_factory.rb
1232
1267
  - lib/spree/testing_support/factories/payment_factory.rb
1233
1268
  - lib/spree/testing_support/factories/payment_method_factory.rb
1234
- - lib/spree/testing_support/factories/payment_source_factory.rb
1235
1269
  - lib/spree/testing_support/factories/post_category_factory.rb
1236
1270
  - lib/spree/testing_support/factories/post_factory.rb
1237
1271
  - lib/spree/testing_support/factories/price_factory.rb
@@ -1311,9 +1345,9 @@ licenses:
1311
1345
  - BSD-3-Clause
1312
1346
  metadata:
1313
1347
  bug_tracker_uri: https://github.com/spree/spree/issues
1314
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.0.5
1348
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.1.0.beta
1315
1349
  documentation_uri: https://docs.spreecommerce.org/
1316
- source_code_uri: https://github.com/spree/spree/tree/v5.0.5
1350
+ source_code_uri: https://github.com/spree/spree/tree/v5.1.0.beta
1317
1351
  post_install_message:
1318
1352
  rdoc_options: []
1319
1353
  require_paths:
@@ -1,39 +0,0 @@
1
- module Spree
2
- module PaymentSourceConcern
3
- extend ActiveSupport::Concern
4
-
5
- # Available actions for the payment source.
6
- # @return [Array<String>]
7
- def actions
8
- %w{capture void credit}
9
- end
10
-
11
- # Indicates whether its possible to capture the payment
12
- # @param payment [Spree::Payment]
13
- # @return [Boolean]
14
- def can_capture?(payment)
15
- payment.pending? || payment.checkout?
16
- end
17
-
18
- # Indicates whether its possible to void the payment.
19
- # @param payment [Spree::Payment]
20
- # @return [Boolean]
21
- def can_void?(payment)
22
- !payment.failed? && !payment.void?
23
- end
24
-
25
- # Indicates whether its possible to credit the payment. Note that most gateways require that the
26
- # payment be settled first which generally happens within 12-24 hours of the transaction.
27
- # @param payment [Spree::Payment]
28
- # @return [Boolean]
29
- def can_credit?(payment)
30
- payment.completed? && payment.credit_allowed > 0
31
- end
32
-
33
- # Returns true if the payment source has a payment profile.
34
- # @return [Boolean]
35
- def has_payment_profile?
36
- gateway_customer_profile_id.present? || gateway_payment_profile_id.present?
37
- end
38
- end
39
- end
@@ -1,33 +0,0 @@
1
- module Spree
2
- class Gateway::CustomPaymentSourceMethod < Gateway
3
- def provider_class
4
- self.class
5
- end
6
-
7
- def payment_source_class
8
- Spree::PaymentSource
9
- end
10
-
11
- def payment_profiles_supported?
12
- true
13
- end
14
-
15
- def show_in_admin?
16
- false
17
- end
18
-
19
- def create_profile(payment)
20
- return if payment.source.gateway_customer.present?
21
-
22
- user = payment.source.user || payment.order.user
23
- return if user.blank?
24
-
25
- find_or_create_customer(user)
26
- end
27
-
28
- # simulate a 3rd party payment gateway api to fetch/or create a customer
29
- def find_or_create_customer(user)
30
- gateway_customers.find_or_create_by!(user: user, profile_id: "CUSTOMER-#{user.id}")
31
- end
32
- end
33
- end