@croct/plug
Version:
A fully-featured devkit for building natively personalized applications.
46 lines (43 loc) • 2.02 kB
text/typescript
import { DynamicContentOptions as DynamicContentOptions$1, StaticContentOptions as StaticContentOptions$1 } from '@croct/sdk/contentFetcher';
import { ApiKey } from '@croct/sdk/apiKey';
import { Logger } from '@croct/sdk/logging';
import { JsonObject, JsonValue } from '@croct/json/mutable';
import { FetchResponse } from '../plug.cjs';
import { SlotContent, VersionedSlotId } from '../slot.cjs';
import '@croct/sdk/facade/sessionFacade';
import '@croct/sdk/facade/userFacade';
import '@croct/sdk/facade/trackerFacade';
import '@croct/sdk/facade/evaluatorFacade';
import '@croct/sdk/facade/sdkFacade';
import '@croct/sdk/utilityTypes';
import '@croct/sdk/trackingEvents';
import '@croct/sdk/facade/contentFetcherFacade';
import '../plugin.cjs';
import '@croct/sdk/token';
import '../sdk/index.cjs';
import '@croct/sdk/eventManager';
import '@croct/sdk/sdkEvents';
import '@croct/sdk/tab';
import '@croct/sdk/cid';
import '@croct/json';
import '../versioning.cjs';
import '../component.cjs';
type FetchingOptions<T extends JsonValue> = {
baseEndpointUrl?: string;
fallback?: T;
logger?: Logger;
};
type AuthOptions = ServerSideAuthOptions | ClientSideAuthOptions;
type ServerSideAuthOptions = {
apiKey: string | ApiKey;
appId?: never;
};
type ClientSideAuthOptions = {
appId: string;
apiKey?: never;
};
type DynamicContentOptions<T extends JsonObject = JsonObject> = Omit<DynamicContentOptions$1, 'version'> & FetchingOptions<T> & AuthOptions;
type StaticContentOptions<T extends JsonObject = JsonObject> = Omit<StaticContentOptions$1, 'version'> & FetchingOptions<T> & ServerSideAuthOptions;
type FetchOptions<T extends JsonObject = SlotContent> = DynamicContentOptions<T> | StaticContentOptions<T>;
declare function fetchContent<I extends VersionedSlotId, C extends JsonObject>(slotId: I, options?: FetchOptions<SlotContent<I, C>>): Promise<Omit<FetchResponse<I, C>, 'payload'>>;
export { type DynamicContentOptions, type FetchOptions, FetchResponse, type StaticContentOptions, fetchContent };