@swishapp/browser
Version: 
JS library to integrate Swish into a browser environment.
58 lines (57 loc) • 1.37 kB
TypeScript
import type { SwishClientConfig } from "@swishapp/api-client";
import type { SwishApp } from "./swish";
import type { StorefrontConfig } from "./storefront-api/storefront-api-client";
export interface SwishAppOptions {
    loadProfile?: () => string | undefined;
    storeProfile?: (profile: string) => void;
    deleteProfile?: () => void;
    proxy: {
        baseUrl: string;
    };
    swishApi?: SwishClientConfig;
    ui?: SwishUiOptions;
    storefront: StorefrontConfig;
}
export interface SwishUiOptions {
    baseUrl: string;
    version: string;
}
export interface SwishUiManifest {
    scripts: Record<string, string>;
    prerender: Record<string, string>;
    css: {
        critical: string;
    };
    stylesheets: {
        nonCritical: string;
    };
    version: string;
}
export interface SwishUiElementSpec {
    script: string;
    template: string;
}
export interface SwishEmbedData {
    customer: {
        id: string | null;
        email: string | null;
        firstName: string | null;
        lastName: string | null;
        b2b: boolean | null;
    };
    localization: {
        country: string;
        language: string;
        market: number;
    };
    routes: {
        accountUrl: string;
        accountLoginUrl: string;
        rootUrl: string;
    };
}
declare global {
    interface Window {
        swish: SwishApp;
    }
}