-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(checkout): CHECKOUT-4223 Add
CheckoutSupport
interface, to be …
…implemented by classes used to check if feature is supported by certain type of checkout
- Loading branch information
Showing
3 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default interface CheckoutSupport { | ||
/** | ||
* Check if a feature is supported. | ||
* | ||
* If a feature is not supported, the call will throw an error. | ||
* Otherwise, it will return true. It will always return true if the | ||
* application is not running as Embedded Checkout. | ||
*/ | ||
isSupported(...ids: string[]): boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import CheckoutSupport from './CheckoutSupport'; | ||
|
||
export default class NoopCheckoutSupport implements CheckoutSupport { | ||
isSupported(): boolean { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { CheckoutContextProps } from './CheckoutContext'; | ||
import { CheckoutProviderProps, CheckoutProviderState } from './CheckoutProvider'; | ||
import CheckoutSupport from './CheckoutSupport'; | ||
|
||
export type CheckoutContextProps = CheckoutContextProps; | ||
export type CheckoutProviderProps = CheckoutProviderProps; | ||
export type CheckoutProviderState = CheckoutProviderState; | ||
export type CheckoutSupport = CheckoutSupport; | ||
|
||
export { default as CheckoutContext } from './CheckoutContext'; | ||
export { default as CheckoutProvider } from './CheckoutProvider'; | ||
export { default as withCheckout } from './withCheckout'; | ||
export { default as NoopCheckoutSupport } from './NoopCheckoutSupport'; |