@@ -61,7 +61,6 @@ export class Action {
6161 private readonly _data : NextAction ,
6262 private readonly _metadata : ActionMetadata ,
6363 private readonly _supportStrategy : ActionSupportStrategy ,
64- private _adapter ?: ActionAdapter ,
6564 private readonly _chainMetadata : ActionChainMetadata = { isChained : false } ,
6665 private readonly _id ?: string ,
6766 private readonly _experimental ?: ExperimentalFeatures ,
@@ -162,30 +161,9 @@ export class Action {
162161 } ;
163162 }
164163
165- public get adapterUnsafe ( ) {
166- return this . _adapter ;
167- }
168-
169- public get adapter ( ) {
170- if ( ! this . _adapter ) {
171- throw new Error ( 'No adapter provided' ) ;
172- }
173-
174- return this . _adapter ;
175- }
176-
177- /**
178- * Set the adapter for the action.
179- * Not recommended to use in react environments, consider using Action.update() instead that returns a new instance.
180- * @param adapter The adapter to set
181- */
182- public setAdapter ( adapter : ActionAdapter ) {
183- this . _adapter = adapter ;
184- }
185-
186- public async isSupported ( ) {
164+ public async isSupported ( adapter : ActionAdapter ) {
187165 try {
188- return await this . _supportStrategy ( this ) ;
166+ return await this . _supportStrategy ( this , adapter ) ;
189167 } catch ( e ) {
190168 console . error (
191169 `[@dialectlabs/blinks] Failed to check supportability for action ${ this . url } ` ,
@@ -210,7 +188,6 @@ export class Action {
210188 next . action ,
211189 this . metadata ,
212190 this . _supportStrategy ,
213- this . adapter ,
214191 {
215192 isChained : true ,
216193 isInline : true ,
@@ -257,7 +234,6 @@ export class Action {
257234 data ,
258235 metadata ,
259236 this . _supportStrategy ,
260- this . adapter ,
261237 {
262238 isChained : true ,
263239 isInline : false ,
@@ -272,23 +248,20 @@ export class Action {
272248 data : NextAction ,
273249 metadata : ActionMetadata ,
274250 supportStrategy : ActionSupportStrategy ,
275- adapter ?: ActionAdapter ,
276251 ) {
277252 const id = nanoid ( ) ;
278253 return new Action (
279254 url ,
280255 data ,
281256 metadata ,
282257 supportStrategy ,
283- adapter ,
284258 { isChained : false } ,
285259 id ,
286260 ) ;
287261 }
288262
289263 private static async _fetch (
290264 apiUrl : string ,
291- adapter ?: ActionAdapter ,
292265 supportStrategy : ActionSupportStrategy = defaultActionSupportStrategy ,
293266 chainMetadata ?: ActionChainMetadata ,
294267 id ?: string ,
@@ -314,7 +287,6 @@ export class Action {
314287 { ...data , type : 'action' } ,
315288 metadata ,
316289 supportStrategy ,
317- adapter ,
318290 chainMetadata ,
319291 id ,
320292 data . dialectExperimental ,
@@ -323,13 +295,11 @@ export class Action {
323295
324296 static async fetch (
325297 apiUrl : string ,
326- adapter ?: ActionAdapter ,
327298 supportStrategy : ActionSupportStrategy = defaultActionSupportStrategy ,
328299 ) {
329300 const id = nanoid ( ) ;
330301 return Action . _fetch (
331302 apiUrl ,
332- adapter ,
333303 supportStrategy ,
334304 {
335305 isChained : false ,
@@ -341,23 +311,18 @@ export class Action {
341311 refresh ( ) {
342312 return Action . _fetch (
343313 this . url ,
344- this . adapter ,
345314 this . _supportStrategy ,
346315 this . _chainMetadata ,
347316 this . _id ,
348317 ) ;
349318 }
350319
351- withUpdate ( update : {
352- adapter ?: ActionAdapter ;
353- supportStrategy ?: ActionSupportStrategy ;
354- } ) {
320+ withUpdate ( update : { supportStrategy ?: ActionSupportStrategy } ) {
355321 return new Action (
356322 this . _url ,
357323 this . _data ,
358324 this . _metadata ,
359325 update . supportStrategy ?? this . _supportStrategy ,
360- update . adapter ?? this . _adapter ,
361326 this . _chainMetadata ,
362327 this . _id ,
363328 this . _experimental ,
0 commit comments