shop-client 3.8.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/LICENSE +21 -0
- package/README.md +912 -0
- package/dist/checkout.d.mts +31 -0
- package/dist/checkout.d.ts +31 -0
- package/dist/checkout.js +115 -0
- package/dist/checkout.js.map +1 -0
- package/dist/checkout.mjs +7 -0
- package/dist/checkout.mjs.map +1 -0
- package/dist/chunk-2KBOKOAD.mjs +177 -0
- package/dist/chunk-2KBOKOAD.mjs.map +1 -0
- package/dist/chunk-BWKBRM2Z.mjs +136 -0
- package/dist/chunk-BWKBRM2Z.mjs.map +1 -0
- package/dist/chunk-O4BPIIQ6.mjs +503 -0
- package/dist/chunk-O4BPIIQ6.mjs.map +1 -0
- package/dist/chunk-QCTICSBE.mjs +398 -0
- package/dist/chunk-QCTICSBE.mjs.map +1 -0
- package/dist/chunk-QL5OUZGP.mjs +91 -0
- package/dist/chunk-QL5OUZGP.mjs.map +1 -0
- package/dist/chunk-WTK5HUFI.mjs +1287 -0
- package/dist/chunk-WTK5HUFI.mjs.map +1 -0
- package/dist/collections.d.mts +64 -0
- package/dist/collections.d.ts +64 -0
- package/dist/collections.js +540 -0
- package/dist/collections.js.map +1 -0
- package/dist/collections.mjs +9 -0
- package/dist/collections.mjs.map +1 -0
- package/dist/index.d.mts +233 -0
- package/dist/index.d.ts +233 -0
- package/dist/index.js +3241 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +702 -0
- package/dist/index.mjs.map +1 -0
- package/dist/products.d.mts +63 -0
- package/dist/products.d.ts +63 -0
- package/dist/products.js +1206 -0
- package/dist/products.js.map +1 -0
- package/dist/products.mjs +9 -0
- package/dist/products.mjs.map +1 -0
- package/dist/store-CJVUz2Yb.d.mts +608 -0
- package/dist/store-CJVUz2Yb.d.ts +608 -0
- package/dist/store.d.mts +1 -0
- package/dist/store.d.ts +1 -0
- package/dist/store.js +698 -0
- package/dist/store.js.map +1 -0
- package/dist/store.mjs +9 -0
- package/dist/store.mjs.map +1 -0
- package/dist/utils/rate-limit.d.mts +25 -0
- package/dist/utils/rate-limit.d.ts +25 -0
- package/dist/utils/rate-limit.js +203 -0
- package/dist/utils/rate-limit.js.map +1 -0
- package/dist/utils/rate-limit.mjs +11 -0
- package/dist/utils/rate-limit.mjs.map +1 -0
- package/package.json +116 -0
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for the shop-search package.
|
|
3
|
+
*
|
|
4
|
+
* This file contains all TypeScript type definitions used throughout the shop-search library,
|
|
5
|
+
* including Shopify API response types, normalized product/collection types, and utility types.
|
|
6
|
+
*
|
|
7
|
+
* @author shop-search
|
|
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
|
+
/**
|
|
40
|
+
* Base timestamp fields used across Shopify entities.
|
|
41
|
+
*/
|
|
42
|
+
type ShopifyTimestamps = {
|
|
43
|
+
created_at: string;
|
|
44
|
+
updated_at: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Basic information fields common to Shopify entities.
|
|
48
|
+
*/
|
|
49
|
+
type ShopifyBasicInfo = {
|
|
50
|
+
id: number;
|
|
51
|
+
title: string;
|
|
52
|
+
handle: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Image dimension properties.
|
|
56
|
+
*/
|
|
57
|
+
type ShopifyImageDimensions = {
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
aspect_ratio?: number;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Shopify product image structure from API responses.
|
|
64
|
+
*/
|
|
65
|
+
type ShopifyImage = ShopifyBasicInfo & ShopifyTimestamps & ShopifyImageDimensions & {
|
|
66
|
+
src: string;
|
|
67
|
+
position: number;
|
|
68
|
+
product_id: number;
|
|
69
|
+
variant_ids: string[];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Shopify variant image structure with additional properties.
|
|
73
|
+
*/
|
|
74
|
+
type ShopifyVariantImage = ShopifyBasicInfo & ShopifyTimestamps & ShopifyImageDimensions & {
|
|
75
|
+
src: string;
|
|
76
|
+
position: number;
|
|
77
|
+
product_id: number;
|
|
78
|
+
variant_ids: number[];
|
|
79
|
+
alt: string | null;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Featured media structure for products.
|
|
83
|
+
*/
|
|
84
|
+
type ShopifyFeaturedMedia = {
|
|
85
|
+
alt: string | null;
|
|
86
|
+
id: number;
|
|
87
|
+
position: number;
|
|
88
|
+
preview_image: {
|
|
89
|
+
aspect_ratio: number;
|
|
90
|
+
height: number;
|
|
91
|
+
width: number;
|
|
92
|
+
src: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Media structure supporting both images and videos.
|
|
97
|
+
*/
|
|
98
|
+
type ShopifyMedia = ShopifyFeaturedMedia & ShopifyImageDimensions & {
|
|
99
|
+
media_type: "image" | "video";
|
|
100
|
+
src: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Product option structure (e.g., Size, Color).
|
|
104
|
+
*/
|
|
105
|
+
type ShopifyOption = {
|
|
106
|
+
name: string;
|
|
107
|
+
position: number;
|
|
108
|
+
values: string[];
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Base variant structure with common properties.
|
|
112
|
+
*/
|
|
113
|
+
type ShopifyBaseVariant = ShopifyBasicInfo & ShopifyTimestamps & {
|
|
114
|
+
option1: string | null;
|
|
115
|
+
option2: string | null;
|
|
116
|
+
option3: string | null;
|
|
117
|
+
sku: string | null;
|
|
118
|
+
requires_shipping: boolean;
|
|
119
|
+
taxable: boolean;
|
|
120
|
+
position: number;
|
|
121
|
+
product_id: number;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Product variant structure for Shopify products with basic properties.
|
|
125
|
+
*/
|
|
126
|
+
type ShopifyProductVariant = ShopifyBaseVariant & {
|
|
127
|
+
name?: string | undefined;
|
|
128
|
+
options?: string[] | undefined;
|
|
129
|
+
featured_image: {
|
|
130
|
+
id: number;
|
|
131
|
+
src: string;
|
|
132
|
+
width: number;
|
|
133
|
+
height: number;
|
|
134
|
+
position: number;
|
|
135
|
+
product_id: number;
|
|
136
|
+
aspect_ratio: number;
|
|
137
|
+
variant_ids: unknown[];
|
|
138
|
+
created_at: string;
|
|
139
|
+
updated_at: string;
|
|
140
|
+
alt: string | null;
|
|
141
|
+
} | null;
|
|
142
|
+
available: boolean;
|
|
143
|
+
price: string | number;
|
|
144
|
+
weightInGrams?: number | undefined;
|
|
145
|
+
compare_at_price?: string | number | undefined;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Enhanced product variant structure for single product API responses.
|
|
149
|
+
*/
|
|
150
|
+
type ShopifySingleProductVariant = ShopifyBaseVariant & {
|
|
151
|
+
featured_image: ShopifyVariantImage | null;
|
|
152
|
+
featured_media: ShopifyFeaturedMedia | null;
|
|
153
|
+
available?: boolean | undefined;
|
|
154
|
+
price: string;
|
|
155
|
+
compare_at_price: string | null;
|
|
156
|
+
inventory_quantity?: number | undefined;
|
|
157
|
+
inventory_management: string | null;
|
|
158
|
+
inventory_policy?: string | undefined;
|
|
159
|
+
fulfillment_service?: string | undefined;
|
|
160
|
+
barcode?: string | null | undefined;
|
|
161
|
+
grams?: number | undefined;
|
|
162
|
+
weight?: number | undefined;
|
|
163
|
+
weight_unit?: string | undefined;
|
|
164
|
+
requires_selling_plan?: boolean | undefined;
|
|
165
|
+
selling_plan_allocations?: unknown[] | undefined;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Base product structure with common Shopify product properties.
|
|
169
|
+
*/
|
|
170
|
+
type ShopifyBaseProduct = ShopifyBasicInfo & ShopifyTimestamps & {
|
|
171
|
+
vendor: string;
|
|
172
|
+
tags: string[];
|
|
173
|
+
options: ShopifyOption[];
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Standard Shopify product structure from products API.
|
|
177
|
+
*/
|
|
178
|
+
type ShopifyProduct = ShopifyBaseProduct & {
|
|
179
|
+
body_html: string;
|
|
180
|
+
body?: string | undefined;
|
|
181
|
+
published_at: string;
|
|
182
|
+
product_type: string;
|
|
183
|
+
variants: ShopifyProductVariant[];
|
|
184
|
+
images: ShopifyImage[];
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Alias for ShopifyProduct with store context.
|
|
188
|
+
*/
|
|
189
|
+
type ShopifyProductAndStore = ShopifyProduct;
|
|
190
|
+
/**
|
|
191
|
+
* Enhanced single product structure with additional pricing and availability data.
|
|
192
|
+
*/
|
|
193
|
+
type ShopifySingleProduct = ShopifyBaseProduct & {
|
|
194
|
+
description: string;
|
|
195
|
+
published_at: string;
|
|
196
|
+
type: string;
|
|
197
|
+
tags: (string | string[] | undefined) & (string | string[]);
|
|
198
|
+
price: number;
|
|
199
|
+
price_min: number;
|
|
200
|
+
price_max: number;
|
|
201
|
+
available: boolean;
|
|
202
|
+
price_varies: boolean;
|
|
203
|
+
compare_at_price: number | null;
|
|
204
|
+
compare_at_price_min: number;
|
|
205
|
+
compare_at_price_max: number;
|
|
206
|
+
compare_at_price_varies: boolean;
|
|
207
|
+
variants: ShopifySingleProductVariant[];
|
|
208
|
+
images: string[];
|
|
209
|
+
featured_image: string | null;
|
|
210
|
+
url?: string;
|
|
211
|
+
media?: ShopifyMedia[];
|
|
212
|
+
requires_selling_plan?: boolean;
|
|
213
|
+
selling_plan_groups?: string[];
|
|
214
|
+
};
|
|
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
|
+
/**
|
|
243
|
+
* Localized/display pricing with currency-aware formatted strings.
|
|
244
|
+
*/
|
|
245
|
+
type LocalizedPricing = {
|
|
246
|
+
currency: string;
|
|
247
|
+
priceFormatted: string;
|
|
248
|
+
priceMinFormatted: string;
|
|
249
|
+
priceMaxFormatted: string;
|
|
250
|
+
compareAtPriceFormatted: string;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* ISO 4217 currency code type aligned with Intl.NumberFormat expectations.
|
|
254
|
+
* Example values: "USD", "EUR", "GBP".
|
|
255
|
+
*/
|
|
256
|
+
type CurrencyCode = NonNullable<Intl.NumberFormatOptions["currency"]>;
|
|
257
|
+
/**
|
|
258
|
+
* Product option structure (e.g., Size, Color) for normalized products.
|
|
259
|
+
*/
|
|
260
|
+
type ProductOption = {
|
|
261
|
+
key: string;
|
|
262
|
+
data: string[];
|
|
263
|
+
name: string;
|
|
264
|
+
position: number;
|
|
265
|
+
values: string[];
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Normalized product variant image structure.
|
|
269
|
+
*/
|
|
270
|
+
type ProductVariantImage = ShopifyImageDimensions & {
|
|
271
|
+
id: number;
|
|
272
|
+
src: string;
|
|
273
|
+
position: number;
|
|
274
|
+
productId: number;
|
|
275
|
+
aspectRatio: number;
|
|
276
|
+
variantIds: unknown[];
|
|
277
|
+
createdAt: string;
|
|
278
|
+
updatedAt: string;
|
|
279
|
+
alt: string | null;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Normalized product variant structure used by the library.
|
|
283
|
+
*/
|
|
284
|
+
type ProductVariant = {
|
|
285
|
+
id: string;
|
|
286
|
+
platformId: string;
|
|
287
|
+
name?: string | undefined;
|
|
288
|
+
title: string;
|
|
289
|
+
option1: string | null;
|
|
290
|
+
option2: string | null;
|
|
291
|
+
option3: string | null;
|
|
292
|
+
options?: string[] | undefined;
|
|
293
|
+
sku: string | null;
|
|
294
|
+
requiresShipping: boolean;
|
|
295
|
+
taxable: boolean;
|
|
296
|
+
featuredImage: ProductVariantImage | null;
|
|
297
|
+
available: boolean;
|
|
298
|
+
price: number;
|
|
299
|
+
weightInGrams?: number | undefined;
|
|
300
|
+
compareAtPrice: number;
|
|
301
|
+
position: number;
|
|
302
|
+
productId: number;
|
|
303
|
+
createdAt?: string | undefined;
|
|
304
|
+
updatedAt?: string | undefined;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Normalized product image structure.
|
|
308
|
+
*/
|
|
309
|
+
type ProductImage = ShopifyImageDimensions & {
|
|
310
|
+
id: number;
|
|
311
|
+
productId: number;
|
|
312
|
+
alt: string | null;
|
|
313
|
+
position: number;
|
|
314
|
+
src: string;
|
|
315
|
+
mediaType: "image" | "video";
|
|
316
|
+
variantIds: unknown[];
|
|
317
|
+
createdAt?: string | undefined;
|
|
318
|
+
updatedAt?: string | undefined;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* HTML meta tag structure for SEO data.
|
|
322
|
+
*/
|
|
323
|
+
type MetaTag = {
|
|
324
|
+
name: string;
|
|
325
|
+
content: string;
|
|
326
|
+
} | {
|
|
327
|
+
property: string;
|
|
328
|
+
content: string;
|
|
329
|
+
} | {
|
|
330
|
+
itemprop: string;
|
|
331
|
+
content: string;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* Main normalized product structure returned by the library.
|
|
335
|
+
* This is the primary interface for working with products.
|
|
336
|
+
*/
|
|
337
|
+
type Product = {
|
|
338
|
+
slug: string;
|
|
339
|
+
handle: string;
|
|
340
|
+
platformId: string;
|
|
341
|
+
title: string;
|
|
342
|
+
available: boolean;
|
|
343
|
+
price: number;
|
|
344
|
+
priceMin: number;
|
|
345
|
+
priceVaries: boolean;
|
|
346
|
+
compareAtPrice: number;
|
|
347
|
+
compareAtPriceMin: number;
|
|
348
|
+
priceMax: number;
|
|
349
|
+
compareAtPriceMax: number;
|
|
350
|
+
compareAtPriceVaries: boolean;
|
|
351
|
+
discount: number;
|
|
352
|
+
currency?: string;
|
|
353
|
+
localizedPricing?: LocalizedPricing;
|
|
354
|
+
options: ProductOption[];
|
|
355
|
+
bodyHtml: string | null;
|
|
356
|
+
active?: boolean;
|
|
357
|
+
productType: string | null;
|
|
358
|
+
tags: string[];
|
|
359
|
+
vendor: string;
|
|
360
|
+
featuredImage?: string | null;
|
|
361
|
+
isProxyFeaturedImage: boolean | null;
|
|
362
|
+
createdAt?: Date;
|
|
363
|
+
updatedAt?: Date;
|
|
364
|
+
variants: ProductVariant[] | null;
|
|
365
|
+
images: ProductImage[];
|
|
366
|
+
publishedAt: Date | null;
|
|
367
|
+
seo?: MetaTag[] | null;
|
|
368
|
+
metaTags?: MetaTag[] | null;
|
|
369
|
+
displayScore?: number;
|
|
370
|
+
deletedAt?: Date | null;
|
|
371
|
+
storeSlug: string;
|
|
372
|
+
storeDomain: string;
|
|
373
|
+
embedding?: number[] | null;
|
|
374
|
+
url: string;
|
|
375
|
+
requiresSellingPlan?: boolean | null;
|
|
376
|
+
sellingPlanGroups?: unknown;
|
|
377
|
+
variantOptionsMap: Record<string, string>;
|
|
378
|
+
enriched_content?: string;
|
|
379
|
+
};
|
|
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
|
+
/**
|
|
455
|
+
* Shopify collection structure from API responses.
|
|
456
|
+
*/
|
|
457
|
+
type ShopifyCollection = {
|
|
458
|
+
id: number;
|
|
459
|
+
title: string;
|
|
460
|
+
handle: string;
|
|
461
|
+
description?: string | undefined;
|
|
462
|
+
published_at: string;
|
|
463
|
+
updated_at: string;
|
|
464
|
+
image?: {
|
|
465
|
+
id: number;
|
|
466
|
+
created_at: string;
|
|
467
|
+
src: string;
|
|
468
|
+
alt?: string;
|
|
469
|
+
} | undefined;
|
|
470
|
+
products_count: number;
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* Main normalized collection structure returned by the library.
|
|
474
|
+
* This is the primary interface for working with collections.
|
|
475
|
+
*/
|
|
476
|
+
/**
|
|
477
|
+
* Country detection result with confidence scoring.
|
|
478
|
+
*/
|
|
479
|
+
/**
|
|
480
|
+
* Result of country detection analysis for a Shopify store.
|
|
481
|
+
* Contains the detected country as an ISO 3166-1 alpha-2 code.
|
|
482
|
+
*/
|
|
483
|
+
type CountryDetectionResult = {
|
|
484
|
+
/** The detected country as ISO 3166-1 alpha-2 code (e.g., "US", "GB") or "Unknown" if no reliable detection */
|
|
485
|
+
country: string;
|
|
486
|
+
/** Confidence score between 0 and 1 (higher = more confident) */
|
|
487
|
+
confidence: number;
|
|
488
|
+
/** Array of detection signals that contributed to the result */
|
|
489
|
+
signals: string[];
|
|
490
|
+
/** Detected currency code (e.g., "USD", "INR") if available */
|
|
491
|
+
currencyCode?: string;
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Country scoring data for internal calculations.
|
|
495
|
+
*/
|
|
496
|
+
type CountryScore = {
|
|
497
|
+
score: number;
|
|
498
|
+
reasons: string[];
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Country scores mapping for detection algorithm.
|
|
502
|
+
*/
|
|
503
|
+
type CountryScores = {
|
|
504
|
+
[country: string]: CountryScore;
|
|
505
|
+
};
|
|
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
|
+
type JsonLdEntry = Record<string, unknown>;
|
|
516
|
+
type Collection = {
|
|
517
|
+
id: string;
|
|
518
|
+
title: string;
|
|
519
|
+
handle: string;
|
|
520
|
+
description?: string | undefined;
|
|
521
|
+
image?: {
|
|
522
|
+
id: number;
|
|
523
|
+
createdAt: string;
|
|
524
|
+
src: string;
|
|
525
|
+
alt?: string;
|
|
526
|
+
};
|
|
527
|
+
productsCount: number;
|
|
528
|
+
publishedAt: string;
|
|
529
|
+
updatedAt: string;
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* Product classification result returned by classifyProduct.
|
|
533
|
+
*/
|
|
534
|
+
type ProductClassification = {
|
|
535
|
+
audience: "adult_male" | "adult_female" | "kid_male" | "kid_female" | "generic";
|
|
536
|
+
vertical: "clothing" | "beauty" | "accessories" | "home-decor" | "food-and-beverages";
|
|
537
|
+
category?: string | null;
|
|
538
|
+
subCategory?: string | null;
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* SEO and marketing content generated by LLM.
|
|
542
|
+
*/
|
|
543
|
+
type SEOContent = {
|
|
544
|
+
metaTitle: string;
|
|
545
|
+
metaDescription: string;
|
|
546
|
+
shortDescription: string;
|
|
547
|
+
longDescription: string;
|
|
548
|
+
tags: string[];
|
|
549
|
+
marketingCopy: string;
|
|
550
|
+
};
|
|
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
|
+
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
|
+
|
|
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 };
|