@magicx-eng/ai-autocomplete-angular 0.41.0 → 0.42.1

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.
@@ -1454,6 +1454,12 @@ class AIAutocompleteController {
1454
1454
  return;
1455
1455
  this.core.reset();
1456
1456
  }
1457
+ /** Prepare the typed word before you build a submit result from your own button. */
1458
+ prepareSubmit() {
1459
+ if (this.isDestroyed)
1460
+ return;
1461
+ this.core.prepareSubmit();
1462
+ }
1457
1463
  /**
1458
1464
  * Records a submit in telemetry. Enter is recorded by the SDK; call this
1459
1465
  * from a submit button you render, so each submit is counted once.
@@ -2466,9 +2472,8 @@ class AIAutocompleteComponent {
2466
2472
  const state = this.controller.getState();
2467
2473
  if (!this.canSubmit(state))
2468
2474
  return;
2469
- // Synthesize the result for the submit-button click path; same shape
2470
- // the controller would deliver from a keyboard Enter, so handleSubmit
2471
- // can take either entry point.
2475
+ this.controller.prepareSubmit();
2476
+ // Use the same handler for button clicks and Enter.
2472
2477
  this.handleSubmit({
2473
2478
  query: state.text.trim(),
2474
2479
  raw_query: "",