@commercengine/storefront-sdk 0.13.2 → 0.13.3
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/dist/index.d.mts +101 -25
- package/dist/index.iife.js +39 -9
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +39 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4079,7 +4079,8 @@ interface components {
|
|
|
4079
4079
|
backorder?: boolean;
|
|
4080
4080
|
on_subscription: boolean;
|
|
4081
4081
|
on_promotion: boolean;
|
|
4082
|
-
category_ids: string[];
|
|
4082
|
+
category_ids: string[]; /** @description Expanded category objects. */
|
|
4083
|
+
categories?: components["schemas"]["Category"][];
|
|
4083
4084
|
tags: string[] | null;
|
|
4084
4085
|
reviews_count: number;
|
|
4085
4086
|
reviews_rating_sum: number | null;
|
|
@@ -4475,12 +4476,20 @@ interface components {
|
|
|
4475
4476
|
* @description Loyalty Point Activity
|
|
4476
4477
|
*/
|
|
4477
4478
|
LoyaltyPointActivity: {
|
|
4478
|
-
/**
|
|
4479
|
-
|
|
4480
|
-
|
|
4479
|
+
/**
|
|
4480
|
+
* @description The action that occurred.
|
|
4481
|
+
* @enum {string}
|
|
4482
|
+
*/
|
|
4483
|
+
action?: "add" | "remove";
|
|
4484
|
+
/**
|
|
4485
|
+
* @description The activity that occurred.
|
|
4486
|
+
* @enum {string}
|
|
4487
|
+
*/
|
|
4488
|
+
activity?: "order-placed" | "credit-note-issued" | "tier-upgrade" | "tier-downgrade" | "points-expired" | "points-carryforward" | "signup" | "bonus" | "other";
|
|
4489
|
+
reference_number?: string | null;
|
|
4481
4490
|
title?: string;
|
|
4482
|
-
|
|
4483
|
-
remarks?: string; /** Format: date-time */
|
|
4491
|
+
loyalty_points?: number;
|
|
4492
|
+
remarks?: string | null; /** Format: date-time */
|
|
4484
4493
|
created_at?: string; /** Format: date-time */
|
|
4485
4494
|
modified_at?: string;
|
|
4486
4495
|
}; /** ManualPaymentMethod */
|
|
@@ -5388,17 +5397,55 @@ interface components {
|
|
|
5388
5397
|
* @description Maximum number of records returned for a page.
|
|
5389
5398
|
* @default 25
|
|
5390
5399
|
*/
|
|
5391
|
-
limit: number;
|
|
5400
|
+
limit: number; /** @description provide list of attributes for specific facets or * for all facets. All attributes supported in the filter parameter are also supported here. */
|
|
5401
|
+
facets?: string[];
|
|
5392
5402
|
/**
|
|
5393
|
-
* @description
|
|
5394
|
-
*
|
|
5395
|
-
*
|
|
5396
|
-
*
|
|
5397
|
-
*
|
|
5398
|
-
*
|
|
5399
|
-
*
|
|
5403
|
+
* @description Filter expression(s) to narrow results. Omit for no filtering.
|
|
5404
|
+
*
|
|
5405
|
+
* **Syntax:** `attribute OPERATOR value`
|
|
5406
|
+
*
|
|
5407
|
+
* **Operators:**
|
|
5408
|
+
*
|
|
5409
|
+
* | Operator | Description | Example |
|
|
5410
|
+
* |---|---|---|
|
|
5411
|
+
* | `=` | Equal to | `product_type = physical` |
|
|
5412
|
+
* | `!=` | Not equal to | `product_type != bundle` |
|
|
5413
|
+
* | `>`, `>=`, `<`, `<=` | Comparison | `rating > 4` |
|
|
5414
|
+
* | `TO` | Inclusive range (`>=` AND `<=`) | `pricing.selling_price 100 TO 500` |
|
|
5415
|
+
* | `IN [...]` | Matches any value in the list | `product_type IN [physical,bundle]` |
|
|
5416
|
+
* | `NOT IN [...]` | Excludes all values in the list | `product_type NOT IN [physical,bundle]` |
|
|
5417
|
+
* | `EXISTS` | Attribute is present (even if `null` or empty) | `tags EXISTS` |
|
|
5418
|
+
* | `NOT EXISTS` | Attribute is absent | `tags NOT EXISTS` |
|
|
5419
|
+
* | `IS NULL` | Value is `null` | `variant_id IS NULL` |
|
|
5420
|
+
* | `IS NOT NULL` | Value is not `null` | `variant_id IS NOT NULL` |
|
|
5421
|
+
* | `IS EMPTY` | Value is `""`, `[]`, or `{}` | `tags IS EMPTY` |
|
|
5422
|
+
* | `IS NOT EMPTY` | Value is not empty | `tags IS NOT EMPTY` |
|
|
5423
|
+
* | `AND` | Both conditions must match | `rating > 4 AND product_type = physical` |
|
|
5424
|
+
* | `OR` | Either condition must match | `product_type = physical OR product_type = bundle` |
|
|
5425
|
+
* | `NOT` | Negates a condition | `NOT product_type = bundle` |
|
|
5426
|
+
*
|
|
5427
|
+
* **Important rules:**
|
|
5428
|
+
* - Operators are **case-sensitive** — must be uppercase (`AND`, not `and`).
|
|
5429
|
+
* - String value comparison is **case-insensitive** — `product_type = Physical` matches `physical`.
|
|
5430
|
+
* - Operator precedence: `NOT` > `AND` > `OR`. Use parentheses to override.
|
|
5431
|
+
* - String values containing whitespace must be wrapped in single quotes.
|
|
5432
|
+
* - `IN` takes comma-separated values in square brackets.
|
|
5433
|
+
* - Maximum array nesting depth is **2 levels**.
|
|
5434
|
+
*
|
|
5435
|
+
* **Supported attributes:** `product_type`, `categories.name`, `attributes.key`, `pricing.listing_price`, `pricing.selling_price`, `pricing.tax_rate`, `product_id`, `variant_id`, `product_name`, `variant_name`, `tags`, `sku`, `stock_available`, `rating`
|
|
5436
|
+
*
|
|
5437
|
+
* **Combining conditions:**
|
|
5438
|
+
* - **String:** Use `AND`/`OR` operators inline — `"rating > 4 AND product_type = physical"`
|
|
5439
|
+
* - **Array of strings:** Conditions are combined with AND — `["rating > 4", "product_type = physical"]`
|
|
5440
|
+
* - **Nested arrays:** Inner arrays express OR, outer array expresses AND — `["product_type = physical", ["product_type = bundle", "rating > 4"]]`
|
|
5400
5441
|
*/
|
|
5401
|
-
|
|
5442
|
+
filter?: string | (string | string[])[];
|
|
5443
|
+
/**
|
|
5444
|
+
* @description Sort results by attributes. Use `asc` for ascending order and `desc` for descending order.
|
|
5445
|
+
* @example product_type:desc
|
|
5446
|
+
* @example product_name:asc
|
|
5447
|
+
*/
|
|
5448
|
+
sort?: string[];
|
|
5402
5449
|
}; /** SellerDetail */
|
|
5403
5450
|
SellerDetail: components["schemas"]["SellerInfo"] & {
|
|
5404
5451
|
description?: string;
|
|
@@ -8993,7 +9040,6 @@ interface operations {
|
|
|
8993
9040
|
success?: boolean;
|
|
8994
9041
|
content?: {
|
|
8995
9042
|
loyalty?: components["schemas"]["CustomerLoyalty"];
|
|
8996
|
-
loyalty_point_balance?: number;
|
|
8997
9043
|
};
|
|
8998
9044
|
};
|
|
8999
9045
|
};
|
|
@@ -13434,19 +13480,15 @@ declare class CatalogClient extends StorefrontAPIClient {
|
|
|
13434
13480
|
/**
|
|
13435
13481
|
* Search for products
|
|
13436
13482
|
*
|
|
13437
|
-
* @param searchData - The search query and
|
|
13483
|
+
* @param searchData - The search query, filters, sort, and pagination options
|
|
13438
13484
|
* @param headers - Optional header parameters (customer_group_id, etc.)
|
|
13439
|
-
* @returns Promise with search results including
|
|
13485
|
+
* @returns Promise with search results including SKUs, facet distribution, facet stats, and pagination
|
|
13440
13486
|
*
|
|
13441
13487
|
* @example
|
|
13442
13488
|
* ```typescript
|
|
13489
|
+
* // Basic search
|
|
13443
13490
|
* const { data, error } = await sdk.catalog.searchProducts({
|
|
13444
13491
|
* query: "smartphone",
|
|
13445
|
-
* filters: {
|
|
13446
|
-
* category: ["electronics", "mobile"],
|
|
13447
|
-
* price_range: { min: 100, max: 1000 },
|
|
13448
|
-
* brand: ["Apple", "Samsung"] // facet names depend on product configuration
|
|
13449
|
-
* },
|
|
13450
13492
|
* page: 1,
|
|
13451
13493
|
* limit: 20
|
|
13452
13494
|
* });
|
|
@@ -13458,17 +13500,51 @@ declare class CatalogClient extends StorefrontAPIClient {
|
|
|
13458
13500
|
*
|
|
13459
13501
|
* console.log("Search results:", data.skus?.length || 0, "products found");
|
|
13460
13502
|
* console.log("Facet distribution:", data.facet_distribution);
|
|
13461
|
-
* console.log("
|
|
13503
|
+
* console.log("Facet stats:", data.facet_stats);
|
|
13504
|
+
* console.log("Pagination:", data.pagination);
|
|
13462
13505
|
*
|
|
13463
13506
|
* data.skus?.forEach(sku => {
|
|
13464
13507
|
* console.log(`Found: ${sku.product_name} - ${sku.pricing?.selling_price}`);
|
|
13465
13508
|
* });
|
|
13466
13509
|
*
|
|
13510
|
+
* // With filter (string expression — Meilisearch syntax)
|
|
13511
|
+
* const { data: filtered, error: filteredError } = await sdk.catalog.searchProducts({
|
|
13512
|
+
* query: "laptop",
|
|
13513
|
+
* filter: "pricing.selling_price 500 TO 2000 AND product_type = physical",
|
|
13514
|
+
* sort: ["pricing.selling_price:asc"],
|
|
13515
|
+
* facets: ["product_type", "categories.name", "tags"],
|
|
13516
|
+
* page: 1,
|
|
13517
|
+
* limit: 10
|
|
13518
|
+
* });
|
|
13519
|
+
*
|
|
13520
|
+
* // With filter (array of conditions — combined with AND)
|
|
13521
|
+
* const { data: arrayFiltered, error: arrayError } = await sdk.catalog.searchProducts({
|
|
13522
|
+
* query: "shoes",
|
|
13523
|
+
* filter: ["product_type = physical", "rating >= 4", "stock_available > 0"],
|
|
13524
|
+
* sort: ["rating:desc"],
|
|
13525
|
+
* facets: ["*"],
|
|
13526
|
+
* page: 1,
|
|
13527
|
+
* limit: 25
|
|
13528
|
+
* });
|
|
13529
|
+
*
|
|
13530
|
+
* // With filter (nested arrays — inner arrays use OR, outer uses AND)
|
|
13531
|
+
* const { data: nestedFiltered, error: nestedError } = await sdk.catalog.searchProducts({
|
|
13532
|
+
* query: "headphones",
|
|
13533
|
+
* filter: [
|
|
13534
|
+
* "pricing.selling_price 50 TO 300",
|
|
13535
|
+
* ["product_type = physical", "product_type = bundle"]
|
|
13536
|
+
* ],
|
|
13537
|
+
* page: 1,
|
|
13538
|
+
* limit: 25
|
|
13539
|
+
* });
|
|
13540
|
+
*
|
|
13467
13541
|
* // Override customer group ID for this specific request
|
|
13468
13542
|
* const { data: overrideData, error: overrideError } = await sdk.catalog.searchProducts(
|
|
13469
13543
|
* {
|
|
13470
13544
|
* query: "laptop",
|
|
13471
|
-
*
|
|
13545
|
+
* filter: "categories.name = computers",
|
|
13546
|
+
* page: 1,
|
|
13547
|
+
* limit: 20
|
|
13472
13548
|
* },
|
|
13473
13549
|
* {
|
|
13474
13550
|
* "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
|
package/dist/index.iife.js
CHANGED
|
@@ -1745,19 +1745,15 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
1745
1745
|
/**
|
|
1746
1746
|
* Search for products
|
|
1747
1747
|
*
|
|
1748
|
-
* @param searchData - The search query and
|
|
1748
|
+
* @param searchData - The search query, filters, sort, and pagination options
|
|
1749
1749
|
* @param headers - Optional header parameters (customer_group_id, etc.)
|
|
1750
|
-
* @returns Promise with search results including
|
|
1750
|
+
* @returns Promise with search results including SKUs, facet distribution, facet stats, and pagination
|
|
1751
1751
|
*
|
|
1752
1752
|
* @example
|
|
1753
1753
|
* ```typescript
|
|
1754
|
+
* // Basic search
|
|
1754
1755
|
* const { data, error } = await sdk.catalog.searchProducts({
|
|
1755
1756
|
* query: "smartphone",
|
|
1756
|
-
* filters: {
|
|
1757
|
-
* category: ["electronics", "mobile"],
|
|
1758
|
-
* price_range: { min: 100, max: 1000 },
|
|
1759
|
-
* brand: ["Apple", "Samsung"] // facet names depend on product configuration
|
|
1760
|
-
* },
|
|
1761
1757
|
* page: 1,
|
|
1762
1758
|
* limit: 20
|
|
1763
1759
|
* });
|
|
@@ -1769,17 +1765,51 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
1769
1765
|
*
|
|
1770
1766
|
* console.log("Search results:", data.skus?.length || 0, "products found");
|
|
1771
1767
|
* console.log("Facet distribution:", data.facet_distribution);
|
|
1772
|
-
* console.log("
|
|
1768
|
+
* console.log("Facet stats:", data.facet_stats);
|
|
1769
|
+
* console.log("Pagination:", data.pagination);
|
|
1773
1770
|
*
|
|
1774
1771
|
* data.skus?.forEach(sku => {
|
|
1775
1772
|
* console.log(`Found: ${sku.product_name} - ${sku.pricing?.selling_price}`);
|
|
1776
1773
|
* });
|
|
1777
1774
|
*
|
|
1775
|
+
* // With filter (string expression — Meilisearch syntax)
|
|
1776
|
+
* const { data: filtered, error: filteredError } = await sdk.catalog.searchProducts({
|
|
1777
|
+
* query: "laptop",
|
|
1778
|
+
* filter: "pricing.selling_price 500 TO 2000 AND product_type = physical",
|
|
1779
|
+
* sort: ["pricing.selling_price:asc"],
|
|
1780
|
+
* facets: ["product_type", "categories.name", "tags"],
|
|
1781
|
+
* page: 1,
|
|
1782
|
+
* limit: 10
|
|
1783
|
+
* });
|
|
1784
|
+
*
|
|
1785
|
+
* // With filter (array of conditions — combined with AND)
|
|
1786
|
+
* const { data: arrayFiltered, error: arrayError } = await sdk.catalog.searchProducts({
|
|
1787
|
+
* query: "shoes",
|
|
1788
|
+
* filter: ["product_type = physical", "rating >= 4", "stock_available > 0"],
|
|
1789
|
+
* sort: ["rating:desc"],
|
|
1790
|
+
* facets: ["*"],
|
|
1791
|
+
* page: 1,
|
|
1792
|
+
* limit: 25
|
|
1793
|
+
* });
|
|
1794
|
+
*
|
|
1795
|
+
* // With filter (nested arrays — inner arrays use OR, outer uses AND)
|
|
1796
|
+
* const { data: nestedFiltered, error: nestedError } = await sdk.catalog.searchProducts({
|
|
1797
|
+
* query: "headphones",
|
|
1798
|
+
* filter: [
|
|
1799
|
+
* "pricing.selling_price 50 TO 300",
|
|
1800
|
+
* ["product_type = physical", "product_type = bundle"]
|
|
1801
|
+
* ],
|
|
1802
|
+
* page: 1,
|
|
1803
|
+
* limit: 25
|
|
1804
|
+
* });
|
|
1805
|
+
*
|
|
1778
1806
|
* // Override customer group ID for this specific request
|
|
1779
1807
|
* const { data: overrideData, error: overrideError } = await sdk.catalog.searchProducts(
|
|
1780
1808
|
* {
|
|
1781
1809
|
* query: "laptop",
|
|
1782
|
-
*
|
|
1810
|
+
* filter: "categories.name = computers",
|
|
1811
|
+
* page: 1,
|
|
1812
|
+
* limit: 20
|
|
1783
1813
|
* },
|
|
1784
1814
|
* {
|
|
1785
1815
|
* "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
|