spree_core 5.0.7 → 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.
- checksums.yaml +4 -4
- data/app/assets/images/logo.png +0 -0
- data/app/finders/spree/products/find.rb +28 -1
- data/app/finders/spree/taxons/find.rb +1 -1
- data/app/helpers/spree/base_helper.rb +1 -6
- data/app/helpers/spree/images_helper.rb +12 -13
- data/app/helpers/spree/integrations_helper.rb +15 -0
- data/app/helpers/spree/mail_helper.rb +3 -4
- data/app/javascript/spree/core/controllers/disable_submit_button_controller.js +19 -0
- data/app/mailers/spree/invitation_mailer.rb +24 -0
- data/app/models/concerns/spree/integrations_concern.rb +11 -0
- data/app/models/concerns/spree/product_scopes.rb +6 -6
- data/app/models/concerns/spree/translatable_resource.rb +4 -0
- data/app/models/concerns/spree/translatable_resource_scopes.rb +17 -3
- data/app/models/concerns/spree/unique_name.rb +2 -0
- data/app/models/concerns/spree/user_management.rb +33 -0
- data/app/models/concerns/spree/user_methods.rb +19 -0
- data/app/models/concerns/spree/user_roles.rb +43 -17
- data/app/models/spree/ability.rb +9 -8
- data/app/models/spree/asset.rb +1 -6
- data/app/models/spree/base.rb +1 -0
- data/app/models/spree/base_analytics_event_handler.rb +7 -2
- data/app/models/spree/classification.rb +13 -0
- data/app/models/spree/credit_card.rb +24 -2
- data/app/models/spree/custom_domain.rb +3 -2
- data/app/models/spree/export.rb +1 -1
- data/app/models/spree/integration.rb +63 -0
- data/app/models/spree/invitation.rb +153 -0
- data/app/models/spree/invitations/store.rb +6 -0
- data/app/models/spree/option_value.rb +2 -2
- data/app/models/spree/order.rb +16 -5
- data/app/models/spree/order_merger.rb +7 -5
- data/app/models/spree/page_sections/featured_posts.rb +0 -4
- data/app/models/spree/payment.rb +1 -2
- data/app/models/spree/payment_source.rb +0 -21
- data/app/models/spree/post.rb +0 -1
- data/app/models/spree/product.rb +75 -5
- data/app/models/spree/product_property.rb +1 -1
- data/app/models/spree/promotion/rules/item_total.rb +12 -12
- data/app/models/spree/property.rb +3 -1
- data/app/models/spree/reports/sales_total.rb +5 -1
- data/app/models/spree/role.rb +16 -0
- data/app/models/spree/role_user.rb +32 -1
- data/app/models/spree/shipment_handler.rb +1 -0
- data/app/models/spree/shipping_method.rb +2 -2
- data/app/models/spree/store.rb +9 -4
- data/app/models/spree/store_credit_category.rb +4 -0
- data/app/models/spree/taxon.rb +4 -7
- data/app/models/spree/theme.rb +1 -1
- data/app/models/spree/wishlist.rb +0 -7
- data/app/services/spree/checkout/update.rb +0 -24
- data/app/services/spree/country_to_timezone.rb +273 -0
- data/app/services/spree/products/prepare_nested_attributes.rb +2 -9
- data/app/services/spree/seeds/admin_user.rb +4 -2
- data/app/services/spree/seeds/all.rb +3 -1
- data/app/services/spree/seeds/digital_delivery.rb +20 -0
- data/app/services/spree/seeds/returns_environment.rb +27 -0
- data/app/services/spree/seeds/tax_categories.rb +12 -0
- data/app/services/spree/stores/settings_defaults_by_country.rb +38 -0
- data/app/services/spree/tags/bulk_add.rb +13 -7
- data/app/views/spree/addresses/_form.html.erb +1 -1
- data/app/views/spree/invitation_mailer/invitation_accepted.html.erb +12 -0
- data/app/views/spree/invitation_mailer/invitation_email.html.erb +21 -0
- data/app/views/spree/shared/_payment.html.erb +0 -9
- data/config/locales/en.yml +48 -21
- data/db/migrate/20250407085228_create_spree_integrations.rb +12 -0
- data/db/migrate/20250410061306_create_spree_invitations.rb +20 -0
- data/db/migrate/20250418174652_add_resource_to_spree_role_users.rb +8 -0
- data/db/migrate/20250508060800_add_selected_locale_to_spree_admin_users.rb +8 -0
- data/db/migrate/20250509143831_add_session_id_to_spree_assets.rb +5 -0
- data/lib/generators/spree/authentication/devise/templates/authentication_helpers.rb.tt +3 -3
- data/lib/spree/core/controller_helpers/auth.rb +15 -14
- data/lib/spree/core/controller_helpers/currency.rb +11 -0
- data/lib/spree/core/controller_helpers/strong_parameters.rb +3 -2
- data/lib/spree/core/engine.rb +13 -3
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +1 -0
- data/lib/spree/permitted_attributes.rb +111 -13
- data/lib/spree/testing_support/common_rake.rb +7 -25
- data/lib/spree/testing_support/extension_rake.rb +1 -1
- data/lib/spree/testing_support/factories/integration_factory.rb +7 -0
- data/lib/spree/testing_support/factories/invitation_factory.rb +6 -0
- data/lib/spree/testing_support/factories/page_section_factory.rb +0 -4
- data/lib/spree/testing_support/factories/payment_factory.rb +0 -5
- data/lib/spree/testing_support/factories/payment_method_factory.rb +0 -5
- data/lib/spree/testing_support/factories/promotion_action_factory.rb +4 -0
- data/lib/spree/testing_support/factories/taxon_factory.rb +0 -6
- data/lib/spree/testing_support/factories/user_factory.rb +14 -1
- data/lib/spree/translation_migrations.rb +27 -15
- data/lib/tasks/core.rake +8 -0
- metadata +41 -8
- data/app/models/concerns/spree/payment_source_concern.rb +0 -39
- data/app/models/spree/gateway/custom_payment_source_method.rb +0 -33
- data/app/models/spree/product/slugs.rb +0 -112
- data/lib/spree/testing_support/factories/payment_source_factory.rb +0 -5
|
@@ -16,7 +16,19 @@ module Spree
|
|
|
16
16
|
|
|
17
17
|
record_class = records.first.class
|
|
18
18
|
|
|
19
|
-
taggings_to_upsert = records
|
|
19
|
+
taggings_to_upsert = taggings_attributes(tags, records, context: context, record_class: record_class)
|
|
20
|
+
|
|
21
|
+
return if taggings_to_upsert.empty?
|
|
22
|
+
|
|
23
|
+
ActsAsTaggableOn::Tagging.insert_all(taggings_to_upsert)
|
|
24
|
+
|
|
25
|
+
record_class.where(id: records.pluck(:id)).touch_all
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def taggings_attributes(tags, records, context:, record_class:)
|
|
31
|
+
records.pluck(:id).map do |record_id|
|
|
20
32
|
tags.map do |tag|
|
|
21
33
|
{
|
|
22
34
|
taggable_id: record_id,
|
|
@@ -26,12 +38,6 @@ module Spree
|
|
|
26
38
|
}
|
|
27
39
|
end
|
|
28
40
|
end.flatten.compact
|
|
29
|
-
|
|
30
|
-
return if taggings_to_upsert.empty?
|
|
31
|
-
|
|
32
|
-
ActsAsTaggableOn::Tagging.insert_all(taggings_to_upsert)
|
|
33
|
-
|
|
34
|
-
record_class.where(id: records.pluck(:id)).touch_all
|
|
35
41
|
end
|
|
36
42
|
end
|
|
37
43
|
end
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
data-controller="address-form address-autocomplete"
|
|
6
6
|
data-address-form-countries-value="<%= available_countries.to_json %>"
|
|
7
7
|
data-address-form-states-value="<%= available_states.to_json %>"
|
|
8
|
-
data-address-form-current-state-id-value="<%= address.state_id
|
|
8
|
+
data-address-form-current-state-id-value="<%= address.state_id %>"
|
|
9
9
|
>
|
|
10
10
|
<div id="<%= "#{address_id}country" %>">
|
|
11
11
|
<div class="form-group mb-0">
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<h1>
|
|
2
|
+
<%= Spree.t('invitation_mailer.greeting', user_name: @invitation.inviter.first_name) %>
|
|
3
|
+
</h1>
|
|
4
|
+
<p>
|
|
5
|
+
<%= Spree.t('invitation_mailer.invitation_accepted.body', invitee_name: @invitation.invitee&.name, resource_name: @invitation.resource.name) %>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p>
|
|
9
|
+
<%= Spree.t('invitation_mailer.thanks') %><br />
|
|
10
|
+
<%= current_store.name %>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<h1>
|
|
2
|
+
<%= Spree.t('invitation_mailer.greeting', user_name: @invitation.invitee&.first_name || @invitation.email) %>
|
|
3
|
+
</h1>
|
|
4
|
+
<p>
|
|
5
|
+
<%= Spree.t('invitation_mailer.invitation_email.body', inviter_name: @invitation.inviter.name, resource_name: @invitation.resource.name) %>
|
|
6
|
+
</p>
|
|
7
|
+
<p>
|
|
8
|
+
<%= Spree.t('invitation_mailer.invitation_email.link_description') %>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<% if spree.respond_to?(:admin_invitation_url) %>
|
|
12
|
+
<p>
|
|
13
|
+
<%= link_to Spree.t('invitation_mailer.invitation_email.link_text'), spree.admin_invitation_url(@invitation, token: @invitation.token, host: @invitation.store.formatted_url) %>
|
|
14
|
+
</p>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<p>
|
|
18
|
+
<%= Spree.t('invitation_mailer.thanks') %><br />
|
|
19
|
+
<%= current_store.name %>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
@@ -30,15 +30,6 @@
|
|
|
30
30
|
<div class="flex-shrink-0">
|
|
31
31
|
<%= payment_method_icon_tag source.class.to_s.demodulize.downcase, height: 30 %>
|
|
32
32
|
</div>
|
|
33
|
-
<div>
|
|
34
|
-
<% if payment.payment_method.respond_to?(:source_partial_name) %>
|
|
35
|
-
<%= render partial: "spree/payment_sources/#{payment.payment_method.source_partial_name}", locals: { payment: payment, source: source } %>
|
|
36
|
-
<% elsif source.respond_to?(:name) %>
|
|
37
|
-
<%= source.name %>
|
|
38
|
-
<% else %>
|
|
39
|
-
<%= source.class.to_s.demodulize.downcase %>
|
|
40
|
-
<% end %>
|
|
41
|
-
</div>
|
|
42
33
|
<% else %>
|
|
43
34
|
<div class="flex-shrink-0">
|
|
44
35
|
<%= payment_method_icon_tag payment.payment_method.payment_icon_name %>
|
data/config/locales/en.yml
CHANGED
|
@@ -52,6 +52,9 @@ en:
|
|
|
52
52
|
year: Year
|
|
53
53
|
spree/inventory_unit:
|
|
54
54
|
state: State
|
|
55
|
+
spree/invitation:
|
|
56
|
+
expires_at: Expires at
|
|
57
|
+
inviter: Inviter
|
|
55
58
|
spree/line_item:
|
|
56
59
|
price: Price
|
|
57
60
|
quantity: Quantity
|
|
@@ -194,6 +197,10 @@ en:
|
|
|
194
197
|
spree/zone:
|
|
195
198
|
description: Description
|
|
196
199
|
name: Name
|
|
200
|
+
user:
|
|
201
|
+
current_sign_in: Current sign in at
|
|
202
|
+
last_sign_in: Last sign in at
|
|
203
|
+
sign_in_count: Sign in count
|
|
197
204
|
errors:
|
|
198
205
|
messages:
|
|
199
206
|
blank: can't be blank
|
|
@@ -334,6 +341,9 @@ en:
|
|
|
334
341
|
spree/export:
|
|
335
342
|
one: Export
|
|
336
343
|
other: Exports
|
|
344
|
+
spree/integration:
|
|
345
|
+
one: Integration
|
|
346
|
+
other: Integrations
|
|
337
347
|
spree/inventory_unit:
|
|
338
348
|
one: Inventory Unit
|
|
339
349
|
other: Inventory Units
|
|
@@ -349,6 +359,18 @@ en:
|
|
|
349
359
|
spree/order:
|
|
350
360
|
one: Order
|
|
351
361
|
other: Orders
|
|
362
|
+
spree/page:
|
|
363
|
+
one: Page
|
|
364
|
+
other: Pages
|
|
365
|
+
spree/page_block:
|
|
366
|
+
one: Page Block
|
|
367
|
+
other: Page Blocks
|
|
368
|
+
spree/page_link:
|
|
369
|
+
one: Page Link
|
|
370
|
+
other: Page Links
|
|
371
|
+
spree/page_section:
|
|
372
|
+
one: Page Section
|
|
373
|
+
other: Page Sections
|
|
352
374
|
spree/payment:
|
|
353
375
|
one: Payment
|
|
354
376
|
other: Payments
|
|
@@ -526,7 +548,6 @@ en:
|
|
|
526
548
|
accepts_email_marketing: Accepts email marketing
|
|
527
549
|
account: Account
|
|
528
550
|
account_info: Account info
|
|
529
|
-
account_members: Team
|
|
530
551
|
action: Action
|
|
531
552
|
actions:
|
|
532
553
|
approve: Approve
|
|
@@ -546,6 +567,7 @@ en:
|
|
|
546
567
|
receive: Mark as received
|
|
547
568
|
refund: Refund
|
|
548
569
|
reject: Reject
|
|
570
|
+
resend: Resend
|
|
549
571
|
resolve: Mark as resolved
|
|
550
572
|
save: Save
|
|
551
573
|
select_file: Select file
|
|
@@ -608,7 +630,6 @@ en:
|
|
|
608
630
|
successfully_updated: Updated successfully
|
|
609
631
|
unsuccessfully_saved: There was an error while trying to save your address.
|
|
610
632
|
unsuccessfully_updated: There was an update while trying to update your address.
|
|
611
|
-
address_not_owned_by_user: The specified address does not belong to this user.
|
|
612
633
|
addresses: Addresses
|
|
613
634
|
adjustable: Adjustable
|
|
614
635
|
adjustment: Adjustment
|
|
@@ -717,7 +738,6 @@ en:
|
|
|
717
738
|
capture: Capture
|
|
718
739
|
capture_events: Capture events
|
|
719
740
|
card_code: Card Verification Code (CVC)
|
|
720
|
-
card_expiration_placeholder: MM/YYYY
|
|
721
741
|
card_number: Card Number
|
|
722
742
|
card_type: Brand
|
|
723
743
|
card_type_is: Card type is
|
|
@@ -786,6 +806,7 @@ en:
|
|
|
786
806
|
continue_as_guest: Continue as a guest
|
|
787
807
|
continue_selling_when_out_of_stock: Continue selling when out of stock
|
|
788
808
|
continue_shopping: Continue shopping
|
|
809
|
+
continue_without_logging_in: Continue without logging in
|
|
789
810
|
copy: Copy
|
|
790
811
|
copy_id: Copy ID
|
|
791
812
|
copy_link: Copy link
|
|
@@ -821,14 +842,13 @@ en:
|
|
|
821
842
|
coupon_codes: Coupon codes
|
|
822
843
|
create: Create
|
|
823
844
|
create_a_new_account: Create a new account
|
|
824
|
-
create_account: Create account
|
|
825
845
|
create_customer: Create customer
|
|
826
846
|
create_new: Create new
|
|
827
847
|
create_new_order: Create new order
|
|
828
848
|
create_new_team: Create new team
|
|
829
849
|
create_reimbursement: Create reimbursement
|
|
830
|
-
created_at: Created
|
|
831
|
-
created_by: Created
|
|
850
|
+
created_at: Created at
|
|
851
|
+
created_by: Created by
|
|
832
852
|
credit: Credit
|
|
833
853
|
credit_allowed: Credit allowed
|
|
834
854
|
credit_card: Credit Card
|
|
@@ -893,8 +913,6 @@ en:
|
|
|
893
913
|
destroy: Destroy
|
|
894
914
|
details: Details
|
|
895
915
|
developers: Developers
|
|
896
|
-
didn_t_receive_confirmation_instructions: Didn't receive confirmation instructions?
|
|
897
|
-
didn_t_receive_unlock_instructions: Didn't receive unlock instructions?
|
|
898
916
|
digital:
|
|
899
917
|
digital_delivery: Digital Delivery
|
|
900
918
|
digital_assets: Digital assets
|
|
@@ -1126,6 +1144,7 @@ en:
|
|
|
1126
1144
|
internationalization: Internationalization
|
|
1127
1145
|
invalid_credit_card: Invalid credit card.
|
|
1128
1146
|
invalid_exchange_variant: Invalid exchange variant.
|
|
1147
|
+
invalid_or_expired_invitation: Invalid or expired invitation
|
|
1129
1148
|
invalid_payment_provider: Invalid payment provider.
|
|
1130
1149
|
invalid_promotion_action: Invalid promotion action.
|
|
1131
1150
|
invalid_promotion_rule: Invalid promotion rule.
|
|
@@ -1133,6 +1152,20 @@ en:
|
|
|
1133
1152
|
inventory_adjustment: Inventory Adjustment
|
|
1134
1153
|
inventory_error_flash_for_insufficient_quantity: An item in your cart has become unavailable.
|
|
1135
1154
|
inventory_state: Inventory State
|
|
1155
|
+
invitation_accepted: Invitation accepted!
|
|
1156
|
+
invitation_mailer:
|
|
1157
|
+
greeting: Hi %{user_name},
|
|
1158
|
+
invitation_accepted:
|
|
1159
|
+
body: "%{invitee_name} has accepted your invitation to join %{resource_name}"
|
|
1160
|
+
subject: "%{invitee_name} has accepted your invitation to join %{resource_name}"
|
|
1161
|
+
invitation_email:
|
|
1162
|
+
body: "%{inviter_name} has invited you to join %{resource_name}"
|
|
1163
|
+
link_description: 'To accept this invitation, please click the link below:'
|
|
1164
|
+
subject: Invitation to join %{resource_name}
|
|
1165
|
+
thanks: Thank you,
|
|
1166
|
+
invitation_resent: Invitation resent!
|
|
1167
|
+
invitations: Invitations
|
|
1168
|
+
invited_by: Invited by
|
|
1136
1169
|
is_not_available_to_shipment_address: is not available to shipment address
|
|
1137
1170
|
iso: ISO Alpha-2
|
|
1138
1171
|
iso3: ISO Alpha-3
|
|
@@ -1168,7 +1201,6 @@ en:
|
|
|
1168
1201
|
list: List
|
|
1169
1202
|
live: Live
|
|
1170
1203
|
loading: Loading
|
|
1171
|
-
loading_tree: Loading tree. Please wait…
|
|
1172
1204
|
locale_changed: Locale Changed
|
|
1173
1205
|
location: Location
|
|
1174
1206
|
lock: Lock
|
|
@@ -1183,7 +1215,6 @@ en:
|
|
|
1183
1215
|
login_failed: Login authentication failed.
|
|
1184
1216
|
login_name: Login
|
|
1185
1217
|
logo: Logo
|
|
1186
|
-
logo_alt: Brand logo
|
|
1187
1218
|
logout: Logout
|
|
1188
1219
|
logs: Logs
|
|
1189
1220
|
look_for_similar_items: Look for similar items
|
|
@@ -1212,9 +1243,6 @@ en:
|
|
|
1212
1243
|
metadata: Metadata
|
|
1213
1244
|
min: Min
|
|
1214
1245
|
minimal_amount: Minimal Amount
|
|
1215
|
-
minimum_password_length:
|
|
1216
|
-
one: "(%{count} character minimum)"
|
|
1217
|
-
other: "(%{count} characters minimum)"
|
|
1218
1246
|
missing_return_authorization: Missing Return Authorization for %{item_name}.
|
|
1219
1247
|
month: Month
|
|
1220
1248
|
more: More
|
|
@@ -1240,7 +1268,7 @@ en:
|
|
|
1240
1268
|
new_billing_address: New Billing Address
|
|
1241
1269
|
new_country: New Country
|
|
1242
1270
|
new_custom_domain: New Custom Domain
|
|
1243
|
-
new_customer:
|
|
1271
|
+
new_customer: New Customer
|
|
1244
1272
|
new_customer_return: New Customer Return
|
|
1245
1273
|
new_digital_asset: New digital asset
|
|
1246
1274
|
new_domain: New domain
|
|
@@ -1469,7 +1497,6 @@ en:
|
|
|
1469
1497
|
video:
|
|
1470
1498
|
heading_1_default: Why I recommend it?
|
|
1471
1499
|
heading_2_default: There's nothing like a soft hint of blush to add dimension and color to your look.
|
|
1472
|
-
page_settings: Page settings
|
|
1473
1500
|
pages: Pages
|
|
1474
1501
|
pages_defaults:
|
|
1475
1502
|
homepage:
|
|
@@ -1488,7 +1515,7 @@ en:
|
|
|
1488
1515
|
password_protected: Password protected
|
|
1489
1516
|
paste: Paste
|
|
1490
1517
|
path: Path
|
|
1491
|
-
pay:
|
|
1518
|
+
pay: pay
|
|
1492
1519
|
payment: Payment
|
|
1493
1520
|
payment_amount: Payment amount
|
|
1494
1521
|
payment_attempts: failed attempts
|
|
@@ -1505,11 +1532,11 @@ en:
|
|
|
1505
1532
|
payment_source: Payment source
|
|
1506
1533
|
payment_state: Payment State
|
|
1507
1534
|
payment_states:
|
|
1508
|
-
balance_due: Balance
|
|
1535
|
+
balance_due: Balance due
|
|
1509
1536
|
checkout: Checkout
|
|
1510
1537
|
complete: Complete
|
|
1511
1538
|
completed: Completed
|
|
1512
|
-
credit_owed: Credit
|
|
1539
|
+
credit_owed: Credit owed
|
|
1513
1540
|
failed: Failed
|
|
1514
1541
|
paid: Paid
|
|
1515
1542
|
partially_refunded: Partially Refunded
|
|
@@ -1527,12 +1554,15 @@ en:
|
|
|
1527
1554
|
percent: Percent
|
|
1528
1555
|
percent_per_item: Percent Per Item
|
|
1529
1556
|
permalink: Permalink
|
|
1557
|
+
permissions: Permissions
|
|
1530
1558
|
personal_details: Personal details
|
|
1531
1559
|
phone: Phone
|
|
1532
1560
|
place_order: Place Order
|
|
1533
1561
|
please_check_back_soon: Please check back soon.
|
|
1534
1562
|
please_define_payment_methods: Please define some payment methods first.
|
|
1535
1563
|
please_enter_reasonable_quantity: Please enter a reasonable quantity.
|
|
1564
|
+
please_select: Please select
|
|
1565
|
+
please_select_all_options: Please select all options
|
|
1536
1566
|
policies: Policies
|
|
1537
1567
|
populate_get_error: Something went wrong. Please try adding the item again.
|
|
1538
1568
|
post_categories: Post categories
|
|
@@ -1883,7 +1913,6 @@ en:
|
|
|
1883
1913
|
show_store_selector:
|
|
1884
1914
|
long: Display the Store selector in the main nav bar of Storefront and allow users to change Store and Currency
|
|
1885
1915
|
short: Show Store selector
|
|
1886
|
-
sign_in_with_provider: Sign in with %{provider}
|
|
1887
1916
|
sign_out: Sign out
|
|
1888
1917
|
sign_up: Sign Up
|
|
1889
1918
|
site_name: Site name
|
|
@@ -2104,7 +2133,6 @@ en:
|
|
|
2104
2133
|
timezone: Timezone
|
|
2105
2134
|
title: Title
|
|
2106
2135
|
title_link: Title link
|
|
2107
|
-
to: To
|
|
2108
2136
|
to_add_variants_you_must_first_define: To add variants, you must first define
|
|
2109
2137
|
toggle_menu: Toggle menu
|
|
2110
2138
|
top_suggestions: Top suggestions
|
|
@@ -2150,7 +2178,6 @@ en:
|
|
|
2150
2178
|
update_billing_address: Update billing address
|
|
2151
2179
|
update_contact_information: Update contact information
|
|
2152
2180
|
update_shipping_address: Update shipping address
|
|
2153
|
-
updated: Updated
|
|
2154
2181
|
updated_at: Updated at
|
|
2155
2182
|
updating: Updating
|
|
2156
2183
|
upload_image: Upload image
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class CreateSpreeIntegrations < ActiveRecord::Migration[7.2]
|
|
2
|
+
def change
|
|
3
|
+
create_table :spree_integrations, if_not_exists: true do |t|
|
|
4
|
+
t.references :store, null: false, index: true
|
|
5
|
+
t.string :type, null: false, index: true
|
|
6
|
+
t.text :preferences
|
|
7
|
+
t.boolean :active, default: false, null: false, index: true
|
|
8
|
+
|
|
9
|
+
t.timestamps
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class CreateSpreeInvitations < ActiveRecord::Migration[7.2]
|
|
2
|
+
def change
|
|
3
|
+
create_table :spree_invitations do |t|
|
|
4
|
+
t.string :email, index: true, null: false
|
|
5
|
+
t.string :token, index: { unique: true }, null: false
|
|
6
|
+
t.string :status, null: false, index: true
|
|
7
|
+
|
|
8
|
+
t.references :resource, polymorphic: true, index: true, null: false # eg. Store, Vendor, Account
|
|
9
|
+
t.references :inviter, polymorphic: true, index: true, null: false
|
|
10
|
+
t.references :invitee, polymorphic: true, index: true
|
|
11
|
+
t.references :role, null: false
|
|
12
|
+
|
|
13
|
+
t.datetime :accepted_at
|
|
14
|
+
t.datetime :expires_at, index: true
|
|
15
|
+
t.datetime :deleted_at, index: true
|
|
16
|
+
|
|
17
|
+
t.timestamps
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class AddResourceToSpreeRoleUsers < ActiveRecord::Migration[7.2]
|
|
2
|
+
def change
|
|
3
|
+
add_reference :spree_role_users, :resource, polymorphic: true, null: true
|
|
4
|
+
add_reference :spree_role_users, :invitation, null: true
|
|
5
|
+
|
|
6
|
+
add_index :spree_role_users, [:resource_id, :resource_type, :user_id, :user_type, :role_id], unique: true
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class AddSelectedLocaleToSpreeAdminUsers < ActiveRecord::Migration[7.2]
|
|
2
|
+
def change
|
|
3
|
+
if Spree.admin_user_class.present?
|
|
4
|
+
users_table_name = Spree.admin_user_class.table_name
|
|
5
|
+
add_column users_table_name, :selected_locale, :string unless column_exists?(users_table_name, :selected_locale)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -38,13 +38,13 @@ module Spree
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def spree_admin_login_path(opts = {})
|
|
41
|
-
|
|
41
|
+
new_session_path(Spree.admin_user_class.model_name.singular_route_key, opts)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def spree_admin_logout_path(opts = {})
|
|
45
|
-
|
|
45
|
+
destroy_session_path(Spree.admin_user_class.model_name.singular_route_key, opts)
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
ApplicationController.include Spree::AuthenticationHelpers if defined?(ApplicationController)
|
|
50
|
+
ApplicationController.include Spree::AuthenticationHelpers if defined?(ApplicationController)
|
|
@@ -17,12 +17,12 @@ module Spree
|
|
|
17
17
|
|
|
18
18
|
# Needs to be overridden so that we use Spree's Ability rather than anyone else's.
|
|
19
19
|
def current_ability
|
|
20
|
-
@current_ability ||= Spree::Dependencies.ability_class.constantize.new(try_spree_current_user)
|
|
20
|
+
@current_ability ||= Spree::Dependencies.ability_class.constantize.new(try_spree_current_user, { store: current_store })
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def redirect_back_or_default(default)
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
Spree::Deprecation.warn('redirect_back_or_default is deprecated and will be removed in Spree 5.2. Please use redirect_back(fallback_location: default) instead.')
|
|
25
|
+
redirect_back(fallback_location: default)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def set_token
|
|
@@ -44,18 +44,19 @@ module Spree
|
|
|
44
44
|
@current_oauth_token ||= get_last_access_token.call(user) || create_access_token.call(user)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
authentication_routes.each do |route|
|
|
52
|
-
disallowed_urls << send(route) if respond_to?(route)
|
|
53
|
-
end
|
|
47
|
+
# this will work for devise out of the box
|
|
48
|
+
# for other auth systems you will need to override this method
|
|
49
|
+
def store_location(location = nil)
|
|
50
|
+
return if try_spree_current_user
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
location ||= request.fullpath
|
|
53
|
+
session_key = store_location_session_key
|
|
54
|
+
|
|
55
|
+
session[session_key] = location
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def store_location_session_key
|
|
59
|
+
"#{Spree.user_class.model_name.singular_route_key.to_sym}_return_to"
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
# proxy method to *possible* spree_current_user method
|
|
@@ -14,6 +14,8 @@ module Spree
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Returns the currently selected currency.
|
|
18
|
+
# @return [String] the currently selected currency, eg. `USD`
|
|
17
19
|
def current_currency
|
|
18
20
|
@current_currency ||= if defined?(session) && session.key?(:currency) && supported_currency?(session[:currency])
|
|
19
21
|
session[:currency]
|
|
@@ -26,10 +28,14 @@ module Spree
|
|
|
26
28
|
end&.upcase
|
|
27
29
|
end
|
|
28
30
|
|
|
31
|
+
# Returns the list of supported currencies for the current store.
|
|
32
|
+
# @return [Array<Money::Currency>] the list of supported currencies
|
|
29
33
|
def supported_currencies
|
|
30
34
|
@supported_currencies ||= current_store&.supported_currencies_list
|
|
31
35
|
end
|
|
32
36
|
|
|
37
|
+
# Returns the list of supported currencies for all stores.
|
|
38
|
+
# @return [Array<String>] the list of supported currencies, eg. `["USD", "EUR"]`
|
|
33
39
|
def supported_currencies_for_all_stores
|
|
34
40
|
@supported_currencies_for_all_stores ||= begin
|
|
35
41
|
(
|
|
@@ -39,12 +45,17 @@ module Spree
|
|
|
39
45
|
end
|
|
40
46
|
end
|
|
41
47
|
|
|
48
|
+
# Checks if the given currency is supported.
|
|
49
|
+
# @param currency_iso_code [String] the ISO code of the currency, eg. `USD`
|
|
50
|
+
# @return [Boolean] `true` if the currency is supported, `false` otherwise
|
|
42
51
|
def supported_currency?(currency_iso_code)
|
|
43
52
|
return false if supported_currencies.nil?
|
|
44
53
|
|
|
45
54
|
supported_currencies.map(&:iso_code).include?(currency_iso_code.upcase)
|
|
46
55
|
end
|
|
47
56
|
|
|
57
|
+
# Returns the currency parameter from the request.
|
|
58
|
+
# @return [String] the currency parameter, eg. `USD`
|
|
48
59
|
def currency_param
|
|
49
60
|
return if current_currency == current_store.default_currency
|
|
50
61
|
|
|
@@ -33,8 +33,9 @@ module Spree
|
|
|
33
33
|
|
|
34
34
|
def permitted_product_attributes
|
|
35
35
|
permitted_attributes.product_attributes + [
|
|
36
|
-
:
|
|
37
|
-
|
|
36
|
+
variants_attributes: permitted_variant_attributes + ['id', :_destroy],
|
|
37
|
+
master_attributes: permitted_variant_attributes + ['id'],
|
|
38
|
+
product_properties_attributes: permitted_product_properties_attributes + ['id', :_destroy]
|
|
38
39
|
]
|
|
39
40
|
end
|
|
40
41
|
|
data/lib/spree/core/engine.rb
CHANGED
|
@@ -21,8 +21,10 @@ module Spree
|
|
|
21
21
|
:page_sections,
|
|
22
22
|
:page_blocks,
|
|
23
23
|
:reports,
|
|
24
|
+
:translatable_resources,
|
|
24
25
|
:analytics_events,
|
|
25
|
-
:analytics_event_handlers
|
|
26
|
+
:analytics_event_handlers,
|
|
27
|
+
:integrations)
|
|
26
28
|
SpreeCalculators = Struct.new(:shipping_methods, :tax_rates, :promotion_actions_create_adjustments, :promotion_actions_create_item_adjustments)
|
|
27
29
|
PromoEnvironment = Struct.new(:rules, :actions)
|
|
28
30
|
isolate_namespace Spree
|
|
@@ -96,7 +98,6 @@ module Spree
|
|
|
96
98
|
Rails.application.config.spree.payment_methods = [
|
|
97
99
|
Spree::Gateway::Bogus,
|
|
98
100
|
Spree::Gateway::BogusSimple,
|
|
99
|
-
Spree::Gateway::CustomPaymentSourceMethod,
|
|
100
101
|
Spree::PaymentMethod::Check,
|
|
101
102
|
Spree::PaymentMethod::StoreCredit
|
|
102
103
|
]
|
|
@@ -235,6 +236,13 @@ module Spree
|
|
|
235
236
|
Spree::Reports::SalesTotal
|
|
236
237
|
]
|
|
237
238
|
|
|
239
|
+
Rails.application.config.spree.translatable_resources = [
|
|
240
|
+
Spree::Product,
|
|
241
|
+
Spree::Taxon,
|
|
242
|
+
Spree::Taxonomy,
|
|
243
|
+
Spree::Store
|
|
244
|
+
]
|
|
245
|
+
|
|
238
246
|
Rails.application.config.spree.analytics_events = {
|
|
239
247
|
product_viewed: 'Product Viewed',
|
|
240
248
|
product_list_viewed: 'Product List Viewed',
|
|
@@ -258,9 +266,11 @@ module Spree
|
|
|
258
266
|
checkout_email_entered: 'Checkout Email Entered',
|
|
259
267
|
checkout_step_viewed: 'Checkout Step Viewed',
|
|
260
268
|
checkout_step_completed: 'Checkout Step Completed',
|
|
261
|
-
order_completed: 'Order Completed'
|
|
269
|
+
order_completed: 'Order Completed',
|
|
262
270
|
}
|
|
263
271
|
Rails.application.config.spree.analytics_event_handlers = []
|
|
272
|
+
|
|
273
|
+
Rails.application.config.spree.integrations = []
|
|
264
274
|
end
|
|
265
275
|
|
|
266
276
|
initializer 'spree.promo.register.promotions.actions' do |app|
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
|
@@ -31,6 +31,7 @@ require 'request_store'
|
|
|
31
31
|
require 'wannabe_bool'
|
|
32
32
|
require 'geocoder'
|
|
33
33
|
require 'oembed'
|
|
34
|
+
require 'safely_block'
|
|
34
35
|
|
|
35
36
|
# This is required because ActiveModel::Validations#invalid? conflicts with the
|
|
36
37
|
# invalid state of a Payment. In the future this should be removed.
|