From 2604187ec260bf94500c04110c1f80984571ba48 Mon Sep 17 00:00:00 2001 From: Rodolphe Stoclin Date: Thu, 12 Dec 2024 17:10:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Remove=20enable/disable=20share?= =?UTF-8?q?=20button=20and=20update=20modal=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/clients/createIFrameFrakClient.ts | 4 -- sdk/core/src/types/config.ts | 2 - sdk/core/src/utils/buttonShare.ts | 46 ------------------- sdk/core/src/utils/iframeHelper.ts | 4 -- sdk/legacy/src/specifics/gapianne.ts | 4 +- 5 files changed, 2 insertions(+), 58 deletions(-) delete mode 100644 sdk/core/src/utils/buttonShare.ts diff --git a/sdk/core/src/clients/createIFrameFrakClient.ts b/sdk/core/src/clients/createIFrameFrakClient.ts index e8b452b7..de4587df 100644 --- a/sdk/core/src/clients/createIFrameFrakClient.ts +++ b/sdk/core/src/clients/createIFrameFrakClient.ts @@ -9,7 +9,6 @@ import type { RpcResponse, } from "../types/transport"; import { Deferred } from "../utils/Deferred"; -import { enableButtonShare } from "../utils/buttonShare"; import { decompressDataAndCheckHash, hashAndCompressData, @@ -187,9 +186,6 @@ export async function postConnectionSetup({ // Wait for the handler to be connected await lifecycleManager.isConnected; - // Show the share button - enableButtonShare(config); - // Push raw CSS if needed const pushCss = async () => { const cssLink = config.metadata.css; diff --git a/sdk/core/src/types/config.ts b/sdk/core/src/types/config.ts index fabf44b4..b035f73f 100644 --- a/sdk/core/src/types/config.ts +++ b/sdk/core/src/types/config.ts @@ -10,8 +10,6 @@ export type FrakWalletSdkConfig = Readonly<{ name: string; // Your app styles to skin modals / sso css?: string; - // Your button to trigger the wallet share modal - buttonShare?: string; }; // Your domain (will be retrieved automatically if not provided) domain?: string; diff --git a/sdk/core/src/utils/buttonShare.ts b/sdk/core/src/utils/buttonShare.ts deleted file mode 100644 index de34dfeb..00000000 --- a/sdk/core/src/utils/buttonShare.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { FrakWalletSdkConfig } from "../types"; - -/** - * Get the button share element - * @param selector - */ -const getButtonShare = ( - selector = "button[data-frak-share-button], #nexus-share-button > button" -): NodeListOf => document.querySelectorAll(selector); - -/** - * Set the button disabled - * @param disabled - * @param button - */ -const setButtonDisabled = (disabled: boolean, button: Element | null) => { - if (disabled) { - button?.removeAttribute("disabled"); - return; - } - button?.setAttribute("disabled", ""); -}; - -/** - * Toggle the button attribute disabled - * @param disabled - */ -const toggleButtonDisabled = - (disabled: boolean) => (config?: FrakWalletSdkConfig) => { - const buttons = Array.from( - getButtonShare(config?.metadata?.buttonShare) - ); - for (const button of buttons) { - setButtonDisabled(disabled, button); - } - }; - -/** - * Enable the button share - */ -export const enableButtonShare = toggleButtonDisabled(true); - -/** - * Disable the button share - */ -export const disableButtonShare = toggleButtonDisabled(false); diff --git a/sdk/core/src/utils/iframeHelper.ts b/sdk/core/src/utils/iframeHelper.ts index 0eb70260..062f5350 100644 --- a/sdk/core/src/utils/iframeHelper.ts +++ b/sdk/core/src/utils/iframeHelper.ts @@ -1,5 +1,4 @@ import type { FrakWalletSdkConfig } from "../types"; -import { disableButtonShare } from "./buttonShare"; /** * Base props for the iframe @@ -30,9 +29,6 @@ export function createIframe({ }: { walletBaseUrl?: string; config?: FrakWalletSdkConfig }): Promise< HTMLIFrameElement | undefined > { - // Hide the share button by default until the iframe is loaded and connected - disableButtonShare(config); - // Check if the iframe is already created const alreadyCreatedIFrame = document.querySelector("#nexus-wallet"); diff --git a/sdk/legacy/src/specifics/gapianne.ts b/sdk/legacy/src/specifics/gapianne.ts index 4b9da46e..c8a93104 100644 --- a/sdk/legacy/src/specifics/gapianne.ts +++ b/sdk/legacy/src/specifics/gapianne.ts @@ -34,8 +34,8 @@ function setConfig() { }, }; window.FrakSetup.modalShareConfig = { - popupTitle: "Pr\xEAt(e) \xE0 r\xE9v\xE9ler un secret bien-\xEAtre ?", - text: "D\xE9couvre ce produit chez Gapianne", + popupTitle: "Prêt(e) à révéler un secret bien-être ?", + text: "Découvre ce produit chez Gapianne", link: window.location.href, }; }