shop-client 3.23.0 → 3.24.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 CHANGED
@@ -359,7 +359,7 @@ Fetches all products from the store with automatic pagination handling.
359
359
  const allProducts = await shop.products.all();
360
360
  ```
361
361
 
362
- **Returns:** `ProductResult[] | null`
362
+ **Returns:** `ProductResult[] | null` (typed based on `columns`, defaults to minimal)
363
363
 
364
364
  #### `products.paginated(options)`
365
365
 
@@ -379,7 +379,7 @@ const products = await shop.products.paginated({
379
379
  - `limit` (number, optional): Products per page (default: 250, max: 250)
380
380
  - `currency` (CurrencyCode, optional): ISO 4217 code aligned with `Intl.NumberFormatOptions['currency']` (e.g., `"USD"`, `"EUR"`, `"JPY"`)
381
381
 
382
- **Returns:** `ProductResult[] | null`
382
+ **Returns:** `ProductResult[] | null` (typed based on `columns`, defaults to minimal)
383
383
 
384
384
  #### `products.find(handle)`
385
385
 
@@ -397,7 +397,26 @@ const productEur = await shop.products.find("product-handle", { currency: "EUR"
397
397
  - `options` (object, optional): Additional options
398
398
  - `currency` (CurrencyCode, optional): ISO 4217 code aligned with `Intl.NumberFormatOptions['currency']`
399
399
 
400
- **Returns:** `ProductResult | null`
400
+ **Returns:** `ProductResult | null` (typed based on `columns`, defaults to minimal)
401
+
402
+ #### `products.findEnhanced(handle, options)`
403
+
404
+ Finds a product by handle and returns the product plus AI enrichment from the worker endpoint. The `product` field is typed the same way as `products.find()` based on `columns`.
405
+
406
+ ```typescript
407
+ const enhanced = await shop.products.findEnhanced("product-handle", {
408
+ apiKey: process.env.ENRICH_API_KEY!,
409
+ columns: { mode: "full", images: "full", options: "full" },
410
+ });
411
+
412
+ if (enhanced) {
413
+ console.log(enhanced.cache); // e.g. "hit" | "miss"
414
+ console.log(enhanced.enrichment.markdown);
415
+ console.log(enhanced.product.handle); // available when mode: "full"
416
+ }
417
+ ```
418
+
419
+ **Returns:** `EnhancedProductResponse<ProductResult> | null` (typed based on `columns`)
401
420
 
402
421
  #### `products.showcased()`
403
422
 
@@ -475,7 +494,7 @@ const results = await shop.products.predictiveSearch("dress", {
475
494
  - Extracts handles from Ajax results, fetches full products via `find`
476
495
  - Falls back to non-locale path when locale returns 404/417
477
496
 
478
- **Returns:** `ProductResult[]`
497
+ **Returns:** `ProductResult[]` (typed based on `columns`, defaults to minimal)
479
498
 
480
499
  ### Recommendations
481
500
 
@@ -497,7 +516,7 @@ const recos = await shop.products.recommendations(1234567890, {
497
516
 
498
517
  ### Product Columns
499
518
 
500
- Default product payload is minimal. Use `columns` to override the product payload shape (full vs minimal):
519
+ Default product payload is minimal. Use `columns` to override the product payload shape, and TypeScript will reflect the shape in the returned type:
501
520
 
502
521
  ```typescript
503
522
  // Minimal products (default)
@@ -514,6 +533,11 @@ const minimalOne = await shop.products.find("product-handle", {
514
533
  });
