@alloyidentity/web-sdk
Version:
Alloy Web Document SDK
288 lines (287 loc) • 7.71 kB
TypeScript
import { ActionNamespaces } from './actions/types';
export type EvaluationData = {
nameFirst?: string;
nameLast?: string;
addressLine1?: string;
addressLine2?: string;
addressCity?: string;
addressState?: string;
addressPostalCode?: string;
addressCountryCode?: string;
birthDate?: string;
phoneNumber?: string;
emailAddress?: string;
};
type DocumentTypes = 'license' | 'passport';
type Colors = {
primary: string;
secondary: string;
};
export type CustomTheme = {
primaryColor?: string;
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
iconColor?: string;
successColor?: string;
errorColor?: string;
};
export type ComponentOverride = {
PrimaryButton?: {
default?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
hover?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
focus?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
};
ExitButton?: {
default?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
hover?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
focus?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
};
PictureButton?: {
default?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
hover?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
focus?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
};
};
SelectorButton?: {
default?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
iconColor?: string;
};
hover?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
iconColor?: string;
};
focus?: {
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
border?: string;
boxShadow?: string;
iconColor?: string;
};
};
Header?: {
default?: {
backgroundColor?: string;
textColor?: string;
border?: string;
boxShadow?: string;
borderRadius?: string;
};
};
HelpBanner?: {
default?: {
backgroundColor?: string;
textColor?: string;
border?: string;
boxShadow?: string;
borderRadius?: string;
iconColor?: string;
};
};
PhoneInput?: {
default?: {
backgroundColor?: string;
textColor?: string;
border?: string;
boxShadow?: string;
borderRadius?: string;
};
};
};
export type CustomStyle = {
theme: CustomTheme;
componentOverride: ComponentOverride;
};
type Entity = {
entity_type: string;
branch_name?: string;
data: {
[key: string]: any;
};
};
export type JourneyData = {
entities: Entity[];
external_group_id?: string;
external_product_id?: string;
do_await_additional_entities?: boolean;
};
/**
* The Init params related to BC only
*/
export interface BCInit {
bcCustomerSessionId: string;
bcBrand: string;
bcContext: string;
bcJsUrl: string;
}
export type BCInitResult = BCInit & {
bcCdApi: typeof window.cdApi;
bcClient: typeof window.bcClient;
};
export type InitResult = Init & Partial<BCInitResult> & {
services: ActionNamespaces;
};
export type Init = {
key: string;
npmPackageVersion?: string;
appUrl?: string;
apiUrl?: string;
entityToken?: string;
externalEntityId?: string;
evaluationData?: EvaluationData;
production?: boolean;
maxEvaluationAttempts?: number;
documents?: Array<DocumentTypes | string>;
selfie?: boolean;
color?: Colors;
customStyle?: CustomStyle;
customerSlug?: string;
forceMobile?: boolean;
showHeader?: boolean;
validationPreChecks?: boolean;
journeyApplicationToken?: string;
journeyToken?: string;
isSingleEntity?: boolean;
socurePublicToken?: string;
socureDeviceId?: string;
socureDigitalIntelPublicToken?: string;
socureSessionToken?: string;
socureCustomerSessionId?: string;
neuroIdSiteId?: string;
neuroUserId?: string;
neuroIdFunnel?: string;
threatmetrixSessionId?: string;
threatmetrixOrgId?: string;
iovationBlackboxId?: string;
isReactNative?: boolean;
isAndroidDevice?: boolean;
telemetry?: boolean;
experianCrossCoreFraudNetHdim?: string;
experianCrossCoreFraudNetJsc?: string;
runtimePlatform?: 'web' | 'hybrid';
language?: string;
removeClosingDelay?: boolean;
skipBehavioralPluginsFetch?: boolean;
alloyRequestFields?: Record<string, string | boolean>;
} & Partial<BCInit>;
export type Alloy = {
init: (initParam: Init) => Promise<InitResult>;
preload: (anchorElement?: string) => void;
open: (cb: (data: any) => void, anchorElement?: string) => void;
close: () => void;
createJourneyApplication: (journeyData: any) => Promise<any>;
createEvaluation: (data: any) => Promise<any>;
getPublicUrl: () => string;
};
export interface ClientServices {
isNeuroIdEnabled: boolean;
neuroIdSiteId: string;
isIovationEnabled: boolean;
isSocureEnabled: boolean;
socurePublicToken: string;
isThreatmetrixEnabled: boolean;
threatmetrixOrgId: string;
isSocureDigitalIntelEnabled: boolean;
socureDigitalIntelPublicToken: string;
bcBrand: string;
bcJsUrl: string;
bcWupUrl: string;
bcCid: string;
isExperianCrossCoreFraudNetEnabled: boolean;
}
export declare enum PluginType {
IOVATION = "Iovation",
NEURO_ID = "Neuro Id",
BIOCATCH = "BioCatch",
FRAUDNET = "Experian FraudNet",
SOCURE_DEVICE_RISK = "Socure Device Risk",
SOCURE_DIGITAL_INTELLIGENCE = "Socure Digital Intelligence",
THREATMETRIX = "Threatmetrix"
}
export declare enum LogLevel {
ERROR = "error",
DEBUG = "debug",
INFO = "info",
LOG = "log",
WARN = "warn"
}
export type Metrics = {
accessToken: string;
logging?: MetricsLogging;
analytics?: MetricsAnalytics;
plugin?: PluginType;
};
export type MetricsLogging = {
message: string;
body?: any;
type: LogLevel;
};
export type MetricsAnalytics = {
customerSlug?: string;
id?: string;
metricName: string;
};
export {};