@thorprovider/types 3.3.0 → 3.4.1
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 +10 -0
- package/dist/index.d.mts +925 -17
- package/dist/index.d.ts +925 -17
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/admin/DropshippingAdmin.ts +995 -0
- package/src/admin/index.ts +1 -0
- package/src/auth.ts +28 -15
- package/src/commerce-provider.ts +42 -0
- package/src/index.ts +106 -1
- package/src/provider.ts +57 -1
package/src/admin/index.ts
CHANGED
package/src/auth.ts
CHANGED
|
@@ -233,22 +233,35 @@ export interface AuthProvider {
|
|
|
233
233
|
* Only implemented if capabilities.deleteAccount is true.
|
|
234
234
|
*/
|
|
235
235
|
deleteCustomerAccount(): Promise<void>;
|
|
236
|
-
|
|
236
|
+
|
|
237
237
|
// ========================================
|
|
238
|
-
//
|
|
238
|
+
// Address Management
|
|
239
239
|
// ========================================
|
|
240
|
-
|
|
240
|
+
|
|
241
241
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* @returns
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
242
|
+
* Get customer addresses
|
|
243
|
+
* @returns List of customer addresses
|
|
244
|
+
*/
|
|
245
|
+
getAddresses(): Promise<Address[]>;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Create new address for current customer
|
|
249
|
+
* @param data - Address data
|
|
250
|
+
* @returns Created address
|
|
251
|
+
*/
|
|
252
|
+
createAddress(data: CreateAddressData): Promise<Address>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Update customer address
|
|
256
|
+
* @param addressId - Address ID
|
|
257
|
+
* @param data - Fields to update
|
|
258
|
+
* @returns Updated address
|
|
259
|
+
*/
|
|
260
|
+
updateAddress(addressId: string, data: Partial<CreateAddressData>): Promise<Address>;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Delete customer address
|
|
264
|
+
* @param addressId - Address ID
|
|
265
|
+
*/
|
|
266
|
+
deleteAddress(addressId: string): Promise<void>;
|
|
254
267
|
}
|
package/src/commerce-provider.ts
CHANGED
|
@@ -740,6 +740,48 @@ export interface CommerceProvider {
|
|
|
740
740
|
* ```
|
|
741
741
|
*/
|
|
742
742
|
updateBillingAddress?(cartId: string, address: Address): Promise<Cart>;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Update the shipping address on a cart.
|
|
746
|
+
*
|
|
747
|
+
* Sets the customer's delivery address and email before proceeding to
|
|
748
|
+
* shipping method and payment selection.
|
|
749
|
+
*
|
|
750
|
+
* @param cartId - Cart ID
|
|
751
|
+
* @param address - Shipping address and contact details
|
|
752
|
+
* @throws {ProviderAPIError} If cart not found or address is invalid
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```typescript
|
|
756
|
+
* await commerce.updateShippingAddress(cartId, {
|
|
757
|
+
* email: 'customer@example.com',
|
|
758
|
+
* firstName: 'Jane',
|
|
759
|
+
* lastName: 'Doe',
|
|
760
|
+
* address1: '123 Main St',
|
|
761
|
+
* city: 'Madrid',
|
|
762
|
+
* province: 'Madrid',
|
|
763
|
+
* postalCode: '28001',
|
|
764
|
+
* countryCode: 'ES',
|
|
765
|
+
* phone: '+34 600 000 000',
|
|
766
|
+
* });
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
updateShippingAddress?(
|
|
770
|
+
cartId: string,
|
|
771
|
+
address: {
|
|
772
|
+
email: string;
|
|
773
|
+
firstName: string;
|
|
774
|
+
lastName: string;
|
|
775
|
+
address1: string;
|
|
776
|
+
address2?: string;
|
|
777
|
+
company?: string;
|
|
778
|
+
city: string;
|
|
779
|
+
province: string;
|
|
780
|
+
postalCode: string;
|
|
781
|
+
countryCode: string;
|
|
782
|
+
phone: string;
|
|
783
|
+
},
|
|
784
|
+
): Promise<void>;
|
|
743
785
|
|
|
744
786
|
// ============================================ // Customer Operations (Optional)
|
|
745
787
|
// ============================================
|
package/src/index.ts
CHANGED
|
@@ -261,7 +261,112 @@ export type {
|
|
|
261
261
|
GetAdminSiteConfigHistoryOptions,
|
|
262
262
|
RestoreSiteConfigResponse,
|
|
263
263
|
LinkCustomerToChannelResponse,
|
|
264
|
-
|
|
264
|
+
// Dropshipping types
|
|
265
|
+
DropshipperAccountRef,
|
|
266
|
+
OnboardDropshipperBody,
|
|
267
|
+
OnboardDropshipperResponse,
|
|
268
|
+
VariantCost,
|
|
269
|
+
GetVariantCostsOptions,
|
|
270
|
+
GetVariantCostsResponse,
|
|
271
|
+
CreateVariantCostBody,
|
|
272
|
+
CreateVariantCostResponse,
|
|
273
|
+
BatchVariantCostItem,
|
|
274
|
+
BatchVariantCostsBody,
|
|
275
|
+
BatchVariantCostsResponse,
|
|
276
|
+
DeleteVariantCostResponse,
|
|
277
|
+
DropshipperVariant,
|
|
278
|
+
DropshipperProduct,
|
|
279
|
+
GetDropshipperProductsOptions,
|
|
280
|
+
GetDropshipperProductsResponse,
|
|
281
|
+
DropshipperPriceItem,
|
|
282
|
+
UpdateDropshipperPricesBody,
|
|
283
|
+
UpdateDropshipperPricesResponse,
|
|
284
|
+
DropshipperOrderCustomer,
|
|
285
|
+
DropshipperOrder,
|
|
286
|
+
GetDropshipperOrdersOptions,
|
|
287
|
+
GetDropshipperOrdersResponse,
|
|
288
|
+
DropshipperOrderShippingAddress,
|
|
289
|
+
DropshipperOrderItem,
|
|
290
|
+
DropshipperOrderTotals,
|
|
291
|
+
DropshipperOrderTimelineEvent,
|
|
292
|
+
DropshipperOrderDetail,
|
|
293
|
+
GetDropshipperOrderDetailResponse,
|
|
294
|
+
CreateOrderItem,
|
|
295
|
+
CreateDropshipperOrderBody,
|
|
296
|
+
CreateDropshipperOrderResponse,
|
|
297
|
+
SetPaymentCollectorBody,
|
|
298
|
+
SetPaymentCollectorResponse,
|
|
299
|
+
DropshipperCategory,
|
|
300
|
+
GetDropshipperCategoriesOptions,
|
|
301
|
+
GetDropshipperCategoriesResponse,
|
|
302
|
+
CreateDropshipperCategoryBody,
|
|
303
|
+
UpdateDropshipperCategoryBody,
|
|
304
|
+
DeleteDropshipperCategoryResponse,
|
|
305
|
+
CreateCategoryMappingBody,
|
|
306
|
+
CreateCategoryMappingResponse,
|
|
307
|
+
DeleteCategoryMappingResponse,
|
|
308
|
+
DropshipperCustomer,
|
|
309
|
+
DropshipperCustomerStats,
|
|
310
|
+
DropshipperCustomerOrderRef,
|
|
311
|
+
DropshipperCustomerDetail,
|
|
312
|
+
GetDropshipperCustomersOptions,
|
|
313
|
+
GetDropshipperCustomersResponse,
|
|
314
|
+
GetDropshipperCustomerDetailResponse,
|
|
315
|
+
CreateDropshipperCustomerBody,
|
|
316
|
+
CreateDropshipperCustomerResponse,
|
|
317
|
+
DropshipperBalance,
|
|
318
|
+
DropshipperPendingOrders,
|
|
319
|
+
DropshipperAccount,
|
|
320
|
+
GetDropshipperAccountResponse,
|
|
321
|
+
DropshipperPayableOrder,
|
|
322
|
+
GetDropshipperPayableResponse,
|
|
323
|
+
DropshipperReceivableOrder,
|
|
324
|
+
GetDropshipperReceivableResponse,
|
|
325
|
+
SettlementRecord,
|
|
326
|
+
GetSettlementsOptions,
|
|
327
|
+
GetSettlementsResponse,
|
|
328
|
+
GetSettlementDetailResponse,
|
|
329
|
+
CreateSettlementBody,
|
|
330
|
+
CreateSettlementResponse,
|
|
331
|
+
ConfirmSettlementBody,
|
|
332
|
+
CancelSettlementBody,
|
|
333
|
+
UpdateSettlementStatusResponse,
|
|
334
|
+
AdminDropshipperAccount,
|
|
335
|
+
AdminDropshipperBalance,
|
|
336
|
+
GetAdminDropshipperAccountsResponse,
|
|
337
|
+
GetAdminAccountBalanceResponse,
|
|
338
|
+
GetAdminPriceListsResponse,
|
|
339
|
+
GetUserChannelResponse,
|
|
340
|
+
DropshipperPromotion,
|
|
341
|
+
GetDropshipperPromotionsOptions,
|
|
342
|
+
GetDropshipperPromotionsResponse,
|
|
343
|
+
PromotionRule,
|
|
344
|
+
CreateDropshipperPromotionBody,
|
|
345
|
+
UpdateDropshipperPromotionBody,
|
|
346
|
+
DeleteDropshipperPromotionResponse,
|
|
347
|
+
GetDashboardStatsOptions,
|
|
348
|
+
DashboardPeriodMetrics,
|
|
349
|
+
DashboardChanges,
|
|
350
|
+
DashboardTopProduct,
|
|
351
|
+
DashboardStats,
|
|
352
|
+
GetDashboardStatsResponse,
|
|
353
|
+
GetStorefrontDropshipperCategoriesResponse,
|
|
354
|
+
OrderNote,
|
|
355
|
+
CreateOrderNoteBody,
|
|
356
|
+
GetOrderNotesResponse,
|
|
357
|
+
DeleteOrderNoteResponse,
|
|
358
|
+
// Order cancel and edits
|
|
359
|
+
CancelDropshipperOrderResponse,
|
|
360
|
+
CreateOrderEditBody,
|
|
361
|
+
CreateOrderEditResponse,
|
|
362
|
+
AddOrderEditItemBody,
|
|
363
|
+
AddOrderEditItemResponse,
|
|
364
|
+
ConfirmOrderEditResponse,
|
|
365
|
+
// Dropshipper addresses (channel-scoped)
|
|
366
|
+
DropshipperAddressBody,
|
|
367
|
+
DropshipperAddressResponse,
|
|
368
|
+
GetDropshipperAddressesResponse,
|
|
369
|
+
} from './admin';
|
|
265
370
|
|
|
266
371
|
// ============================================
|
|
267
372
|
// Header Configuration Types
|
package/src/provider.ts
CHANGED
|
@@ -36,6 +36,11 @@ export enum SupportedProviderType {
|
|
|
36
36
|
Mock = 'mock',
|
|
37
37
|
Medusa = 'medusa',
|
|
38
38
|
StelOrder = 'stelorder',
|
|
39
|
+
Shopify = 'shopify',
|
|
40
|
+
BigCommerce = 'bigcommerce',
|
|
41
|
+
WooCommerce = 'woocommerce',
|
|
42
|
+
Spree = 'spree',
|
|
43
|
+
Magento = 'magento',
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/**
|
|
@@ -49,7 +54,7 @@ export enum SupportedProviderType {
|
|
|
49
54
|
* }
|
|
50
55
|
* ```
|
|
51
56
|
*/
|
|
52
|
-
export type ProviderTypeString = 'mock' | 'medusa' | 'stelorder';
|
|
57
|
+
export type ProviderTypeString = 'mock' | 'medusa' | 'stelorder' | 'shopify' | 'bigcommerce' | 'woocommerce' | 'spree' | 'magento';
|
|
53
58
|
|
|
54
59
|
/**
|
|
55
60
|
* Metadata about each provider.
|
|
@@ -95,6 +100,57 @@ export const PROVIDER_METADATA: Record<
|
|
|
95
100
|
],
|
|
96
101
|
maxRetries: 2,
|
|
97
102
|
},
|
|
103
|
+
shopify: {
|
|
104
|
+
name: 'Shopify',
|
|
105
|
+
description: 'Shopify Storefront API (GraphQL)',
|
|
106
|
+
requiresStorefront: false,
|
|
107
|
+
requiredEnvVars: [
|
|
108
|
+
'NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN',
|
|
109
|
+
'NEXT_PUBLIC_SHOPIFY_STOREFRONT_TOKEN',
|
|
110
|
+
],
|
|
111
|
+
maxRetries: 3,
|
|
112
|
+
},
|
|
113
|
+
bigcommerce: {
|
|
114
|
+
name: 'BigCommerce',
|
|
115
|
+
description: 'BigCommerce REST Storefront API',
|
|
116
|
+
requiresStorefront: false,
|
|
117
|
+
requiredEnvVars: [
|
|
118
|
+
'BIGCOMMERCE_STORE_HASH',
|
|
119
|
+
'BIGCOMMERCE_STOREFRONT_API_TOKEN',
|
|
120
|
+
'BIGCOMMERCE_CHANNEL_ID',
|
|
121
|
+
],
|
|
122
|
+
maxRetries: 3,
|
|
123
|
+
},
|
|
124
|
+
woocommerce: {
|
|
125
|
+
name: 'WooCommerce',
|
|
126
|
+
description: 'WooCommerce Store API + REST API v3',
|
|
127
|
+
requiresStorefront: false,
|
|
128
|
+
requiredEnvVars: [
|
|
129
|
+
'WOOCOMMERCE_URL',
|
|
130
|
+
'WOOCOMMERCE_CONSUMER_KEY',
|
|
131
|
+
'WOOCOMMERCE_CONSUMER_SECRET',
|
|
132
|
+
],
|
|
133
|
+
maxRetries: 3,
|
|
134
|
+
},
|
|
135
|
+
spree: {
|
|
136
|
+
name: 'Spree Commerce',
|
|
137
|
+
description: 'Spree API v2 Storefront (JSON:API)',
|
|
138
|
+
requiresStorefront: false,
|
|
139
|
+
requiredEnvVars: [
|
|
140
|
+
'SPREE_API_URL',
|
|
141
|
+
],
|
|
142
|
+
maxRetries: 3,
|
|
143
|
+
},
|
|
144
|
+
magento: {
|
|
145
|
+
name: 'Adobe Commerce (Magento)',
|
|
146
|
+
description: 'Adobe Commerce GraphQL + REST API',
|
|
147
|
+
requiresStorefront: true,
|
|
148
|
+
requiredEnvVars: [
|
|
149
|
+
'MAGENTO_URL',
|
|
150
|
+
'MAGENTO_STORE_CODE',
|
|
151
|
+
],
|
|
152
|
+
maxRetries: 3,
|
|
153
|
+
},
|
|
98
154
|
};
|
|
99
155
|
|
|
100
156
|
/**
|