515
534
  ```
516
535
 
536
+ Quick mental model:
537
+ - `mode: "minimal"` returns a minimal product shape (no `handle`, no `priceMin/priceMax`, no `currency` field)
538
+ - `mode: "full"` returns a full product shape (includes `handle`, pricing range fields, `currency`, variants, etc.)
539
+ - `images: "full"` and `options: "full"` expand those subfields while keeping the chosen `mode`
540
+
517
541
  ### Collections
518
542
 
519
543
  #### `collections.all()`
@@ -579,7 +603,7 @@ const products = await shop.collections.products.all("collection-handle");
579
603
  **Parameters:**
580
604
  - `handle` (string): The collection handle
581
605
 
582
- **Returns:** `ProductResult[] | null`
606
+ **Returns:** `ProductResult[] | null` (typed based on `columns`, defaults to minimal)
583
607
 
584
608
  #### `collections.products.paginated(handle, options)`
585
609
 
@@ -600,7 +624,7 @@ const products = await shop.collections.products.paginated("collection-handle",
600
624
  - `limit` (number, optional): Products per page (default: 250)
601
625
  - `currency` (CurrencyCode, optional): ISO 4217 code aligned with `Intl.NumberFormatOptions['currency']`
602
626
 
603
- **Returns:** `ProductResult[] | null`
627
+ **Returns:** `ProductResult[] | null` (typed based on `columns`, defaults to minimal)
604
628
 
605
629
  Collection products also default to minimal. To request full products from collections, pass `columns`:
606
630
 
@@ -616,6 +640,7 @@ By default, pricing is formatted using the store’s detected currency.
616
640
  You can override the currency for product and collection queries by passing a `currency` option.
617
641
  This override updates pricing display fields only:
618
642
  - `ProductResult.localizedPricing` formatted strings
643
+ - For full products (`mode: "full"`), `ProductResult.currency` is also set to the override
619
644
 
620
645
  ### Showcased Products
621
646
 
@@ -1,4 +1,4 @@
1
- import { O as OpenRouterConfig, n as ProductClassification, o as SEOContent, p as SystemUserPrompt, b as ShopifySingleProduct } from '../types-C0NvqVL-.js';
1
+ import { O as OpenRouterConfig, q as ProductClassification, r as SEOContent, s as SystemUserPrompt, e as ShopifySingleProduct } from '../types-gQvOWe1Z.js';
2
2
 
3
3
  declare function buildEnrichPrompt(args: {
4
4
  bodyInput: string;
@@ -21,12 +21,10 @@ function createCollectionOperations(baseUrl, storeDomain, fetchCollections, coll
21
21
  findCache.set(key, { ts: Date.now(), value });
22
22
  };
23
23
  function applyCurrencyOverride(product, currency) {
24
- var _a, _b, _c, _d, _e;
25
24
  if ("priceMin" in product) {
26
- const p = product;
27
- const priceMin = typeof p.priceMin === "number" ? p.priceMin : (_a = p.price) != null ? _a : 0;
28
- const priceMax = typeof p.priceMax === "number" ? p.priceMax : (_b = p.price) != null ? _b : 0;
29
- const compareAtMin = typeof p.compareAtPriceMin === "number" ? p.compareAtPriceMin : (_c = p.compareAtPrice) != null ? _c : 0;
25
+ const priceMin = product.priceMin;
26
+ const priceMax = product.priceMax;
27
+ const compareAtMin = product.compareAtPriceMin;
30
28
  return {
31
29
  ...product,
32
30
  currency,
@@ -39,12 +37,11 @@ function createCollectionOperations(baseUrl, storeDomain, fetchCollections, coll
39
37
  }
40
38
  };
41
39
  }
42
- const compareAtPrice = (_d = product.compareAtPrice) != null ? _d : 0;
43
40
  return {
44
41
  ...product,
45
42
  localizedPricing: {
46
- priceFormatted: formatPrice((_e = product.price) != null ? _e : 0, currency),
47
- compareAtPriceFormatted: formatPrice(compareAtPrice, currency)
43
+ priceFormatted: formatPrice(product.price, currency),
44
+ compareAtPriceFormatted: formatPrice(product.compareAtPrice, currency)
48
45
  }
49
46
  };
50
47
  }
@@ -21,12 +21,10 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
21
21
  findCache.set(key, { ts: Date.now(), value });
22
22
  };
23
23
  function applyCurrencyOverride(product, currency) {
24
- var _a, _b, _c, _d, _e;
25
24
  if ("priceMin" in product) {
26
- const p = product;
27
- const priceMin = typeof p.priceMin === "number" ? p.priceMin : (_a = p.price) != null ? _a : 0;
28
- const priceMax = typeof p.priceMax === "number" ? p.priceMax : (_b = p.price) != null ? _b : 0;
29
- const compareAtMin = typeof p.compareAtPriceMin === "number" ? p.compareAtPriceMin : (_c = p.compareAtPrice) != null ? _c : 0;
25
+ const priceMin = product.priceMin;
26
+ const priceMax = product.priceMax;
27
+ const compareAtMin = product.compareAtPriceMin;
30
28
  return {
31
29
  ...product,
32
30
  currency,
@@ -39,12 +37,11 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
39
37
  }
40
38
  };
41
39
  }
42
- const compareAtPrice = (_d = product.compareAtPrice) != null ? _d : 0;
43
40
  return {
44
41
  ...product,
45
42
  localizedPricing: {
46
- priceFormatted: formatPrice((_e = product.price) != null ? _e : 0, currency),
47
- compareAtPriceFormatted: formatPrice(compareAtPrice, currency)
43
+ priceFormatted: formatPrice(product.price, currency),
44
+ compareAtPriceFormatted: formatPrice(product.compareAtPrice, currency)
48
45
  }
49
46
  };
50
47
  }
@@ -237,10 +234,7 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
237
234
  handles.map((h) => findInternal(h, { columns }))
238
235
  );
239
236
  const results = filter(fetched, isNonNullish);
240
- return (_e = maybeOverrideProductsCurrency(
241
- results,
242
- options.currency
243
- )) != null ? _e : [];
237
+ return (_e = maybeOverrideProductsCurrency(results, options.currency)) != null ? _e : [];
244
238
  }
245
239
  async function recommendationsInternal(productId, options) {
246
240
  var _a, _b;
@@ -268,10 +262,7 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
268
262
  const isRecord = (v) => typeof v === "object" && v !== null;
269
263
  const productsArray = Array.isArray(data) ? data : isRecord(data) && Array.isArray(data.products) ? data.products : [];
270
264
  const normalized = productsDto(productsArray, { columns }) || [];
271
- return maybeOverrideProductsCurrency(
272
- normalized,
273
- options.currency
274
- );
265
+ return maybeOverrideProductsCurrency(normalized, options.currency);
275
266
  }
276
267
  async function findEnhancedInternal(productHandle, options) {
277
268
  var _a;
@@ -279,12 +270,11 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
279
270
  if (!apiKey || typeof apiKey !== "string" || !apiKey.trim()) {
280
271
  throw new Error("apiKey is required");
281
272
  }
282
- const updatedAt = options.updatedAt;
283
273
  let updatedAtTrimmed;
284
- if (typeof updatedAt === "string") {
285
- const trimmed = updatedAt.trim();
274
+ if (typeof options.updatedAt === "string") {
275
+ const trimmed = options.updatedAt.trim();
286
276
  updatedAtTrimmed = trimmed ? trimmed : void 0;
287
- } else if (updatedAt != null) {
277
+ } else if (options.updatedAt != null) {
288
278
  throw new Error("updatedAt must be a string");
289
279
  }
290
280
  const columns = resolveColumns(options.columns);
@@ -396,10 +386,13 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
396
386
  * });
397
387
  * ```
