UNPKG

963 BTypeScriptView Raw
1import { StatusCode, CspDirective } from '@shopify/network';
2import { EffectKind } from '@shopify/react-effect';
3export { NetworkContext } from './context';
4export declare const EFFECT_ID: unique symbol;
5interface Options {
6 headers?: Record<string, string>;
7}
8export declare class NetworkManager {
9 readonly effect: EffectKind;
10 private statusCodes;
11 private redirectUrl?;
12 private readonly csp;
13 private readonly headers;
14 private readonly requestHeaders;
15 constructor({ headers }?: Options);
16 reset(): void;
17 getHeader(header: string): string;
18 setHeader(header: string, value: string): void;
19 redirectTo(url: string, status?: StatusCode): void;
20 addStatusCode(statusCode: StatusCode): void;
21 addCspDirective(directive: CspDirective, value: string | string[] | boolean): void;
22 extract(): {
23 status: number | undefined;
24 headers: Map<string, string>;
25 redirectUrl: string | undefined;
26 };
27}