Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Support the entire invitation - signup flow in Admin SPA

Damian Legawiec5e5e8a380cb1
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yaml
index 5340912608..3e0d0fef7d 100644
--- a/docs/api-reference/admin.yaml
+++ b/docs/api-reference/admin.yaml
@@ -82,11 +82,11 @@ paths:
example:
data:
- id: admin_UkLWZg9DAJ
- first_name: Jamika
- last_name: Green
- created_at: '2026-05-06T19:14:25.646Z'
- updated_at: '2026-05-06T19:14:25.646Z'
+ first_name: Akiko
+ last_name: Gibson
+ created_at: '2026-05-06T21:12:11.889Z'
+ updated_at: '2026-05-06T21:12:11.889Z'
roles:
- id: role_UkLWZg9DAJ
name: admin
@@ -144,11 +144,11 @@ paths:
application/json:
example:
id: admin_UkLWZg9DAJ
- first_name: Keiko
- last_name: Wisoky
- created_at: '2026-05-06T19:14:25.981Z'
- updated_at: '2026-05-06T19:14:25.981Z'
+ first_name: Jerrie
+ last_name: Lueilwitz
+ created_at: '2026-05-06T21:12:12.227Z'
+ updated_at: '2026-05-06T21:12:12.227Z'
roles:
- id: role_UkLWZg9DAJ
name: admin
@@ -201,11 +201,11 @@ paths:
application/json:
example:
id: admin_UkLWZg9DAJ
first_name: Renamed
- last_name: Stark
- created_at: '2026-05-06T19:14:26.296Z'
- updated_at: '2026-05-06T19:14:26.322Z'
+ last_name: Rath
+ created_at: '2026-05-06T21:12:12.556Z'
+ updated_at: '2026-05-06T21:12:12.576Z'
roles:
- id: role_UkLWZg9DAJ
name: admin
@@ -314,32 +314,32 @@ paths:
key_type: publishable
token_prefix:
scopes: []
- created_at: '2026-05-06T19:14:26.624Z'
- updated_at: '2026-05-06T19:14:26.624Z'
+ created_at: '2026-05-06T21:12:12.877Z'
+ updated_at: '2026-05-06T21:12:12.877Z'
revoked_at:
last_used_at:
- plaintext_token: pk_ceNspWKRDdKTXY5b2ZBcx1wa
+ plaintext_token: pk_jtLEBWVqeXqwnrnwMe7XPePW
created_by_email:
- id: key_gbHJdmfrXB
name: Backend integration
key_type: secret
- token_prefix: sk_JBwbUC97E
+ token_prefix: sk_o9W7g6Zdu
scopes:
- write_all
- created_at: '2026-05-06T19:14:26.625Z'
- updated_at: '2026-05-06T19:14:26.625Z'
+ created_at: '2026-05-06T21:12:12.878Z'
+ updated_at: '2026-05-06T21:12:12.878Z'
revoked_at:
last_used_at:
plaintext_token:
created_by_email:
- id: key_EfhxLZ9ck8
- name: non
+ name: officiis
key_type: secret
- token_prefix: sk_aHNiBUfCZ
+ token_prefix: sk_bRwx5fM7c
scopes:
- write_all
- created_at: '2026-05-06T19:14:26.626Z'
- updated_at: '2026-05-06T19:14:26.626Z'
+ created_at: '2026-05-06T21:12:12.879Z'
+ updated_at: '2026-05-06T21:12:12.879Z'
revoked_at:
last_used_at:
plaintext_token:
@@ -402,15 +402,15 @@ paths:
id: key_VqXmZF31wY
name: CI key
key_type: secret
- token_prefix: sk_hFv9z3sTw
+ token_prefix: sk_G3qtCfeaX
scopes:
- read_orders
- created_at: '2026-05-06T19:14:27.192Z'
- updated_at: '2026-05-06T19:14:27.192Z'
+ created_at: '2026-05-06T21:12:13.449Z'
+ updated_at: '2026-05-06T21:12:13.449Z'
revoked_at:
last_used_at:
- plaintext_token: sk_hFv9z3sTw9vXGgqJpSFBc4Ch
- created_by_email: [email protected]
+ plaintext_token: sk_G3qtCfeaXTfUChwdYVRbYXGp
+ created_by_email: [email protected]
'422':
description: validation error
content:
@@ -496,11 +496,11 @@ paths:
key_type: publishable
token_prefix:
scopes: []
- created_at: '2026-05-06T19:14:27.480Z'
- updated_at: '2026-05-06T19:14:27.480Z'
+ created_at: '2026-05-06T21:12:13.738Z'
+ updated_at: '2026-05-06T21:12:13.738Z'
revoked_at:
last_used_at:
- plaintext_token: pk_zBo9Dptd9m1eqzq2tvk2jiWZ
+ plaintext_token: pk_wKAFVz9hkEti83avhmmuc7vm
created_by_email:
delete:
summary: Delete an API key
@@ -590,12 +590,12 @@ paths:
id: key_gbHJdmfrXB
name: Backend integration
key_type: secret
- token_prefix: sk_1tNpCb5UU
+ token_prefix: sk_uSf36YXuL
scopes:
- write_all
- created_at: '2026-05-06T19:14:28.057Z'
- updated_at: '2026-05-06T19:14:28.357Z'
- revoked_at: '2026-05-06T19:14:28.356Z'
+ created_at: '2026-05-06T21:12:14.312Z'
+ updated_at: '2026-05-06T21:12:14.608Z'
+ revoked_at: '2026-05-06T21:12:14.605Z'
last_used_at:
plaintext_token:
created_by_email:
@@ -664,8 +664,8 @@ paths:
field_type: short_text
resource_type: Spree::Product
storefront_visible: true
- created_at: '2026-05-06T19:14:28.376Z'
- updated_at: '2026-05-06T19:14:28.376Z'
+ created_at: '2026-05-06T21:12:14.626Z'
+ updated_at: '2026-05-06T21:12:14.626Z'
- id: cfdef_gbHJdmfrXB
namespace: custom
key: order_notes
@@ -673,8 +673,8 @@ paths:
field_type: short_text
resource_type: Spree::Order
storefront_visible: true
- created_at: '2026-05-06T19:14:28.379Z'
- updated_at: '2026-05-06T19:14:28.379Z'
+ created_at: '2026-05-06T21:12:14.629Z'
+ updated_at: '2026-05-06T21:12:14.629Z'
meta:
page: 1
limit: 25
@@ -737,8 +737,8 @@ paths:
field_type: short_text
resource_type: Spree::Product
storefront_visible: true
- created_at: '2026-05-06T19:14:28.972Z'
- updated_at: '2026-05-06T19:14:28.972Z'
+ created_at: '2026-05-06T21:12:15.228Z'
+ updated_at: '2026-05-06T21:12:15.228Z'
requestBody:
content:
application/json:
@@ -821,8 +821,8 @@ paths:
field_type: short_text
resource_type: Spree::Product
storefront_visible: true
- created_at: '2026-05-06T19:14:28.976Z'
- updated_at: '2026-05-06T19:14:28.976Z'
+ created_at: '2026-05-06T21:12:15.231Z'
+ updated_at: '2026-05-06T21:12:15.231Z'
patch:
summary: Update a custom field definition
tags:
@@ -861,8 +861,8 @@ paths:
field_type: short_text
resource_type: Spree::Product
storefront_visible: false
- created_at: '2026-05-06T19:14:29.258Z'
- updated_at: '2026-05-06T19:14:29.536Z'
+ created_at: '2026-05-06T21:12:15.513Z'
+ updated_at: '2026-05-06T21:12:15.792Z'
requestBody:
content:
application/json:
@@ -984,8 +984,8 @@ paths:
state_name: New York
label:
metadata: {}
- created_at: '2026-05-06T19:14:30.104Z'
- updated_at: '2026-05-06T19:14:30.104Z'
+ created_at: '2026-05-06T21:12:16.363Z'
+ updated_at: '2026-05-06T21:12:16.363Z'
customer_id: cus_UkLWZg9DAJ
meta:
page: 1
@@ -1073,8 +1073,8 @@ paths:
state_name: New York
label: Office
metadata: {}
- created_at: '2026-05-06T19:14:31.455Z'
- updated_at: '2026-05-06T19:14:31.455Z'
+ created_at: '2026-05-06T21:12:17.756Z'
+ updated_at: '2026-05-06T21:12:17.756Z'
customer_id: cus_UkLWZg9DAJ
requestBody:
content:
@@ -1185,8 +1185,8 @@ paths:
state_name: New York
label:
metadata: {}
- created_at: '2026-05-06T19:14:31.723Z'
- updated_at: '2026-05-06T19:14:32.299Z'
+ created_at: '2026-05-06T21:12:18.027Z'
+ updated_at: '2026-05-06T21:12:18.571Z'
customer_id: cus_UkLWZg9DAJ
requestBody:
content:
@@ -1319,8 +1319,8 @@ paths:
customer_id: cus_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
metadata: {}
- created_at: '2026-05-06T19:14:33.408Z'
- updated_at: '2026-05-06T19:14:33.408Z'
+ created_at: '2026-05-06T21:12:19.742Z'
+ updated_at: '2026-05-06T21:12:19.742Z'
meta:
page: 1
limit: 25
@@ -1407,8 +1407,8 @@ paths:
customer_id: cus_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
metadata: {}
- created_at: '2026-05-06T19:14:33.963Z'
- updated_at: '2026-05-06T19:14:33.963Z'
+ created_at: '2026-05-06T21:12:20.315Z'
+ updated_at: '2026-05-06T21:12:20.315Z'
delete:
summary: Delete a customer credit card
tags:
@@ -1526,8 +1526,8 @@ paths:
display_amount_remaining: "$50.00"
currency: USD
metadata: {}
- created_at: '2026-05-06T19:14:35.346Z'
- updated_at: '2026-05-06T19:14:35.346Z'
+ created_at: '2026-05-06T21:12:21.711Z'
+ updated_at: '2026-05-06T21:12:21.711Z'
customer_id: cus_UkLWZg9DAJ
created_by_id: admin_UkLWZg9DAJ
meta:
@@ -1599,8 +1599,8 @@ paths:
display_amount_remaining: "$25.00"
currency: USD
metadata: {}
- created_at: '2026-05-06T19:14:36.445Z'
- updated_at: '2026-05-06T19:14:36.445Z'
+ created_at: '2026-05-06T21:12:22.827Z'
+ updated_at: '2026-05-06T21:12:22.827Z'
customer_id: cus_UkLWZg9DAJ
created_by_id: admin_gbHJdmfrXB
requestBody:
@@ -1688,8 +1688,8 @@ paths:
display_amount_remaining: "$50.00"
currency: USD
metadata: {}
- created_at: '2026-05-06T19:14:36.987Z'
- updated_at: '2026-05-06T19:14:37.264Z'
+ created_at: '2026-05-06T21:12:23.372Z'
+ updated_at: '2026-05-06T21:12:23.661Z'
customer_id: cus_UkLWZg9DAJ
created_by_id: admin_UkLWZg9DAJ
requestBody:
@@ -1841,8 +1841,8 @@ paths:
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-06T19:14:38.349Z'
- updated_at: '2026-05-06T19:14:38.349Z'
+ created_at: '2026-05-06T21:12:24.763Z'
+ updated_at: '2026-05-06T21:12:24.763Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -1925,8 +1925,8 @@ paths:
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-06T19:14:39.194Z'
- updated_at: '2026-05-06T19:14:39.194Z'
+ created_at: '2026-05-06T21:12:25.621Z'
+ updated_at: '2026-05-06T21:12:25.621Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -2042,8 +2042,8 @@ paths:
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-06T19:14:39.462Z'
- updated_at: '2026-05-06T19:14:39.462Z'
+ created_at: '2026-05-06T21:12:25.897Z'
+ updated_at: '2026-05-06T21:12:25.897Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -2117,8 +2117,8 @@ paths:
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-06T19:14:40.006Z'
- updated_at: '2026-05-06T19:14:40.285Z'
+ created_at: '2026-05-06T21:12:26.452Z'
+ updated_at: '2026-05-06T21:12:26.735Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -2240,14 +2240,15 @@ paths:
example:
data:
- id: inv_UkLWZg9DAJ
status: pending
- created_at: '2026-05-06T19:14:41.123Z'
- updated_at: '2026-05-06T19:14:41.123Z'
- expires_at: '2026-05-20T19:14:41.120Z'
+ created_at: '2026-05-06T21:12:27.594Z'
+ updated_at: '2026-05-06T21:12:27.594Z'
+ expires_at: '2026-05-20T21:12:27.591Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
+ inviter_email: [email protected]
+ acceptance_url: http://www.example.com:3000/accept-invitation/inv_UkLWZg9DAJ?token=JBqWjFZtQprH3XSau1A1Ntro
meta:
page: 1
limit: 25
@@ -2304,12 +2305,13 @@ paths:
id: inv_gbHJdmfrXB
status: pending
- created_at: '2026-05-06T19:14:41.418Z'
- updated_at: '2026-05-06T19:14:41.418Z'
- expires_at: '2026-05-20T19:14:41.416Z'
+ created_at: '2026-05-06T21:12:27.895Z'
+ updated_at: '2026-05-06T21:12:27.895Z'
+ expires_at: '2026-05-20T21:12:27.893Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
+ inviter_email: [email protected]
+ acceptance_url: http://www.example.com:3000/accept-invitation/inv_gbHJdmfrXB?token=eyDL2pSnFzJ6U8SzNtK7QmiZ
requestBody:
content:
application/json:
@@ -2412,14 +2414,15 @@ paths:
application/json:
example:
id: inv_UkLWZg9DAJ
status: pending
- created_at: '2026-05-06T19:14:41.985Z'
- updated_at: '2026-05-06T19:14:41.985Z'
- expires_at: '2026-05-20T19:14:41.982Z'
+ created_at: '2026-05-06T21:12:28.469Z'
+ updated_at: '2026-05-06T21:12:28.469Z'
+ expires_at: '2026-05-20T21:12:28.467Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
+ inviter_email: [email protected]
+ acceptance_url: http://www.example.com:3000/accept-invitation/inv_UkLWZg9DAJ?token=4jiinc4bwD3VyLUPRmXwiPAo
"/api/v3/admin/me":
get:
summary: Get current admin user and permissions
@@ -2465,11 +2468,11 @@ paths:
example:
user:
id: admin_UkLWZg9DAJ
- first_name: Charlene
- last_name: Wisoky
- created_at: '2026-05-06T19:14:42.263Z'
- updated_at: '2026-05-06T19:14:42.263Z'
+ first_name: Colene
+ last_name: Beier
+ created_at: '2026-05-06T21:12:28.752Z'
+ updated_at: '2026-05-06T21:12:28.752Z'
roles:
- id: role_UkLWZg9DAJ
name: admin
@@ -2618,8 +2621,8 @@ paths:
position: 1
kind: dropdown
metadata: {}
- created_at: '2026-05-06T19:14:42.313Z'
- updated_at: '2026-05-06T19:14:42.313Z'
+ created_at: '2026-05-06T21:12:28.803Z'
+ updated_at: '2026-05-06T21:12:28.803Z'
option_values: []
meta:
page: 1
@@ -2710,8 +2713,8 @@ paths:
position: 2
kind: dropdown
metadata: {}
- created_at: '2026-05-06T19:14:42.956Z'
- updated_at: '2026-05-06T19:14:42.956Z'
+ created_at: '2026-05-06T21:12:29.459Z'
+ updated_at: '2026-05-06T21:12:29.459Z'
option_values: []
schema:
"$ref": "#/components/schemas/OptionType"
@@ -2832,8 +2835,8 @@ paths:
position: 1
kind: dropdown
metadata: {}
- created_at: '2026-05-06T19:14:43.247Z'
- updated_at: '2026-05-06T19:14:43.247Z'
+ created_at: '2026-05-06T21:12:29.757Z'
+ updated_at: '2026-05-06T21:12:29.757Z'
option_values: []
schema:
"$ref": "#/components/schemas/OptionType"
@@ -2905,8 +2908,8 @@ paths:
position: 1
kind: dropdown
metadata: {}
- created_at: '2026-05-06T19:14:43.807Z'
- updated_at: '2026-05-06T19:14:44.084Z'
+ created_at: '2026-05-06T21:12:30.327Z'
+ updated_at: '2026-05-06T21:12:30.609Z'
option_values: []
schema:
"$ref": "#/components/schemas/OptionType"
@@ -3066,7 +3069,7 @@ paths:
example:
data:
- id: ful_UkLWZg9DAJ
- number: H62698337491
+ number: H08564278295
tracking: U10000
tracking_url:
cost: '10.0'
@@ -3091,8 +3094,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-06T19:14:45.021Z'
- updated_at: '2026-05-06T19:14:45.117Z'
+ created_at: '2026-05-06T21:12:31.565Z'
+ updated_at: '2026-05-06T21:12:31.662Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
meta:
@@ -3175,7 +3178,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H37384901266
+ number: H54780302716
tracking: U10000
tracking_url:
cost: '10.0'
@@ -3200,8 +3203,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-06T19:14:45.731Z'
- updated_at: '2026-05-06T19:14:45.794Z'
+ created_at: '2026-05-06T21:12:32.298Z'
+ updated_at: '2026-05-06T21:12:32.369Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
patch:
@@ -3260,7 +3263,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H49288097976
+ number: H96611884798
tracking: 1Z999AA10123456784
tracking_url: https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=1Z999AA10123456784
cost: '10.0'
@@ -3285,8 +3288,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-06T19:14:46.382Z'
- updated_at: '2026-05-06T19:14:46.722Z'
+ created_at: '2026-05-06T21:12:32.977Z'
+ updated_at: '2026-05-06T21:12:33.327Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
requestBody:
@@ -3355,7 +3358,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H34344934685
+ number: H97200604879
tracking: U10000
tracking_url:
cost: '10.0'
@@ -3372,7 +3375,7 @@ paths:
display_tax_total: "$0.00"
status: shipped
fulfillment_type: shipping
- fulfilled_at: '2026-05-06T19:14:47Z'
+ fulfilled_at: '2026-05-06T21:12:34Z'
items:
- item_id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
@@ -3380,8 +3383,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-06T19:14:47.048Z'
- updated_at: '2026-05-06T19:14:47.385Z'
+ created_at: '2026-05-06T21:12:33.652Z'
+ updated_at: '2026-05-06T21:12:34.001Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/fulfillments/{id}/cancel":
@@ -3439,7 +3442,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H82620392914
+ number: H25693165413
tracking: U10000
tracking_url:
cost: '10.0'
@@ -3464,8 +3467,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-06T19:14:47.716Z'
- updated_at: '2026-05-06T19:14:48.053Z'
+ created_at: '2026-05-06T21:12:34.344Z'
+ updated_at: '2026-05-06T21:12:34.695Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/fulfillments/{id}/resume":
@@ -3523,7 +3526,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H83935840263
+ number: H74113970852
tracking: U10000
tracking_url:
cost: '10.0'
@@ -3548,8 +3551,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-06T19:14:48.373Z'
- updated_at: '2026-05-06T19:14:48.712Z'
+ created_at: '2026-05-06T21:12:35.032Z'
+ updated_at: '2026-05-06T21:12:35.388Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/fulfillments/{id}/split":
@@ -3610,7 +3613,7 @@ paths:
example:
data:
- id: ful_gbHJdmfrXB
- number: H63075459410
+ number: H99928001254
tracking:
tracking_url:
cost: '10.0'
@@ -3635,8 +3638,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-06T19:14:49.439Z'
- updated_at: '2026-05-06T19:14:49.485Z'
+ created_at: '2026-05-06T21:12:36.092Z'
+ updated_at: '2026-05-06T21:12:36.142Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_gbHJdmfrXB
requestBody:
@@ -3708,7 +3711,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: 61CE3BB204DBDC09
+ code: AE724B235ADB6B1D
status: active
currency: USD
amount: '10.0'
@@ -3722,8 +3725,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-05-06T19:14:49.826Z'
- updated_at: '2026-05-06T19:14:50.124Z'
+ created_at: '2026-05-06T21:12:36.493Z'
+ updated_at: '2026-05-06T21:12:36.810Z'
requestBody:
content:
application/json:
@@ -3854,8 +3857,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 2
currency: USD
- name: Product 107040
- slug: product-107040
+ name: Product 108785
+ slug: product-108785
options_text: 'Size: S'
price: '10.0'
display_price: "$10.00"
@@ -3887,12 +3890,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-06T19:14:50.884Z'
- updated_at: '2026-05-06T19:14:50.884Z'
+ created_at: '2026-05-06T21:12:37.594Z'
+ updated_at: '2026-05-06T21:12:37.594Z'
digital_links: []
metadata: {}
- created_at: '2026-05-06T19:14:51.174Z'
- updated_at: '2026-05-06T19:14:51.174Z'
+ created_at: '2026-05-06T21:12:37.897Z'
+ updated_at: '2026-05-06T21:12:37.897Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
meta:
@@ -3959,8 +3962,8 @@ paths:
variant_id: variant_VqXmZF31wY
quantity: 3
currency: USD
- name: Product 123452
- slug: product-123452
+ name: Product 12276
+ slug: product-12276
options_text: 'Size: S'
price: '19.99'
display_price: "$19.99"
@@ -3992,12 +3995,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-06T19:14:52.085Z'
- updated_at: '2026-05-06T19:14:52.085Z'
+ created_at: '2026-05-06T21:12:38.826Z'
+ updated_at: '2026-05-06T21:12:38.826Z'
digital_links: []
metadata: {}
- created_at: '2026-05-06T19:14:52.112Z'
- updated_at: '2026-05-06T19:14:52.112Z'
+ created_at: '2026-05-06T21:12:38.858Z'
+ updated_at: '2026-05-06T21:12:38.858Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
requestBody:
@@ -4086,8 +4089,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 2
currency: USD
- name: Product 137110
- slug: product-137110
+ name: Product 138755
+ slug: product-138755
options_text: 'Size: S'
price: '10.0'
display_price: "$10.00"
@@ -4119,12 +4122,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-06T19:14:52.176Z'
- updated_at: '2026-05-06T19:14:52.176Z'
+ created_at: '2026-05-06T21:12:38.931Z'
+ updated_at: '2026-05-06T21:12:38.931Z'
digital_links: []
metadata: {}
- created_at: '2026-05-06T19:14:52.462Z'
- updated_at: '2026-05-06T19:14:52.462Z'
+ created_at: '2026-05-06T21:12:39.218Z'
+ updated_at: '2026-05-06T21:12:39.218Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
patch:
@@ -4186,8 +4189,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 5
currency: USD
- name: Product 144545
- slug: product-144545
+ name: Product 149103
+ slug: product-149103
options_text: 'Size: S'
price: '19.99'
display_price: "$19.99"
@@ -4219,12 +4222,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-06T19:14:52.783Z'
- updated_at: '2026-05-06T19:14:52.783Z'
+ created_at: '2026-05-06T21:12:39.556Z'
+ updated_at: '2026-05-06T21:12:39.556Z'
digital_links: []
metadata: {}
- created_at: '2026-05-06T19:14:53.066Z'
- updated_at: '2026-05-06T19:14:53.368Z'
+ created_at: '2026-05-06T21:12:39.850Z'
+ updated_at: '2026-05-06T21:12:40.159Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
requestBody:
@@ -4350,8 +4353,8 @@ paths:
data:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-b6f17bdce014
- number: P2LMS7NO
+ response_code: BGS-8d041cdf0eac
+ number: PVWX4G07
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -4369,14 +4372,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-05-06T19:14:54.340Z'
- updated_at: '2026-05-06T19:14:54.343Z'
+ created_at: '2026-05-06T21:12:41.155Z'
+ updated_at: '2026-05-06T21:12:41.159Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-06T19:14:54.342Z'
- updated_at: '2026-05-06T19:14:54.342Z'
+ created_at: '2026-05-06T21:12:41.158Z'
+ updated_at: '2026-05-06T21:12:41.158Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
meta:
@@ -4443,7 +4446,7 @@ paths:
id: py_gbHJdmfrXB
payment_method_id: pm_EfhxLZ9ck8
response_code:
- number: P4IWE7MU
+ number: PBREQ1M7
amount: '110.0'
display_amount: "$110.00"
status: checkout
@@ -4454,8 +4457,8 @@ paths:
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-06T19:14:55.632Z'
- updated_at: '2026-05-06T19:14:55.632Z'
+ created_at: '2026-05-06T21:12:42.486Z'
+ updated_at: '2026-05-06T21:12:42.486Z'
captured_amount: '0.0'
order_id: or_gbHJdmfrXB
requestBody:
@@ -4545,8 +4548,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-28d7efb5828c
- number: PRRYGQHP
+ response_code: BGS-0191ee7524a9
+ number: P31KTS3Y
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -4564,14 +4567,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-05-06T19:14:56.000Z'
- updated_at: '2026-05-06T19:14:56.003Z'
+ created_at: '2026-05-06T21:12:42.869Z'
+ updated_at: '2026-05-06T21:12:42.872Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-06T19:14:56.002Z'
- updated_at: '2026-05-06T19:14:56.002Z'
+ created_at: '2026-05-06T21:12:42.871Z'
+ updated_at: '2026-05-06T21:12:42.871Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/payments/{id}/capture":
@@ -4630,8 +4633,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-5436b829fae9
- number: PUHLHLYQ
+ response_code: BGS-2c4ffa541b1c
+ number: P8EWLHDQ
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -4649,14 +4652,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-05-06T19:14:56.642Z'
- updated_at: '2026-05-06T19:14:56.644Z'
+ created_at: '2026-05-06T21:12:43.527Z'
+ updated_at: '2026-05-06T21:12:43.530Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-06T19:14:56.643Z'
- updated_at: '2026-05-06T19:14:56.967Z'
+ created_at: '2026-05-06T21:12:43.529Z'
+ updated_at: '2026-05-06T21:12:43.873Z'
captured_amount: '110.0'
order_id: or_UkLWZg9DAJ
'422':
@@ -4725,8 +4728,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: void-BGS-ef75357224b1
- number: P7K8C85V
+ response_code: void-BGS-49e1dfec2645
+ number: P2L0IA91
amount: '110.0'
display_amount: "$110.00"
status: void
@@ -4744,14 +4747,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-05-06T19:14:58.034Z'
- updated_at: '2026-05-06T19:14:58.036Z'
+ created_at: '2026-05-06T21:12:44.970Z'
+ updated_at: '2026-05-06T21:12:44.973Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-06T19:14:58.035Z'
- updated_at: '2026-05-06T19:14:58.334Z'
+ created_at: '2026-05-06T21:12:44.972Z'
+ updated_at: '2026-05-06T21:12:45.277Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/refunds":
@@ -4879,14 +4882,14 @@ paths:
application/json:
example:
id: re_UkLWZg9DAJ
- transaction_id: BGS-37185658164a
+ transaction_id: BGS-ee195def7f75
amount: '5.0'
payment_id: py_UkLWZg9DAJ
refund_reason_id: rr_UkLWZg9DAJ
reimbursement_id:
metadata: {}
- created_at: '2026-05-06T19:14:59.647Z'
- updated_at: '2026-05-06T19:14:59.647Z'
+ created_at: '2026-05-06T21:12:46.658Z'
+ updated_at: '2026-05-06T21:12:46.658Z'
requestBody:
content:
application/json:
@@ -4957,8 +4960,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R201929534
+ number: R136324746
customer_note:
currency: USD
locale: en
@@ -5001,8 +5004,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-06T19:14:59.940Z'
- updated_at: '2026-05-06T19:14:59.989Z'
+ created_at: '2026-05-06T21:12:46.981Z'
+ updated_at: '2026-05-06T21:12:47.037Z'
tags: []
internal_note:
approver_id:
@@ -5171,8 +5174,8 @@ paths:
data:
- id: or_UkLWZg9DAJ
market_id:
- number: R906280437
+ number: R411430777
customer_note:
currency: USD
locale: en
@@ -5215,8 +5218,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-06T19:15:01.722Z'
- updated_at: '2026-05-06T19:15:01.722Z'
+ created_at: '2026-05-06T21:12:48.821Z'
+ updated_at: '2026-05-06T21:12:48.821Z'
tags: []
internal_note:
approver_id:
@@ -5345,7 +5348,7 @@ paths:
example:
id: or_gbHJdmfrXB
market_id:
- number: R761025636
+ number: R338449249
customer_note:
currency: USD
@@ -5389,8 +5392,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-06T19:15:02.839Z'
- updated_at: '2026-05-06T19:15:02.842Z'
+ created_at: '2026-05-06T21:12:49.958Z'
+ updated_at: '2026-05-06T21:12:49.963Z'
tags: []
internal_note:
approver_id:
@@ -5562,8 +5565,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R961535675
+ number: R095578452
customer_note:
currency: USD
locale: en
@@ -5606,8 +5609,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-06T19:15:03.117Z'
- updated_at: '2026-05-06T19:15:03.117Z'
+ created_at: '2026-05-06T21:12:50.243Z'
+ updated_at: '2026-05-06T21:12:50.243Z'
tags: []
internal_note:
approver_id:
@@ -5676,7 +5679,7 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R368582010
+ number: R782700219
customer_note:
currency: USD
@@ -5720,8 +5723,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-06T19:15:04.215Z'
- updated_at: '2026-05-06T19:15:04.499Z'
+ created_at: '2026-05-06T21:12:51.410Z'
+ updated_at: '2026-05-06T21:12:51.726Z'
tags: []
internal_note:
approver_id:
@@ -5892,8 +5895,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R178948040
+ number: R744752476
customer_note:
currency: USD
locale: en
@@ -5920,7 +5923,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status: ready
payment_status: paid
- completed_at: '2026-05-06T19:15:05.462Z'
+ completed_at: '2026-05-06T21:12:52.665Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -5936,8 +5939,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-06T19:15:05.365Z'
- updated_at: '2026-05-06T19:15:05.492Z'
+ created_at: '2026-05-06T21:12:52.605Z'
+ updated_at: '2026-05-06T21:12:52.691Z'
tags: []
internal_note:
approver_id:
@@ -6016,8 +6019,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R383710968
+ number: R746542679
customer_note:
currency: USD
locale: en
@@ -6044,7 +6047,7 @@ paths:
display_delivery_total: "$10.00"
fulfillment_status: canceled
payment_status: void
- completed_at: '2026-05-06T19:15:06.717Z'
+ completed_at: '2026-05-06T21:12:53.952Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -6058,10 +6061,10 @@ paths:
payment_total: '0.0'
display_payment_total: "$0.00"
metadata: {}
- canceled_at: '2026-05-06T19:15:07.004Z'
+ canceled_at: '2026-05-06T21:12:54.250Z'
approved_at:
- created_at: '2026-05-06T19:15:06.668Z'
- updated_at: '2026-05-06T19:15:07.040Z'
+ created_at: '2026-05-06T21:12:53.892Z'
+ updated_at: '2026-05-06T21:12:54.297Z'
tags: []
internal_note:
approver_id:
@@ -6118,8 +6121,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R996790421
+ number: R486757219
customer_note:
currency: USD
locale: en
@@ -6146,7 +6149,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-05-06T19:15:07.387Z'
+ completed_at: '2026-05-06T21:12:54.670Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -6161,9 +6164,9 @@ paths:
display_payment_total: "$0.00"
metadata: {}
canceled_at:
- approved_at: '2026-05-06T19:15:07.684Z'
- created_at: '2026-05-06T19:15:07.337Z'
- updated_at: '2026-05-06T19:15:07.387Z'
+ approved_at: '2026-05-06T21:12:54.962Z'
+ created_at: '2026-05-06T21:12:54.610Z'
+ updated_at: '2026-05-06T21:12:54.670Z'
tags: []
internal_note:
approver_id: admin_UkLWZg9DAJ
@@ -6220,8 +6223,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R867851447
+ number: R050394121
customer_note:
currency: USD
locale: en
@@ -6248,7 +6251,7 @@ paths:
display_delivery_total: "$10.00"
fulfillment_status: canceled
payment_status: void
- completed_at: '2026-05-06T19:15:08.016Z'
+ completed_at: '2026-05-06T21:12:55.301Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -6262,10 +6265,10 @@ paths:
payment_total: '0.0'
display_payment_total: "$0.00"
metadata: {}
- canceled_at: '2026-05-06T19:15:08.309Z'
+ canceled_at: '2026-05-06T21:12:55.582Z'
approved_at:
- created_at: '2026-05-06T19:15:07.965Z'
- updated_at: '2026-05-06T19:15:08.389Z'
+ created_at: '2026-05-06T21:12:55.245Z'
+ updated_at: '2026-05-06T21:12:55.692Z'
tags: []
internal_note:
approver_id:
@@ -6322,8 +6325,8 @@ paths:
example:
id: or_UkLWZg9DAJ
market_id:
- number: R603605437
+ number: R555316893
customer_note:
currency: USD
locale: en
@@ -6350,7 +6353,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-05-06T19:15:08.716Z'
+ completed_at: '2026-05-06T21:12:56.028Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -6366,8 +6369,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-06T19:15:08.666Z'
- updated_at: '2026-05-06T19:15:08.715Z'
+ created_at: '2026-05-06T21:12:55.975Z'
+ updated_at: '2026-05-06T21:12:56.028Z'
tags: []
internal_note:
approver_id:
@@ -6439,8 +6442,8 @@ paths:
metadata: {}
active: true
auto_capture:
- created_at: '2026-05-06T19:15:09.013Z'
- updated_at: '2026-05-06T19:15:09.014Z'
+ created_at: '2026-05-06T21:12:56.340Z'
+ updated_at: '2026-05-06T21:12:56.342Z'
meta:
page: 1
limit: 25
@@ -6520,8 +6523,8 @@ paths:
metadata: {}
active: true
auto_capture:
- created_at: '2026-05-06T19:15:09.299Z'
- updated_at: '2026-05-06T19:15:09.300Z'
+ created_at: '2026-05-06T21:12:56.633Z'
+ updated_at: '2026-05-06T21:12:56.635Z'
"/api/v3/admin/products/{product_id}/custom_fields":
get:
summary: List product custom fields
@@ -6589,8 +6592,8 @@ paths:
field_type: short_text
key: custom.title
value: wool
- created_at: '2026-05-06T19:15:09.608Z'
- updated_at: '2026-05-06T19:15:09.608Z'
+ created_at: '2026-05-06T21:12:56.964Z'
+ updated_at: '2026-05-06T21:12:56.964Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
meta:
@@ -6657,8 +6660,8 @@ paths:
field_type: long_text
key: custom.description
value: A longer description
- created_at: '2026-05-06T19:15:10.243Z'
- updated_at: '2026-05-06T19:15:10.243Z'
+ created_at: '2026-05-06T21:12:57.577Z'
+ updated_at: '2026-05-06T21:12:57.577Z'
storefront_visible: true
custom_field_definition_id: cfdef_gbHJdmfrXB
'422':
@@ -6742,8 +6745,8 @@ paths:
field_type: short_text
key: custom.title
value: wool
- created_at: '2026-05-06T19:15:10.594Z'
- updated_at: '2026-05-06T19:15:10.594Z'
+ created_at: '2026-05-06T21:12:58.006Z'
+ updated_at: '2026-05-06T21:12:58.006Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
patch:
@@ -6790,8 +6793,8 @@ paths:
field_type: short_text
key: custom.title
value: cotton
- created_at: '2026-05-06T19:15:10.915Z'
- updated_at: '2026-05-06T19:15:11.194Z'
+ created_at: '2026-05-06T21:12:58.326Z'
+ updated_at: '2026-05-06T21:12:58.612Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
requestBody:
@@ -6929,31 +6932,26 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 391530
- slug: product-391530
+ name: Product 399635
+ slug: product-399635
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-05-06T19:15:11.518Z'
+ available_on: '2025-05-06T21:12:58.945Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Temporibus distinctio voluptates suscipit quidem. At
- eum quidem dolores voluptate quisquam sapiente facilis. Repellendus
- quia adipisci accusamus cum et. Pariatur neque enim culpa dolorem
- sed iste magni. Blanditiis eos mollitia ipsam consequatur tempora
- impedit. Rerum amet ab ipsa cumque tenetur assumenda. Perspiciatis
- doloribus vitae quasi consequatur culpa quam veritatis natus.
- Aperiam error veritatis hic quasi officiis ipsa dolore. In possimus
- quidem fugiat repellat corrupti culpa. Quod eius commodi provident
- voluptates. Nostrum ipsa sapiente laboriosam veniam eaque est
- id. Amet cupiditate explicabo debitis tenetur officiis autem eveniet.
+ description: Nesciunt ut sed impedit iusto molestias voluptates.
+ Reiciendis saepe unde accusamus aut. Alias sed reiciendis magni
+ neque sit fugiat fugit eius. Cumque aut neque quas et illum optio.
+ Dolor laboriosam iusto aliquid beatae error temporibus saepe accusamus.
+ Eligendi ratione ad id quas. Maiores occaecati minus ducimus ipsa
+ pariatur consequatur natus facilis. Facere labore inventore nihil
+ ullam.
description_html: |-
- Temporibus distinctio voluptates suscipit quidem. At eum quidem dolores voluptate quisquam sapiente facilis. Repellendus quia adipisci accusamus cum et.
- Pariatur neque enim culpa dolorem sed iste magni. Blanditiis eos mollitia ipsam consequatur tempora impedit. Rerum amet ab ipsa cumque tenetur assumenda.
- Perspiciatis doloribus vitae quasi consequatur culpa quam veritatis natus. Aperiam error veritatis hic quasi officiis ipsa dolore. In possimus quidem fugiat repellat corrupti culpa.
- Quod eius commodi provident voluptates. Nostrum ipsa sapiente laboriosam veniam eaque est id. Amet cupiditate explicabo debitis tenetur officiis autem eveniet.
+ Nesciunt ut sed impedit iusto molestias voluptates. Reiciendis saepe unde accusamus aut. Alias sed reiciendis magni neque sit fugiat fugit eius.
+ Cumque aut neque quas et illum optio. Dolor laboriosam iusto aliquid beatae error temporibus saepe accusamus. Eligendi ratione ad id quas. Maiores occaecati minus ducimus ipsa pariatur consequatur natus facilis. Facere labore inventore nihil ullam.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -6968,16 +6966,16 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-05-06T19:15:11.542Z'
- updated_at: '2026-05-06T19:15:11.542Z'
+ created_at: '2026-05-06T21:12:58.977Z'
+ updated_at: '2026-05-06T21:12:58.977Z'
original_price:
status: active
- make_active_at: '2025-05-06T19:15:11.518Z'
+ make_active_at: '2025-05-06T21:12:58.945Z'
discontinue_on:
metadata: {}
deleted_at:
- created_at: '2026-05-06T19:15:11.529Z'
- updated_at: '2026-05-06T19:15:11.543Z'
+ created_at: '2026-05-06T21:12:58.961Z'
+ updated_at: '2026-05-06T21:12:58.978Z'
cost_price: '17.0'
cost_currency: USD
meta:
@@ -7116,16 +7114,16 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_gbHJdmfrXB
- created_at: '2026-05-06T19:15:12.229Z'
- updated_at: '2026-05-06T19:15:12.229Z'
+ created_at: '2026-05-06T21:12:59.662Z'
+ updated_at: '2026-05-06T21:12:59.662Z'
original_price:
status: draft
make_active_at:
discontinue_on:
metadata: {}
deleted_at:
- created_at: '2026-05-06T19:15:12.227Z'
- updated_at: '2026-05-06T19:15:12.234Z'
+ created_at: '2026-05-06T21:12:59.660Z'
+ updated_at: '2026-05-06T21:12:59.667Z'
cost_price:
cost_currency: USD
schema:
@@ -7312,25 +7310,25 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 432495
- slug: product-432495
+ name: Product 435751
+ slug: product-435751
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-05-06T19:15:12.584Z'
+ available_on: '2025-05-06T21:13:00.057Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Officia assumenda veritatis nihil blanditiis nesciunt.
- Eum quis error commodi perferendis. Voluptates quas soluta accusantium
- vero magni provident eaque. Similique sed reiciendis deserunt eligendi
- sapiente ut sequi. Perspiciatis nam odio voluptas vel quam quidem.
- Tempora provident expedita accusantium ab et. Ad amet doloribus
- est eveniet quam perspiciatis voluptatibus assumenda.
+ description: Repudiandae dicta eaque deserunt eligendi vitae. Totam
+ eligendi est reprehenderit rerum maxime veritatis vel expedita.
+ Numquam omnis amet corrupti repellat corporis labore. Assumenda
+ vel sequi eos minus. Amet eaque enim vitae doloremque omnis alias
+ iure. Ducimus animi quo doloremque fuga delectus tempora enim iure.
+ Rerum omnis nobis recusandae voluptatem neque nulla alias sit.
description_html: |-
- Officia assumenda veritatis nihil blanditiis nesciunt. Eum quis error commodi perferendis. Voluptates quas soluta accusantium vero magni provident eaque. Similique sed reiciendis deserunt eligendi sapiente ut sequi.
- Perspiciatis nam odio voluptas vel quam quidem. Tempora provident expedita accusantium ab et. Ad amet doloribus est eveniet quam perspiciatis voluptatibus assumenda.
+ Repudiandae dicta eaque deserunt eligendi vitae. Totam eligendi est reprehenderit rerum maxime veritatis vel expedita. Numquam omnis amet corrupti repellat corporis labore. Assumenda vel sequi eos minus.
+ Amet eaque enim vitae doloremque omnis alias iure. Ducimus animi quo doloremque fuga delectus tempora enim iure. Rerum omnis nobis recusandae voluptatem neque nulla alias sit.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -7345,16 +7343,16 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-05-06T19:15:12.610Z'
- updated_at: '2026-05-06T19:15:12.610Z'
+ created_at: '2026-05-06T21:13:00.106Z'
+ updated_at: '2026-05-06T21:13:00.106Z'
original_price:
status: active
- make_active_at: '2025-05-06T19:15:12.584Z'
+ make_active_at: '2025-05-06T21:13:00.057Z'
discontinue_on:
metadata: {}
deleted_at:
- created_at: '2026-05-06T19:15:12.597Z'
- updated_at: '2026-05-06T19:15:12.611Z'
+ created_at: '2026-05-06T21:13:00.080Z'
+ updated_at: '2026-05-06T21:13:00.108Z'
cost_price: '17.0'
cost_currency: USD
schema:
@@ -7422,27 +7420,29 @@ paths:
example:
id: prod_UkLWZg9DAJ
name: Updated Name
- slug: product-456413
+ slug: product-452240
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-05-06T19:15:13.304Z'
+ available_on: '2025-05-06T21:13:00.762Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Libero fugiat repellendus ea odio. Commodi libero laborum
- illo minima vitae adipisci nostrum quidem. Incidunt ratione ab aut
- magnam aliquid aperiam. Ullam ipsa nisi assumenda quasi excepturi
- suscipit facilis dicta. Ipsam fuga voluptas tempore repellat optio
- impedit pariatur. Odit consequatur enim minus soluta. Velit voluptatem
- eius at assumenda nostrum iure. Quos ipsa at ab fuga iste. Similique
- quibusdam perspiciatis atque non facere. Architecto ut dolorum distinctio
- similique. Optio provident ab officia reiciendis.
+ description: Tempore id reprehenderit culpa earum illum debitis accusamus
+ quas. Nihil consequatur quae necessitatibus quos. Voluptas ipsum
+ aliquam possimus id et qui. Veniam fugit non exercitationem placeat.
+ Ipsam suscipit quaerat quod earum aliquam natus recusandae ex. Tempora
+ neque id tempore voluptate in beatae voluptatibus ipsa. Harum tempore
+ officiis eius assumenda. Optio officiis iusto harum itaque minima.
+ Quisquam officiis nobis eum tenetur. Autem pariatur non qui molestias
+ minima odit commodi. Voluptatum rerum atque quo vero rem. Autem
+ perspiciatis amet dolore neque. Quod voluptatem delectus eaque minus.
+ Id consequatur iusto enim minus alias accusamus in.
description_html: |-
- Libero fugiat repellendus ea odio. Commodi libero laborum illo minima vitae adipisci nostrum quidem. Incidunt ratione ab aut magnam aliquid aperiam. Ullam ipsa nisi assumenda quasi excepturi suscipit facilis dicta.
- Ipsam fuga voluptas tempore repellat optio impedit pariatur. Odit consequatur enim minus soluta. Velit voluptatem eius at assumenda nostrum iure. Quos ipsa at ab fuga iste.
- Similique quibusdam perspiciatis atque non facere. Architecto ut dolorum distinctio similique. Optio provident ab officia reiciendis.
+ Tempore id reprehenderit culpa earum illum debitis accusamus quas. Nihil consequatur quae necessitatibus quos. Voluptas ipsum aliquam possimus id et qui. Veniam fugit non exercitationem placeat. Ipsam suscipit quaerat quod earum aliquam natus recusandae ex.
+ Tempora neque id tempore voluptate in beatae voluptatibus ipsa. Harum tempore officiis eius assumenda. Optio officiis iusto harum itaque minima. Quisquam officiis nobis eum tenetur. Autem pariatur non qui molestias minima odit commodi.
+ Voluptatum rerum atque quo vero rem. Autem perspiciatis amet dolore neque. Quod voluptatem delectus eaque minus. Id consequatur iusto enim minus alias accusamus in.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -7457,16 +7457,16 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-05-06T19:15:13.343Z'
- updated_at: '2026-05-06T19:15:13.343Z'
+ created_at: '2026-05-06T21:13:00.793Z'
+ updated_at: '2026-05-06T21:13:00.793Z'
original_price:
status: active
- make_active_at: '2025-05-06T19:15:13.304Z'
+ make_active_at: '2025-05-06T21:13:00.762Z'
discontinue_on:
metadata: {}
deleted_at:
- created_at: '2026-05-06T19:15:13.325Z'
- updated_at: '2026-05-06T19:15:13.639Z'
+ created_at: '2026-05-06T21:13:00.778Z'
+ updated_at: '2026-05-06T21:13:01.085Z'
cost_price: '17.0'
cost_currency: USD
schema:
@@ -7673,8 +7673,8 @@ paths:
data:
- id: role_UkLWZg9DAJ
name: admin
- created_at: '2026-05-06T19:15:14.315Z'
- updated_at: '2026-05-06T19:15:14.315Z'
+ created_at: '2026-05-06T21:13:01.768Z'
+ updated_at: '2026-05-06T21:13:01.768Z'
meta:
page: 1
limit: 25
@@ -7736,8 +7736,8 @@ paths:
preferred_timezone: UTC
preferred_weight_unit: lb
preferred_unit_system: imperial
- created_at: '2026-05-06T19:14:25.333Z'
- updated_at: '2026-05-06T19:15:14.612Z'
+ created_at: '2026-05-06T21:12:11.579Z'
+ updated_at: '2026-05-06T21:13:02.074Z'
url: http://www.example.com:3000
supported_currencies:
- USD
@@ -7808,8 +7808,8 @@ paths:
preferred_timezone: UTC
preferred_weight_unit: lb
preferred_unit_system: imperial
- created_at: '2026-05-06T19:14:25.333Z'
- updated_at: '2026-05-06T19:15:15.210Z'
+ created_at: '2026-05-06T21:12:11.579Z'
+ updated_at: '2026-05-06T21:13:02.703Z'
url: http://www.example.com:3000
supported_currencies:
- USD
@@ -8028,9 +8028,9 @@ paths:
cost_price: '17.0'
cost_currency: USD
deleted_at:
- created_at: '2026-05-06T19:15:16.619Z'
- updated_at: '2026-05-06T19:15:16.631Z'
- product_name: Product 486546
+ created_at: '2026-05-06T21:13:04.139Z'
+ updated_at: '2026-05-06T21:13:04.152Z'
+ product_name: Product 48396
display_price: "$0.00"
- id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
@@ -8042,10 +8042,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 139.86
- height: 156.38
- width: 163.0
- depth: 12.5
+ weight: 159.63
+ height: 159.24
+ width: 160.44
+ depth: 81.44
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -8068,8 +8068,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-06T19:15:16.640Z'
- updated_at: '2026-05-06T19:15:16.640Z'
+ created_at: '2026-05-06T21:13:04.163Z'
+ updated_at: '2026-05-06T21:13:04.163Z'
metadata: {}
position: 2
total_on_hand: 0
@@ -8077,9 +8077,9 @@ paths:
cost_price: '17.0'
cost_currency: USD
deleted_at:
- created_at: '2026-05-06T19:15:16.637Z'
- updated_at: '2026-05-06T19:15:16.649Z'
- product_name: Product 486546
+ created_at: '2026-05-06T21:13:04.161Z'
+ updated_at: '2026-05-06T21:13:04.175Z'
+ product_name: Product 48396
display_price: "$19.99"
meta:
page: 1
@@ -8191,8 +8191,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-06T19:15:17.283Z'
- updated_at: '2026-05-06T19:15:17.283Z'
+ created_at: '2026-05-06T21:13:04.838Z'
+ updated_at: '2026-05-06T21:13:04.838Z'
metadata: {}
position: 3
total_on_hand: 0
@@ -8200,9 +8200,9 @@ paths:
cost_price:
cost_currency: USD
deleted_at:
- created_at: '2026-05-06T19:15:17.286Z'
- updated_at: '2026-05-06T19:15:17.287Z'
- product_name: Product 492475
+ created_at: '2026-05-06T21:13:04.843Z'
+ updated_at: '2026-05-06T21:13:04.844Z'
+ product_name: Product 498498
display_price: "$24.99"
'422':
description: validation error
@@ -8390,10 +8390,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 139.2
- height: 150.49
- width: 171.59
- depth: 38.84
+ weight: 188.28
+ height: 142.74
+ width: 142.25
+ depth: 92.52
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -8416,8 +8416,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-06T19:15:17.686Z'
- updated_at: '2026-05-06T19:15:17.686Z'
+ created_at: '2026-05-06T21:13:05.265Z'
+ updated_at: '2026-05-06T21:13:05.265Z'
metadata: {}
position: 2
total_on_hand: 0
@@ -8425,9 +8425,9 @@ paths:
cost_price: '17.0'
cost_currency: USD
deleted_at:
- created_at: '2026-05-06T19:15:17.683Z'
- updated_at: '2026-05-06T19:15:17.698Z'
- product_name: Product 518557
+ created_at: '2026-05-06T21:13:05.262Z'
+ updated_at: '2026-05-06T21:13:05.277Z'
+ product_name: Product 512379
display_price: "$19.99"
'404':
description: variant not found
@@ -8507,10 +8507,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 55.89
- height: 7.5
- width: 176.6
- depth: 156.78
+ weight: 96.68
+ height: 107.82
+ width: 121.52
+ depth: 184.21
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -8533,8 +8533,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-06T19:15:18.349Z'
- updated_at: '2026-05-06T19:15:18.349Z'
+ created_at: '2026-05-06T21:13:05.948Z'
+ updated_at: '2026-05-06T21:13:05.948Z'
metadata: {}
position: 2
total_on_hand: 0
@@ -8542,9 +8542,9 @@ paths:
cost_price: '17.0'
cost_currency: USD
deleted_at:
- created_at: '2026-05-06T19:15:18.347Z'
- updated_at: '2026-05-06T19:15:18.641Z'
- product_name: Product 536764
+ created_at: '2026-05-06T21:13:05.946Z'
+ updated_at: '2026-05-06T21:13:06.253Z'
+ product_name: Product 53313
display_price: "$19.99"
requestBody:
content:
@@ -9868,6 +9868,8 @@ components:
inviter_email:
type: string
nullable: true
+ acceptance_url:
+ type: string
required:
- id
- email
@@ -9878,6 +9880,7 @@ components:
- role_id
- role_name
- inviter_email
+ - acceptance_url
x-typelizer: true
LineItem:
type: object
diff --git a/packages/admin-sdk/.changeset/admin-staff-and-api-keys.md b/packages/admin-sdk/.changeset/admin-staff-and-api-keys.md
index 88f0daf2fb..67d8ad16c4 100644
--- a/packages/admin-sdk/.changeset/admin-staff-and-api-keys.md
+++ b/packages/admin-sdk/.changeset/admin-staff-and-api-keys.md
@@ -8,5 +8,7 @@ Staff and API key management.
- New `client.invitations` accessor with `list / get / create / delete / resend`. Invitations carry an `email` + prefixed `role_id`; on accept, a per-store `RoleUser` is created. `resend` issues a fresh token and re-dispatches the invitation email.
- New `client.apiKeys` accessor with `list / get / create / update / delete / revoke`. Supports both `publishable` (storefront) and `secret` (server-to-server) keys. The plaintext token for secret keys is delivered exactly once on the create response — store it client-side immediately because subsequent reads expose only `token_prefix`. `revoke` marks the key revoked while preserving the row for audit.
- New `client.roles` accessor with `list / get`. Read-only — used to populate the role picker on the staff invite/edit forms.
-- New types: `ApiKey`, `Invitation`, `Role`. `AdminUser` now includes a `roles` field with the role assignments scoped to the current store.
-- New params types: `ApiKeyCreateParams`, `ApiKeyUpdateParams`, `InvitationCreateParams`, `AdminUserUpdateParams`.
+- New `client.auth.lookupInvitation(id, token)` and `client.auth.acceptInvitation(id, token, params)`. Public (unauthenticated) endpoints that drive the SPA invitation acceptance screen — `lookup` returns the safe-to-render context (store, role, inviter, `invitee_exists`) so the page can pick between sign-in (existing account) and signup (new account); `accept` creates the user if needed, marks the invitation accepted, and issues a JWT + refresh-token cookie identical to `auth.login`.
+- `Invitation` now carries `acceptance_url` — the shareable link the SPA's "Copy invitation link" action and the invitation email both use.
+- New types: `ApiKey`, `Invitation`, `Role`, `InvitationLookup`. `AdminUser` now includes a `roles` field with the role assignments scoped to the current store.
+- New params types: `ApiKeyCreateParams`, `ApiKeyUpdateParams`, `InvitationCreateParams`, `InvitationAcceptParams`, `AdminUserUpdateParams`.
diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.ts
index 433d5becb3..5b9c98caa3 100644
--- a/packages/admin-sdk/src/admin-client.ts
+++ b/packages/admin-sdk/src/admin-client.ts
@@ -48,6 +48,24 @@ export interface LoginCredentials {
password: string
}
+/**
+ * Public lookup of a pending invitation. The SPA hits this to render the
+ * acceptance page (store name, role, inviter). `invitee_exists` decides
+ * between the sign-in form (true) and the signup form (false).
+ */
+export interface InvitationLookup {
+ id: string
+ email: string
+ role_name: string | null
+ inviter_email: string | null
+ expires_at: string | null
+ invitee_exists: boolean
+ store: {
+ id: string | null
+ name: string | null
+ }
+}
+
export interface PermissionRule {
/** true for `can`, false for `cannot` */
allow: boolean
@@ -86,6 +104,7 @@ import type {
DirectUploadCreateParams,
FulfillmentUpdateParams,
GiftCardApplyParams,
+ InvitationAcceptParams,
InvitationCreateParams,
LineItemCreateParams,
LineItemUpdateParams,
@@ -306,6 +325,39 @@ export class AdminClient {
*/
logout: (options?: RequestOptions): Promise<void> =>
this.request<void>('POST', '/auth/logout', options),
+
+ /**
+ * Public (unauthenticated) lookup of a pending invitation by prefixed ID + token.
+ * Returns just the safe-to-render context (store, role, inviter, invitee_exists)
+ * so the SPA acceptance page can decide between sign-in and signup forms.
+ */
+ lookupInvitation: (
+ id: string,
+ token: string,
+ options?: RequestOptions,
+ ): Promise<InvitationLookup> =>
+ this.request<InvitationLookup>('GET', `/auth/invitations/${id}/lookup`, {
+ ...options,
+ params: { token },
+ }),
+
+ /**
+ * Public (unauthenticated) accept of an invitation. For existing accounts the
+ * caller passes their password; for new accounts they pass password +
+ * confirmation + names. Either path issues a JWT + refresh-token cookie
+ * identical to `login`.
+ */
+ acceptInvitation: (
+ id: string,
+ token: string,
+ params: InvitationAcceptParams,
+ options?: RequestOptions,
+ ): Promise<AuthTokens> =>
+ this.request<AuthTokens>('POST', `/auth/invitations/${id}/accept`, {
+ ...options,
+ params: { token },
+ body: params,
+ }),
}
// ============================================
diff --git a/packages/admin-sdk/src/index.ts b/packages/admin-sdk/src/index.ts
index 9e0b8b6492..62faaa3caf 100644
--- a/packages/admin-sdk/src/index.ts
+++ b/packages/admin-sdk/src/index.ts
@@ -6,6 +6,7 @@ export { SpreeError } from '@spree/sdk-core'
export type {
AuthTokens,
DashboardAnalytics,
+ InvitationLookup,
LoginCredentials,
MeResponse,
PermissionRule,
diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.ts
index a0c219e12c..1b091c7baa 100644
--- a/packages/admin-sdk/src/params.ts
+++ b/packages/admin-sdk/src/params.ts
@@ -365,6 +365,18 @@ export interface InvitationCreateParams {
role_id: string
}
+/**
+ * Body for accepting an invitation. Empty for existing accounts when no
+ * password change is needed; populated with `password` (and optionally
+ * `password_confirmation` + names) for new accounts being created on accept.
+ */
+export interface InvitationAcceptParams {
+ password?: string
+ password_confirmation?: string
+ first_name?: string
+ last_name?: string
+}
+
export interface AdminUserUpdateParams {
first_name?: string
last_name?: string
diff --git a/packages/admin-sdk/src/types/generated/Invitation.ts b/packages/admin-sdk/src/types/generated/Invitation.ts
index 43ab1cd868..e9f8b75604 100644
--- a/packages/admin-sdk/src/types/generated/Invitation.ts
+++ b/packages/admin-sdk/src/types/generated/Invitation.ts
@@ -1,4 +1,4 @@
-// Typelizer digest a180ffdf01300567a126e5dfb1f598ca
+// Typelizer digest 9c0b07f7cb7efaa857c228e03635867c
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -12,6 +12,7 @@ interface Invitation {
role_id: string | null;
role_name: string | null;
inviter_email: string | null;
+ acceptance_url: string;
}
export default Invitation;
diff --git a/packages/admin/src/client.ts b/packages/admin/src/client.ts
index 9256230ab8..213c30ac2f 100644
--- a/packages/admin/src/client.ts
+++ b/packages/admin/src/client.ts
@@ -1,10 +1,22 @@
import { createAdminClient } from '@spree/admin-sdk'
-// In dev, the Vite proxy forwards /api/* to the Rails server (same-origin to the browser).
-// In prod, VITE_SPREE_API_URL points at the absolute API URL (cross-origin → cookies need
-// SameSite=None; Secure, which the backend handles based on Rails.env).
-// Empty baseUrl → relative URLs → uses the proxy in dev, absolute origin in prod builds
-// only if the env var is set; when set, the SDK prepends it.
+// `VITE_SPREE_API_URL` controls whether the SDK builds relative or absolute URLs.
+// Three deployment topologies, one code path:
+//
+// 1. Dev (default, env unset) — Vite dev proxy forwards `/api/*` to
+// Rails. Browser sees same-origin → no CORS, no preflight, the refresh-token
+// cookie rides under `SameSite=Lax` without HTTPS.
+//
+// 2. Prod single-origin (env unset) — Static-host rewrite (Render/nginx/
+// Cloudflare Worker) forwards `/api/*` to Rails. Same code path as dev,
+// same security posture, no CORS config to maintain. This is the
+// recommended topology for self-hosters.
+//
+// 3. Prod cross-origin (env set) — `VITE_SPREE_API_URL=https://api.shop.com`
+// makes the SDK emit absolute URLs. Backend then needs the origin in
+// `Spree::AllowedOrigin`; cookies switch to `SameSite=None; Secure`
+// (handled server-side by Rails.env). Use when the admin lives on a CDN
+// and you don't want an edge proxy.
const baseUrl = import.meta.env.VITE_SPREE_API_URL || ''
export const adminClient = createAdminClient({
diff --git a/packages/admin/src/providers/auth-provider.tsx b/packages/admin/src/providers/auth-provider.tsx
index c0e6775575..782ea08caf 100644
--- a/packages/admin/src/providers/auth-provider.tsx
+++ b/packages/admin/src/providers/auth-provider.tsx
@@ -1,3 +1,4 @@
+import type { InvitationAcceptParams } from '@spree/admin-sdk'
import { createContext, type ReactNode, useCallback, useEffect, useRef, useState } from 'react'
import { adminClient } from '@/client'
@@ -18,6 +19,12 @@ interface AuthContextValue {
isLoading: boolean
login: (email: string, password: string) => Promise<void>
logout: () => Promise<void>
+ /**
+ * Drives the public invitation-acceptance flow. On success the issued JWT +
+ * refresh-token cookie behave identically to a fresh login — the provider's
+ * normal refresh loop takes over from there.
+ */
+ acceptInvitation: (id: string, token: string, params: InvitationAcceptParams) => Promise<void>
}
export const AuthContext = createContext<AuthContextValue | null>(null)
@@ -96,6 +103,20 @@ export function AuthProvider({ children }: { children: ReactNode }) {
[applySession, scheduleRefresh],
)
+ const acceptInvitation = useCallback(
+ async (id: string, token: string, params: InvitationAcceptParams) => {
+ setIsLoading(true)
+ try {
+ const res = await adminClient.auth.acceptInvitation(id, token, params)
+ applySession(res.token, res.user)
+ scheduleRefresh()
+ } finally {
+ setIsLoading(false)
+ }
+ },
+ [applySession, scheduleRefresh],
+ )
+
const logout = useCallback(async () => {
try {
await adminClient.auth.logout()
@@ -135,6 +156,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
isLoading,
login,
logout,
+ acceptInvitation,
}}
>
{children}
diff --git a/packages/admin/src/routeTree.gen.ts b/packages/admin/src/routeTree.gen.ts
index 26be91772d..593e6e7672 100644
--- a/packages/admin/src/routeTree.gen.ts
+++ b/packages/admin/src/routeTree.gen.ts
@@ -12,6 +12,7 @@ import { Route as rootRouteImport } from './routes/__root'
import { Route as LoginRouteImport } from './routes/login'
import { Route as AuthenticatedRouteImport } from './routes/_authenticated'
import { Route as AuthenticatedIndexRouteImport } from './routes/_authenticated/index'
+import { Route as AcceptInvitationInvitationIdRouteImport } from './routes/accept-invitation.$invitationId'
import { Route as AuthenticatedStoreIdRouteImport } from './routes/_authenticated/$storeId'
import { Route as AuthenticatedStoreIdIndexRouteImport } from './routes/_authenticated/$storeId/index'
import { Route as AuthenticatedStoreIdSettingsRouteImport } from './routes/_authenticated/$storeId/settings'
@@ -42,6 +43,12 @@ const AuthenticatedIndexRoute = AuthenticatedIndexRouteImport.update({
path: '/',
getParentRoute: () => AuthenticatedRoute,
} as any)
+const AcceptInvitationInvitationIdRoute =
+ AcceptInvitationInvitationIdRouteImport.update({
+ id: '/accept-invitation/$invitationId',
+ path: '/accept-invitation/$invitationId',
+ getParentRoute: () => rootRouteImport,
+ } as any)
const AuthenticatedStoreIdRoute = AuthenticatedStoreIdRouteImport.update({
id: '/$storeId',
path: '/$storeId',
@@ -136,6 +143,7 @@ export interface FileRoutesByFullPath {
'/': typeof AuthenticatedIndexRoute
'/login': typeof LoginRoute
'/$storeId': typeof AuthenticatedStoreIdRouteWithChildren
+ '/accept-invitation/$invitationId': typeof AcceptInvitationInvitationIdRoute
'/$storeId/settings': typeof AuthenticatedStoreIdSettingsRouteWithChildren
'/$storeId/': typeof AuthenticatedStoreIdIndexRoute
'/$storeId/customers/$customerId': typeof AuthenticatedStoreIdCustomersCustomerIdRoute
@@ -153,6 +161,7 @@ export interface FileRoutesByFullPath {
}
export interface FileRoutesByTo {
'/login': typeof LoginRoute
+ '/accept-invitation/$invitationId': typeof AcceptInvitationInvitationIdRoute
'/': typeof AuthenticatedIndexRoute
'/$storeId': typeof AuthenticatedStoreIdIndexRoute
'/$storeId/customers/$customerId': typeof AuthenticatedStoreIdCustomersCustomerIdRoute
@@ -173,6 +182,7 @@ export interface FileRoutesById {
'/_authenticated': typeof AuthenticatedRouteWithChildren
'/login': typeof LoginRoute
'/_authenticated/$storeId': typeof AuthenticatedStoreIdRouteWithChildren
+ '/accept-invitation/$invitationId': typeof AcceptInvitationInvitationIdRoute
'/_authenticated/': typeof AuthenticatedIndexRoute
'/_authenticated/$storeId/settings': typeof AuthenticatedStoreIdSettingsRouteWithChildren
'/_authenticated/$storeId/': typeof AuthenticatedStoreIdIndexRoute
@@ -195,6 +205,7 @@ export interface FileRouteTypes {
| '/'
| '/login'
| '/$storeId'
+ | '/accept-invitation/$invitationId'
| '/$storeId/settings'
| '/$storeId/'
| '/$storeId/customers/$customerId'
@@ -212,6 +223,7 @@ export interface FileRouteTypes {
fileRoutesByTo: FileRoutesByTo
to:
| '/login'
+ | '/accept-invitation/$invitationId'
| '/'
| '/$storeId'
| '/$storeId/customers/$customerId'
@@ -231,6 +243,7 @@ export interface FileRouteTypes {
| '/_authenticated'
| '/login'
| '/_authenticated/$storeId'
+ | '/accept-invitation/$invitationId'
| '/_authenticated/'
| '/_authenticated/$storeId/settings'
| '/_authenticated/$storeId/'
@@ -251,6 +264,7 @@ export interface FileRouteTypes {
export interface RootRouteChildren {
AuthenticatedRoute: typeof AuthenticatedRouteWithChildren
LoginRoute: typeof LoginRoute
+ AcceptInvitationInvitationIdRoute: typeof AcceptInvitationInvitationIdRoute
}
declare module '@tanstack/react-router' {
@@ -276,6 +290,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedIndexRouteImport
parentRoute: typeof AuthenticatedRoute
}
+ '/accept-invitation/$invitationId': {
+ id: '/accept-invitation/$invitationId'
+ path: '/accept-invitation/$invitationId'
+ fullPath: '/accept-invitation/$invitationId'
+ preLoaderRoute: typeof AcceptInvitationInvitationIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/_authenticated/$storeId': {
id: '/_authenticated/$storeId'
path: '/$storeId'
@@ -460,6 +481,7 @@ const AuthenticatedRouteWithChildren = AuthenticatedRoute._addFileChildren(
const rootRouteChildren: RootRouteChildren = {
AuthenticatedRoute: AuthenticatedRouteWithChildren,
LoginRoute: LoginRoute,
+ AcceptInvitationInvitationIdRoute: AcceptInvitationInvitationIdRoute,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
diff --git a/packages/admin/src/routes/_authenticated/$storeId/settings/staff.tsx b/packages/admin/src/routes/_authenticated/$storeId/settings/staff.tsx
index ef55e1b03b..2d4483485d 100644
--- a/packages/admin/src/routes/_authenticated/$storeId/settings/staff.tsx
+++ b/packages/admin/src/routes/_authenticated/$storeId/settings/staff.tsx
@@ -3,6 +3,7 @@ import type { AdminUser, Invitation, Role } from '@spree/admin-sdk'
import { createFileRoute } from '@tanstack/react-router'
import {
ClockIcon,
+ LinkIcon,
MailIcon,
MoreHorizontalIcon,
PlusIcon,
@@ -54,6 +55,7 @@ import {
SelectValue,
} from '@/components/ui/select'
import { Skeleton } from '@/components/ui/skeleton'
+import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
import {
useCreateInvitation,
useDeleteInvitation,
@@ -279,6 +281,16 @@ function InvitationRow({ invitation }: { invitation: Invitation }) {
const resendMutation = useResendInvitation()
const deleteMutation = useDeleteInvitation()
const confirm = useConfirm()
+ const { copy } = useCopyToClipboard()
+
+ async function handleCopyLink() {
+ // Path-only when `Spree::Config[:admin_url]` is unset; resolve against the SPA's origin.
+ const url = invitation.acceptance_url.startsWith('/')
+ ? `${window.location.origin}${invitation.acceptance_url}`
+ : invitation.acceptance_url
+ await copy(url)
+ toast.success('Invitation link copied')
+ }
async function handleResend() {
try {
@@ -343,6 +355,10 @@ function InvitationRow({ invitation }: { invitation: Invitation }) {
<MailIcon className="size-4" />
Resend invitation
</DropdownMenuItem>
+ <DropdownMenuItem onClick={handleCopyLink}>
+ <LinkIcon className="size-4" />
+ Copy invitation link
+ </DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive" onClick={handleDelete}>
Revoke invitation
diff --git a/packages/admin/src/routes/accept-invitation.$invitationId.tsx b/packages/admin/src/routes/accept-invitation.$invitationId.tsx
new file mode 100644
index 0000000000..54f8ed5e69
--- /dev/null
+++ b/packages/admin/src/routes/accept-invitation.$invitationId.tsx
@@ -0,0 +1,299 @@
+import { zodResolver } from '@hookform/resolvers/zod'
+import type { InvitationLookup, SpreeError } from '@spree/admin-sdk'
+import { useQuery } from '@tanstack/react-query'
+import { createFileRoute, Navigate, useNavigate } from '@tanstack/react-router'
+import { useForm } from 'react-hook-form'
+import { z } from 'zod/v4'
+import { adminClient } from '@/client'
+import { Button } from '@/components/ui/button'
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
+import { Input } from '@/components/ui/input'
+import { Label } from '@/components/ui/label'
+import { useAuth } from '@/hooks/use-auth'
+
+const acceptSearchSchema = z.object({
+ token: z.string().min(1).optional(),
+})
+
+export const Route = createFileRoute('/accept-invitation/$invitationId')({
+ validateSearch: acceptSearchSchema,
+ component: AcceptInvitationPage,
+})
+
+function AcceptInvitationPage() {
+ const { invitationId } = Route.useParams()
+ const { token } = Route.useSearch()
+ const { isAuthenticated } = useAuth()
+
+ if (isAuthenticated) return <Navigate to="/" replace />
+
+ if (!token) {
+ return (
+ <Shell>
+ <ErrorCard
+ title="Missing invitation token"
+ message="This link looks incomplete. Ask whoever invited you to send it again."
+ />
+ </Shell>
+ )
+ }
+
+ return (
+ <Shell>
+ <InvitationLoader invitationId={invitationId} token={token} />
+ </Shell>
+ )
+}
+
+function InvitationLoader({ invitationId, token }: { invitationId: string; token: string }) {
+ const lookup = useQuery({
+ queryKey: ['invitation-lookup', invitationId, token],
+ queryFn: () => adminClient.auth.lookupInvitation(invitationId, token),
+ retry: false,
+ })
+
+ if (lookup.isPending) {
+ return (
+ <Card>
+ <CardContent className="py-12 text-center text-muted-foreground">
+ Loading invitation…
+ </CardContent>
+ </Card>
+ )
+ }
+
+ if (lookup.isError) {
+ const err = lookup.error as SpreeError
+ return (
+ <ErrorCard
+ title={err.status === 404 ? 'Invitation not found' : 'Could not load invitation'}
+ message={
+ err.status === 404
+ ? 'This invitation has expired, been revoked, or already been accepted. Ask the inviter to send a new one.'
+ : err.message || 'Something went wrong. Please try again.'
+ }
+ />
+ )
+ }
+
+ return <AcceptForm invitationId={invitationId} token={token} invitation={lookup.data} />
+}
+
+function AcceptForm({
+ invitationId,
+ token,
+ invitation,
+}: {
+ invitationId: string
+ token: string
+ invitation: InvitationLookup
+}) {
+ return invitation.invitee_exists ? (
+ <SignInForm invitationId={invitationId} token={token} invitation={invitation} />
+ ) : (
+ <SignUpForm invitationId={invitationId} token={token} invitation={invitation} />
+ )
+}
+
+const signInSchema = z.object({
+ password: z.string().min(1, 'Password is required'),
+})
+type SignInForm = z.infer<typeof signInSchema>
+
+function SignInForm({
+ invitationId,
+ token,
+ invitation,
+}: {
+ invitationId: string
+ token: string
+ invitation: InvitationLookup
+}) {
+ const { acceptInvitation, isLoading } = useAuth()
+ const navigate = useNavigate()
+
+ const form = useForm<SignInForm>({
+ resolver: zodResolver(signInSchema),
+ defaultValues: { password: '' },
+ })
+
+ const onSubmit = async (data: SignInForm) => {
+ try {
+ await acceptInvitation(invitationId, token, { password: data.password })
+ navigate({ to: '/', replace: true })
+ } catch (err) {
+ const e = err as SpreeError
+ form.setError('root', {
+ message: e.status === 401 ? 'Invalid password' : e.message || 'Could not accept invitation',
+ })
+ }
+ }
+
+ return (
+ <Card>
+ <CardHeader className="text-center">
+ <CardTitle className="text-xl">Join {invitation.store.name ?? 'this store'}</CardTitle>
+ <CardDescription>
+ {invitation.inviter_email
+ ? `${invitation.inviter_email} invited you`
+ : 'You have been invited'}
+ {invitation.role_name ? ` as ${invitation.role_name}` : null}. Sign in to accept.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <form onSubmit={form.handleSubmit(onSubmit)} className="grid gap-6">
+ {form.formState.errors.root && (
+ <p className="text-center text-sm text-destructive">
+ {form.formState.errors.root.message}
+ </p>
+ )}
+ <div className="grid gap-2">
+ <Label>Email</Label>
+ <Input value={invitation.email} disabled />
+ </div>
+ <div className="grid gap-2">
+ <Label htmlFor="password">Password</Label>
+ <Input id="password" type="password" autoFocus {...form.register('password')} />
+ {form.formState.errors.password && (
+ <p className="text-sm text-destructive">{form.formState.errors.password.message}</p>
+ )}
+ </div>
+ <Button type="submit" className="w-full" disabled={isLoading}>
+ {isLoading ? 'Accepting…' : 'Sign in & accept'}
+ </Button>
+ </form>
+ </CardContent>
+ </Card>
+ )
+}
+
+const signUpSchema = z
+ .object({
+ first_name: z.string().min(1, 'First name is required'),
+ last_name: z.string().min(1, 'Last name is required'),
+ password: z.string().min(8, 'Password must be at least 8 characters'),
+ password_confirmation: z.string(),
+ })
+ .refine((data) => data.password === data.password_confirmation, {
+ message: 'Passwords do not match',
+ path: ['password_confirmation'],
+ })
+type SignUpForm = z.infer<typeof signUpSchema>
+
+function SignUpForm({
+ invitationId,
+ token,
+ invitation,
+}: {
+ invitationId: string
+ token: string
+ invitation: InvitationLookup
+}) {
+ const { acceptInvitation, isLoading } = useAuth()
+ const navigate = useNavigate()
+
+ const form = useForm<SignUpForm>({
+ resolver: zodResolver(signUpSchema),
+ defaultValues: { first_name: '', last_name: '', password: '', password_confirmation: '' },
+ })
+
+ const onSubmit = async (data: SignUpForm) => {
+ try {
+ await acceptInvitation(invitationId, token, data)
+ navigate({ to: '/', replace: true })
+ } catch (err) {
+ const e = err as SpreeError
+ form.setError('root', { message: e.message || 'Could not accept invitation' })
+ }
+ }
+
+ return (
+ <Card>
+ <CardHeader className="text-center">
+ <CardTitle className="text-xl">Join {invitation.store.name ?? 'this store'}</CardTitle>
+ <CardDescription>
+ {invitation.inviter_email
+ ? `${invitation.inviter_email} invited you`
+ : 'You have been invited'}
+ {invitation.role_name ? ` as ${invitation.role_name}` : null}. Create your account to
+ accept.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <form onSubmit={form.handleSubmit(onSubmit)} className="grid gap-6">
+ {form.formState.errors.root && (
+ <p className="text-center text-sm text-destructive">
+ {form.formState.errors.root.message}
+ </p>
+ )}
+ <div className="grid gap-2">
+ <Label>Email</Label>
+ <Input value={invitation.email} disabled />
+ </div>
+ <div className="grid grid-cols-2 gap-3">
+ <div className="grid gap-2">
+ <Label htmlFor="first_name">First name</Label>
+ <Input id="first_name" autoFocus {...form.register('first_name')} />
+ {form.formState.errors.first_name && (
+ <p className="text-sm text-destructive">
+ {form.formState.errors.first_name.message}
+ </p>
+ )}
+ </div>
+ <div className="grid gap-2">
+ <Label htmlFor="last_name">Last name</Label>
+ <Input id="last_name" {...form.register('last_name')} />
+ {form.formState.errors.last_name && (
+ <p className="text-sm text-destructive">
+ {form.formState.errors.last_name.message}
+ </p>
+ )}
+ </div>
+ </div>
+ <div className="grid gap-2">
+ <Label htmlFor="password">Password</Label>
+ <Input id="password" type="password" {...form.register('password')} />
+ {form.formState.errors.password && (
+ <p className="text-sm text-destructive">{form.formState.errors.password.message}</p>
+ )}
+ </div>
+ <div className="grid gap-2">
+ <Label htmlFor="password_confirmation">Confirm password</Label>
+ <Input
+ id="password_confirmation"
+ type="password"
+ {...form.register('password_confirmation')}
+ />
+ {form.formState.errors.password_confirmation && (
+ <p className="text-sm text-destructive">
+ {form.formState.errors.password_confirmation.message}
+ </p>
+ )}
+ </div>
+ <Button type="submit" className="w-full" disabled={isLoading}>
+ {isLoading ? 'Creating account…' : 'Create account & accept'}
+ </Button>
+ </form>
+ </CardContent>
+ </Card>
+ )
+}
+
+function ErrorCard({ title, message }: { title: string; message: string }) {
+ return (
+ <Card>
+ <CardHeader className="text-center">
+ <CardTitle className="text-xl">{title}</CardTitle>
+ <CardDescription>{message}</CardDescription>
+ </CardHeader>
+ </Card>
+ )
+}
+
+function Shell({ children }: { children: React.ReactNode }) {
+ return (
+ <div className="flex min-h-svh flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10">
+ <div className="flex w-full max-w-sm flex-col gap-6">{children}</div>
+ </div>
+ )
+}
diff --git a/spree/api/app/controllers/spree/api/v3/admin/invitation_acceptances_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/invitation_acceptances_controller.rb
new file mode 100644
index 0000000000..7928944553
--- /dev/null
+++ b/spree/api/app/controllers/spree/api/v3/admin/invitation_acceptances_controller.rb
@@ -0,0 +1,153 @@
+module Spree
+ module Api
+ module V3
+ module Admin
+ # Public invitation acceptance — mounted under `/api/v3/admin/auth/...`
+ # so the issued refresh-token cookie's path matches `/auth/refresh`.
+ class InvitationAcceptancesController < BaseController
+ include Spree::Api::V3::Admin::AuthCookies
+
+ skip_scope_check!
+ skip_before_action :authenticate_admin!, only: [:lookup, :accept]
+
+ rate_limit to: Spree::Api::Config[:rate_limit_login],
+ within: Spree::Api::Config[:rate_limit_window].seconds,
+ store: Rails.cache,
+ only: [:lookup, :accept],
+ with: RATE_LIMIT_RESPONSE
+
+ # GET /api/v3/admin/auth/invitations/:id/lookup?token=:token
+ def lookup
+ return unless load_invitation
+
+ render json: lookup_response(@invitation)
+ end
+
+ # POST /api/v3/admin/auth/invitations/:id/accept?token=:token
+ # Body: { password?, password_confirmation?, first_name?, last_name? }
+ def accept
+ return unless load_invitation
+
+ user = resolve_or_create_invitee(@invitation)
+ return if performed?
+
+ @invitation.invitee = user
+ @invitation.accept!
+
+ refresh_token = Spree::RefreshToken.create_for(user, request_env: request_env_for_token)
+ set_refresh_cookie(refresh_token)
+ render json: auth_response(user)
+ rescue ActiveRecord::RecordInvalid => e
+ render_validation_error(e.record.errors)
+ end
+
+ private
+
+ # Token mismatch is treated identically to "not found" to avoid
+ # leaking whether an ID exists.
+ def load_invitation
+ decoded_id = Spree::Invitation.decode_prefixed_id(params[:id])
+ @invitation = Spree::Invitation.pending.not_expired.find_by(id: decoded_id, token: params[:token])
+
+ unless @invitation
+ render_error(
+ code: ERROR_CODES[:record_not_found],
+ message: 'Invitation not found, expired, or already accepted',
+ status: :not_found
+ )
+ return false
+ end
+
+ true
+ end
+
+ def lookup_response(invitation)
+ {
+ id: invitation.prefixed_id,
+ email: invitation.email,
+ role_name: invitation.role&.name,
+ inviter_email: invitation.inviter&.email,
+ expires_at: invitation.expires_at&.iso8601,
+ invitee_exists: Spree.admin_user_class.exists?(email: invitation.email),
+ store: {
+ id: invitation.store&.prefixed_id,
+ name: invitation.store&.name
+ }
+ }
+ end
+
+ # Email match between the invitation and any existing account is
+ # implicit: we look the user up by `invitation.email`, never by a
+ # client-supplied email. The token is the credential.
+ def resolve_or_create_invitee(invitation)
+ existing = Spree.admin_user_class.find_by(email: invitation.email)
+ return authenticate_existing(existing) if existing
+
+ create_new_invitee(invitation)
+ end
+
+ def authenticate_existing(user)
+ return user if user.valid_password?(params[:password].to_s)
+
+ render_error(
+ code: ERROR_CODES[:authentication_failed],
+ message: 'Invalid password',
+ status: :unauthorized
+ )
+ nil
+ end
+
+ def create_new_invitee(invitation)
+ if params[:password].blank?
+ render_error(
+ code: ERROR_CODES[:parameter_missing],
+ message: 'Password is required to create your account',
+ status: :unprocessable_content
+ )
+ return nil
+ end
+
+ Spree.admin_user_class.create!(signup_params(invitation))
+ end
+
+ def signup_params(invitation)
+ params.permit(:password, :password_confirmation, :first_name, :last_name).
+ merge(email: invitation.email)
+ end
+
+ def auth_response(user)
+ {
+ token: generate_jwt(user, audience: JWT_AUDIENCE_ADMIN),
+ user: admin_user_serializer.new(user, params: serializer_params).to_h
+ }
+ end
+
+ def serializer_params
+ {
+ store: @invitation&.store || current_store,
+ locale: current_locale,
+ currency: current_currency,
+ user: nil,
+ includes: []
+ }
+ end
+
+ def admin_user_serializer
+ Spree.api.admin_admin_user_serializer
+ end
+
+ def request_env_for_token
+ {
+ ip_address: request.remote_ip,
+ user_agent: request.user_agent&.truncate(255)
+ }
+ end
+
+ def jwt_expiration
+ Spree::Api::Config[:admin_jwt_expiration]
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/app/serializers/spree/api/v3/admin/invitation_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/invitation_serializer.rb
index e2c7ff804d..187149de55 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/invitation_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/invitation_serializer.rb
@@ -12,7 +12,8 @@ module Spree
role_id: [:string, nullable: true],
role_name: [:string, nullable: true],
inviter_email: [:string, nullable: true],
- expires_at: [:string, nullable: true]
+ expires_at: [:string, nullable: true],
+ acceptance_url: :string
attributes :email, :status,
created_at: :iso8601, updated_at: :iso8601, expires_at: :iso8601
@@ -28,6 +29,16 @@ module Spree
attribute :inviter_email do |invitation|
invitation.inviter&.email
end
+
+ # Absolute URL when `Spree::Config[:admin_url]` is set, otherwise
+ # the path so the SPA can prepend `window.location.origin`.
+ attribute :acceptance_url do |invitation|
+ if Spree::Config[:admin_url].present?
+ Rails.application.routes.url_helpers.admin_invitation_acceptance_url(invitation)
+ else
+ "/accept-invitation/#{invitation.prefixed_id}?token=#{invitation.token}"
+ end
+ end
end
end
end
diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rb
index d23305a237..7f8e8a3d3e 100644
--- a/spree/api/config/routes.rb
+++ b/spree/api/config/routes.rb
@@ -105,6 +105,12 @@ Spree::Core::Engine.add_routes do
post 'auth/refresh', to: 'auth#refresh'
post 'auth/logout', to: 'auth#logout'
+ # Public invitation acceptance — unauthenticated; the prefixed ID +
+ # token in the URL act as the credential. Mounted under `auth/` so
+ # the issued refresh-token cookie's path matches `/auth/refresh`.
+ get 'auth/invitations/:id/lookup', to: 'invitation_acceptances#lookup'
+ post 'auth/invitations/:id/accept', to: 'invitation_acceptances#accept'
+
# Dashboard
namespace :dashboard do
get :analytics
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/invitation_acceptances_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/invitation_acceptances_controller_spec.rb
new file mode 100644
index 0000000000..54406f8926
--- /dev/null
+++ b/spree/api/spec/controllers/spree/api/v3/admin/invitation_acceptances_controller_spec.rb
@@ -0,0 +1,126 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Api::V3::Admin::InvitationAcceptancesController, type: :controller do
+ render_views
+
+ include_context 'API v3 Admin'
+
+ let(:role) { Spree::Role.default_admin_role }
+ let!(:inviter) { create(:admin_user) }
+ let(:invitation_email) { '[email protected]' }
+
+ # The "set_invitee_from_email" before_validation callback only runs on
+ # create — fine for our tests since the controller resolves invitee
+ # itself at accept-time. `inviter` is `let!` so its row already exists
+ # before any `expect { ... }.to change(AdminUser, :count)` block runs.
+ let!(:invitation) do
+ create(:invitation, email: invitation_email, resource: store, role: role, inviter: inviter)
+ end
+
+ describe 'GET #lookup' do
+ context 'with a valid prefixed ID + token' do
+ it 'returns the safe invitation context' do
+ get :lookup, params: { id: invitation.prefixed_id, token: invitation.token }
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['email']).to eq(invitation_email)
+ expect(json_response['role_name']).to eq(role.name)
+ expect(json_response['inviter_email']).to eq(inviter.email)
+ expect(json_response['invitee_exists']).to eq(false)
+ expect(json_response['store']['name']).to eq(store.name)
+ end
+
+ it 'reports invitee_exists when an admin user with that email already exists' do
+ create(:admin_user, :without_admin_role, email: invitation_email)
+ get :lookup, params: { id: invitation.prefixed_id, token: invitation.token }
+
+ expect(json_response['invitee_exists']).to eq(true)
+ end
+ end
+
+ context 'with a wrong token' do
+ it 'returns 404' do
+ get :lookup, params: { id: invitation.prefixed_id, token: 'bogus' }
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+
+ context 'when the invitation has expired' do
+ it 'returns 404' do
+ invitation.update_columns(expires_at: 1.day.ago)
+ get :lookup, params: { id: invitation.prefixed_id, token: invitation.token }
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+ end
+
+ describe 'POST #accept' do
+ context 'when the invitee already has an account' do
+ let!(:existing) do
+ create(:admin_user, :without_admin_role, email: invitation_email,
+ password: 'password123', password_confirmation: 'password123')
+ end
+
+ it 'verifies the password, accepts, and issues a JWT' do
+ post :accept,
+ params: { id: invitation.prefixed_id, token: invitation.token, password: 'password123' }
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['token']).to be_present
+ expect(json_response['user']['email']).to eq(invitation_email)
+ expect(invitation.reload.status).to eq('accepted')
+ expect(invitation.reload.invitee_id).to eq(existing.id)
+ end
+
+ it 'rejects an invalid password without accepting the invitation' do
+ post :accept,
+ params: { id: invitation.prefixed_id, token: invitation.token, password: 'wrong' }
+
+ expect(response).to have_http_status(:unauthorized)
+ expect(invitation.reload.status).to eq('pending')
+ end
+ end
+
+ context 'when the invitee does not yet have an account' do
+ it 'creates the user, accepts the invitation, and issues a JWT' do
+ expect {
+ post :accept, params: {
+ id: invitation.prefixed_id,
+ token: invitation.token,
+ password: 'password123',
+ password_confirmation: 'password123',
+ first_name: 'Pat',
+ last_name: 'Carlson'
+ }
+ }.to change(Spree.admin_user_class, :count).by(1)
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['token']).to be_present
+ expect(json_response['user']['email']).to eq(invitation_email)
+
+ new_user = Spree.admin_user_class.find_by(email: invitation_email)
+ expect(new_user.first_name).to eq('Pat')
+ expect(invitation.reload.status).to eq('accepted')
+ expect(invitation.reload.invitee_id).to eq(new_user.id)
+ end
+
+ it 'returns a validation error when password is missing' do
+ post :accept,
+ params: { id: invitation.prefixed_id, token: invitation.token, first_name: 'Pat' }
+
+ expect(response).to have_http_status(:unprocessable_content)
+ expect(invitation.reload.status).to eq('pending')
+ end
+ end
+
+ context 'with a wrong token' do
+ it 'returns 404 without touching the invitation' do
+ post :accept,
+ params: { id: invitation.prefixed_id, token: 'bogus', password: 'whatever' }
+
+ expect(response).to have_http_status(:not_found)
+ expect(invitation.reload.status).to eq('pending')
+ end
+ end
+ end
+end
diff --git a/spree/core/app/views/spree/invitation_mailer/invitation_email.html.erb b/spree/core/app/views/spree/invitation_mailer/invitation_email.html.erb
index ab57c9e8dc..5750159893 100644
--- a/spree/core/app/views/spree/invitation_mailer/invitation_email.html.erb
+++ b/spree/core/app/views/spree/invitation_mailer/invitation_email.html.erb
@@ -12,6 +12,10 @@
<p>
<%= link_to Spree.t(:accept), spree.admin_invitation_url(@invitation, token: @invitation.token, host: @invitation.store.formatted_url) %>
</p>
+<% else %>
+ <p>
+ <%= link_to Spree.t(:accept), main_app.admin_invitation_acceptance_url(@invitation) %>
+ </p>
<% end %>
<p>
diff --git a/spree/core/config/routes.rb b/spree/core/config/routes.rb
index b4e980619b..8d9f9374d8 100644
--- a/spree/core/config/routes.rb
+++ b/spree/core/config/routes.rb
@@ -40,6 +40,15 @@ Rails.application.routes.draw do
)
end
end
+ # Used by admin mailers; the SPA derives the URL from `window.location.origin` instead.
+ direct :admin_invitation_acceptance do |invitation, _options = {}|
+ path = "/accept-invitation/#{invitation.prefixed_id}?token=#{invitation.token}"
+ base = Spree::Config[:admin_url].presence ||
+ (Rails.env.development? ? 'http://localhost:5173' : nil) ||
+ invitation.store&.formatted_url
+
+ base.present? ? "#{base.chomp('/')}#{path}" : path
+ end
end
Spree::Core::Engine.draw_routes
diff --git a/spree/core/lib/spree/core/configuration.rb b/spree/core/lib/spree/core/configuration.rb
index 0251add6b0..d0ada2ba25 100644
--- a/spree/core/lib/spree/core/configuration.rb
+++ b/spree/core/lib/spree/core/configuration.rb
@@ -25,6 +25,10 @@ module Spree
# Alphabetized to more easily lookup particular preferences
preference :address_requires_state, :boolean, default: true, deprecated: true # should state/state_name be required
preference :address_requires_phone, :boolean, default: false # Determines whether we require phone in address
+ # Origin where the admin SPA is hosted (e.g. `https://admin.shop.com`).
+ # Used by admin mailers; falls back to `http://localhost:5173` in dev
+ # and the store's storefront URL otherwise. Set this in production.
+ preference :admin_url, :string, default: nil
preference :allow_checkout_on_gateway_error, :boolean, default: false
preference :allow_empty_price_amount, :boolean, default: false
preference :allow_guest_checkout, :boolean, default: true, deprecated: true # this is only used in the rails frontend, and is not implemented in API
diff --git a/spree/core/spec/mailers/spree/invitation_mailer_spec.rb b/spree/core/spec/mailers/spree/invitation_mailer_spec.rb
index 24c0082b91..3c4acb2d81 100644
--- a/spree/core/spec/mailers/spree/invitation_mailer_spec.rb
+++ b/spree/core/spec/mailers/spree/invitation_mailer_spec.rb
@@ -5,10 +5,8 @@ RSpec.describe Spree::InvitationMailer, type: :mailer do
let(:inviter) { create(:admin_user) }
let(:invitation) { create(:invitation, email: '[email protected]', inviter: inviter, resource: store, skip_email: true) }
let(:spree) { Spree::Core::Engine.routes.url_helpers }
-
- before do
- allow(spree).to receive(:admin_invitation_url).and_return("http://test.com/admin/invitations/#{invitation.id}?token=#{invitation.token}")
- end
+ let(:legacy_admin_url) { "http://test.com/admin/invitations/#{invitation.id}?token=#{invitation.token}" }
+ let(:spa_acceptance_url) { Rails.application.routes.url_helpers.admin_invitation_acceptance_url(invitation) }
describe '#invitation_email' do
subject(:mail) { described_class.invitation_email(invitation) }
@@ -31,9 +29,60 @@ RSpec.describe Spree::InvitationMailer, type: :mailer do
expect(mail.reply_to).to eq([store.mail_from_address])
end
- it 'includes the invitation link in the body' do
- expect(mail.body.encoded).to include(Spree.t(:accept))
- expect(mail.body.encoded).to include("http://test.com/admin/invitations/#{invitation.id}?token=#{invitation.token}")
+ # The link target depends on whether the legacy `spree_admin` Rails gem
+ # is loaded — when present its `admin_invitation_url` route helper takes
+ # precedence so existing deployments keep working unchanged. When
+ # absent (the 6.0 SPA-only setup) the mailer falls back to the
+ # `admin_invitation_acceptance` direct route, which points at the SPA.
+ context 'when the legacy spree_admin gem is installed' do
+ before do
+ allow(spree).to receive(:respond_to?).and_call_original
+ allow(spree).to receive(:respond_to?).with(:admin_invitation_url).and_return(true)
+ allow(spree).to receive(:admin_invitation_url).and_return(legacy_admin_url)
+ end
+
+ it 'uses spree.admin_invitation_url for the accept link' do
+ expect(mail.body.encoded).to include(Spree.t(:accept))
+ expect(mail.body.encoded).to include(legacy_admin_url)
+ expect(mail.body.encoded).not_to include(spa_acceptance_url)
+ end
+ end
+
+ context 'when the legacy spree_admin gem is not installed' do
+ before do
+ allow(spree).to receive(:respond_to?).and_call_original
+ allow(spree).to receive(:respond_to?).with(:admin_invitation_url).and_return(false)
+ Spree::Config[:admin_url] = 'https://admin.example.com'
+ end
+
+ after do
+ Spree::Config[:admin_url] = nil
+ end
+
+ it 'uses the admin_invitation_acceptance helper for the accept link' do
+ expect(mail.body.encoded).to include(Spree.t(:accept))
+ expect(mail.body.encoded).to include(spa_acceptance_url)
+ expect(mail.body.encoded).not_to include(legacy_admin_url)
+ end
+
+ it 'honors Spree::Config[:admin_url] in the rendered URL' do
+ expect(mail.body.encoded).to include(
+ "https://admin.example.com/accept-invitation/#{invitation.prefixed_id}"
+ )
+ end
+ end
+
+ context 'when neither the legacy gem nor admin_url is configured' do
+ before do
+ allow(spree).to receive(:respond_to?).and_call_original
+ allow(spree).to receive(:respond_to?).with(:admin_invitation_url).and_return(false)
+ end
+
+ # Falls through to the store's storefront URL — keeps the dummy/test
+ # app + all-in-one installs working without any Spree::Config setup.
+ it 'falls back to the storefront URL' do
+ expect(mail.body.encoded).to match(%r{accept-invitation/#{invitation.prefixed_id}\?token=#{invitation.token}})
+ end
end
end