398
388
  */
399
- all: async (options) => allInternal({
400
- currency: options == null ? void 0 : options.currency,
401
- columns: options == null ? void 0 : options.columns
402
- }),
389
+ all: async (options) => {
390
+ const res = await allInternal({
391
+ currency: options == null ? void 0 : options.currency,
392
+ columns: options == null ? void 0 : options.columns
393
+ });
394
+ return res;
395
+ },
403
396
  /**
404
397
  * Fetches products with pagination support.
405
398
  *
@@ -422,12 +415,15 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
422
415
  * const secondPage = await shop.products.paginated({ page: 2, limit: 50 });
423
416
  * ```
424
417
  */
425
- paginated: async (options) => paginatedInternal({
426
- page: options == null ? void 0 : options.page,
427
- limit: options == null ? void 0 : options.limit,
428
- currency: options == null ? void 0 : options.currency,
429
- columns: options == null ? void 0 : options.columns
430
- }),
418
+ paginated: async (options) => {
419
+ const res = await paginatedInternal({
420
+ page: options == null ? void 0 : options.page,
421
+ limit: options == null ? void 0 : options.limit,
422
+ currency: options == null ? void 0 : options.currency,
423
+ columns: options == null ? void 0 : options.columns
424
+ });
425
+ return res;
426
+ },
431
427
  /**
432
428
  * Finds a specific product by its handle.
433
429
  *
@@ -453,10 +449,13 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
453
449
  * const productWithVariant = await shop.products.find('t-shirt?variant=123');
454
450
  * ```
455
451
  */
