From 5edd391e02982d237ef6fdb80de7b5c728aef594 Mon Sep 17 00:00:00 2001 From: afzalansari12 Date: Mon, 27 Jul 2026 12:34:27 +0530 Subject: [PATCH 1/2] fix: improve Code tab contrast in light mode --- landing-page/src/components/Playground.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/landing-page/src/components/Playground.tsx b/landing-page/src/components/Playground.tsx index 21ce89f4..49d39802 100644 --- a/landing-page/src/components/Playground.tsx +++ b/landing-page/src/components/Playground.tsx @@ -87,8 +87,8 @@ export function Playground() {
- | - + | +
{/* The Output Mockup */} From 592a13c25cd4e2f2af00e236b4b8a17976392560 Mon Sep 17 00:00:00 2001 From: afzalansari12 Date: Tue, 28 Jul 2026 00:36:33 +0530 Subject: [PATCH 2/2] fix: remove duplicate instance _debugWarn, use static helper everywhere --- src/social-share-button.js | 43 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/social-share-button.js b/src/social-share-button.js index 2dd6dd57..f2ddf9a0 100644 --- a/src/social-share-button.js +++ b/src/social-share-button.js @@ -732,28 +732,29 @@ class SocialShareButton { // --------------------------------------------------------------------------- // Resolves a raw container value (string or Element) to a DOM Element, or null if absent/SSR. - static _resolveContainer(raw) { + static _resolveContainer(raw, debug) { if (!raw) return null; if (typeof document === "undefined") return null; - return typeof raw === "string" ? document.querySelector(raw) : raw; - } - - // Returns the cached host container element, or null. - _getContainer() { - return this._containerEl || null; + if (typeof raw !== "string") return raw; + try { + return document.querySelector(raw); + } catch (error) { + SocialShareButton._debugWarn(debug, "Invalid container selector:", raw, error); + return null; + } } - - /** - * Logs analytics warnings only when debug mode is enabled. - * @param {string} message - Description of the failed analytics path. - * @param {Error} err - The caught error instance. +/** + * Logs warnings only when debug mode is enabled. + * @param {boolean} debug - Whether debug mode is on. + * @param {string} message - Description of the failed path. + * @param {Error} [err] - The caught error instance, if any. */ - _debugWarn(message, err) { - // _debugWarn: emit analytics warnings only in debug mode for visibility. - if (!this.options.debug) return; - // eslint-disable-next-line no-console - console.warn("[SocialShareButton Analytics]", message, err); - } +static _debugWarn(debug, message, err) { + if (!debug) return; + // eslint-disable-next-line no-console + console.warn("[SocialShareButton]", message, err); +} + /** * Emits an analytics event through all configured delivery paths. @@ -814,7 +815,7 @@ class SocialShareButton { const el = this._getContainer(); (el || document).dispatchEvent(domEvent); } catch (err) { - this._debugWarn("DOM event dispatch failed", err); + SocialShareButton._debugWarn(this.options.debug, message, err); } } @@ -823,7 +824,7 @@ class SocialShareButton { try { this.options.onAnalytics(payload); } catch (err) { - this._debugWarn("onAnalytics callback failed", err); + SocialShareButton._debugWarn(this.options.debug, message, err); } } @@ -834,7 +835,7 @@ class SocialShareButton { try { plugin.track(payload); } catch (err) { - this._debugWarn("plugin.track() failed", err); + SocialShareButton._debugWarn(this.options.debug, message, err); } } }