@thorprovider/types 3.2.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/index.d.mts +1134 -1
- package/dist/index.d.ts +1134 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/admin/DropshippingAdmin.ts +994 -0
- package/src/admin/MultiTenantAdmin.ts +295 -0
- package/src/admin/index.ts +2 -0
- package/src/commerce-provider.ts +42 -0
- package/src/index.ts +141 -1
package/dist/index.d.ts
CHANGED
|
@@ -2784,6 +2784,44 @@ interface CommerceProvider {
|
|
|
2784
2784
|
* ```
|
|
2785
2785
|
*/
|
|
2786
2786
|
updateBillingAddress?(cartId: string, address: Address): Promise<Cart>;
|
|
2787
|
+
/**
|
|
2788
|
+
* Update the shipping address on a cart.
|
|
2789
|
+
*
|
|
2790
|
+
* Sets the customer's delivery address and email before proceeding to
|
|
2791
|
+
* shipping method and payment selection.
|
|
2792
|
+
*
|
|
2793
|
+
* @param cartId - Cart ID
|
|
2794
|
+
* @param address - Shipping address and contact details
|
|
2795
|
+
* @throws {ProviderAPIError} If cart not found or address is invalid
|
|
2796
|
+
*
|
|
2797
|
+
* @example
|
|
2798
|
+
* ```typescript
|
|
2799
|
+
* await commerce.updateShippingAddress(cartId, {
|
|
2800
|
+
* email: 'customer@example.com',
|
|
2801
|
+
* firstName: 'Jane',
|
|
2802
|
+
* lastName: 'Doe',
|
|
2803
|
+
* address1: '123 Main St',
|
|
2804
|
+
* city: 'Madrid',
|
|
2805
|
+
* province: 'Madrid',
|
|
2806
|
+
* postalCode: '28001',
|
|
2807
|
+
* countryCode: 'ES',
|
|
2808
|
+
* phone: '+34 600 000 000',
|
|
2809
|
+
* });
|
|
2810
|
+
* ```
|
|
2811
|
+
*/
|
|
2812
|
+
updateShippingAddress?(cartId: string, address: {
|
|
2813
|
+
email: string;
|
|
2814
|
+
firstName: string;
|
|
2815
|
+
lastName: string;
|
|
2816
|
+
address1: string;
|
|
2817
|
+
address2?: string;
|
|
2818
|
+
company?: string;
|
|
2819
|
+
city: string;
|
|
2820
|
+
province: string;
|
|
2821
|
+
postalCode: string;
|
|
2822
|
+
countryCode: string;
|
|
2823
|
+
phone: string;
|
|
2824
|
+
}): Promise<void>;
|
|
2787
2825
|
/**
|
|
2788
2826
|
* Get customer by ID (optional)
|
|
2789
2827
|
* @param customerId - Customer ID
|
|
@@ -3383,4 +3421,1099 @@ interface SiteConfigMetadata {
|
|
|
3383
3421
|
history?: ConfigHistoryEntry[];
|
|
3384
3422
|
}
|
|
3385
3423
|
|
|
3386
|
-
|
|
3424
|
+
/**
|
|
3425
|
+
* @thorprovider/types — Multi-Tenant Admin Types
|
|
3426
|
+
*
|
|
3427
|
+
* Type definitions for admin operations on the Thor Commerce multi-tenant
|
|
3428
|
+
* backend plugin (`/admin/thor/`).
|
|
3429
|
+
*
|
|
3430
|
+
* These types map 1:1 to the API contract defined in
|
|
3431
|
+
* `multitenant-api-contract.md`.
|
|
3432
|
+
*
|
|
3433
|
+
* @module admin/MultiTenantAdmin
|
|
3434
|
+
*/
|
|
3435
|
+
/**
|
|
3436
|
+
* A customer entry as returned by the admin multi-tenant API.
|
|
3437
|
+
*/
|
|
3438
|
+
interface AdminChannelCustomer {
|
|
3439
|
+
id: string;
|
|
3440
|
+
email: string;
|
|
3441
|
+
first_name: string | null;
|
|
3442
|
+
last_name: string | null;
|
|
3443
|
+
phone: string | null;
|
|
3444
|
+
created_at: string;
|
|
3445
|
+
}
|
|
3446
|
+
/** Response for `GET /admin/thor/sales-channels/:id/customers` */
|
|
3447
|
+
interface GetChannelCustomersResponse {
|
|
3448
|
+
customers: AdminChannelCustomer[];
|
|
3449
|
+
count: number;
|
|
3450
|
+
limit: number;
|
|
3451
|
+
offset: number;
|
|
3452
|
+
}
|
|
3453
|
+
/** Options for paginating channel customers */
|
|
3454
|
+
interface GetChannelCustomersOptions {
|
|
3455
|
+
/** Max customers to return (default 20, max 100) */
|
|
3456
|
+
limit?: number;
|
|
3457
|
+
/** Pagination offset (default 0) */
|
|
3458
|
+
offset?: number;
|
|
3459
|
+
}
|
|
3460
|
+
/**
|
|
3461
|
+
* A publishable API key entry as returned by the admin multi-tenant API.
|
|
3462
|
+
*/
|
|
3463
|
+
interface AdminApiKey {
|
|
3464
|
+
id: string;
|
|
3465
|
+
title: string;
|
|
3466
|
+
token: string;
|
|
3467
|
+
type: 'publishable' | string;
|
|
3468
|
+
created_at: string;
|
|
3469
|
+
}
|
|
3470
|
+
/** Response for `GET /admin/thor/sales-channels/:id/api-keys` */
|
|
3471
|
+
interface GetChannelApiKeysResponse {
|
|
3472
|
+
api_keys: AdminApiKey[];
|
|
3473
|
+
}
|
|
3474
|
+
/**
|
|
3475
|
+
* A product category entry as returned by admin channel category endpoints.
|
|
3476
|
+
*/
|
|
3477
|
+
interface AdminChannelCategory {
|
|
3478
|
+
id: string;
|
|
3479
|
+
name: string;
|
|
3480
|
+
handle: string;
|
|
3481
|
+
description: string | null;
|
|
3482
|
+
parent_category_id: string | null;
|
|
3483
|
+
rank: number;
|
|
3484
|
+
metadata: Record<string, unknown>;
|
|
3485
|
+
}
|
|
3486
|
+
/** Response for `GET /admin/thor/sales-channels/:id/categories` */
|
|
3487
|
+
interface GetChannelCategoriesResponse {
|
|
3488
|
+
categories: AdminChannelCategory[];
|
|
3489
|
+
count: number;
|
|
3490
|
+
}
|
|
3491
|
+
/** Options for listing channel categories */
|
|
3492
|
+
interface GetChannelCategoriesOptions {
|
|
3493
|
+
/** Max categories per page (default 20, max 100) */
|
|
3494
|
+
limit?: number;
|
|
3495
|
+
/** Pagination offset (default 0) */
|
|
3496
|
+
offset?: number;
|
|
3497
|
+
/** Expand child categories in nested tree */
|
|
3498
|
+
include_descendants?: boolean;
|
|
3499
|
+
}
|
|
3500
|
+
/**
|
|
3501
|
+
* A slim sales channel reference returned when listing channels for a resource.
|
|
3502
|
+
*/
|
|
3503
|
+
interface AdminSalesChannelRef {
|
|
3504
|
+
id: string;
|
|
3505
|
+
name: string;
|
|
3506
|
+
description?: string;
|
|
3507
|
+
}
|
|
3508
|
+
/** Response for `GET /admin/thor/categories/:id/sales-channels` */
|
|
3509
|
+
interface GetCategorySalesChannelsResponse {
|
|
3510
|
+
sales_channels: AdminSalesChannelRef[];
|
|
3511
|
+
}
|
|
3512
|
+
/** Body for `POST /admin/thor/categories/:id/sales-channels` */
|
|
3513
|
+
interface AssignCategoriesToChannelsBody {
|
|
3514
|
+
sales_channel_ids: string[];
|
|
3515
|
+
}
|
|
3516
|
+
/** Response for `POST /admin/thor/categories/:id/sales-channels` */
|
|
3517
|
+
interface AssignCategoriesToChannelsResponse {
|
|
3518
|
+
message: string;
|
|
3519
|
+
linked: number;
|
|
3520
|
+
}
|
|
3521
|
+
/** Body for `DELETE /admin/thor/categories/:id/sales-channels` */
|
|
3522
|
+
interface UnassignCategoriesFromChannelsBody {
|
|
3523
|
+
sales_channel_ids: string[];
|
|
3524
|
+
}
|
|
3525
|
+
/** Response for `DELETE /admin/thor/categories/:id/sales-channels` */
|
|
3526
|
+
interface UnassignCategoriesFromChannelsResponse {
|
|
3527
|
+
message: string;
|
|
3528
|
+
dismissed: number;
|
|
3529
|
+
}
|
|
3530
|
+
/** Response for `GET /admin/thor/collections/:id/sales-channels` */
|
|
3531
|
+
interface GetCollectionSalesChannelsResponse {
|
|
3532
|
+
sales_channels: AdminSalesChannelRef[];
|
|
3533
|
+
}
|
|
3534
|
+
/** Body for `POST /admin/thor/collections/:id/sales-channels` */
|
|
3535
|
+
interface AssignCollectionsToChannelsBody {
|
|
3536
|
+
sales_channel_ids: string[];
|
|
3537
|
+
}
|
|
3538
|
+
/** Response for `POST /admin/thor/collections/:id/sales-channels` */
|
|
3539
|
+
interface AssignCollectionsToChannelsResponse {
|
|
3540
|
+
message: string;
|
|
3541
|
+
linked: number;
|
|
3542
|
+
}
|
|
3543
|
+
/** Body for `DELETE /admin/thor/collections/:id/sales-channels` */
|
|
3544
|
+
interface UnassignCollectionsFromChannelsBody {
|
|
3545
|
+
sales_channel_ids: string[];
|
|
3546
|
+
}
|
|
3547
|
+
/** Response for `DELETE /admin/thor/collections/:id/sales-channels` */
|
|
3548
|
+
interface UnassignCollectionsFromChannelsResponse {
|
|
3549
|
+
message: string;
|
|
3550
|
+
dismissed: number;
|
|
3551
|
+
}
|
|
3552
|
+
/**
|
|
3553
|
+
* SEO defaults as stored in the storefront config.
|
|
3554
|
+
*/
|
|
3555
|
+
interface AdminStorefrontSeoDefaults {
|
|
3556
|
+
title: string;
|
|
3557
|
+
description: string;
|
|
3558
|
+
ogImage?: string;
|
|
3559
|
+
}
|
|
3560
|
+
/**
|
|
3561
|
+
* Full storefront config record as returned by admin endpoints.
|
|
3562
|
+
* Uses snake_case to match the API contract response shape exactly.
|
|
3563
|
+
*/
|
|
3564
|
+
interface AdminStorefrontConfig {
|
|
3565
|
+
id: string;
|
|
3566
|
+
sales_channel_id: string;
|
|
3567
|
+
theme_accent_color: string;
|
|
3568
|
+
logo_url: string;
|
|
3569
|
+
currency_code: string;
|
|
3570
|
+
seo_defaults: AdminStorefrontSeoDefaults;
|
|
3571
|
+
frontend_webhook_url?: string;
|
|
3572
|
+
created_at: string;
|
|
3573
|
+
updated_at: string;
|
|
3574
|
+
}
|
|
3575
|
+
/** Response for `GET /admin/thor/storefront-config/:id` */
|
|
3576
|
+
interface GetAdminStorefrontConfigResponse {
|
|
3577
|
+
storefront_config: AdminStorefrontConfig;
|
|
3578
|
+
}
|
|
3579
|
+
/** Body for `PUT /admin/thor/storefront-config/:id` */
|
|
3580
|
+
interface UpdateStorefrontConfigBody {
|
|
3581
|
+
theme_accent_color: string;
|
|
3582
|
+
logo_url: string;
|
|
3583
|
+
currency_code: string;
|
|
3584
|
+
seo_defaults: {
|
|
3585
|
+
title: string;
|
|
3586
|
+
description: string;
|
|
3587
|
+
ogImage?: string;
|
|
3588
|
+
};
|
|
3589
|
+
frontend_webhook_url?: string;
|
|
3590
|
+
}
|
|
3591
|
+
/** Response for `PUT /admin/thor/storefront-config/:id` */
|
|
3592
|
+
interface UpdateStorefrontConfigResponse {
|
|
3593
|
+
storefront_config: AdminStorefrontConfig;
|
|
3594
|
+
}
|
|
3595
|
+
/**
|
|
3596
|
+
* A single history entry for the Site Designer config.
|
|
3597
|
+
*/
|
|
3598
|
+
interface AdminSiteConfigHistoryEntry {
|
|
3599
|
+
id?: string;
|
|
3600
|
+
version: string;
|
|
3601
|
+
createdAt: string;
|
|
3602
|
+
createdBy?: string;
|
|
3603
|
+
}
|
|
3604
|
+
/**
|
|
3605
|
+
* Full site config record as returned by admin endpoints.
|
|
3606
|
+
* `config` is the free-form `DesignerConfig` JSON object.
|
|
3607
|
+
*/
|
|
3608
|
+
interface AdminSiteConfig {
|
|
3609
|
+
id: string;
|
|
3610
|
+
sales_channel_id: string;
|
|
3611
|
+
version: string;
|
|
3612
|
+
/** Free-form DesignerConfig object managed by the Site Designer */
|
|
3613
|
+
config: Record<string, unknown>;
|
|
3614
|
+
history?: AdminSiteConfigHistoryEntry[];
|
|
3615
|
+
created_at?: string;
|
|
3616
|
+
updated_at?: string;
|
|
3617
|
+
}
|
|
3618
|
+
/** Response for `GET /admin/thor/site-config/:sales_channel_id` */
|
|
3619
|
+
interface GetAdminSiteConfigResponse {
|
|
3620
|
+
site_config: AdminSiteConfig;
|
|
3621
|
+
}
|
|
3622
|
+
/** Body for `PUT /admin/thor/site-config/:sales_channel_id` */
|
|
3623
|
+
type UpdateSiteConfigBody = Record<string, unknown>;
|
|
3624
|
+
/** Response for `PUT /admin/thor/site-config/:sales_channel_id` */
|
|
3625
|
+
interface UpdateSiteConfigResponse {
|
|
3626
|
+
site_config: AdminSiteConfig;
|
|
3627
|
+
}
|
|
3628
|
+
/**
|
|
3629
|
+
* A full history entry including the stored config snapshot.
|
|
3630
|
+
*/
|
|
3631
|
+
interface AdminSiteConfigHistoryEntryFull {
|
|
3632
|
+
id: string;
|
|
3633
|
+
version: string;
|
|
3634
|
+
config: Record<string, unknown>;
|
|
3635
|
+
createdAt: string;
|
|
3636
|
+
createdBy?: string;
|
|
3637
|
+
}
|
|
3638
|
+
/** Response for `GET /admin/thor/site-config/:sales_channel_id/history` */
|
|
3639
|
+
interface GetAdminSiteConfigHistoryResponse {
|
|
3640
|
+
history: AdminSiteConfigHistoryEntryFull[];
|
|
3641
|
+
count: number;
|
|
3642
|
+
}
|
|
3643
|
+
/** Options for paginating site config history */
|
|
3644
|
+
interface GetAdminSiteConfigHistoryOptions {
|
|
3645
|
+
limit?: number;
|
|
3646
|
+
offset?: number;
|
|
3647
|
+
}
|
|
3648
|
+
/** Response for `POST /admin/thor/site-config/:sales_channel_id/restore/:version` */
|
|
3649
|
+
interface RestoreSiteConfigResponse {
|
|
3650
|
+
site_config: AdminSiteConfig;
|
|
3651
|
+
}
|
|
3652
|
+
/** Response for `POST /store/thor/customers/me/channels` */
|
|
3653
|
+
interface LinkCustomerToChannelResponse {
|
|
3654
|
+
linked: boolean;
|
|
3655
|
+
reason?: 'already_linked';
|
|
3656
|
+
}
|
|
3657
|
+
|
|
3658
|
+
/**
|
|
3659
|
+
* @thorprovider/types — Dropshipping Admin Types
|
|
3660
|
+
*
|
|
3661
|
+
* Type definitions for all dropshipping API operations on the Thor Commerce
|
|
3662
|
+
* extended backend plugin (`/admin/thor/dropshipper/`).
|
|
3663
|
+
*
|
|
3664
|
+
* These types map 1:1 to the API contract defined in
|
|
3665
|
+
* `dropshipping-api-contract.md`.
|
|
3666
|
+
*
|
|
3667
|
+
* Actors:
|
|
3668
|
+
* X = ThorProvider admin (role "Admin")
|
|
3669
|
+
* Y = Dropshipper (role "Dropshipper")
|
|
3670
|
+
* V = End customer (store)
|
|
3671
|
+
*
|
|
3672
|
+
* @module admin/DropshippingAdmin
|
|
3673
|
+
*/
|
|
3674
|
+
|
|
3675
|
+
/** Slim reference to a dropshipper account */
|
|
3676
|
+
interface DropshipperAccountRef {
|
|
3677
|
+
id: string;
|
|
3678
|
+
provider_name: string;
|
|
3679
|
+
}
|
|
3680
|
+
/** Body for `POST /admin/thor/dropshipper/onboard` */
|
|
3681
|
+
interface OnboardDropshipperBody {
|
|
3682
|
+
/** Business name — used as SalesChannel name and DropshipperAccount.provider_name */
|
|
3683
|
+
business_name: string;
|
|
3684
|
+
/** Dropshipper user email. Must be unique in the system. */
|
|
3685
|
+
email: string;
|
|
3686
|
+
/** Initial password. Y should change it on first access. */
|
|
3687
|
+
password: string;
|
|
3688
|
+
/** Contact phone number */
|
|
3689
|
+
phone?: string;
|
|
3690
|
+
/** Name of the account contact person */
|
|
3691
|
+
contact_name?: string;
|
|
3692
|
+
/** Payment terms in days after delivery. Default: 15 */
|
|
3693
|
+
payment_terms_days?: number;
|
|
3694
|
+
/** Primary currency code. Default: "usd" */
|
|
3695
|
+
currency_code?: string;
|
|
3696
|
+
}
|
|
3697
|
+
/** Response for `POST /admin/thor/dropshipper/onboard` */
|
|
3698
|
+
interface OnboardDropshipperResponse {
|
|
3699
|
+
dropshipper: {
|
|
3700
|
+
user_id: string;
|
|
3701
|
+
email: string;
|
|
3702
|
+
sales_channel_id: string;
|
|
3703
|
+
sales_channel_name: string;
|
|
3704
|
+
account_id: string;
|
|
3705
|
+
price_list_id: string;
|
|
3706
|
+
/** Publishable API key token for the storefront */
|
|
3707
|
+
publishable_key_token: string;
|
|
3708
|
+
role: 'Dropshipper';
|
|
3709
|
+
};
|
|
3710
|
+
}
|
|
3711
|
+
/** A single variant cost record */
|
|
3712
|
+
interface VariantCost {
|
|
3713
|
+
id: string;
|
|
3714
|
+
account_id: string;
|
|
3715
|
+
variant_id: string;
|
|
3716
|
+
variant_title?: string;
|
|
3717
|
+
product_title?: string;
|
|
3718
|
+
cost_amount: number;
|
|
3719
|
+
currency_code: string;
|
|
3720
|
+
created_at?: string;
|
|
3721
|
+
updated_at: string;
|
|
3722
|
+
}
|
|
3723
|
+
/** Options for `GET /admin/thor/dropshipper/variant-costs` */
|
|
3724
|
+
interface GetVariantCostsOptions {
|
|
3725
|
+
/** Filter by dropshipper account */
|
|
3726
|
+
account_id?: string;
|
|
3727
|
+
variant_id?: string;
|
|
3728
|
+
currency_code?: string;
|
|
3729
|
+
limit?: number;
|
|
3730
|
+
offset?: number;
|
|
3731
|
+
}
|
|
3732
|
+
/** Response for `GET /admin/thor/dropshipper/variant-costs` */
|
|
3733
|
+
interface GetVariantCostsResponse {
|
|
3734
|
+
variant_costs: VariantCost[];
|
|
3735
|
+
count: number;
|
|
3736
|
+
offset: number;
|
|
3737
|
+
limit: number;
|
|
3738
|
+
}
|
|
3739
|
+
/** Body for `POST /admin/thor/dropshipper/variant-costs` (upsert) */
|
|
3740
|
+
interface CreateVariantCostBody {
|
|
3741
|
+
account_id: string;
|
|
3742
|
+
variant_id: string;
|
|
3743
|
+
cost_amount: number;
|
|
3744
|
+
currency_code: string;
|
|
3745
|
+
}
|
|
3746
|
+
/** Response for `POST /admin/thor/dropshipper/variant-costs` */
|
|
3747
|
+
interface CreateVariantCostResponse {
|
|
3748
|
+
variant_cost: VariantCost;
|
|
3749
|
+
}
|
|
3750
|
+
/** Single item in a batch variant cost update */
|
|
3751
|
+
interface BatchVariantCostItem {
|
|
3752
|
+
variant_id: string;
|
|
3753
|
+
cost_amount: number;
|
|
3754
|
+
}
|
|
3755
|
+
/** Body for `POST /admin/thor/dropshipper/variant-costs/batch` */
|
|
3756
|
+
interface BatchVariantCostsBody {
|
|
3757
|
+
account_id: string;
|
|
3758
|
+
currency_code: string;
|
|
3759
|
+
costs: BatchVariantCostItem[];
|
|
3760
|
+
}
|
|
3761
|
+
/** Response for `POST /admin/thor/dropshipper/variant-costs/batch` */
|
|
3762
|
+
interface BatchVariantCostsResponse {
|
|
3763
|
+
updated: number;
|
|
3764
|
+
errors: unknown[];
|
|
3765
|
+
}
|
|
3766
|
+
/** Response for `DELETE /admin/thor/dropshipper/variant-costs/:id` */
|
|
3767
|
+
interface DeleteVariantCostResponse {
|
|
3768
|
+
deleted: true;
|
|
3769
|
+
id: string;
|
|
3770
|
+
}
|
|
3771
|
+
/** A product variant as seen by the dropshipper */
|
|
3772
|
+
interface DropshipperVariant {
|
|
3773
|
+
id: string;
|
|
3774
|
+
title: string;
|
|
3775
|
+
sku: string | null;
|
|
3776
|
+
stock_quantity: number;
|
|
3777
|
+
/** Price Y pays to X. Read-only for Y. */
|
|
3778
|
+
cost_price: number;
|
|
3779
|
+
cost_price_currency: string;
|
|
3780
|
+
/** "custom" if from DropshipperVariantCost, "base_price" if fallback */
|
|
3781
|
+
cost_price_source: 'custom' | 'base_price';
|
|
3782
|
+
/** Price Y charges to V. From the channel's price list. */
|
|
3783
|
+
sale_price: number;
|
|
3784
|
+
sale_price_currency: string;
|
|
3785
|
+
/** sale_price - cost_price (calculated by backend) */
|
|
3786
|
+
margin: number;
|
|
3787
|
+
/** (margin / sale_price) × 100 (calculated by backend) */
|
|
3788
|
+
margin_percent: number;
|
|
3789
|
+
}
|
|
3790
|
+
/** A product as seen by the dropshipper */
|
|
3791
|
+
interface DropshipperProduct {
|
|
3792
|
+
id: string;
|
|
3793
|
+
title: string;
|
|
3794
|
+
thumbnail: string | null;
|
|
3795
|
+
status: 'published' | 'draft' | string;
|
|
3796
|
+
variants: DropshipperVariant[];
|
|
3797
|
+
}
|
|
3798
|
+
/** Options for `GET /admin/thor/dropshipper/products` */
|
|
3799
|
+
interface GetDropshipperProductsOptions {
|
|
3800
|
+
/** Search by product or variant title */
|
|
3801
|
+
q?: string;
|
|
3802
|
+
category_id?: string;
|
|
3803
|
+
status?: 'published' | 'draft';
|
|
3804
|
+
in_stock?: boolean;
|
|
3805
|
+
limit?: number;
|
|
3806
|
+
offset?: number;
|
|
3807
|
+
}
|
|
3808
|
+
/** Response for `GET /admin/thor/dropshipper/products` */
|
|
3809
|
+
interface GetDropshipperProductsResponse {
|
|
3810
|
+
products: DropshipperProduct[];
|
|
3811
|
+
count: number;
|
|
3812
|
+
offset: number;
|
|
3813
|
+
limit: number;
|
|
3814
|
+
}
|
|
3815
|
+
/** Single price update item */
|
|
3816
|
+
interface DropshipperPriceItem {
|
|
3817
|
+
variant_id: string;
|
|
3818
|
+
amount: number;
|
|
3819
|
+
}
|
|
3820
|
+
/** Body for `PUT /admin/thor/dropshipper/prices` */
|
|
3821
|
+
interface UpdateDropshipperPricesBody {
|
|
3822
|
+
currency_code: string;
|
|
3823
|
+
prices: DropshipperPriceItem[];
|
|
3824
|
+
}
|
|
3825
|
+
/** Response for `PUT /admin/thor/dropshipper/prices` */
|
|
3826
|
+
interface UpdateDropshipperPricesResponse {
|
|
3827
|
+
updated: number;
|
|
3828
|
+
price_list_id: string;
|
|
3829
|
+
}
|
|
3830
|
+
/** Slim customer reference on an order */
|
|
3831
|
+
interface DropshipperOrderCustomer {
|
|
3832
|
+
id: string;
|
|
3833
|
+
full_name: string;
|
|
3834
|
+
email: string;
|
|
3835
|
+
phone?: string;
|
|
3836
|
+
}
|
|
3837
|
+
/** Slim order row as returned in list responses */
|
|
3838
|
+
interface DropshipperOrder {
|
|
3839
|
+
id: string;
|
|
3840
|
+
display_id: number;
|
|
3841
|
+
status: string;
|
|
3842
|
+
fulfillment_status: string | null;
|
|
3843
|
+
created_at: string;
|
|
3844
|
+
customer: DropshipperOrderCustomer;
|
|
3845
|
+
currency_code: string;
|
|
3846
|
+
total: number;
|
|
3847
|
+
profit: number;
|
|
3848
|
+
margin_percent: number;
|
|
3849
|
+
items_count: number;
|
|
3850
|
+
payment_collected_by: 'dropshipper' | 'provider' | null;
|
|
3851
|
+
settlement_status: 'settled' | 'unsettled';
|
|
3852
|
+
}
|
|
3853
|
+
/** Options for `GET /admin/thor/dropshipper/orders` */
|
|
3854
|
+
interface GetDropshipperOrdersOptions {
|
|
3855
|
+
status?: string;
|
|
3856
|
+
payment_collector?: 'dropshipper' | 'provider';
|
|
3857
|
+
settlement_status?: 'settled' | 'unsettled';
|
|
3858
|
+
from?: string;
|
|
3859
|
+
to?: string;
|
|
3860
|
+
q?: string;
|
|
3861
|
+
limit?: number;
|
|
3862
|
+
offset?: number;
|
|
3863
|
+
}
|
|
3864
|
+
/** Response for `GET /admin/thor/dropshipper/orders` */
|
|
3865
|
+
interface GetDropshipperOrdersResponse {
|
|
3866
|
+
orders: DropshipperOrder[];
|
|
3867
|
+
count: number;
|
|
3868
|
+
offset: number;
|
|
3869
|
+
limit: number;
|
|
3870
|
+
}
|
|
3871
|
+
/** A shipping address on an order */
|
|
3872
|
+
interface DropshipperOrderShippingAddress {
|
|
3873
|
+
full_name: string;
|
|
3874
|
+
address_1: string;
|
|
3875
|
+
city: string;
|
|
3876
|
+
province: string | null;
|
|
3877
|
+
postal_code: string;
|
|
3878
|
+
country_code: string;
|
|
3879
|
+
}
|
|
3880
|
+
/** A line item with cost and profit breakdown */
|
|
3881
|
+
interface DropshipperOrderItem {
|
|
3882
|
+
id: string;
|
|
3883
|
+
title: string;
|
|
3884
|
+
variant_title: string;
|
|
3885
|
+
sku: string | null;
|
|
3886
|
+
quantity: number;
|
|
3887
|
+
unit_price: number;
|
|
3888
|
+
cost_price: number;
|
|
3889
|
+
subtotal: number;
|
|
3890
|
+
cost_subtotal: number;
|
|
3891
|
+
profit: number;
|
|
3892
|
+
thumbnail: string | null;
|
|
3893
|
+
}
|
|
3894
|
+
/** Order totals with profit breakdown */
|
|
3895
|
+
interface DropshipperOrderTotals {
|
|
3896
|
+
subtotal: number;
|
|
3897
|
+
shipping_total: number;
|
|
3898
|
+
discount_total: number;
|
|
3899
|
+
total: number;
|
|
3900
|
+
cost_total: number;
|
|
3901
|
+
profit: number;
|
|
3902
|
+
margin_percent: number;
|
|
3903
|
+
}
|
|
3904
|
+
/** Timeline event on an order */
|
|
3905
|
+
interface DropshipperOrderTimelineEvent {
|
|
3906
|
+
event: string;
|
|
3907
|
+
timestamp: string;
|
|
3908
|
+
}
|
|
3909
|
+
/** Full order detail as returned by GET /admin/thor/dropshipper/orders/:id */
|
|
3910
|
+
interface DropshipperOrderDetail {
|
|
3911
|
+
id: string;
|
|
3912
|
+
display_id: number;
|
|
3913
|
+
status: string;
|
|
3914
|
+
fulfillment_status: string | null;
|
|
3915
|
+
created_at: string;
|
|
3916
|
+
currency_code: string;
|
|
3917
|
+
customer: DropshipperOrderCustomer & {
|
|
3918
|
+
phone?: string;
|
|
3919
|
+
};
|
|
3920
|
+
shipping_address: DropshipperOrderShippingAddress;
|
|
3921
|
+
items: DropshipperOrderItem[];
|
|
3922
|
+
totals: DropshipperOrderTotals;
|
|
3923
|
+
payment_collected_by: 'dropshipper' | 'provider' | null;
|
|
3924
|
+
settlement_status: 'settled' | 'unsettled';
|
|
3925
|
+
timeline: DropshipperOrderTimelineEvent[];
|
|
3926
|
+
}
|
|
3927
|
+
/** Response for `GET /admin/thor/dropshipper/orders/:id` */
|
|
3928
|
+
interface GetDropshipperOrderDetailResponse {
|
|
3929
|
+
order: DropshipperOrderDetail;
|
|
3930
|
+
}
|
|
3931
|
+
/** A line item in a manual order creation */
|
|
3932
|
+
interface CreateOrderItem {
|
|
3933
|
+
variant_id: string;
|
|
3934
|
+
quantity: number;
|
|
3935
|
+
}
|
|
3936
|
+
/** Body for `POST /admin/thor/dropshipper/orders` */
|
|
3937
|
+
interface CreateDropshipperOrderBody {
|
|
3938
|
+
customer_id: string;
|
|
3939
|
+
currency_code: string;
|
|
3940
|
+
items: CreateOrderItem[];
|
|
3941
|
+
shipping_address: DropshipperOrderShippingAddress & {
|
|
3942
|
+
phone?: string;
|
|
3943
|
+
};
|
|
3944
|
+
shipping_method_id?: string;
|
|
3945
|
+
notes?: string;
|
|
3946
|
+
}
|
|
3947
|
+
/** Response for `POST /admin/thor/dropshipper/orders` */
|
|
3948
|
+
interface CreateDropshipperOrderResponse {
|
|
3949
|
+
order: {
|
|
3950
|
+
id: string;
|
|
3951
|
+
display_id: number;
|
|
3952
|
+
status: string;
|
|
3953
|
+
total: number;
|
|
3954
|
+
profit: number;
|
|
3955
|
+
created_at: string;
|
|
3956
|
+
};
|
|
3957
|
+
}
|
|
3958
|
+
/** Body for `POST /admin/thor/dropshipper/orders/:id/set-payment-collector` */
|
|
3959
|
+
interface SetPaymentCollectorBody {
|
|
3960
|
+
payment_collected_by: 'dropshipper' | 'provider';
|
|
3961
|
+
}
|
|
3962
|
+
/** Response for `POST /admin/thor/dropshipper/orders/:id/set-payment-collector` */
|
|
3963
|
+
interface SetPaymentCollectorResponse {
|
|
3964
|
+
order_id: string;
|
|
3965
|
+
payment_collected_by: 'dropshipper' | 'provider';
|
|
3966
|
+
updated_at: string;
|
|
3967
|
+
}
|
|
3968
|
+
/** Response for `POST /admin/thor/dropshipper/orders/:id/cancel` */
|
|
3969
|
+
interface CancelDropshipperOrderResponse {
|
|
3970
|
+
order: {
|
|
3971
|
+
id: string;
|
|
3972
|
+
status: string;
|
|
3973
|
+
[key: string]: unknown;
|
|
3974
|
+
};
|
|
3975
|
+
}
|
|
3976
|
+
/** Body for `POST /admin/thor/dropshipper/orders/:id/edits` */
|
|
3977
|
+
interface CreateOrderEditBody {
|
|
3978
|
+
internal_note?: string;
|
|
3979
|
+
}
|
|
3980
|
+
/** Response for `POST /admin/thor/dropshipper/orders/:id/edits` */
|
|
3981
|
+
interface CreateOrderEditResponse {
|
|
3982
|
+
order_edit: {
|
|
3983
|
+
id: string;
|
|
3984
|
+
order_id: string;
|
|
3985
|
+
status: string;
|
|
3986
|
+
[key: string]: unknown;
|
|
3987
|
+
};
|
|
3988
|
+
}
|
|
3989
|
+
/** Body for `POST /admin/thor/dropshipper/orders/:id/edits/:edit_id/items` */
|
|
3990
|
+
interface AddOrderEditItemBody {
|
|
3991
|
+
variant_id: string;
|
|
3992
|
+
quantity: number;
|
|
3993
|
+
unit_price?: number;
|
|
3994
|
+
}
|
|
3995
|
+
/** Response for `POST /admin/thor/dropshipper/orders/:id/edits/:edit_id/items` */
|
|
3996
|
+
interface AddOrderEditItemResponse {
|
|
3997
|
+
order_edit: {
|
|
3998
|
+
id: string;
|
|
3999
|
+
[key: string]: unknown;
|
|
4000
|
+
};
|
|
4001
|
+
}
|
|
4002
|
+
/** Response for `POST /admin/thor/dropshipper/orders/:id/edits/:edit_id/confirm` */
|
|
4003
|
+
interface ConfirmOrderEditResponse {
|
|
4004
|
+
order: {
|
|
4005
|
+
id: string;
|
|
4006
|
+
[key: string]: unknown;
|
|
4007
|
+
};
|
|
4008
|
+
}
|
|
4009
|
+
/** A dropshipper custom category node */
|
|
4010
|
+
interface DropshipperCategory {
|
|
4011
|
+
id: string;
|
|
4012
|
+
name: string;
|
|
4013
|
+
handle: string;
|
|
4014
|
+
description?: string | null;
|
|
4015
|
+
position: number;
|
|
4016
|
+
parent_id: string | null;
|
|
4017
|
+
sales_channel_id?: string;
|
|
4018
|
+
products_count?: number;
|
|
4019
|
+
children?: DropshipperCategory[];
|
|
4020
|
+
created_at?: string;
|
|
4021
|
+
updated_at?: string;
|
|
4022
|
+
}
|
|
4023
|
+
/** Options for `GET /admin/thor/dropshipper/categories` */
|
|
4024
|
+
interface GetDropshipperCategoriesOptions {
|
|
4025
|
+
parent_id?: string;
|
|
4026
|
+
include_children?: boolean;
|
|
4027
|
+
}
|
|
4028
|
+
/** Response for `GET /admin/thor/dropshipper/categories` */
|
|
4029
|
+
interface GetDropshipperCategoriesResponse {
|
|
4030
|
+
categories: DropshipperCategory[];
|
|
4031
|
+
}
|
|
4032
|
+
/** Body for `POST /admin/thor/dropshipper/categories` */
|
|
4033
|
+
interface CreateDropshipperCategoryBody {
|
|
4034
|
+
name: string;
|
|
4035
|
+
/** Auto-generated from name if omitted. Must be unique within the channel. */
|
|
4036
|
+
handle?: string;
|
|
4037
|
+
description?: string;
|
|
4038
|
+
parent_id?: string | null;
|
|
4039
|
+
position?: number;
|
|
4040
|
+
}
|
|
4041
|
+
/** Body for `PUT /admin/thor/dropshipper/categories/:id` */
|
|
4042
|
+
interface UpdateDropshipperCategoryBody {
|
|
4043
|
+
name?: string;
|
|
4044
|
+
description?: string;
|
|
4045
|
+
handle?: string;
|
|
4046
|
+
parent_id?: string | null;
|
|
4047
|
+
position?: number;
|
|
4048
|
+
}
|
|
4049
|
+
/** Response for `DELETE /admin/thor/dropshipper/categories/:id` */
|
|
4050
|
+
interface DeleteDropshipperCategoryResponse {
|
|
4051
|
+
deleted: true;
|
|
4052
|
+
id: string;
|
|
4053
|
+
/** Number of products unmapped from the deleted category */
|
|
4054
|
+
unmapped_products: number;
|
|
4055
|
+
}
|
|
4056
|
+
/** Body for `POST /admin/thor/dropshipper/category-mappings` */
|
|
4057
|
+
interface CreateCategoryMappingBody {
|
|
4058
|
+
category_id: string;
|
|
4059
|
+
product_id: string;
|
|
4060
|
+
}
|
|
4061
|
+
/** Response for `POST /admin/thor/dropshipper/category-mappings` */
|
|
4062
|
+
interface CreateCategoryMappingResponse {
|
|
4063
|
+
mapping: {
|
|
4064
|
+
id: string;
|
|
4065
|
+
category_id: string;
|
|
4066
|
+
product_id: string;
|
|
4067
|
+
created_at: string;
|
|
4068
|
+
};
|
|
4069
|
+
}
|
|
4070
|
+
/** Response for `DELETE /admin/thor/dropshipper/category-mappings/:id` */
|
|
4071
|
+
interface DeleteCategoryMappingResponse {
|
|
4072
|
+
deleted: true;
|
|
4073
|
+
id: string;
|
|
4074
|
+
}
|
|
4075
|
+
/** A customer as seen by the dropshipper (list view) */
|
|
4076
|
+
interface DropshipperCustomer {
|
|
4077
|
+
id: string;
|
|
4078
|
+
first_name: string | null;
|
|
4079
|
+
last_name: string | null;
|
|
4080
|
+
email: string;
|
|
4081
|
+
phone: string | null;
|
|
4082
|
+
created_at: string;
|
|
4083
|
+
total_orders: number;
|
|
4084
|
+
total_spent: number;
|
|
4085
|
+
currency_code: string;
|
|
4086
|
+
last_order_at: string | null;
|
|
4087
|
+
}
|
|
4088
|
+
/** Stats on a customer as seen by the dropshipper */
|
|
4089
|
+
interface DropshipperCustomerStats {
|
|
4090
|
+
total_orders: number;
|
|
4091
|
+
total_spent: number;
|
|
4092
|
+
total_profit_generated: number;
|
|
4093
|
+
avg_order_value: number;
|
|
4094
|
+
currency_code: string;
|
|
4095
|
+
first_order_at: string | null;
|
|
4096
|
+
last_order_at: string | null;
|
|
4097
|
+
}
|
|
4098
|
+
/** Slim order reference for customer detail */
|
|
4099
|
+
interface DropshipperCustomerOrderRef {
|
|
4100
|
+
id: string;
|
|
4101
|
+
display_id: number;
|
|
4102
|
+
status: string;
|
|
4103
|
+
total: number;
|
|
4104
|
+
created_at: string;
|
|
4105
|
+
}
|
|
4106
|
+
/** Full customer detail as seen by the dropshipper */
|
|
4107
|
+
interface DropshipperCustomerDetail {
|
|
4108
|
+
id: string;
|
|
4109
|
+
first_name: string | null;
|
|
4110
|
+
last_name: string | null;
|
|
4111
|
+
email: string;
|
|
4112
|
+
phone: string | null;
|
|
4113
|
+
created_at: string;
|
|
4114
|
+
default_shipping_address?: DropshipperOrderShippingAddress | null;
|
|
4115
|
+
stats: DropshipperCustomerStats;
|
|
4116
|
+
recent_orders: DropshipperCustomerOrderRef[];
|
|
4117
|
+
}
|
|
4118
|
+
/** Options for `GET /admin/thor/dropshipper/customers` */
|
|
4119
|
+
interface GetDropshipperCustomersOptions {
|
|
4120
|
+
q?: string;
|
|
4121
|
+
has_orders?: boolean;
|
|
4122
|
+
from?: string;
|
|
4123
|
+
limit?: number;
|
|
4124
|
+
offset?: number;
|
|
4125
|
+
}
|
|
4126
|
+
/** Response for `GET /admin/thor/dropshipper/customers` */
|
|
4127
|
+
interface GetDropshipperCustomersResponse {
|
|
4128
|
+
customers: DropshipperCustomer[];
|
|
4129
|
+
count: number;
|
|
4130
|
+
offset: number;
|
|
4131
|
+
limit: number;
|
|
4132
|
+
}
|
|
4133
|
+
/** Response for `GET /admin/thor/dropshipper/customers/:id` */
|
|
4134
|
+
interface GetDropshipperCustomerDetailResponse {
|
|
4135
|
+
customer: DropshipperCustomerDetail;
|
|
4136
|
+
}
|
|
4137
|
+
/** Body for `POST /admin/thor/dropshipper/customers` */
|
|
4138
|
+
interface CreateDropshipperCustomerBody {
|
|
4139
|
+
first_name?: string;
|
|
4140
|
+
last_name?: string;
|
|
4141
|
+
email: string;
|
|
4142
|
+
phone?: string;
|
|
4143
|
+
password: string;
|
|
4144
|
+
shipping_address?: {
|
|
4145
|
+
address_1?: string;
|
|
4146
|
+
city?: string;
|
|
4147
|
+
province?: string;
|
|
4148
|
+
postal_code?: string;
|
|
4149
|
+
country_code?: string;
|
|
4150
|
+
};
|
|
4151
|
+
}
|
|
4152
|
+
/** Response for `POST /admin/thor/dropshipper/customers` */
|
|
4153
|
+
interface CreateDropshipperCustomerResponse {
|
|
4154
|
+
customer: {
|
|
4155
|
+
id: string;
|
|
4156
|
+
email: string;
|
|
4157
|
+
first_name: string | null;
|
|
4158
|
+
last_name: string | null;
|
|
4159
|
+
sales_channel_id: string;
|
|
4160
|
+
created_at: string;
|
|
4161
|
+
};
|
|
4162
|
+
}
|
|
4163
|
+
/** Balance breakdown for a dropshipper account */
|
|
4164
|
+
interface DropshipperBalance {
|
|
4165
|
+
/** Sum of cost_price × qty for delivered orders where Y collected payment. Unsettled. */
|
|
4166
|
+
payable_to_provider: number;
|
|
4167
|
+
/** Sum of profit for delivered orders where X collected payment (COD). Unsettled. */
|
|
4168
|
+
receivable_from_provider: number;
|
|
4169
|
+
/** receivable - payable. Negative = Y owes X; positive = X owes Y. */
|
|
4170
|
+
net_balance: number;
|
|
4171
|
+
net_balance_label: string;
|
|
4172
|
+
}
|
|
4173
|
+
/** Pending order counts for a balance summary */
|
|
4174
|
+
interface DropshipperPendingOrders {
|
|
4175
|
+
payable_count: number;
|
|
4176
|
+
payable_total: number;
|
|
4177
|
+
receivable_count: number;
|
|
4178
|
+
receivable_total: number;
|
|
4179
|
+
}
|
|
4180
|
+
/** Full account record as returned by `GET /admin/thor/dropshipper/account` */
|
|
4181
|
+
interface DropshipperAccount {
|
|
4182
|
+
id: string;
|
|
4183
|
+
provider_name: string;
|
|
4184
|
+
currency_code: string;
|
|
4185
|
+
payment_terms_days: number;
|
|
4186
|
+
balance: DropshipperBalance;
|
|
4187
|
+
pending_orders: DropshipperPendingOrders;
|
|
4188
|
+
}
|
|
4189
|
+
/** Response for `GET /admin/thor/dropshipper/account` */
|
|
4190
|
+
interface GetDropshipperAccountResponse {
|
|
4191
|
+
account: DropshipperAccount;
|
|
4192
|
+
}
|
|
4193
|
+
/** A payable order row */
|
|
4194
|
+
interface DropshipperPayableOrder {
|
|
4195
|
+
id: string;
|
|
4196
|
+
display_id: number;
|
|
4197
|
+
fulfilled_at: string;
|
|
4198
|
+
due_date: string;
|
|
4199
|
+
customer_name: string;
|
|
4200
|
+
sale_total: number;
|
|
4201
|
+
cost_total: number;
|
|
4202
|
+
amount_payable: number;
|
|
4203
|
+
days_overdue: number;
|
|
4204
|
+
}
|
|
4205
|
+
/** Response for `GET /admin/thor/dropshipper/account/payable` */
|
|
4206
|
+
interface GetDropshipperPayableResponse {
|
|
4207
|
+
orders: DropshipperPayableOrder[];
|
|
4208
|
+
total_payable: number;
|
|
4209
|
+
count: number;
|
|
4210
|
+
offset: number;
|
|
4211
|
+
limit: number;
|
|
4212
|
+
}
|
|
4213
|
+
/** A receivable order row */
|
|
4214
|
+
interface DropshipperReceivableOrder {
|
|
4215
|
+
id: string;
|
|
4216
|
+
display_id: number;
|
|
4217
|
+
fulfilled_at: string;
|
|
4218
|
+
customer_name: string;
|
|
4219
|
+
sale_total: number;
|
|
4220
|
+
cost_total: number;
|
|
4221
|
+
commission_amount: number;
|
|
4222
|
+
}
|
|
4223
|
+
/** Response for `GET /admin/thor/dropshipper/account/receivable` */
|
|
4224
|
+
interface GetDropshipperReceivableResponse {
|
|
4225
|
+
orders: DropshipperReceivableOrder[];
|
|
4226
|
+
total_receivable: number;
|
|
4227
|
+
count: number;
|
|
4228
|
+
offset: number;
|
|
4229
|
+
limit: number;
|
|
4230
|
+
}
|
|
4231
|
+
/** A settlement record */
|
|
4232
|
+
interface SettlementRecord {
|
|
4233
|
+
id: string;
|
|
4234
|
+
type: 'payment_to_provider' | 'commission_from_provider';
|
|
4235
|
+
amount: number;
|
|
4236
|
+
order_ids_count?: number;
|
|
4237
|
+
status: 'pending' | 'confirmed' | 'cancelled';
|
|
4238
|
+
notes?: string | null;
|
|
4239
|
+
created_at: string;
|
|
4240
|
+
settled_at: string | null;
|
|
4241
|
+
confirmed_by: string | null;
|
|
4242
|
+
account?: DropshipperAccountRef;
|
|
4243
|
+
orders?: Array<{
|
|
4244
|
+
id: string;
|
|
4245
|
+
display_id: number;
|
|
4246
|
+
fulfilled_at: string;
|
|
4247
|
+
cost_total: number;
|
|
4248
|
+
}>;
|
|
4249
|
+
}
|
|
4250
|
+
/** Options for listing settlements */
|
|
4251
|
+
interface GetSettlementsOptions {
|
|
4252
|
+
status?: 'pending' | 'confirmed' | 'cancelled';
|
|
4253
|
+
type?: 'payment_to_provider' | 'commission_from_provider';
|
|
4254
|
+
account_id?: string;
|
|
4255
|
+
limit?: number;
|
|
4256
|
+
offset?: number;
|
|
4257
|
+
}
|
|
4258
|
+
/** Response for `GET /admin/thor/dropshipper/settlements` */
|
|
4259
|
+
interface GetSettlementsResponse {
|
|
4260
|
+
settlements: SettlementRecord[];
|
|
4261
|
+
count: number;
|
|
4262
|
+
offset: number;
|
|
4263
|
+
limit: number;
|
|
4264
|
+
}
|
|
4265
|
+
/** Response for `GET /admin/thor/dropshipper/settlements/:id` */
|
|
4266
|
+
interface GetSettlementDetailResponse {
|
|
4267
|
+
settlement: SettlementRecord;
|
|
4268
|
+
}
|
|
4269
|
+
/** Body for `POST /admin/thor/dropshipper/admin/settlements` (Solo X) */
|
|
4270
|
+
interface CreateSettlementBody {
|
|
4271
|
+
account_id: string;
|
|
4272
|
+
type: 'payment_to_provider' | 'commission_from_provider';
|
|
4273
|
+
order_ids: string[];
|
|
4274
|
+
amount: number;
|
|
4275
|
+
notes?: string;
|
|
4276
|
+
}
|
|
4277
|
+
/** Response for `POST /admin/thor/dropshipper/admin/settlements` */
|
|
4278
|
+
interface CreateSettlementResponse {
|
|
4279
|
+
settlement: SettlementRecord;
|
|
4280
|
+
}
|
|
4281
|
+
/** Body for `POST /admin/thor/dropshipper/admin/settlements/:id/confirm` */
|
|
4282
|
+
interface ConfirmSettlementBody {
|
|
4283
|
+
notes?: string;
|
|
4284
|
+
}
|
|
4285
|
+
/** Body for `POST /admin/thor/dropshipper/admin/settlements/:id/cancel` */
|
|
4286
|
+
interface CancelSettlementBody {
|
|
4287
|
+
reason?: string;
|
|
4288
|
+
}
|
|
4289
|
+
/** Response for confirm/cancel settlement */
|
|
4290
|
+
interface UpdateSettlementStatusResponse {
|
|
4291
|
+
settlement: SettlementRecord;
|
|
4292
|
+
}
|
|
4293
|
+
/** Full account record with channel info as seen by X */
|
|
4294
|
+
interface AdminDropshipperAccount {
|
|
4295
|
+
id: string;
|
|
4296
|
+
provider_name: string;
|
|
4297
|
+
provider_email?: string;
|
|
4298
|
+
sales_channel_id: string;
|
|
4299
|
+
sales_channel_name: string;
|
|
4300
|
+
currency_code: string;
|
|
4301
|
+
payment_terms_days: number;
|
|
4302
|
+
created_at?: string;
|
|
4303
|
+
}
|
|
4304
|
+
/** Response for `GET /admin/thor/dropshipper/admin/accounts` */
|
|
4305
|
+
interface GetAdminDropshipperAccountsResponse {
|
|
4306
|
+
accounts: AdminDropshipperAccount[];
|
|
4307
|
+
}
|
|
4308
|
+
/** Extended balance for admin view of a specific account */
|
|
4309
|
+
interface AdminDropshipperBalance extends DropshipperBalance {
|
|
4310
|
+
payable_count: number;
|
|
4311
|
+
payable_order_ids: string[];
|
|
4312
|
+
payable_orders: DropshipperPayableOrder[];
|
|
4313
|
+
receivable_count: number;
|
|
4314
|
+
receivable_order_ids: string[];
|
|
4315
|
+
receivable_orders: DropshipperReceivableOrder[];
|
|
4316
|
+
unclassified_orders: number;
|
|
4317
|
+
}
|
|
4318
|
+
/** Response for `GET /admin/thor/dropshipper/admin/accounts/:id/balance` */
|
|
4319
|
+
interface GetAdminAccountBalanceResponse {
|
|
4320
|
+
account: Pick<AdminDropshipperAccount, 'id' | 'provider_name' | 'currency_code' | 'payment_terms_days' | 'sales_channel_id'>;
|
|
4321
|
+
balance: AdminDropshipperBalance;
|
|
4322
|
+
}
|
|
4323
|
+
/** Response for `GET /admin/thor/dropshipper/admin/price-lists` */
|
|
4324
|
+
interface GetAdminPriceListsResponse {
|
|
4325
|
+
price_lists: Array<{
|
|
4326
|
+
id: string;
|
|
4327
|
+
sales_channel_id: string;
|
|
4328
|
+
sales_channel_name: string;
|
|
4329
|
+
provider_name: string;
|
|
4330
|
+
}>;
|
|
4331
|
+
}
|
|
4332
|
+
/** Response for `GET /admin/thor/dropshipper/admin/user-channel` */
|
|
4333
|
+
interface GetUserChannelResponse {
|
|
4334
|
+
links: Array<{
|
|
4335
|
+
sales_channel_id: string;
|
|
4336
|
+
}>;
|
|
4337
|
+
}
|
|
4338
|
+
/** A dropshipper promotion record */
|
|
4339
|
+
interface DropshipperPromotion {
|
|
4340
|
+
id: string;
|
|
4341
|
+
code: string;
|
|
4342
|
+
/** Maps to application_method.type */
|
|
4343
|
+
type: 'percentage' | 'fixed';
|
|
4344
|
+
value: number;
|
|
4345
|
+
status: 'active' | 'inactive' | string;
|
|
4346
|
+
usage_limit: number | null;
|
|
4347
|
+
usage_count: number;
|
|
4348
|
+
starts_at: string | null;
|
|
4349
|
+
ends_at: string | null;
|
|
4350
|
+
target_type?: 'order' | 'items';
|
|
4351
|
+
min_amount?: number | null;
|
|
4352
|
+
currency_code?: string;
|
|
4353
|
+
}
|
|
4354
|
+
/** Options for `GET /admin/thor/dropshipper/promotions` */
|
|
4355
|
+
interface GetDropshipperPromotionsOptions {
|
|
4356
|
+
type?: 'percentage' | 'fixed';
|
|
4357
|
+
limit?: number;
|
|
4358
|
+
offset?: number;
|
|
4359
|
+
}
|
|
4360
|
+
/** Response for `GET /admin/thor/dropshipper/promotions` */
|
|
4361
|
+
interface GetDropshipperPromotionsResponse {
|
|
4362
|
+
promotions: DropshipperPromotion[];
|
|
4363
|
+
count: number;
|
|
4364
|
+
offset: number;
|
|
4365
|
+
limit: number;
|
|
4366
|
+
}
|
|
4367
|
+
/** An additional targeting rule for a promotion */
|
|
4368
|
+
interface PromotionRule {
|
|
4369
|
+
attribute: string;
|
|
4370
|
+
operator: string;
|
|
4371
|
+
values: string[];
|
|
4372
|
+
}
|
|
4373
|
+
/** Body for `POST /admin/thor/dropshipper/promotions` */
|
|
4374
|
+
interface CreateDropshipperPromotionBody {
|
|
4375
|
+
code: string;
|
|
4376
|
+
type: 'percentage' | 'fixed';
|
|
4377
|
+
value: number;
|
|
4378
|
+
currency_code?: string;
|
|
4379
|
+
target_type?: 'order' | 'items';
|
|
4380
|
+
allocation?: 'each' | 'across';
|
|
4381
|
+
usage_limit?: number | null;
|
|
4382
|
+
starts_at?: string | null;
|
|
4383
|
+
ends_at?: string | null;
|
|
4384
|
+
rules?: PromotionRule[];
|
|
4385
|
+
}
|
|
4386
|
+
/** Body for `PUT /admin/thor/dropshipper/promotions/:id` */
|
|
4387
|
+
interface UpdateDropshipperPromotionBody {
|
|
4388
|
+
value?: number;
|
|
4389
|
+
ends_at?: string | null;
|
|
4390
|
+
usage_limit?: number | null;
|
|
4391
|
+
}
|
|
4392
|
+
/** Response for `DELETE /admin/thor/dropshipper/promotions/:id` */
|
|
4393
|
+
interface DeleteDropshipperPromotionResponse {
|
|
4394
|
+
deleted: true;
|
|
4395
|
+
id: string;
|
|
4396
|
+
}
|
|
4397
|
+
/** Options for `GET /admin/thor/dropshipper/dashboard/stats` */
|
|
4398
|
+
interface GetDashboardStatsOptions {
|
|
4399
|
+
period?: '7d' | '30d' | '90d' | 'custom';
|
|
4400
|
+
/** Required when period = "custom" */
|
|
4401
|
+
from?: string;
|
|
4402
|
+
/** Required when period = "custom" */
|
|
4403
|
+
to?: string;
|
|
4404
|
+
currency_code?: string;
|
|
4405
|
+
}
|
|
4406
|
+
/** Core period metrics */
|
|
4407
|
+
interface DashboardPeriodMetrics {
|
|
4408
|
+
orders_count: number;
|
|
4409
|
+
revenue_total: number;
|
|
4410
|
+
profit_total: number;
|
|
4411
|
+
avg_margin_percent: number;
|
|
4412
|
+
avg_order_value: number;
|
|
4413
|
+
customers_active?: number;
|
|
4414
|
+
customers_new?: number;
|
|
4415
|
+
currency_code: string;
|
|
4416
|
+
}
|
|
4417
|
+
/** Percentage changes vs. previous period */
|
|
4418
|
+
interface DashboardChanges {
|
|
4419
|
+
orders_count_pct: number;
|
|
4420
|
+
revenue_total_pct: number;
|
|
4421
|
+
profit_total_pct: number;
|
|
4422
|
+
avg_margin_percent_pct: number;
|
|
4423
|
+
}
|
|
4424
|
+
/** Top product row by profit */
|
|
4425
|
+
interface DashboardTopProduct {
|
|
4426
|
+
product_id: string;
|
|
4427
|
+
product_title: string;
|
|
4428
|
+
variant_id: string;
|
|
4429
|
+
variant_title: string;
|
|
4430
|
+
units_sold: number;
|
|
4431
|
+
revenue: number;
|
|
4432
|
+
profit: number;
|
|
4433
|
+
margin_percent: number;
|
|
4434
|
+
thumbnail: string | null;
|
|
4435
|
+
}
|
|
4436
|
+
/** Full dashboard stats response */
|
|
4437
|
+
interface DashboardStats {
|
|
4438
|
+
period: {
|
|
4439
|
+
from: string;
|
|
4440
|
+
to: string;
|
|
4441
|
+
label: string;
|
|
4442
|
+
};
|
|
4443
|
+
current: DashboardPeriodMetrics;
|
|
4444
|
+
previous: DashboardPeriodMetrics;
|
|
4445
|
+
changes: DashboardChanges;
|
|
4446
|
+
orders_by_status: Record<string, number>;
|
|
4447
|
+
settlement_summary: DropshipperBalance & {
|
|
4448
|
+
pending_settlement_records: number;
|
|
4449
|
+
currency_code: string;
|
|
4450
|
+
};
|
|
4451
|
+
recent_orders: Array<{
|
|
4452
|
+
id: string;
|
|
4453
|
+
display_id: number;
|
|
4454
|
+
customer_name: string;
|
|
4455
|
+
total: number;
|
|
4456
|
+
profit: number;
|
|
4457
|
+
status: string;
|
|
4458
|
+
created_at: string;
|
|
4459
|
+
}>;
|
|
4460
|
+
top_products_by_profit: DashboardTopProduct[];
|
|
4461
|
+
}
|
|
4462
|
+
/** Response for `GET /admin/thor/dropshipper/dashboard/stats` */
|
|
4463
|
+
interface GetDashboardStatsResponse {
|
|
4464
|
+
stats?: DashboardStats;
|
|
4465
|
+
[key: string]: unknown;
|
|
4466
|
+
}
|
|
4467
|
+
/** A note attached to an order */
|
|
4468
|
+
interface OrderNote {
|
|
4469
|
+
id: string;
|
|
4470
|
+
order_id: string;
|
|
4471
|
+
author_id: string;
|
|
4472
|
+
text: string;
|
|
4473
|
+
created_at: string;
|
|
4474
|
+
}
|
|
4475
|
+
/** Body for `POST /admin/thor/dropshipper/orders/:id/notes` */
|
|
4476
|
+
interface CreateOrderNoteBody {
|
|
4477
|
+
text: string;
|
|
4478
|
+
}
|
|
4479
|
+
/** Response for `GET /admin/thor/dropshipper/orders/:id/notes` */
|
|
4480
|
+
interface GetOrderNotesResponse {
|
|
4481
|
+
notes: OrderNote[];
|
|
4482
|
+
}
|
|
4483
|
+
/** Response for `DELETE /admin/thor/dropshipper/orders/:id/notes/:note_id` */
|
|
4484
|
+
interface DeleteOrderNoteResponse {
|
|
4485
|
+
id: string;
|
|
4486
|
+
deleted: boolean;
|
|
4487
|
+
}
|
|
4488
|
+
/** Body for creating/updating a dropshipper address */
|
|
4489
|
+
interface DropshipperAddressBody {
|
|
4490
|
+
first_name: string;
|
|
4491
|
+
last_name: string;
|
|
4492
|
+
company?: string;
|
|
4493
|
+
address_1: string;
|
|
4494
|
+
address_2?: string;
|
|
4495
|
+
city: string;
|
|
4496
|
+
province?: string;
|
|
4497
|
+
postal_code: string;
|
|
4498
|
+
country_code: string;
|
|
4499
|
+
phone?: string;
|
|
4500
|
+
is_default?: boolean;
|
|
4501
|
+
}
|
|
4502
|
+
/** Response for creating a dropshipper address */
|
|
4503
|
+
interface DropshipperAddressResponse {
|
|
4504
|
+
address: Address & {
|
|
4505
|
+
sales_channel_id: string;
|
|
4506
|
+
};
|
|
4507
|
+
}
|
|
4508
|
+
/** Response for getting dropshipper addresses for a channel */
|
|
4509
|
+
interface GetDropshipperAddressesResponse {
|
|
4510
|
+
addresses: Array<Address & {
|
|
4511
|
+
sales_channel_id: string;
|
|
4512
|
+
}>;
|
|
4513
|
+
}
|
|
4514
|
+
/** Response for `GET /store/thor/dropshipper-categories` */
|
|
4515
|
+
interface GetStorefrontDropshipperCategoriesResponse {
|
|
4516
|
+
categories: DropshipperCategory[];
|
|
4517
|
+
}
|
|
4518
|
+
|
|
4519
|
+
export { type AccountDropdownConfig, type AccountMenuItem, type ActiveFilter, type AddOrderEditItemBody, type AddOrderEditItemResponse, type Address, type AdminApiKey, type AdminChannelCategory, type AdminChannelCustomer, type AdminDropshipperAccount, type AdminDropshipperBalance, type AdminProduct, type AdminProductVariant, type AdminSalesChannelRef, type AdminSiteConfig, type AdminSiteConfigHistoryEntry, type AdminSiteConfigHistoryEntryFull, type AdminStorefrontConfig, type AdminStorefrontSeoDefaults, type AdminUser, type AdvancedSearchProductsOptions, type AssignCategoriesToChannelsBody, type AssignCategoriesToChannelsResponse, type AssignCollectionsToChannelsBody, type AssignCollectionsToChannelsResponse, type AuditLog, type AuditLogAdapter, type AuthConfig, type AuthMethod, type AuthProvider, type AuthResponse, type AuthStorage, type AuthorConfig, type BackendCapabilities, type BatchVariantCostItem, type BatchVariantCostsBody, type BatchVariantCostsResponse, type BrandConfig, type CachedPaymentMethods, type CancelDropshipperOrderResponse, type CancelSettlementBody, type Cart, type CartCost, type CartItem, type CartLineInput, type CartLineUpdate, type CartProduct, type ChartDataPoint, type Collection, type CollectionProductsOptions, type CommerceProvider, type CompareProduct, type ConfigHistoryEntry, type ConfirmOrderEditResponse, type ConfirmSettlementBody, type Connection, type Country, type CreateAddressData, type CreateCategoryMappingBody, type CreateCategoryMappingResponse, type CreateDropshipperCategoryBody, type CreateDropshipperCustomerBody, type CreateDropshipperCustomerResponse, type CreateDropshipperOrderBody, type CreateDropshipperOrderResponse, type CreateDropshipperPromotionBody, type CreateOrderEditBody, type CreateOrderEditResponse, type CreateOrderItem, type CreateOrderNoteBody, type CreateSettlementBody, type CreateSettlementResponse, type CreateVariantCostBody, type CreateVariantCostResponse, type Customer, type DashboardChanges, type DashboardConfig, type DashboardMetrics, type DashboardMetricsAdapter, type DashboardOrdersAdapter, type DashboardPeriodMetrics, type DashboardProductsAdapter, type DashboardStats, type DashboardTopProduct, type DeleteCategoryMappingResponse, type DeleteDropshipperCategoryResponse, type DeleteDropshipperPromotionResponse, type DeleteOrderNoteResponse, type DeleteVariantCostResponse, type DesignerConfig, type DesignerHistoryEntry, type DesignerNavItem, type DesignerThemeConfig, type DesignerThemePreset, type DiscountCode, type DropshipperAccount, type DropshipperAccountRef, type DropshipperAddressBody, type DropshipperAddressResponse, type DropshipperBalance, type DropshipperCategory, type DropshipperCustomer, type DropshipperCustomerDetail, type DropshipperCustomerOrderRef, type DropshipperCustomerStats, type DropshipperOrder, type DropshipperOrderCustomer, type DropshipperOrderDetail, type DropshipperOrderItem, type DropshipperOrderShippingAddress, type DropshipperOrderTimelineEvent, type DropshipperOrderTotals, type DropshipperPayableOrder, type DropshipperPendingOrders, type DropshipperPriceItem, type DropshipperProduct, type DropshipperPromotion, type DropshipperReceivableOrder, type DropshipperVariant, type DynamicSource, type Edge, type FilterConfig, type FilterOption, type FilterSection, type FulfillmentOption, type FulfillmentSet, type FulfillmentStatus, type GetAdminAccountBalanceResponse, type GetAdminDropshipperAccountsResponse, type GetAdminPriceListsResponse, type GetAdminSiteConfigHistoryOptions, type GetAdminSiteConfigHistoryResponse, type GetAdminSiteConfigResponse, type GetAdminStorefrontConfigResponse, type GetCategoriesCallback, type GetCategoriesOptions, type GetCategorySalesChannelsResponse, type GetChannelApiKeysResponse, type GetChannelCategoriesOptions, type GetChannelCategoriesResponse, type GetChannelCustomersOptions, type GetChannelCustomersResponse, type GetCollectionSalesChannelsResponse, type GetCollectionsOptions, type GetCustomersCallback, type GetCustomersOptions, type GetDashboardStatsOptions, type GetDashboardStatsResponse, type GetDropshipperAccountResponse, type GetDropshipperAddressesResponse, type GetDropshipperCategoriesOptions, type GetDropshipperCategoriesResponse, type GetDropshipperCustomerDetailResponse, type GetDropshipperCustomersOptions, type GetDropshipperCustomersResponse, type GetDropshipperOrderDetailResponse, type GetDropshipperOrdersOptions, type GetDropshipperOrdersResponse, type GetDropshipperPayableResponse, type GetDropshipperProductsOptions, type GetDropshipperProductsResponse, type GetDropshipperPromotionsOptions, type GetDropshipperPromotionsResponse, type GetDropshipperReceivableResponse, type GetOrderNotesResponse, type GetOrdersCallback, type GetOrdersOptions, type GetProductsOptions, type GetSettlementDetailResponse, type GetSettlementsOptions, type GetSettlementsResponse, type GetStorefrontDropshipperCategoriesResponse, type GetUserChannelResponse, type GetVariantCostsOptions, type GetVariantCostsResponse, type HeaderLinkItem, type HeaderNavigationConfig, type IconConfig, type Image, type InventoryLevel, type LinkCustomerToChannelResponse, type LoginCredentials, type ModulesConfig, type Money, type NavigationCalloutItem, type NavigationItem, type NavigationLinkItem, type OnboardDropshipperBody, type OnboardDropshipperResponse, type Order, type OrderItem, type OrderNote, type OrderStatus, type OrdersMetrics, PROVIDER_METADATA, type PaginationOptions, type PasswordResetConfirm, type PasswordResetRequest, type PaymentMethod, type PaymentMethodFeatures, type PaymentMethodType, type PaymentMethodsOptions, type PaymentStatus, type PriceRange, type Product, type ProductCategory, type ProductOption, type ProductPreview, type ProductVariant, type ProductsMetrics, type PromotionRule, type ProviderConfig, type ProviderTypeString, type Region, type RegisterData, type RestoreSiteConfigResponse, type Review, type SEO, type SalesMetrics, type SearchBarConfig, type SearchResultMeta, type SelectedOption, type SetPaymentCollectorBody, type SetPaymentCollectorResponse, type SettlementRecord, type ShippingMethod, type SiteConfig, type SiteConfigLabels, type SiteConfigMetadata, type SocialConfig, type SortOption, type SortOptions, type StockLocation, type StockStatus, type StockValidation, type StorefrontConfig, StorefrontConfigError, type StorefrontContext, type StorefrontPlatformType, type StorefrontSeoDefaults, SupportedProviderType, type UnassignCategoriesFromChannelsBody, type UnassignCategoriesFromChannelsResponse, type UnassignCollectionsFromChannelsBody, type UnassignCollectionsFromChannelsResponse, type UpdateCustomerData, type UpdateDropshipperCategoryBody, type UpdateDropshipperPricesBody, type UpdateDropshipperPricesResponse, type UpdateDropshipperPromotionBody, type UpdateSettlementStatusResponse, type UpdateSiteConfigBody, type UpdateSiteConfigResponse, type UpdateStorefrontConfigBody, type UpdateStorefrontConfigResponse, type VariantCost, getProviderMetadata, isSupportedProviderType };
|