456
- find: async (productHandle, options) => findInternal(productHandle, {
457
- currency: options == null ? void 0 : options.currency,
458
- columns: options == null ? void 0 : options.columns
459
- }),
452
+ find: async (productHandle, options) => {
453
+ const res = await findInternal(productHandle, {
454
+ currency: options == null ? void 0 : options.currency,
455
+ columns: options == null ? void 0 : options.columns
456
+ });
457
+ return res;
458
+ },
460
459
  findEnhanced: async (productHandle, options) => findEnhancedInternal(productHandle, options),
461
460
  /**
462
461
  * Enrich a product by generating merged markdown from body_html and product page.
@@ -466,9 +465,12 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
466
465
  if (!productHandle || typeof productHandle !== "string") {
467
466
  throw new Error("Product handle is required and must be a string");
468
467
  }
469
- const baseProduct = await findInternal(productHandle, {
470
- columns: { mode: "full", images: "full", options: "full" }
471
- });
468
+ const baseProduct = await findInternal(
469
+ productHandle,
470
+ {
471
+ columns: { mode: "full", images: "full", options: "full" }
472
+ }
473
+ );
472
474
  if (!baseProduct) return null;
473
475
  const handle = baseProduct.handle;
474
476
  const { enrichProduct } = await import("./ai/enrich.mjs");
@@ -490,9 +492,12 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
490
492
  if (!productHandle || typeof productHandle !== "string") {
491
493
  throw new Error("Product handle is required and must be a string");
492
494
  }
493
- const baseProduct = await findInternal(productHandle, {
494
- columns: { mode: "full", images: "full", options: "full" }
495
- });
495
+ const baseProduct = await findInternal(
496
+ productHandle,
497
+ {
498
+ columns: { mode: "full", images: "full", options: "full" }
499
+ }
500
+ );
496
501
  if (!baseProduct) throw new Error("Product not found");
497
502
  const handle = baseProduct.handle;
498
503
  const { buildEnrichPromptForProduct } = await import("./ai/enrich.mjs");
@@ -546,9 +551,12 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
546
551
  if (!productHandle || typeof productHandle !== "string") {
547
552
  throw new Error("Product handle is required and must be a string");
548
553
  }
549
- const baseProduct = await findInternal(productHandle, {
550
- columns: { mode: "full", images: "full", options: "full" }
551
- });
554
+ const baseProduct = await findInternal(
555
+ productHandle,
556
+ {
557
+ columns: { mode: "full", images: "full", options: "full" }
558
+ }
559
+ );
552
560
  if (!baseProduct) throw new Error("Product not found");
553
561
  const handle = baseProduct.handle;
554
562
  const { buildClassifyPromptForProduct } = await import("./ai/enrich.mjs");
@@ -562,9 +570,12 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
562
570
  if (!productHandle || typeof productHandle !== "string") {
563
571
  throw new Error("Product handle is required and must be a string");
564
572
  }
565
- const baseProduct = await findInternal(productHandle, {
566
- columns: { mode: "full", images: "full", options: "full" }
567
- });
573
+ const baseProduct = await findInternal(
574
+ productHandle,
575
+ {
576
+ columns: { mode: "full", images: "full", options: "full" }
577
+ }
578
+ );
568
579
  if (!baseProduct) return null;
569
580
  const payload = {
570
581
  title: baseProduct.title,
@@ -606,9 +617,12 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
606
617
  if (content) {
607
618
  return extractMainSection(content);
608
619
  }
609
- const baseProduct = await findInternal(productHandle, {
610
- columns: { mode: "full", images: "full", options: "full" }
611
- });
620
+ const baseProduct = await findInternal(
621
+ productHandle,
622
+ {
623
+ columns: { mode: "full", images: "full", options: "full" }
624
+ }
625
+ );
612
626
  if (!baseProduct) return null;
613
627
  const pageHtml = await fetchProductPage(storeDomain, baseProduct.handle);
614
628
  return extractMainSection(pageHtml);
@@ -1,5 +1,5 @@
1
1
  import { ShopInfo } from './store.js';
2
- import { d as Collection, h as CurrencyCode, P as ProductColumnsConfig, a as ProductResult, c as ShopifyCollection } from './types-C0NvqVL-.js';
2
+ import { g as Collection, a as ProductColumnsMode, b as ProductImagesMode, c as ProductOptionsMode, k as CurrencyCode, P as ProductColumnsConfig, d as ProductResult, f as ShopifyCollection } from './types-gQvOWe1Z.js';
3
3
 
4
4
  /**
5
5
  * Interface for collection operations
@@ -37,19 +37,19 @@ interface CollectionOperations {
37
37
  /**
38
38
  * Fetches products from a specific collection with pagination support.
39
39
  */
40
- paginated(collectionHandle: string, options?: {
40
+ paginated<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(collectionHandle: string, options?: {
41
41
  page?: number;
42
42
  limit?: number;
43
43
  currency?: CurrencyCode;
44
- columns?: ProductColumnsConfig;
45
- }): Promise<ProductResult[] | null>;
44
+ columns?: ProductColumnsConfig<C, I, O>;
45
+ }): Promise<ProductResult<C, I, O>[] | null>;
46
46
  /**
47
47
  * Fetches all products from a specific collection.
48
48
  */
49
- all(collectionHandle: string, options?: {
49
+ all<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(collectionHandle: string, options?: {
50
50
  currency?: CurrencyCode;
51
- columns?: ProductColumnsConfig;
52
- }): Promise<ProductResult[] | null>;
51
+ columns?: ProductColumnsConfig<C, I, O>;
52
+ }): Promise<ProductResult<C, I, O>[] | null>;
53
53
  /**
54
54
  * Fetches all product slugs from a specific collection.
55
55
  */
@@ -59,10 +59,10 @@ interface CollectionOperations {
59
59
  /**
60
60
  * Creates collection operations for a store instance
61
61
  */
62
- declare function createCollectionOperations(baseUrl: string, storeDomain: string, fetchCollections: (page: number, limit: number) => Promise<Collection[] | null>, collectionsDto: (collections: ShopifyCollection[]) => Collection[], fetchPaginatedProductsFromCollection: (collectionHandle: string, options?: {
62
+ declare function createCollectionOperations(baseUrl: string, storeDomain: string, fetchCollections: (page: number, limit: number) => Promise<Collection[] | null>, collectionsDto: (collections: ShopifyCollection[]) => Collection[], fetchPaginatedProductsFromCollection: <C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(collectionHandle: string, options?: {
63
63
  page?: number;
64
64
  limit?: number;
65
- columns?: ProductColumnsConfig;
66
- }) => Promise<ProductResult[] | null>, getStoreInfo: () => Promise<ShopInfo>, findCollection: (handle: string) => Promise<Collection | null>): CollectionOperations;
65
+ columns?: ProductColumnsConfig<C, I, O>;
66
+ }) => Promise<ProductResult<C, I, O>[] | null>, getStoreInfo: () => Promise<ShopInfo>, findCollection: (handle: string) => Promise<Collection | null>): CollectionOperations;
67
67
 
68
68
  export { type CollectionOperations, createCollectionOperations };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCollectionOperations
3
- } from "./chunk-LAJWR2GQ.mjs";
3
+ } from "./chunk-2BRLCC3V.mjs";
4
4
  import "./chunk-4GPP2KXF.mjs";
5
5
  import "./chunk-U3RQRBXZ.mjs";
6
6
  export {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as OpenRouterConfig, P as ProductColumnsConfig, C as CollectionColumnsConfig, S as ShopifyProduct, a as ProductResult, b as ShopifySingleProduct, c as ShopifyCollection, d as Collection, J as JsonLdEntry, e as StoreTypeBreakdown } from './types-C0NvqVL-.js';
2
- export { f as CountryDetectionResult, g as CountryScores, h as CurrencyCode, L as LocalizedPricing, M as MetaTag, i as Product, j as ProductImage, k as ProductOption, l as ProductVariant, m as ProductVariantImage } from './types-C0NvqVL-.js';
1
+ import { O as OpenRouterConfig, P as ProductColumnsConfig, C as CollectionColumnsConfig, a as ProductColumnsMode, b as ProductImagesMode, c as ProductOptionsMode, S as ShopifyProduct, d as ProductResult, e as ShopifySingleProduct, f as ShopifyCollection, g as Collection, J as JsonLdEntry, h as StoreTypeBreakdown } from './types-gQvOWe1Z.js';
2
+ export { i as CountryDetectionResult, j as CountryScores, k as CurrencyCode, L as LocalizedPricing, M as MetaTag, l as Product, m as ProductImage, n as ProductOption, o as ProductVariant, p as ProductVariantImage } from './types-gQvOWe1Z.js';
3
3
  import { CheckoutOperations } from './checkout.js';
4
4
  import { CollectionOperations } from './collections.js';
5
5
  import { ProductOperations } from './products.js';
