@@ -9,6 +9,7 @@ import Component from '@glimmer/component';
9
9
10
10
import { restartableTask , task , timeout } from ' ember-concurrency' ;
11
11
import focusTrap from ' ember-focus-trap/modifiers/focus-trap' ;
12
+ import { consume } from ' ember-provide-consume-context' ;
12
13
13
14
import flatMap from ' lodash/flatMap' ;
14
15
@@ -18,15 +19,17 @@ import { Button, BoxelInput } from '@cardstack/boxel-ui/components';
18
19
import { eq , not } from ' @cardstack/boxel-ui/helpers' ;
19
20
20
21
import {
21
- createNewCard ,
22
- baseRealm ,
23
22
type CodeRef ,
24
23
type CreateNewCard ,
24
+ type getCards ,
25
+ createNewCard ,
26
+ baseRealm ,
25
27
Deferred ,
26
28
Loader ,
27
29
RealmInfo ,
28
30
CardCatalogQuery ,
29
31
isCardInstance ,
32
+ GetCardsContextName ,
30
33
} from ' @cardstack/runtime-common' ;
31
34
32
35
import type {
@@ -43,8 +46,6 @@ import {
43
46
44
47
import type { CardDef } from ' https://cardstack.com/base/card-api' ;
45
48
46
- import { getSearch , type SearchResource } from ' ../../resources/search' ;
47
-
48
49
import {
49
50
suggestCardChooserTitle ,
50
51
getSuggestionWithLowestDepth ,
@@ -71,7 +72,7 @@ interface Signature {
71
72
}
72
73
73
74
type Request = {
74
- search: SearchResource ;
75
+ search: ReturnType < getCards > ;
75
76
deferred: Deferred <CardDef | undefined >;
76
77
opts? : {
77
78
offerToCreate? : {
@@ -231,8 +232,10 @@ export default class CardCatalogModal extends Component<Signature> {
231
232
< /style >
232
233
</template >
233
234
234
- stateStack: State [] = new TrackedArray <State >();
235
- stateId = 0 ;
235
+ @consume (GetCardsContextName ) private declare getCards: getCards ;
236
+
237
+ private stateStack: State [] = new TrackedArray <State >();
238
+ private stateId = 0 ;
236
239
@service private declare cardService: CardService ;
237
240
@service private declare loaderService: LoaderService ;
238
241
@service private declare operatorModeStateService: OperatorModeStateService ;
@@ -358,7 +361,7 @@ export default class CardCatalogModal extends Component<Signature> {
358
361
opts ?.multiSelect ,
359
362
);
360
363
let request = new TrackedObject <Request >({
361
- search: getSearch (this , () => query ),
364
+ search: this . getCards (this , () => query ),
362
365
deferred: new Deferred (),
363
366
opts ,
364
367
});
0 commit comments