Skip to content

Commit

Permalink
add interface for ensureFNLN
Browse files Browse the repository at this point in the history
  • Loading branch information
fgerardwltn24 committed Aug 6, 2024
1 parent d53686f commit 2fec86b
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/ps-web-apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ export interface WhoamiUserInfo {
}

export interface PurchaseData {
entitlements: [string];
entitlements
: [string];
}

export interface UserDataRequestResult {
success: boolean;
reason?: "userNotLoggedIn" | "generalError" | "userAborted";
}


export type FetchOptions = RequestInit & { timeout?: number };
export type WaitingRoomQueueDefault = "";
export type WaitingRoomQueue = WaitingRoomQueueDefault | "auth" | "checkout";
Expand All @@ -62,6 +70,8 @@ export type GetRosettaEnvByKey = (key: string) => string | undefined;
export type WaitForCapacity = (queue: WaitingRoomQueue) => Promise<void>;
export type RegisterIframeMessageListener = (eventtype: string, listener: (event: any, iframe: HTMLIFrameElement) => void) => void;



export interface WhoamiV1 {
/**
* will assert valid not outdated session before fetch will be done. backend credentials will be added automatically
Expand All @@ -78,6 +88,7 @@ export interface WhoamiV1 {
* gives information if the user is currently a C1 User. These are users which are not logged in from
* sso/mypass perspective. These users are originated from the apps and have potentially in app purchases.
* If this method resolves to true isLogged in will resolve to false.
* @deprecated there is not replacement for the client planned
*/
isC1User(): boolean;
/**
Expand All @@ -91,6 +102,26 @@ export interface WhoamiV1 {
* an error is resolved if session is invalid and not refeshable (= user logged out)
*/
ensureUserHasAuthorization(): Promise<void>;

/**
* Ensures that the user has provided both a first name and a last name.
* If the user has not provided these details, the function will prompt the user
* to enter them. Depending on the `skippable` parameter, the user may be allowed
* to skip this step.
*
* @param skippable - If true, the user can choose to skip providing their first name
* and last name.
* @param title - Optional. A custom title for the prompt that asks for the user's
* first name and last name. If not set default will be used.
* @param text - Optional. A custom text or message to display in the prompt. If not
* set default will be used.
*
* @returns A promise that resolves to an object indicating whether the user provided
* the required information (`success: true`) or not, along with a `reason` if applicable.
* Possible reasons include "userNotLoggedIn", "error", or "userAborted".
*/
ensureUserHasFirstNameAndLastName(skippable: boolean, title?: string, text?: string): Promise<UserDataRequestResult>;

/**
* will start login-process (e.g. go to sso-login)
*/
Expand Down Expand Up @@ -119,6 +150,7 @@ export interface WhoamiV1 {
/**
* will request customer pseudo id for currently logged user from consent backend
* @param clientId The string identifier of the client for which the customer id is requested.
* @deprecated there is not replacement for the client planned
*/
getCustomerId(clientId: string): Promise<string>;
/**
Expand Down

0 comments on commit 2fec86b

Please sign in to comment.