UNPKG

@shopify/app-bridge-host

Version:

App Bridge Host contains components and middleware to be consumed by the app's host, as well as the host itself. The middleware and `Frame` component are responsible for facilitating communication between the client and host, and used to act on actions se

28 lines (27 loc) 1.45 kB
import React from 'react'; import { ActionCreatorsMapObject } from 'redux'; import { ComponentProps } from './types'; import { Feature, FeatureWithApi, FeatureWithRouterApi } from './features/utilities/types'; /** * @deprecated * @remarks * Use from {@link ./features/utilities/types | features util} instead. */ export { Feature, FeatureWithApi, FeatureWithRouterApi }; /** * The interface the props of a component with a feature * @public * */ export interface FeatureProps<LocalStore, LocalActions> extends ComponentProps { /** actions for the feature*/ actions: LocalActions; /** the local store for the feature*/ store: LocalStore; } /** * A higher order component that takes a feature and make its actions and reducer available * @public * @returns a component which has access to the feature actions and local state */ export default function withFeature<LocalStore, LocalActions extends ActionCreatorsMapObject, Api>(feature: Feature<LocalStore, LocalActions> | FeatureWithApi<LocalStore, LocalActions, Api> | FeatureWithRouterApi<LocalStore, LocalActions, Api>): <OwnProps>(WrappedComponent: React.ComponentType<OwnProps>) => React.ComponentType<OwnProps & ComponentProps & FeatureProps<LocalActions, LocalStore>>; export declare function useSetFeatureApi<LocalStore, LocalActions, Api>(feature: Feature<LocalStore, LocalActions> | FeatureWithApi<LocalStore, LocalActions, Api>, localActions: LocalActions): void;