@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
35 lines (34 loc) • 1.63 kB
TypeScript
import type { FeaturesState, FeaturesAction, FeaturePermission } from '@shopify/app-bridge-core/client';
import { AnyAction, Group } from '@shopify/app-bridge-core/actions/types';
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(actions: object | object[], 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 | undefined, action: UpdateAction | LegacyUpdateAction | 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 | undefined, action: UpdateAction | LegacyUpdateAction | 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: Group[]): FeaturesState;