@spree/next 0.1.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/LICENSE +58 -0
- package/dist/actions/addresses.d.ts +26 -0
- package/dist/actions/addresses.js +157 -0
- package/dist/actions/addresses.js.map +1 -0
- package/dist/actions/auth.d.ts +48 -0
- package/dist/actions/auth.js +215 -0
- package/dist/actions/auth.js.map +1 -0
- package/dist/actions/cart.d.ts +39 -0
- package/dist/actions/cart.js +170 -0
- package/dist/actions/cart.js.map +1 -0
- package/dist/actions/checkout.d.ts +49 -0
- package/dist/actions/checkout.js +146 -0
- package/dist/actions/checkout.js.map +1 -0
- package/dist/actions/credit-cards.d.ts +14 -0
- package/dist/actions/credit-cards.js +135 -0
- package/dist/actions/credit-cards.js.map +1 -0
- package/dist/actions/gift-cards.d.ts +14 -0
- package/dist/actions/gift-cards.js +131 -0
- package/dist/actions/gift-cards.js.map +1 -0
- package/dist/actions/orders.d.ts +12 -0
- package/dist/actions/orders.js +131 -0
- package/dist/actions/orders.js.map +1 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.js +40 -0
- package/dist/config.js.map +1 -0
- package/dist/data/countries.d.ts +15 -0
- package/dist/data/countries.js +42 -0
- package/dist/data/countries.js.map +1 -0
- package/dist/data/products.d.ts +19 -0
- package/dist/data/products.js +48 -0
- package/dist/data/products.js.map +1 -0
- package/dist/data/store.d.ts +9 -0
- package/dist/data/store.js +36 -0
- package/dist/data/store.js.map +1 -0
- package/dist/data/taxonomies.d.ts +13 -0
- package/dist/data/taxonomies.js +42 -0
- package/dist/data/taxonomies.js.map +1 -0
- package/dist/data/taxons.d.ts +17 -0
- package/dist/data/taxons.js +48 -0
- package/dist/data/taxons.js.map +1 -0
- package/dist/index.d.ts +192 -0
- package/dist/index.js +506 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config.ts","../../src/data/taxonomies.ts"],"names":[],"mappings":";;;AAGA,IAAI,OAAA,GAA8B,IAAA;AAQ3B,SAAS,cAAc,MAAA,EAA+B;AAE3D,EAAA,OAAA,GAAU,iBAAA,CAAkB;AAAA,IAC1B,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,QAAQ,MAAA,CAAO;AAAA,GAChB,CAAA;AACH;AAMO,SAAS,SAAA,GAAyB;AACvC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,OAAA,GAAU,QAAQ,GAAA,CAAI,aAAA;AAC5B,IAAA,MAAM,MAAA,GAAS,QAAQ,GAAA,CAAI,aAAA;AAC3B,IAAA,IAAI,WAAW,MAAA,EAAQ;AACrB,MAAA,aAAA,CAAc,EAAE,OAAA,EAAS,MAAA,EAAQ,CAAA;AAAA,IACnC,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT;;;AC7BA,eAAsB,cAAA,CACpB,QACA,OAAA,EAC2C;AAC3C,EAAA,OAAO,SAAA,EAAU,CAAE,UAAA,CAAW,IAAA,CAAK,MAAA,EAAQ;AAAA,IACzC,QAAQ,OAAA,EAAS,MAAA;AAAA,IACjB,UAAU,OAAA,EAAS;AAAA,GACpB,CAAA;AACH;AAKA,eAAsB,WAAA,CACpB,EAAA,EACA,MAAA,EACA,OAAA,EACwB;AACxB,EAAA,OAAO,SAAA,EAAU,CAAE,UAAA,CAAW,GAAA,CAAI,IAAI,MAAA,EAAQ;AAAA,IAC5C,QAAQ,OAAA,EAAS,MAAA;AAAA,IACjB,UAAU,OAAA,EAAS;AAAA,GACpB,CAAA;AACH","file":"taxonomies.js","sourcesContent":["import { createSpreeClient, type SpreeClient } from '@spree/sdk';\nimport type { SpreeNextConfig } from './types';\n\nlet _client: SpreeClient | null = null;\nlet _config: SpreeNextConfig | null = null;\n\n/**\n * Initialize the Spree Next.js integration.\n * Call this once in your app (e.g., in `lib/storefront.ts`).\n * If not called, the client will auto-initialize from SPREE_API_URL and SPREE_API_KEY env vars.\n */\nexport function initSpreeNext(config: SpreeNextConfig): void {\n _config = config;\n _client = createSpreeClient({\n baseUrl: config.baseUrl,\n apiKey: config.apiKey,\n });\n}\n\n/**\n * Get the SpreeClient instance. Auto-initializes from env vars if needed.\n * @internal\n */\nexport function getClient(): SpreeClient {\n if (!_client) {\n const baseUrl = process.env.SPREE_API_URL;\n const apiKey = process.env.SPREE_API_KEY;\n if (baseUrl && apiKey) {\n initSpreeNext({ baseUrl, apiKey });\n } else {\n throw new Error(\n '@spree/next is not configured. Either call initSpreeNext() or set SPREE_API_URL and SPREE_API_KEY environment variables.'\n );\n }\n }\n return _client!;\n}\n\n/**\n * Get the current config. Auto-initializes from env vars if needed.\n * @internal\n */\nexport function getConfig(): SpreeNextConfig {\n if (!_config) {\n getClient(); // triggers auto-init\n }\n return _config!;\n}\n\n/**\n * Reset the client (useful for testing).\n * @internal\n */\nexport function resetClient(): void {\n _client = null;\n _config = null;\n}\n","import type { StoreTaxonomy, PaginatedResponse } from '@spree/sdk';\nimport { getClient } from '../config';\nimport type { SpreeNextOptions } from '../types';\n\n/**\n * List taxonomies with optional filtering and pagination.\n */\nexport async function listTaxonomies(\n params?: Record<string, unknown>,\n options?: SpreeNextOptions\n): Promise<PaginatedResponse<StoreTaxonomy>> {\n return getClient().taxonomies.list(params, {\n locale: options?.locale,\n currency: options?.currency,\n });\n}\n\n/**\n * Get a single taxonomy by ID.\n */\nexport async function getTaxonomy(\n id: string,\n params?: Record<string, unknown>,\n options?: SpreeNextOptions\n): Promise<StoreTaxonomy> {\n return getClient().taxonomies.get(id, params, {\n locale: options?.locale,\n currency: options?.currency,\n });\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StoreTaxon, PaginatedResponse, StoreProduct } from '@spree/sdk';
|
|
2
|
+
import { SpreeNextOptions } from '../types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* List taxons (categories) with optional filtering and pagination.
|
|
6
|
+
*/
|
|
7
|
+
declare function listTaxons(params?: Record<string, unknown>, options?: SpreeNextOptions): Promise<PaginatedResponse<StoreTaxon>>;
|
|
8
|
+
/**
|
|
9
|
+
* Get a single taxon by ID or permalink.
|
|
10
|
+
*/
|
|
11
|
+
declare function getTaxon(idOrPermalink: string, params?: Record<string, unknown>, options?: SpreeNextOptions): Promise<StoreTaxon>;
|
|
12
|
+
/**
|
|
13
|
+
* List products within a taxon.
|
|
14
|
+
*/
|
|
15
|
+
declare function listTaxonProducts(taxonId: string, params?: Record<string, unknown>, options?: SpreeNextOptions): Promise<PaginatedResponse<StoreProduct>>;
|
|
16
|
+
|
|
17
|
+
export { getTaxon, listTaxonProducts, listTaxons };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createSpreeClient } from '@spree/sdk';
|
|
2
|
+
|
|
3
|
+
// src/config.ts
|
|
4
|
+
var _client = null;
|
|
5
|
+
function initSpreeNext(config) {
|
|
6
|
+
_client = createSpreeClient({
|
|
7
|
+
baseUrl: config.baseUrl,
|
|
8
|
+
apiKey: config.apiKey
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function getClient() {
|
|
12
|
+
if (!_client) {
|
|
13
|
+
const baseUrl = process.env.SPREE_API_URL;
|
|
14
|
+
const apiKey = process.env.SPREE_API_KEY;
|
|
15
|
+
if (baseUrl && apiKey) {
|
|
16
|
+
initSpreeNext({ baseUrl, apiKey });
|
|
17
|
+
} else {
|
|
18
|
+
throw new Error(
|
|
19
|
+
"@spree/next is not configured. Either call initSpreeNext() or set SPREE_API_URL and SPREE_API_KEY environment variables."
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return _client;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/data/taxons.ts
|
|
27
|
+
async function listTaxons(params, options) {
|
|
28
|
+
return getClient().taxons.list(params, {
|
|
29
|
+
locale: options?.locale,
|
|
30
|
+
currency: options?.currency
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async function getTaxon(idOrPermalink, params, options) {
|
|
34
|
+
return getClient().taxons.get(idOrPermalink, params, {
|
|
35
|
+
locale: options?.locale,
|
|
36
|
+
currency: options?.currency
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function listTaxonProducts(taxonId, params, options) {
|
|
40
|
+
return getClient().taxons.products.list(taxonId, params, {
|
|
41
|
+
locale: options?.locale,
|
|
42
|
+
currency: options?.currency
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { getTaxon, listTaxonProducts, listTaxons };
|
|
47
|
+
//# sourceMappingURL=taxons.js.map
|
|
48
|
+
//# sourceMappingURL=taxons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config.ts","../../src/data/taxons.ts"],"names":[],"mappings":";;;AAGA,IAAI,OAAA,GAA8B,IAAA;AAQ3B,SAAS,cAAc,MAAA,EAA+B;AAE3D,EAAA,OAAA,GAAU,iBAAA,CAAkB;AAAA,IAC1B,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,QAAQ,MAAA,CAAO;AAAA,GAChB,CAAA;AACH;AAMO,SAAS,SAAA,GAAyB;AACvC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,OAAA,GAAU,QAAQ,GAAA,CAAI,aAAA;AAC5B,IAAA,MAAM,MAAA,GAAS,QAAQ,GAAA,CAAI,aAAA;AAC3B,IAAA,IAAI,WAAW,MAAA,EAAQ;AACrB,MAAA,aAAA,CAAc,EAAE,OAAA,EAAS,MAAA,EAAQ,CAAA;AAAA,IACnC,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT;;;AC7BA,eAAsB,UAAA,CACpB,QACA,OAAA,EACwC;AACxC,EAAA,OAAO,SAAA,EAAU,CAAE,MAAA,CAAO,IAAA,CAAK,MAAA,EAAQ;AAAA,IACrC,QAAQ,OAAA,EAAS,MAAA;AAAA,IACjB,UAAU,OAAA,EAAS;AAAA,GACpB,CAAA;AACH;AAKA,eAAsB,QAAA,CACpB,aAAA,EACA,MAAA,EACA,OAAA,EACqB;AACrB,EAAA,OAAO,SAAA,EAAU,CAAE,MAAA,CAAO,GAAA,CAAI,eAAe,MAAA,EAAQ;AAAA,IACnD,QAAQ,OAAA,EAAS,MAAA;AAAA,IACjB,UAAU,OAAA,EAAS;AAAA,GACpB,CAAA;AACH;AAKA,eAAsB,iBAAA,CACpB,OAAA,EACA,MAAA,EACA,OAAA,EAC0C;AAC1C,EAAA,OAAO,WAAU,CAAE,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,SAAS,MAAA,EAAQ;AAAA,IACvD,QAAQ,OAAA,EAAS,MAAA;AAAA,IACjB,UAAU,OAAA,EAAS;AAAA,GACpB,CAAA;AACH","file":"taxons.js","sourcesContent":["import { createSpreeClient, type SpreeClient } from '@spree/sdk';\nimport type { SpreeNextConfig } from './types';\n\nlet _client: SpreeClient | null = null;\nlet _config: SpreeNextConfig | null = null;\n\n/**\n * Initialize the Spree Next.js integration.\n * Call this once in your app (e.g., in `lib/storefront.ts`).\n * If not called, the client will auto-initialize from SPREE_API_URL and SPREE_API_KEY env vars.\n */\nexport function initSpreeNext(config: SpreeNextConfig): void {\n _config = config;\n _client = createSpreeClient({\n baseUrl: config.baseUrl,\n apiKey: config.apiKey,\n });\n}\n\n/**\n * Get the SpreeClient instance. Auto-initializes from env vars if needed.\n * @internal\n */\nexport function getClient(): SpreeClient {\n if (!_client) {\n const baseUrl = process.env.SPREE_API_URL;\n const apiKey = process.env.SPREE_API_KEY;\n if (baseUrl && apiKey) {\n initSpreeNext({ baseUrl, apiKey });\n } else {\n throw new Error(\n '@spree/next is not configured. Either call initSpreeNext() or set SPREE_API_URL and SPREE_API_KEY environment variables.'\n );\n }\n }\n return _client!;\n}\n\n/**\n * Get the current config. Auto-initializes from env vars if needed.\n * @internal\n */\nexport function getConfig(): SpreeNextConfig {\n if (!_config) {\n getClient(); // triggers auto-init\n }\n return _config!;\n}\n\n/**\n * Reset the client (useful for testing).\n * @internal\n */\nexport function resetClient(): void {\n _client = null;\n _config = null;\n}\n","import type { StoreTaxon, StoreProduct, PaginatedResponse } from '@spree/sdk';\nimport { getClient } from '../config';\nimport type { SpreeNextOptions } from '../types';\n\n/**\n * List taxons (categories) with optional filtering and pagination.\n */\nexport async function listTaxons(\n params?: Record<string, unknown>,\n options?: SpreeNextOptions\n): Promise<PaginatedResponse<StoreTaxon>> {\n return getClient().taxons.list(params, {\n locale: options?.locale,\n currency: options?.currency,\n });\n}\n\n/**\n * Get a single taxon by ID or permalink.\n */\nexport async function getTaxon(\n idOrPermalink: string,\n params?: Record<string, unknown>,\n options?: SpreeNextOptions\n): Promise<StoreTaxon> {\n return getClient().taxons.get(idOrPermalink, params, {\n locale: options?.locale,\n currency: options?.currency,\n });\n}\n\n/**\n * List products within a taxon.\n */\nexport async function listTaxonProducts(\n taxonId: string,\n params?: Record<string, unknown>,\n options?: SpreeNextOptions\n): Promise<PaginatedResponse<StoreProduct>> {\n return getClient().taxons.products.list(taxonId, params, {\n locale: options?.locale,\n currency: options?.currency,\n });\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export { getClient, initSpreeNext } from './config.js';
|
|
2
|
+
export { SpreeNextConfig, SpreeNextOptions } from './types.js';
|
|
3
|
+
export { getProduct, getProductFilters, listProducts } from './data/products.js';
|
|
4
|
+
export { getTaxon, listTaxonProducts, listTaxons } from './data/taxons.js';
|
|
5
|
+
export { getTaxonomy, listTaxonomies } from './data/taxonomies.js';
|
|
6
|
+
export { getStore } from './data/store.js';
|
|
7
|
+
export { getCountry, listCountries } from './data/countries.js';
|
|
8
|
+
import { StoreLineItem, StoreOrder, StoreShipment, AddressParams, StoreUser, StoreAddress, PaginatedResponse, StoreCreditCard, StoreGiftCard } from '@spree/sdk';
|
|
9
|
+
export { AddressParams, PaginatedResponse, ProductFiltersResponse, SpreeError, StoreAddress, StoreCountry, StoreCreditCard, StoreGiftCard, StoreImage, StoreLineItem, StoreOptionType, StoreOptionValue, StoreOrder, StoreOrderPromotion, StorePayment, StorePaymentMethod, StorePrice, StoreProduct, StoreShipment, StoreShippingRate, StoreStore, StoreTaxon, StoreTaxonomy, StoreUser, StoreVariant } from '@spree/sdk';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get the current cart. Returns null if no cart exists.
|
|
13
|
+
*/
|
|
14
|
+
declare function getCart(): Promise<(StoreOrder & {
|
|
15
|
+
token: string;
|
|
16
|
+
}) | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Get existing cart or create a new one.
|
|
19
|
+
*/
|
|
20
|
+
declare function getOrCreateCart(): Promise<StoreOrder & {
|
|
21
|
+
token: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Add an item to the cart. Creates a cart if none exists.
|
|
25
|
+
*/
|
|
26
|
+
declare function addItem(variantId: string, quantity?: number): Promise<StoreLineItem>;
|
|
27
|
+
/**
|
|
28
|
+
* Update a line item quantity in the cart.
|
|
29
|
+
*/
|
|
30
|
+
declare function updateItem(lineItemId: string, quantity: number): Promise<StoreLineItem>;
|
|
31
|
+
/**
|
|
32
|
+
* Remove a line item from the cart.
|
|
33
|
+
*/
|
|
34
|
+
declare function removeItem(lineItemId: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Clear the cart (abandons the current cart).
|
|
37
|
+
*/
|
|
38
|
+
declare function clearCart(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Associate a guest cart with the currently authenticated user.
|
|
41
|
+
* Call this after login/register when the user has an existing guest cart.
|
|
42
|
+
*/
|
|
43
|
+
declare function associateCart(): Promise<(StoreOrder & {
|
|
44
|
+
token: string;
|
|
45
|
+
}) | null>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the current checkout order state.
|
|
49
|
+
* Includes line_items, shipments, and addresses by default.
|
|
50
|
+
*/
|
|
51
|
+
declare function getCheckout(orderId: string): Promise<StoreOrder>;
|
|
52
|
+
/**
|
|
53
|
+
* Update shipping and/or billing addresses on the order.
|
|
54
|
+
*/
|
|
55
|
+
declare function updateAddresses(orderId: string, params: {
|
|
56
|
+
email?: string;
|
|
57
|
+
ship_address?: AddressParams;
|
|
58
|
+
bill_address?: AddressParams;
|
|
59
|
+
ship_address_id?: string;
|
|
60
|
+
bill_address_id?: string;
|
|
61
|
+
}): Promise<StoreOrder>;
|
|
62
|
+
/**
|
|
63
|
+
* Advance the checkout to the next step.
|
|
64
|
+
*/
|
|
65
|
+
declare function advance(orderId: string): Promise<StoreOrder>;
|
|
66
|
+
/**
|
|
67
|
+
* Move the checkout to the next step (alias for advance).
|
|
68
|
+
*/
|
|
69
|
+
declare function next(orderId: string): Promise<StoreOrder>;
|
|
70
|
+
/**
|
|
71
|
+
* Get shipments for the order (includes available shipping rates).
|
|
72
|
+
*/
|
|
73
|
+
declare function getShipments(orderId: string): Promise<{
|
|
74
|
+
data: StoreShipment[];
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Select a shipping rate for a shipment.
|
|
78
|
+
*/
|
|
79
|
+
declare function selectShippingRate(orderId: string, shipmentId: string, shippingRateId: string): Promise<StoreShipment>;
|
|
80
|
+
/**
|
|
81
|
+
* Apply a coupon code to the order.
|
|
82
|
+
*/
|
|
83
|
+
declare function applyCoupon(orderId: string, code: string): Promise<StoreOrder>;
|
|
84
|
+
/**
|
|
85
|
+
* Remove a coupon/promotion from the order.
|
|
86
|
+
*/
|
|
87
|
+
declare function removeCoupon(orderId: string, promotionId: string): Promise<StoreOrder>;
|
|
88
|
+
/**
|
|
89
|
+
* Complete the checkout and place the order.
|
|
90
|
+
*/
|
|
91
|
+
declare function complete(orderId: string): Promise<StoreOrder>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Login with email and password.
|
|
95
|
+
* Automatically associates any guest cart with the authenticated user.
|
|
96
|
+
*/
|
|
97
|
+
declare function login(email: string, password: string): Promise<{
|
|
98
|
+
success: boolean;
|
|
99
|
+
user?: {
|
|
100
|
+
id: string;
|
|
101
|
+
email: string;
|
|
102
|
+
first_name?: string | null;
|
|
103
|
+
last_name?: string | null;
|
|
104
|
+
};
|
|
105
|
+
error?: string;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Register a new customer account.
|
|
109
|
+
* Automatically associates any guest cart with the new account.
|
|
110
|
+
*/
|
|
111
|
+
declare function register(email: string, password: string, passwordConfirmation: string): Promise<{
|
|
112
|
+
success: boolean;
|
|
113
|
+
user?: {
|
|
114
|
+
id: string;
|
|
115
|
+
email: string;
|
|
116
|
+
first_name?: string | null;
|
|
117
|
+
last_name?: string | null;
|
|
118
|
+
};
|
|
119
|
+
error?: string;
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* Logout the current user.
|
|
123
|
+
*/
|
|
124
|
+
declare function logout(): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Get the currently authenticated customer. Returns null if not logged in.
|
|
127
|
+
*/
|
|
128
|
+
declare function getCustomer(): Promise<StoreUser | null>;
|
|
129
|
+
/**
|
|
130
|
+
* Update the current customer's profile.
|
|
131
|
+
*/
|
|
132
|
+
declare function updateCustomer(data: {
|
|
133
|
+
first_name?: string;
|
|
134
|
+
last_name?: string;
|
|
135
|
+
email?: string;
|
|
136
|
+
}): Promise<StoreUser>;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* List the authenticated customer's addresses.
|
|
140
|
+
*/
|
|
141
|
+
declare function listAddresses(): Promise<{
|
|
142
|
+
data: StoreAddress[];
|
|
143
|
+
}>;
|
|
144
|
+
/**
|
|
145
|
+
* Get a single address by ID.
|
|
146
|
+
*/
|
|
147
|
+
declare function getAddress(id: string): Promise<StoreAddress>;
|
|
148
|
+
/**
|
|
149
|
+
* Create a new address for the customer.
|
|
150
|
+
*/
|
|
151
|
+
declare function createAddress(params: AddressParams): Promise<StoreAddress>;
|
|
152
|
+
/**
|
|
153
|
+
* Update an existing address.
|
|
154
|
+
*/
|
|
155
|
+
declare function updateAddress(id: string, params: Partial<AddressParams>): Promise<StoreAddress>;
|
|
156
|
+
/**
|
|
157
|
+
* Delete an address.
|
|
158
|
+
*/
|
|
159
|
+
declare function deleteAddress(id: string): Promise<void>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* List the authenticated customer's orders.
|
|
163
|
+
*/
|
|
164
|
+
declare function listOrders(params?: Record<string, unknown>): Promise<PaginatedResponse<StoreOrder>>;
|
|
165
|
+
/**
|
|
166
|
+
* Get a single order by ID or number.
|
|
167
|
+
*/
|
|
168
|
+
declare function getOrder(idOrNumber: string, params?: Record<string, unknown>): Promise<StoreOrder>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* List the authenticated customer's credit cards.
|
|
172
|
+
*/
|
|
173
|
+
declare function listCreditCards(): Promise<{
|
|
174
|
+
data: StoreCreditCard[];
|
|
175
|
+
}>;
|
|
176
|
+
/**
|
|
177
|
+
* Delete a credit card.
|
|
178
|
+
*/
|
|
179
|
+
declare function deleteCreditCard(id: string): Promise<void>;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* List the authenticated customer's gift cards.
|
|
183
|
+
*/
|
|
184
|
+
declare function listGiftCards(): Promise<{
|
|
185
|
+
data: StoreGiftCard[];
|
|
186
|
+
}>;
|
|
187
|
+
/**
|
|
188
|
+
* Get a single gift card by ID.
|
|
189
|
+
*/
|
|
190
|
+
declare function getGiftCard(id: string): Promise<StoreGiftCard>;
|
|
191
|
+
|
|
192
|
+
export { addItem, advance, applyCoupon, associateCart, clearCart, complete, createAddress, deleteAddress, deleteCreditCard, getAddress, getCart, getCheckout, getCustomer, getGiftCard, getOrCreateCart, getOrder, getShipments, listAddresses, listCreditCards, listGiftCards, listOrders, login, logout, next, register, removeCoupon, removeItem, selectShippingRate, updateAddress, updateAddresses, updateCustomer, updateItem };
|