From 89a257456107910cc706165ca2f572a2b30007fc Mon Sep 17 00:00:00 2001 From: Luca Esposito Date: Fri, 27 Sep 2024 15:13:33 +0200 Subject: [PATCH 1/4] PA-4774 extended WhoamiV1 interface for Wonderwal --- src/ps-web-apis.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/ps-web-apis.ts b/src/ps-web-apis.ts index 53b436b..5216937 100644 --- a/src/ps-web-apis.ts +++ b/src/ps-web-apis.ts @@ -174,8 +174,31 @@ export interface WhoamiV1 { * @throws error */ getJaId(): string; + + /** + * will render the Wonderwall in the given container with the given props and call the callback after main functionality is done + * + * @param container - The HTML element in which the Wonderwall should be rendered. + * The container should be an HTML element. + * + * @param props - The props that should be passed, which will be used to render the Wonderwall. + * The props should contain the template and variant. + * The props can optional contain the headline and ctaText. + * + * @param callback - The callback that should be called after the main functionality is done. + * The callback should be a function + * + */ + renderWonderwall(container: HTMLElement, props: WonderwallProps, callback?: () => void): void; } +export type WonderwallProps = { + template: string; + variant: string; + headline?: string; + ctaText?: string; +}; + export interface UtilsV1 { fetchWithTimeout: Fetch; getRosettaEnvByKey: GetRosettaEnvByKey; From a536a5dfe27b39c348292cdd3b34ac6abca876be Mon Sep 17 00:00:00 2001 From: Luca Esposito Date: Mon, 30 Sep 2024 12:52:29 +0200 Subject: [PATCH 2/4] PA-4774 finalised wonderwall interface --- src/ps-web-apis.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ps-web-apis.ts b/src/ps-web-apis.ts index 5216937..d847536 100644 --- a/src/ps-web-apis.ts +++ b/src/ps-web-apis.ts @@ -189,11 +189,11 @@ export interface WhoamiV1 { * The callback should be a function * */ - renderWonderwall(container: HTMLElement, props: WonderwallProps, callback?: () => void): void; + renderAuthComponent(container: HTMLElement, props: WonderwallProps, callback: () => void): void; } export type WonderwallProps = { - template: string; + template: "login" | "register" | "verification" | "recovery"; variant: string; headline?: string; ctaText?: string; From 7055d2a650d2a21076a6ce54d3e730a89dd5a133 Mon Sep 17 00:00:00 2001 From: Luca Esposito Date: Mon, 30 Sep 2024 17:52:47 +0200 Subject: [PATCH 3/4] PA-4774 finalized WhoamiV1 renderAuthComponent interface --- src/ps-web-apis.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ps-web-apis.ts b/src/ps-web-apis.ts index d847536..6f6e997 100644 --- a/src/ps-web-apis.ts +++ b/src/ps-web-apis.ts @@ -185,15 +185,12 @@ export interface WhoamiV1 { * The props should contain the template and variant. * The props can optional contain the headline and ctaText. * - * @param callback - The callback that should be called after the main functionality is done. - * The callback should be a function - * */ - renderAuthComponent(container: HTMLElement, props: WonderwallProps, callback: () => void): void; + renderAuthComponent(container: HTMLElement, props: WonderwallProps): void; } export type WonderwallProps = { - template: "login" | "register" | "verification" | "recovery"; + template: "login" | "register"; variant: string; headline?: string; ctaText?: string; From e31e0a8c6b179f2020ff5371f49a69813fedce65 Mon Sep 17 00:00:00 2001 From: Luca Esposito Date: Tue, 1 Oct 2024 13:34:13 +0200 Subject: [PATCH 4/4] PA-4774 changed renderAuthComponent interface --- src/ps-web-apis.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ps-web-apis.ts b/src/ps-web-apis.ts index 6f6e997..153142a 100644 --- a/src/ps-web-apis.ts +++ b/src/ps-web-apis.ts @@ -185,8 +185,14 @@ export interface WhoamiV1 { * The props should contain the template and variant. * The props can optional contain the headline and ctaText. * + * @param abortable - If true, the Wonderwall can be aborted by the user. */ - renderAuthComponent(container: HTMLElement, props: WonderwallProps): void; + renderAuthComponent(container: HTMLElement, props: WonderwallProps, abortable: boolean): Promise; +} + +export interface AuthRes { + isLoggedIn: boolean; + message: string; } export type WonderwallProps = {