UNPKG

@shopify/app-bridge-host

Version:

App Bridge Host contains middleware and components that are meant to be consumed by the app's host. The middleware and `Frame` component are responsible for facilitating messages posted between the client and host, and used to act on actions sent from the

35 lines (34 loc) 1.74 kB
import { FeaturesState, FeaturesAction, FeaturePermission } from '@shopify/app-bridge'; import * as Actions from '@shopify/app-bridge/actions'; import { LegacyUpdateAction, UpdateAction } from './actions'; export declare const defaultFeaturesStore: FeaturesState; /** * Map an action enum to the given permission * @public * @param actions - the actions enum * @param value - the permission to set * @returns an object with keys mapped to the actions and value set to the given permission */ export declare function setFeature<A extends Object>(actions: A, value?: boolean | FeaturePermission): FeaturesAction; /** * Returns the updated feature state * @param state - the current state * @param action - the update action with partial features in the payload * @internal * */ export default function featuresReducer(state: FeaturesState<Record<Actions.Group, FeaturesAction>> | undefined, action: UpdateAction | LegacyUpdateAction | Actions.AnyAction): FeaturesState; /** * Returns the updated feature state * @param state - the current state * @param action - the update action with partial features in the payload * @internal * */ export declare function asyncFeaturesReducer(state: FeaturesState<Record<Actions.Group, FeaturesAction>> | undefined, action: UpdateAction | LegacyUpdateAction | Actions.AnyAction): FeaturesState; /** * Returns the features state with the provided group(s) enabled * The permission is set for both Main and Modal context * according to the default feature permission rules * @argument keys - the group(s) to enable the feature permission * @public * */ export declare function setFeaturesAvailable(...features: Actions.Group[]): FeaturesState<Record<Actions.Group, FeaturesAction>>;