@asgardeo/browser 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -39,3 +39,4 @@ export { detectThemeMode, createClassObserver, createMediaQueryListener, Browser
39
39
  export { default as getActiveTheme } from './theme/getActiveTheme';
40
40
  export { default as handleWebAuthnAuthentication } from './utils/handleWebAuthnAuthentication';
41
41
  export { default as http } from './utils/http';
42
+ export { default as resolveEmojiUrisInHtml } from './utils/v2/resolveEmojiUrisInHtml';
package/dist/index.js CHANGED
@@ -5860,6 +5860,28 @@ var http = (instanceId = 0) => {
5860
5860
  };
5861
5861
  };
5862
5862
  var http_default = http();
5863
+
5864
+ // src/utils/v2/resolveEmojiUrisInHtml.ts
5865
+ import { extractEmojiFromUri, isEmojiUri } from "@asgardeo/javascript";
5866
+ var resolveEmojiUrisInHtml = (html) => {
5867
+ const withEmojiImages = html.replace(
5868
+ /<img([^>]*)src="(emoji:[^"]+)"([^>]*)\/?>/gi,
5869
+ (_match, pre, src, post) => {
5870
+ const emoji = extractEmojiFromUri(src);
5871
+ if (!emoji) {
5872
+ return _match;
5873
+ }
5874
+ const altMatch = (pre + post).match(/alt="([^"]*)"/i);
5875
+ const label = altMatch ? altMatch[1] : emoji;
5876
+ return `<span role="img" aria-label="${label}">${emoji}</span>`;
5877
+ }
5878
+ );
5879
+ return withEmojiImages.replace(
5880
+ /emoji:([^\s"<>&]+)/g,
5881
+ (_, rest) => isEmojiUri(`emoji:${rest}`) ? rest : `emoji:${rest}`
5882
+ );
5883
+ };
5884
+ var resolveEmojiUrisInHtml_default = resolveEmojiUrisInHtml;
5863
5885
  export {
5864
5886
  AsgardeoBrowserClient_default as AsgardeoBrowserClient,
5865
5887
  AsgardeoSPAClient,
@@ -5880,6 +5902,7 @@ export {
5880
5902
  hasCalledForThisInstanceInUrl_default as hasCalledForThisInstanceInUrl,
5881
5903
  http_default as http,
5882
5904
  navigate_default as navigate,
5905
+ resolveEmojiUrisInHtml_default as resolveEmojiUrisInHtml,
5883
5906
  workerReceiver
5884
5907
  };
5885
5908
  /*! Bundled license information: