shop-client 3.12.0 → 3.13.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 +40 -10
- package/dist/{chunk-VK5666EK.mjs → chunk-CUL7ZM2W.mjs} +1 -0
- package/dist/index.mjs +1 -1
- package/dist/store.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Shop
|
|
1
|
+
# Shop Client
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/shop-client)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
@@ -205,17 +205,8 @@ Notes:
|
|
|
205
205
|
|
|
206
206
|
### Migration: Barrel → Subpath Imports
|
|
207
207
|
|
|
208
|
-
#### Package Rename: `shop-search` → `shop-client` (v3.8.2)
|
|
209
|
-
- Install: `npm i shop-client` (replaces `shop-search`)
|
|
210
|
-
- Update imports to `shop-client` (API unchanged)
|
|
211
|
-
|
|
212
208
|
TypeScript:
|
|
213
209
|
```ts
|
|
214
|
-
// Before (pre-rename: shop-search)
|
|
215
|
-
import { Store } from 'shop-search';
|
|
216
|
-
const store = new Store("your-store.myshopify.com");
|
|
217
|
-
|
|
218
|
-
// After (post-rename: shop-client v3.8.2+)
|
|
219
210
|
import { ShopClient } from 'shop-client';
|
|
220
211
|
const client = new ShopClient("your-store.myshopify.com");
|
|
221
212
|
```
|
|
@@ -354,6 +345,8 @@ const storeInfo = await shop.getInfo();
|
|
|
354
345
|
- `headerLinks`: Navigation menu links
|
|
355
346
|
- `showcase`: Featured products and collections
|
|
356
347
|
- `jsonLdData`: Structured data from the store
|
|
348
|
+
- `country`: ISO 3166-1 alpha-2 code (e.g., `US`, `GB`)
|
|
349
|
+
- `currency`: ISO 4217 currency code (e.g., `USD`, `EUR`)
|
|
357
350
|
|
|
358
351
|
### Products
|
|
359
352
|
|
|
@@ -444,6 +437,43 @@ Object.entries(filters || {}).forEach(([optionName, values]) => {
|
|
|
444
437
|
- Handles products with multiple variant options
|
|
445
438
|
- Returns empty object `{}` if no products have variants
|
|
446
439
|
|
|
440
|
+
### Predictive Search
|
|
441
|
+
|
|
442
|
+
#### `products.predictiveSearch(query, options?)`
|
|
443
|
+
|
|
444
|
+
Locale-aware Shopify Ajax predictive search for products.
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
const results = await shop.products.predictiveSearch("dress", {
|
|
448
|
+
limit: 10, // clamps 1–10
|
|
449
|
+
locale: "en", // defaults to "en"
|
|
450
|
+
// unavailableProducts defaults to "hide"
|
|
451
|
+
currency: "USD", // optional override
|
|
452
|
+
});
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
- Hides unavailable items by default
|
|
456
|
+
- Extracts handles from Ajax results, fetches full products via `find`
|
|
457
|
+
- Falls back to non-locale path when locale returns 404/417
|
|
458
|
+
|
|
459
|
+
### Recommendations
|
|
460
|
+
|
|
461
|
+
#### `products.recommendations(productId, options?)`
|
|
462
|
+
|
|
463
|
+
Shopify Ajax product recommendations for a given product.
|
|
464
|
+
|
|
465
|
+
```typescript
|
|
466
|
+
const recos = await shop.products.recommendations(1234567890, {
|
|
467
|
+
limit: 6, // clamps 1–10 (default 10)
|
|
468
|
+
intent: "related", // or "complementary" (default: related)
|
|
469
|
+
locale: "en", // defaults to "en"
|
|
470
|
+
currency: "USD", // optional override
|
|
471
|
+
});
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
- Returns normalized `Product[]`
|
|
475
|
+
- Locale-aware endpoint `/{locale}/recommendations/products.json`
|
|
476
|
+
|
|
447
477
|
### Collections
|
|
448
478
|
|
|
449
479
|
#### `collections.all()`
|
|
@@ -219,6 +219,7 @@ function createStoreOperations(context) {
|
|
|
219
219
|
* - `jsonLdData` - Structured data from JSON-LD scripts
|
|
220
220
|
* - `techProvider` - Shopify-specific information (walletId, subDomain)
|
|
221
221
|
* - `country` - Country detection results with ISO 3166-1 alpha-2 codes (e.g., "US", "GB")
|
|
222
|
+
* - `currency` - ISO 4217 currency code inferred from store (e.g., "USD")
|
|
222
223
|
*
|
|
223
224
|
* @throws {Error} When the store URL is unreachable or returns an error
|
|
224
225
|
*
|
package/dist/index.mjs
CHANGED
package/dist/store.mjs
CHANGED