|
| 1 | +import { provide } from "./apiprovide"; |
| 2 | +declare function requirePackage<T>(name: string): Promise<T>; |
1 | 3 | export interface WhoamiUserInfo {
|
2 | 4 | user_id: string;
|
3 | 5 | first_name?: string;
|
4 | 6 | last_name?: string;
|
| 7 | + email: string; |
5 | 8 | }
|
| 9 | +export interface PurchaseData { |
| 10 | + entitlements: [string]; |
| 11 | +} |
| 12 | +export declare type FetchOptions = RequestInit & { |
| 13 | + timeout?: number; |
| 14 | +}; |
| 15 | +/** |
| 16 | + * Custom fetch interface which includes the possibility to customize timeouts for fetch requests |
| 17 | + */ |
| 18 | +export declare type Fetch = (input: RequestInfo, init?: FetchOptions) => Promise<Response>; |
6 | 19 | export interface WhoamiV1 {
|
7 | 20 | /**
|
8 | 21 | * will assert valid not outdated session before fetch will be done. backend credentials will be added automatically
|
9 | 22 | * an error is resolved if session is invalid and not refeshable (= user logged out)
|
| 23 | + * Important: as of version 1.9.9 all requests are timeout after 5s by default. |
| 24 | + * Can be changed by adding the field timeout to the FetchOptions Interface |
10 | 25 | */
|
11 |
| - authorizedFetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>; |
| 26 | + authorizedFetch: Fetch; |
12 | 27 | /**
|
13 | 28 | * gives information if user is currently loggedin from ui perspective
|
14 | 29 | */
|
15 | 30 | isLoggedIn(): boolean;
|
| 31 | + /** |
| 32 | + * gives information if the user is currently a C1 User. These are users which are not logged in from |
| 33 | + * sso/mypass perspective. These users are originated from the apps and have potentially in app purchases. |
| 34 | + * If this method resolves to true isLogged in will resolve to false. |
| 35 | + */ |
| 36 | + isC1User(): boolean; |
16 | 37 | /**
|
17 | 38 | * will assert valid not outdated session before promise is resolved
|
18 | 39 | * an error is resolved if session is invalid and not refeshable (= user logged out)
|
@@ -48,5 +69,49 @@ export interface WhoamiV1 {
|
48 | 69 | * @param clientId The string identifier of the client for which the customer id is requested.
|
49 | 70 | */
|
50 | 71 | getCustomerId(clientId: string): Promise<string>;
|
| 72 | + /** |
| 73 | + * will provide unsafe purchase data |
| 74 | + */ |
| 75 | + getUnsafePurchaseData(): Promise<PurchaseData>; |
| 76 | + /** |
| 77 | + * will provide jaId |
| 78 | + */ |
| 79 | + getJaId(): string; |
| 80 | +} |
| 81 | +export interface UtilsV1 { |
| 82 | + fetchWithTimeout: Fetch; |
| 83 | +} |
| 84 | +export declare type ILayer = "privacy" | "reject"; |
| 85 | +export declare type IApp = "offerpage" | "checkout"; |
| 86 | +export declare type ITenant = "welt" | "bild"; |
| 87 | +export interface IAccount { |
| 88 | + accountId: number | string; |
| 89 | + propertyId: number | string; |
| 90 | + baseEndpoint: string; |
| 91 | + purEntitlement: string; |
| 92 | + layers: { |
| 93 | + [key in ILayer]: number | string; |
| 94 | + }; |
| 95 | +} |
| 96 | +export declare type IAppConfig = { |
| 97 | + [key in ITenant]: IAccount; |
| 98 | +} & { |
| 99 | + urlsWithoutConsentLayer: string[]; |
| 100 | +}; |
| 101 | +export declare type IConfig = { |
| 102 | + [key in IApp]: IAppConfig; |
| 103 | +}; |
| 104 | +export interface ICligV1 { |
| 105 | + init: (app: IApp) => Promise<void>; |
| 106 | + open: (layer: ILayer) => void; |
51 | 107 | }
|
| 108 | +export declare type ICligV2 = (app: IApp) => Promise<{ |
| 109 | + open: (layer: ILayer) => void; |
| 110 | +}>; |
52 | 111 | export declare function whoamiV1(): Promise<WhoamiV1>;
|
| 112 | +export declare function utilsV1(): Promise<UtilsV1>; |
| 113 | +export declare function CligV1(): Promise<ICligV1>; |
| 114 | +export declare function CligV2(): Promise<ICligV2>; |
| 115 | +export declare const provideApi: typeof provide; |
| 116 | +export declare const requireApi: typeof requirePackage; |
| 117 | +export {}; |
0 commit comments