@@ -85,12 +85,12 @@ declare class ShopClient {
85
85
  /**
86
86
  * Transform Shopify products to our Product format
87
87
  */
88
- productsDto(products: ShopifyProduct[], options?: {
89
- columns?: ProductColumnsConfig;
90
- }): ProductResult[] | null;
91
- productDto(product: ShopifySingleProduct, options?: {
92
- columns?: ProductColumnsConfig;
93
- }): ProductResult;
88
+ productsDto<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(products: ShopifyProduct[], options?: {
89
+ columns?: ProductColumnsConfig<C, I, O>;
90
+ }): ProductResult<C, I, O>[] | null;
91
+ productDto<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(product: ShopifySingleProduct, options?: {
92
+ columns?: ProductColumnsConfig<C, I, O>;
93
+ }): ProductResult<C, I, O>;
94
94
  collectionsDto(collections: ShopifyCollection[]): Collection[];
95
95
  /**
96
96
  * Enhanced error handling with context
package/dist/index.mjs CHANGED
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-W4SF6W2P.mjs";
4
4
  import {
5
5
  createCollectionOperations
6
- } from "./chunk-LAJWR2GQ.mjs";
6
+ } from "./chunk-2BRLCC3V.mjs";
7
7
  import {
8
8
  createProductOperations
9
- } from "./chunk-HEQDULXV.mjs";
9
+ } from "./chunk-YUS7GIF2.mjs";
10
10
  import {
11
11
  createShopOperations,
12
12
  getInfoForShop
@@ -608,7 +608,9 @@ var ShopClient = class {
608
608
  normalizeImageUrl: (url) => this.normalizeImageUrl(url),
609
609
  formatPrice: (amount) => this.formatPrice(amount)
610
610
  },
611
- { columns: (_b = options == null ? void 0 : options.columns) != null ? _b : this.productColumns }
611
+ {
612
+ columns: (_b = options == null ? void 0 : options.columns) != null ? _b : this.productColumns
613
+ }
612
614
  );
613
615
  }
614
616
  productDto(product, options) {
@@ -622,7 +624,9 @@ var ShopClient = class {
622
624
  normalizeImageUrl: (url) => this.normalizeImageUrl(url),
623
625
  formatPrice: (amount) => this.formatPrice(amount)
624
626
  },
625
- { columns: (_b = options == null ? void 0 : options.columns) != null ? _b : this.productColumns }
627
+ {
628
+ columns: (_b = options == null ? void 0 : options.columns) != null ? _b : this.productColumns
629
+ }
626
630
  );
627
631
  }
628
632
  collectionsDto(collections) {
@@ -1,5 +1,5 @@
1
1
  import { ShopInfo } from './store.js';
2
- import { h as CurrencyCode, P as ProductColumnsConfig, a as ProductResult, E as EnhancedProductResponse, i as Product, n as ProductClassification, o as SEOContent, S as ShopifyProduct, b as ShopifySingleProduct, O as OpenRouterConfig } from './types-C0NvqVL-.js';
2
+ import { a as ProductColumnsMode, b as ProductImagesMode, c as ProductOptionsMode, k as CurrencyCode, P as ProductColumnsConfig, d as ProductResult, E as EnhancedProductResponse, l as Product, q as ProductClassification, r as SEOContent, S as ShopifyProduct, e as ShopifySingleProduct, O as OpenRouterConfig } from './types-gQvOWe1Z.js';
3
3
 
4
4
  /**
5
5
  * Interface for product operations
@@ -8,26 +8,26 @@ interface ProductOperations {
8
8
  /**
9
9
  * Fetches all products from the store across all pages.
10
10
  */
11
- all(options?: {
11
+ all<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(options?: {
12
12
  currency?: CurrencyCode;
13
- columns?: ProductColumnsConfig;
14
- }): Promise<ProductResult[] | null>;
13
+ columns?: ProductColumnsConfig<C, I, O>;
14
+ }): Promise<ProductResult<C, I, O>[] | null>;
15
15
  /**
16
16
  * Fetches products with pagination support.
17
17
  */
18
- paginated(options?: {
18
+ paginated<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(options?: {
19
19
  page?: number;
20
20
  limit?: number;
21
21
  currency?: CurrencyCode;
22
- columns?: ProductColumnsConfig;
23
- }): Promise<ProductResult[] | null>;
22
+ columns?: ProductColumnsConfig<C, I, O>;
23
+ }): Promise<ProductResult<C, I, O>[] | null>;
24
24
  /**
25
25
  * Finds a specific product by its handle.
26
26
  */
27
- find(productHandle: string, options?: {
27
+ find<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(productHandle: string, options?: {
28
28
  currency?: CurrencyCode;
29
- columns?: ProductColumnsConfig;
30
- }): Promise<ProductResult | null>;
29
+ columns?: ProductColumnsConfig<C, I, O>;
30
+ }): Promise<ProductResult<C, I, O> | null>;
31
31
  /**
32
32
  * Finds a product and enhances it with AI-generated content using an external service.
33
33
  *
@@ -37,12 +37,12 @@ interface ProductOperations {
37
37
  * @param options.updatedAt - Optional product updatedAt timestamp used to cache-bust/invalidate enrichment.
38
38
  * @param options.endpoint - Optional custom endpoint URL for the enhancement service. Defaults to the standard worker URL.
39
39
  */
40
- findEnhanced(productHandle: string, options: {
40
+ findEnhanced<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(productHandle: string, options: {
41
41
  apiKey: string;
42
42
  updatedAt?: string;
43
43
  endpoint?: string;
44
- columns?: ProductColumnsConfig;
45
- }): Promise<EnhancedProductResponse<ProductResult> | null>;
44
+ columns?: ProductColumnsConfig<C, I, O>;
45
+ }): Promise<EnhancedProductResponse<ProductResult<C, I, O>> | null>;
46
46
  /**
47
47
  * Finds a product by handle and enriches its content using LLM.
48
48
  * Requires an OpenRouter API key via options.apiKey or ShopClient options.
@@ -93,9 +93,9 @@ interface ProductOperations {
93
93
  /**
94
94
  * Fetches products that are showcased/featured on the store's homepage.
95
95
  */
96
- showcased(options?: {
97
- columns?: ProductColumnsConfig;
98
- }): Promise<ProductResult[]>;
96
+ showcased<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(options?: {
97
+ columns?: ProductColumnsConfig<C, I, O>;
98
+ }): Promise<ProductResult<C, I, O>[]>;
99
99
  /**
100
100
  * Creates a filter map of variant options and their distinct values from all products.
101
101
  */
@@ -103,36 +103,36 @@ interface ProductOperations {
103
103
  /**
104
104
  * Predictive product search using Shopify Ajax API.
105
105
  */
106
- predictiveSearch(query: string, options?: {
106
+ predictiveSearch<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(query: string, options?: {
107
107
  limit?: number;
108
108
  locale?: string;
109
109
  currency?: CurrencyCode;
110
110
  unavailableProducts?: "show" | "hide" | "last";
111
- columns?: ProductColumnsConfig;
112
- }): Promise<ProductResult[]>;
111
+ columns?: ProductColumnsConfig<C, I, O>;
112
+ }): Promise<ProductResult<C, I, O>[]>;
113
113
  /**
114
114
  * Product recommendations for a given product ID using Shopify Ajax API.
115
115
  */
116
- recommendations(productId: number, options?: {
116
+ recommendations<C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(productId: number, options?: {
117
117
  limit?: number;
118
118
  intent?: "related" | "complementary";
119
119
  locale?: string;
120
120
  currency?: CurrencyCode;
121
- columns?: ProductColumnsConfig;
122
- }): Promise<ProductResult[] | null>;
121
+ columns?: ProductColumnsConfig<C, I, O>;
122
+ }): Promise<ProductResult<C, I, O>[] | null>;
123
123
  }
124
124
  /**
125
125
  * Creates product operations for a store instance
126
126
  */
127
- declare function createProductOperations(baseUrl: string, storeDomain: string, fetchProducts: (page: number, limit: number, options?: {
128
- columns?: ProductColumnsConfig;
129
- }) => Promise<ProductResult[] | null>, productsDto: (products: ShopifyProduct[], options?: {
130
- columns?: ProductColumnsConfig;
131
- }) => ProductResult[] | null, productDto: (product: ShopifySingleProduct, options?: {
132
- columns?: ProductColumnsConfig;
133
- }) => ProductResult, getStoreInfo: () => Promise<ShopInfo>, _findProduct: (handle: string, options?: {
134
- columns?: ProductColumnsConfig;
135
- }) => Promise<ProductResult | null>, getDefaultProductColumns: () => ProductColumnsConfig, ai?: {
127
+ declare function createProductOperations(baseUrl: string, storeDomain: string, fetchProducts: <C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(page: number, limit: number, options?: {
128
+ columns?: ProductColumnsConfig<C, I, O>;
129
+ }) => Promise<ProductResult<C, I, O>[] | null>, productsDto: <C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(products: ShopifyProduct[], options?: {
130
+ columns?: ProductColumnsConfig<C, I, O>;
131
+ }) => ProductResult<C, I, O>[] | null, productDto: <C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(product: ShopifySingleProduct, options?: {
132
+ columns?: ProductColumnsConfig<C, I, O>;
133
+ }) => ProductResult<C, I, O>, getStoreInfo: () => Promise<ShopInfo>, _findProduct: <C extends ProductColumnsMode = "minimal", I extends ProductImagesMode = "minimal", O extends ProductOptionsMode = "minimal">(handle: string, options?: {
134
+ columns?: ProductColumnsConfig<C, I, O>;
135
+ }) => Promise<ProductResult<C, I, O> | null>, getDefaultProductColumns: () => ProductColumnsConfig, ai?: {
136
136
  openRouter?: OpenRouterConfig;
137
137
  }): ProductOperations;
138
138
 
package/dist/products.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createProductOperations
3
- } from "./chunk-HEQDULXV.mjs";
3
+ } from "./chunk-YUS7GIF2.mjs";
4
4
  import "./chunk-4GPP2KXF.mjs";
5
5
  import "./chunk-U3RQRBXZ.mjs";
6
6
  export {
package/dist/store.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { J as JsonLdEntry, f as CountryDetectionResult, h as CurrencyCode } from './types-C0NvqVL-.js';
1
+ import { J as JsonLdEntry, i as CountryDetectionResult, k as CurrencyCode } from './types-gQvOWe1Z.js';
2
2
 
3
3
  /**
4
4
  * Store operations interface for managing store-related functionality.
@@ -519,4 +519,4 @@ type EnhancedProductResponse<TProduct = Product> = {
519
519
  };
520
520
  type StoreTypeBreakdown = Partial<Record<"adult_male" | "adult_female" | "kid_male" | "kid_female" | "generic", Partial<Record<"clothing" | "beauty" | "accessories" | "home-decor" | "food-and-beverages", string[]>>>>;
521
521
 
522
- export type { CollectionColumnsConfig as C, EnhancedProductResponse as E, JsonLdEntry as J, LocalizedPricing as L, MetaTag as M, OpenRouterConfig as O, ProductColumnsConfig as P, ShopifyProduct as S, ProductResult as a, ShopifySingleProduct as b, ShopifyCollection as c, Collection as d, StoreTypeBreakdown as e, CountryDetectionResult as f, CountryScores as g, CurrencyCode as h, Product as i, ProductImage as j, ProductOption as k, ProductVariant as l, ProductVariantImage as m, ProductClassification as n, SEOContent as o, SystemUserPrompt as p };
522
+ export type { CollectionColumnsConfig as C, EnhancedProductResponse as E, JsonLdEntry as J, LocalizedPricing as L, MetaTag as M, OpenRouterConfig as O, ProductColumnsConfig as P, ShopifyProduct as S, ProductColumnsMode as a, ProductImagesMode as b, ProductOptionsMode as c, ProductResult as d, ShopifySingleProduct as e, ShopifyCollection as f, Collection as g, StoreTypeBreakdown as h, CountryDetectionResult as i, CountryScores as j, CurrencyCode as k, Product as l, ProductImage as m, ProductOption as n, ProductVariant as o, ProductVariantImage as p, ProductClassification as q, SEOContent as r, SystemUserPrompt as s };
@@ -1,4 +1,4 @@
1
- import { f as CountryDetectionResult } from '../types-C0NvqVL-.js';
1
+ import { i as CountryDetectionResult } from '../types-gQvOWe1Z.js';
2
2
 
3
3
  /**
4
4
  * Detects the country of a Shopify store by analyzing various signals in the HTML content.
@@ -1,4 +1,4 @@
1
- import { h as CurrencyCode } from '../types-C0NvqVL-.js';
1
+ import { k as CurrencyCode } from '../types-gQvOWe1Z.js';
2
2
 
3
3
  declare function extractDomainWithoutSuffix(domain: string): string | null;
4
4
  declare function generateStoreSlug(domain: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shop-client",
3
- "version": "3.23.0",
3
+ "version": "3.24.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",