@magicx-eng/ai-autocomplete-vanilla 0.50.1 → 0.51.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/dist/index.d.mts CHANGED
@@ -88,6 +88,12 @@ interface Suggestion {
88
88
  required: boolean;
89
89
  options?: SuggestionOption[];
90
90
  type?: SuggestionType;
91
+ /**
92
+ * Asks for the Smart Suggestion look (sparkle and shimmer) on an ordinary
93
+ * question, such as one the server curated for a question query. It changes
94
+ * nothing about how the options are answered.
95
+ */
96
+ smart_suggestion?: boolean;
91
97
  }
92
98
  interface InputItem {
93
99
  parameter: string;
@@ -114,6 +120,15 @@ interface RecentlySuggested {
114
120
  parameter: string;
115
121
  text: string;
116
122
  }
123
+ /** Presentment currency context for suggestion requests. */
124
+ interface CurrencyOptions {
125
+ /** ISO 4217 presentment currency code. */
126
+ code: string;
127
+ /** Conversion rate from shop currency to presentment currency. Must be finite and positive. */
128
+ rate: number;
129
+ /** Optional ISO 3166 alpha-2 country code. */
130
+ country?: string;
131
+ }
117
132
  interface AutocompleteRequest {
118
133
  data: {
119
134
  raw_query: string;
@@ -129,6 +144,9 @@ interface AutocompleteRequest {
129
144
  request_id: string;
130
145
  request_at: string;
131
146
  language: string;
147
+ currency?: string;
148
+ currency_rate?: number;
149
+ country?: string;
132
150
  client_version: string;
133
151
  session_id: string;
134
152
  source?: "full-sdk" | "headless-sdk";
@@ -262,6 +280,8 @@ interface MatchedItems {
262
280
  * null.
263
281
  */
264
282
  interface CustomFieldsReport {
283
+ /** ISO 4217 currency code for the reported prices. */
284
+ currency?: string;
265
285
  /** Constraints the catalog read actually ran under. */
266
286
  applied_filters: ExpressedFilter[];
267
287
  /**
@@ -991,6 +1011,8 @@ interface CoreOptions {
991
1011
  * Unsupported languages use English.
992
1012
  */
993
1013
  language?: string;
1014
+ /** Sends currency context with suggestions when the code and a finite positive rate are set. */
1015
+ currency?: CurrencyOptions;
994
1016
  /**
995
1017
  * Your product id. When set, what the dropdown offers before anything is
996
1018
  * typed is read from a cacheable URL for your product, with no credential,
@@ -2638,11 +2660,18 @@ declare function buildSubmitResult(text: string, completedParams: CompletedParam
2638
2660
 
2639
2661
  /** True for the suggestion whose options complete the word being typed. */
2640
2662
  declare function isTraditionalAutocompleteSuggestion(suggestion: Suggestion | undefined | null): boolean;
2663
+ /** True for a suggestion drawn with the Smart Suggestion header: the traditional autocomplete one, or a question the server marks. */
2664
+ declare function isSmartSuggestion(suggestion: Suggestion | undefined | null): boolean;
2641
2665
  /** Drops the traditional autocomplete suggestion where only real pills make sense. */
2642
2666
  declare function withoutTraditionalAutocomplete(suggestions: Suggestion[]): Suggestion[];
2643
2667
  /** Gives the traditional autocomplete suggestion its header when the server left the text empty. */
2644
2668
  declare function labelTraditionalAutocomplete(suggestions: Suggestion[], header: string): Suggestion[];
2669
+ /**
2670
+ * The sparkle drawn after the Smart Suggestion header (over completions, or on a marked question), in currentColor.
2671
+ * A fixed string, so React and Angular can insert it as markup too.
2672
+ */
2673
+ declare const SMART_SUGGESTION_SPARKLE_SVG: string;
2645
2674
  /** True when some pill is a question the shopper can decline. */
2646
2675
  declare function hasSkippablePill(suggestions: Suggestion[]): boolean;
2647
2676
 
2648
- export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, OPTION_IMAGE_WIDTH, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, type TaskKind, type TextPart, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isTraditionalAutocompleteSuggestion, isoDate, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withoutTraditionalAutocomplete };
2677
+ export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type CurrencyOptions, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, OPTION_IMAGE_WIDTH, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, SMART_SUGGESTION_SPARKLE_SVG, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, type TaskKind, type TextPart, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withoutTraditionalAutocomplete };
package/dist/index.d.ts CHANGED
@@ -88,6 +88,12 @@ interface Suggestion {
88
88
  required: boolean;
89
89
  options?: SuggestionOption[];
90
90
  type?: SuggestionType;
91
+ /**
92
+ * Asks for the Smart Suggestion look (sparkle and shimmer) on an ordinary
93
+ * question, such as one the server curated for a question query. It changes
94
+ * nothing about how the options are answered.
95
+ */
96
+ smart_suggestion?: boolean;
91
97
  }
92
98
  interface InputItem {
93
99
  parameter: string;
@@ -114,6 +120,15 @@ interface RecentlySuggested {
114
120
  parameter: string;
115
121
  text: string;
116
122
  }
123
+ /** Presentment currency context for suggestion requests. */
124
+ interface CurrencyOptions {
125
+ /** ISO 4217 presentment currency code. */
126
+ code: string;
127
+ /** Conversion rate from shop currency to presentment currency. Must be finite and positive. */
128
+ rate: number;
129
+ /** Optional ISO 3166 alpha-2 country code. */
130
+ country?: string;
131
+ }
117
132
  interface AutocompleteRequest {
118
133
  data: {
119
134
  raw_query: string;
@@ -129,6 +144,9 @@ interface AutocompleteRequest {
129
144
  request_id: string;
130
145
  request_at: string;
131
146
  language: string;
147
+ currency?: string;
148
+ currency_rate?: number;
149
+ country?: string;
132
150
  client_version: string;
133
151
  session_id: string;
134
152
  source?: "full-sdk" | "headless-sdk";
@@ -262,6 +280,8 @@ interface MatchedItems {
262
280
  * null.
263
281
  */
264
282
  interface CustomFieldsReport {
283
+ /** ISO 4217 currency code for the reported prices. */
284
+ currency?: string;
265
285
  /** Constraints the catalog read actually ran under. */
266
286
  applied_filters: ExpressedFilter[];
267
287
  /**
@@ -991,6 +1011,8 @@ interface CoreOptions {
991
1011
  * Unsupported languages use English.
992
1012
  */
993
1013
  language?: string;
1014
+ /** Sends currency context with suggestions when the code and a finite positive rate are set. */
1015
+ currency?: CurrencyOptions;
994
1016
  /**
995
1017
  * Your product id. When set, what the dropdown offers before anything is
996
1018
  * typed is read from a cacheable URL for your product, with no credential,
@@ -2638,11 +2660,18 @@ declare function buildSubmitResult(text: string, completedParams: CompletedParam
2638
2660
 
2639
2661
  /** True for the suggestion whose options complete the word being typed. */
2640
2662
  declare function isTraditionalAutocompleteSuggestion(suggestion: Suggestion | undefined | null): boolean;
2663
+ /** True for a suggestion drawn with the Smart Suggestion header: the traditional autocomplete one, or a question the server marks. */
2664
+ declare function isSmartSuggestion(suggestion: Suggestion | undefined | null): boolean;
2641
2665
  /** Drops the traditional autocomplete suggestion where only real pills make sense. */
2642
2666
  declare function withoutTraditionalAutocomplete(suggestions: Suggestion[]): Suggestion[];
2643
2667
  /** Gives the traditional autocomplete suggestion its header when the server left the text empty. */
2644
2668
  declare function labelTraditionalAutocomplete(suggestions: Suggestion[], header: string): Suggestion[];
2669
+ /**
2670
+ * The sparkle drawn after the Smart Suggestion header (over completions, or on a marked question), in currentColor.
2671
+ * A fixed string, so React and Angular can insert it as markup too.
2672
+ */
2673
+ declare const SMART_SUGGESTION_SPARKLE_SVG: string;
2645
2674
  /** True when some pill is a question the shopper can decline. */
2646
2675
  declare function hasSkippablePill(suggestions: Suggestion[]): boolean;
2647
2676
 
2648
- export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, OPTION_IMAGE_WIDTH, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, type TaskKind, type TextPart, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isTraditionalAutocompleteSuggestion, isoDate, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withoutTraditionalAutocomplete };
2677
+ export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type CurrencyOptions, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, OPTION_IMAGE_WIDTH, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, SMART_SUGGESTION_SPARKLE_SVG, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, type TaskKind, type TextPart, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withoutTraditionalAutocomplete };