@shopify/app-bridge-core
Version:
**[Join our team and work on libraries like this one.](https://www.shopify.ca/careers)**
34 lines (33 loc) • 1.02 kB
TypeScript
import { Group, MetaAction } from '../types';
export interface ExchangeRequiredPayload {
status: 'needsExchange';
code: string;
hmac: string;
timestamp: string;
shop: string;
readonly id: string;
}
export interface FailedResponsePayload {
status: 'failure';
readonly id: string;
}
export declare enum Action {
REQUEST = "APP::AUTH_CODE::REQUEST",
RESPOND = "APP::AUTH_CODE::RESPOND"
}
export interface RequestPayload {
readonly id: string;
}
export interface ActionBase extends MetaAction {
readonly group: typeof Group.AuthCode;
}
export interface RequestAuthCodeAction extends ActionBase {
readonly type: typeof Action.REQUEST;
payload: RequestPayload;
}
export interface RespondWithAuthCodeAction extends ActionBase {
readonly type: typeof Action.RESPOND;
payload?: ResponsePayload;
}
export type ResponsePayload = ExchangeRequiredPayload | FailedResponsePayload;
export declare function respond(payload?: ResponsePayload): RespondWithAuthCodeAction;