@magicx-eng/ai-autocomplete-angular 0.13.1 → 0.14.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.
@@ -1032,6 +1032,7 @@ class AIAutocompleteController {
1032
1032
  this.text$ = deriveField(this.rawState$, (s) => s.text);
1033
1033
  this.completedParams$ = deriveField(this.rawState$, (s) => s.completedParams, arrEq);
1034
1034
  this.skippedParams$ = deriveField(this.rawState$, (s) => s.skippedParams, arrEq);
1035
+ this.identifiedParams$ = deriveField(this.rawState$, (s) => s.identifiedParams, arrEq);
1035
1036
  this.suggestionPills$ = deriveField(this.rawState$, (s) => s.actionableSuggestions, arrEq);
1036
1037
  this.segments$ = deriveField(this.rawState$, (s) => s.segments, arrEq);
1037
1038
  this.newParamId$ = deriveField(this.rawState$, (s) => s.newParamId);
@@ -1078,6 +1079,15 @@ class AIAutocompleteController {
1078
1079
  getState() {
1079
1080
  return computeState(this.rawState$.value);
1080
1081
  }
1082
+ /**
1083
+ * The structured query as the SDK understands it right now — the same
1084
+ * object `onResult` delivers after each response and `onSubmit` delivers
1085
+ * on submit. Read it on demand from a place that has no event handy (a
1086
+ * custom submit button, a "save draft" action).
1087
+ */
1088
+ getResult() {
1089
+ return this.core.getResult();
1090
+ }
1081
1091
  // === Action methods (pass-through to the core) ===
1082
1092
  //
1083
1093
  // Every action method begins with an `isDestroyed` guard so that callers
@@ -1223,7 +1233,7 @@ class AIAutocompleteController {
1223
1233
  // === Lifecycle ===
1224
1234
  /**
1225
1235
  * Apply runtime changes to a subset of options. Event callbacks
1226
- * (`onSubmit`, `onError`, etc.) cannot be swapped this way — they are
1236
+ * (`onSubmit`, `onResult`, `onError`, etc.) cannot be swapped this way — they are
1227
1237
  * registered once at construction (matches the React hook's design). For
1228
1238
  * dynamic event reactivity, subscribe to the corresponding observable
1229
1239
  * (e.g. `text$` instead of `onChange`).
@@ -1277,6 +1287,7 @@ function computeState(s) {
1277
1287
  text: s.text,
1278
1288
  completedParams: s.completedParams,
1279
1289
  skippedParams: s.skippedParams,
1290
+ identifiedParams: s.identifiedParams,
1280
1291
  suggestionPills: s.actionableSuggestions,
1281
1292
  segments: s.segments,
1282
1293
  newParamId: s.newParamId,
@@ -1667,6 +1678,15 @@ class AIAutocompleteComponent {
1667
1678
  // === Outputs ===
1668
1679
  /** Called on Enter or submit-button click. */
1669
1680
  this.submitted = new EventEmitter();
1681
+ /**
1682
+ * Fires after every successful suggestion round-trip with the structured
1683
+ * query as the SDK now understands it — the same `AutocompleteResult` shape
1684
+ * `submitted` carries, so you can mirror the query as it is built (a live
1685
+ * preview, a draft, analytics) without waiting for submit. Fires once per
1686
+ * applied response, including the initial request on init (an empty
1687
+ * result); never for a failed, aborted or superseded request.
1688
+ */
1689
+ this.resultChange = new EventEmitter();
1670
1690
  this.errored = new EventEmitter();
1671
1691
  this.valueChange = new EventEmitter();
1672
1692
  this.completedParamsChange = new EventEmitter();
@@ -1713,6 +1733,7 @@ class AIAutocompleteComponent {
1713
1733
  value: this.value,
1714
1734
  completedParams: this.completedParams,
1715
1735
  onSubmit: (result) => this.handleSubmit(result),
1736
+ onResult: (result) => this.resultChange.emit(result),
1716
1737
  onError: (error) => this.errored.emit(error),
1717
1738
  onChange: (text) => {
1718
1739
  this.valueChange.emit(text);
@@ -1930,7 +1951,10 @@ class AIAutocompleteComponent {
1930
1951
  const text = extractPlainText(editor);
1931
1952
  const state = this.controller.getState();
1932
1953
  const params = this.completedParams ?? state.completedParams;
1933
- this.submitted.emit(buildSubmitResult$1(text, params, state.skippedParams));
1954
+ this.submitted.emit(buildSubmitResult$1(text, params, state.skippedParams, {
1955
+ identifiedParams: state.identifiedParams,
1956
+ isReady: state.isReady,
1957
+ }));
1934
1958
  this.controller.reset();
1935
1959
  }
1936
1960
  handleSubmitFromUserAction() {
@@ -1944,6 +1968,8 @@ class AIAutocompleteComponent {
1944
1968
  query: state.text.trim(),
1945
1969
  raw_query: "",
1946
1970
  completed_params: [],
1971
+ identified_params: [],
1972
+ is_ready: state.isReady,
1947
1973
  });
1948
1974
  }
1949
1975
  measurePillWrap() {
@@ -1971,7 +1997,7 @@ class AIAutocompleteComponent {
1971
1997
  }
1972
1998
  }
1973
1999
  AIAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1974
- AIAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIAutocompleteComponent, isStandalone: true, selector: "ai-autocomplete", inputs: { apiConfig: "apiConfig", additionalContext: "additionalContext", optionOverrides: "optionOverrides", maskCompletedText: "maskCompletedText", columns: "columns", pillPlacement: "pillPlacement", mode: "mode", optionsPosition: "optionsPosition", animations: "animations", dropdownTrigger: "dropdownTrigger", closeDropdownOnBlur: "closeDropdownOnBlur", showNonTappableOptions: "showNonTappableOptions", showSkipButton: "showSkipButton", autoFocus: "autoFocus", value: "value", completedParams: "completedParams", products: "products", submitButton: "submitButton" }, outputs: { submitted: "submitted", errored: "errored", valueChange: "valueChange", completedParamsChange: "completedParamsChange", focused: "focused", blurred: "blurred", productSelect: "productSelect" }, providers: [
2000
+ AIAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIAutocompleteComponent, isStandalone: true, selector: "ai-autocomplete", inputs: { apiConfig: "apiConfig", additionalContext: "additionalContext", optionOverrides: "optionOverrides", maskCompletedText: "maskCompletedText", columns: "columns", pillPlacement: "pillPlacement", mode: "mode", optionsPosition: "optionsPosition", animations: "animations", dropdownTrigger: "dropdownTrigger", closeDropdownOnBlur: "closeDropdownOnBlur", showNonTappableOptions: "showNonTappableOptions", showSkipButton: "showSkipButton", autoFocus: "autoFocus", value: "value", completedParams: "completedParams", products: "products", submitButton: "submitButton" }, outputs: { submitted: "submitted", resultChange: "resultChange", errored: "errored", valueChange: "valueChange", completedParamsChange: "completedParamsChange", focused: "focused", blurred: "blurred", productSelect: "productSelect" }, providers: [
1975
2001
  {
1976
2002
  provide: NG_VALUE_ACCESSOR,
1977
2003
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -2033,6 +2059,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2033
2059
  type: Input
2034
2060
  }], submitted: [{
2035
2061
  type: Output
2062
+ }], resultChange: [{
2063
+ type: Output
2036
2064
  }], errored: [{
2037
2065
  type: Output
2038
2066
  }], valueChange: [{