@commerce-ai-tool/react 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 +17 -0
- package/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/components/CameraCaptureOverlay.d.ts +11 -0
- package/dist/components/CameraCaptureOverlay.d.ts.map +1 -0
- package/dist/components/CartPanel.d.ts +22 -0
- package/dist/components/CartPanel.d.ts.map +1 -0
- package/dist/components/CommerceAICheckout.d.ts +15 -0
- package/dist/components/CommerceAICheckout.d.ts.map +1 -0
- package/dist/components/CommerceAIOrderStatus.d.ts +15 -0
- package/dist/components/CommerceAIOrderStatus.d.ts.map +1 -0
- package/dist/components/CommerceAISearch.d.ts +43 -0
- package/dist/components/CommerceAISearch.d.ts.map +1 -0
- package/dist/components/MissionResults.d.ts +13 -0
- package/dist/components/MissionResults.d.ts.map +1 -0
- package/dist/components/SearchFacets.d.ts +12 -0
- package/dist/components/SearchFacets.d.ts.map +1 -0
- package/dist/components/VoiceStatusBanner.d.ts +12 -0
- package/dist/components/VoiceStatusBanner.d.ts.map +1 -0
- package/dist/hooks/useCameraCapture.d.ts +18 -0
- package/dist/hooks/useCameraCapture.d.ts.map +1 -0
- package/dist/hooks/useCart.d.ts +57 -0
- package/dist/hooks/useCart.d.ts.map +1 -0
- package/dist/hooks/useCommerceAISearch.d.ts +59 -0
- package/dist/hooks/useCommerceAISearch.d.ts.map +1 -0
- package/dist/hooks/useRecordingDuration.d.ts +3 -0
- package/dist/hooks/useRecordingDuration.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +4 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/hooks/useVoiceSearch.d.ts +24 -0
- package/dist/hooks/useVoiceSearch.d.ts.map +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/index.cjs +3714 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1783 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3702 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/camera.d.ts +7 -0
- package/dist/utils/camera.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 +84 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type CameraFacingMode = "environment" | "user";
|
|
2
|
+
export declare function prefersNativeCamera(): boolean;
|
|
3
|
+
export declare function stopMediaStream(stream: MediaStream | null): void;
|
|
4
|
+
export declare function getCameraErrorMessage(error: unknown): string;
|
|
5
|
+
export declare function createJpegFileFromVideo(video: HTMLVideoElement, fileName?: string): Promise<File>;
|
|
6
|
+
export declare function buildCameraConstraints(facingMode: CameraFacingMode): MediaStreamConstraints;
|
|
7
|
+
//# sourceMappingURL=camera.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../src/utils/camera.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,MAAM,CAAC;AAEtD,wBAAgB,mBAAmB,IAAI,OAAO,CAO7C;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAEhE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAc5D;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,gBAAgB,EACvB,QAAQ,SAAuB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAiCf;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,gBAAgB,GAAG,sBAAsB,CAS3F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe core surface for the React and Angular widgets.
|
|
3
|
+
* Do not re-export AI, commercetools, or observability from this entry.
|
|
4
|
+
*/
|
|
5
|
+
export type * from "./types/index.js";
|
|
6
|
+
export { CART_SESSION_HEADER, MAX_LINE_ITEM_QUANTITY } from "./types/index.js";
|
|
7
|
+
export { DEFAULT_COMMERCE_AI_SEARCH_MESSAGES, resolveCommerceAISearchMessages, } from "./messages/index.js";
|
|
8
|
+
export type { CommerceAISearchMessages } from "./messages/index.js";
|
|
9
|
+
export { looksLikeCompoundShoppingList } from "./search/compound-shopping-list.js";
|
|
10
|
+
export { isFacetFilterSelected, toggleFacetFilter, } from "./commercetools/facets.js";
|
|
11
|
+
export { hexColorSwatchValue, isColorLikeFacetName, } from "./commercetools/facet-color.js";
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe core surface for the React and Angular widgets.
|
|
3
|
+
* Do not re-export AI, commercetools, or observability from this entry.
|
|
4
|
+
*/
|
|
5
|
+
export type * from "./types/index.js";
|
|
6
|
+
export { CART_SESSION_HEADER, MAX_LINE_ITEM_QUANTITY } from "./types/index.js";
|
|
7
|
+
export { DEFAULT_COMMERCE_AI_SEARCH_MESSAGES, resolveCommerceAISearchMessages, } from "./messages/index.js";
|
|
8
|
+
export type { CommerceAISearchMessages } from "./messages/index.js";
|
|
9
|
+
export { looksLikeCompoundShoppingList } from "./search/compound-shopping-list.js";
|
|
10
|
+
export { isFacetFilterSelected, toggleFacetFilter, } from "./commercetools/facets.js";
|
|
11
|
+
export { hexColorSwatchValue, isColorLikeFacetName, } from "./commercetools/facet-color.js";
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** True when a facet id looks like a color/finish attribute (`color-code`, `finish-code`). */
|
|
2
|
+
export declare function isColorLikeFacetName(name: string): boolean;
|
|
3
|
+
/** True when a facet bucket key is a CSS hex color (`#RGB` or `#RRGGBB`). */
|
|
4
|
+
export declare function isHexColorFacetKey(value: string): boolean;
|
|
5
|
+
/** Normalized `#rrggbb` for a hex facet key, or `undefined` when not a color. */
|
|
6
|
+
export declare function hexColorSwatchValue(value: string): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Human-readable facet chip label. Hex keys on color/finish facets become the
|
|
9
|
+
* nearest CSS color name when close enough; other keys are unchanged.
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatFacetBucketLabel(key: string, facetName?: string): string;
|
|
12
|
+
//# sourceMappingURL=facet-color.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FacetAttributeDefinition, InterpretedSearchFilters, ResolvedFacetSchema, SearchFacetGroup, SuggestedFacet } from "../types/index.js";
|
|
2
|
+
export declare const PRICE_FACET_ID = "price";
|
|
3
|
+
export declare const CATEGORIES_FACET_ID = "categories";
|
|
4
|
+
export declare const DEFAULT_PRICE_RANGES: readonly [{
|
|
5
|
+
readonly key: "under-50";
|
|
6
|
+
readonly to: 5000;
|
|
7
|
+
}, {
|
|
8
|
+
readonly key: "50-to-100";
|
|
9
|
+
readonly from: 5000;
|
|
10
|
+
readonly to: 10000;
|
|
11
|
+
}, {
|
|
12
|
+
readonly key: "100-plus";
|
|
13
|
+
readonly from: 10000;
|
|
14
|
+
}];
|
|
15
|
+
export type PriceRangeDefinition = (typeof DEFAULT_PRICE_RANGES)[number];
|
|
16
|
+
/** Major currency units (e.g. EUR) corresponding to a price range bucket. */
|
|
17
|
+
export declare function priceRangeToFilterValues(range: PriceRangeDefinition): Pick<InterpretedSearchFilters, "priceMin" | "priceMax">;
|
|
18
|
+
export declare function priceBucketKeyFromFilters(filters: InterpretedSearchFilters): string | undefined;
|
|
19
|
+
export declare function isFacetFilterSelected(filters: InterpretedSearchFilters, facetId: string, bucketKey: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Toggle a facet chip into filter state. Price buckets map to priceMin/priceMax;
|
|
22
|
+
* categories map to `category`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toggleFacetFilter(filters: InterpretedSearchFilters, facetId: string, bucketKey: string): InterpretedSearchFilters;
|
|
25
|
+
export declare function buildProductSearchFacets(schema: ResolvedFacetSchema, suggestedFacets?: SuggestedFacet[]): unknown[];
|
|
26
|
+
/** Product Projection Search `facet` query parameter expressions. */
|
|
27
|
+
export declare function buildProjectionFacetParams(schema: ResolvedFacetSchema, suggestedFacets?: SuggestedFacet[]): string[];
|
|
28
|
+
export declare function normalizeProductSearchFacets(rawFacets: unknown, schema: ResolvedFacetSchema, suggestedFacets?: SuggestedFacet[], filters?: InterpretedSearchFilters): SearchFacetGroup[];
|
|
29
|
+
export declare function filterFacetSuggestions(suggestedFacets: SuggestedFacet[] | undefined, schema: ResolvedFacetSchema): SuggestedFacet[];
|
|
30
|
+
export declare function getFacetAttribute(schema: ResolvedFacetSchema, name: string): FacetAttributeDefinition | undefined;
|
|
31
|
+
//# sourceMappingURL=facets.d.ts.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export interface CommerceAISearchMessages {
|
|
2
|
+
placeholder: string;
|
|
3
|
+
searchAriaLabel: string;
|
|
4
|
+
productSearchAriaLabel: string;
|
|
5
|
+
searchResultsAriaLabel: string;
|
|
6
|
+
searching: string;
|
|
7
|
+
noProductsFound: string;
|
|
8
|
+
searchedFor: string;
|
|
9
|
+
dropImageToSearch: string;
|
|
10
|
+
voiceSearch: string;
|
|
11
|
+
stopRecording: string;
|
|
12
|
+
searchByCamera: string;
|
|
13
|
+
searchByImage: string;
|
|
14
|
+
replayVoiceSummary: string;
|
|
15
|
+
listening: string;
|
|
16
|
+
tapMicToStop: string;
|
|
17
|
+
understandingQuery: string;
|
|
18
|
+
preparingAudioSummary: string;
|
|
19
|
+
cameraCapture: string;
|
|
20
|
+
cameraPreview: string;
|
|
21
|
+
capturePhoto: string;
|
|
22
|
+
cancel: string;
|
|
23
|
+
dismiss: string;
|
|
24
|
+
searchFailed: string;
|
|
25
|
+
imageSearchFailed: string;
|
|
26
|
+
couldNotCapturePhoto: string;
|
|
27
|
+
suggestionsAriaLabel: string;
|
|
28
|
+
loadingSuggestions: string;
|
|
29
|
+
noSuggestions: string;
|
|
30
|
+
filtersAriaLabel: string;
|
|
31
|
+
clearFilters: string;
|
|
32
|
+
narrowResults: string;
|
|
33
|
+
newSearch: string;
|
|
34
|
+
addToCart: string;
|
|
35
|
+
cart: string;
|
|
36
|
+
emptyCart: string;
|
|
37
|
+
removeItem: string;
|
|
38
|
+
total: string;
|
|
39
|
+
each: string;
|
|
40
|
+
cartAriaLabel: string;
|
|
41
|
+
itemAdded: string;
|
|
42
|
+
increaseQuantity: string;
|
|
43
|
+
decreaseQuantity: string;
|
|
44
|
+
closeCart: string;
|
|
45
|
+
unableToAddToCart: string;
|
|
46
|
+
missionTitle: string;
|
|
47
|
+
missionQuantity: string;
|
|
48
|
+
/** Adds the first (recommended) product from each filled lane. Use `{count}` for the number of picks. */
|
|
49
|
+
missionAddAll: string;
|
|
50
|
+
missionItemsAdded: string;
|
|
51
|
+
missionSelectProduct: string;
|
|
52
|
+
missionIntentEmpty: string;
|
|
53
|
+
missionIntentFailed: string;
|
|
54
|
+
signIn: string;
|
|
55
|
+
signInToSyncCart: string;
|
|
56
|
+
signOut: string;
|
|
57
|
+
email: string;
|
|
58
|
+
password: string;
|
|
59
|
+
signedInAs: string;
|
|
60
|
+
invalidCredentials: string;
|
|
61
|
+
signInFailed: string;
|
|
62
|
+
checkout: string;
|
|
63
|
+
checkoutTitle: string;
|
|
64
|
+
orderSummary: string;
|
|
65
|
+
shippingAddress: string;
|
|
66
|
+
billingAddress: string;
|
|
67
|
+
billingSameAsShipping: string;
|
|
68
|
+
continueToDelivery: string;
|
|
69
|
+
shippingMethod: string;
|
|
70
|
+
selectShippingMethod: string;
|
|
71
|
+
noShippingMethods: string;
|
|
72
|
+
completeAddressToContinue: string;
|
|
73
|
+
selectDeliveryToContinue: string;
|
|
74
|
+
selectPaymentToContinue: string;
|
|
75
|
+
checkoutStepAddress: string;
|
|
76
|
+
checkoutStepDelivery: string;
|
|
77
|
+
checkoutStepPayment: string;
|
|
78
|
+
paymentMethod: string;
|
|
79
|
+
selectPaymentMethod: string;
|
|
80
|
+
paymentAuthorized: string;
|
|
81
|
+
paymentDeclined: string;
|
|
82
|
+
continueToPayment: string;
|
|
83
|
+
placeOrder: string;
|
|
84
|
+
placingOrder: string;
|
|
85
|
+
orderPlaced: string;
|
|
86
|
+
viewOrderStatus: string;
|
|
87
|
+
continueShopping: string;
|
|
88
|
+
checkoutFailed: string;
|
|
89
|
+
orderStatus: string;
|
|
90
|
+
orderPlacedAt: string;
|
|
91
|
+
paymentStateLabel: string;
|
|
92
|
+
shipmentStateLabel: string;
|
|
93
|
+
trackingNumber: string;
|
|
94
|
+
carrier: string;
|
|
95
|
+
noTrackingYet: string;
|
|
96
|
+
orderNotFound: string;
|
|
97
|
+
noOrdersYet: string;
|
|
98
|
+
yourOrders: string;
|
|
99
|
+
firstName: string;
|
|
100
|
+
lastName: string;
|
|
101
|
+
streetName: string;
|
|
102
|
+
additionalAddress: string;
|
|
103
|
+
postalCode: string;
|
|
104
|
+
city: string;
|
|
105
|
+
region: string;
|
|
106
|
+
country: string;
|
|
107
|
+
}
|
|
108
|
+
export declare const DEFAULT_COMMERCE_AI_SEARCH_MESSAGES: CommerceAISearchMessages;
|
|
109
|
+
export declare function resolveCommerceAISearchMessages(overrides?: Partial<CommerceAISearchMessages>): CommerceAISearchMessages;
|
|
110
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface PaymentMethodOption {
|
|
2
|
+
method: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PaymentAuthorizationRequest {
|
|
7
|
+
cartId: string;
|
|
8
|
+
/** Shared with order creation so retries stay idempotent. */
|
|
9
|
+
orderNumber: string;
|
|
10
|
+
method: string;
|
|
11
|
+
amount: {
|
|
12
|
+
centAmount: number;
|
|
13
|
+
currencyCode: string;
|
|
14
|
+
};
|
|
15
|
+
locale: string;
|
|
16
|
+
country?: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PaymentAuthorizationResult {
|
|
20
|
+
status: "authorized" | "pending" | "failed";
|
|
21
|
+
/** PSP charge / intent / transaction reference. */
|
|
22
|
+
interfaceId?: string;
|
|
23
|
+
failureReason?: string;
|
|
24
|
+
/** Opaque client payload (redirect / SCA). Never include secrets. */
|
|
25
|
+
clientData?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
export interface PaymentProvider {
|
|
28
|
+
readonly paymentInterface: string;
|
|
29
|
+
listMethods(context: {
|
|
30
|
+
locale: string;
|
|
31
|
+
country?: string;
|
|
32
|
+
}): Promise<PaymentMethodOption[]>;
|
|
33
|
+
authorize(request: PaymentAuthorizationRequest): Promise<PaymentAuthorizationResult>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heuristic for the search box: a new multi-item query should not be treated as
|
|
3
|
+
* a facet NL refine of the previous session.
|
|
4
|
+
*/
|
|
5
|
+
export declare function looksLikeCompoundShoppingList(query: string): boolean;
|
|
6
|
+
//# sourceMappingURL=compound-shopping-list.d.ts.map
|