shop-client 3.9.0 → 3.9.2
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 +65 -0
- package/dist/ai/enrich.d.ts +93 -0
- package/dist/ai/enrich.js +25 -0
- package/dist/checkout.js +6 -0
- package/dist/chunk-2MF53V33.js +196 -0
- package/dist/chunk-CN7L3BHG.js +147 -0
- package/dist/chunk-CXUCPK6X.js +460 -0
- package/dist/chunk-DJQEZNHG.js +233 -0
- package/dist/chunk-MOBWPEY4.js +420 -0
- package/dist/chunk-QUDGES3A.js +195 -0
- package/dist/chunk-RR6YTQWP.js +90 -0
- package/dist/chunk-VPPCOJC3.js +865 -0
- package/dist/collections.d.ts +2 -1
- package/dist/collections.js +8 -0
- package/dist/index.d.ts +7 -84
- package/dist/index.js +753 -0
- package/dist/products.d.ts +2 -1
- package/dist/products.js +8 -0
- package/dist/store.d.ts +53 -1
- package/dist/store.js +9 -0
- package/dist/{store-iQARl6J3.d.ts → types-luPg5O08.d.ts} +1 -208
- package/dist/utils/detect-country.d.ts +32 -0
- package/dist/utils/detect-country.js +6 -0
- package/dist/utils/func.d.ts +61 -0
- package/dist/utils/func.js +24 -0
- package/dist/utils/rate-limit.js +10 -0
- package/package.json +16 -3
- package/dist/checkout.mjs +0 -1
- package/dist/chunk-6GPWNCDO.mjs +0 -130
- package/dist/chunk-EJO5U4BT.mjs +0 -2
- package/dist/chunk-FFKWCNLU.mjs +0 -1
- package/dist/chunk-KYLPIEU3.mjs +0 -2
- package/dist/chunk-MB2INNNP.mjs +0 -1
- package/dist/chunk-MI7754VX.mjs +0 -2
- package/dist/chunk-SZQPMLZG.mjs +0 -1
- package/dist/collections.mjs +0 -1
- package/dist/enrich-OZHBXKK6.mjs +0 -1
- package/dist/index.mjs +0 -2
- package/dist/products.mjs +0 -1
- package/dist/store.mjs +0 -1
- package/dist/utils/rate-limit.mjs +0 -1
package/dist/products.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StoreInfo } from './store.js';
|
|
2
|
+
import { f as CurrencyCode, P as Product, k as ProductClassification, l as SEOContent, S as ShopifyProduct, a as ShopifySingleProduct } from './types-luPg5O08.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Interface for product operations
|
package/dist/products.js
ADDED
package/dist/store.d.ts
CHANGED
|
@@ -1 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
import { J as JsonLdEntry, d as CountryDetectionResult } from './types-luPg5O08.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Store operations interface for managing store-related functionality.
|
|
5
|
+
* Provides methods to fetch comprehensive store information and metadata.
|
|
6
|
+
*/
|
|
7
|
+
interface StoreOperations {
|
|
8
|
+
info(): Promise<StoreInfo>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Comprehensive store information structure returned by the info method.
|
|
12
|
+
* Contains all metadata, branding, social links, and showcase content for a Shopify store.
|
|
13
|
+
*/
|
|
14
|
+
interface StoreInfo {
|
|
15
|
+
name: string;
|
|
16
|
+
domain: string;
|
|
17
|
+
slug: string;
|
|
18
|
+
title: string | null;
|
|
19
|
+
description: string | null;
|
|
20
|
+
logoUrl: string | null;
|
|
21
|
+
socialLinks: Record<string, string>;
|
|
22
|
+
contactLinks: {
|
|
23
|
+
tel: string | null;
|
|
24
|
+
email: string | null;
|
|
25
|
+
contactPage: string | null;
|
|
26
|
+
};
|
|
27
|
+
headerLinks: string[];
|
|
28
|
+
showcase: {
|
|
29
|
+
products: string[];
|
|
30
|
+
collections: string[];
|
|
31
|
+
};
|
|
32
|
+
jsonLdData: JsonLdEntry[] | undefined;
|
|
33
|
+
techProvider: {
|
|
34
|
+
name: string;
|
|
35
|
+
walletId: string | undefined;
|
|
36
|
+
subDomain: string | null;
|
|
37
|
+
};
|
|
38
|
+
country: CountryDetectionResult["country"];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates store operations for a ShopClient instance.
|
|
42
|
+
* @param context - ShopClient context containing necessary methods and properties for store operations
|
|
43
|
+
*/
|
|
44
|
+
declare function createStoreOperations(context: {
|
|
45
|
+
baseUrl: string;
|
|
46
|
+
storeDomain: string;
|
|
47
|
+
validateProductExists: (handle: string) => Promise<boolean>;
|
|
48
|
+
validateCollectionExists: (handle: string) => Promise<boolean>;
|
|
49
|
+
validateLinksInBatches: <T>(items: T[], validator: (item: T) => Promise<boolean>, batchSize?: number) => Promise<T[]>;
|
|
50
|
+
handleFetchError: (error: unknown, context: string, url: string) => never;
|
|
51
|
+
}): StoreOperations;
|
|
52
|
+
|
|
53
|
+
export { type StoreInfo, type StoreOperations, createStoreOperations };
|
package/dist/store.js
ADDED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Type definitions for the shop-client package.
|
|
3
|
-
*
|
|
4
|
-
* This file contains all TypeScript type definitions used throughout the shop-client library,
|
|
5
|
-
* including Shopify API response types, normalized product/collection types, and utility types.
|
|
6
|
-
*
|
|
7
|
-
* @author shop-client
|
|
8
|
-
*/
|
|
9
|
-
type RequireAtLeastOne<T> = {
|
|
10
|
-
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
|
|
11
|
-
}[keyof T];
|
|
12
|
-
/**
|
|
13
|
-
* Supported audience demographics for product categorization.
|
|
14
|
-
*/
|
|
15
|
-
type Audience = "adult_male" | "adult_female" | "kid_male" | "kid_female" | "adult_unisex" | "kid_unisex";
|
|
16
|
-
/**
|
|
17
|
-
* Product category structure for organizing store inventory.
|
|
18
|
-
*/
|
|
19
|
-
type Category = {
|
|
20
|
-
clothing?: string[];
|
|
21
|
-
jewellery?: string[];
|
|
22
|
-
accessories?: string[];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Special category for non-demographic specific products.
|
|
26
|
-
*/
|
|
27
|
-
type NoneCategory = {
|
|
28
|
-
home_decor: string[];
|
|
29
|
-
accessories: string[];
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Complete store catalog structure with demographic-based categorization.
|
|
33
|
-
*/
|
|
34
|
-
type StoreCatalog = RequireAtLeastOne<{
|
|
35
|
-
[K in Audience]: RequireAtLeastOne<Category>;
|
|
36
|
-
}> & {
|
|
37
|
-
none: RequireAtLeastOne<NoneCategory>;
|
|
38
|
-
};
|
|
39
1
|
/**
|
|
40
2
|
* Base timestamp fields used across Shopify entities.
|
|
41
3
|
*/
|
|
@@ -183,10 +145,6 @@ type ShopifyProduct = ShopifyBaseProduct & {
|
|
|
183
145
|
variants: ShopifyProductVariant[];
|
|
184
146
|
images: ShopifyImage[];
|
|
185
147
|
};
|
|
186
|
-
/**
|
|
187
|
-
* Alias for ShopifyProduct with store context.
|
|
188
|
-
*/
|
|
189
|
-
type ShopifyProductAndStore = ShopifyProduct;
|
|
190
148
|
/**
|
|
191
149
|
* Enhanced single product structure with additional pricing and availability data.
|
|
192
150
|
*/
|
|
@@ -212,33 +170,6 @@ type ShopifySingleProduct = ShopifyBaseProduct & {
|
|
|
212
170
|
requires_selling_plan?: boolean;
|
|
213
171
|
selling_plan_groups?: string[];
|
|
214
172
|
};
|
|
215
|
-
/**
|
|
216
|
-
* Shopify predictive search API response structure.
|
|
217
|
-
*/
|
|
218
|
-
type ShopifyPredictiveProductSearch = {
|
|
219
|
-
resources: {
|
|
220
|
-
results: {
|
|
221
|
-
products: Array<Omit<ShopifySingleProduct, "description"> & {
|
|
222
|
-
body: string;
|
|
223
|
-
}>;
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* Normalized pricing information for products.
|
|
229
|
-
*/
|
|
230
|
-
type ProductPricing = {
|
|
231
|
-
price: number;
|
|
232
|
-
priceMin: number;
|
|
233
|
-
priceMax: number;
|
|
234
|
-
priceVaries: boolean;
|
|
235
|
-
compareAtPrice: number;
|
|
236
|
-
compareAtPriceMin: number;
|
|
237
|
-
compareAtPriceMax: number;
|
|
238
|
-
compareAtPriceVaries: boolean;
|
|
239
|
-
discount: number;
|
|
240
|
-
currency?: string;
|
|
241
|
-
};
|
|
242
173
|
/**
|
|
243
174
|
* Localized/display pricing with currency-aware formatted strings.
|
|
244
175
|
*/
|
|
@@ -377,80 +308,6 @@ type Product = {
|
|
|
377
308
|
variantOptionsMap: Record<string, string>;
|
|
378
309
|
enriched_content?: string;
|
|
379
310
|
};
|
|
380
|
-
/**
|
|
381
|
-
* Alternative product structure for API responses with normalized field names.
|
|
382
|
-
*/
|
|
383
|
-
type ShopifyApiProduct = ShopifyBasicInfo & {
|
|
384
|
-
bodyHtml: string;
|
|
385
|
-
body?: string | undefined;
|
|
386
|
-
publishedAt: string;
|
|
387
|
-
createdAt?: string | undefined;
|
|
388
|
-
updatedAt?: string | undefined;
|
|
389
|
-
vendor: string;
|
|
390
|
-
productType: string;
|
|
391
|
-
tags: string[];
|
|
392
|
-
variants: (Omit<ShopifyBaseVariant, "id"> & {
|
|
393
|
-
id: number;
|
|
394
|
-
name?: string | undefined;
|
|
395
|
-
title: string;
|
|
396
|
-
featuredImage: ProductVariantImage | null;
|
|
397
|
-
available: boolean;
|
|
398
|
-
price: number;
|
|
399
|
-
weightInGrams?: number | undefined;
|
|
400
|
-
compareAtPrice: number;
|
|
401
|
-
position: number;
|
|
402
|
-
productId: number;
|
|
403
|
-
createdAt?: string | undefined;
|
|
404
|
-
updatedAt?: string | undefined;
|
|
405
|
-
})[];
|
|
406
|
-
images: ProductImage[];
|
|
407
|
-
options: ShopifyOption[];
|
|
408
|
-
};
|
|
409
|
-
/**
|
|
410
|
-
* Product category structure for store catalogs.
|
|
411
|
-
*/
|
|
412
|
-
type CatalogCategory = {
|
|
413
|
-
clothing?: string[] | undefined;
|
|
414
|
-
jewellery?: string[] | undefined;
|
|
415
|
-
accessories?: string[] | undefined;
|
|
416
|
-
};
|
|
417
|
-
/**
|
|
418
|
-
* Demographic categories for product targeting.
|
|
419
|
-
*/
|
|
420
|
-
type Demographics = "adult_male" | "adult_female" | "adult_unisex" | "kid_male" | "kid_female" | "kid_unisex";
|
|
421
|
-
/**
|
|
422
|
-
* Valid store catalog structure with demographic-based organization.
|
|
423
|
-
*/
|
|
424
|
-
type ValidStoreCatalog = {
|
|
425
|
-
[key in Demographics]?: CatalogCategory | undefined;
|
|
426
|
-
};
|
|
427
|
-
/**
|
|
428
|
-
* Physical address structure for shipping and contact information.
|
|
429
|
-
*/
|
|
430
|
-
type Address = {
|
|
431
|
-
addressLine1: string;
|
|
432
|
-
addressLine2?: string | undefined;
|
|
433
|
-
city: string;
|
|
434
|
-
state: string;
|
|
435
|
-
code: string;
|
|
436
|
-
country: string;
|
|
437
|
-
label?: string | undefined;
|
|
438
|
-
};
|
|
439
|
-
/**
|
|
440
|
-
* Contact URL structure for store communication channels.
|
|
441
|
-
*/
|
|
442
|
-
type ContactUrls = {
|
|
443
|
-
whatsapp?: string | undefined;
|
|
444
|
-
tel?: string | undefined;
|
|
445
|
-
email?: string | undefined;
|
|
446
|
-
};
|
|
447
|
-
/**
|
|
448
|
-
* Coupon/discount code structure.
|
|
449
|
-
*/
|
|
450
|
-
type Coupon = {
|
|
451
|
-
label: string;
|
|
452
|
-
description?: string | undefined;
|
|
453
|
-
};
|
|
454
311
|
/**
|
|
455
312
|
* Shopify collection structure from API responses.
|
|
456
313
|
*/
|
|
@@ -503,15 +360,6 @@ type CountryScore = {
|
|
|
503
360
|
type CountryScores = {
|
|
504
361
|
[country: string]: CountryScore;
|
|
505
362
|
};
|
|
506
|
-
/**
|
|
507
|
-
* Shopify features data structure from script tags.
|
|
508
|
-
*/
|
|
509
|
-
type ShopifyFeaturesData = {
|
|
510
|
-
country?: string;
|
|
511
|
-
locale?: string;
|
|
512
|
-
moneyFormat?: string;
|
|
513
|
-
[key: string]: unknown;
|
|
514
|
-
};
|
|
515
363
|
type JsonLdEntry = Record<string, unknown>;
|
|
516
364
|
type Collection = {
|
|
517
365
|
id: string;
|
|
@@ -548,61 +396,6 @@ type SEOContent = {
|
|
|
548
396
|
tags: string[];
|
|
549
397
|
marketingCopy: string;
|
|
550
398
|
};
|
|
551
|
-
type StoreTypeResult = {
|
|
552
|
-
vertical: "clothing" | "beauty" | "accessories" | "home-decor" | "food-and-beverages";
|
|
553
|
-
audience: "adult_male" | "adult_female" | "kid_male" | "kid_female" | "generic";
|
|
554
|
-
reason: string;
|
|
555
|
-
};
|
|
556
399
|
type StoreTypeBreakdown = Partial<Record<"adult_male" | "adult_female" | "kid_male" | "kid_female" | "generic", Partial<Record<"clothing" | "beauty" | "accessories" | "home-decor" | "food-and-beverages", string[]>>>>;
|
|
557
400
|
|
|
558
|
-
|
|
559
|
-
* Store operations interface for managing store-related functionality.
|
|
560
|
-
* Provides methods to fetch comprehensive store information and metadata.
|
|
561
|
-
*/
|
|
562
|
-
interface StoreOperations {
|
|
563
|
-
info(): Promise<StoreInfo>;
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Comprehensive store information structure returned by the info method.
|
|
567
|
-
* Contains all metadata, branding, social links, and showcase content for a Shopify store.
|
|
568
|
-
*/
|
|
569
|
-
interface StoreInfo {
|
|
570
|
-
name: string;
|
|
571
|
-
domain: string;
|
|
572
|
-
slug: string;
|
|
573
|
-
title: string | null;
|
|
574
|
-
description: string | null;
|
|
575
|
-
logoUrl: string | null;
|
|
576
|
-
socialLinks: Record<string, string>;
|
|
577
|
-
contactLinks: {
|
|
578
|
-
tel: string | null;
|
|
579
|
-
email: string | null;
|
|
580
|
-
contactPage: string | null;
|
|
581
|
-
};
|
|
582
|
-
headerLinks: string[];
|
|
583
|
-
showcase: {
|
|
584
|
-
products: string[];
|
|
585
|
-
collections: string[];
|
|
586
|
-
};
|
|
587
|
-
jsonLdData: JsonLdEntry[] | undefined;
|
|
588
|
-
techProvider: {
|
|
589
|
-
name: string;
|
|
590
|
-
walletId: string | undefined;
|
|
591
|
-
subDomain: string | null;
|
|
592
|
-
};
|
|
593
|
-
country: CountryDetectionResult["country"];
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Creates store operations for a ShopClient instance.
|
|
597
|
-
* @param context - ShopClient context containing necessary methods and properties for store operations
|
|
598
|
-
*/
|
|
599
|
-
declare function createStoreOperations(context: {
|
|
600
|
-
baseUrl: string;
|
|
601
|
-
storeDomain: string;
|
|
602
|
-
validateProductExists: (handle: string) => Promise<boolean>;
|
|
603
|
-
validateCollectionExists: (handle: string) => Promise<boolean>;
|
|
604
|
-
validateLinksInBatches: <T>(items: T[], validator: (item: T) => Promise<boolean>, batchSize?: number) => Promise<T[]>;
|
|
605
|
-
handleFetchError: (error: unknown, context: string, url: string) => never;
|
|
606
|
-
}): StoreOperations;
|
|
607
|
-
|
|
608
|
-
export { type ProductVariantImage as A, type ProductVariant as B, type CountryDetectionResult as C, type ProductImage as D, type ShopifyApiProduct as E, type CatalogCategory as F, type Demographics as G, type Address as H, type ContactUrls as I, type Coupon as J, type CountryScore as K, type LocalizedPricing as L, type MetaTag as M, type CountryScores as N, type ShopifyFeaturesData as O, type ProductClassification as P, type JsonLdEntry as Q, type StoreTypeResult as R, type SEOContent as S, createStoreOperations as T, type ValidStoreCatalog as V, type StoreOperations as a, type ShopifyProduct as b, type Product as c, type ShopifySingleProduct as d, type ShopifyCollection as e, type Collection as f, type StoreInfo as g, type StoreTypeBreakdown as h, type StoreCatalog as i, type ShopifyTimestamps as j, type ShopifyBasicInfo as k, type ShopifyImageDimensions as l, type ShopifyImage as m, type ShopifyVariantImage as n, type ShopifyFeaturedMedia as o, type ShopifyMedia as p, type ShopifyOption as q, type ShopifyBaseVariant as r, type ShopifyProductVariant as s, type ShopifySingleProductVariant as t, type ShopifyBaseProduct as u, type ShopifyProductAndStore as v, type ShopifyPredictiveProductSearch as w, type ProductPricing as x, type CurrencyCode as y, type ProductOption as z };
|
|
401
|
+
export type { Collection as C, JsonLdEntry as J, LocalizedPricing as L, MetaTag as M, Product as P, ShopifyProduct as S, ShopifySingleProduct as a, ShopifyCollection as b, StoreTypeBreakdown as c, CountryDetectionResult as d, CountryScores as e, CurrencyCode as f, ProductImage as g, ProductOption as h, ProductVariant as i, ProductVariantImage as j, ProductClassification as k, SEOContent as l };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { d as CountryDetectionResult } from '../types-luPg5O08.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Detects the country of a Shopify store by analyzing various signals in the HTML content.
|
|
5
|
+
*
|
|
6
|
+
* This function examines multiple data sources within the HTML to determine the store's country:
|
|
7
|
+
* - Shopify features JSON data (country, locale, money format)
|
|
8
|
+
* - Phone number prefixes in contact information
|
|
9
|
+
* - JSON-LD structured data with address information
|
|
10
|
+
* - Footer mentions of country names
|
|
11
|
+
* - Currency symbols in money formatting
|
|
12
|
+
*
|
|
13
|
+
* @param html - The HTML content of the Shopify store's homepage
|
|
14
|
+
* @returns Promise resolving to country detection results containing:
|
|
15
|
+
* - `country` - The detected country ISO 3166-1 alpha-2 code (e.g., "US", "GB") or "Unknown" if no reliable detection
|
|
16
|
+
* - `confidence` - Confidence score between 0 and 1 (higher = more confident)
|
|
17
|
+
* - `signals` - Array of detection signals that contributed to the result
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const response = await fetch('https://exampleshop.com');
|
|
22
|
+
* const html = await response.text();
|
|
23
|
+
* const result = await detectShopifyCountry(html);
|
|
24
|
+
*
|
|
25
|
+
* console.log(result.country); // "US" (ISO code for United States)
|
|
26
|
+
* console.log(result.confidence); // 0.85
|
|
27
|
+
* console.log(result.signals); // ["shopify-features.country", "phone prefix +1"]
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function detectShopCountry(html: string): Promise<CountryDetectionResult>;
|
|
31
|
+
|
|
32
|
+
export { detectShopCountry };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { f as CurrencyCode } from '../types-luPg5O08.js';
|
|
2
|
+
|
|
3
|
+
declare function extractDomainWithoutSuffix(domain: string): string | null;
|
|
4
|
+
declare function generateStoreSlug(domain: string): string;
|
|
5
|
+
declare const genProductSlug: ({ handle, storeDomain, }: {
|
|
6
|
+
handle: string;
|
|
7
|
+
storeDomain: string;
|
|
8
|
+
}) => string;
|
|
9
|
+
declare const calculateDiscount: (price: number, compareAtPrice?: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Normalize and sanitize a domain string.
|
|
12
|
+
*
|
|
13
|
+
* Accepts inputs like full URLs, protocol-relative URLs, bare hostnames,
|
|
14
|
+
* or strings with paths/query/fragment, and returns a normalized domain.
|
|
15
|
+
*
|
|
16
|
+
* Examples:
|
|
17
|
+
* - "https://WWW.Example.com/path" -> "example.com"
|
|
18
|
+
* - "//sub.example.co.uk" -> "example.co.uk"
|
|
19
|
+
* - "www.example.com:8080" -> "example.com"
|
|
20
|
+
* - "example" -> "example"
|
|
21
|
+
*/
|
|
22
|
+
declare function sanitizeDomain(input: string, opts?: {
|
|
23
|
+
stripWWW?: boolean;
|
|
24
|
+
}): string;
|
|
25
|
+
/**
|
|
26
|
+
* Safely parse a date string into a Date object.
|
|
27
|
+
*
|
|
28
|
+
* Returns `undefined` when input is falsy or cannot be parsed into a valid date.
|
|
29
|
+
* Use `|| null` at call sites that expect `null` instead of `undefined`.
|
|
30
|
+
*/
|
|
31
|
+
declare function safeParseDate(input?: string | null): Date | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Normalize an option name or value to a lowercase, underscore-separated key.
|
|
34
|
+
*/
|
|
35
|
+
declare function normalizeKey(input: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Build a map from normalized option combination → variant id strings.
|
|
38
|
+
* Example key: `size#xl##color#blue`.
|
|
39
|
+
*/
|
|
40
|
+
declare function buildVariantOptionsMap(optionNames: string[], variants: Array<{
|
|
41
|
+
id: number;
|
|
42
|
+
option1: string | null;
|
|
43
|
+
option2: string | null;
|
|
44
|
+
option3: string | null;
|
|
45
|
+
}>): Record<string, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Build a normalized variant key string from an object of option name → value.
|
|
48
|
+
* - Normalizes both names and values using `normalizeKey`
|
|
49
|
+
* - Sorts parts alphabetically for deterministic output
|
|
50
|
+
* - Joins parts using `##` and uses `name#value` for each part
|
|
51
|
+
*
|
|
52
|
+
* Example output: `color#blue##size#xl`
|
|
53
|
+
*/
|
|
54
|
+
declare function buildVariantKey(obj: Record<string, string | null | undefined>): string;
|
|
55
|
+
/**
|
|
56
|
+
* Format a price amount (in cents) using a given ISO 4217 currency code.
|
|
57
|
+
* Falls back to a simple string when Intl formatting fails.
|
|
58
|
+
*/
|
|
59
|
+
declare function formatPrice(amountInCents: number, currency: CurrencyCode): string;
|
|
60
|
+
|
|
61
|
+
export { buildVariantKey, buildVariantOptionsMap, calculateDiscount, extractDomainWithoutSuffix, formatPrice, genProductSlug, generateStoreSlug, normalizeKey, safeParseDate, sanitizeDomain };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildVariantKey,
|
|
3
|
+
buildVariantOptionsMap,
|
|
4
|
+
calculateDiscount,
|
|
5
|
+
extractDomainWithoutSuffix,
|
|
6
|
+
formatPrice,
|
|
7
|
+
genProductSlug,
|
|
8
|
+
generateStoreSlug,
|
|
9
|
+
normalizeKey,
|
|
10
|
+
safeParseDate,
|
|
11
|
+
sanitizeDomain
|
|
12
|
+
} from "../chunk-CN7L3BHG.js";
|
|
13
|
+
export {
|
|
14
|
+
buildVariantKey,
|
|
15
|
+
buildVariantOptionsMap,
|
|
16
|
+
calculateDiscount,
|
|
17
|
+
extractDomainWithoutSuffix,
|
|
18
|
+
formatPrice,
|
|
19
|
+
genProductSlug,
|
|
20
|
+
generateStoreSlug,
|
|
21
|
+
normalizeKey,
|
|
22
|
+
safeParseDate,
|
|
23
|
+
sanitizeDomain
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shop-client",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"import": "./dist/index.mjs",
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
12
|
},
|
|
13
|
+
"./enrich": {
|
|
14
|
+
"import": "./dist/ai/enrich.mjs",
|
|
15
|
+
"types": "./dist/ai/enrich.d.ts"
|
|
16
|
+
},
|
|
13
17
|
"./products": {
|
|
14
18
|
"import": "./dist/products.mjs",
|
|
15
19
|
"types": "./dist/products.d.ts"
|
|
@@ -29,6 +33,14 @@
|
|
|
29
33
|
"./rate-limit": {
|
|
30
34
|
"import": "./dist/utils/rate-limit.mjs",
|
|
31
35
|
"types": "./dist/utils/rate-limit.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./func": {
|
|
38
|
+
"import": "./dist/utils/func.mjs",
|
|
39
|
+
"types": "./dist/utils/func.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./detect-country": {
|
|
42
|
+
"import": "./dist/utils/detect-country.mjs",
|
|
43
|
+
"types": "./dist/utils/detect-country.d.ts"
|
|
32
44
|
}
|
|
33
45
|
},
|
|
34
46
|
"sideEffects": false,
|
|
@@ -46,6 +58,7 @@
|
|
|
46
58
|
"test": "bun test",
|
|
47
59
|
"test:ci": "bun test --coverage",
|
|
48
60
|
"docs:build": "typedoc",
|
|
61
|
+
"docs:site": "typedoc --options typedoc.pages.json",
|
|
49
62
|
"semantic-release": "semantic-release",
|
|
50
63
|
"format": "biome format --write --no-errors-on-unmatched",
|
|
51
64
|
"lint": "biome lint --diagnostic-level=error --no-errors-on-unmatched . && tsc --noEmit -p tsconfig.json",
|
|
@@ -88,8 +101,8 @@
|
|
|
88
101
|
"husky": "^9.1.7",
|
|
89
102
|
"lint-staged": "^16.2.7",
|
|
90
103
|
"semantic-release": "^25.0.2",
|
|
91
|
-
"typedoc": "^0.
|
|
92
|
-
"typedoc-plugin-markdown": "^4.
|
|
104
|
+
"typedoc": "^0.28.0",
|
|
105
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
93
106
|
"tsup": "^8.5.1",
|
|
94
107
|
"typescript": "^5.9.3"
|
|
95
108
|
},
|
package/dist/checkout.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as createCheckoutOperations}from'./chunk-SZQPMLZG.mjs';
|