@commerce-ai-tool/angular 2.4.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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/index.cjs +2811 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1015 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2780 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/camera.util.d.ts +7 -0
- package/dist/lib/camera.util.d.ts.map +1 -0
- package/dist/lib/commerce-ai-api.service.d.ts +35 -0
- package/dist/lib/commerce-ai-api.service.d.ts.map +1 -0
- package/dist/lib/commerce-ai-cart-panel.component.d.ts +34 -0
- package/dist/lib/commerce-ai-cart-panel.component.d.ts.map +1 -0
- package/dist/lib/commerce-ai-cart.service.d.ts +61 -0
- package/dist/lib/commerce-ai-cart.service.d.ts.map +1 -0
- package/dist/lib/commerce-ai-mission-results.component.d.ts +26 -0
- package/dist/lib/commerce-ai-mission-results.component.d.ts.map +1 -0
- package/dist/lib/commerce-ai-search.component.d.ts +141 -0
- package/dist/lib/commerce-ai-search.component.d.ts.map +1 -0
- package/dist/lib/mission.util.d.ts +6 -0
- package/dist/lib/mission.util.d.ts.map +1 -0
- package/dist/vendor-core/client.d.cts +12 -0
- package/dist/vendor-core/client.d.ts +12 -0
- package/dist/vendor-core/commercetools/facet-color.d.ts +12 -0
- package/dist/vendor-core/commercetools/facets.d.ts +31 -0
- package/dist/vendor-core/messages/index.d.ts +110 -0
- package/dist/vendor-core/payments/types.d.ts +35 -0
- package/dist/vendor-core/search/compound-shopping-list.d.ts +6 -0
- package/dist/vendor-core/types/index.d.ts +510 -0
- package/package.json +83 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import type { PaymentProvider } from "../payments/types.js";
|
|
2
|
+
export type { PaymentMethodOption } from "../payments/types.js";
|
|
3
|
+
export type ThemeMode = "auto" | "light" | "dark";
|
|
4
|
+
export type AIProviderName = "openrouter" | "bedrock";
|
|
5
|
+
export type VoiceMode = "openrouter-audio" | "elevenlabs-stt";
|
|
6
|
+
export interface SearchCacheConfig {
|
|
7
|
+
ttlMs?: number;
|
|
8
|
+
maxEntries?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface FacetConfig {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
schemaTtlMs?: number;
|
|
13
|
+
include?: string[];
|
|
14
|
+
exclude?: string[];
|
|
15
|
+
maxAttributes?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface SearchTimeoutsConfig {
|
|
18
|
+
aiTextMs?: number;
|
|
19
|
+
aiVoiceAudioMs?: number;
|
|
20
|
+
aiImageMs?: number;
|
|
21
|
+
commercetoolsMs?: number;
|
|
22
|
+
commercetoolsSuggestMs?: number;
|
|
23
|
+
elevenLabsTtsMs?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const SUGGESTIONS_MIN_PREFIX_LENGTH = 2;
|
|
26
|
+
export declare const SUGGESTIONS_DEFAULT_LIMIT = 8;
|
|
27
|
+
export declare const SUGGESTIONS_MAX_LIMIT = 20;
|
|
28
|
+
export interface CommercetoolsConfig {
|
|
29
|
+
projectKey: string;
|
|
30
|
+
clientId: string;
|
|
31
|
+
clientSecret: string;
|
|
32
|
+
region: string;
|
|
33
|
+
scopes?: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface OpenRouterConfig {
|
|
36
|
+
apiKey: string;
|
|
37
|
+
model?: string;
|
|
38
|
+
visionModel?: string;
|
|
39
|
+
/** Audio-capable model for direct voice search (OpenRouter input_audio). */
|
|
40
|
+
voiceModel?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Use OpenRouter `json_schema` (strict) for structured interpretation.
|
|
43
|
+
* Falls back to `json_object` when the model rejects json_schema.
|
|
44
|
+
* Default: true.
|
|
45
|
+
*/
|
|
46
|
+
jsonSchema?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface BedrockConfig {
|
|
49
|
+
region: string;
|
|
50
|
+
modelId?: string;
|
|
51
|
+
visionModelId?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface AIConfig {
|
|
54
|
+
provider: AIProviderName;
|
|
55
|
+
openrouter?: OpenRouterConfig;
|
|
56
|
+
bedrock?: BedrockConfig;
|
|
57
|
+
}
|
|
58
|
+
export interface ElevenLabsConfig {
|
|
59
|
+
apiKey: string;
|
|
60
|
+
sttModel?: string;
|
|
61
|
+
ttsVoiceId?: string;
|
|
62
|
+
ttsModel?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface CommerceAIDefaults {
|
|
65
|
+
/** Language products are indexed in within commercetools */
|
|
66
|
+
catalogLocale?: string;
|
|
67
|
+
/** @deprecated Use catalogLocale */
|
|
68
|
+
locale?: string;
|
|
69
|
+
storeKey?: string;
|
|
70
|
+
limit?: number;
|
|
71
|
+
currency?: string;
|
|
72
|
+
/** ISO country code for cart and product-card price selection (optional). */
|
|
73
|
+
country?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface PaymentConfig {
|
|
76
|
+
provider?: PaymentProvider;
|
|
77
|
+
/** Block order creation without a successful authorization. Defaults to true when a provider is set. */
|
|
78
|
+
requiredForOrder?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface LangfuseConfig {
|
|
81
|
+
/** Derived from LANGFUSE_PUBLIC_KEY + LANGFUSE_SECRET_KEY when loading from env. */
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Fetch system prompts from Langfuse at runtime.
|
|
85
|
+
* Applied via `configureLangfusePrompts` when creating the search orchestrator
|
|
86
|
+
* (or set `LANGFUSE_PROMPTS=true` when config omits this field).
|
|
87
|
+
* Local catalog remains the fallback and the source of truth for evals.
|
|
88
|
+
*/
|
|
89
|
+
promptsEnabled?: boolean;
|
|
90
|
+
/** Langfuse prompt label (default `production`). From LANGFUSE_PROMPT_LABEL or this field. */
|
|
91
|
+
promptLabel?: string;
|
|
92
|
+
/** Client-side prompt cache TTL in seconds (default 60). From LANGFUSE_PROMPT_CACHE_TTL_SECONDS or this field. */
|
|
93
|
+
promptCacheTtlSeconds?: number;
|
|
94
|
+
}
|
|
95
|
+
export interface MissionsConfig {
|
|
96
|
+
/** Opt-in. When true, every fresh text search also runs mission decomposition. */
|
|
97
|
+
enabled?: boolean;
|
|
98
|
+
/** Maximum product intents kept from a decomposed mission. Default 5. */
|
|
99
|
+
maxIntents?: number;
|
|
100
|
+
/** Product Search limit per intent. Default 4. */
|
|
101
|
+
perIntentLimit?: number;
|
|
102
|
+
/** Minimum AI confidence (0–1) required to keep a mission. Default 0.6. */
|
|
103
|
+
minConfidence?: number;
|
|
104
|
+
}
|
|
105
|
+
export interface CommerceAIConfig {
|
|
106
|
+
commercetools: CommercetoolsConfig;
|
|
107
|
+
ai: AIConfig;
|
|
108
|
+
elevenlabs?: ElevenLabsConfig;
|
|
109
|
+
defaults?: CommerceAIDefaults;
|
|
110
|
+
voiceMode?: VoiceMode;
|
|
111
|
+
cache?: SearchCacheConfig;
|
|
112
|
+
timeouts?: SearchTimeoutsConfig;
|
|
113
|
+
facets?: FacetConfig;
|
|
114
|
+
langfuse?: LangfuseConfig;
|
|
115
|
+
payments?: PaymentConfig;
|
|
116
|
+
missions?: MissionsConfig;
|
|
117
|
+
}
|
|
118
|
+
export interface ProductCard {
|
|
119
|
+
id: string;
|
|
120
|
+
key?: string;
|
|
121
|
+
name: string;
|
|
122
|
+
description?: string;
|
|
123
|
+
imageUrl?: string;
|
|
124
|
+
/** SKU of the master variant — used for add-to-cart. */
|
|
125
|
+
sku?: string;
|
|
126
|
+
/** Master variant id — fallback when `sku` is missing. */
|
|
127
|
+
variantId?: number;
|
|
128
|
+
price?: {
|
|
129
|
+
amount: number;
|
|
130
|
+
currency: string;
|
|
131
|
+
formatted: string;
|
|
132
|
+
};
|
|
133
|
+
slug?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface MoneyAmount {
|
|
136
|
+
amount: number;
|
|
137
|
+
currency: string;
|
|
138
|
+
formatted: string;
|
|
139
|
+
}
|
|
140
|
+
export interface CartLineItemSnapshot {
|
|
141
|
+
id: string;
|
|
142
|
+
name: string;
|
|
143
|
+
sku?: string;
|
|
144
|
+
productId: string;
|
|
145
|
+
quantity: number;
|
|
146
|
+
imageUrl?: string;
|
|
147
|
+
price?: MoneyAmount;
|
|
148
|
+
totalPrice?: MoneyAmount;
|
|
149
|
+
}
|
|
150
|
+
export interface CheckoutAddress {
|
|
151
|
+
firstName: string;
|
|
152
|
+
lastName: string;
|
|
153
|
+
streetName: string;
|
|
154
|
+
additionalStreetInfo?: string;
|
|
155
|
+
postalCode: string;
|
|
156
|
+
city: string;
|
|
157
|
+
region?: string;
|
|
158
|
+
country: string;
|
|
159
|
+
email?: string;
|
|
160
|
+
phone?: string;
|
|
161
|
+
}
|
|
162
|
+
export interface ShippingMethodSnapshot {
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
description?: string;
|
|
166
|
+
price?: MoneyAmount;
|
|
167
|
+
}
|
|
168
|
+
export interface PaymentSnapshot {
|
|
169
|
+
id: string;
|
|
170
|
+
key?: string;
|
|
171
|
+
interfaceId?: string;
|
|
172
|
+
paymentInterface: string;
|
|
173
|
+
method: string;
|
|
174
|
+
status: "authorized" | "pending" | "failed";
|
|
175
|
+
amount: MoneyAmount;
|
|
176
|
+
clientData?: Record<string, string>;
|
|
177
|
+
}
|
|
178
|
+
export interface DeliverySnapshot {
|
|
179
|
+
id: string;
|
|
180
|
+
trackingId?: string;
|
|
181
|
+
carrier?: string;
|
|
182
|
+
provider?: string;
|
|
183
|
+
}
|
|
184
|
+
/** Client-safe cart shape — never the raw commercetools Cart object. */
|
|
185
|
+
export interface CartSnapshot {
|
|
186
|
+
id: string;
|
|
187
|
+
version: number;
|
|
188
|
+
anonymousId?: string;
|
|
189
|
+
customerId?: string;
|
|
190
|
+
lineItems: CartLineItemSnapshot[];
|
|
191
|
+
totalPrice: MoneyAmount;
|
|
192
|
+
totalQuantity: number;
|
|
193
|
+
shippingAddress?: CheckoutAddress;
|
|
194
|
+
billingAddress?: CheckoutAddress;
|
|
195
|
+
shippingMethod?: ShippingMethodSnapshot;
|
|
196
|
+
payments?: PaymentSnapshot[];
|
|
197
|
+
}
|
|
198
|
+
export interface OrderSnapshot {
|
|
199
|
+
id: string;
|
|
200
|
+
orderNumber?: string;
|
|
201
|
+
orderState: string;
|
|
202
|
+
createdAt?: string;
|
|
203
|
+
paymentState?: string;
|
|
204
|
+
shipmentState?: string;
|
|
205
|
+
customerEmail?: string;
|
|
206
|
+
totalPrice: MoneyAmount;
|
|
207
|
+
lineItems: CartLineItemSnapshot[];
|
|
208
|
+
shippingAddress?: CheckoutAddress;
|
|
209
|
+
billingAddress?: CheckoutAddress;
|
|
210
|
+
shippingMethod?: ShippingMethodSnapshot;
|
|
211
|
+
payments?: PaymentSnapshot[];
|
|
212
|
+
deliveries?: DeliverySnapshot[];
|
|
213
|
+
}
|
|
214
|
+
/** Public customer identity — never includes credentials. */
|
|
215
|
+
export interface CustomerSnapshot {
|
|
216
|
+
id: string;
|
|
217
|
+
email: string;
|
|
218
|
+
}
|
|
219
|
+
/** HMAC cart session header for GET /cart — never send the token in the query string. */
|
|
220
|
+
export declare const CART_SESSION_HEADER = "x-commerce-ai-cart-session";
|
|
221
|
+
/** Upper bound for a single add-to-cart line quantity (mission add-all and batch add). */
|
|
222
|
+
export declare const MAX_LINE_ITEM_QUANTITY = 99;
|
|
223
|
+
export interface CartLoginRequest {
|
|
224
|
+
email: string;
|
|
225
|
+
password: string;
|
|
226
|
+
anonymousId?: string;
|
|
227
|
+
cartId?: string;
|
|
228
|
+
catalogLocale?: string;
|
|
229
|
+
}
|
|
230
|
+
export interface CartLoginResult {
|
|
231
|
+
cart: CartSnapshot | null;
|
|
232
|
+
customer: CustomerSnapshot;
|
|
233
|
+
}
|
|
234
|
+
export interface AddToCartLineItem {
|
|
235
|
+
sku?: string;
|
|
236
|
+
productId?: string;
|
|
237
|
+
variantId?: number;
|
|
238
|
+
quantity?: number;
|
|
239
|
+
}
|
|
240
|
+
export interface AddToCartRequest {
|
|
241
|
+
anonymousId?: string;
|
|
242
|
+
customerId?: string;
|
|
243
|
+
sku?: string;
|
|
244
|
+
productId?: string;
|
|
245
|
+
variantId?: number;
|
|
246
|
+
quantity?: number;
|
|
247
|
+
currency?: string;
|
|
248
|
+
country?: string;
|
|
249
|
+
catalogLocale?: string;
|
|
250
|
+
/** When set, add to this cart instead of looking up by anonymousId / customerId. */
|
|
251
|
+
cartId?: string;
|
|
252
|
+
sessionToken?: string;
|
|
253
|
+
}
|
|
254
|
+
export interface AddItemsToCartRequest {
|
|
255
|
+
anonymousId?: string;
|
|
256
|
+
customerId?: string;
|
|
257
|
+
items: AddToCartLineItem[];
|
|
258
|
+
currency?: string;
|
|
259
|
+
country?: string;
|
|
260
|
+
catalogLocale?: string;
|
|
261
|
+
cartId?: string;
|
|
262
|
+
sessionToken?: string;
|
|
263
|
+
}
|
|
264
|
+
export interface CartMutationRequest {
|
|
265
|
+
anonymousId?: string;
|
|
266
|
+
customerId?: string;
|
|
267
|
+
lineItemId: string;
|
|
268
|
+
cartId?: string;
|
|
269
|
+
cartVersion?: number;
|
|
270
|
+
catalogLocale?: string;
|
|
271
|
+
sessionToken?: string;
|
|
272
|
+
}
|
|
273
|
+
export interface UpdateCartQuantityRequest extends CartMutationRequest {
|
|
274
|
+
quantity: number;
|
|
275
|
+
}
|
|
276
|
+
export interface GetCartRequest {
|
|
277
|
+
anonymousId?: string;
|
|
278
|
+
customerId?: string;
|
|
279
|
+
catalogLocale?: string;
|
|
280
|
+
sessionToken?: string;
|
|
281
|
+
}
|
|
282
|
+
export interface CheckoutRequest {
|
|
283
|
+
anonymousId?: string;
|
|
284
|
+
customerId?: string;
|
|
285
|
+
cartId?: string;
|
|
286
|
+
catalogLocale?: string;
|
|
287
|
+
sessionToken?: string;
|
|
288
|
+
}
|
|
289
|
+
export interface SetCartAddressesRequest extends CheckoutRequest {
|
|
290
|
+
shippingAddress: CheckoutAddress;
|
|
291
|
+
billingAddress?: CheckoutAddress;
|
|
292
|
+
}
|
|
293
|
+
export interface SetShippingMethodRequest extends CheckoutRequest {
|
|
294
|
+
shippingMethodId: string;
|
|
295
|
+
}
|
|
296
|
+
export interface CreateOrderRequest extends CheckoutRequest {
|
|
297
|
+
orderNumber?: string;
|
|
298
|
+
}
|
|
299
|
+
export interface AuthorizePaymentRequest extends CheckoutRequest {
|
|
300
|
+
method: string;
|
|
301
|
+
orderNumber?: string;
|
|
302
|
+
}
|
|
303
|
+
export interface GetOrderRequest {
|
|
304
|
+
orderNumber?: string;
|
|
305
|
+
anonymousId?: string;
|
|
306
|
+
customerId?: string;
|
|
307
|
+
catalogLocale?: string;
|
|
308
|
+
sessionToken?: string;
|
|
309
|
+
}
|
|
310
|
+
export interface ListOrdersRequest {
|
|
311
|
+
anonymousId?: string;
|
|
312
|
+
customerId?: string;
|
|
313
|
+
catalogLocale?: string;
|
|
314
|
+
sessionToken?: string;
|
|
315
|
+
limit?: number;
|
|
316
|
+
}
|
|
317
|
+
export type SearchRelaxationLevel = "none" | "drop_soft_filters" | "primary_any_match";
|
|
318
|
+
export interface SearchMeta {
|
|
319
|
+
total: number;
|
|
320
|
+
limit: number;
|
|
321
|
+
offset: number;
|
|
322
|
+
/** @deprecated Use catalogLocale */
|
|
323
|
+
locale: string;
|
|
324
|
+
catalogLocale: string;
|
|
325
|
+
queryLocale: string;
|
|
326
|
+
queryInterpretation?: string;
|
|
327
|
+
searchTerms?: string[];
|
|
328
|
+
/** Catalog-language phrase closest to the user's intent, when the model supplied one. */
|
|
329
|
+
primaryTerm?: string;
|
|
330
|
+
appliedFilters?: InterpretedSearchFilters;
|
|
331
|
+
/**
|
|
332
|
+
* How far Product Search was relaxed after an empty first result.
|
|
333
|
+
* Omitted when no relaxation ran (`none`).
|
|
334
|
+
*/
|
|
335
|
+
relaxation?: SearchRelaxationLevel;
|
|
336
|
+
sort?: "relevance" | "price_asc" | "price_desc";
|
|
337
|
+
schemaEtag?: string;
|
|
338
|
+
/** Per-step durations in milliseconds (dev / CAT_DEBUG only) */
|
|
339
|
+
timings?: Record<string, number>;
|
|
340
|
+
/** Total pipeline duration in milliseconds (dev / CAT_DEBUG only) */
|
|
341
|
+
totalMs?: number;
|
|
342
|
+
/**
|
|
343
|
+
* Active OpenTelemetry / Langfuse trace id when Langfuse is enabled or CAT_DEBUG=true.
|
|
344
|
+
* Non-stable for client contracts — intended for local/dev linking.
|
|
345
|
+
*/
|
|
346
|
+
traceId?: string;
|
|
347
|
+
}
|
|
348
|
+
export interface SearchResult {
|
|
349
|
+
products: ProductCard[];
|
|
350
|
+
meta: SearchMeta;
|
|
351
|
+
facets?: SearchFacetGroup[];
|
|
352
|
+
suggestedFacets?: SuggestedFacet[];
|
|
353
|
+
facetSchema?: FacetAttributeDefinition[];
|
|
354
|
+
/** Present when a compound shopping mission was executed. */
|
|
355
|
+
mission?: MissionSearchResult;
|
|
356
|
+
}
|
|
357
|
+
export interface SuggestionsRequest extends SearchLocaleOptions {
|
|
358
|
+
query: string;
|
|
359
|
+
limit?: number;
|
|
360
|
+
}
|
|
361
|
+
export interface SuggestionsResult {
|
|
362
|
+
suggestions: string[];
|
|
363
|
+
/**
|
|
364
|
+
* True when this request invoked AI `suggestSearchTerms` (not a cache hit).
|
|
365
|
+
* Used by the server to flush Langfuse on serverless hosts.
|
|
366
|
+
*/
|
|
367
|
+
aiFallbackUsed?: boolean;
|
|
368
|
+
}
|
|
369
|
+
export interface TextSearchRequest {
|
|
370
|
+
query: string;
|
|
371
|
+
/** Language of the user query (AI input) */
|
|
372
|
+
queryLocale?: string;
|
|
373
|
+
/** Language products are indexed in commercetools */
|
|
374
|
+
catalogLocale?: string;
|
|
375
|
+
/** @deprecated Use queryLocale */
|
|
376
|
+
locale?: string;
|
|
377
|
+
limit?: number;
|
|
378
|
+
offset?: number;
|
|
379
|
+
filters?: InterpretedSearchFilters;
|
|
380
|
+
searchTerms?: string[];
|
|
381
|
+
sort?: "relevance" | "price_asc" | "price_desc";
|
|
382
|
+
refineQuery?: string;
|
|
383
|
+
includeFacets?: boolean;
|
|
384
|
+
/** AI-suggested facets from the active search session (chip refine). */
|
|
385
|
+
suggestedFacets?: SuggestedFacet[];
|
|
386
|
+
/** Per-request override of `CommerceAIConfig.missions.enabled`. */
|
|
387
|
+
enableMissions?: boolean;
|
|
388
|
+
}
|
|
389
|
+
export interface SearchLocaleOptions {
|
|
390
|
+
queryLocale?: string;
|
|
391
|
+
catalogLocale?: string;
|
|
392
|
+
/** @deprecated Use queryLocale */
|
|
393
|
+
locale?: string;
|
|
394
|
+
}
|
|
395
|
+
export interface SearchLocaleContext {
|
|
396
|
+
queryLocale: string;
|
|
397
|
+
catalogLocale: string;
|
|
398
|
+
}
|
|
399
|
+
export interface VoiceSearchResult extends SearchResult {
|
|
400
|
+
transcript: string;
|
|
401
|
+
enhancedQuery?: string;
|
|
402
|
+
}
|
|
403
|
+
export interface ImageSearchResult extends SearchResult {
|
|
404
|
+
interpretation: string;
|
|
405
|
+
}
|
|
406
|
+
/** Standard filter keys returned by AI interpretation (all optional). */
|
|
407
|
+
export interface InterpretedSearchFilters {
|
|
408
|
+
color?: string;
|
|
409
|
+
brand?: string;
|
|
410
|
+
category?: string;
|
|
411
|
+
priceMin?: string;
|
|
412
|
+
priceMax?: string;
|
|
413
|
+
[key: string]: string | undefined;
|
|
414
|
+
}
|
|
415
|
+
export interface InterpretedSearchQuery {
|
|
416
|
+
/**
|
|
417
|
+
* Catalog-language phrase closest to the user's intent.
|
|
418
|
+
* Product Search boosts this phrase above the other `searchTerms`.
|
|
419
|
+
* Kept separate from `searchTerms[0]` because same-language query passthrough
|
|
420
|
+
* prepends the typed query without changing intent priority.
|
|
421
|
+
*/
|
|
422
|
+
primaryTerm?: string;
|
|
423
|
+
/**
|
|
424
|
+
* Catalog-language search phrases. Product Search matches any phrase (OR).
|
|
425
|
+
* Each element is a complete phrase (e.g. `"red shoes"`), not a split word.
|
|
426
|
+
* Broad intents may include 3–5 synonym or hyponym phrases.
|
|
427
|
+
*/
|
|
428
|
+
searchTerms: string[];
|
|
429
|
+
filters?: InterpretedSearchFilters;
|
|
430
|
+
suggestedFacets?: SuggestedFacet[];
|
|
431
|
+
sort?: "relevance" | "price_asc" | "price_desc";
|
|
432
|
+
interpretation: string;
|
|
433
|
+
}
|
|
434
|
+
export interface ShoppingIntent {
|
|
435
|
+
/** Stable id for UI keys and selection (`intent-0`, `intent-1`, …). */
|
|
436
|
+
id: string;
|
|
437
|
+
/** Short catalog-language label, e.g. "tennis racket". */
|
|
438
|
+
label: string;
|
|
439
|
+
/** Requested quantity, always >= 1. */
|
|
440
|
+
quantity: number;
|
|
441
|
+
/** Catalog-language phrase closest to this intent, boosted above alternates. */
|
|
442
|
+
primaryTerm?: string;
|
|
443
|
+
searchTerms: string[];
|
|
444
|
+
filters?: InterpretedSearchFilters;
|
|
445
|
+
sort?: "relevance" | "price_asc" | "price_desc";
|
|
446
|
+
}
|
|
447
|
+
export interface DecomposedShoppingMission {
|
|
448
|
+
isMission: boolean;
|
|
449
|
+
/** 0–1. Missions below the configured minConfidence fall back to standard search. */
|
|
450
|
+
confidence: number;
|
|
451
|
+
intents: ShoppingIntent[];
|
|
452
|
+
interpretation: string;
|
|
453
|
+
}
|
|
454
|
+
export interface MissionIntentGroup {
|
|
455
|
+
intent: ShoppingIntent;
|
|
456
|
+
products: ProductCard[];
|
|
457
|
+
total: number;
|
|
458
|
+
/** True when this intent's Product Search failed; other groups still render. */
|
|
459
|
+
failed?: boolean;
|
|
460
|
+
}
|
|
461
|
+
export interface MissionSearchResult {
|
|
462
|
+
intents: MissionIntentGroup[];
|
|
463
|
+
interpretation: string;
|
|
464
|
+
}
|
|
465
|
+
export type FacetAttributeType = "enum" | "lenum" | "boolean" | "text" | "number";
|
|
466
|
+
export interface FacetAttributeDefinition {
|
|
467
|
+
name: string;
|
|
468
|
+
label: string;
|
|
469
|
+
kind: "distinct" | "range";
|
|
470
|
+
attributeType: FacetAttributeType;
|
|
471
|
+
field: string;
|
|
472
|
+
fieldType?: string;
|
|
473
|
+
}
|
|
474
|
+
export interface ResolvedFacetSchema {
|
|
475
|
+
attributes: FacetAttributeDefinition[];
|
|
476
|
+
systemFacets: Array<"categories" | "price">;
|
|
477
|
+
etag: string;
|
|
478
|
+
resolvedAt: string;
|
|
479
|
+
}
|
|
480
|
+
export interface SuggestedFacet {
|
|
481
|
+
name: string;
|
|
482
|
+
reason?: string;
|
|
483
|
+
}
|
|
484
|
+
export interface SearchFacetBucket {
|
|
485
|
+
key: string;
|
|
486
|
+
label: string;
|
|
487
|
+
count: number;
|
|
488
|
+
}
|
|
489
|
+
export interface SearchFacetGroup {
|
|
490
|
+
id: string;
|
|
491
|
+
label: string;
|
|
492
|
+
type: "distinct" | "range";
|
|
493
|
+
buckets: SearchFacetBucket[];
|
|
494
|
+
selectedKey?: string;
|
|
495
|
+
}
|
|
496
|
+
export interface SearchSessionState {
|
|
497
|
+
query: string;
|
|
498
|
+
searchTerms: string[];
|
|
499
|
+
appliedFilters: InterpretedSearchFilters;
|
|
500
|
+
suggestedFacets: SuggestedFacet[];
|
|
501
|
+
facetSchema?: FacetAttributeDefinition[];
|
|
502
|
+
schemaEtag?: string;
|
|
503
|
+
}
|
|
504
|
+
export interface VoiceAudioInterpretation extends InterpretedSearchQuery {
|
|
505
|
+
transcript: string;
|
|
506
|
+
enhancedQuery: string;
|
|
507
|
+
}
|
|
508
|
+
/** @deprecated Use ProductSearchRequest from query-builder / platform-sdk */
|
|
509
|
+
export type { ProductSearchRequest as ProductSearchQueryBody } from "@commercetools/platform-sdk";
|
|
510
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@commerce-ai-tool/angular",
|
|
3
|
+
"version": "2.4.0",
|
|
4
|
+
"description": "Angular component for Commerce AI Tool — glass morphism product search widget",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./styles.css": "./dist/index.css"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": [
|
|
28
|
+
"**/*.css"
|
|
29
|
+
],
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@angular/common": ">=17",
|
|
32
|
+
"@angular/core": ">=17",
|
|
33
|
+
"@angular/forms": ">=17",
|
|
34
|
+
"rxjs": ">=7"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@angular/common": "^20.3.27",
|
|
38
|
+
"@angular/compiler": "^20.3.27",
|
|
39
|
+
"@angular/core": "^20.3.27",
|
|
40
|
+
"@angular/forms": "^19.2.3",
|
|
41
|
+
"@angular/platform-browser": "^19.2.3",
|
|
42
|
+
"rxjs": "^7.8.2",
|
|
43
|
+
"tsup": "^8.4.0",
|
|
44
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
45
|
+
"vitest": "^3.0.9",
|
|
46
|
+
"zone.js": "^0.15.0",
|
|
47
|
+
"@commerce-ai-tool/core": "2.4.0"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"author": {
|
|
53
|
+
"name": "Tomasz Miller",
|
|
54
|
+
"url": "https://github.com/tomasz-miller"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/tomasz-miller/commerce-ai-tool#readme",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/tomasz-miller/commerce-ai-tool/issues"
|
|
59
|
+
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git+https://github.com/tomasz-miller/commerce-ai-tool.git",
|
|
63
|
+
"directory": "packages/angular"
|
|
64
|
+
},
|
|
65
|
+
"keywords": [
|
|
66
|
+
"commercetools",
|
|
67
|
+
"ai",
|
|
68
|
+
"search",
|
|
69
|
+
"angular",
|
|
70
|
+
"widget"
|
|
71
|
+
],
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=24"
|
|
74
|
+
},
|
|
75
|
+
"scripts": {
|
|
76
|
+
"build": "tsup && node ../../scripts/emit-package-dts.mjs dist/index.d.ts && node ../../scripts/inline-core-client-dts.mjs",
|
|
77
|
+
"dev": "tsup --watch",
|
|
78
|
+
"typecheck": "tsc --noEmit",
|
|
79
|
+
"lint": "eslint src",
|
|
80
|
+
"test": "vitest run",
|
|
81
|
+
"clean": "rm -rf dist"
|
|
82
|
+
}
|
|
83
|
+
}
|