@constructor-io/constructorio-ui-autocomplete 1.28.2 → 1.29.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.
@@ -247,4 +247,6 @@ export interface PodData {
247
247
  podId: string;
248
248
  displayName: string;
249
249
  request: Partial<AutocompleteRequestType>;
250
+ resultId?: string;
251
+ numResults?: number;
250
252
  }
@@ -0,0 +1,75 @@
1
+ import { Item, Section } from '../types';
2
+ export declare const cnstrcDataAttrs: {
3
+ common: {
4
+ itemId: string;
5
+ itemName: string;
6
+ itemPrice: string;
7
+ variationId: string;
8
+ numResults: string;
9
+ conversionBtn: string;
10
+ resultId: string;
11
+ itemSection: string;
12
+ itemGroup: string;
13
+ slCampaignId: string;
14
+ slCampaignOwner: string;
15
+ section: string;
16
+ };
17
+ autocomplete: {
18
+ input: string;
19
+ inputForm: string;
20
+ searchSubmitButton: string;
21
+ autocompleteContainer: string;
22
+ };
23
+ recommendations: {
24
+ recommendationsContainer: string;
25
+ recommendationsPodId: string;
26
+ item: string;
27
+ strategyId: string;
28
+ seedItems: string;
29
+ };
30
+ custom: {
31
+ customSection: string;
32
+ customSectionName: string;
33
+ };
34
+ };
35
+ export interface CnstrcDataAttrs {
36
+ [key: string]: string | number | boolean | undefined;
37
+ }
38
+ /**
39
+ * Normalize itemIds to array format for seed items
40
+ */
41
+ export declare function normalizeSeedItems(itemIds?: string | string[]): string[] | undefined;
42
+ /**
43
+ * Get data attributes for autocomplete/recommendation items
44
+ *
45
+ * @param item - The item to generate data attributes for
46
+ * @returns An object containing data attributes to be spread onto the element
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * // For autocomplete items
51
+ * const itemProps = getItemCnstrcDataAttributes(searchSuggestionItem);
52
+ * <li {...itemProps}>Search Suggestion</li>
53
+ *
54
+ * // For recommendation items
55
+ * const recItemProps = getItemCnstrcDataAttributes(recommendationItem);
56
+ * <div {...recItemProps}>Recommended Product</div>
57
+ * ```
58
+ */
59
+ export declare function getItemCnstrcDataAttributes(item: Item): CnstrcDataAttrs;
60
+ /**
61
+ * Get data attributes for recommendation sections
62
+ */
63
+ export declare function getRecommendationsSectionCnstrcDataAttributes(section: Section, resultId?: string, numResults?: number, seedItems?: string[]): CnstrcDataAttrs;
64
+ export type ConversionType = 'add_to_cart' | 'add_to_wishlist' | 'like' | 'message' | 'make_offer' | 'read' | string;
65
+ /**
66
+ * Get data attributes for conversion buttons
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * <button {...getConversionButtonCnstrcDataAttributes('add_to_cart')}>
71
+ * Add to Cart
72
+ * </button>
73
+ * ```
74
+ */
75
+ export declare function getConversionButtonCnstrcDataAttributes(conversionType: ConversionType): CnstrcDataAttrs;
@@ -1,2 +1,2 @@
1
- declare const _default: "1.28.2";
1
+ declare const _default: "1.29.0";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-ui-autocomplete",
3
- "version": "1.28.2",
3
+ "version": "1.29.0",
4
4
  "description": "Constructor.io Autocomplete UI library for web applications",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",