@simplr-ai/angular 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tokens.ts","../src/services/simplr.service.ts","../src/services/simplr-flags.service.ts","../src/services/simplr-profiles.service.ts","../src/services/simplr-rum.service.ts","../src/services/simplr-ai.service.ts","../src/services/simplr-error-handler.ts","../src/directives/simplr-protect.directive.ts","../src/directives/simplr-rum-view.directive.ts","../src/directives/simplr-protected-form.component.ts","../src/provider.ts"],"names":["SIMPLR_CONFIG","InjectionToken","SimplrService","core","config","SimplrFraud","apiKey","fraud","isReady","initialize","startTracking","stopTracking","reset","trackInput","fieldName","getDeviceSignals","collectDeviceSignals","getDeviceSignals$","from","getBehaviorSignals","collectBehaviorSignals","collect","collect$","check","input","signals","baseUrl","replace","res","fetch","method","headers","body","JSON","stringify","device","behavior","json","catch","ok","Error","message","error","status","content","check$","ngOnDestroy","providedIn","SimplrFlagsService","SimplrFlags","flags$","BehaviorSubject","refreshTimer","autoInitDone","overrides","refreshIntervalMs","flags","cfg","emit","setInterval","refresh","setUser","userId","refresh$","isEnabled","key","ctx","observeFlag","pipe","map","distinctUntilChanged","getAll","next","clearInterval","dispose","complete","SimplrProfilesService","SimplrProfiles","profiles","collectBiometrics","autoStart","setDeviceSignalCollector","identify","externalId","options","identify$","submitOrder","order","submitOrder$","getProfileRisk","getProfileRisk$","reportOutcome","outcome","reportOutcome$","SimplrRumService","SimplrRUM","getInstance","merged","rum","isInitialized","attributes","clearUser","addAttribute","value","removeAttribute","trackView","name","trackAction","type","trackError","context","log","level","stopSession","flush","getSessionId","getViewId","SimplrAIService","SimplrAI","endpoint","ai","connect","connect$","createDelegation","createDelegation$","validate","token","validate$","revoke","delegationId","reason","revoke$","list","list$","get","get$","stats","stats$","revokeAllForUser","revokeAllForUser$","SimplrErrorHandler","handleError","err","source","console","SimplrProtectDirective","simplrPreventDefault","simplrSignals","EventEmitter","simplrError","simplr","onSubmit","event","preventDefault","selector","standalone","SimplrRumViewDirective","viewName","simplrRumViewAttributes","ngOnInit","SimplrProtectedFormComponent","submitWithSignals","collectError","template","buildProviders","providers","provide","useValue","errorHandler","push","ErrorHandler","useClass","provideSimplr","makeEnvironmentProviders","SIMPLR_DIRECTIVES","SimplrModule","forRoot","ngModule","imports","exports"],"mappings":";;;;;;;;;AA6CO,IAAMA,aAAAA,GAAgB,IAAIC,mBAAAA,CAA6B,eAAA;;;;;;;;;;;;;;;;;;AC3BjDC,wBAAN,mBAAA,CAAMA;AAAAA,EAAAA;;;;AAEFC,EAAAA,IAAAA;AAEQC,EAAAA,MAAAA;AAEjB,EAAA,WAAA,CAA+CA,MAAAA,EAAuB;AACpE,IAAA,IAAA,CAAKA,MAAAA,GAASA,MAAAA;AACd,IAAA,IAAA,CAAKD,IAAAA,GAAO,IAAIE,cAAAA,CAAY;AAC1BC,MAAAA,MAAAA,EAAQF,MAAAA,EAAQE,MAAAA;AAChB,MAAA,GAAGF,MAAAA,EAAQG;KACb,CAAA;AACF,EAAA;;AAGA,EAAA,IAAIC,OAAAA,GAAmB;AACrB,IAAA,OAAO,KAAKL,IAAAA,CAAKK,OAAAA;AACnB,EAAA;;EAGAC,UAAAA,GAAmB;AACjB,IAAA,IAAA,CAAKN,KAAKM,UAAAA,EAAU;AACtB,EAAA;;EAGAC,aAAAA,GAAsB;AACpB,IAAA,IAAA,CAAKP,KAAKO,aAAAA,EAAa;AACzB,EAAA;;EAGAC,YAAAA,GAAqB;AACnB,IAAA,IAAA,CAAKR,KAAKQ,YAAAA,EAAY;AACxB,EAAA;;EAGAC,KAAAA,GAAc;AACZ,IAAA,IAAA,CAAKT,KAAKS,KAAAA,EAAK;AACjB,EAAA;;AAGAC,EAAAA,UAAAA,CAAWC,SAAAA,EAAmB;AAC5B,IAAA,OAAO,IAAA,CAAKX,IAAAA,CAAKU,UAAAA,CAAWC,SAAAA,CAAAA;AAC9B,EAAA;;EAGAC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AbSD,MAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA;AAwBF,SAASQ,aAAAA,CACdxK,QACAgF,OAAAA,EAA8B;AAE9B,EAAA,OAAOyF,6BAAAA,CAAyBT,cAAAA,CAAehK,MAAAA,EAAQgF,OAAAA,CAAAA,CAAAA;AACzD;AALgBwF,MAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA;AAQT,IAAME,iBAAAA,GAAoB;AAC/B7B,EAAAA,8BAAAA;AACAW,EAAAA,8BAAAA;AACAI,EAAAA;;AAoBWe,oBAAAA,GAAN,MAAMA,aAAAA,CAAAA;AAAAA,EAAAA;;;EACX,OAAOC,OAAAA,CACL5K,QACAgF,OAAAA,EACmC;AACnC,IAAA,OAAO;MACL6F,QAAAA,EAAUF,aAAAA;MACVV,SAAAA,EAAWD,cAAAA,CAAehK,QAAQgF,OAAAA;AACpC,KAAA;AACF,EAAA;AACF;;;IArBE8F,OAAAA,EAAS;AACPjC,MAAAA,8BAAAA;AACAW,MAAAA,8BAAAA;AACAI,MAAAA;;IAEFmB,OAAAA,EAAS;AACPlC,MAAAA,8BAAAA;AACAW,MAAAA,8BAAAA;AACAI,MAAAA","file":"index.cjs","sourcesContent":["import { InjectionToken } from \"@angular/core\";\nimport type { SimplrFraudConfig } from \"@simplr-ai/js\";\nimport type { SimplrFlagsConfig } from \"@simplr-ai/js\";\nimport type { SimplrRUMConfig } from \"@simplr-ai/js\";\nimport type { SimplrProfilesConfig } from \"@simplr-ai/js\";\nimport type { AIDelegationConfig } from \"@simplr-ai/js\";\n\n/**\n * Unified configuration for the Simplr Angular adapter. A single config object\n * configures every feature surface: fraud/biometrics, feature flags, profiles,\n * RUM and AI delegation. All keys are optional except `apiKey` (your public\n * `pk_*` key) which most features require.\n */\nexport interface SimplrConfig {\n /** Public API key (`pk_live_…` / `pk_test_…`). Safe for the client. */\n apiKey: string;\n /** Override the API base URL (default `https://api.simplr.sh`). */\n baseUrl?: string;\n\n /** Options forwarded to the core `SimplrFraud` device/biometrics collector. */\n fraud?: Omit<SimplrFraudConfig, \"apiKey\">;\n\n /** Options forwarded to the core `SimplrFlags` feature-flag engine. */\n flags?: Partial<Omit<SimplrFlagsConfig, \"apiKey\">>;\n\n /**\n * Options forwarded to the core `SimplrProfiles` SDK.\n * Falls back to the top-level `apiKey`/`baseUrl`.\n */\n profiles?: Partial<Omit<SimplrProfilesConfig, \"apiKey\">>;\n\n /**\n * Options forwarded to the core `SimplrRUM` SDK. `applicationId` is required\n * by the core when RUM is initialized.\n */\n rum?: Partial<SimplrRUMConfig>;\n\n /** Options forwarded to the core `SimplrAI` delegation client. */\n ai?: Partial<Omit<AIDelegationConfig, \"apiKey\">>;\n}\n\n/**\n * DI token holding the resolved {@link SimplrConfig}. Provided by\n * `provideSimplr()` or `SimplrModule.forRoot()`.\n */\nexport const SIMPLR_CONFIG = new InjectionToken<SimplrConfig>(\"SIMPLR_CONFIG\");\n","import { Inject, Injectable, OnDestroy, Optional } from \"@angular/core\";\nimport { Observable, from } from \"rxjs\";\nimport {\n SimplrFraud,\n type CollectedSignals,\n type DeviceSignals,\n type BehaviorSignals,\n} from \"@simplr-ai/js\";\nimport { SIMPLR_CONFIG, type SimplrConfig } from \"../tokens\";\n\n/**\n * Wraps the core `SimplrFraud` instance: device fingerprinting + behavioral\n * biometrics + signal collection used for `/v1/check` fraud/identity checks.\n *\n * The constructor accepts the resolved {@link SimplrConfig} directly so it can be\n * unit-tested without Angular's DI runtime: `new SimplrService(config)`.\n */\n@Injectable({ providedIn: \"root\" })\nexport class SimplrService implements OnDestroy {\n /** The underlying core SDK instance. Exposed for advanced/escape-hatch use. */\n readonly core: SimplrFraud;\n\n private readonly config?: SimplrConfig;\n\n constructor(@Optional() @Inject(SIMPLR_CONFIG) config?: SimplrConfig) {\n this.config = config;\n this.core = new SimplrFraud({\n apiKey: config?.apiKey,\n ...config?.fraud,\n });\n }\n\n /** Whether the SDK has been initialized and is ready to collect. */\n get isReady(): boolean {\n return this.core.isReady;\n }\n\n /** Initialize the SDK and start biometric tracking (no-op if auto-started). */\n initialize(): void {\n this.core.initialize();\n }\n\n /** Start behavioral biometric tracking. */\n startTracking(): void {\n this.core.startTracking();\n }\n\n /** Stop behavioral biometric tracking. */\n stopTracking(): void {\n this.core.stopTracking();\n }\n\n /** Reset all collected behavioral data. */\n reset(): void {\n this.core.reset();\n }\n\n /** Event handlers + `data-simplr-field` attr to wire up an input for keystroke biometrics. */\n trackInput(fieldName: string) {\n return this.core.trackInput(fieldName);\n }\n\n /** Collect the full device fingerprint only (Promise). */\n getDeviceSignals(): Promise<DeviceSignals> {\n return this.core.collectDeviceSignals();\n }\n\n /** Collect the full device fingerprint only (Observable). */\n getDeviceSignals$(): Observable<DeviceSignals> {\n return from(this.core.collectDeviceSignals());\n }\n\n /** Collect behavioral signals synchronously. */\n getBehaviorSignals(): BehaviorSignals {\n return this.core.collectBehaviorSignals();\n }\n\n /** Collect device + behavior signals (Promise). */\n collect(): Promise<CollectedSignals> {\n return this.core.collect();\n }\n\n /** Collect device + behavior signals (Observable). */\n collect$(): Observable<CollectedSignals> {\n return from(this.core.collect());\n }\n\n /**\n * Convenience: run a fraud/identity check against `/v1/check`. Collects fresh\n * device + behavior signals and posts them with the configured public key.\n * Returns the unwrapped `content` from the response envelope.\n */\n async check(input: Record<string, unknown> = {}): Promise<unknown> {\n const config = this.config;\n const signals = await this.core.collect();\n const baseUrl = (config?.baseUrl || \"https://api.simplr.sh\").replace(/\\/+$/, \"\");\n const res = await fetch(`${baseUrl}/v1/check`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-API-Key\": config?.apiKey ?? \"\",\n },\n body: JSON.stringify({\n ...input,\n device: signals.device,\n behavior: signals.behavior,\n }),\n });\n const body = await res.json().catch(() => null);\n if (!res.ok) {\n throw new Error(body?.message || body?.error || `Simplr API error ${res.status}`);\n }\n return body && \"content\" in body ? body.content : body;\n }\n\n /** Observable variant of {@link check}. */\n check$(input: Record<string, unknown> = {}): Observable<unknown> {\n return from(this.check(input));\n }\n\n ngOnDestroy(): void {\n this.core.stopTracking();\n }\n}\n","import { Inject, Injectable, OnDestroy, Optional } from \"@angular/core\";\nimport { BehaviorSubject, Observable, from } from \"rxjs\";\nimport { distinctUntilChanged, map } from \"rxjs/operators\";\nimport {\n SimplrFlags,\n type FlagDefinition,\n type EvalContext,\n type SimplrFlagsConfig,\n} from \"@simplr-ai/js\";\nimport { SIMPLR_CONFIG, type SimplrConfig } from \"../tokens\";\n\n/**\n * Wraps the core `SimplrFlags` engine (feature flags with deterministic\n * per-user rollout + targeting, evaluated locally). Adds an RxJS surface:\n * `flags$` emits the full flag map whenever flags refresh, and\n * `observeFlag(key, ctx?)` emits a boolean that re-evaluates on every refresh.\n *\n * Unit-testable without Angular DI: `new SimplrFlagsService(config)`.\n */\n@Injectable({ providedIn: \"root\" })\nexport class SimplrFlagsService implements OnDestroy {\n /** The underlying core SDK instance. */\n readonly core = new SimplrFlags();\n\n /** Emits the full `{ key -> FlagDefinition }` map on every refresh. */\n readonly flags$ = new BehaviorSubject<Record<string, FlagDefinition>>({});\n\n private readonly config?: SimplrConfig;\n private refreshTimer: ReturnType<typeof setInterval> | null = null;\n private autoInitDone = false;\n\n constructor(@Optional() @Inject(SIMPLR_CONFIG) config?: SimplrConfig) {\n this.config = config;\n }\n\n /**\n * Initialize the flag engine. Loads flags from `/v1/flags`, seeds `flags$`,\n * and starts an internal refresh loop that re-emits `flags$` on each cycle.\n */\n async initialize(overrides?: Partial<SimplrFlagsConfig>): Promise<void> {\n const refreshIntervalMs =\n overrides?.refreshIntervalMs ?? this.config?.flags?.refreshIntervalMs ?? 60000;\n\n const cfg: SimplrFlagsConfig = {\n apiKey: this.config?.apiKey ?? \"\",\n baseUrl: this.config?.baseUrl,\n ...this.config?.flags,\n ...overrides,\n // We drive refresh emissions ourselves so flags$ stays in sync; disable\n // the core's internal timer to avoid a second uncontrolled loop.\n refreshIntervalMs: 0,\n };\n\n await this.core.initialize(cfg);\n this.emit();\n\n if (refreshIntervalMs > 0 && typeof setInterval !== \"undefined\") {\n this.refreshTimer = setInterval(() => this.refresh(), refreshIntervalMs);\n }\n this.autoInitDone = true;\n }\n\n /** Set the default user id used for flag evaluation/bucketing. */\n setUser(userId: string): void {\n this.core.setUser(userId);\n }\n\n /** Manually refresh flags from the server and re-emit `flags$`. */\n async refresh(): Promise<void> {\n await this.core.refresh();\n this.emit();\n }\n\n /** Manually refresh flags as an Observable. */\n refresh$(): Observable<void> {\n return from(this.refresh());\n }\n\n /** Evaluate a flag synchronously (local eval, murmurhash bucketing). */\n isEnabled(key: string, ctx?: EvalContext): boolean {\n return this.core.isEnabled(key, ctx);\n }\n\n /**\n * Observe a single flag as a boolean stream. Re-evaluates and emits whenever\n * `flags$` changes (i.e. on every refresh), deduping consecutive equal values.\n */\n observeFlag(key: string, ctx?: EvalContext): Observable<boolean> {\n return this.flags$.pipe(\n map(() => this.core.isEnabled(key, ctx)),\n distinctUntilChanged(),\n );\n }\n\n /** Whether the engine has loaded its initial flag set. */\n isReady(): boolean {\n return this.core.isReady();\n }\n\n /** Snapshot of all currently-known flag definitions. */\n getAll(): Record<string, FlagDefinition> {\n return this.core.getAll();\n }\n\n private emit(): void {\n this.flags$.next(this.core.getAll());\n }\n\n ngOnDestroy(): void {\n if (this.refreshTimer) clearInterval(this.refreshTimer);\n this.refreshTimer = null;\n this.core.dispose();\n this.flags$.complete();\n }\n}\n","import { Inject, Injectable, Optional } from \"@angular/core\";\nimport { Observable, from } from \"rxjs\";\nimport {\n SimplrProfiles,\n SimplrFraud,\n type IdentifyOptions,\n type ProfileIdentifyResult,\n type ProfileOrderInput,\n type ProfileOrderFraudResult,\n type ProfileRiskResult,\n} from \"@simplr-ai/js\";\nimport { SIMPLR_CONFIG, type SimplrConfig } from \"../tokens\";\n\n/**\n * Wraps the core `SimplrProfiles` SDK: anonymous user profile management and\n * order fraud scoring. Methods are exposed as Promises and `*$` Observable\n * variants. Device fingerprints are auto-collected via a wired-in `SimplrFraud`\n * collector, matching the browser core behavior.\n *\n * Unit-testable without Angular DI: `new SimplrProfilesService(config)`.\n */\n@Injectable({ providedIn: \"root\" })\nexport class SimplrProfilesService {\n /** The underlying core SDK instance. */\n readonly core: SimplrProfiles;\n\n constructor(@Optional() @Inject(SIMPLR_CONFIG) config?: SimplrConfig) {\n this.core = new SimplrProfiles({\n apiKey: config?.apiKey ?? \"\",\n baseUrl: config?.baseUrl,\n ...config?.profiles,\n });\n\n // Auto-collect device signals using a non-biometric SimplrFraud instance.\n const fraud = new SimplrFraud({ apiKey: config?.apiKey, collectBiometrics: false, autoStart: false });\n this.core.setDeviceSignalCollector(() => fraud.collectDeviceSignals());\n }\n\n /** Identify a user — creates/updates an anonymous profile, links the device. */\n identify(externalId: string, options?: IdentifyOptions): Promise<ProfileIdentifyResult> {\n return this.core.identify(externalId, options);\n }\n\n /** Observable variant of {@link identify}. */\n identify$(externalId: string, options?: IdentifyOptions): Observable<ProfileIdentifyResult> {\n return from(this.core.identify(externalId, options));\n }\n\n /** Submit an order for real-time fraud scoring (`/v1/orders`). */\n submitOrder(order: ProfileOrderInput): Promise<ProfileOrderFraudResult> {\n return this.core.submitOrder(order);\n }\n\n /** Observable variant of {@link submitOrder}. */\n submitOrder$(order: ProfileOrderInput): Observable<ProfileOrderFraudResult> {\n return from(this.core.submitOrder(order));\n }\n\n /** Get the risk profile for a user (`GET /v1/profiles/{externalId}`). */\n getProfileRisk(externalId: string): Promise<ProfileRiskResult> {\n return this.core.getProfileRisk(externalId);\n }\n\n /** Observable variant of {@link getProfileRisk}. */\n getProfileRisk$(externalId: string): Observable<ProfileRiskResult> {\n return from(this.core.getProfileRisk(externalId));\n }\n\n /** Report a profile outcome as `fraud` or `legitimate`. */\n reportOutcome(externalId: string, outcome: \"fraud\" | \"legitimate\"): Promise<void> {\n return this.core.reportOutcome(externalId, outcome);\n }\n\n /** Observable variant of {@link reportOutcome}. */\n reportOutcome$(externalId: string, outcome: \"fraud\" | \"legitimate\"): Observable<void> {\n return from(this.core.reportOutcome(externalId, outcome));\n }\n}\n","import { Inject, Injectable, OnDestroy, Optional } from \"@angular/core\";\nimport {\n SimplrRUM,\n type SimplrRUMConfig,\n type RUMActionType,\n type RUMLogLevel,\n type RUMActionTarget,\n type RUMErrorData,\n} from \"@simplr-ai/js\";\nimport { SIMPLR_CONFIG, type SimplrConfig } from \"../tokens\";\n\n/**\n * Wraps the core `SimplrRUM` Real User Monitoring SDK. Exposes the full method\n * surface (setUser/clearUser/attributes/trackView/trackAction/trackError/log/\n * flush/getSessionId/getViewId) plus an auto-view-tracking helper used by the\n * `[simplrRumView]` directive.\n *\n * Unit-testable without Angular DI: `new SimplrRumService(config)`.\n */\n@Injectable({ providedIn: \"root\" })\nexport class SimplrRumService implements OnDestroy {\n /** The underlying core RUM singleton. */\n readonly core: SimplrRUM = SimplrRUM.getInstance();\n\n private readonly config?: SimplrConfig;\n\n constructor(@Optional() @Inject(SIMPLR_CONFIG) config?: SimplrConfig) {\n this.config = config;\n }\n\n /**\n * Initialize RUM. `applicationId` is required by the core. Pulls apiKey/baseUrl\n * from the unified config when not supplied in overrides.\n */\n initialize(overrides?: Partial<SimplrRUMConfig>): void {\n const merged = {\n apiKey: this.config?.apiKey,\n ...this.config?.rum,\n ...overrides,\n } as SimplrRUMConfig;\n this.core.initialize(merged);\n }\n\n /** Whether RUM has been initialized. */\n isInitialized(): boolean {\n return this.core.isInitialized();\n }\n\n /** Associate the current session with a user. */\n setUser(userId: string, attributes?: Record<string, unknown>): void {\n this.core.setUser(userId, attributes);\n }\n\n /** Clear the current session's user. */\n clearUser(): void {\n this.core.clearUser();\n }\n\n /** Add a global attribute attached to every event. */\n addAttribute(key: string, value: unknown): void {\n this.core.addAttribute(key, value);\n }\n\n /** Remove a previously added global attribute. */\n removeAttribute(key: string): void {\n this.core.removeAttribute(key);\n }\n\n /** Track a page/screen view. */\n trackView(name: string, attributes?: Record<string, unknown>): void {\n this.core.trackView(name, attributes);\n }\n\n /** Track a user action. */\n trackAction(\n name: string,\n type: RUMActionType,\n options?: { target?: Partial<RUMActionTarget>; attributes?: Record<string, unknown> },\n ): void {\n this.core.trackAction(name, type, options);\n }\n\n /** Track an error. */\n trackError(error: Error | RUMErrorData, context?: Record<string, unknown>): void {\n this.core.trackError(error, context);\n }\n\n /** Emit a structured log message. */\n log(level: RUMLogLevel, message: string, context?: Record<string, unknown>): void {\n this.core.log(level, message, context);\n }\n\n /** End the current RUM session and flush. */\n stopSession(): void {\n this.core.stopSession();\n }\n\n /** Force-flush the event batch. */\n flush(): Promise<void> {\n return this.core.flush();\n }\n\n /** Current session id (or null). */\n getSessionId(): string | null {\n return this.core.getSessionId();\n }\n\n /** Current view id (or null). */\n getViewId(): string | null {\n return this.core.getViewId();\n }\n\n ngOnDestroy(): void {\n if (this.core.isInitialized()) {\n this.core.flush();\n }\n }\n}\n","import { Inject, Injectable, Optional } from \"@angular/core\";\nimport { Observable, from } from \"rxjs\";\nimport {\n SimplrAI,\n type CreateDelegationOptions,\n type DelegationResult,\n type DelegationInfo,\n type ValidationResult,\n type DelegationStats,\n} from \"@simplr-ai/js\";\nimport { SIMPLR_CONFIG, type SimplrConfig } from \"../tokens\";\n\n// `ConnectOptions` / `ConnectResult` are not re-exported by the core barrel, so\n// derive them structurally from the method signature to stay decoupled.\ntype ConnectOptions = Parameters<SimplrAI[\"connect\"]>[0];\ntype ConnectResult = Awaited<ReturnType<SimplrAI[\"connect\"]>>;\ntype ValidateOptions = Parameters<SimplrAI[\"validate\"]>[1];\n\n/**\n * Wraps the core `SimplrAI` delegation client (OAuth-like AI authentication).\n * Full surface — connect/createDelegation/validate/revoke/list/get/stats/\n * revokeAllForUser — exposed as Promises and `*$` Observable variants.\n *\n * Unit-testable without Angular DI: `new SimplrAIService(config)`.\n */\n@Injectable({ providedIn: \"root\" })\nexport class SimplrAIService {\n /** The underlying core SDK instance. */\n readonly core: SimplrAI;\n\n constructor(@Optional() @Inject(SIMPLR_CONFIG) config?: SimplrConfig) {\n this.core = new SimplrAI({\n apiKey: config?.apiKey ?? \"\",\n endpoint: config?.baseUrl,\n ...config?.ai,\n });\n }\n\n /** Open the AI Connect gateway (popup/redirect) for users to connect their AI. */\n connect(options: ConnectOptions): Promise<ConnectResult> {\n return this.core.connect(options);\n }\n\n /** Observable variant of {@link connect}. */\n connect$(options: ConnectOptions): Observable<ConnectResult> {\n return from(this.core.connect(options));\n }\n\n /** Create a new AI delegation token for a user. */\n createDelegation(options: CreateDelegationOptions): Promise<DelegationResult> {\n return this.core.createDelegation(options);\n }\n\n /** Observable variant of {@link createDelegation}. */\n createDelegation$(options: CreateDelegationOptions): Observable<DelegationResult> {\n return from(this.core.createDelegation(options));\n }\n\n /** Validate a delegation token. */\n validate(token: string, options?: ValidateOptions): Promise<ValidationResult> {\n return this.core.validate(token, options);\n }\n\n /** Observable variant of {@link validate}. */\n validate$(token: string, options?: ValidateOptions): Observable<ValidationResult> {\n return from(this.core.validate(token, options));\n }\n\n /** Revoke a single delegation. */\n revoke(delegationId: string, reason?: string): Promise<void> {\n return this.core.revoke(delegationId, reason);\n }\n\n /** Observable variant of {@link revoke}. */\n revoke$(delegationId: string, reason?: string): Observable<void> {\n return from(this.core.revoke(delegationId, reason));\n }\n\n /** List delegations (optionally filtered by user). */\n list(userId?: string): Promise<DelegationInfo[]> {\n return this.core.list(userId);\n }\n\n /** Observable variant of {@link list}. */\n list$(userId?: string): Observable<DelegationInfo[]> {\n return from(this.core.list(userId));\n }\n\n /** Get a single delegation. */\n get(delegationId: string): Promise<DelegationInfo> {\n return this.core.get(delegationId);\n }\n\n /** Observable variant of {@link get}. */\n get$(delegationId: string): Observable<DelegationInfo> {\n return from(this.core.get(delegationId));\n }\n\n /** Get aggregate delegation statistics. */\n stats(): Promise<DelegationStats> {\n return this.core.stats();\n }\n\n /** Observable variant of {@link stats}. */\n stats$(): Observable<DelegationStats> {\n return from(this.core.stats());\n }\n\n /** Revoke all delegations for a user (useful on logout). Returns the count revoked. */\n revokeAllForUser(userId: string, reason?: string): Promise<number> {\n return this.core.revokeAllForUser(userId, reason);\n }\n\n /** Observable variant of {@link revokeAllForUser}. */\n revokeAllForUser$(userId: string, reason?: string): Observable<number> {\n return from(this.core.revokeAllForUser(userId, reason));\n }\n}\n","import { ErrorHandler, Injectable, Optional } from \"@angular/core\";\nimport { SimplrRumService } from \"./simplr-rum.service\";\n\n/**\n * Optional Angular `ErrorHandler` that pipes uncaught application errors into\n * Simplr RUM via {@link SimplrRumService.trackError} before re-logging them.\n *\n * Wire it up by adding `{ provide: ErrorHandler, useClass: SimplrErrorHandler }`\n * to your providers (or pass `errorHandler: true` to `provideSimplr()`).\n */\n@Injectable()\nexport class SimplrErrorHandler implements ErrorHandler {\n constructor(@Optional() private readonly rum?: SimplrRumService) {}\n\n handleError(error: unknown): void {\n try {\n if (this.rum?.isInitialized()) {\n const err =\n error instanceof Error\n ? error\n : new Error(typeof error === \"string\" ? error : JSON.stringify(error));\n this.rum.trackError(err, { source: \"angular_error_handler\" });\n }\n } catch {\n // Never let RUM reporting mask the original error.\n }\n // Preserve default behavior — surface the error in the console.\n console.error(error);\n }\n}\n","import {\n Directive,\n EventEmitter,\n HostListener,\n Input,\n Output,\n} from \"@angular/core\";\nimport { SimplrService } from \"../services/simplr.service\";\nimport type { CollectedSignals } from \"@simplr-ai/js\";\n\n/**\n * `[simplrProtect]` — attach Simplr device + behavioral signals to a form on\n * submit. On the form's `submit` event it collects fresh signals and emits them\n * via `(simplrSignals)`. By default it prevents the native submit so callers\n * can finish their request with the signals attached; set\n * `[simplrPreventDefault]=\"false\"` to opt out.\n *\n * ```html\n * <form simplrProtect (simplrSignals)=\"onSignals($event)\"> … </form>\n * ```\n */\n@Directive({\n selector: \"[simplrProtect]\",\n standalone: true,\n})\nexport class SimplrProtectDirective {\n /** Prevent the native form submit while signals are collected (default true). */\n @Input() simplrPreventDefault = true;\n\n /** Emits the collected device + behavior signals on submit. */\n @Output() simplrSignals = new EventEmitter<CollectedSignals>();\n\n /** Emits if signal collection fails. */\n @Output() simplrError = new EventEmitter<unknown>();\n\n constructor(private readonly simplr: SimplrService) {}\n\n @HostListener(\"submit\", [\"$event\"])\n async onSubmit(event: Event): Promise<void> {\n if (this.simplrPreventDefault) {\n event.preventDefault();\n }\n try {\n const signals = await this.simplr.collect();\n this.simplrSignals.emit(signals);\n } catch (err) {\n this.simplrError.emit(err);\n }\n }\n}\n","import { Directive, Input, OnInit } from \"@angular/core\";\nimport { SimplrRumService } from \"../services/simplr-rum.service\";\n\n/**\n * `[simplrRumView]` — declaratively track a RUM view when the host element\n * initializes. The view name is the directive's bound value; an optional\n * attributes object can be supplied.\n *\n * ```html\n * <section [simplrRumView]=\"'Checkout'\" [simplrRumViewAttributes]=\"{ step: 2 }\"></section>\n * ```\n */\n@Directive({\n selector: \"[simplrRumView]\",\n standalone: true,\n})\nexport class SimplrRumViewDirective implements OnInit {\n /** The view name to report. */\n @Input(\"simplrRumView\") viewName = \"\";\n\n /** Optional attributes attached to the view event. */\n @Input() simplrRumViewAttributes?: Record<string, unknown>;\n\n constructor(private readonly rum: SimplrRumService) {}\n\n ngOnInit(): void {\n if (this.viewName) {\n this.rum.trackView(this.viewName, this.simplrRumViewAttributes);\n }\n }\n}\n","import { Component, EventEmitter, Input, Output } from \"@angular/core\";\nimport { SimplrService } from \"../services/simplr.service\";\nimport type { CollectedSignals } from \"@simplr-ai/js\";\n\n/**\n * `<simplr-protected-form>` — a standalone form wrapper that collects Simplr\n * device + behavioral signals on submit and emits them via\n * `(submitWithSignals)`. Project your form fields as content.\n *\n * ```html\n * <simplr-protected-form (submitWithSignals)=\"submit($event)\">\n * <input name=\"email\" /> <button type=\"submit\">Pay</button>\n * </simplr-protected-form>\n * ```\n */\n@Component({\n selector: \"simplr-protected-form\",\n standalone: true,\n template: `\n <form (submit)=\"onSubmit($event)\">\n <ng-content></ng-content>\n </form>\n `,\n})\nexport class SimplrProtectedFormComponent {\n /** Prevent native submit while signals are collected (default true). */\n @Input() preventDefault = true;\n\n /** Emits the collected device + behavior signals together with the event. */\n @Output() submitWithSignals = new EventEmitter<{\n signals: CollectedSignals;\n event: Event;\n }>();\n\n /** Emits if signal collection fails. */\n @Output() collectError = new EventEmitter<unknown>();\n\n constructor(private readonly simplr: SimplrService) {}\n\n async onSubmit(event: Event): Promise<void> {\n if (this.preventDefault) {\n event.preventDefault();\n }\n try {\n const signals = await this.simplr.collect();\n this.submitWithSignals.emit({ signals, event });\n } catch (err) {\n this.collectError.emit(err);\n }\n }\n}\n","import {\n ErrorHandler,\n ModuleWithProviders,\n NgModule,\n type EnvironmentProviders,\n type Provider,\n makeEnvironmentProviders,\n} from \"@angular/core\";\nimport { SIMPLR_CONFIG, type SimplrConfig } from \"./tokens\";\nimport { SimplrService } from \"./services/simplr.service\";\nimport { SimplrFlagsService } from \"./services/simplr-flags.service\";\nimport { SimplrProfilesService } from \"./services/simplr-profiles.service\";\nimport { SimplrRumService } from \"./services/simplr-rum.service\";\nimport { SimplrAIService } from \"./services/simplr-ai.service\";\nimport { SimplrErrorHandler } from \"./services/simplr-error-handler\";\nimport { SimplrProtectDirective } from \"./directives/simplr-protect.directive\";\nimport { SimplrRumViewDirective } from \"./directives/simplr-rum-view.directive\";\nimport { SimplrProtectedFormComponent } from \"./directives/simplr-protected-form.component\";\n\n/** Extra options for {@link provideSimplr} / {@link SimplrModule.forRoot}. */\nexport interface ProvideSimplrOptions {\n /**\n * When true, registers {@link SimplrErrorHandler} as Angular's `ErrorHandler`\n * so uncaught errors are piped into RUM. Default false.\n */\n errorHandler?: boolean;\n}\n\nfunction buildProviders(config: SimplrConfig, options?: ProvideSimplrOptions): Provider[] {\n const providers: Provider[] = [\n { provide: SIMPLR_CONFIG, useValue: config },\n SimplrService,\n SimplrFlagsService,\n SimplrProfilesService,\n SimplrRumService,\n SimplrAIService,\n ];\n if (options?.errorHandler) {\n providers.push({ provide: ErrorHandler, useClass: SimplrErrorHandler });\n }\n return providers;\n}\n\n/**\n * Standalone provider for the Simplr Angular adapter. Use in `bootstrapApplication`:\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [provideSimplr({ apiKey: \"pk_live_…\" })],\n * });\n * ```\n */\nexport function provideSimplr(\n config: SimplrConfig,\n options?: ProvideSimplrOptions,\n): EnvironmentProviders {\n return makeEnvironmentProviders(buildProviders(config, options));\n}\n\n/** Standalone declarables (directives + component) for ergonomic imports. */\nexport const SIMPLR_DIRECTIVES = [\n SimplrProtectDirective,\n SimplrRumViewDirective,\n SimplrProtectedFormComponent,\n] as const;\n\n/**\n * NgModule for module-based Angular apps. Import `SimplrModule.forRoot(config)`\n * once in your root module; the directives/component are re-exported for use in\n * templates.\n */\n@NgModule({\n imports: [\n SimplrProtectDirective,\n SimplrRumViewDirective,\n SimplrProtectedFormComponent,\n ],\n exports: [\n SimplrProtectDirective,\n SimplrRumViewDirective,\n SimplrProtectedFormComponent,\n ],\n})\nexport class SimplrModule {\n static forRoot(\n config: SimplrConfig,\n options?: ProvideSimplrOptions,\n ): ModuleWithProviders<SimplrModule> {\n return {\n ngModule: SimplrModule,\n providers: buildProviders(config, options),\n };\n }\n}\n"]}
@@ -0,0 +1,371 @@
1
+ import { InjectionToken, OnDestroy, EventEmitter, OnInit, ModuleWithProviders, EnvironmentProviders, ErrorHandler } from '@angular/core';
2
+ import { SimplrFraudConfig, SimplrFlagsConfig, SimplrProfilesConfig, SimplrRUMConfig, AIDelegationConfig, SimplrFraud, DeviceSignals, BehaviorSignals, CollectedSignals, SimplrRUM, RUMActionType, RUMActionTarget, RUMErrorData, RUMLogLevel, SimplrFlags, FlagDefinition, EvalContext, SimplrProfiles, IdentifyOptions, ProfileIdentifyResult, ProfileOrderInput, ProfileOrderFraudResult, ProfileRiskResult, SimplrAI, CreateDelegationOptions, DelegationResult, ValidationResult, DelegationInfo, DelegationStats } from '@simplr-ai/js';
3
+ export { AIDelegationConfig, BehaviorSignals, BindingMode, CollectedSignals, CreateDelegationOptions, DelegationInfo, DelegationResult, DelegationStats, DeviceSignals, EvalContext, FlagDefinition, FlagRule, IdentifyOptions, KeystrokeMetrics, MouseMetrics, ProfileIdentifyResult, ProfileOrderFraudResult, ProfileOrderInput, ProfileRiskResult, RUMActionTarget, RUMActionType, RUMErrorData, RUMEvent, RUMEventType, RUMLogLevel, SimplrAI, SimplrFlags, SimplrFlagsConfig, SimplrFraud, SimplrFraudConfig, SimplrProfiles, SimplrProfilesConfig, SimplrRUM, SimplrRUMConfig, TouchMetrics, ValidationResult, clearDeviceId, createSimplrAI, createSimplrProfiles, getDeviceId, murmurHash3, sha256 } from '@simplr-ai/js';
4
+ import { Observable, BehaviorSubject } from 'rxjs';
5
+
6
+ /**
7
+ * Unified configuration for the Simplr Angular adapter. A single config object
8
+ * configures every feature surface: fraud/biometrics, feature flags, profiles,
9
+ * RUM and AI delegation. All keys are optional except `apiKey` (your public
10
+ * `pk_*` key) which most features require.
11
+ */
12
+ interface SimplrConfig {
13
+ /** Public API key (`pk_live_…` / `pk_test_…`). Safe for the client. */
14
+ apiKey: string;
15
+ /** Override the API base URL (default `https://api.simplr.sh`). */
16
+ baseUrl?: string;
17
+ /** Options forwarded to the core `SimplrFraud` device/biometrics collector. */
18
+ fraud?: Omit<SimplrFraudConfig, "apiKey">;
19
+ /** Options forwarded to the core `SimplrFlags` feature-flag engine. */
20
+ flags?: Partial<Omit<SimplrFlagsConfig, "apiKey">>;
21
+ /**
22
+ * Options forwarded to the core `SimplrProfiles` SDK.
23
+ * Falls back to the top-level `apiKey`/`baseUrl`.
24
+ */
25
+ profiles?: Partial<Omit<SimplrProfilesConfig, "apiKey">>;
26
+ /**
27
+ * Options forwarded to the core `SimplrRUM` SDK. `applicationId` is required
28
+ * by the core when RUM is initialized.
29
+ */
30
+ rum?: Partial<SimplrRUMConfig>;
31
+ /** Options forwarded to the core `SimplrAI` delegation client. */
32
+ ai?: Partial<Omit<AIDelegationConfig, "apiKey">>;
33
+ }
34
+ /**
35
+ * DI token holding the resolved {@link SimplrConfig}. Provided by
36
+ * `provideSimplr()` or `SimplrModule.forRoot()`.
37
+ */
38
+ declare const SIMPLR_CONFIG: InjectionToken<SimplrConfig>;
39
+
40
+ /**
41
+ * Wraps the core `SimplrFraud` instance: device fingerprinting + behavioral
42
+ * biometrics + signal collection used for `/v1/check` fraud/identity checks.
43
+ *
44
+ * The constructor accepts the resolved {@link SimplrConfig} directly so it can be
45
+ * unit-tested without Angular's DI runtime: `new SimplrService(config)`.
46
+ */
47
+ declare class SimplrService implements OnDestroy {
48
+ /** The underlying core SDK instance. Exposed for advanced/escape-hatch use. */
49
+ readonly core: SimplrFraud;
50
+ private readonly config?;
51
+ constructor(config?: SimplrConfig);
52
+ /** Whether the SDK has been initialized and is ready to collect. */
53
+ get isReady(): boolean;
54
+ /** Initialize the SDK and start biometric tracking (no-op if auto-started). */
55
+ initialize(): void;
56
+ /** Start behavioral biometric tracking. */
57
+ startTracking(): void;
58
+ /** Stop behavioral biometric tracking. */
59
+ stopTracking(): void;
60
+ /** Reset all collected behavioral data. */
61
+ reset(): void;
62
+ /** Event handlers + `data-simplr-field` attr to wire up an input for keystroke biometrics. */
63
+ trackInput(fieldName: string): {
64
+ onKeyDown: (e: KeyboardEvent) => void;
65
+ onKeyUp: (e: KeyboardEvent) => void;
66
+ onPaste: () => void;
67
+ "data-simplr-field": string;
68
+ };
69
+ /** Collect the full device fingerprint only (Promise). */
70
+ getDeviceSignals(): Promise<DeviceSignals>;
71
+ /** Collect the full device fingerprint only (Observable). */
72
+ getDeviceSignals$(): Observable<DeviceSignals>;
73
+ /** Collect behavioral signals synchronously. */
74
+ getBehaviorSignals(): BehaviorSignals;
75
+ /** Collect device + behavior signals (Promise). */
76
+ collect(): Promise<CollectedSignals>;
77
+ /** Collect device + behavior signals (Observable). */
78
+ collect$(): Observable<CollectedSignals>;
79
+ /**
80
+ * Convenience: run a fraud/identity check against `/v1/check`. Collects fresh
81
+ * device + behavior signals and posts them with the configured public key.
82
+ * Returns the unwrapped `content` from the response envelope.
83
+ */
84
+ check(input?: Record<string, unknown>): Promise<unknown>;
85
+ /** Observable variant of {@link check}. */
86
+ check$(input?: Record<string, unknown>): Observable<unknown>;
87
+ ngOnDestroy(): void;
88
+ }
89
+
90
+ /**
91
+ * `[simplrProtect]` — attach Simplr device + behavioral signals to a form on
92
+ * submit. On the form's `submit` event it collects fresh signals and emits them
93
+ * via `(simplrSignals)`. By default it prevents the native submit so callers
94
+ * can finish their request with the signals attached; set
95
+ * `[simplrPreventDefault]="false"` to opt out.
96
+ *
97
+ * ```html
98
+ * <form simplrProtect (simplrSignals)="onSignals($event)"> … </form>
99
+ * ```
100
+ */
101
+ declare class SimplrProtectDirective {
102
+ private readonly simplr;
103
+ /** Prevent the native form submit while signals are collected (default true). */
104
+ simplrPreventDefault: boolean;
105
+ /** Emits the collected device + behavior signals on submit. */
106
+ simplrSignals: EventEmitter<CollectedSignals>;
107
+ /** Emits if signal collection fails. */
108
+ simplrError: EventEmitter<unknown>;
109
+ constructor(simplr: SimplrService);
110
+ onSubmit(event: Event): Promise<void>;
111
+ }
112
+
113
+ /**
114
+ * Wraps the core `SimplrRUM` Real User Monitoring SDK. Exposes the full method
115
+ * surface (setUser/clearUser/attributes/trackView/trackAction/trackError/log/
116
+ * flush/getSessionId/getViewId) plus an auto-view-tracking helper used by the
117
+ * `[simplrRumView]` directive.
118
+ *
119
+ * Unit-testable without Angular DI: `new SimplrRumService(config)`.
120
+ */
121
+ declare class SimplrRumService implements OnDestroy {
122
+ /** The underlying core RUM singleton. */
123
+ readonly core: SimplrRUM;
124
+ private readonly config?;
125
+ constructor(config?: SimplrConfig);
126
+ /**
127
+ * Initialize RUM. `applicationId` is required by the core. Pulls apiKey/baseUrl
128
+ * from the unified config when not supplied in overrides.
129
+ */
130
+ initialize(overrides?: Partial<SimplrRUMConfig>): void;
131
+ /** Whether RUM has been initialized. */
132
+ isInitialized(): boolean;
133
+ /** Associate the current session with a user. */
134
+ setUser(userId: string, attributes?: Record<string, unknown>): void;
135
+ /** Clear the current session's user. */
136
+ clearUser(): void;
137
+ /** Add a global attribute attached to every event. */
138
+ addAttribute(key: string, value: unknown): void;
139
+ /** Remove a previously added global attribute. */
140
+ removeAttribute(key: string): void;
141
+ /** Track a page/screen view. */
142
+ trackView(name: string, attributes?: Record<string, unknown>): void;
143
+ /** Track a user action. */
144
+ trackAction(name: string, type: RUMActionType, options?: {
145
+ target?: Partial<RUMActionTarget>;
146
+ attributes?: Record<string, unknown>;
147
+ }): void;
148
+ /** Track an error. */
149
+ trackError(error: Error | RUMErrorData, context?: Record<string, unknown>): void;
150
+ /** Emit a structured log message. */
151
+ log(level: RUMLogLevel, message: string, context?: Record<string, unknown>): void;
152
+ /** End the current RUM session and flush. */
153
+ stopSession(): void;
154
+ /** Force-flush the event batch. */
155
+ flush(): Promise<void>;
156
+ /** Current session id (or null). */
157
+ getSessionId(): string | null;
158
+ /** Current view id (or null). */
159
+ getViewId(): string | null;
160
+ ngOnDestroy(): void;
161
+ }
162
+
163
+ /**
164
+ * `[simplrRumView]` — declaratively track a RUM view when the host element
165
+ * initializes. The view name is the directive's bound value; an optional
166
+ * attributes object can be supplied.
167
+ *
168
+ * ```html
169
+ * <section [simplrRumView]="'Checkout'" [simplrRumViewAttributes]="{ step: 2 }"></section>
170
+ * ```
171
+ */
172
+ declare class SimplrRumViewDirective implements OnInit {
173
+ private readonly rum;
174
+ /** The view name to report. */
175
+ viewName: string;
176
+ /** Optional attributes attached to the view event. */
177
+ simplrRumViewAttributes?: Record<string, unknown>;
178
+ constructor(rum: SimplrRumService);
179
+ ngOnInit(): void;
180
+ }
181
+
182
+ /**
183
+ * `<simplr-protected-form>` — a standalone form wrapper that collects Simplr
184
+ * device + behavioral signals on submit and emits them via
185
+ * `(submitWithSignals)`. Project your form fields as content.
186
+ *
187
+ * ```html
188
+ * <simplr-protected-form (submitWithSignals)="submit($event)">
189
+ * <input name="email" /> <button type="submit">Pay</button>
190
+ * </simplr-protected-form>
191
+ * ```
192
+ */
193
+ declare class SimplrProtectedFormComponent {
194
+ private readonly simplr;
195
+ /** Prevent native submit while signals are collected (default true). */
196
+ preventDefault: boolean;
197
+ /** Emits the collected device + behavior signals together with the event. */
198
+ submitWithSignals: EventEmitter<{
199
+ signals: CollectedSignals;
200
+ event: Event;
201
+ }>;
202
+ /** Emits if signal collection fails. */
203
+ collectError: EventEmitter<unknown>;
204
+ constructor(simplr: SimplrService);
205
+ onSubmit(event: Event): Promise<void>;
206
+ }
207
+
208
+ /** Extra options for {@link provideSimplr} / {@link SimplrModule.forRoot}. */
209
+ interface ProvideSimplrOptions {
210
+ /**
211
+ * When true, registers {@link SimplrErrorHandler} as Angular's `ErrorHandler`
212
+ * so uncaught errors are piped into RUM. Default false.
213
+ */
214
+ errorHandler?: boolean;
215
+ }
216
+ /**
217
+ * Standalone provider for the Simplr Angular adapter. Use in `bootstrapApplication`:
218
+ *
219
+ * ```ts
220
+ * bootstrapApplication(AppComponent, {
221
+ * providers: [provideSimplr({ apiKey: "pk_live_…" })],
222
+ * });
223
+ * ```
224
+ */
225
+ declare function provideSimplr(config: SimplrConfig, options?: ProvideSimplrOptions): EnvironmentProviders;
226
+ /** Standalone declarables (directives + component) for ergonomic imports. */
227
+ declare const SIMPLR_DIRECTIVES: readonly [typeof SimplrProtectDirective, typeof SimplrRumViewDirective, typeof SimplrProtectedFormComponent];
228
+ /**
229
+ * NgModule for module-based Angular apps. Import `SimplrModule.forRoot(config)`
230
+ * once in your root module; the directives/component are re-exported for use in
231
+ * templates.
232
+ */
233
+ declare class SimplrModule {
234
+ static forRoot(config: SimplrConfig, options?: ProvideSimplrOptions): ModuleWithProviders<SimplrModule>;
235
+ }
236
+
237
+ /**
238
+ * Wraps the core `SimplrFlags` engine (feature flags with deterministic
239
+ * per-user rollout + targeting, evaluated locally). Adds an RxJS surface:
240
+ * `flags$` emits the full flag map whenever flags refresh, and
241
+ * `observeFlag(key, ctx?)` emits a boolean that re-evaluates on every refresh.
242
+ *
243
+ * Unit-testable without Angular DI: `new SimplrFlagsService(config)`.
244
+ */
245
+ declare class SimplrFlagsService implements OnDestroy {
246
+ /** The underlying core SDK instance. */
247
+ readonly core: SimplrFlags;
248
+ /** Emits the full `{ key -> FlagDefinition }` map on every refresh. */
249
+ readonly flags$: BehaviorSubject<Record<string, FlagDefinition>>;
250
+ private readonly config?;
251
+ private refreshTimer;
252
+ private autoInitDone;
253
+ constructor(config?: SimplrConfig);
254
+ /**
255
+ * Initialize the flag engine. Loads flags from `/v1/flags`, seeds `flags$`,
256
+ * and starts an internal refresh loop that re-emits `flags$` on each cycle.
257
+ */
258
+ initialize(overrides?: Partial<SimplrFlagsConfig>): Promise<void>;
259
+ /** Set the default user id used for flag evaluation/bucketing. */
260
+ setUser(userId: string): void;
261
+ /** Manually refresh flags from the server and re-emit `flags$`. */
262
+ refresh(): Promise<void>;
263
+ /** Manually refresh flags as an Observable. */
264
+ refresh$(): Observable<void>;
265
+ /** Evaluate a flag synchronously (local eval, murmurhash bucketing). */
266
+ isEnabled(key: string, ctx?: EvalContext): boolean;
267
+ /**
268
+ * Observe a single flag as a boolean stream. Re-evaluates and emits whenever
269
+ * `flags$` changes (i.e. on every refresh), deduping consecutive equal values.
270
+ */
271
+ observeFlag(key: string, ctx?: EvalContext): Observable<boolean>;
272
+ /** Whether the engine has loaded its initial flag set. */
273
+ isReady(): boolean;
274
+ /** Snapshot of all currently-known flag definitions. */
275
+ getAll(): Record<string, FlagDefinition>;
276
+ private emit;
277
+ ngOnDestroy(): void;
278
+ }
279
+
280
+ /**
281
+ * Wraps the core `SimplrProfiles` SDK: anonymous user profile management and
282
+ * order fraud scoring. Methods are exposed as Promises and `*$` Observable
283
+ * variants. Device fingerprints are auto-collected via a wired-in `SimplrFraud`
284
+ * collector, matching the browser core behavior.
285
+ *
286
+ * Unit-testable without Angular DI: `new SimplrProfilesService(config)`.
287
+ */
288
+ declare class SimplrProfilesService {
289
+ /** The underlying core SDK instance. */
290
+ readonly core: SimplrProfiles;
291
+ constructor(config?: SimplrConfig);
292
+ /** Identify a user — creates/updates an anonymous profile, links the device. */
293
+ identify(externalId: string, options?: IdentifyOptions): Promise<ProfileIdentifyResult>;
294
+ /** Observable variant of {@link identify}. */
295
+ identify$(externalId: string, options?: IdentifyOptions): Observable<ProfileIdentifyResult>;
296
+ /** Submit an order for real-time fraud scoring (`/v1/orders`). */
297
+ submitOrder(order: ProfileOrderInput): Promise<ProfileOrderFraudResult>;
298
+ /** Observable variant of {@link submitOrder}. */
299
+ submitOrder$(order: ProfileOrderInput): Observable<ProfileOrderFraudResult>;
300
+ /** Get the risk profile for a user (`GET /v1/profiles/{externalId}`). */
301
+ getProfileRisk(externalId: string): Promise<ProfileRiskResult>;
302
+ /** Observable variant of {@link getProfileRisk}. */
303
+ getProfileRisk$(externalId: string): Observable<ProfileRiskResult>;
304
+ /** Report a profile outcome as `fraud` or `legitimate`. */
305
+ reportOutcome(externalId: string, outcome: "fraud" | "legitimate"): Promise<void>;
306
+ /** Observable variant of {@link reportOutcome}. */
307
+ reportOutcome$(externalId: string, outcome: "fraud" | "legitimate"): Observable<void>;
308
+ }
309
+
310
+ type ConnectOptions = Parameters<SimplrAI["connect"]>[0];
311
+ type ConnectResult = Awaited<ReturnType<SimplrAI["connect"]>>;
312
+ type ValidateOptions = Parameters<SimplrAI["validate"]>[1];
313
+ /**
314
+ * Wraps the core `SimplrAI` delegation client (OAuth-like AI authentication).
315
+ * Full surface — connect/createDelegation/validate/revoke/list/get/stats/
316
+ * revokeAllForUser — exposed as Promises and `*$` Observable variants.
317
+ *
318
+ * Unit-testable without Angular DI: `new SimplrAIService(config)`.
319
+ */
320
+ declare class SimplrAIService {
321
+ /** The underlying core SDK instance. */
322
+ readonly core: SimplrAI;
323
+ constructor(config?: SimplrConfig);
324
+ /** Open the AI Connect gateway (popup/redirect) for users to connect their AI. */
325
+ connect(options: ConnectOptions): Promise<ConnectResult>;
326
+ /** Observable variant of {@link connect}. */
327
+ connect$(options: ConnectOptions): Observable<ConnectResult>;
328
+ /** Create a new AI delegation token for a user. */
329
+ createDelegation(options: CreateDelegationOptions): Promise<DelegationResult>;
330
+ /** Observable variant of {@link createDelegation}. */
331
+ createDelegation$(options: CreateDelegationOptions): Observable<DelegationResult>;
332
+ /** Validate a delegation token. */
333
+ validate(token: string, options?: ValidateOptions): Promise<ValidationResult>;
334
+ /** Observable variant of {@link validate}. */
335
+ validate$(token: string, options?: ValidateOptions): Observable<ValidationResult>;
336
+ /** Revoke a single delegation. */
337
+ revoke(delegationId: string, reason?: string): Promise<void>;
338
+ /** Observable variant of {@link revoke}. */
339
+ revoke$(delegationId: string, reason?: string): Observable<void>;
340
+ /** List delegations (optionally filtered by user). */
341
+ list(userId?: string): Promise<DelegationInfo[]>;
342
+ /** Observable variant of {@link list}. */
343
+ list$(userId?: string): Observable<DelegationInfo[]>;
344
+ /** Get a single delegation. */
345
+ get(delegationId: string): Promise<DelegationInfo>;
346
+ /** Observable variant of {@link get}. */
347
+ get$(delegationId: string): Observable<DelegationInfo>;
348
+ /** Get aggregate delegation statistics. */
349
+ stats(): Promise<DelegationStats>;
350
+ /** Observable variant of {@link stats}. */
351
+ stats$(): Observable<DelegationStats>;
352
+ /** Revoke all delegations for a user (useful on logout). Returns the count revoked. */
353
+ revokeAllForUser(userId: string, reason?: string): Promise<number>;
354
+ /** Observable variant of {@link revokeAllForUser}. */
355
+ revokeAllForUser$(userId: string, reason?: string): Observable<number>;
356
+ }
357
+
358
+ /**
359
+ * Optional Angular `ErrorHandler` that pipes uncaught application errors into
360
+ * Simplr RUM via {@link SimplrRumService.trackError} before re-logging them.
361
+ *
362
+ * Wire it up by adding `{ provide: ErrorHandler, useClass: SimplrErrorHandler }`
363
+ * to your providers (or pass `errorHandler: true` to `provideSimplr()`).
364
+ */
365
+ declare class SimplrErrorHandler implements ErrorHandler {
366
+ private readonly rum?;
367
+ constructor(rum?: SimplrRumService | undefined);
368
+ handleError(error: unknown): void;
369
+ }
370
+
371
+ export { type ProvideSimplrOptions, SIMPLR_CONFIG, SIMPLR_DIRECTIVES, SimplrAIService, type SimplrConfig, SimplrErrorHandler, SimplrFlagsService, SimplrModule, SimplrProfilesService, SimplrProtectDirective, SimplrProtectedFormComponent, SimplrRumService, SimplrRumViewDirective, SimplrService, provideSimplr };