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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Let a seller complete every kind of onboarding task
Damian Legawiec862fb4f34123
diff --git a/packages/admin-sdk/examples/admin-users/get.ts b/packages/admin-sdk/examples/admin-users/get.tsindex c7247eca2c..342e64d6b1 100644--- a/packages/admin-sdk/examples/admin-users/get.ts+++ b/packages/admin-sdk/examples/admin-users/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst staff = await client.adminUsers.get('admin_xxx')+// endregion:exampleexport { staff }diff --git a/packages/admin-sdk/examples/admin-users/list.ts b/packages/admin-sdk/examples/admin-users/list.tsindex 856522f50c..3b9b258468 100644--- a/packages/admin-sdk/examples/admin-users/list.ts+++ b/packages/admin-sdk/examples/admin-users/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: staff } = await client.adminUsers.list()+// endregion:exampleexport { staff }diff --git a/packages/admin-sdk/examples/admin-users/update.ts b/packages/admin-sdk/examples/admin-users/update.tsindex d8f4e24810..398d6ef493 100644--- a/packages/admin-sdk/examples/admin-users/update.ts+++ b/packages/admin-sdk/examples/admin-users/update.ts@@ -8,8 +8,9 @@ const client = createAdminClient({// region:exampleconst staff = await client.adminUsers.update('admin_xxx', {first_name: 'Ada',- role_ids: ['role_xxx']+ role_ids: ['role_xxx'],})+// endregion:exampleexport { staff }diff --git a/packages/admin-sdk/examples/api-keys/create.ts b/packages/admin-sdk/examples/api-keys/create.tsindex 46797c6802..b924887717 100644--- a/packages/admin-sdk/examples/api-keys/create.ts+++ b/packages/admin-sdk/examples/api-keys/create.ts@@ -9,8 +9,9 @@ const client = createAdminClient({const key = await client.apiKeys.create({name: 'Backend integration',key_type: 'secret',- scopes: ['read_orders', 'write_orders']+ scopes: ['read_orders', 'write_orders'],})+// `key.plaintext_token` is available only on this response.// endregion:examplediff --git a/packages/admin-sdk/examples/api-keys/get.ts b/packages/admin-sdk/examples/api-keys/get.tsindex 98127f406b..8c772bc7e8 100644--- a/packages/admin-sdk/examples/api-keys/get.ts+++ b/packages/admin-sdk/examples/api-keys/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst key = await client.apiKeys.get('key_xxx')+// endregion:exampleexport { key }diff --git a/packages/admin-sdk/examples/api-keys/list.ts b/packages/admin-sdk/examples/api-keys/list.tsindex fc85508230..e7e90a9c51 100644--- a/packages/admin-sdk/examples/api-keys/list.ts+++ b/packages/admin-sdk/examples/api-keys/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: keys } = await client.apiKeys.list()+// endregion:exampleexport { keys }diff --git a/packages/admin-sdk/examples/api-keys/revoke.ts b/packages/admin-sdk/examples/api-keys/revoke.tsindex d48d9d66d9..04a4447e6f 100644--- a/packages/admin-sdk/examples/api-keys/revoke.ts+++ b/packages/admin-sdk/examples/api-keys/revoke.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst key = await client.apiKeys.revoke('key_xxx')+// endregion:exampleexport { key }diff --git a/packages/admin-sdk/examples/auth/login.ts b/packages/admin-sdk/examples/auth/login.tsindex 883a41915a..f4462c8b1d 100644--- a/packages/admin-sdk/examples/auth/login.ts+++ b/packages/admin-sdk/examples/auth/login.ts@@ -11,6 +11,7 @@ const auth = await client.auth.login({email: '[email protected]',password: 'password123',})+// endregion:exampleexport { auth }diff --git a/packages/admin-sdk/examples/auth/logout.ts b/packages/admin-sdk/examples/auth/logout.tsindex 2a18c9b084..bf0965555e 100644--- a/packages/admin-sdk/examples/auth/logout.ts+++ b/packages/admin-sdk/examples/auth/logout.ts@@ -8,5 +8,3 @@ const client = createAdminClient({// region:exampleawait client.auth.logout()// endregion:example--export {}diff --git a/packages/admin-sdk/examples/auth/refresh.ts b/packages/admin-sdk/examples/auth/refresh.tsindex 14a6f721a3..e745a3788c 100644--- a/packages/admin-sdk/examples/auth/refresh.ts+++ b/packages/admin-sdk/examples/auth/refresh.ts@@ -8,6 +8,7 @@ const client = createAdminClient({// region:example// Driven entirely by the HttpOnly refresh-token cookie + CSRF header (set by the SDK).const auth = await client.auth.refresh()+// endregion:exampleexport { auth }diff --git a/packages/admin-sdk/examples/coupon-codes/list.ts b/packages/admin-sdk/examples/coupon-codes/list.tsindex f157f171df..0321fe8fa7 100644--- a/packages/admin-sdk/examples/coupon-codes/list.ts+++ b/packages/admin-sdk/examples/coupon-codes/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: coupons } = await client.promotions.couponCodes.list('promo_UkLWZg9DAJ')+// endregion:exampleexport { coupons }diff --git a/packages/admin-sdk/examples/custom-field-definitions/create.ts b/packages/admin-sdk/examples/custom-field-definitions/create.tsindex 6338391de8..8e3556c3f3 100644--- a/packages/admin-sdk/examples/custom-field-definitions/create.ts+++ b/packages/admin-sdk/examples/custom-field-definitions/create.ts@@ -14,6 +14,7 @@ const definition = await client.customFieldDefinitions.create({resource_type: 'Spree::Product',storefront_visible: true,})+// endregion:exampleexport { definition }diff --git a/packages/admin-sdk/examples/custom-field-definitions/list.ts b/packages/admin-sdk/examples/custom-field-definitions/list.tsindex d991fc9e18..1f64af5f43 100644--- a/packages/admin-sdk/examples/custom-field-definitions/list.ts+++ b/packages/admin-sdk/examples/custom-field-definitions/list.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const { data: definitions } = await client.customFieldDefinitions.list({q: { resource_type_eq: 'Spree::Product' },})+// endregion:exampleexport { definitions }diff --git a/packages/admin-sdk/examples/customer-addresses/list.ts b/packages/admin-sdk/examples/customer-addresses/list.tsindex fe084cf19a..e40e35ebb9 100644--- a/packages/admin-sdk/examples/customer-addresses/list.ts+++ b/packages/admin-sdk/examples/customer-addresses/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: addresses } = await client.customers.addresses.list('cus_UkLWZg9DAJ')+// endregion:exampleexport { addresses }diff --git a/packages/admin-sdk/examples/customer-addresses/update.ts b/packages/admin-sdk/examples/customer-addresses/update.tsindex 4a8c451a0a..4cd8ff3ac6 100644--- a/packages/admin-sdk/examples/customer-addresses/update.ts+++ b/packages/admin-sdk/examples/customer-addresses/update.ts@@ -6,11 +6,10 @@ const client = createAdminClient({})// region:example-const address = await client.customers.addresses.update(- 'cus_UkLWZg9DAJ',- 'addr_UkLWZg9DAJ',- { city: 'Manhattan' },-)+const address = await client.customers.addresses.update('cus_UkLWZg9DAJ', 'addr_UkLWZg9DAJ', {+ city: 'Manhattan',+})+// endregion:exampleexport { address }diff --git a/packages/admin-sdk/examples/customer-credit-cards/get.ts b/packages/admin-sdk/examples/customer-credit-cards/get.tsindex 405def0ddf..d728b6d4f6 100644--- a/packages/admin-sdk/examples/customer-credit-cards/get.ts+++ b/packages/admin-sdk/examples/customer-credit-cards/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst card = await client.customers.creditCards.get('cus_UkLWZg9DAJ', 'cc_UkLWZg9DAJ')+// endregion:exampleexport { card }diff --git a/packages/admin-sdk/examples/customer-credit-cards/list.ts b/packages/admin-sdk/examples/customer-credit-cards/list.tsindex d9ee9f46a8..a6bc15d9d2 100644--- a/packages/admin-sdk/examples/customer-credit-cards/list.ts+++ b/packages/admin-sdk/examples/customer-credit-cards/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: cards } = await client.customers.creditCards.list('cus_UkLWZg9DAJ')+// endregion:exampleexport { cards }diff --git a/packages/admin-sdk/examples/customer-groups/create.ts b/packages/admin-sdk/examples/customer-groups/create.tsindex ea31832d6f..314ad74a8f 100644--- a/packages/admin-sdk/examples/customer-groups/create.ts+++ b/packages/admin-sdk/examples/customer-groups/create.ts@@ -11,6 +11,7 @@ const group = await client.customerGroups.create({description: 'Top spenders, eligible for early access',customer_ids: ['cus_UkLWZg9DAJ', 'cus_QrLWXg9CAJ'],})+// endregion:exampleexport { group }diff --git a/packages/admin-sdk/examples/customer-groups/get.ts b/packages/admin-sdk/examples/customer-groups/get.tsindex 22539f4579..700d5e4e58 100644--- a/packages/admin-sdk/examples/customer-groups/get.ts+++ b/packages/admin-sdk/examples/customer-groups/get.ts@@ -9,6 +9,7 @@ const client = createAdminClient({// Pass `expand: ['customers']` to embed the group's customers in the response// — omit it for the much smaller index-payload shape.const group = await client.customerGroups.get('cg_UkLWZg9DAJ', { expand: ['customers'] })+// endregion:exampleexport { group }diff --git a/packages/admin-sdk/examples/customer-groups/list.ts b/packages/admin-sdk/examples/customer-groups/list.tsindex ee6431d402..373dbbf31d 100644--- a/packages/admin-sdk/examples/customer-groups/list.ts+++ b/packages/admin-sdk/examples/customer-groups/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: groups } = await client.customerGroups.list({ page: 1, limit: 25 })+// endregion:exampleexport { groups }diff --git a/packages/admin-sdk/examples/customer-groups/update.ts b/packages/admin-sdk/examples/customer-groups/update.tsindex cf99fbb25f..8c9a1429f4 100644--- a/packages/admin-sdk/examples/customer-groups/update.ts+++ b/packages/admin-sdk/examples/customer-groups/update.ts@@ -12,6 +12,7 @@ const group = await client.customerGroups.update('cg_UkLWZg9DAJ', {name: 'VIP customers (Q1)',customer_ids: ['cus_UkLWZg9DAJ'],})+// endregion:exampleexport { group }diff --git a/packages/admin-sdk/examples/customer-store-credits/list.ts b/packages/admin-sdk/examples/customer-store-credits/list.tsindex 4ab104cddb..a746111674 100644--- a/packages/admin-sdk/examples/customer-store-credits/list.ts+++ b/packages/admin-sdk/examples/customer-store-credits/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: storeCredits } = await client.customers.storeCredits.list('cus_UkLWZg9DAJ')+// endregion:exampleexport { storeCredits }diff --git a/packages/admin-sdk/examples/customer-store-credits/update.ts b/packages/admin-sdk/examples/customer-store-credits/update.tsindex 4324f89a6c..4ade8f96b3 100644--- a/packages/admin-sdk/examples/customer-store-credits/update.ts+++ b/packages/admin-sdk/examples/customer-store-credits/update.ts@@ -6,11 +6,10 @@ const client = createAdminClient({})// region:example-const credit = await client.customers.storeCredits.update(- 'cus_UkLWZg9DAJ',- 'sc_UkLWZg9DAJ',- { memo: 'Reissued for damaged shipment' },-)+const credit = await client.customers.storeCredits.update('cus_UkLWZg9DAJ', 'sc_UkLWZg9DAJ', {+ memo: 'Reissued for damaged shipment',+})+// endregion:exampleexport { credit }diff --git a/packages/admin-sdk/examples/customers/bulk-add-tags.ts b/packages/admin-sdk/examples/customers/bulk-add-tags.tsindex 0bfb2e257d..fcc469274d 100644--- a/packages/admin-sdk/examples/customers/bulk-add-tags.ts+++ b/packages/admin-sdk/examples/customers/bulk-add-tags.ts@@ -10,6 +10,7 @@ const result = await client.customers.bulkAddTags({ids: ['cus_UkLWZg9DAJ', 'cus_QrLWXg9CAJ'],tags: ['vip', 'newsletter'],})+// endregion:exampleexport { result }diff --git a/packages/admin-sdk/examples/customers/bulk-add-to-groups.ts b/packages/admin-sdk/examples/customers/bulk-add-to-groups.tsindex 092e73812d..7ffacd7cb6 100644--- a/packages/admin-sdk/examples/customers/bulk-add-to-groups.ts+++ b/packages/admin-sdk/examples/customers/bulk-add-to-groups.ts@@ -10,6 +10,7 @@ const result = await client.customers.bulkAddToGroups({ids: ['cus_UkLWZg9DAJ', 'cus_QrLWXg9CAJ'],customer_group_ids: ['cg_UkLWZg9DAJ'],})+// endregion:exampleexport { result }diff --git a/packages/admin-sdk/examples/customers/bulk-remove-from-groups.ts b/packages/admin-sdk/examples/customers/bulk-remove-from-groups.tsindex d595b2d75f..e3461135c1 100644--- a/packages/admin-sdk/examples/customers/bulk-remove-from-groups.ts+++ b/packages/admin-sdk/examples/customers/bulk-remove-from-groups.ts@@ -10,6 +10,7 @@ const result = await client.customers.bulkRemoveFromGroups({ids: ['cus_UkLWZg9DAJ'],customer_group_ids: ['cg_UkLWZg9DAJ'],})+// endregion:exampleexport { result }diff --git a/packages/admin-sdk/examples/customers/bulk-remove-tags.ts b/packages/admin-sdk/examples/customers/bulk-remove-tags.tsindex 97870dd821..a157b78429 100644--- a/packages/admin-sdk/examples/customers/bulk-remove-tags.ts+++ b/packages/admin-sdk/examples/customers/bulk-remove-tags.ts@@ -10,6 +10,7 @@ const result = await client.customers.bulkRemoveTags({ids: ['cus_UkLWZg9DAJ'],tags: ['vip'],})+// endregion:exampleexport { result }diff --git a/packages/admin-sdk/examples/customers/create.ts b/packages/admin-sdk/examples/customers/create.tsindex ac48d0083c..7e1579318e 100644--- a/packages/admin-sdk/examples/customers/create.ts+++ b/packages/admin-sdk/examples/customers/create.ts@@ -14,6 +14,7 @@ const customer = await client.customers.create({tags: ['wholesale'],accepts_email_marketing: true,})+// endregion:exampleexport { customer }diff --git a/packages/admin-sdk/examples/customers/get.ts b/packages/admin-sdk/examples/customers/get.tsindex 53b2a836e3..905aa871bf 100644--- a/packages/admin-sdk/examples/customers/get.ts+++ b/packages/admin-sdk/examples/customers/get.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const customer = await client.customers.get('cus_UkLWZg9DAJ', {expand: ['addresses', 'store_credits'],})+// endregion:exampleexport { customer }diff --git a/packages/admin-sdk/examples/customers/list.ts b/packages/admin-sdk/examples/customers/list.tsindex c08bb51aee..0c19a91ebc 100644--- a/packages/admin-sdk/examples/customers/list.ts+++ b/packages/admin-sdk/examples/customers/list.ts@@ -11,6 +11,7 @@ const { data: customers } = await client.customers.list({sort: '-created_at',limit: 25,})+// endregion:exampleexport { customers }diff --git a/packages/admin-sdk/examples/customers/update.ts b/packages/admin-sdk/examples/customers/update.tsindex 8db6a9d54b..6e6b8a38ba 100644--- a/packages/admin-sdk/examples/customers/update.ts+++ b/packages/admin-sdk/examples/customers/update.ts@@ -10,6 +10,7 @@ const customer = await client.customers.update('cus_UkLWZg9DAJ', {first_name: 'Updated',tags: ['wholesale', 'vip'],})+// endregion:exampleexport { customer }diff --git a/packages/admin-sdk/examples/exports/create.ts b/packages/admin-sdk/examples/exports/create.tsindex 5e49a55dc9..8b6bfe9d9a 100644--- a/packages/admin-sdk/examples/exports/create.ts+++ b/packages/admin-sdk/examples/exports/create.ts@@ -8,8 +8,9 @@ const client = createAdminClient({// region:exampleconst exp = await client.exports.create({type: 'Spree::Exports::Products',- search_params: { name_cont: 'shirt' }+ search_params: { name_cont: 'shirt' },})+// endregion:exampleexport { exp }diff --git a/packages/admin-sdk/examples/exports/download.ts b/packages/admin-sdk/examples/exports/download.tsindex f578e37a61..00aad68aea 100644--- a/packages/admin-sdk/examples/exports/download.ts+++ b/packages/admin-sdk/examples/exports/download.ts@@ -14,13 +14,13 @@ const exp = _exp as { download_url: string; filename: string }// region:example// Fetch with the Bearer token, then drive the browser download:const res = await fetch(exp.download_url, {- headers: { Authorization: `Bearer ${token}` }+ headers: { Authorization: `Bearer ${token}` },})const blob = await res.blob()const url = URL.createObjectURL(blob)const a = Object.assign(document.createElement('a'), {href: url,- download: exp.filename+ download: exp.filename,})a.click()URL.revokeObjectURL(url)diff --git a/packages/admin-sdk/examples/exports/get.ts b/packages/admin-sdk/examples/exports/get.tsindex f1839633a9..77dfdfd8db 100644--- a/packages/admin-sdk/examples/exports/get.ts+++ b/packages/admin-sdk/examples/exports/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst exp = await client.exports.get('exp_xxx')+// endregion:exampleexport { exp }diff --git a/packages/admin-sdk/examples/exports/list.ts b/packages/admin-sdk/examples/exports/list.tsindex 102bd14c5e..9c7137dc0f 100644--- a/packages/admin-sdk/examples/exports/list.ts+++ b/packages/admin-sdk/examples/exports/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: exports } = await client.exports.list()+// endregion:exampleexport { exports }diff --git a/packages/admin-sdk/examples/gift-card-batches/create.ts b/packages/admin-sdk/examples/gift-card-batches/create.tsindex cebf517b5a..5d418acf77 100644--- a/packages/admin-sdk/examples/gift-card-batches/create.ts+++ b/packages/admin-sdk/examples/gift-card-batches/create.ts@@ -13,6 +13,7 @@ const batch = await client.giftCardBatches.create({codes_count: 100,expires_at: '2030-12-31',})+// endregion:exampleexport { batch }diff --git a/packages/admin-sdk/examples/gift-card-batches/get.ts b/packages/admin-sdk/examples/gift-card-batches/get.tsindex 13f612f233..22898ec0fe 100644--- a/packages/admin-sdk/examples/gift-card-batches/get.ts+++ b/packages/admin-sdk/examples/gift-card-batches/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst batch = await client.giftCardBatches.get('gcb_K3zr8x')+// endregion:exampleexport { batch }diff --git a/packages/admin-sdk/examples/gift-card-batches/list.ts b/packages/admin-sdk/examples/gift-card-batches/list.tsindex ac190f7b6c..3dd077b143 100644--- a/packages/admin-sdk/examples/gift-card-batches/list.ts+++ b/packages/admin-sdk/examples/gift-card-batches/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: batches } = await client.giftCardBatches.list({ page: 1, limit: 25 })+// endregion:exampleexport { batches }diff --git a/packages/admin-sdk/examples/gift-cards/create.ts b/packages/admin-sdk/examples/gift-cards/create.tsindex 913d66263e..75a737c25a 100644--- a/packages/admin-sdk/examples/gift-cards/create.ts+++ b/packages/admin-sdk/examples/gift-cards/create.ts@@ -12,6 +12,7 @@ const giftCard = await client.giftCards.create({expires_at: '2030-12-31',user_id: 'cus_UkLWZg9DAJ',})+// endregion:exampleexport { giftCard }diff --git a/packages/admin-sdk/examples/gift-cards/get.ts b/packages/admin-sdk/examples/gift-cards/get.tsindex ba5c87141e..9c94f8f11e 100644--- a/packages/admin-sdk/examples/gift-cards/get.ts+++ b/packages/admin-sdk/examples/gift-cards/get.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const giftCard = await client.giftCards.get('gc_K3zr8x', {expand: ['customer', 'created_by', 'orders'],})+// endregion:exampleexport { giftCard }diff --git a/packages/admin-sdk/examples/gift-cards/list.ts b/packages/admin-sdk/examples/gift-cards/list.tsindex dda37b10dd..8fc3b6049e 100644--- a/packages/admin-sdk/examples/gift-cards/list.ts+++ b/packages/admin-sdk/examples/gift-cards/list.ts@@ -11,6 +11,7 @@ const { data: giftCards } = await client.giftCards.list({limit: 25,expand: ['customer', 'created_by'],})+// endregion:exampleexport { giftCards }diff --git a/packages/admin-sdk/examples/gift-cards/update.ts b/packages/admin-sdk/examples/gift-cards/update.tsindex 4699ec2641..e72db56547 100644--- a/packages/admin-sdk/examples/gift-cards/update.ts+++ b/packages/admin-sdk/examples/gift-cards/update.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const giftCard = await client.giftCards.update('gc_K3zr8x', {amount: '75.00',})+// endregion:exampleexport { giftCard }diff --git a/packages/admin-sdk/examples/invitations/create.ts b/packages/admin-sdk/examples/invitations/create.tsindex d5955226ed..4371f4c048 100644--- a/packages/admin-sdk/examples/invitations/create.ts+++ b/packages/admin-sdk/examples/invitations/create.ts@@ -8,8 +8,9 @@ const client = createAdminClient({// region:exampleconst invitation = await client.invitations.create({email: '[email protected]',- role_id: 'role_xxx'+ role_id: 'role_xxx',})+// endregion:exampleexport { invitation }diff --git a/packages/admin-sdk/examples/invitations/list.ts b/packages/admin-sdk/examples/invitations/list.tsindex 6041e86208..5238d8257c 100644--- a/packages/admin-sdk/examples/invitations/list.ts+++ b/packages/admin-sdk/examples/invitations/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: invitations } = await client.invitations.list()+// endregion:exampleexport { invitations }diff --git a/packages/admin-sdk/examples/invitations/resend.ts b/packages/admin-sdk/examples/invitations/resend.tsindex cff0fa5c60..1cdd12e075 100644--- a/packages/admin-sdk/examples/invitations/resend.ts+++ b/packages/admin-sdk/examples/invitations/resend.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst invitation = await client.invitations.resend('inv_xxx')+// endregion:exampleexport { invitation }diff --git a/packages/admin-sdk/examples/markets/get.ts b/packages/admin-sdk/examples/markets/get.tsindex cf52a66097..8b716cdc5a 100644--- a/packages/admin-sdk/examples/markets/get.ts+++ b/packages/admin-sdk/examples/markets/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst market = await client.markets.get('market_xxx')+// endregion:exampleexport { market }diff --git a/packages/admin-sdk/examples/markets/list.ts b/packages/admin-sdk/examples/markets/list.tsindex 543144d47f..667b021c6d 100644--- a/packages/admin-sdk/examples/markets/list.ts+++ b/packages/admin-sdk/examples/markets/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: markets } = await client.markets.list()+// endregion:exampleexport { markets }diff --git a/packages/admin-sdk/examples/me/get.ts b/packages/admin-sdk/examples/me/get.tsindex d65fc5b5bf..be79d149d2 100644--- a/packages/admin-sdk/examples/me/get.ts+++ b/packages/admin-sdk/examples/me/get.ts@@ -7,9 +7,14 @@ const client = createAdminClient({// region:exampleconst me = await client.me.get()-if (me.permissions.some((r) => r.allow && r.actions.includes('manage') && r.subjects.includes('Spree::Product'))) {+if (+ me.permissions.some(+ (r) => r.allow && r.actions.includes('manage') && r.subjects.includes('Spree::Product'),+ )+) {// show "Create product" button}+// endregion:exampleexport { me }diff --git a/packages/admin-sdk/examples/option-types/get.ts b/packages/admin-sdk/examples/option-types/get.tsindex 15dc43c160..a8e0c529c9 100644--- a/packages/admin-sdk/examples/option-types/get.ts+++ b/packages/admin-sdk/examples/option-types/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst optionType = await client.optionTypes.get('ot_UkLWZg9DAJ')+// endregion:exampleexport { optionType }diff --git a/packages/admin-sdk/examples/option-types/list.ts b/packages/admin-sdk/examples/option-types/list.tsindex b39597ec34..7f868fde2c 100644--- a/packages/admin-sdk/examples/option-types/list.ts+++ b/packages/admin-sdk/examples/option-types/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: optionTypes } = await client.optionTypes.list()+// endregion:exampleexport { optionTypes }diff --git a/packages/admin-sdk/examples/order-fulfillments/cancel.ts b/packages/admin-sdk/examples/order-fulfillments/cancel.tsindex 86a6d78d8c..64ab09bf78 100644--- a/packages/admin-sdk/examples/order-fulfillments/cancel.ts+++ b/packages/admin-sdk/examples/order-fulfillments/cancel.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst fulfillment = await client.orders.fulfillments.cancel('or_UkLWZg9DAJ', 'ful_UkLWZg9DAJ')+// endregion:exampleexport { fulfillment }diff --git a/packages/admin-sdk/examples/order-fulfillments/fulfill.ts b/packages/admin-sdk/examples/order-fulfillments/fulfill.tsindex 9c8d8266be..21039ca82f 100644--- a/packages/admin-sdk/examples/order-fulfillments/fulfill.ts+++ b/packages/admin-sdk/examples/order-fulfillments/fulfill.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst fulfillment = await client.orders.fulfillments.fulfill('or_UkLWZg9DAJ', 'ful_UkLWZg9DAJ')+// endregion:exampleexport { fulfillment }diff --git a/packages/admin-sdk/examples/order-fulfillments/get.ts b/packages/admin-sdk/examples/order-fulfillments/get.tsindex bb872d9a4b..5b7f82d62a 100644--- a/packages/admin-sdk/examples/order-fulfillments/get.ts+++ b/packages/admin-sdk/examples/order-fulfillments/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst fulfillment = await client.orders.fulfillments.get('or_UkLWZg9DAJ', 'ful_UkLWZg9DAJ')+// endregion:exampleexport { fulfillment }diff --git a/packages/admin-sdk/examples/order-fulfillments/list.ts b/packages/admin-sdk/examples/order-fulfillments/list.tsindex 85a94608ab..f122df3049 100644--- a/packages/admin-sdk/examples/order-fulfillments/list.ts+++ b/packages/admin-sdk/examples/order-fulfillments/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: fulfillments } = await client.orders.fulfillments.list('or_UkLWZg9DAJ')+// endregion:exampleexport { fulfillments }diff --git a/packages/admin-sdk/examples/order-fulfillments/resume.ts b/packages/admin-sdk/examples/order-fulfillments/resume.tsindex 721e1c3af4..3b03bd1cfd 100644--- a/packages/admin-sdk/examples/order-fulfillments/resume.ts+++ b/packages/admin-sdk/examples/order-fulfillments/resume.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst fulfillment = await client.orders.fulfillments.resume('or_UkLWZg9DAJ', 'ful_UkLWZg9DAJ')+// endregion:exampleexport { fulfillment }diff --git a/packages/admin-sdk/examples/order-fulfillments/update.ts b/packages/admin-sdk/examples/order-fulfillments/update.tsindex bf6122489a..eec947ff25 100644--- a/packages/admin-sdk/examples/order-fulfillments/update.ts+++ b/packages/admin-sdk/examples/order-fulfillments/update.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const fulfillment = await client.orders.fulfillments.update('or_UkLWZg9DAJ', 'ful_UkLWZg9DAJ', {tracking: '1Z999AA10123456784',})+// endregion:exampleexport { fulfillment }diff --git a/packages/admin-sdk/examples/order-items/create.ts b/packages/admin-sdk/examples/order-items/create.tsindex ffc5920a68..6ab595125b 100644--- a/packages/admin-sdk/examples/order-items/create.ts+++ b/packages/admin-sdk/examples/order-items/create.ts@@ -10,6 +10,7 @@ const item = await client.orders.items.create('or_UkLWZg9DAJ', {variant_id: 'variant_k5nR8xLq',quantity: 2,})+// endregion:exampleexport { item }diff --git a/packages/admin-sdk/examples/order-items/get.ts b/packages/admin-sdk/examples/order-items/get.tsindex 2cd6ed14d1..42d70b38d9 100644--- a/packages/admin-sdk/examples/order-items/get.ts+++ b/packages/admin-sdk/examples/order-items/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst item = await client.orders.items.get('or_UkLWZg9DAJ', 'li_UkLWZg9DAJ')+// endregion:exampleexport { item }diff --git a/packages/admin-sdk/examples/order-items/list.ts b/packages/admin-sdk/examples/order-items/list.tsindex 282a26371a..6a5bfca627 100644--- a/packages/admin-sdk/examples/order-items/list.ts+++ b/packages/admin-sdk/examples/order-items/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: items } = await client.orders.items.list('or_UkLWZg9DAJ')+// endregion:exampleexport { items }diff --git a/packages/admin-sdk/examples/order-items/update.ts b/packages/admin-sdk/examples/order-items/update.tsindex c2faec5e03..4bc061937a 100644--- a/packages/admin-sdk/examples/order-items/update.ts+++ b/packages/admin-sdk/examples/order-items/update.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const item = await client.orders.items.update('or_UkLWZg9DAJ', 'li_UkLWZg9DAJ', {quantity: 5,})+// endregion:exampleexport { item }diff --git a/packages/admin-sdk/examples/order-payments/capture.ts b/packages/admin-sdk/examples/order-payments/capture.tsindex 0e629cd7c6..910df92e69 100644--- a/packages/admin-sdk/examples/order-payments/capture.ts+++ b/packages/admin-sdk/examples/order-payments/capture.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst payment = await client.orders.payments.capture('or_UkLWZg9DAJ', 'pay_UkLWZg9DAJ')+// endregion:exampleexport { payment }diff --git a/packages/admin-sdk/examples/order-payments/get.ts b/packages/admin-sdk/examples/order-payments/get.tsindex e8fac7221d..8593d6002f 100644--- a/packages/admin-sdk/examples/order-payments/get.ts+++ b/packages/admin-sdk/examples/order-payments/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst payment = await client.orders.payments.get('or_UkLWZg9DAJ', 'pay_UkLWZg9DAJ')+// endregion:exampleexport { payment }diff --git a/packages/admin-sdk/examples/order-payments/list.ts b/packages/admin-sdk/examples/order-payments/list.tsindex e37760d6f4..068b445e9b 100644--- a/packages/admin-sdk/examples/order-payments/list.ts+++ b/packages/admin-sdk/examples/order-payments/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: payments } = await client.orders.payments.list('or_UkLWZg9DAJ')+// endregion:exampleexport { payments }diff --git a/packages/admin-sdk/examples/order-payments/void.ts b/packages/admin-sdk/examples/order-payments/void.tsindex b1841de917..2b9a82ca50 100644--- a/packages/admin-sdk/examples/order-payments/void.ts+++ b/packages/admin-sdk/examples/order-payments/void.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst payment = await client.orders.payments.void('or_UkLWZg9DAJ', 'pay_UkLWZg9DAJ')+// endregion:exampleexport { payment }diff --git a/packages/admin-sdk/examples/order-refunds/list.ts b/packages/admin-sdk/examples/order-refunds/list.tsindex 753aa421da..7fd7bee445 100644--- a/packages/admin-sdk/examples/order-refunds/list.ts+++ b/packages/admin-sdk/examples/order-refunds/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: refunds } = await client.orders.refunds.list('or_UkLWZg9DAJ')+// endregion:exampleexport { refunds }diff --git a/packages/admin-sdk/examples/orders/approve.ts b/packages/admin-sdk/examples/orders/approve.tsindex 6a2c2d5c6b..07f40ab365 100644--- a/packages/admin-sdk/examples/orders/approve.ts+++ b/packages/admin-sdk/examples/orders/approve.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst order = await client.orders.approve('or_UkLWZg9DAJ')+// endregion:exampleexport { order }diff --git a/packages/admin-sdk/examples/orders/cancel.ts b/packages/admin-sdk/examples/orders/cancel.tsindex e52a60ca0d..910e55fea3 100644--- a/packages/admin-sdk/examples/orders/cancel.ts+++ b/packages/admin-sdk/examples/orders/cancel.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst order = await client.orders.cancel('or_UkLWZg9DAJ')+// endregion:exampleexport { order }diff --git a/packages/admin-sdk/examples/orders/complete.ts b/packages/admin-sdk/examples/orders/complete.tsindex 4f95ee2a71..98fb5925b9 100644--- a/packages/admin-sdk/examples/orders/complete.ts+++ b/packages/admin-sdk/examples/orders/complete.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const order = await client.orders.complete('or_UkLWZg9DAJ', {notify_customer: true,})+// endregion:exampleexport { order }diff --git a/packages/admin-sdk/examples/orders/get.ts b/packages/admin-sdk/examples/orders/get.tsindex 693508c0eb..b3ae18c384 100644--- a/packages/admin-sdk/examples/orders/get.ts+++ b/packages/admin-sdk/examples/orders/get.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const order = await client.orders.get('or_UkLWZg9DAJ', {expand: ['items', 'fulfillments', 'payments', 'customer'],})+// endregion:exampleexport { order }diff --git a/packages/admin-sdk/examples/orders/list.ts b/packages/admin-sdk/examples/orders/list.tsindex 97b9a41944..41a756a76b 100644--- a/packages/admin-sdk/examples/orders/list.ts+++ b/packages/admin-sdk/examples/orders/list.ts@@ -12,6 +12,7 @@ const { data: orders, meta } = await client.orders.list({sort: '-completed_at',limit: 25,})+// endregion:example-export { orders, meta }+export { meta, orders }diff --git a/packages/admin-sdk/examples/orders/resume.ts b/packages/admin-sdk/examples/orders/resume.tsindex 05ff74e5bf..a639cbc92d 100644--- a/packages/admin-sdk/examples/orders/resume.ts+++ b/packages/admin-sdk/examples/orders/resume.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst order = await client.orders.resume('or_UkLWZg9DAJ')+// endregion:exampleexport { order }diff --git a/packages/admin-sdk/examples/payment-methods/get.ts b/packages/admin-sdk/examples/payment-methods/get.tsindex 160996fc69..1b0a18d940 100644--- a/packages/admin-sdk/examples/payment-methods/get.ts+++ b/packages/admin-sdk/examples/payment-methods/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst paymentMethod = await client.paymentMethods.get('pm_UkLWZg9DAJ')+// endregion:exampleexport { paymentMethod }diff --git a/packages/admin-sdk/examples/payment-methods/list.ts b/packages/admin-sdk/examples/payment-methods/list.tsindex e143d50a0b..463313fe70 100644--- a/packages/admin-sdk/examples/payment-methods/list.ts+++ b/packages/admin-sdk/examples/payment-methods/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: paymentMethods } = await client.paymentMethods.list()+// endregion:exampleexport { paymentMethods }diff --git a/packages/admin-sdk/examples/payment-methods/types.ts b/packages/admin-sdk/examples/payment-methods/types.tsindex c4b35ce71b..b18dd5f004 100644--- a/packages/admin-sdk/examples/payment-methods/types.ts+++ b/packages/admin-sdk/examples/payment-methods/types.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: types } = await client.paymentMethods.types()+// endregion:exampleexport { types }diff --git a/packages/admin-sdk/examples/price-lists/activate.ts b/packages/admin-sdk/examples/price-lists/activate.tsindex 0e6e8adaf9..9e634f0d4e 100644--- a/packages/admin-sdk/examples/price-lists/activate.ts+++ b/packages/admin-sdk/examples/price-lists/activate.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst priceList = await client.priceLists.activate('pl_xxx')+// endregion:exampleexport { priceList }diff --git a/packages/admin-sdk/examples/price-lists/create.ts b/packages/admin-sdk/examples/price-lists/create.tsindex 37bb8f2d08..160d0400ea 100644--- a/packages/admin-sdk/examples/price-lists/create.ts+++ b/packages/admin-sdk/examples/price-lists/create.ts@@ -41,6 +41,7 @@ const priceList = await client.priceLists.create({},],})+// endregion:exampleexport { priceList }diff --git a/packages/admin-sdk/examples/price-lists/deactivate.ts b/packages/admin-sdk/examples/price-lists/deactivate.tsindex 368a60cf69..c7f4865da8 100644--- a/packages/admin-sdk/examples/price-lists/deactivate.ts+++ b/packages/admin-sdk/examples/price-lists/deactivate.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst priceList = await client.priceLists.deactivate('pl_xxx')+// endregion:exampleexport { priceList }diff --git a/packages/admin-sdk/examples/price-lists/get.ts b/packages/admin-sdk/examples/price-lists/get.tsindex 89a25458fe..8da1f5a1fa 100644--- a/packages/admin-sdk/examples/price-lists/get.ts+++ b/packages/admin-sdk/examples/price-lists/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst priceList = await client.priceLists.get('pl_xxx')+// endregion:exampleexport { priceList }diff --git a/packages/admin-sdk/examples/price-lists/list.ts b/packages/admin-sdk/examples/price-lists/list.tsindex 456edcef9e..1a9da7078f 100644--- a/packages/admin-sdk/examples/price-lists/list.ts+++ b/packages/admin-sdk/examples/price-lists/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: priceLists } = await client.priceLists.list()+// endregion:exampleexport { priceLists }diff --git a/packages/admin-sdk/examples/price-lists/update.ts b/packages/admin-sdk/examples/price-lists/update.tsindex 6615395011..c04caa2780 100644--- a/packages/admin-sdk/examples/price-lists/update.ts+++ b/packages/admin-sdk/examples/price-lists/update.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const priceList = await client.priceLists.update('pl_xxx', {name: 'Wholesale (Q3)',})+// endregion:exampleexport { priceList }diff --git a/packages/admin-sdk/examples/prices/bulk-destroy.ts b/packages/admin-sdk/examples/prices/bulk-destroy.tsindex a483587de3..1501687ea8 100644--- a/packages/admin-sdk/examples/prices/bulk-destroy.ts+++ b/packages/admin-sdk/examples/prices/bulk-destroy.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const { price_count } = await client.prices.bulkDestroy({ids: ['price_xxx', 'price_yyy'],})+// endregion:exampleexport { price_count }diff --git a/packages/admin-sdk/examples/prices/bulk-upsert.ts b/packages/admin-sdk/examples/prices/bulk-upsert.tsindex f7c4705836..02b92a7b86 100644--- a/packages/admin-sdk/examples/prices/bulk-upsert.ts+++ b/packages/admin-sdk/examples/prices/bulk-upsert.ts@@ -22,6 +22,7 @@ const { price_count } = await client.prices.bulkUpsert({},],})+// endregion:exampleexport { price_count }diff --git a/packages/admin-sdk/examples/prices/create.ts b/packages/admin-sdk/examples/prices/create.tsindex 579b217f3c..b40aef0472 100644--- a/packages/admin-sdk/examples/prices/create.ts+++ b/packages/admin-sdk/examples/prices/create.ts@@ -11,6 +11,7 @@ const price = await client.prices.create({currency: 'USD',amount: '19.99',})+// endregion:exampleexport { price }diff --git a/packages/admin-sdk/examples/prices/get.ts b/packages/admin-sdk/examples/prices/get.tsindex c9451611d0..5b67fc7de4 100644--- a/packages/admin-sdk/examples/prices/get.ts+++ b/packages/admin-sdk/examples/prices/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst price = await client.prices.get('price_xxx')+// endregion:exampleexport { price }diff --git a/packages/admin-sdk/examples/prices/list.ts b/packages/admin-sdk/examples/prices/list.tsindex 398ade816f..8819a9026e 100644--- a/packages/admin-sdk/examples/prices/list.ts+++ b/packages/admin-sdk/examples/prices/list.ts@@ -11,6 +11,7 @@ const { data: prices } = await client.prices.list({currency_eq: 'USD',expand: ['variant'],})+// endregion:exampleexport { prices }diff --git a/packages/admin-sdk/examples/prices/update.ts b/packages/admin-sdk/examples/prices/update.tsindex 9150b35528..2215adec74 100644--- a/packages/admin-sdk/examples/prices/update.ts+++ b/packages/admin-sdk/examples/prices/update.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const price = await client.prices.update('price_xxx', {amount: '12.34',})+// endregion:exampleexport { price }diff --git a/packages/admin-sdk/examples/product-custom-fields/create.ts b/packages/admin-sdk/examples/product-custom-fields/create.tsindex 2d054dcc16..1cde549360 100644--- a/packages/admin-sdk/examples/product-custom-fields/create.ts+++ b/packages/admin-sdk/examples/product-custom-fields/create.ts@@ -10,6 +10,7 @@ const customField = await client.products.customFields.create('prod_UkLWZg9DAJ',custom_field_definition_id: 'cfdef_AbC123XyZ',value: 'wool',})+// endregion:exampleexport { customField }diff --git a/packages/admin-sdk/examples/product-custom-fields/list.ts b/packages/admin-sdk/examples/product-custom-fields/list.tsindex 681eaf8c9e..456d2db3d1 100644--- a/packages/admin-sdk/examples/product-custom-fields/list.ts+++ b/packages/admin-sdk/examples/product-custom-fields/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: customFields } = await client.products.customFields.list('prod_UkLWZg9DAJ')+// endregion:exampleexport { customFields }diff --git a/packages/admin-sdk/examples/products/get.ts b/packages/admin-sdk/examples/products/get.tsindex 6ed0487a19..81651160df 100644--- a/packages/admin-sdk/examples/products/get.ts+++ b/packages/admin-sdk/examples/products/get.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const product = await client.products.get('prod_86Rf07xd4z', {expand: ['variants', 'option_types'],})+// endregion:exampleexport { product }diff --git a/packages/admin-sdk/examples/products/list.ts b/packages/admin-sdk/examples/products/list.tsindex c2835890c6..24af03afe5 100644--- a/packages/admin-sdk/examples/products/list.ts+++ b/packages/admin-sdk/examples/products/list.ts@@ -12,6 +12,7 @@ const { data: products } = await client.products.list({sort: '-created_at',limit: 25,})+// endregion:exampleexport { products }diff --git a/packages/admin-sdk/examples/products/update.ts b/packages/admin-sdk/examples/products/update.tsindex 31360a2301..c961e07aec 100644--- a/packages/admin-sdk/examples/products/update.ts+++ b/packages/admin-sdk/examples/products/update.ts@@ -11,6 +11,7 @@ const product = await client.products.update('prod_86Rf07xd4z', {status: 'active',tags: ['eco', 'sale'],})+// endregion:exampleexport { product }diff --git a/packages/admin-sdk/examples/promotion-actions/create.ts b/packages/admin-sdk/examples/promotion-actions/create.tsindex 5782b1d37a..fb4491832f 100644--- a/packages/admin-sdk/examples/promotion-actions/create.ts+++ b/packages/admin-sdk/examples/promotion-actions/create.ts@@ -9,6 +9,7 @@ const client = createAdminClient({const action = await client.promotions.actions.create('promo_UkLWZg9DAJ', {type: 'free_shipping',})+// endregion:exampleexport { action }diff --git a/packages/admin-sdk/examples/promotion-actions/list.ts b/packages/admin-sdk/examples/promotion-actions/list.tsindex b982c860a3..a115729252 100644--- a/packages/admin-sdk/examples/promotion-actions/list.ts+++ b/packages/admin-sdk/examples/promotion-actions/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: actions } = await client.promotions.actions.list('promo_UkLWZg9DAJ')+// endregion:exampleexport { actions }diff --git a/packages/admin-sdk/examples/promotion-rules/create.ts b/packages/admin-sdk/examples/promotion-rules/create.tsindex 8bdfbb018c..347648b377 100644--- a/packages/admin-sdk/examples/promotion-rules/create.ts+++ b/packages/admin-sdk/examples/promotion-rules/create.ts@@ -10,6 +10,7 @@ const rule = await client.promotions.rules.create('promo_UkLWZg9DAJ', {type: 'currency',preferences: { currency: 'EUR' },})+// endregion:exampleexport { rule }diff --git a/packages/admin-sdk/examples/promotion-rules/list.ts b/packages/admin-sdk/examples/promotion-rules/list.tsindex 3e18b8bc34..f2e973c026 100644--- a/packages/admin-sdk/examples/promotion-rules/list.ts+++ b/packages/admin-sdk/examples/promotion-rules/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: rules } = await client.promotions.rules.list('promo_UkLWZg9DAJ')+// endregion:exampleexport { rules }diff --git a/packages/admin-sdk/examples/promotions/action-types.ts b/packages/admin-sdk/examples/promotions/action-types.tsindex 1ce8980f3b..490cdc52ad 100644--- a/packages/admin-sdk/examples/promotions/action-types.ts+++ b/packages/admin-sdk/examples/promotions/action-types.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: actionTypes } = await client.promotionActions.types()+// endregion:exampleexport { actionTypes }diff --git a/packages/admin-sdk/examples/promotions/create.ts b/packages/admin-sdk/examples/promotions/create.tsindex dc97260394..6579f1a6b7 100644--- a/packages/admin-sdk/examples/promotions/create.ts+++ b/packages/admin-sdk/examples/promotions/create.ts@@ -48,7 +48,8 @@ const blackFriday = await client.promotions.create({{ type: 'free_shipping' },],})+// endregion:example// Suppress unused-binding warnings — these are display-only example values.-export { promotion, blackFriday }+export { blackFriday, promotion }diff --git a/packages/admin-sdk/examples/promotions/list.ts b/packages/admin-sdk/examples/promotions/list.tsindex 337773d938..3fcf7ff4c8 100644--- a/packages/admin-sdk/examples/promotions/list.ts+++ b/packages/admin-sdk/examples/promotions/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: promotions } = await client.promotions.list()+// endregion:exampleexport { promotions }diff --git a/packages/admin-sdk/examples/promotions/rule-types.ts b/packages/admin-sdk/examples/promotions/rule-types.tsindex 2bb13544dd..ad5d5b7a9c 100644--- a/packages/admin-sdk/examples/promotions/rule-types.ts+++ b/packages/admin-sdk/examples/promotions/rule-types.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: ruleTypes } = await client.promotionRules.types()+// endregion:exampleexport { ruleTypes }diff --git a/packages/admin-sdk/examples/roles/list.ts b/packages/admin-sdk/examples/roles/list.tsindex 6b5715ecd4..52121a5e7f 100644--- a/packages/admin-sdk/examples/roles/list.ts+++ b/packages/admin-sdk/examples/roles/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: roles } = await client.roles.list()+// endregion:exampleexport { roles }diff --git a/packages/admin-sdk/examples/stock-locations/get.ts b/packages/admin-sdk/examples/stock-locations/get.tsindex d38524c059..0a49aba5bc 100644--- a/packages/admin-sdk/examples/stock-locations/get.ts+++ b/packages/admin-sdk/examples/stock-locations/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst stockLocation = await client.stockLocations.get('sloc_UkLWZg9DAJ')+// endregion:exampleexport { stockLocation }diff --git a/packages/admin-sdk/examples/stock-locations/list.ts b/packages/admin-sdk/examples/stock-locations/list.tsindex ae16429900..349ee088b9 100644--- a/packages/admin-sdk/examples/stock-locations/list.ts+++ b/packages/admin-sdk/examples/stock-locations/list.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst { data: stockLocations } = await client.stockLocations.list()+// endregion:exampleexport { stockLocations }diff --git a/packages/admin-sdk/examples/stock-locations/update.ts b/packages/admin-sdk/examples/stock-locations/update.tsindex a1f33113d2..0a5cfa8df7 100644--- a/packages/admin-sdk/examples/stock-locations/update.ts+++ b/packages/admin-sdk/examples/stock-locations/update.ts@@ -11,6 +11,7 @@ const stockLocation = await client.stockLocations.update('sloc_UkLWZg9DAJ', {pickup_ready_in_minutes: 45,pickup_instructions: 'Enter through the back door, ring the bell.',})+// endregion:exampleexport { stockLocation }diff --git a/packages/admin-sdk/examples/store/get.ts b/packages/admin-sdk/examples/store/get.tsindex 0333b9e404..072a265b4e 100644--- a/packages/admin-sdk/examples/store/get.ts+++ b/packages/admin-sdk/examples/store/get.ts@@ -7,6 +7,7 @@ const client = createAdminClient({// region:exampleconst store = await client.store.get()+// endregion:exampleexport { store }diff --git a/packages/admin-sdk/examples/store/update.ts b/packages/admin-sdk/examples/store/update.tsindex bdc644a9c0..8a97fd282a 100644--- a/packages/admin-sdk/examples/store/update.ts+++ b/packages/admin-sdk/examples/store/update.ts@@ -7,8 +7,9 @@ const client = createAdminClient({// region:exampleconst store = await client.store.update({- name: 'My Store'+ name: 'My Store',})+// endregion:exampleexport { store }diff --git a/packages/admin-sdk/examples/tags/list.ts b/packages/admin-sdk/examples/tags/list.tsindex 29da535843..9be0ed23af 100644--- a/packages/admin-sdk/examples/tags/list.ts+++ b/packages/admin-sdk/examples/tags/list.ts@@ -10,6 +10,7 @@ const { data: tags } = await client.tags.list({taggable_type: 'Spree::User',q: 'vip',})+// endregion:exampleexport { tags }diff --git a/packages/admin-sdk/src/types/generated/Seller.ts b/packages/admin-sdk/src/types/generated/Seller.tsindex 8f1bb6f3b5..0d72e497ac 100644--- a/packages/admin-sdk/src/types/generated/Seller.ts+++ b/packages/admin-sdk/src/types/generated/Seller.ts@@ -1,4 +1,4 @@-// Typelizer digest 9ea0fa57629e2cfbc989efe587510dc2+// Typelizer digest 1131a5f9f219ca1e88ba4e34354f4d98//// DO NOT MODIFY: This file was automatically generated by Typelizer.import type {Address} from '@/types'@@ -30,6 +30,8 @@ interface Seller {users_count: number;onboarding_progress: { done: number; total: number; percentage: number };onboarding_complete: boolean;+ legal_name: string | null;+ registration_number: string | null;billing_address?: Address;returns_address?: Address;}diff --git a/packages/dashboard-core/src/api-client.ts b/packages/dashboard-core/src/api-client.tsindex ee32bce9f2..80d0173c8b 100644--- a/packages/dashboard-core/src/api-client.ts+++ b/packages/dashboard-core/src/api-client.ts@@ -76,6 +76,20 @@ export interface PanelApiClient {* it: a location holds stock levels and is named on historical* fulfillments, so they retire one by deactivating it.*/+ /**+ * Exchanges blob metadata for a presigned upload URL.+ *+ * Registered rather than imported for the same reason as everything else+ * here: the shared upload field would otherwise work only in the+ * operator's panel, and a seller uploading an onboarding document would+ * get a 401 from an API they hold no key for.+ */+ createDirectUpload?(params: {+ blob: { filename: string; byte_size: number; checksum: string; content_type: string }+ }): Promise<{+ direct_upload: { url: string; headers: Record<string, string> }+ signed_id: string+ }>stockLocations?: {list(params?: Record<string, unknown>): Promise<{ data: PanelStockLocation[]; meta?: unknown }>get(id: string): Promise<PanelStockLocation>diff --git a/packages/dashboard-core/src/hooks/use-direct-upload.ts b/packages/dashboard-core/src/hooks/use-direct-upload.tsindex 5be8e1aa93..aaff6b358a 100644--- a/packages/dashboard-core/src/hooks/use-direct-upload.ts+++ b/packages/dashboard-core/src/hooks/use-direct-upload.ts@@ -1,6 +1,6 @@import { useMutation } from '@tanstack/react-query'import SparkMD5 from 'spark-md5'-import { adminClient } from '../client'+import { getApiClient } from '../api-client'function computeMD5Checksum(file: File): Promise<string> {return new Promise((resolve, reject) => {@@ -62,7 +62,10 @@ export function useDirectUpload() {signed_id: string}try {- response = await adminClient.directUploads.create({+ const presign = getApiClient().createDirectUpload+ if (!presign) throw new Error('This panel cannot upload files.')++ response = await presign({blob: {filename: file.name,byte_size: file.size,diff --git a/packages/dashboard/src/api-client-setup.ts b/packages/dashboard/src/api-client-setup.tsindex 82b6108178..311443a85c 100644--- a/packages/dashboard/src/api-client-setup.ts+++ b/packages/dashboard/src/api-client-setup.ts@@ -19,6 +19,7 @@ setApiClient({return { rules: response.permissions, keys: response.permission_keys ?? [] }},listCountries: () => adminClient.countries.list({ expand: ['states'] }),+ createDirectUpload: (params) => adminClient.directUploads.create(params),// Backs the shared stock-locations page, which both panels render.stockLocations: {list: (params) => adminClient.stockLocations.list(params),diff --git a/packages/docs/scripts/build.js b/packages/docs/scripts/build.jsindex 061dab5364..31a9180120 100644--- a/packages/docs/scripts/build.js+++ b/packages/docs/scripts/build.js@@ -7,25 +7,19 @@* - Outputs clean .md files to dist/*/-import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, statSync } from 'fs'-import { join, dirname, relative, resolve } from 'path'-import { convertContent, resolveImports, extractFrontmatter, rewriteLinks } from './convert.js'+import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs'+import { dirname, join, relative, resolve } from 'path'+import { convertContent, extractFrontmatter, resolveImports, rewriteLinks } from './convert.js'const ROOT = resolve(import.meta.dirname, '..', '..', '..')const DOCS_DIR = join(ROOT, 'docs')const DIST_DIR = resolve(import.meta.dirname, '..', 'dist')// Directories to include in the output-const INCLUDE_DIRS = [- 'developer',- 'api-reference',- 'integrations',-]+const INCLUDE_DIRS = ['developer', 'api-reference', 'integrations']// Paths to exclude (relative to DOCS_DIR)-const EXCLUDE_PATHS = [- 'developer/storefront/rails',-]+const EXCLUDE_PATHS = ['developer/storefront/rails']// ---------------------------------------------------------------------------// Snippet resolution (uses filesystem — not in convert.js)@@ -54,7 +48,7 @@ function resolveSnippet(importPath) {// ---------------------------------------------------------------------------function processFile(filePath) {- let content = readFileSync(filePath, 'utf-8')+ const content = readFileSync(filePath, 'utf-8')const { frontmatter, body } = extractFrontmatter(content)const fileRelDir = dirname(relative(DOCS_DIR, filePath))@@ -117,9 +111,7 @@ for (const dir of INCLUDE_DIRS) {// Copy OpenAPI specs// ----------------------------------------------------------------------------const OPENAPI_FILES = [- 'api-reference/store.yaml',-]+const OPENAPI_FILES = ['api-reference/store.yaml']for (const file of OPENAPI_FILES) {const src = join(DOCS_DIR, file)diff --git a/packages/docs/scripts/convert.js b/packages/docs/scripts/convert.jsindex b12ec3dd37..0f1bf438ad 100644--- a/packages/docs/scripts/convert.js+++ b/packages/docs/scripts/convert.js@@ -3,52 +3,52 @@* Separated from build.js for testability.*/-import { relative } from "path";+import { relative } from 'path'// ---------------------------------------------------------------------------// Callout mapping// ---------------------------------------------------------------------------const CALLOUT_MAP = {- Info: "INFO",- Warning: "WARNING",- Tip: "TIP",- Note: "NOTE",- Hint: "HINT",-};+ Info: 'INFO',+ Warning: 'WARNING',+ Tip: 'TIP',+ Note: 'NOTE',+ Hint: 'HINT',+}// ---------------------------------------------------------------------------// Import resolution// ----------------------------------------------------------------------------export function resolveImports(content, snippetResolver = () => "") {+export function resolveImports(content, snippetResolver = () => '') {// Collect import mappings: import Name from '/snippets/...'- const importMap = new Map();- const importRegex = /^import\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?\s*$/gm;- let match;-- while ((match = importRegex.exec(content)) !== null) {- const [, componentName, importPath] = match;+ const importMap = new Map()+ const importRegex = /^import\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?\s*$/gm+ // Assignment lifted out of the condition: `while ((m = re.exec(s)))` is the+ // classic form, but it reads as a comparison typo and the linter rejects it.+ let match = importRegex.exec(content)++ while (match !== null) {+ const [, componentName, importPath] = match// Only resolve snippet imports (from /snippets/ or relative .mdx)- if (importPath.includes("/snippets/") || importPath.endsWith(".mdx")) {- importMap.set(componentName, importPath);+ if (importPath.includes('/snippets/') || importPath.endsWith('.mdx')) {+ importMap.set(componentName, importPath)}+ match = importRegex.exec(content)}// Remove all import lines- content = content.replace(- /^import\s+\w+\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,- "",- );+ content = content.replace(/^import\s+\w+\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm, '')// Replace <ComponentName /> self-closing tags with inlined snippet contentfor (const [name, path] of importMap) {- const selfClosingRegex = new RegExp(`<${name}\\s*/>`, "g");- const snippetContent = snippetResolver(path);- content = content.replace(selfClosingRegex, snippetContent);+ const selfClosingRegex = new RegExp(`<${name}\\s*/>`, 'g')+ const snippetContent = snippetResolver(path)+ content = content.replace(selfClosingRegex, snippetContent)}- return content;+ return content}// ---------------------------------------------------------------------------@@ -57,23 +57,20 @@ export function resolveImports(content, snippetResolver = () => "") {export function convertContent(content) {// Protect code blocks from conversion- const codeBlocks = [];+ const codeBlocks = []content = content.replace(/(```[\s\S]*?```|`[^`\n]+`)/g, (match) => {- const index = codeBlocks.length;- codeBlocks.push(match);- return `__CODE_BLOCK_${index}__`;- });+ const index = codeBlocks.length+ codeBlocks.push(match)+ return `__CODE_BLOCK_${index}__`+ })// --- Callout components → GitHub-style blockquote alerts ---for (const [component, label] of Object.entries(CALLOUT_MAP)) {- const regex = new RegExp(- `<${component}>\\s*([\\s\\S]*?)\\s*</${component}>`,- "gi",- );+ const regex = new RegExp(`<${component}>\\s*([\\s\\S]*?)\\s*</${component}>`, 'gi')content = content.replace(regex, (_, inner) => {- const lines = inner.trim().split("\n");- return `> **${label}:** ${lines.join("\n> ")}`;- });+ const lines = inner.trim().split('\n')+ return `> **${label}:** ${lines.join('\n> ')}`+ })}// --- Tabs → Sections with headers ---@@ -81,133 +78,118 @@ export function convertContent(content) {return inner.replace(/<Tab\s+title="([^"]*)">\s*([\s\S]*?)\s*<\/Tab>/gi,(_, title, tabContent) => {- return `**${title}:**\n\n${tabContent.trim()}\n`;+ return `**${title}:**\n\n${tabContent.trim()}\n`},- );- });+ )+ })// --- Steps → Numbered list ---- let stepCounter = 0;- content = content.replace(- /<Steps>\s*([\s\S]*?)\s*<\/Steps>/gi,- (_, inner) => {- stepCounter = 0;- return inner.replace(- /<Step\s+title="([^"]*)">\s*([\s\S]*?)\s*<\/Step>/gi,- (_, title, stepContent) => {- stepCounter++;- return `**Step ${stepCounter}: ${title}**\n\n${stepContent.trim()}\n`;- },- );- },- );+ let stepCounter = 0+ content = content.replace(/<Steps>\s*([\s\S]*?)\s*<\/Steps>/gi, (_, inner) => {+ stepCounter = 0+ return inner.replace(+ /<Step\s+title="([^"]*)">\s*([\s\S]*?)\s*<\/Step>/gi,+ (_, title, stepContent) => {+ stepCounter+++ return `**Step ${stepCounter}: ${title}**\n\n${stepContent.trim()}\n`+ },+ )+ })// --- CodeGroup → Just keep the code blocks inside ---- content = content.replace(/<\/?CodeGroup>/gi, "");+ content = content.replace(/<\/?CodeGroup>/gi, '')// --- Accordion/AccordionGroup → Details/summary ---content = content.replace(/<AccordionGroup>\s*([\s\S]*?)\s*<\/AccordionGroup>/gi,(_, inner) => inner,- );+ )content = content.replace(/<Accordion\s+title="([^"]*)">\s*([\s\S]*?)\s*<\/Accordion>/gi,(_, title, inner) => {- return `<details>\n<summary>${title}</summary>\n\n${inner.trim()}\n\n</details>\n`;+ return `<details>\n<summary>${title}</summary>\n\n${inner.trim()}\n\n</details>\n`},- );+ )// --- Card/CardGroup → Bold title + description ---- content = content.replace(/<\/?CardGroup[^>]*>/gi, "");- content = content.replace(- /<Card\s+([^>]*)>([\s\S]*?)<\/Card>/gi,- (_, attrs, inner) => {- const titleMatch = attrs.match(/title="([^"]*)"/);- const hrefMatch = attrs.match(/href="([^"]*)"/);- const title = titleMatch ? titleMatch[1] : "";- const href = hrefMatch ? hrefMatch[1] : "";- const titleText = href ? `[${title}](${href})` : `**${title}**`;- const body = inner.trim();- return body ? `- ${titleText} — ${body}` : `- ${titleText}`;- },- );+ content = content.replace(/<\/?CardGroup[^>]*>/gi, '')+ content = content.replace(/<Card\s+([^>]*)>([\s\S]*?)<\/Card>/gi, (_, attrs, inner) => {+ const titleMatch = attrs.match(/title="([^"]*)"/)+ const hrefMatch = attrs.match(/href="([^"]*)"/)+ const title = titleMatch ? titleMatch[1] : ''+ const href = hrefMatch ? hrefMatch[1] : ''+ const titleText = href ? `[${title}](${href})` : `**${title}**`+ const body = inner.trim()+ return body ? `- ${titleText} — ${body}` : `- ${titleText}`+ })// Self-closing cardscontent = content.replace(/<Card\s+([\s\S]*?)\/>/gi, (_, attrs) => {- const titleMatch = attrs.match(/title="([^"]*)"/);- const hrefMatch = attrs.match(/href="([^"]*)"/);- const title = titleMatch ? titleMatch[1] : "";- const href = hrefMatch ? hrefMatch[1] : "";- return href ? `- [${title}](${href})` : `- **${title}**`;- });+ const titleMatch = attrs.match(/title="([^"]*)"/)+ const hrefMatch = attrs.match(/href="([^"]*)"/)+ const title = titleMatch ? titleMatch[1] : ''+ const href = hrefMatch ? hrefMatch[1] : ''+ return href ? `- [${title}](${href})` : `- **${title}**`+ })// --- Frame → Just keep the content (strip the wrapper) ---- content = content.replace(- /<Frame[^>]*>\s*([\s\S]*?)\s*<\/Frame>/gi,- (_, inner) => inner.trim(),- );+ content = content.replace(/<Frame[^>]*>\s*([\s\S]*?)\s*<\/Frame>/gi, (_, inner) => inner.trim())// --- Expandable → Details/summary ---content = content.replace(/<Expandable\s+title="([^"]*)">\s*([\s\S]*?)\s*<\/Expandable>/gi,(_, title, inner) => {- return `<details>\n<summary>${title}</summary>\n\n${inner.trim()}\n\n</details>\n`;+ return `<details>\n<summary>${title}</summary>\n\n${inner.trim()}\n\n</details>\n`},- );+ )// --- ResponseField → Bold field name with type ---content = content.replace(/<ResponseField\s+name="([^"]*)"\s+type="([^"]*)">\s*([\s\S]*?)\s*<\/ResponseField>/gi,(_, name, type, desc) => {- return `- **\`${name}\`** (\`${type}\`) — ${desc.trim()}`;+ return `- **\`${name}\`** (\`${type}\`) — ${desc.trim()}`},- );+ )// --- ParamField → Bold param name with type ---content = content.replace(/<ParamField\s+([^>]*)>\s*([\s\S]*?)\s*<\/ParamField>/gi,(_, attrs, desc) => {- const nameMatch = attrs.match(/(?:name|path|query|body)="([^"]*)"/);- const typeMatch = attrs.match(/type="([^"]*)"/);- const name = nameMatch ? nameMatch[1] : "";- const type = typeMatch ? ` (\`${typeMatch[1]}\`)` : "";- return `- **\`${name}\`**${type} — ${desc.trim()}`;+ const nameMatch = attrs.match(/(?:name|path|query|body)="([^"]*)"/)+ const typeMatch = attrs.match(/type="([^"]*)"/)+ const name = nameMatch ? nameMatch[1] : ''+ const type = typeMatch ? ` (\`${typeMatch[1]}\`)` : ''+ return `- **\`${name}\`**${type} — ${desc.trim()}`},- );+ )// --- Icon → just remove ---- content = content.replace(/<Icon\s[^>]*\/>/gi, "");- content = content.replace(/<Icon\s[^>]*>[^<]*<\/Icon>/gi, "");+ content = content.replace(/<Icon\s[^>]*\/>/gi, '')+ content = content.replace(/<Icon\s[^>]*>[^<]*<\/Icon>/gi, '')// --- CopyCommand → code block ---- content = content.replace(- /<CopyCommand\s+command="([^"]*)"[^>]*\/>/gi,- (_, cmd) => {- return "```bash\n" + cmd + "\n```";- },- );+ content = content.replace(/<CopyCommand\s+command="([^"]*)"[^>]*\/>/gi, (_, cmd) => {+ return '```bash\n' + cmd + '\n```'+ })// --- Columns → just keep content ---- content = content.replace(/<\/?Columns[^>]*>/gi, "");+ content = content.replace(/<\/?Columns[^>]*>/gi, '')// --- Any remaining self-closing custom components → remove ---- content = content.replace(/<[A-Z]\w*\s[^>]*\/>/g, "");+ content = content.replace(/<[A-Z]\w*\s[^>]*\/>/g, '')// --- Any remaining paired custom components → keep inner content ---content = content.replace(/<([A-Z]\w*)(?:\s[^>]*)?>[\s]*([\s\S]*?)[\s]*<\/\1>/g,(_, _tag, inner) => inner.trim(),- );+ )// --- Clean up: remove excessive blank lines ---- content = content.replace(/\n{4,}/g, "\n\n\n");+ content = content.replace(/\n{4,}/g, '\n\n\n')// --- Restore code blocks ---- content = content.replace(- /__CODE_BLOCK_(\d+)__/g,- (_, index) => codeBlocks[parseInt(index)],- );+ content = content.replace(/__CODE_BLOCK_(\d+)__/g, (_, index) => codeBlocks[parseInt(index)])- return content;+ return content}// ---------------------------------------------------------------------------@@ -215,9 +197,9 @@ export function convertContent(content) {// ---------------------------------------------------------------------------export function extractFrontmatter(content) {- const match = content.match(/^---\n([\s\S]*?)\n---\n/);- if (!match) return { frontmatter: null, body: content };- return { frontmatter: match[0], body: content.slice(match[0].length) };+ const match = content.match(/^---\n([\s\S]*?)\n---\n/)+ if (!match) return { frontmatter: null, body: content }+ return { frontmatter: match[0], body: content.slice(match[0].length) }}// ---------------------------------------------------------------------------@@ -227,12 +209,12 @@ export function extractFrontmatter(content) {export function rewriteLinks(content, fileRelDir) {return content.replace(/\[([^\]]*)\]\(\/(developer|api-reference|integrations)(\/[^)]*)\)/g,- (match, text, prefix, rest) => {- const [pathPart, anchor] = rest.split("#", 2);- const targetPath = prefix + pathPart;- const relPath = relative(fileRelDir, targetPath) || ".";- const suffix = anchor ? `#${anchor}` : "";- return `[${text}](${relPath}.md${suffix})`;+ (_match, text, prefix, rest) => {+ const [pathPart, anchor] = rest.split('#', 2)+ const targetPath = prefix + pathPart+ const relPath = relative(fileRelDir, targetPath) || '.'+ const suffix = anchor ? `#${anchor}` : ''+ return `[${text}](${relPath}.md${suffix})`},- );+ )}diff --git a/packages/docs/tests/convert.test.js b/packages/docs/tests/convert.test.jsindex 4a90ba13d3..aff993a4a1 100644--- a/packages/docs/tests/convert.test.js+++ b/packages/docs/tests/convert.test.js@@ -1,5 +1,10 @@-import { describe, it, expect } from 'vitest'-import { convertContent, resolveImports, extractFrontmatter, rewriteLinks } from '../scripts/convert.js'+import { describe, expect, it } from 'vitest'+import {+ convertContent,+ extractFrontmatter,+ resolveImports,+ rewriteLinks,+} from '../scripts/convert.js'// ---------------------------------------------------------------------------// extractFrontmatter@@ -168,7 +173,8 @@ describe('convertContent — accordion', () => {describe('convertContent — cards', () => {it('converts Card with title and href to link', () => {- const input = '<Card title="Products" href="/developer/core-concepts/products">Product docs</Card>'+ const input =+ '<Card title="Products" href="/developer/core-concepts/products">Product docs</Card>'const result = convertContent(input)expect(result).toContain('- [Products](/developer/core-concepts/products) — Product docs')})diff --git a/packages/sdk/examples/auth/login.ts b/packages/sdk/examples/auth/login.tsindex b27b72744d..4886008edd 100644--- a/packages/sdk/examples/auth/login.ts+++ b/packages/sdk/examples/auth/login.ts@@ -10,6 +10,7 @@ const auth = await client.auth.login({email: '[email protected]',password: 'password123',})+// endregion:exampleexport { auth }diff --git a/packages/sdk/examples/auth/refresh.ts b/packages/sdk/examples/auth/refresh.tsindex e71e8d411f..dd02eac99f 100644--- a/packages/sdk/examples/auth/refresh.ts+++ b/packages/sdk/examples/auth/refresh.ts@@ -9,6 +9,7 @@ const client = createClient({const auth = await client.auth.refresh({refresh_token: 'rt_xxx',})+// endregion:exampleexport { auth }diff --git a/packages/sdk/examples/carts/associate.ts b/packages/sdk/examples/carts/associate.tsindex 74511fee99..8c23d06192 100644--- a/packages/sdk/examples/carts/associate.ts+++ b/packages/sdk/examples/carts/associate.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.associate('cart_abc123', {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/complete.ts b/packages/sdk/examples/carts/complete.tsindex 60f9750e7e..2891d2f91d 100644--- a/packages/sdk/examples/carts/complete.ts+++ b/packages/sdk/examples/carts/complete.ts@@ -9,6 +9,7 @@ const client = createClient({const order = await client.carts.complete('cart_abc123', {token: '<token>',})+// endregion:exampleexport { order }diff --git a/packages/sdk/examples/carts/create.ts b/packages/sdk/examples/carts/create.tsindex 8f8ad3156b..f6c28739b1 100644--- a/packages/sdk/examples/carts/create.ts+++ b/packages/sdk/examples/carts/create.ts@@ -11,10 +11,9 @@ const cart = await client.carts.create()// Create a cart with itemsconst cartWithItems = await client.carts.create({- items: [- { variant_id: 'variant_abc123', quantity: 2 },- ],+ items: [{ variant_id: 'variant_abc123', quantity: 2 }],})+// endregion:exampleexport { cart, cartWithItems }diff --git a/packages/sdk/examples/carts/discount-codes-apply.ts b/packages/sdk/examples/carts/discount-codes-apply.tsindex 4680bebd23..9f12dff55a 100644--- a/packages/sdk/examples/carts/discount-codes-apply.ts+++ b/packages/sdk/examples/carts/discount-codes-apply.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.discountCodes.apply('cart_abc123', 'SAVE10', {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/discount-codes-remove.ts b/packages/sdk/examples/carts/discount-codes-remove.tsindex f370398140..e88ffae0f8 100644--- a/packages/sdk/examples/carts/discount-codes-remove.ts+++ b/packages/sdk/examples/carts/discount-codes-remove.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.discountCodes.remove('cart_abc123', 'SAVE10', {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/fulfillments-update.ts b/packages/sdk/examples/carts/fulfillments-update.tsindex 71b687ebd2..fa39258e27 100644--- a/packages/sdk/examples/carts/fulfillments-update.ts+++ b/packages/sdk/examples/carts/fulfillments-update.ts@@ -6,11 +6,17 @@ const client = createClient({})// region:example-const cart = await client.carts.fulfillments.update('cart_abc123', 'ful_abc123', {- selected_delivery_rate_id: 'dr_abc123',-}, {- token: '<token>',-})+const cart = await client.carts.fulfillments.update(+ 'cart_abc123',+ 'ful_abc123',+ {+ selected_delivery_rate_id: 'dr_abc123',+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/get.ts b/packages/sdk/examples/carts/get.tsindex 38a47287bc..8f5ba80d08 100644--- a/packages/sdk/examples/carts/get.ts+++ b/packages/sdk/examples/carts/get.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.get('cart_abc123', {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/gift-cards-apply.ts b/packages/sdk/examples/carts/gift-cards-apply.tsindex dc67d9ce98..5ec2e6b55d 100644--- a/packages/sdk/examples/carts/gift-cards-apply.ts+++ b/packages/sdk/examples/carts/gift-cards-apply.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.giftCards.apply('cart_abc123', 'GC-ABCD-1234', {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/gift-cards-remove.ts b/packages/sdk/examples/carts/gift-cards-remove.tsindex 994f72de10..d0ee73a229 100644--- a/packages/sdk/examples/carts/gift-cards-remove.ts+++ b/packages/sdk/examples/carts/gift-cards-remove.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.giftCards.remove('cart_abc123', 'gc_abc123', {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/items-create.ts b/packages/sdk/examples/carts/items-create.tsindex 7a7d666ec0..49b06eeda7 100644--- a/packages/sdk/examples/carts/items-create.ts+++ b/packages/sdk/examples/carts/items-create.ts@@ -6,12 +6,17 @@ const client = createClient({})// region:example-const cart = await client.carts.items.create('cart_abc123', {- variant_id: 'variant_abc123',- quantity: 2,-}, {- token: '<token>',-})+const cart = await client.carts.items.create(+ 'cart_abc123',+ {+ variant_id: 'variant_abc123',+ quantity: 2,+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/items-delete.ts b/packages/sdk/examples/carts/items-delete.tsindex e79f228b87..664c4d7799 100644--- a/packages/sdk/examples/carts/items-delete.ts+++ b/packages/sdk/examples/carts/items-delete.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.items.delete('cart_abc123', 'li_abc123', {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/items-update.ts b/packages/sdk/examples/carts/items-update.tsindex db4a47953b..afd2aa6b24 100644--- a/packages/sdk/examples/carts/items-update.ts+++ b/packages/sdk/examples/carts/items-update.ts@@ -6,11 +6,17 @@ const client = createClient({})// region:example-const cart = await client.carts.items.update('cart_abc123', 'li_abc123', {- quantity: 5,-}, {- token: '<token>',-})+const cart = await client.carts.items.update(+ 'cart_abc123',+ 'li_abc123',+ {+ quantity: 5,+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/list.ts b/packages/sdk/examples/carts/list.tsindex 77c725fc6c..007cb6d1da 100644--- a/packages/sdk/examples/carts/list.ts+++ b/packages/sdk/examples/carts/list.ts@@ -9,6 +9,7 @@ const client = createClient({const carts = await client.carts.list({token: '<token>',})+// endregion:exampleexport { carts }diff --git a/packages/sdk/examples/carts/payment-sessions-complete.ts b/packages/sdk/examples/carts/payment-sessions-complete.tsindex 6690431dc3..6cc4e957ec 100644--- a/packages/sdk/examples/carts/payment-sessions-complete.ts+++ b/packages/sdk/examples/carts/payment-sessions-complete.ts@@ -6,11 +6,17 @@ const client = createClient({})// region:example-const session = await client.carts.paymentSessions.complete('cart_abc123', 'ps_abc123', {- session_result: 'success',-}, {- token: '<token>',-})+const session = await client.carts.paymentSessions.complete(+ 'cart_abc123',+ 'ps_abc123',+ {+ session_result: 'success',+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { session }diff --git a/packages/sdk/examples/carts/payment-sessions-create.ts b/packages/sdk/examples/carts/payment-sessions-create.tsindex 068c32361f..8b681a8764 100644--- a/packages/sdk/examples/carts/payment-sessions-create.ts+++ b/packages/sdk/examples/carts/payment-sessions-create.ts@@ -6,11 +6,16 @@ const client = createClient({})// region:example-const session = await client.carts.paymentSessions.create('cart_abc123', {- payment_method_id: 'pm_abc123',-}, {- token: '<token>',-})+const session = await client.carts.paymentSessions.create(+ 'cart_abc123',+ {+ payment_method_id: 'pm_abc123',+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { session }diff --git a/packages/sdk/examples/carts/payment-sessions-get.ts b/packages/sdk/examples/carts/payment-sessions-get.tsindex 85a83c3f49..122c11a3ee 100644--- a/packages/sdk/examples/carts/payment-sessions-get.ts+++ b/packages/sdk/examples/carts/payment-sessions-get.ts@@ -9,6 +9,7 @@ const client = createClient({const session = await client.carts.paymentSessions.get('cart_abc123', 'ps_abc123', {token: '<token>',})+// endregion:exampleexport { session }diff --git a/packages/sdk/examples/carts/payment-sessions-update.ts b/packages/sdk/examples/carts/payment-sessions-update.tsindex 3aa729a3ba..fa5fa724e4 100644--- a/packages/sdk/examples/carts/payment-sessions-update.ts+++ b/packages/sdk/examples/carts/payment-sessions-update.ts@@ -6,11 +6,17 @@ const client = createClient({})// region:example-const session = await client.carts.paymentSessions.update('cart_abc123', 'ps_abc123', {- amount: '50.00',-}, {- token: '<token>',-})+const session = await client.carts.paymentSessions.update(+ 'cart_abc123',+ 'ps_abc123',+ {+ amount: '50.00',+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { session }diff --git a/packages/sdk/examples/carts/payments-create.ts b/packages/sdk/examples/carts/payments-create.tsindex a1c1fa4aee..1df32b9c43 100644--- a/packages/sdk/examples/carts/payments-create.ts+++ b/packages/sdk/examples/carts/payments-create.ts@@ -6,11 +6,16 @@ const client = createClient({})// region:example-const payment = await client.carts.payments.create('cart_abc123', {- payment_method_id: 'pm_abc123',-}, {- token: '<token>',-})+const payment = await client.carts.payments.create(+ 'cart_abc123',+ {+ payment_method_id: 'pm_abc123',+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { payment }diff --git a/packages/sdk/examples/carts/store-credits-apply.ts b/packages/sdk/examples/carts/store-credits-apply.tsindex 7a49e59523..38e1af576b 100644--- a/packages/sdk/examples/carts/store-credits-apply.ts+++ b/packages/sdk/examples/carts/store-credits-apply.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.storeCredits.apply('cart_abc123', 10.0, {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/carts/store-credits-remove.ts b/packages/sdk/examples/carts/store-credits-remove.tsindex 6d43806771..1ff8cb6a8e 100644--- a/packages/sdk/examples/carts/store-credits-remove.ts+++ b/packages/sdk/examples/carts/store-credits-remove.ts@@ -9,6 +9,7 @@ const client = createClient({const cart = await client.carts.storeCredits.remove('cart_abc123', {token: '<token>',})+// endregion:exampleexport { cart }diff --git a/packages/sdk/examples/categories/get.ts b/packages/sdk/examples/categories/get.tsindex 221c96d580..2d2d7e445f 100644--- a/packages/sdk/examples/categories/get.ts+++ b/packages/sdk/examples/categories/get.ts@@ -9,6 +9,7 @@ const client = createClient({const category = await client.categories.get('categories/clothing/shirts', {expand: ['children'],})+// endregion:exampleexport { category }diff --git a/packages/sdk/examples/categories/list.ts b/packages/sdk/examples/categories/list.tsindex ed003c81d4..f65d6c8de5 100644--- a/packages/sdk/examples/categories/list.ts+++ b/packages/sdk/examples/categories/list.ts@@ -10,6 +10,7 @@ const categories = await client.categories.list({page: 1,limit: 25,})+// endregion:exampleexport { categories }diff --git a/packages/sdk/examples/countries/get.ts b/packages/sdk/examples/countries/get.tsindex becd62b01c..29fb846f3e 100644--- a/packages/sdk/examples/countries/get.ts+++ b/packages/sdk/examples/countries/get.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst country = await client.countries.get('US')+// endregion:exampleexport { country }diff --git a/packages/sdk/examples/countries/list.ts b/packages/sdk/examples/countries/list.tsindex 53457653ff..9ae14e2d82 100644--- a/packages/sdk/examples/countries/list.ts+++ b/packages/sdk/examples/countries/list.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst countries = await client.countries.list()+// endregion:exampleexport { countries }diff --git a/packages/sdk/examples/currencies/list.ts b/packages/sdk/examples/currencies/list.tsindex 821c7996c2..03a4f174da 100644--- a/packages/sdk/examples/currencies/list.ts+++ b/packages/sdk/examples/currencies/list.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst currencies = await client.currencies.list()+// endregion:exampleexport { currencies }diff --git a/packages/sdk/examples/customer-addresses/get.ts b/packages/sdk/examples/customer-addresses/get.tsindex 5e7d1478ad..e7164ff593 100644--- a/packages/sdk/examples/customer-addresses/get.ts+++ b/packages/sdk/examples/customer-addresses/get.ts@@ -9,6 +9,7 @@ const client = createClient({const address = await client.customer.addresses.get('addr_abc123', {token: '<token>',})+// endregion:exampleexport { address }diff --git a/packages/sdk/examples/customer-addresses/list.ts b/packages/sdk/examples/customer-addresses/list.tsindex b6cfce4969..e456990b25 100644--- a/packages/sdk/examples/customer-addresses/list.ts+++ b/packages/sdk/examples/customer-addresses/list.ts@@ -6,9 +6,13 @@ const client = createClient({})// region:example-const addresses = await client.customer.addresses.list({}, {- token: '<token>',-})+const addresses = await client.customer.addresses.list(+ {},+ {+ token: '<token>',+ },+)+// endregion:exampleexport { addresses }diff --git a/packages/sdk/examples/customer-addresses/update.ts b/packages/sdk/examples/customer-addresses/update.tsindex 4371b28287..d693998cff 100644--- a/packages/sdk/examples/customer-addresses/update.ts+++ b/packages/sdk/examples/customer-addresses/update.ts@@ -6,11 +6,16 @@ const client = createClient({})// region:example-const address = await client.customer.addresses.update('addr_abc123', {- city: 'Los Angeles',-}, {- token: '<token>',-})+const address = await client.customer.addresses.update(+ 'addr_abc123',+ {+ city: 'Los Angeles',+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { address }diff --git a/packages/sdk/examples/customer-credit-cards/get.ts b/packages/sdk/examples/customer-credit-cards/get.tsindex a0e56c4bd5..0eac5f5f90 100644--- a/packages/sdk/examples/customer-credit-cards/get.ts+++ b/packages/sdk/examples/customer-credit-cards/get.ts@@ -9,6 +9,7 @@ const client = createClient({const card = await client.customer.creditCards.get('card_abc123', {token: '<token>',})+// endregion:exampleexport { card }diff --git a/packages/sdk/examples/customer-credit-cards/list.ts b/packages/sdk/examples/customer-credit-cards/list.tsindex fdbec6002f..d0f3fade86 100644--- a/packages/sdk/examples/customer-credit-cards/list.ts+++ b/packages/sdk/examples/customer-credit-cards/list.ts@@ -6,9 +6,13 @@ const client = createClient({})// region:example-const cards = await client.customer.creditCards.list({}, {- token: '<token>',-})+const cards = await client.customer.creditCards.list(+ {},+ {+ token: '<token>',+ },+)+// endregion:exampleexport { cards }diff --git a/packages/sdk/examples/customer-gift-cards/get.ts b/packages/sdk/examples/customer-gift-cards/get.tsindex 6836330026..1b36c0cbf0 100644--- a/packages/sdk/examples/customer-gift-cards/get.ts+++ b/packages/sdk/examples/customer-gift-cards/get.ts@@ -9,6 +9,7 @@ const client = createClient({const giftCard = await client.customer.giftCards.get('gc_abc123', {token: '<token>',})+// endregion:exampleexport { giftCard }diff --git a/packages/sdk/examples/customer-gift-cards/list.ts b/packages/sdk/examples/customer-gift-cards/list.tsindex fc9fd451ab..9477c62881 100644--- a/packages/sdk/examples/customer-gift-cards/list.ts+++ b/packages/sdk/examples/customer-gift-cards/list.ts@@ -6,9 +6,13 @@ const client = createClient({})// region:example-const giftCards = await client.customer.giftCards.list({}, {- token: '<token>',-})+const giftCards = await client.customer.giftCards.list(+ {},+ {+ token: '<token>',+ },+)+// endregion:exampleexport { giftCards }diff --git a/packages/sdk/examples/customer-orders/get.ts b/packages/sdk/examples/customer-orders/get.tsindex d6fb013783..78bec8b223 100644--- a/packages/sdk/examples/customer-orders/get.ts+++ b/packages/sdk/examples/customer-orders/get.ts@@ -6,9 +6,14 @@ const client = createClient({})// region:example-const order = await client.customer.orders.get('or_abc123', {}, {- token: '<token>',-})+const order = await client.customer.orders.get(+ 'or_abc123',+ {},+ {+ token: '<token>',+ },+)+// endregion:exampleexport { order }diff --git a/packages/sdk/examples/customer-orders/list.ts b/packages/sdk/examples/customer-orders/list.tsindex 9b64ff96f7..8c83e42836 100644--- a/packages/sdk/examples/customer-orders/list.ts+++ b/packages/sdk/examples/customer-orders/list.ts@@ -13,6 +13,7 @@ const orders = await client.customer.orders.list(},{ token: '<token>' },)+// endregion:exampleexport { orders }diff --git a/packages/sdk/examples/customer-password-resets/update.ts b/packages/sdk/examples/customer-password-resets/update.tsindex c3f51774cf..057906ad29 100644--- a/packages/sdk/examples/customer-password-resets/update.ts+++ b/packages/sdk/examples/customer-password-resets/update.ts@@ -6,13 +6,11 @@ const client = createClient({})// region:example-const auth = await client.passwordResets.update(- 'reset-token-from-email',- {- password: 'newsecurepassword',- password_confirmation: 'newsecurepassword',- }-)+const auth = await client.passwordResets.update('reset-token-from-email', {+ password: 'newsecurepassword',+ password_confirmation: 'newsecurepassword',+})+// endregion:exampleexport { auth }diff --git a/packages/sdk/examples/customer-payment-setup-sessions/complete.ts b/packages/sdk/examples/customer-payment-setup-sessions/complete.tsindex 960e4a1579..7fce8f582d 100644--- a/packages/sdk/examples/customer-payment-setup-sessions/complete.ts+++ b/packages/sdk/examples/customer-payment-setup-sessions/complete.ts@@ -6,9 +6,14 @@ const client = createClient({})// region:example-const session = await client.customer.paymentSetupSessions.complete('pss_abc123', {}, {- token: '<token>',-})+const session = await client.customer.paymentSetupSessions.complete(+ 'pss_abc123',+ {},+ {+ token: '<token>',+ },+)+// endregion:exampleexport { session }diff --git a/packages/sdk/examples/customer-payment-setup-sessions/create.ts b/packages/sdk/examples/customer-payment-setup-sessions/create.tsindex bc8b5d761f..b4534ac9a1 100644--- a/packages/sdk/examples/customer-payment-setup-sessions/create.ts+++ b/packages/sdk/examples/customer-payment-setup-sessions/create.ts@@ -6,11 +6,15 @@ const client = createClient({})// region:example-const session = await client.customer.paymentSetupSessions.create({- payment_method_id: 'pm_abc123',-}, {- token: '<token>',-})+const session = await client.customer.paymentSetupSessions.create(+ {+ payment_method_id: 'pm_abc123',+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { session }diff --git a/packages/sdk/examples/customer-payment-setup-sessions/get.ts b/packages/sdk/examples/customer-payment-setup-sessions/get.tsindex 3a0555cb98..b854016a35 100644--- a/packages/sdk/examples/customer-payment-setup-sessions/get.ts+++ b/packages/sdk/examples/customer-payment-setup-sessions/get.ts@@ -9,6 +9,7 @@ const client = createClient({const session = await client.customer.paymentSetupSessions.get('pss_abc123', {token: '<token>',})+// endregion:exampleexport { session }diff --git a/packages/sdk/examples/customer-store-credits/get.ts b/packages/sdk/examples/customer-store-credits/get.tsindex 96808e8419..e14ce8d809 100644--- a/packages/sdk/examples/customer-store-credits/get.ts+++ b/packages/sdk/examples/customer-store-credits/get.ts@@ -9,6 +9,7 @@ const client = createClient({const credit = await client.customer.storeCredits.get('credit_abc123', {token: '<token>',})+// endregion:exampleexport { credit }diff --git a/packages/sdk/examples/customer-store-credits/list.ts b/packages/sdk/examples/customer-store-credits/list.tsindex 50f0e56914..1ed8d785ef 100644--- a/packages/sdk/examples/customer-store-credits/list.ts+++ b/packages/sdk/examples/customer-store-credits/list.ts@@ -6,9 +6,13 @@ const client = createClient({})// region:example-const credits = await client.customer.storeCredits.list({}, {- token: '<token>',-})+const credits = await client.customer.storeCredits.list(+ {},+ {+ token: '<token>',+ },+)+// endregion:exampleexport { credits }diff --git a/packages/sdk/examples/customers/create.ts b/packages/sdk/examples/customers/create.tsindex 05ffd55fe8..db24d67491 100644--- a/packages/sdk/examples/customers/create.ts+++ b/packages/sdk/examples/customers/create.ts@@ -16,6 +16,7 @@ const auth = await client.customers.create({accepts_email_marketing: true,metadata: { source: 'storefront' },})+// endregion:exampleexport { auth }diff --git a/packages/sdk/examples/customers/get.ts b/packages/sdk/examples/customers/get.tsindex 8683e5a10b..515e1fe726 100644--- a/packages/sdk/examples/customers/get.ts+++ b/packages/sdk/examples/customers/get.ts@@ -9,6 +9,7 @@ const client = createClient({const customer = await client.customer.get({token: '<token>',})+// endregion:exampleexport { customer }diff --git a/packages/sdk/examples/customers/update.ts b/packages/sdk/examples/customers/update.tsindex fb754a3ac8..fd9f18b255 100644--- a/packages/sdk/examples/customers/update.ts+++ b/packages/sdk/examples/customers/update.ts@@ -6,13 +6,17 @@ const client = createClient({})// region:example-const customer = await client.customer.update({- first_name: 'John',- last_name: 'Doe',- metadata: { preferred_contact: 'email' },-}, {- token: '<token>',-})+const customer = await client.customer.update(+ {+ first_name: 'John',+ last_name: 'Doe',+ metadata: { preferred_contact: 'email' },+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { customer }diff --git a/packages/sdk/examples/locales/list.ts b/packages/sdk/examples/locales/list.tsindex ca3eb26063..6f14eec598 100644--- a/packages/sdk/examples/locales/list.ts+++ b/packages/sdk/examples/locales/list.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst locales = await client.locales.list()+// endregion:exampleexport { locales }diff --git a/packages/sdk/examples/markets/countries-get.ts b/packages/sdk/examples/markets/countries-get.tsindex c61e9a554b..5628e7a00f 100644--- a/packages/sdk/examples/markets/countries-get.ts+++ b/packages/sdk/examples/markets/countries-get.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst country = await client.markets.countries.get('mkt_xxx', 'DE')+// endregion:exampleexport { country }diff --git a/packages/sdk/examples/markets/countries-list.ts b/packages/sdk/examples/markets/countries-list.tsindex d961c4a0d6..44a284349b 100644--- a/packages/sdk/examples/markets/countries-list.ts+++ b/packages/sdk/examples/markets/countries-list.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst countries = await client.markets.countries.list('mkt_xxx')+// endregion:exampleexport { countries }diff --git a/packages/sdk/examples/markets/get.ts b/packages/sdk/examples/markets/get.tsindex b22c1ba14d..5a8b986694 100644--- a/packages/sdk/examples/markets/get.ts+++ b/packages/sdk/examples/markets/get.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst market = await client.markets.get('mkt_xxx')+// endregion:exampleexport { market }diff --git a/packages/sdk/examples/markets/list.ts b/packages/sdk/examples/markets/list.tsindex 8301aaca34..00a60d7560 100644--- a/packages/sdk/examples/markets/list.ts+++ b/packages/sdk/examples/markets/list.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst markets = await client.markets.list()+// endregion:exampleexport { markets }diff --git a/packages/sdk/examples/markets/resolve.ts b/packages/sdk/examples/markets/resolve.tsindex 88984680aa..bfa24f8d58 100644--- a/packages/sdk/examples/markets/resolve.ts+++ b/packages/sdk/examples/markets/resolve.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst market = await client.markets.resolve('DE')+// endregion:exampleexport { market }diff --git a/packages/sdk/examples/newsletter-subscribers/create.ts b/packages/sdk/examples/newsletter-subscribers/create.tsindex c1369032a2..da046e5a22 100644--- a/packages/sdk/examples/newsletter-subscribers/create.ts+++ b/packages/sdk/examples/newsletter-subscribers/create.ts@@ -10,6 +10,7 @@ const subscriber = await client.newsletterSubscribers.create({email: '[email protected]',redirect_url: 'https://your-store.com/newsletter/confirm',})+// endregion:exampleexport { subscriber }diff --git a/packages/sdk/examples/newsletter-subscribers/verify.ts b/packages/sdk/examples/newsletter-subscribers/verify.tsindex 55ea514fda..e566026c36 100644--- a/packages/sdk/examples/newsletter-subscribers/verify.ts+++ b/packages/sdk/examples/newsletter-subscribers/verify.ts@@ -9,6 +9,7 @@ const client = createClient({const subscriber = await client.newsletterSubscribers.verify({token: 'abc123def456',})+// endregion:exampleexport { subscriber }diff --git a/packages/sdk/examples/orders/get.ts b/packages/sdk/examples/orders/get.tsindex 030886036c..e81be10d28 100644--- a/packages/sdk/examples/orders/get.ts+++ b/packages/sdk/examples/orders/get.ts@@ -6,9 +6,14 @@ const client = createClient({})// region:example-const order = await client.orders.get('or_abc123', {}, {- token: '<token>',-})+const order = await client.orders.get(+ 'or_abc123',+ {},+ {+ token: '<token>',+ },+)+// endregion:exampleexport { order }diff --git a/packages/sdk/examples/policies/get.ts b/packages/sdk/examples/policies/get.tsindex 8c0a64f8f5..5ce1fcb53c 100644--- a/packages/sdk/examples/policies/get.ts+++ b/packages/sdk/examples/policies/get.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst policy = await client.policies.get('return-policy')+// endregion:exampleexport { policy }diff --git a/packages/sdk/examples/policies/list.ts b/packages/sdk/examples/policies/list.tsindex 7bf17e8e57..64fbbd7676 100644--- a/packages/sdk/examples/policies/list.ts+++ b/packages/sdk/examples/policies/list.ts@@ -7,6 +7,7 @@ const client = createClient({// region:exampleconst policies = await client.policies.list()+// endregion:exampleexport { policies }diff --git a/packages/sdk/examples/products/filters.ts b/packages/sdk/examples/products/filters.tsindex 45aeead0d2..4164e5a843 100644--- a/packages/sdk/examples/products/filters.ts+++ b/packages/sdk/examples/products/filters.ts@@ -9,6 +9,7 @@ const client = createClient({const filters = await client.products.filters({category_id: 'ctg_abc123',})+// endregion:exampleexport { filters }diff --git a/packages/sdk/examples/products/get.ts b/packages/sdk/examples/products/get.tsindex baef6a1af3..cf8cdf9efe 100644--- a/packages/sdk/examples/products/get.ts+++ b/packages/sdk/examples/products/get.ts@@ -9,6 +9,7 @@ const client = createClient({const product = await client.products.get('spree-tote', {expand: ['variants', 'media'],})+// endregion:exampleexport { product }diff --git a/packages/sdk/examples/products/list.ts b/packages/sdk/examples/products/list.tsindex 43f9f11e15..de562508b3 100644--- a/packages/sdk/examples/products/list.ts+++ b/packages/sdk/examples/products/list.ts@@ -16,6 +16,7 @@ const products = await client.products.list({with_option_value_ids: ['optval_abc', 'optval_def'],expand: ['variants', 'media'],})+// endregion:exampleexport { products }diff --git a/packages/sdk/examples/wishlists/create.ts b/packages/sdk/examples/wishlists/create.tsindex a9b647a932..5b9512f07f 100644--- a/packages/sdk/examples/wishlists/create.ts+++ b/packages/sdk/examples/wishlists/create.ts@@ -6,12 +6,16 @@ const client = createClient({})// region:example-const wishlist = await client.wishlists.create({- name: 'Birthday Ideas',- is_private: true,-}, {- token: '<token>',-})+const wishlist = await client.wishlists.create(+ {+ name: 'Birthday Ideas',+ is_private: true,+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { wishlist }diff --git a/packages/sdk/examples/wishlists/items-create.ts b/packages/sdk/examples/wishlists/items-create.tsindex d53c0f4bb8..454d8fefba 100644--- a/packages/sdk/examples/wishlists/items-create.ts+++ b/packages/sdk/examples/wishlists/items-create.ts@@ -6,12 +6,17 @@ const client = createClient({})// region:example-const item = await client.wishlists.items.create('wl_abc123', {- variant_id: 'variant_abc123',- quantity: 1,-}, {- token: '<token>',-})+const item = await client.wishlists.items.create(+ 'wl_abc123',+ {+ variant_id: 'variant_abc123',+ quantity: 1,+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { item }diff --git a/packages/sdk/examples/wishlists/list.ts b/packages/sdk/examples/wishlists/list.tsindex c1a9dd8ca4..4ebc4c6364 100644--- a/packages/sdk/examples/wishlists/list.ts+++ b/packages/sdk/examples/wishlists/list.ts@@ -6,9 +6,13 @@ const client = createClient({})// region:example-const wishlists = await client.wishlists.list({}, {- token: '<token>',-})+const wishlists = await client.wishlists.list(+ {},+ {+ token: '<token>',+ },+)+// endregion:exampleexport { wishlists }diff --git a/packages/sdk/examples/wishlists/update.ts b/packages/sdk/examples/wishlists/update.tsindex 0e36eb1a0d..b30fcf957d 100644--- a/packages/sdk/examples/wishlists/update.ts+++ b/packages/sdk/examples/wishlists/update.ts@@ -6,11 +6,16 @@ const client = createClient({})// region:example-const wishlist = await client.wishlists.update('wl_abc123', {- name: 'Updated Name',-}, {- token: '<token>',-})+const wishlist = await client.wishlists.update(+ 'wl_abc123',+ {+ name: 'Updated Name',+ },+ {+ token: '<token>',+ },+)+// endregion:exampleexport { wishlist }diff --git a/packages/seller-dashboard/src/api-client.ts b/packages/seller-dashboard/src/api-client.tsindex cb536abe73..7bfbb5d2da 100644--- a/packages/seller-dashboard/src/api-client.ts+++ b/packages/seller-dashboard/src/api-client.ts@@ -55,6 +55,7 @@ export function createSellerApiClient({// The shared address form reads countries through the registered client,// so it works in a panel that has no admin credential.listCountries: () => sellerClient().countries.list(),+ createDirectUpload: (params) => sellerClient().directUploads.create(params),// Backs the shared stock-locations page. No `delete`: a location holds// stock levels and is named on historical fulfillments, so the Seller API// does not offer it and the page hides the action accordingly.diff --git a/packages/seller-dashboard/src/components/seller-business-card.tsx b/packages/seller-dashboard/src/components/seller-business-card.tsxnew file mode 100644index 0000000000..9e3c9c5a4c--- /dev/null+++ b/packages/seller-dashboard/src/components/seller-business-card.tsx@@ -0,0 +1,149 @@+import {+ Button,+ Card,+ CardAction,+ CardContent,+ CardHeader,+ CardTitle,+ Field,+ FieldLabel,+ Input,+ Sheet,+ SheetContent,+ SheetFooter,+ SheetHeader,+ SheetTitle,+} from '@spree/dashboard-ui'+import type { Profile } from '@spree/seller-sdk'+import { useMutation, useQueryClient } from '@tanstack/react-query'+import { useParams } from '@tanstack/react-router'+import { PencilIcon } from 'lucide-react'+import { useState } from 'react'+import { useTranslation } from 'react-i18next'+import { toast } from 'sonner'+import { sellerClient } from '../api-client'++/** The registration kind this panel collects. */+const VAT_KIND = 'eu_vat'++/**+ * The business behind the seller, as the marketplace's commission invoice+ * must address it: legal name, registration number, and the VAT number that+ * decides whether that invoice carries VAT or is reverse-charged.+ *+ * Separate from the billing address, which is only where post goes. Most of+ * what an invoice needs is not an address, and putting a VAT number in an+ * address form is what makes it get lost.+ */+export function SellerBusinessCard({ profile }: { profile: Profile }) {+ const { t } = useTranslation()+ const { sellerId } = useParams({ from: '/_authenticated/$sellerId' })+ const queryClient = useQueryClient()+ const [editing, setEditing] = useState(false)++ const vat = profile.tax_identifiers?.find((identifier) => identifier.kind === VAT_KIND)++ const [legalName, setLegalName] = useState(profile.legal_name ?? '')+ const [registrationNumber, setRegistrationNumber] = useState(profile.registration_number ?? '')+ const [vatNumber, setVatNumber] = useState(vat?.value ?? '')++ const save = useMutation({+ mutationFn: () =>+ sellerClient().profile.update({+ legal_name: legalName || null,+ registration_number: registrationNumber || null,+ tax_identifier: { kind: VAT_KIND, value: vatNumber },+ }),+ onSuccess: (updated) => {+ queryClient.setQueryData(['seller', sellerId, 'profile'], updated)+ // A checklist kind may read these, so it has to re-evaluate.+ void queryClient.invalidateQueries({ queryKey: ['seller', sellerId, 'onboarding'] })+ setEditing(false)+ toast.success(t('profile.saved'))+ },+ onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ })++ const rows = [+ { label: t('profile.legal_name'), value: profile.legal_name },+ { label: t('profile.registration_number'), value: profile.registration_number },+ { label: t('profile.vat_number'), value: vat?.value },+ ]++ return (+ <>+ <Card>+ <CardHeader>+ <CardTitle>{t('profile.business_details')}</CardTitle>+ <CardAction>+ <Button variant="outline" size="sm" onClick={() => setEditing(true)}>+ <PencilIcon className="size-4" />+ {t('profile.edit')}+ </Button>+ </CardAction>+ </CardHeader>+ <CardContent className="flex flex-col gap-2 text-sm">+ {rows.map((row) => (+ <div key={row.label} className="flex justify-between gap-4">+ <span className="text-muted-foreground">{row.label}</span>+ <span className="text-right">{row.value || '—'}</span>+ </div>+ ))}+ {/* A number the seller believes is on file but which came back+ unverified is worth them knowing about. */}+ {vat?.validation_status && vat.validation_status !== 'verified' && (+ <p className="text-muted-foreground text-xs">+ {t(`profile.vat_status.${vat.validation_status}`, {+ defaultValue: vat.validation_status,+ })}+ </p>+ )}+ </CardContent>+ </Card>++ <Sheet open={editing} onOpenChange={setEditing}>+ <SheetContent>+ <SheetHeader>+ <SheetTitle>{t('profile.business_details')}</SheetTitle>+ </SheetHeader>+ <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">+ <Field>+ <FieldLabel htmlFor="legal-name">{t('profile.legal_name')}</FieldLabel>+ <Input+ id="legal-name"+ value={legalName}+ onChange={(event) => setLegalName(event.target.value)}+ />+ </Field>+ <Field>+ <FieldLabel htmlFor="registration-number">+ {t('profile.registration_number')}+ </FieldLabel>+ <Input+ id="registration-number"+ value={registrationNumber}+ onChange={(event) => setRegistrationNumber(event.target.value)}+ />+ </Field>+ <Field>+ <FieldLabel htmlFor="vat-number">{t('profile.vat_number')}</FieldLabel>+ <Input+ id="vat-number"+ value={vatNumber}+ onChange={(event) => setVatNumber(event.target.value)}+ />+ </Field>+ </div>+ <SheetFooter>+ <Button variant="outline" size="sm" onClick={() => setEditing(false)}>+ {t('common.cancel')}+ </Button>+ <Button size="sm" disabled={save.isPending} onClick={() => save.mutate()}>+ {t('common.save')}+ </Button>+ </SheetFooter>+ </SheetContent>+ </Sheet>+ </>+ )+}diff --git a/packages/seller-dashboard/src/locales/en.json b/packages/seller-dashboard/src/locales/en.jsonindex 76075f8f27..16f662c788 100644--- a/packages/seller-dashboard/src/locales/en.json+++ b/packages/seller-dashboard/src/locales/en.json@@ -19,7 +19,8 @@"cancel": "Cancel","error": "Something went wrong.","loading": "Loading…",- "retry": "Try again"+ "retry": "Try again",+ "save": "Save"},"home": {"products": "Products",@@ -56,6 +57,8 @@"accept_terms": "Accept the terms","awaiting_review": "Waiting for the marketplace to review this.","confirm": "Confirm",+ "document_help": "PDF or an image of the document.",+ "document_label": "Document","done": "This one is done.","go": "Go there","note_placeholder": "Anything the marketplace should know (optional)",@@ -72,6 +75,7 @@"rejected": "Needs another look"},"submit": "Submit for review",+ "submit_document": "Submit for review","submitted": "Sent for review","submitted_requirement": "Sent","submitting": "Submitting…",@@ -89,10 +93,12 @@"at_a_glance": "At a glance","billing_address": "Billing address","billing_email": "Billing email",+ "business_details": "Business details","contact_email": "Contact email","edit": "Edit","edit_title": "Edit your profile","joined": "Joined",+ "legal_name": "Legal name","minimum_payout": "Minimum payout","name": "Name","no_about": "You have not written a description yet.",@@ -101,6 +107,7 @@"operator_managed": "Set by the marketplace","payout_schedule": "Payout schedule","products_count": "Products",+ "registration_number": "Registration number","returns_address": "Returns address","save": "Save changes","saved": "Profile saved",@@ -120,7 +127,14 @@},"subtitle": "How your storefront presents you, and how the marketplace reaches you.","tax_remittance": "Tax remitted by",- "team_count": "Team members"+ "team_count": "Team members",+ "vat_number": "VAT number",+ "vat_status": {+ "pending": "We are checking this number.",+ "unavailable": "The registry could not be reached — we will try again.",+ "unsupported": "This number is recorded as entered; we cannot check it automatically.",+ "unverified": "This number could not be verified."+ }},"seller_picker": {"status": "Status",diff --git a/packages/seller-dashboard/src/pages/onboarding.tsx b/packages/seller-dashboard/src/pages/onboarding.tsxindex 32a119cf6d..c0c3eca61f 100644--- a/packages/seller-dashboard/src/pages/onboarding.tsx+++ b/packages/seller-dashboard/src/pages/onboarding.tsx@@ -1,3 +1,8 @@+import {+ EMPTY_FILE_UPLOAD_VALUE,+ FileUploadField,+ type FileUploadValue,+} from '@spree/dashboard-core'import {Badge,Button,@@ -5,6 +10,9 @@ import {CardContent,CardHeader,CardTitle,+ Field,+ FieldLabel,+ Input,Progress,Textarea,} from '@spree/dashboard-ui'@@ -183,6 +191,8 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })const { sellerId } = useParams({ from: '/_authenticated/$sellerId' })const queryClient = useQueryClient()const [note, setNote] = useState('')+ const [file, setFile] = useState<FileUploadValue>(EMPTY_FILE_UPLOAD_VALUE)+ const [fields, setFields] = useState<Record<string, string>>({})// Only the address kinds need it, and it is already loaded by the profile// page and the sidebar switcher — this reads the same cache entry.@@ -204,17 +214,41 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),})- const attest = useMutation({+ // One submit for every kind that takes one — an attestation the seller+ // ticks, a document they upload, a manual check they say is ready. What+ // differs is which controls render above it, not what posting means.+ const submit = useMutation({mutationFn: () =>- sellerClient().requirementSubmissions.create(requirement.id, { note: note || undefined }),+ sellerClient().requirementSubmissions.create(requirement.id, {+ note: note || undefined,+ file: file.signedId || undefined,+ }),onSuccess: () => {setNote('')+ setFile(EMPTY_FILE_UPLOAD_VALUE)toast.success(t('onboarding.submitted_requirement'))void invalidate()},onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),})+ // Custom fields are the seller's own profile data, so they save through the+ // profile like the addresses do rather than as a submission.+ const saveFields = useMutation({+ mutationFn: () =>+ sellerClient().profile.update({+ custom_fields: Object.entries(fields).map(([id, value]) => ({+ custom_field_definition_id: id,+ value,+ })),+ }),+ onSuccess: () => {+ toast.success(t('profile.saved'))+ void invalidate()+ },+ onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ })+const submission = requirement.submission// A rejection the seller cannot read is a rejection they cannot act on.@@ -264,17 +298,69 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })</div>)}- {requirement.kind === 'attestation' && (- <div className="flex flex-col gap-2">+ {/* Every kind that takes a submission gets the same form: a note, a+ file picker when the kind asks for one, and one button. Keyed off+ what the server says the kind accepts rather than off its name, so a+ kind a gem adds is usable without this file knowing about it. */}+ {requirement.accepts_submissions && requirement.kind !== 'accept_terms' && (+ <div className="flex flex-col gap-3">+ {requirement.requires_file && (+ <FileUploadField+ value={file}+ onChange={setFile}+ accept={requirement.accepted_content_types?.join(',')}+ label={t('onboarding.document_label')}+ help={t('onboarding.document_help')}+ />+ )}+<Textarearows={2}value={note}placeholder={t('onboarding.note_placeholder')}onChange={(event) => setNote(event.target.value)}/>++ <div className="flex justify-start">+ <Button+ size="sm"+ // A document requirement with nothing attached is an empty+ // submission the operator can only reject.+ disabled={submit.isPending || (requirement.requires_file && !file.signedId)}+ onClick={() => submit.mutate()}+ >+ {requirement.requires_file+ ? t('onboarding.submit_document')+ : t('onboarding.confirm')}+ </Button>+ </div>+ </div>+ )}++ {/* The fields the marketplace asks this seller to fill in, rendered+ here rather than behind a link: the checklist is where they were+ asked, so it is where they answer. */}+ {requirement.custom_fields && requirement.custom_fields.length > 0 && (+ <div className="flex flex-col gap-3">+ {requirement.custom_fields.map((field) => (+ <Field key={field.id}>+ <FieldLabel htmlFor={`cf-${field.id}`}>{field.label}</FieldLabel>+ <Input+ id={`cf-${field.id}`}+ value={fields[field.id] ?? (field.value == null ? '' : String(field.value))}+ onChange={(event) =>+ setFields((current) => ({ ...current, [field.id]: event.target.value }))+ }+ />+ </Field>+ ))}<div className="flex justify-start">- <Button size="sm" disabled={attest.isPending} onClick={() => attest.mutate()}>- {t('onboarding.confirm')}+ <Button+ size="sm"+ disabled={saveFields.isPending || Object.keys(fields).length === 0}+ onClick={() => saveFields.mutate()}+ >+ {t('common.save')}</Button></div></div>@@ -339,11 +425,13 @@ function isAddressKind(kind: string): boolean {function panelRoute(kind: string): string | undefined {switch (kind) {case 'complete_profile':- case 'required_custom_fields':return '/$sellerId/profile'- // `minimum_products` belongs here too, once the panel has a products- // page — until then it falls through and reads as a plain instruction- // rather than a link to nowhere.+ // `required_custom_fields` is not here: it renders its own fields inline,+ // so a link away would offer a second, worse route to the same thing.+ //+ // `minimum_products` belongs here once the panel has a products page —+ // until then it falls through and reads as a plain instruction rather+ // than a link to nowhere.default:return undefined}diff --git a/packages/seller-dashboard/src/pages/profile.tsx b/packages/seller-dashboard/src/pages/profile.tsxindex 26682acccb..7acee05046 100644--- a/packages/seller-dashboard/src/pages/profile.tsx+++ b/packages/seller-dashboard/src/pages/profile.tsx@@ -32,6 +32,7 @@ import { toast } from 'sonner'import { sellerClient } from '../api-client'import { CenteredMessage } from '../components/centered-message'import { SellerAddressCard } from '../components/seller-address-card'+import { SellerBusinessCard } from '../components/seller-business-card'import { SellerReturnsLocationCard } from '../components/seller-returns-location-card'interface ProfileValues {@@ -92,6 +93,7 @@ export function ProfilePage() {<StandingCard profile={profile} /><AtAGlanceCard profile={profile} teamCount={team?.data?.length} /><ContactCard profile={profile} onEdit={() => setEditing(true)} />+ <SellerBusinessCard profile={profile} /><SellerAddressCard profile={profile} /><SellerReturnsLocationCard /><SettlementCard profile={profile} />diff --git a/packages/seller-sdk/src/seller-client.ts b/packages/seller-sdk/src/seller-client.tsindex feb36c9fcc..207a6c7b2b 100644--- a/packages/seller-sdk/src/seller-client.ts+++ b/packages/seller-sdk/src/seller-client.ts@@ -219,6 +219,23 @@ export class SellerClient {this.request<void>('DELETE', `/products/${id}`, options),}+ /**+ * Presigning for the documents onboarding asks for. Exchange the blob's+ * metadata for an upload URL, PUT the file to it, then post the returned+ * `signed_id` as a submission's `file`.+ */+ readonly directUploads = {+ create: (+ params: {+ blob: { filename: string; byte_size: number; checksum: string; content_type: string }+ },+ options?: RequestOptions,+ ): Promise<{+ direct_upload: { url: string; headers: Record<string, string> }+ signed_id: string+ }> => this.request('POST', '/direct_uploads', { ...options, body: params }),+ }+/*** Where this seller keeps stock, and so where their returns are sent.*@@ -349,8 +366,23 @@ export interface ProfileUpdateParams {logo?: string | nullsquare_logo?: string | nullcover_photo?: string | null+ /** The business a commission invoice is made out to. */+ legal_name?: string | null+ registration_number?: string | null+ /**+ * The seller's tax registration. One per kind — re-sending a kind corrects+ * the number, and an empty value removes it. A changed number drops its+ * validation verdict, since that answer was about the old one.+ */+ tax_identifier?: { kind: string; value: string }billing_address?: SellerAddressParamsreturns_address?: SellerAddressParams+ /**+ * Answers to the custom fields this marketplace's onboarding asks for.+ * Narrowed server-side to those definitions — a field nothing asked for is+ * ignored rather than written.+ */+ custom_fields?: Array<{ custom_field_definition_id: string; value: unknown }>/*** Accepts the marketplace's terms, stamping the moment. One-way: the stamp* records that it happened, so sending `false` does not unmake it.diff --git a/packages/seller-sdk/src/types/generated/Invitation.ts b/packages/seller-sdk/src/types/generated/Invitation.tsindex 3d5c5d9711..2911e9bb78 100644--- a/packages/seller-sdk/src/types/generated/Invitation.ts+++ b/packages/seller-sdk/src/types/generated/Invitation.ts@@ -1,4 +1,4 @@-// Typelizer digest bc9f7c8d41a89f2345c24a7defaddce3+// Typelizer digest f58e4be1fc6a1aa2f830c76f832ea562//// DO NOT MODIFY: This file was automatically generated by Typelizer.@@ -6,10 +6,10 @@ type Invitation = {id: string;email: string;created_at: string;- status: string;- acceptance_url: string;expires_at: string | null;accepted_at: string | null;+ status: string;+ acceptance_url: string;}export default Invitation;diff --git a/packages/seller-sdk/src/types/generated/Profile.ts b/packages/seller-sdk/src/types/generated/Profile.tsindex 04c304e156..3a7691ac64 100644--- a/packages/seller-sdk/src/types/generated/Profile.ts+++ b/packages/seller-sdk/src/types/generated/Profile.ts@@ -1,7 +1,7 @@-// Typelizer digest 6b7b053665b4f97a30ab33385227b3c6+// Typelizer digest b4c08dcba24c392295bc53ff5e5aa51d//// DO NOT MODIFY: This file was automatically generated by Typelizer.-import type {Address} from '@/types'+import type {TaxIdentifier, Address} from '@/types'type Profile = {id: string;@@ -13,6 +13,8 @@ type Profile = {square_logo_url: string | null;cover_photo_url: string | null;status: string;+ legal_name: string | null;+ registration_number: string | null;contact_email: string | null;billing_email: string | null;tax_remittance: string;@@ -24,6 +26,7 @@ type Profile = {on_holiday: boolean;sellable: boolean;products_count: number;+ tax_identifiers: Array<TaxIdentifier>;billing_address?: Address;returns_address?: Address;}diff --git a/packages/seller-sdk/src/types/generated/RequirementCustomField.ts b/packages/seller-sdk/src/types/generated/RequirementCustomField.tsnew file mode 100644index 0000000000..fbebaa3b16--- /dev/null+++ b/packages/seller-sdk/src/types/generated/RequirementCustomField.ts@@ -0,0 +1,13 @@+// Typelizer digest e9669ad0fe85abe55fcbed2497905f03+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type RequirementCustomField = {+ id: string;+ key: string;+ label: string;+ field_type: 'short_text' | 'long_text' | 'rich_text' | 'number' | 'boolean' | 'json';+ value: any;+}++export default RequirementCustomField;diff --git a/packages/seller-sdk/src/types/generated/RequirementStatus.ts b/packages/seller-sdk/src/types/generated/RequirementStatus.tsindex bb561f039f..9e9279f463 100644--- a/packages/seller-sdk/src/types/generated/RequirementStatus.ts+++ b/packages/seller-sdk/src/types/generated/RequirementStatus.ts@@ -1,7 +1,7 @@-// Typelizer digest be0c4985af14b02c335f192aa17291c0+// Typelizer digest 434bfb90137616b68851e9a0fec33b60//// DO NOT MODIFY: This file was automatically generated by Typelizer.-import type {RequirementSubmission} from '@/types'+import type {RequirementSubmission, RequirementCustomField} from '@/types'type RequirementStatus = {id: string;@@ -13,7 +13,11 @@ type RequirementStatus = {status: string;action_url: string | null;blocking: boolean;+ accepts_submissions: boolean;+ requires_file: boolean;+ accepted_content_types: Array<string>;submission?: RequirementSubmission;+ custom_fields?: Array<RequirementCustomField>;}export default RequirementStatus;diff --git a/packages/seller-sdk/src/types/generated/TaxIdentifier.ts b/packages/seller-sdk/src/types/generated/TaxIdentifier.tsnew file mode 100644index 0000000000..b50ae86b81--- /dev/null+++ b/packages/seller-sdk/src/types/generated/TaxIdentifier.ts@@ -0,0 +1,13 @@+// Typelizer digest 4d689e8d66e721fad8e5b02990a68888+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type TaxIdentifier = {+ id: string;+ kind: string;+ value: string;+ validation_status: string | null;+ validated_at: string | null;+}++export default TaxIdentifier;diff --git a/packages/seller-sdk/src/types/generated/index.ts b/packages/seller-sdk/src/types/generated/index.tsindex 4006f68e38..4951a1d084 100644--- a/packages/seller-sdk/src/types/generated/index.ts+++ b/packages/seller-sdk/src/types/generated/index.ts@@ -1,4 +1,4 @@-// Typelizer digest 7332362643df45117ff27e135f8d3e38+// Typelizer digest 53306523edc4d3f2294f0a0ff019019b//// DO NOT MODIFY: This file was automatically generated by Typelizer.export type { default as Address } from './Address'@@ -12,9 +12,11 @@ export type { default as Price } from './Price'export type { default as Invitation } from './Invitation'export type { default as Product } from './Product'export type { default as Profile } from './Profile'+export type { default as RequirementCustomField } from './RequirementCustomField'export type { default as RequirementStatus } from './RequirementStatus'export type { default as RequirementSubmission } from './RequirementSubmission'export type { default as StockLocation } from './StockLocation'+export type { default as TaxIdentifier } from './TaxIdentifier'export type { default as TeamMember } from './TeamMember'export type { default as Seller } from './Seller'export type { default as Variant } from './Variant'diff --git a/spree/api/app/controllers/spree/api/v3/seller/direct_uploads_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/direct_uploads_controller.rbnew file mode 100644index 0000000000..c4eb7f19c9--- /dev/null+++ b/spree/api/app/controllers/spree/api/v3/seller/direct_uploads_controller.rb@@ -0,0 +1,38 @@+module Spree+ module Api+ module V3+ module Seller+ # Presigning for a seller's own uploads — today the documents their+ # onboarding asks for.+ #+ # A blob created here is not attached to anything yet: it becomes a+ # submission only when the seller posts its signed id, and that+ # endpoint is the one that checks the requirement is theirs. So the+ # narrowest meaningful gate is the seller's own profile, which every+ # member of a seller's team holds.+ class DirectUploadsController < Seller::BaseController+ scoped_resource :seller_profile++ # POST /api/v3/seller/direct_uploads+ def create+ blob = ActiveStorage::Blob.create_before_direct_upload!(**blob_params)++ render json: {+ direct_upload: {+ url: blob.service_url_for_direct_upload,+ headers: blob.service_headers_for_direct_upload+ },+ signed_id: blob.signed_id+ }, status: :created+ end++ private++ def blob_params+ params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type).to_h.symbolize_keys+ end+ end+ end+ end+ end+enddiff --git a/spree/api/app/controllers/spree/api/v3/seller/profile_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/profile_controller.rbindex f46a0c6a13..143bb6bce4 100644--- a/spree/api/app/controllers/spree/api/v3/seller/profile_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/seller/profile_controller.rb@@ -25,7 +25,21 @@ module Spreeenddef update- if current_seller.update(permitted_params.merge(terms_attributes))+ attributes = permitted_params.merge(terms_attributes)+ # `normalize_params` rewrites `custom_fields` to the nested-attributes+ # key. Narrow it, then hand it back under the original name: the+ # model's `custom_fields=` upserts by definition, while the nested+ # writer builds a row every time — so a seller correcting a value+ # they had already saved would hit the uniqueness index instead.+ if attributes.key?(:custom_fields_attributes)+ attributes[:custom_fields] =+ requested_custom_fields(attributes.delete(:custom_fields_attributes))+ end++ tax_identifier = attributes.delete(:tax_identifier)++ if current_seller.update(attributes)+ upsert_tax_identifier(tax_identifier) if tax_identifier.present?render json: serialize_sellerelserender_validation_error(current_seller.errors)@@ -62,11 +76,60 @@ module Spree{ terms_accepted_at: Time.current }end+ # One registration per kind, so re-sending a kind corrects the number+ # rather than stacking a second row the model would reject.+ #+ # A changed number drops its verdict — the validator's answer was+ # about the old one, and carrying it over would show a number as+ # verified that nobody has checked.+ def upsert_tax_identifier(attributes)+ kind = attributes[:kind].presence+ value = attributes[:value]+ return if kind.blank?++ identifier = current_seller.tax_identifiers.find_or_initialize_by(kind: kind)++ if value.blank?+ identifier.destroy if identifier.persisted?+ return+ end++ identifier.value = value+ identifier.save+ end++ # Narrowed to the definitions this marketplace's onboarding actually+ # asks this seller for.+ #+ # Custom fields on `Spree::Seller` are the operator's schema, and+ # some of them are the operator's own — an internal risk note, a+ # compliance flag. A seller may fill in what they were asked for;+ # permitting the association wholesale would let them write, and+ # then read back, every field the operator defined.+ def requested_custom_fields(submitted)+ return [] if submitted.blank?++ allowed = Spree::SellerRequirementCustomField.+ joins(:seller_requirement).+ where(Spree::SellerRequirement.table_name => {+ store_id: current_store.id, active: true+ }).+ pluck(:custom_field_definition_id).to_set++ Array(submitted).select do |field|+ allowed.include?(field[:custom_field_definition_id])+ end+ end+def permitted_paramsnormalize_params(params.permit(:name, :contact_email, :billing_email, :about,+ :legal_name, :registration_number,:logo, :square_logo, :cover_photo,- billing_address: ADDRESS_KEYS)+ tax_identifier: [:kind, :value],+ billing_address: ADDRESS_KEYS,+ custom_fields: [:id, :custom_field_definition_id, :value,+ { value: [] }, { value: {} }]))enddiff --git a/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rbindex e8444bf847..02e8744dbd 100644--- a/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb@@ -7,6 +7,8 @@ module Spree# tax configuration only the operator sets.class SellerSerializer < V3::SellerSerializertypelize status: :string,+ legal_name: [:string, nullable: true],+ registration_number: [:string, nullable: true],contact_email: [:string, nullable: true], billing_email: [:string, nullable: true],tax_remittance: :string,payouts_schedule_interval: [:string, nullable: true],@@ -66,6 +68,9 @@ module Spreeseller.onboarding_complete?end+ attribute :legal_name, &:legal_name+ attribute :registration_number, &:registration_number+one :billing_address,resource: proc { Spree.api.admin_address_serializer },if: proc { |seller| seller.billing_address.present? }diff --git a/spree/api/app/serializers/spree/api/v3/admin/stock_location_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/stock_location_serializer.rbindex d0aae4042e..f8adde996f 100644--- a/spree/api/app/serializers/spree/api/v3/admin/stock_location_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/admin/stock_location_serializer.rb@@ -21,10 +21,6 @@ module Spree:pickup_ready_in_minutes, :pickup_instructions,created_at: :iso8601, updated_at: :iso8601- # Whose shelf this is — nil for the marketplace's own. On a- # marketplace the operator's list holds both, and without this the- # two are indistinguishable. The name rides along so the list can- # show it without expanding; the full profile is `?expand=seller`.attribute :seller_id do |stock_location|stock_location.seller&.prefixed_idenddiff --git a/spree/api/app/serializers/spree/api/v3/seller/invitation_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/invitation_serializer.rbindex f1bb40948c..6e2e7e0950 100644--- a/spree/api/app/serializers/spree/api/v3/seller/invitation_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/invitation_serializer.rb@@ -2,29 +2,19 @@ module Spreemodule Apimodule V3module Seller- # A pending invitation to join this seller.- #- # Only what the inviting seller needs to see: who was invited, whether- # they have accepted, and when it lapses. The shared serializer's- # polymorphic fields (`resource_type`, `inviter_id`, `role_id`) describe- # plumbing the seller cannot act on — and the invitation is always to- # the seller whose panel they are already looking at.class InvitationSerializer < V3::BaseSerializertypelize email: :string, status: :string,expires_at: [:string, nullable: true],accepted_at: [:string, nullable: true],acceptance_url: :string- attributes :email, created_at: :iso8601+ attributes :email,+ created_at: :iso8601, expires_at: :iso8601, accepted_at: :iso8601attribute :status do |invitation|invitation.status.to_send- # So the panel can offer "copy link" for a colleague who never got- # the email. Absolute when a panel origin is configured — the route- # sends a seller invitation to the seller panel — otherwise the path,- # which the panel resolves against its own origin.attribute :acceptance_url do |invitation|if Spree::Config[:seller_panel_url].present? || Spree::Config[:dashboard_url].present?Rails.application.routes.url_helpers.admin_invitation_acceptance_url(invitation)@@ -32,14 +22,6 @@ module Spree"/accept-invitation/#{invitation.prefixed_id}?token=#{invitation.token}"endend-- attribute :expires_at do |invitation|- invitation.expires_at&.iso8601- end-- attribute :accepted_at do |invitation|- invitation.accepted_at&.iso8601- endendendenddiff --git a/spree/api/app/serializers/spree/api/v3/seller/product_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/product_serializer.rbindex 1bb2b79618..315f27cf69 100644--- a/spree/api/app/serializers/spree/api/v3/seller/product_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/product_serializer.rb@@ -2,18 +2,6 @@ module Spreemodule Apimodule V3module Seller- # A seller's own product, as they manage it.- #- # Extends the store serializer, NOT the admin one, deliberately. The- # admin serializer's nested associations (`variants`, `channels`,- # `product_publications`) render through admin serializers that carry- # operator data — cost prices, publication state, internal metadata —- # and a seller must not read those even on their own product. The- # store serializer's nested pieces are all customer-safe, so building- # up from there means nothing leaks by inheritance.- #- # On top of the public view, a seller needs `status` (their product may- # be a draft the storefront cannot see yet) and timestamps.class ProductSerializer < V3::ProductSerializertypelize status: :stringdiff --git a/spree/api/app/serializers/spree/api/v3/seller/profile_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/profile_serializer.rbindex b8711ca838..17cb466a2e 100644--- a/spree/api/app/serializers/spree/api/v3/seller/profile_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/profile_serializer.rb@@ -2,18 +2,10 @@ module Spreemodule Apimodule V3module Seller- # A seller's own record, as they see it.- #- # Sits between the two existing views: more than the shopper's public- # profile (the seller needs their contact details and where they stand- # in the marketplace), less than the operator's (they read their- # settlement terms but never the operator's private notes).- #- # `status` and `sellable` are readable but not writable — a seller- # should know they are suspended; moving between states is the- # operator's decision, made through workflows.class ProfileSerializer < V3::SellerSerializertypelize status: :string,+ legal_name: [:string, nullable: true],+ registration_number: [:string, nullable: true],contact_email: [:string, nullable: true],billing_email: [:string, nullable: true],tax_remittance: :string,@@ -24,7 +16,8 @@ module Spreeon_holiday: :boolean, sellable: :boolean,products_count: :number- attributes :status, :contact_email, :billing_email,+ attributes :status, :legal_name, :registration_number,+ :contact_email, :billing_email,:tax_remittance, :payouts_schedule_interval,holiday_mode_until: :iso8601,terms_accepted_at: :iso8601,@@ -46,6 +39,9 @@ module Spreeseller.products.countend+ many :tax_identifiers,+ resource: proc { Spree.api.seller_tax_identifier_serializer }+one :billing_address,resource: proc { Spree.api.address_serializer },if: proc { |seller| seller.billing_address.present? }diff --git a/spree/api/app/serializers/spree/api/v3/seller/requirement_custom_field_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/requirement_custom_field_serializer.rbnew file mode 100644index 0000000000..7beaf18637--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/seller/requirement_custom_field_serializer.rb@@ -0,0 +1,36 @@+module Spree+ module Api+ module V3+ module Seller+ class RequirementCustomFieldSerializer+ include Alba::Resource+ include Typelizer::DSL++ typelize id: :string, key: :string, label: :string,+ field_type: Spree::CustomField::FIELD_TYPE_TOKENS,+ value: :any++ attribute :id do |pair|+ pair[:definition].prefixed_id+ end++ attribute :key do |pair|+ pair[:definition].full_key+ end++ attribute :label do |pair|+ pair[:definition].label+ end++ attribute :field_type do |pair|+ pair[:definition].field_type+ end++ attribute :value do |pair|+ pair[:custom_field]&.serialize_value+ end+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/seller/requirement_status_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/requirement_status_serializer.rbindex 4853ef7c11..0321417ad3 100644--- a/spree/api/app/serializers/spree/api/v3/seller/requirement_status_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/requirement_status_serializer.rb@@ -2,22 +2,6 @@ module Spreemodule Apimodule V3module Seller- # One line of this seller's onboarding checklist.- #- # A value object, so no id of its own: the `id` is the requirement it- # came from, which is what the panel posts a submission against.- #- # `blocking` is serialized rather than derived client-side so the- # panel's "what is stopping me" list and the server's refusal on- # submit-for-review cannot disagree. `kind` is what the panel keys- # presentation off — which line gets a file picker, which gets a- # checkbox, which just links away.- #- # Includes Alba directly instead of inheriting BaseSerializer, as the- # operator's twin does: the base renders `id` by calling- # `object.prefixed_id`, and this is a value object whose `id` is- # already a prefixed id string. Inheriting would render `id: nil` and- # cost the panel the one field it posts submissions against.class RequirementStatusSerializerinclude Alba::Resourceinclude Typelizer::DSL@@ -25,7 +9,9 @@ module Spreetypelize id: :string, kind: :string, name: :string,description: [:string, nullable: true],required: :boolean, position: :number, status: :string,- blocking: :boolean, action_url: [:string, nullable: true]+ blocking: :boolean, action_url: [:string, nullable: true],+ accepts_submissions: :boolean, requires_file: :boolean,+ accepted_content_types: [:string, multi: true]attributes :id, :kind, :name, :description, :required, :position, :status, :action_url@@ -33,9 +19,27 @@ module Spreestatus.blocking?end+ attribute :accepts_submissions do |status|+ status.requirement.class.accepts_submissions?+ end++ attribute :requires_file do |status|+ status.requirement.class.requires_file?+ end++ attribute :accepted_content_types do |status|+ status.requirement.class.requires_file? ? status.requirement.class.accepted_content_types : []+ end+one :submission,resource: proc { Spree.api.seller_requirement_submission_serializer },if: proc { |status| status.submission.present? }++ many :custom_fields,+ resource: proc { Spree.api.seller_requirement_custom_field_serializer },+ if: proc { |status| status.respond_to?(:custom_fields) && status.custom_fields.any? } do |status|+ status.custom_fields+ endendendenddiff --git a/spree/api/app/serializers/spree/api/v3/seller/requirement_submission_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/requirement_submission_serializer.rbindex 51c33dd2a4..8a1f81f181 100644--- a/spree/api/app/serializers/spree/api/v3/seller/requirement_submission_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/requirement_submission_serializer.rb@@ -2,17 +2,6 @@ module Spreemodule Apimodule V3module Seller- # What this seller submitted about one requirement, and what the- # marketplace made of it.- #- # Narrower than the operator's view on purpose: no `seller_id` (there- # is exactly one seller in play and it is the caller), no- # `requirement_name` (the checklist line already carries it), and no- # `metadata` — that is the operator's and any provider's workspace,- # not something a seller reads back.- #- # `review_note` IS included: a rejection the seller cannot read is a- # rejection they cannot act on.class RequirementSubmissionSerializer < V3::BaseSerializertypelize status: :string, note: [:string, nullable: true],review_note: [:string, nullable: true],@@ -26,9 +15,6 @@ module Spreecreated_at: :iso8601,updated_at: :iso8601- # This API's own download action, not a storage URL: these are- # identity documents, so each download is authorized per request- # rather than readable by anyone holding the link.attribute :file_url do |submission|next nil unless submission.file.attached?diff --git a/spree/api/app/serializers/spree/api/v3/seller/stock_location_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/stock_location_serializer.rbindex 71b11ebf24..786e1ce1d3 100644--- a/spree/api/app/serializers/spree/api/v3/seller/stock_location_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/stock_location_serializer.rb@@ -2,14 +2,6 @@ module Spreemodule Apimodule V3module Seller- # A seller's own stock location, as they manage it in the panel.- #- # Extends the store serializer rather than the admin one: the fields- # an operator sees that a seller does not need are the ones about- # running the marketplace's own inventory (`admin_name`,- # `propagate_all_variants`, `backorderable_default`). What a seller- # needs is the address, whether it is live, and whether it is the one- # their returns go to.class StockLocationSerializer < V3::StockLocationSerializertypelize address2: [:string, nullable: true], state_name: [:string, nullable: true],phone: [:string, nullable: true], company: [:string, nullable: true],diff --git a/spree/api/app/serializers/spree/api/v3/seller/tax_identifier_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/tax_identifier_serializer.rbnew file mode 100644index 0000000000..11a2f9a49b--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/seller/tax_identifier_serializer.rb@@ -0,0 +1,15 @@+module Spree+ module Api+ module V3+ module Seller+ class TaxIdentifierSerializer < V3::BaseSerializer+ typelize kind: :string, value: :string,+ validation_status: [:string, nullable: true],+ validated_at: [:string, nullable: true]++ attributes :kind, :value, :validation_status, validated_at: :iso8601+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/seller/team_member_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/team_member_serializer.rbindex 241b8a4ab2..5508b7af16 100644--- a/spree/api/app/serializers/spree/api/v3/seller/team_member_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/team_member_serializer.rb@@ -2,15 +2,6 @@ module Spreemodule Apimodule V3module Seller- # A teammate, as their colleagues on the same seller see them.- #- # Deliberately not the operator's `AdminUserSerializer`. That one- # renders every store the user holds a role on, so the marketplace's- # own store switcher can offer them — rendered to a seller it would- # disclose the name and code of unrelated stores their teammate happens- # to work for. It also scopes `roles` to the current *store*, which- # answers a question nobody asked here: what matters is the teammate's- # standing on this seller.class TeamMemberSerializer < V3::BaseSerializertypelize email: :string,first_name: [:string, nullable: true],diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rbindex 722c082c3a..df3242791c 100644--- a/spree/api/config/routes.rb+++ b/spree/api/config/routes.rb@@ -686,6 +686,9 @@ Spree::Core::Engine.add_routes do# shape every later one follows — rooted in the seller by the anchor.resources :products, only: [:index, :show, :create, :update, :destroy]+ # Presigning for the documents onboarding asks a seller to upload.+ resources :direct_uploads, only: [:create]+# Where this seller keeps stock, and so where their returns are sent.# No destroy: a location holds stock levels and is named on historical# fulfillments, so a seller retires one by deactivating it.diff --git a/spree/api/lib/spree/api/dependencies.rb b/spree/api/lib/spree/api/dependencies.rbindex d2590afe92..2a1d58845e 100644--- a/spree/api/lib/spree/api/dependencies.rb+++ b/spree/api/lib/spree/api/dependencies.rb@@ -161,6 +161,8 @@ module Spreeseller_invitation_serializer: 'Spree::Api::V3::Seller::InvitationSerializer',seller_product_serializer: 'Spree::Api::V3::Seller::ProductSerializer',seller_stock_location_serializer: 'Spree::Api::V3::Seller::StockLocationSerializer',+ seller_requirement_custom_field_serializer: 'Spree::Api::V3::Seller::RequirementCustomFieldSerializer',+ seller_tax_identifier_serializer: 'Spree::Api::V3::Seller::TaxIdentifierSerializer',seller_requirement_status_serializer: 'Spree::Api::V3::Seller::RequirementStatusSerializer',seller_requirement_submission_serializer: 'Spree::Api::V3::Seller::RequirementSubmissionSerializer',admin_seller_serializer: 'Spree::Api::V3::Admin::SellerSerializer',diff --git a/spree/api/spec/controllers/spree/api/v3/seller/profile_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/seller/profile_controller_spec.rbindex b7952302a8..5a584a9afc 100644--- a/spree/api/spec/controllers/spree/api/v3/seller/profile_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/seller/profile_controller_spec.rb@@ -145,4 +145,109 @@ RSpec.describe Spree::Api::V3::Seller::ProfileController, type: :controller doexpect(response).to have_http_status(:forbidden)endend+ # Custom fields on Spree::Seller are the operator's schema, and some are+ # theirs alone. A seller fills in what onboarding asked them for.+ describe 'PATCH #update custom fields' do+ let(:asked_for) do+ create(:custom_field_definition, resource_type: 'Spree::Seller', namespace: 'seller',+ key: 'vat_number', label: 'VAT number')+ end+ let(:operator_only) do+ create(:custom_field_definition, resource_type: 'Spree::Seller', namespace: 'seller',+ key: 'risk_note', label: 'Risk note')+ end+ let!(:requirement) do+ create(:required_custom_fields_requirement, store: store).tap do |req|+ req.custom_field_definitions << asked_for+ end+ end++ it 'writes a field the checklist asks for' do+ patch :update, params: {+ custom_fields: [{ custom_field_definition_id: asked_for.prefixed_id, value: 'GB123456789' }]+ }, as: :json++ expect(response).to have_http_status(:ok)+ expect(seller.reload.custom_fields.find_by(custom_field_definition: asked_for).value).+ to eq('GB123456789')+ end++ # The nested-attributes writer builds a row every time, so a seller+ # correcting a value they had already saved hit the uniqueness index and+ # got "has already been taken". The upserting writer is the right one.+ it 'updates a field the seller already answered' do+ patch :update, params: {+ custom_fields: [{ custom_field_definition_id: asked_for.prefixed_id, value: 'GB111' }]+ }, as: :json+ patch :update, params: {+ custom_fields: [{ custom_field_definition_id: asked_for.prefixed_id, value: 'GB222' }]+ }, as: :json++ expect(response).to have_http_status(:ok)+ fields = seller.reload.custom_fields.where(custom_field_definition: asked_for)+ expect(fields.count).to eq(1)+ expect(fields.first.value).to eq('GB222')+ end++ it 'ignores a field nothing asked them for' do+ patch :update, params: {+ custom_fields: [{ custom_field_definition_id: operator_only.prefixed_id, value: 'sneaky' }]+ }, as: :json++ expect(response).to have_http_status(:ok)+ expect(seller.reload.custom_fields.find_by(custom_field_definition: operator_only)).to be_nil+ end+ end++ # The business identity a commission invoice is made out to — legal name,+ # registration number, and the VAT number EU reverse charge turns on.+ describe 'PATCH #update business identity' do+ it 'writes the legal name and registration number' do+ patch :update, params: {+ legal_name: 'Sparks Trading Ltd', registration_number: '01234567'+ }, as: :json++ expect(response).to have_http_status(:ok)+ expect(seller.reload.legal_name).to eq('Sparks Trading Ltd')+ expect(seller.registration_number).to eq('01234567')+ end++ it 'records a tax registration' do+ patch :update, params: { tax_identifier: { kind: 'eu_vat', value: 'GB123456789' } }, as: :json++ expect(response).to have_http_status(:ok)+ identifier = seller.reload.tax_identifiers.find_by(kind: 'eu_vat')+ expect(identifier.value).to eq('GB123456789')+ end++ # One per kind, so correcting the number replaces it rather than stacking+ # a second row the model would refuse.+ it 'corrects a registration rather than adding a second' do+ patch :update, params: { tax_identifier: { kind: 'eu_vat', value: 'GB111' } }, as: :json+ patch :update, params: { tax_identifier: { kind: 'eu_vat', value: 'GB222' } }, as: :json++ expect(response).to have_http_status(:ok)+ identifiers = seller.reload.tax_identifiers.where(kind: 'eu_vat')+ expect(identifiers.count).to eq(1)+ expect(identifiers.first.value).to eq('GB222')+ end++ it 'removes it when the seller clears the number' do+ patch :update, params: { tax_identifier: { kind: 'eu_vat', value: 'GB111' } }, as: :json+ patch :update, params: { tax_identifier: { kind: 'eu_vat', value: '' } }, as: :json++ expect(seller.reload.tax_identifiers.where(kind: 'eu_vat')).to be_empty+ end++ it 'serializes them back' do+ seller.tax_identifiers.create!(kind: 'eu_vat', value: 'GB123456789')++ get :show, as: :json++ expect(json_response['tax_identifiers'].first).to include(+ 'kind' => 'eu_vat', 'value' => 'GB123456789'+ )+ end+ end+enddiff --git a/spree/core/app/models/spree/seller_requirement_status.rb b/spree/core/app/models/spree/seller_requirement_status.rbindex d1a2c0c1e5..8ef0e9ddf3 100644--- a/spree/core/app/models/spree/seller_requirement_status.rb+++ b/spree/core/app/models/spree/seller_requirement_status.rb@@ -34,6 +34,41 @@ module Spree# @return [Spree::SellerRequirementSubmission, nil]attr_accessor :submission+ # The requirement this was evaluated from.+ #+ # Carried so a serializer can ask the kind its own questions — which+ # custom fields it names, whether it takes a file — without re-fetching a+ # row the evaluator has already loaded. Not serialized itself: what a+ # client needs is the answers, not the configuration row.+ #+ # @return [Spree::SellerRequirement, nil]+ attr_accessor :requirement++ # The seller this was evaluated against, so kind-specific readers can ask+ # about them without the caller passing them a second time.+ #+ # @return [Spree::Seller, nil]+ attr_accessor :seller++ # The custom fields this line asks for, each paired with the seller's+ # current answer — empty for every kind that asks for none.+ #+ # Built here rather than in the serializer because it is the answer to+ # "what does this requirement want", which is the value object's job; the+ # serializer only decides how to render it.+ #+ # @return [Array<Hash>] `{ definition:, custom_field: }` pairs+ def custom_fields+ return [] unless requirement.respond_to?(:custom_field_definitions)+ return [] if seller.nil?++ answered = seller.custom_fields.index_by(&:custom_field_definition_id)++ requirement.custom_field_definitions.map do |definition|+ { definition: definition, custom_field: answered[definition.id] }+ end+ end+# ActiveModel::Attributes gives readers, not predicates.def required?!!requireddiff --git a/spree/core/app/services/spree/sellers/requirements.rb b/spree/core/app/services/spree/sellers/requirements.rbindex ecaba79aa1..92406d8f0e 100644--- a/spree/core/app/services/spree/sellers/requirements.rb+++ b/spree/core/app/services/spree/sellers/requirements.rb@@ -114,7 +114,9 @@ module Spreeposition: requirement.position,status: requirement.status_for(seller),action_url: requirement.action_url(seller),- submission: requirement.latest_submission(seller)+ submission: requirement.latest_submission(seller),+ requirement: requirement,+ seller: seller)endend