@spree/sdk 0.7.2 → 0.8.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 +16 -28
- package/dist/{index-7PDI-vuC.d.cts → index-7DYT6LIh.d.cts} +38 -52
- package/dist/{index-7PDI-vuC.d.ts → index-7DYT6LIh.d.ts} +38 -52
- package/dist/index.cjs +18 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -30
- package/dist/index.d.ts +19 -30
- package/dist/index.js +18 -32
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/zod/index.cjs +36 -47
- package/dist/zod/index.cjs.map +1 -1
- package/dist/zod/index.d.cts +5 -24
- package/dist/zod/index.d.ts +5 -24
- package/dist/zod/index.js +36 -46
- package/dist/zod/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ All Store API resources are available directly on the client:
|
|
|
58
58
|
client.products.list() // Products
|
|
59
59
|
client.cart.create() // Cart
|
|
60
60
|
client.orders.complete(id, opt) // Checkout
|
|
61
|
+
client.customers.create(params) // Registration
|
|
61
62
|
client.customer.get(opt) // Account
|
|
62
63
|
```
|
|
63
64
|
|
|
@@ -96,7 +97,7 @@ const newTokens = await client.auth.refresh({ token });
|
|
|
96
97
|
### 3. Register New Customer
|
|
97
98
|
|
|
98
99
|
```typescript
|
|
99
|
-
const { token, user } = await client.
|
|
100
|
+
const { token, user } = await client.customers.create({
|
|
100
101
|
email: 'new@example.com',
|
|
101
102
|
password: 'password123',
|
|
102
103
|
password_confirmation: 'password123',
|
|
@@ -149,7 +150,7 @@ const products = await client.products.list({
|
|
|
149
150
|
limit: 25,
|
|
150
151
|
name_cont: 'shirt',
|
|
151
152
|
sort: 'price asc',
|
|
152
|
-
expand: ['variants', 'images', '
|
|
153
|
+
expand: ['variants', 'images', 'categories'],
|
|
153
154
|
});
|
|
154
155
|
|
|
155
156
|
// Get single product by ID or slug
|
|
@@ -157,38 +158,27 @@ const product = await client.products.get('spree-tote', {
|
|
|
157
158
|
expand: ['variants', 'images'],
|
|
158
159
|
});
|
|
159
160
|
|
|
160
|
-
// Get available filters (price range, availability, options,
|
|
161
|
+
// Get available filters (price range, availability, options, categories)
|
|
161
162
|
const filters = await client.products.filters({
|
|
162
|
-
|
|
163
|
+
category_id: 'ctg_abc123', // Optional: scope filters to a category
|
|
163
164
|
});
|
|
164
165
|
```
|
|
165
166
|
|
|
166
|
-
### Categories
|
|
167
|
+
### Categories
|
|
167
168
|
|
|
168
169
|
```typescript
|
|
169
|
-
// List
|
|
170
|
-
const
|
|
171
|
-
expand: ['taxons'],
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
// Get taxonomy with taxons
|
|
175
|
-
const categories = await client.taxonomies.get('tax_123', {
|
|
176
|
-
expand: ['root', 'taxons'],
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// List taxons with filtering
|
|
180
|
-
const taxons = await client.taxons.list({
|
|
170
|
+
// List categories with filtering
|
|
171
|
+
const categories = await client.categories.list({
|
|
181
172
|
depth_eq: 1, // Top-level categories only
|
|
182
|
-
taxonomy_id_eq: '123', // Filter by taxonomy
|
|
183
173
|
});
|
|
184
174
|
|
|
185
|
-
// Get single
|
|
186
|
-
const
|
|
175
|
+
// Get single category by ID or permalink
|
|
176
|
+
const category = await client.categories.get('clothing/shirts', {
|
|
187
177
|
expand: ['ancestors', 'children'], // For breadcrumbs and subcategories
|
|
188
178
|
});
|
|
189
179
|
|
|
190
180
|
// List products in a category
|
|
191
|
-
const categoryProducts = await client.
|
|
181
|
+
const categoryProducts = await client.categories.products.list('clothing/shirts', {
|
|
192
182
|
page: 1,
|
|
193
183
|
limit: 12,
|
|
194
184
|
expand: ['images', 'default_variant'],
|
|
@@ -524,7 +514,7 @@ The SDK uses a resource builder pattern for nested resources:
|
|
|
524
514
|
| `customer` | `creditCards` | `list`, `get`, `delete` |
|
|
525
515
|
| `customer` | `giftCards` | `list`, `get` |
|
|
526
516
|
| `markets` | `countries` | `list`, `get` |
|
|
527
|
-
| `
|
|
517
|
+
| `categories` | `products` | `list` |
|
|
528
518
|
| `wishlists` | `items` | `create`, `update`, `delete` |
|
|
529
519
|
|
|
530
520
|
Example:
|
|
@@ -535,7 +525,7 @@ await client.orders.payments.list(orderId, options);
|
|
|
535
525
|
await client.orders.shipments.update(orderId, shipmentId, params, options);
|
|
536
526
|
await client.customer.addresses.list({}, options);
|
|
537
527
|
await client.markets.countries.list(marketId);
|
|
538
|
-
await client.
|
|
528
|
+
await client.categories.products.list(categoryId, params, options);
|
|
539
529
|
await client.wishlists.items.create(wishlistId, params, options);
|
|
540
530
|
```
|
|
541
531
|
|
|
@@ -604,8 +594,7 @@ import type {
|
|
|
604
594
|
StoreProduct,
|
|
605
595
|
StoreOrder,
|
|
606
596
|
StoreVariant,
|
|
607
|
-
|
|
608
|
-
StoreTaxonomy,
|
|
597
|
+
StoreCategory,
|
|
609
598
|
StoreLineItem,
|
|
610
599
|
StoreAddress,
|
|
611
600
|
StoreCustomer,
|
|
@@ -614,7 +603,7 @@ import type {
|
|
|
614
603
|
|
|
615
604
|
// All responses are fully typed
|
|
616
605
|
const products: PaginatedResponse<StoreProduct> = await client.products.list();
|
|
617
|
-
const
|
|
606
|
+
const category: StoreCategory = await client.categories.get('clothing');
|
|
618
607
|
```
|
|
619
608
|
|
|
620
609
|
## Available Types
|
|
@@ -626,8 +615,7 @@ The SDK exports all Store API types:
|
|
|
626
615
|
- `StoreVariant` - Variant data
|
|
627
616
|
- `StoreOrder` - Order/cart data
|
|
628
617
|
- `StoreLineItem` - Line item in cart
|
|
629
|
-
- `
|
|
630
|
-
- `StoreTaxon` - Individual category
|
|
618
|
+
- `StoreCategory` - Category
|
|
631
619
|
- `StoreCountry` - Country with states
|
|
632
620
|
- `StoreState` - State/province
|
|
633
621
|
- `StoreAddress` - Customer address
|
|
@@ -130,6 +130,32 @@ type Base = {
|
|
|
130
130
|
id: string;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
type Category = {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
permalink: string;
|
|
137
|
+
position: number;
|
|
138
|
+
depth: number;
|
|
139
|
+
meta_title: string | null;
|
|
140
|
+
meta_description: string | null;
|
|
141
|
+
meta_keywords: string | null;
|
|
142
|
+
children_count: number;
|
|
143
|
+
created_at: string;
|
|
144
|
+
updated_at: string;
|
|
145
|
+
parent_id: string | null;
|
|
146
|
+
description: string;
|
|
147
|
+
description_html: string;
|
|
148
|
+
image_url: string | null;
|
|
149
|
+
square_image_url: string | null;
|
|
150
|
+
is_root: boolean;
|
|
151
|
+
is_child: boolean;
|
|
152
|
+
is_leaf: boolean;
|
|
153
|
+
parent?: Category;
|
|
154
|
+
children?: Array<Category>;
|
|
155
|
+
ancestors?: Array<Category>;
|
|
156
|
+
metafields?: Array<Metafield>;
|
|
157
|
+
};
|
|
158
|
+
|
|
133
159
|
type Country = {
|
|
134
160
|
iso: string;
|
|
135
161
|
iso3: string;
|
|
@@ -535,7 +561,7 @@ type Product = {
|
|
|
535
561
|
default_variant?: Variant;
|
|
536
562
|
master_variant?: Variant;
|
|
537
563
|
option_types?: Array<OptionType>;
|
|
538
|
-
|
|
564
|
+
categories?: Array<Category>;
|
|
539
565
|
metafields?: Array<Metafield>;
|
|
540
566
|
};
|
|
541
567
|
|
|
@@ -722,45 +748,6 @@ type TaxCategory = {
|
|
|
722
748
|
name: string;
|
|
723
749
|
};
|
|
724
750
|
|
|
725
|
-
type Taxon = {
|
|
726
|
-
id: string;
|
|
727
|
-
name: string;
|
|
728
|
-
permalink: string;
|
|
729
|
-
position: number;
|
|
730
|
-
depth: number;
|
|
731
|
-
meta_title: string | null;
|
|
732
|
-
meta_description: string | null;
|
|
733
|
-
meta_keywords: string | null;
|
|
734
|
-
children_count: number;
|
|
735
|
-
created_at: string;
|
|
736
|
-
updated_at: string;
|
|
737
|
-
parent_id: string | null;
|
|
738
|
-
taxonomy_id: string;
|
|
739
|
-
description: string;
|
|
740
|
-
description_html: string;
|
|
741
|
-
image_url: string | null;
|
|
742
|
-
square_image_url: string | null;
|
|
743
|
-
is_root: boolean;
|
|
744
|
-
is_child: boolean;
|
|
745
|
-
is_leaf: boolean;
|
|
746
|
-
parent?: Taxon;
|
|
747
|
-
children?: Array<Taxon>;
|
|
748
|
-
ancestors?: Array<Taxon>;
|
|
749
|
-
metafields?: Array<Metafield>;
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
type Taxonomy = {
|
|
753
|
-
id: string;
|
|
754
|
-
name: string;
|
|
755
|
-
position: number;
|
|
756
|
-
created_at: string;
|
|
757
|
-
updated_at: string;
|
|
758
|
-
root_id: string | null;
|
|
759
|
-
root?: Taxon;
|
|
760
|
-
taxons?: Array<Taxon>;
|
|
761
|
-
metafields?: Array<Metafield>;
|
|
762
|
-
};
|
|
763
|
-
|
|
764
751
|
type Variant = {
|
|
765
752
|
id: string;
|
|
766
753
|
product_id: string;
|
|
@@ -848,17 +835,16 @@ interface ProductListParams extends ListParams {
|
|
|
848
835
|
in_stock?: boolean;
|
|
849
836
|
/** Filter: only out-of-stock products */
|
|
850
837
|
out_of_stock?: boolean;
|
|
851
|
-
/** Filter: products in
|
|
852
|
-
|
|
838
|
+
/** Filter: products in category */
|
|
839
|
+
categories_id_eq?: string;
|
|
853
840
|
/** Any additional Ransack predicate */
|
|
854
841
|
[key: string]: string | number | boolean | (string | number)[] | undefined;
|
|
855
842
|
}
|
|
856
|
-
interface
|
|
843
|
+
interface CategoryListParams extends ListParams {
|
|
857
844
|
/** Sort order, e.g. 'name', '-created_at' */
|
|
858
845
|
sort?: string;
|
|
859
846
|
/** Filter: name contains */
|
|
860
847
|
name_cont?: string;
|
|
861
|
-
taxonomy_id_eq?: string | number;
|
|
862
848
|
parent_id_eq?: string | number;
|
|
863
849
|
depth_eq?: number;
|
|
864
850
|
/** Any additional Ransack predicate */
|
|
@@ -947,7 +933,7 @@ interface OptionFilterOption extends FilterOption {
|
|
|
947
933
|
presentation: string;
|
|
948
934
|
position: number;
|
|
949
935
|
}
|
|
950
|
-
interface
|
|
936
|
+
interface CategoryFilterOption {
|
|
951
937
|
id: string;
|
|
952
938
|
name: string;
|
|
953
939
|
permalink: string;
|
|
@@ -972,12 +958,12 @@ interface OptionFilter {
|
|
|
972
958
|
presentation: string;
|
|
973
959
|
options: OptionFilterOption[];
|
|
974
960
|
}
|
|
975
|
-
interface
|
|
976
|
-
id: '
|
|
977
|
-
type: '
|
|
978
|
-
options:
|
|
961
|
+
interface CategoryFilter {
|
|
962
|
+
id: 'categories';
|
|
963
|
+
type: 'category';
|
|
964
|
+
options: CategoryFilterOption[];
|
|
979
965
|
}
|
|
980
|
-
type ProductFilter = PriceRangeFilter | AvailabilityFilter | OptionFilter |
|
|
966
|
+
type ProductFilter = PriceRangeFilter | AvailabilityFilter | OptionFilter | CategoryFilter;
|
|
981
967
|
interface SortOption {
|
|
982
968
|
id: string;
|
|
983
969
|
}
|
|
@@ -988,8 +974,8 @@ interface ProductFiltersResponse {
|
|
|
988
974
|
total_count: number;
|
|
989
975
|
}
|
|
990
976
|
interface ProductFiltersParams {
|
|
991
|
-
|
|
977
|
+
category_id?: string;
|
|
992
978
|
q?: Record<string, unknown>;
|
|
993
979
|
}
|
|
994
980
|
|
|
995
|
-
export { type
|
|
981
|
+
export { type GiftCardBatch as $, type AuthTokens as A, type CreatePaymentSetupSessionParams as B, type CategoryListParams as C, type PaymentSetupSession as D, type CompletePaymentSetupSessionParams as E, type WishedItem as F, type GiftCard as G, type RetryConfig as H, type Asset as I, type AvailabilityFilter as J, type Base as K, type LoginCredentials as L, type Market as M, type CategoryFilter as N, type Order as O, type ProductListParams as P, type CategoryFilterOption as Q, type RequestFn as R, type Shipment as S, type CustomerReturn as T, type UpdateOrderParams as U, type Digital as V, type Wishlist as W, type DigitalLink as X, type ErrorResponse as Y, type Export as Z, type FilterOption as _, type RequestOptions as a, type Image as a0, type Import as a1, type ImportRow as a2, type Invitation as a3, type LineItem as a4, type LineItemInput as a5, type LocaleDefaults as a6, type Metafield as a7, type NewsletterSubscriber as a8, type OptionFilter as a9, type TaxCategory as aA, type Variant as aB, type OptionFilterOption as aa, type OptionType as ab, type OptionValue as ac, type OrderPromotion as ad, type PaginationMeta as ae, type PaymentSource as af, type Price as ag, type PriceRangeFilter as ah, type ProductFilter as ai, type Promotion as aj, type Refund as ak, type Reimbursement as al, type Report as am, type ReturnAuthorization as an, type ReturnItem as ao, type ShippingCategory as ap, type ShippingMethod as aq, type ShippingRate as ar, type SortOption as as, SpreeError as at, type State as au, type StockItem as av, type StockLocation as aw, type StockMovement as ax, type StockTransfer as ay, type StoreCredit as az, type PaginatedResponse as b, type Product as c, type ProductFiltersParams as d, type ProductFiltersResponse as e, type Category as f, type ListResponse as g, type Country as h, type Currency as i, type Locale as j, type CreateCartParams as k, type AddLineItemParams as l, type UpdateLineItemParams as m, type Payment as n, type PaymentMethod as o, type CreatePaymentSessionParams as p, type PaymentSession as q, type UpdatePaymentSessionParams as r, type CompletePaymentSessionParams as s, type RegisterParams as t, type Customer as u, type ListParams as v, type Address as w, type AddressParams as x, type CreditCard as y, type OrderListParams as z };
|
|
@@ -130,6 +130,32 @@ type Base = {
|
|
|
130
130
|
id: string;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
type Category = {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
permalink: string;
|
|
137
|
+
position: number;
|
|
138
|
+
depth: number;
|
|
139
|
+
meta_title: string | null;
|
|
140
|
+
meta_description: string | null;
|
|
141
|
+
meta_keywords: string | null;
|
|
142
|
+
children_count: number;
|
|
143
|
+
created_at: string;
|
|
144
|
+
updated_at: string;
|
|
145
|
+
parent_id: string | null;
|
|
146
|
+
description: string;
|
|
147
|
+
description_html: string;
|
|
148
|
+
image_url: string | null;
|
|
149
|
+
square_image_url: string | null;
|
|
150
|
+
is_root: boolean;
|
|
151
|
+
is_child: boolean;
|
|
152
|
+
is_leaf: boolean;
|
|
153
|
+
parent?: Category;
|
|
154
|
+
children?: Array<Category>;
|
|
155
|
+
ancestors?: Array<Category>;
|
|
156
|
+
metafields?: Array<Metafield>;
|
|
157
|
+
};
|
|
158
|
+
|
|
133
159
|
type Country = {
|
|
134
160
|
iso: string;
|
|
135
161
|
iso3: string;
|
|
@@ -535,7 +561,7 @@ type Product = {
|
|
|
535
561
|
default_variant?: Variant;
|
|
536
562
|
master_variant?: Variant;
|
|
537
563
|
option_types?: Array<OptionType>;
|
|
538
|
-
|
|
564
|
+
categories?: Array<Category>;
|
|
539
565
|
metafields?: Array<Metafield>;
|
|
540
566
|
};
|
|
541
567
|
|
|
@@ -722,45 +748,6 @@ type TaxCategory = {
|
|
|
722
748
|
name: string;
|
|
723
749
|
};
|
|
724
750
|
|
|
725
|
-
type Taxon = {
|
|
726
|
-
id: string;
|
|
727
|
-
name: string;
|
|
728
|
-
permalink: string;
|
|
729
|
-
position: number;
|
|
730
|
-
depth: number;
|
|
731
|
-
meta_title: string | null;
|
|
732
|
-
meta_description: string | null;
|
|
733
|
-
meta_keywords: string | null;
|
|
734
|
-
children_count: number;
|
|
735
|
-
created_at: string;
|
|
736
|
-
updated_at: string;
|
|
737
|
-
parent_id: string | null;
|
|
738
|
-
taxonomy_id: string;
|
|
739
|
-
description: string;
|
|
740
|
-
description_html: string;
|
|
741
|
-
image_url: string | null;
|
|
742
|
-
square_image_url: string | null;
|
|
743
|
-
is_root: boolean;
|
|
744
|
-
is_child: boolean;
|
|
745
|
-
is_leaf: boolean;
|
|
746
|
-
parent?: Taxon;
|
|
747
|
-
children?: Array<Taxon>;
|
|
748
|
-
ancestors?: Array<Taxon>;
|
|
749
|
-
metafields?: Array<Metafield>;
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
type Taxonomy = {
|
|
753
|
-
id: string;
|
|
754
|
-
name: string;
|
|
755
|
-
position: number;
|
|
756
|
-
created_at: string;
|
|
757
|
-
updated_at: string;
|
|
758
|
-
root_id: string | null;
|
|
759
|
-
root?: Taxon;
|
|
760
|
-
taxons?: Array<Taxon>;
|
|
761
|
-
metafields?: Array<Metafield>;
|
|
762
|
-
};
|
|
763
|
-
|
|
764
751
|
type Variant = {
|
|
765
752
|
id: string;
|
|
766
753
|
product_id: string;
|
|
@@ -848,17 +835,16 @@ interface ProductListParams extends ListParams {
|
|
|
848
835
|
in_stock?: boolean;
|
|
849
836
|
/** Filter: only out-of-stock products */
|
|
850
837
|
out_of_stock?: boolean;
|
|
851
|
-
/** Filter: products in
|
|
852
|
-
|
|
838
|
+
/** Filter: products in category */
|
|
839
|
+
categories_id_eq?: string;
|
|
853
840
|
/** Any additional Ransack predicate */
|
|
854
841
|
[key: string]: string | number | boolean | (string | number)[] | undefined;
|
|
855
842
|
}
|
|
856
|
-
interface
|
|
843
|
+
interface CategoryListParams extends ListParams {
|
|
857
844
|
/** Sort order, e.g. 'name', '-created_at' */
|
|
858
845
|
sort?: string;
|
|
859
846
|
/** Filter: name contains */
|
|
860
847
|
name_cont?: string;
|
|
861
|
-
taxonomy_id_eq?: string | number;
|
|
862
848
|
parent_id_eq?: string | number;
|
|
863
849
|
depth_eq?: number;
|
|
864
850
|
/** Any additional Ransack predicate */
|
|
@@ -947,7 +933,7 @@ interface OptionFilterOption extends FilterOption {
|
|
|
947
933
|
presentation: string;
|
|
948
934
|
position: number;
|
|
949
935
|
}
|
|
950
|
-
interface
|
|
936
|
+
interface CategoryFilterOption {
|
|
951
937
|
id: string;
|
|
952
938
|
name: string;
|
|
953
939
|
permalink: string;
|
|
@@ -972,12 +958,12 @@ interface OptionFilter {
|
|
|
972
958
|
presentation: string;
|
|
973
959
|
options: OptionFilterOption[];
|
|
974
960
|
}
|
|
975
|
-
interface
|
|
976
|
-
id: '
|
|
977
|
-
type: '
|
|
978
|
-
options:
|
|
961
|
+
interface CategoryFilter {
|
|
962
|
+
id: 'categories';
|
|
963
|
+
type: 'category';
|
|
964
|
+
options: CategoryFilterOption[];
|
|
979
965
|
}
|
|
980
|
-
type ProductFilter = PriceRangeFilter | AvailabilityFilter | OptionFilter |
|
|
966
|
+
type ProductFilter = PriceRangeFilter | AvailabilityFilter | OptionFilter | CategoryFilter;
|
|
981
967
|
interface SortOption {
|
|
982
968
|
id: string;
|
|
983
969
|
}
|
|
@@ -988,8 +974,8 @@ interface ProductFiltersResponse {
|
|
|
988
974
|
total_count: number;
|
|
989
975
|
}
|
|
990
976
|
interface ProductFiltersParams {
|
|
991
|
-
|
|
977
|
+
category_id?: string;
|
|
992
978
|
q?: Record<string, unknown>;
|
|
993
979
|
}
|
|
994
980
|
|
|
995
|
-
export { type
|
|
981
|
+
export { type GiftCardBatch as $, type AuthTokens as A, type CreatePaymentSetupSessionParams as B, type CategoryListParams as C, type PaymentSetupSession as D, type CompletePaymentSetupSessionParams as E, type WishedItem as F, type GiftCard as G, type RetryConfig as H, type Asset as I, type AvailabilityFilter as J, type Base as K, type LoginCredentials as L, type Market as M, type CategoryFilter as N, type Order as O, type ProductListParams as P, type CategoryFilterOption as Q, type RequestFn as R, type Shipment as S, type CustomerReturn as T, type UpdateOrderParams as U, type Digital as V, type Wishlist as W, type DigitalLink as X, type ErrorResponse as Y, type Export as Z, type FilterOption as _, type RequestOptions as a, type Image as a0, type Import as a1, type ImportRow as a2, type Invitation as a3, type LineItem as a4, type LineItemInput as a5, type LocaleDefaults as a6, type Metafield as a7, type NewsletterSubscriber as a8, type OptionFilter as a9, type TaxCategory as aA, type Variant as aB, type OptionFilterOption as aa, type OptionType as ab, type OptionValue as ac, type OrderPromotion as ad, type PaginationMeta as ae, type PaymentSource as af, type Price as ag, type PriceRangeFilter as ah, type ProductFilter as ai, type Promotion as aj, type Refund as ak, type Reimbursement as al, type Report as am, type ReturnAuthorization as an, type ReturnItem as ao, type ShippingCategory as ap, type ShippingMethod as aq, type ShippingRate as ar, type SortOption as as, SpreeError as at, type State as au, type StockItem as av, type StockLocation as aw, type StockMovement as ax, type StockTransfer as ay, type StoreCredit as az, type PaginatedResponse as b, type Product as c, type ProductFiltersParams as d, type ProductFiltersResponse as e, type Category as f, type ListResponse as g, type Country as h, type Currency as i, type Locale as j, type CreateCartParams as k, type AddLineItemParams as l, type UpdateLineItemParams as m, type Payment as n, type PaymentMethod as o, type CreatePaymentSessionParams as p, type PaymentSession as q, type UpdatePaymentSessionParams as r, type CompletePaymentSessionParams as s, type RegisterParams as t, type Customer as u, type ListParams as v, type Address as w, type AddressParams as x, type CreditCard as y, type OrderListParams as z };
|
package/dist/index.cjs
CHANGED
|
@@ -174,10 +174,6 @@ var StoreClient = class {
|
|
|
174
174
|
* Login with email and password
|
|
175
175
|
*/
|
|
176
176
|
login: (credentials) => this.request("POST", "/auth/login", { body: credentials }),
|
|
177
|
-
/**
|
|
178
|
-
* Register a new customer account
|
|
179
|
-
*/
|
|
180
|
-
register: (params) => this.request("POST", "/auth/register", { body: params }),
|
|
181
177
|
/**
|
|
182
178
|
* Refresh access token (requires valid Bearer token)
|
|
183
179
|
*/
|
|
@@ -203,7 +199,7 @@ var StoreClient = class {
|
|
|
203
199
|
}),
|
|
204
200
|
/**
|
|
205
201
|
* Get available filters for products
|
|
206
|
-
* Returns filter options (price range, availability, option types,
|
|
202
|
+
* Returns filter options (price range, availability, option types, categories) with counts
|
|
207
203
|
*/
|
|
208
204
|
filters: (params, options) => this.request("GET", "/products/filters", {
|
|
209
205
|
...options,
|
|
@@ -211,50 +207,34 @@ var StoreClient = class {
|
|
|
211
207
|
})
|
|
212
208
|
};
|
|
213
209
|
// ============================================
|
|
214
|
-
//
|
|
210
|
+
// Categories
|
|
215
211
|
// ============================================
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* List taxonomies
|
|
219
|
-
*/
|
|
220
|
-
list: (params, options) => this.request("GET", "/taxonomies", {
|
|
221
|
-
...options,
|
|
222
|
-
params: transformListParams({ ...params })
|
|
223
|
-
}),
|
|
224
|
-
/**
|
|
225
|
-
* Get a taxonomy by ID
|
|
226
|
-
*/
|
|
227
|
-
get: (id, params, options) => this.request("GET", `/taxonomies/${id}`, {
|
|
228
|
-
...options,
|
|
229
|
-
params: getParams(params)
|
|
230
|
-
})
|
|
231
|
-
};
|
|
232
|
-
taxons = {
|
|
212
|
+
categories = {
|
|
233
213
|
/**
|
|
234
|
-
* List
|
|
214
|
+
* List categories
|
|
235
215
|
*/
|
|
236
|
-
list: (params, options) => this.request("GET", "/
|
|
216
|
+
list: (params, options) => this.request("GET", "/categories", {
|
|
237
217
|
...options,
|
|
238
218
|
params: transformListParams({ ...params })
|
|
239
219
|
}),
|
|
240
220
|
/**
|
|
241
|
-
* Get a
|
|
221
|
+
* Get a category by ID or permalink
|
|
242
222
|
*/
|
|
243
|
-
get: (idOrPermalink, params, options) => this.request("GET", `/
|
|
223
|
+
get: (idOrPermalink, params, options) => this.request("GET", `/categories/${idOrPermalink}`, {
|
|
244
224
|
...options,
|
|
245
225
|
params: getParams(params)
|
|
246
226
|
}),
|
|
247
227
|
/**
|
|
248
|
-
* Nested resource: Products in a
|
|
228
|
+
* Nested resource: Products in a category
|
|
249
229
|
*/
|
|
250
230
|
products: {
|
|
251
231
|
/**
|
|
252
|
-
* List products in a
|
|
253
|
-
* @param
|
|
232
|
+
* List products in a category
|
|
233
|
+
* @param categoryId - Category ID (prefix_id) or permalink
|
|
254
234
|
*/
|
|
255
|
-
list: (
|
|
235
|
+
list: (categoryId, params, options) => this.request(
|
|
256
236
|
"GET",
|
|
257
|
-
`/
|
|
237
|
+
`/categories/${categoryId}/products`,
|
|
258
238
|
{
|
|
259
239
|
...options,
|
|
260
240
|
params: transformListParams({ ...params })
|
|
@@ -568,6 +548,12 @@ var StoreClient = class {
|
|
|
568
548
|
// ============================================
|
|
569
549
|
// Customer
|
|
570
550
|
// ============================================
|
|
551
|
+
customers = {
|
|
552
|
+
/**
|
|
553
|
+
* Register a new customer account
|
|
554
|
+
*/
|
|
555
|
+
create: (params) => this.request("POST", "/customers", { body: params })
|
|
556
|
+
};
|
|
571
557
|
customer = {
|
|
572
558
|
/**
|
|
573
559
|
* Get current customer profile
|