@flamingo-stack/openframe-frontend-core 0.0.217 → 0.0.218

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.
Files changed (93) hide show
  1. package/dist/{chunk-L6IBKPVM.js → chunk-EKBM4FHK.js} +2 -2
  2. package/dist/{chunk-SWZUZYWR.js → chunk-EWA2NFUR.js} +2 -2
  3. package/dist/{chunk-TYIBMDUZ.cjs → chunk-FZZBCRID.cjs} +7 -7
  4. package/dist/{chunk-TYIBMDUZ.cjs.map → chunk-FZZBCRID.cjs.map} +1 -1
  5. package/dist/{chunk-G2HHSZ3S.cjs → chunk-GE64T3JT.cjs} +9 -9
  6. package/dist/{chunk-G2HHSZ3S.cjs.map → chunk-GE64T3JT.cjs.map} +1 -1
  7. package/dist/{chunk-YWDC5BXM.cjs → chunk-L5RSJE2I.cjs} +1940 -915
  8. package/dist/chunk-L5RSJE2I.cjs.map +1 -0
  9. package/dist/{chunk-BVFRD34B.js → chunk-OHOUSDAY.js} +2 -2
  10. package/dist/{chunk-MVQ3OODK.cjs → chunk-S4SVD5JI.cjs} +9 -9
  11. package/dist/{chunk-MVQ3OODK.cjs.map → chunk-S4SVD5JI.cjs.map} +1 -1
  12. package/dist/{chunk-N5IKPYRL.js → chunk-SWIR5EB2.js} +2 -2
  13. package/dist/{chunk-6DCKL73F.cjs → chunk-TCJ5B2ZD.cjs} +24 -24
  14. package/dist/{chunk-6DCKL73F.cjs.map → chunk-TCJ5B2ZD.cjs.map} +1 -1
  15. package/dist/{chunk-ENBGG2K2.js → chunk-V5JY5RSY.js} +2954 -1929
  16. package/dist/chunk-V5JY5RSY.js.map +1 -0
  17. package/dist/components/chat/embeddable-chat.d.ts +13 -0
  18. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  19. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +104 -10
  20. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  21. package/dist/components/chat/hooks/use-slash-commands.d.ts +6 -0
  22. package/dist/components/chat/hooks/use-slash-commands.d.ts.map +1 -1
  23. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  24. package/dist/components/chat/hooks/use-unified-chat.d.ts.map +1 -1
  25. package/dist/components/chat/index.cjs +2 -2
  26. package/dist/components/chat/index.js +1 -1
  27. package/dist/components/chat/types/unified-chat-state.types.d.ts +81 -0
  28. package/dist/components/chat/types/unified-chat-state.types.d.ts.map +1 -1
  29. package/dist/components/contact/index.cjs +3 -3
  30. package/dist/components/contact/index.js +2 -2
  31. package/dist/components/features/index.cjs +2 -2
  32. package/dist/components/features/index.js +1 -1
  33. package/dist/components/index.cjs +73 -51
  34. package/dist/components/index.cjs.map +1 -1
  35. package/dist/components/index.js +26 -4
  36. package/dist/components/index.js.map +1 -1
  37. package/dist/components/navigation/app-header.d.ts +7 -0
  38. package/dist/components/navigation/app-header.d.ts.map +1 -1
  39. package/dist/components/navigation/app-layout-drawer.d.ts +65 -0
  40. package/dist/components/navigation/app-layout-drawer.d.ts.map +1 -0
  41. package/dist/components/navigation/app-layout.d.ts +9 -1
  42. package/dist/components/navigation/app-layout.d.ts.map +1 -1
  43. package/dist/components/navigation/header-mingo-button.d.ts +21 -0
  44. package/dist/components/navigation/header-mingo-button.d.ts.map +1 -0
  45. package/dist/components/navigation/index.cjs +24 -2
  46. package/dist/components/navigation/index.cjs.map +1 -1
  47. package/dist/components/navigation/index.d.ts +5 -1
  48. package/dist/components/navigation/index.d.ts.map +1 -1
  49. package/dist/components/navigation/index.js +23 -1
  50. package/dist/components/onboarding-guides/index.cjs +18 -18
  51. package/dist/components/onboarding-guides/index.js +3 -3
  52. package/dist/components/tickets/hooks/use-ticket-engagements.d.ts.map +1 -1
  53. package/dist/components/tickets/index.cjs +80 -66
  54. package/dist/components/tickets/index.cjs.map +1 -1
  55. package/dist/components/tickets/index.js +20 -6
  56. package/dist/components/tickets/index.js.map +1 -1
  57. package/dist/components/ui/index.cjs +2 -2
  58. package/dist/components/ui/index.js +1 -1
  59. package/dist/index.cjs +26 -2
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.js +25 -1
  62. package/dist/utils/embed-authed-fetch.d.ts +80 -0
  63. package/dist/utils/embed-authed-fetch.d.ts.map +1 -1
  64. package/dist/utils/index.cjs +70 -5
  65. package/dist/utils/index.cjs.map +1 -1
  66. package/dist/utils/index.d.ts +1 -1
  67. package/dist/utils/index.d.ts.map +1 -1
  68. package/dist/utils/index.js +70 -6
  69. package/dist/utils/index.js.map +1 -1
  70. package/package.json +2 -2
  71. package/src/components/chat/embeddable-chat.tsx +154 -37
  72. package/src/components/chat/hooks/use-nats-chat-adapter.ts +601 -23
  73. package/src/components/chat/hooks/use-slash-commands.ts +10 -1
  74. package/src/components/chat/hooks/use-sse-chat-adapter.ts +45 -0
  75. package/src/components/chat/hooks/use-unified-chat.ts +59 -0
  76. package/src/components/chat/types/unified-chat-state.types.ts +116 -0
  77. package/src/components/navigation/app-header.tsx +23 -0
  78. package/src/components/navigation/app-layout-drawer.tsx +620 -0
  79. package/src/components/navigation/app-layout.tsx +65 -26
  80. package/src/components/navigation/header-mingo-button.tsx +58 -0
  81. package/src/components/navigation/index.ts +17 -1
  82. package/src/components/tickets/hooks/use-ticket-engagements.ts +24 -4
  83. package/src/stories/AppLayoutDrawer.stories.tsx +228 -0
  84. package/src/utils/.embed-authed-fetch.md +7 -0
  85. package/src/utils/__tests__/embed-authed-fetch.test.ts +103 -1
  86. package/src/utils/embed-authed-fetch.ts +247 -7
  87. package/src/utils/index.ts +5 -1
  88. package/dist/chunk-ENBGG2K2.js.map +0 -1
  89. package/dist/chunk-YWDC5BXM.cjs.map +0 -1
  90. /package/dist/{chunk-L6IBKPVM.js.map → chunk-EKBM4FHK.js.map} +0 -0
  91. /package/dist/{chunk-SWZUZYWR.js.map → chunk-EWA2NFUR.js.map} +0 -0
  92. /package/dist/{chunk-BVFRD34B.js.map → chunk-OHOUSDAY.js.map} +0 -0
  93. /package/dist/{chunk-N5IKPYRL.js.map → chunk-SWIR5EB2.js.map} +0 -0
@@ -22,7 +22,7 @@ export { type GetProxiedImageUrlOptions, getProxiedImageUrl, urlPathLooksLikeSvg
22
22
  export { formatLargeNumber, formatAbbreviatedNumber, nameInitials, getFirstLastInitials, formatDurationMMSS, formatDurationCompact, formatTimeWithTimezone, formatDurationFromRange, type FormatDateUTCOptions, formatDateUTC, formatCurrency, formatPercent, formatWholeDollars, formatLegalDate, formatBytesShort, formatDateTimeAt, formatDurationFromMs, type MetricFormat, type TrendPolarity, formatCompactMetric, getTrendColors, formatDateRange, formatDuration, formatUnderscoreText, stripHtml, formatBioText, formatClassification, formatPricingModel, } from './format';
23
23
  export { formatRelativeTime, formatAbsoluteDate, formatDateTime, getDetailedTimeDifference, isToday, isWithinMinutes, createUTCTimestamp, } from './date-utils';
24
24
  export { SOURCE_ICON_NAMES, getSourceIconName, SOURCE_LABELS_BY_TABLE, getSourceLabel, } from './source-icons';
25
- export { embedAuthedFetch } from './embed-authed-fetch';
25
+ export { embedAuthedFetch, setEmbedAuthAdapter, type EmbedAuthAdapter, } from './embed-authed-fetch';
26
26
  export { type EmbedProxyAuth, getEmbedProxyAuth, setEmbedProxyAuth, clearEmbedProxyAuth, getPersistedProxyEmail, applyProxyAuth, } from './embed-proxy-auth-storage';
27
27
  export { readLeadingDecisionFrame, type DecisionResolvedFrame, } from './sse-decision-frame';
28
28
  export { escapeMarkdownInline, type ChatAttachment, buildChatAttachmentViewUrl, formatChatAttachmentMarkdownForBubble, CHAT_ATTACHMENT_VIEW_URL_PREFIX, CHAT_ATTACHMENT_VIEW_TOKEN_QUERY_PARAM, ANTHROPIC_SUPPORTED_IMAGE_MIME, CHAT_ATTACHMENT_VIEW_URL_PREFIX_REGEX_ESCAPED, CHAT_ATTACHMENT_MARKDOWN_PATTERN, stripChatAttachmentMarkdown, } from '../components/chat/utils/chat-attachment-markdown';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources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EACtB,cAAc,GACf,MAAM,4BAA4B,CAAA;AAKnC,OAAO,EACL,wBAAwB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAA;AAO7B,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,0BAA0B,EAC1B,qCAAqC,EACrC,+BAA+B,EAC/B,sCAAsC,EACtC,8BAA8B,EAC9B,6CAA6C,EAC7C,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,KAAK,4BAA4B,GAClC,MAAM,sDAAsD,CAAA;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAA;AAC5F,OAAO,EACL,aAAa,EACb,KAAK,YAAY,EACjB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,KAAK,mBAAmB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,8BAA8B,EAC9B,KAAK,eAAe,EACpB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,+CAA+C,CAAA;AAMtD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAA;AAGnG,OAAO,EAAE,KAAK,WAAW,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAI3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AAK/E,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAK7E,cAAc,gBAAgB,CAAA;AAS9B,OAAO,EACL,KAAK,4BAA4B,EACjC,qBAAqB,GACtB,MAAM,oBAAoB,CAAA"}
@@ -2593,6 +2593,23 @@ function applyProxyAuth(url, baseHeaders = { "Content-Type": "application/json"
2593
2593
  }
2594
2594
 
2595
2595
  // src/utils/embed-authed-fetch.ts
2596
+ var ADAPTER_GLOBAL_KEY = "__embedAuthedFetchAdapter__";
2597
+ function getRegisteredAuthAdapter() {
2598
+ if (typeof globalThis === "undefined") return null;
2599
+ return globalThis[ADAPTER_GLOBAL_KEY] ?? null;
2600
+ }
2601
+ function storeRegisteredAuthAdapter(adapter2) {
2602
+ if (typeof globalThis === "undefined") return;
2603
+ globalThis[ADAPTER_GLOBAL_KEY] = adapter2;
2604
+ }
2605
+ function setEmbedAuthAdapter(adapter2) {
2606
+ if (adapter2 && getRegisteredAuthAdapter() && process.env.NODE_ENV !== "production") {
2607
+ console.warn(
2608
+ "[setEmbedAuthAdapter] overwriting a previously-registered auth adapter. Two chat-runtime providers should not coexist \u2014 verify mount order and pass `null` from the unmounting provider."
2609
+ );
2610
+ }
2611
+ storeRegisteredAuthAdapter(adapter2);
2612
+ }
2596
2613
  function embedAuthedFetch(url, init = {}) {
2597
2614
  assertSameOrigin(url);
2598
2615
  let baseHeaders;
@@ -2610,14 +2627,55 @@ function embedAuthedFetch(url, init = {}) {
2610
2627
  Object.assign(baseHeaders, init.headers);
2611
2628
  }
2612
2629
  }
2613
- const { url: authedUrl, headers } = applyProxyAuth(url, baseHeaders);
2614
- return fetch(authedUrl, {
2630
+ return fetchWithRefresh(url, init, baseHeaders, false);
2631
+ }
2632
+ var IN_FLIGHT_REFRESH_GLOBAL_KEY = "__embedAuthedFetchInFlightRefresh__";
2633
+ function getInFlightRefresh() {
2634
+ if (typeof globalThis === "undefined") return null;
2635
+ return globalThis[IN_FLIGHT_REFRESH_GLOBAL_KEY] ?? null;
2636
+ }
2637
+ function setInFlightRefresh(refresh) {
2638
+ if (typeof globalThis === "undefined") return;
2639
+ globalThis[IN_FLIGHT_REFRESH_GLOBAL_KEY] = refresh;
2640
+ }
2641
+ function dedupedRefresh() {
2642
+ const adapter2 = getRegisteredAuthAdapter();
2643
+ if (!adapter2?.refresh) return Promise.resolve(false);
2644
+ let inFlightRefresh = getInFlightRefresh();
2645
+ if (!inFlightRefresh) {
2646
+ inFlightRefresh = Promise.resolve().then(() => adapter2.refresh()).catch(() => false).finally(() => {
2647
+ setInFlightRefresh(null);
2648
+ });
2649
+ setInFlightRefresh(inFlightRefresh);
2650
+ }
2651
+ return inFlightRefresh;
2652
+ }
2653
+ async function fetchWithRefresh(url, init, baseHeaders, isRetry) {
2654
+ const { url: authedUrl, headers } = applyProxyAuth(url, { ...baseHeaders });
2655
+ const adapter2 = getRegisteredAuthAdapter();
2656
+ if (adapter2?.getHeaders) {
2657
+ for (const [k, v] of Object.entries(adapter2.getHeaders())) {
2658
+ if (v !== void 0) headers[k] = v;
2659
+ }
2660
+ }
2661
+ const credentials = adapter2?.credentials ?? init.credentials ?? "same-origin";
2662
+ const response = await fetch(authedUrl, {
2615
2663
  ...init,
2616
2664
  headers,
2617
- // Always include Supabase auth cookies. `applyProxyAuth` handles
2618
- // the bearer header layer; cookies are the session-tier carrier.
2619
- credentials: init.credentials ?? "same-origin"
2665
+ // Default `same-origin` carries Supabase cookies for the MPH proxy-
2666
+ // auth model. Hosts on different origins (openframe-frontend
2667
+ // openframe gateway) register `credentials: 'include'` via the
2668
+ // adapter to make their own cookies travel cross-origin (CORS +
2669
+ // `SameSite=None` must be configured server-side for that to work).
2670
+ credentials
2620
2671
  });
2672
+ if (response.status === 401 && !isRetry && adapter2?.refresh) {
2673
+ const refreshed = await dedupedRefresh();
2674
+ if (refreshed) {
2675
+ return fetchWithRefresh(url, init, baseHeaders, true);
2676
+ }
2677
+ }
2678
+ return response;
2621
2679
  }
2622
2680
  function assertSameOrigin(url) {
2623
2681
  if (typeof window === "undefined") return;
@@ -2635,6 +2693,12 @@ function assertSameOrigin(url) {
2635
2693
  );
2636
2694
  }
2637
2695
  if (target.origin !== pageOrigin) {
2696
+ if (process.env.NODE_ENV !== "production") {
2697
+ console.warn(
2698
+ `[embedAuthedFetch] cross-origin fetch to ${target.origin} allowed in dev (NODE_ENV !== 'production'). Production builds will reject this \u2014 wire a same-origin proxy before shipping.`
2699
+ );
2700
+ return;
2701
+ }
2638
2702
  throw new Error(
2639
2703
  `embedAuthedFetch: refusing cross-origin fetch to ${target.origin} \u2014 pass a relative /api/* path instead`
2640
2704
  );
@@ -3133,6 +3197,6 @@ function scrollElementIntoView(target, options = {}) {
3133
3197
  activeRaf = requestAnimationFrame(step);
3134
3198
  }
3135
3199
 
3136
- export { ANTHROPIC_SUPPORTED_IMAGE_MIME, AUTO_CONTINUATION_DIRECTIVE_PREFIX, CHAT_ATTACHMENT_MARKDOWN_PATTERN, CHAT_ATTACHMENT_VIEW_TOKEN_QUERY_PARAM, CHAT_ATTACHMENT_VIEW_URL_PREFIX, CHAT_ATTACHMENT_VIEW_URL_PREFIX_REGEX_ESCAPED, CUSTOM_ITEM_ID, DEFAULT_OS_PLATFORM, DELIVERY_TASK_TYPE_OPTIONS, DESIGN_PALETTE, GENERIC_EMAIL_DOMAINS, ICON_REGISTRY, OPENFRAME_DEV_SECTIONS, OS_PLATFORMS, PLAY_ICON_PATH, ROADMAP_STATUS_OPTIONS, SCROLL_ANCHOR, SCROLL_ANCHOR_WIRE_KEY, SOURCE_ICON_NAMES, SOURCE_LABELS_BY_TABLE, TICKET_STATUS_OPTIONS, analyzeImageColor, applyProxyAuth, buildAutoContinuationDirective, buildChatAttachmentViewUrl, buildDiscussAddendum, cleanEmailDomain, clearEmbedProxyAuth, clickupTaskUrl, cn, consumeAccessCode, createUTCTimestamp, deepClone, delay, embedAuthedFetch, escapeMarkdownInline, extractDomainFromEmail, extractDominantColor, extractEntityIdFilter, extractImageEdgeColorAsync, fetchPriorityProp, flattenAssistantContent, formatAbbreviatedNumber, formatAbsoluteDate, formatBioText, formatBytes, formatBytesShort, formatChatAttachmentMarkdownForBubble, formatClassification, formatCompactMetric, formatCurrency, formatDate, formatDateRange, formatDateShort, formatDateSlashUTC, formatDateTime, formatDateTimeAt, formatDateUTC, formatDuration, formatDurationCompact, formatDurationFromMs, formatDurationFromRange, formatDurationMMSS, formatLargeNumber, formatLegalDate, formatNumber, formatPercent, formatPhoneE164, formatPrice, formatPricingModel, formatRelativeTime, formatReleaseDate, formatSingularLookupInvocation, formatTimeWithTimezone, formatUnderscoreText, formatWholeDollars, generateImageSizes, generateRandomString, getAllPlatformBaseDomains, getBaseUrl, getBestContrastColor, getConfidenceBgClass, getConfidenceBorderClass, getConfidenceColorClass, getConfidenceLabel, getConfidenceLevel, getConfidenceTextClass, getContrastRatio, getCountryByCode, getCountryPhoneData, getCurrentPlatform, getDefaultColorForPlatform, getDefaultIconForPlatform, getDetailedTimeDifference, getDynamicIcon, getEmbedProxyAuth, getFirstLastInitials, getIconComponent, getOSIcon, getOSLabel, getOSPlatformId, getOSTypeDefinition, getPersistedProxyEmail, getPlatformAccentColor, getPlatformColor, getPlatformDescription, getPlatformDisplayName, getPlatformIcon, getPlatformIconComponent, getPlatformIconComponent as getPlatformLogo, getPlatformProductionUrl, getPlatformSlogan, getProxiedImageUrl, getShellIcon, getShellLabel, getSlackCommunityJoinUrl, getSmallPlatformIcon, getSourceIconName, getSourceLabel, getStatusColorScheme, getTaskTypeLabel, getToolLabel, getToolTypeAliases, getTrendColors, hasGenericEmailDomain, hexToRgb, isCrossOriginUrl, isGenericDomain, isGenericWebsiteDomain, isOSPlatform, isToday, isValidEmailDomain, isValidToolType, isWithinMinutes, nameInitials, normalizeDomain, normalizeIconKey, normalizeOSType, normalizeToolType, normalizeToolTypeWithFallback, parseScrollAnchor, parseWireCommandOverride, platformColors, platformDescriptions, platformDisplayNames, platformHexColors, platformIconNames, platformIcons, platformSlogans, readLeadingDecisionFrame, sanitizeTitleForChat, scrollElementIntoView, setEmbedProxyAuth, shouldProxyImage, stripChatAttachmentMarkdown, stripHtml, toToolLabel, transformPlatformConfigsToOptions, truncateString, urlPathLooksLikeSvg, validateAccessCode, validateAndConsumeAccessCode, validateEmailDomain, validateEmailDomainList, validatePhoneNumber };
3200
+ export { ANTHROPIC_SUPPORTED_IMAGE_MIME, AUTO_CONTINUATION_DIRECTIVE_PREFIX, CHAT_ATTACHMENT_MARKDOWN_PATTERN, CHAT_ATTACHMENT_VIEW_TOKEN_QUERY_PARAM, CHAT_ATTACHMENT_VIEW_URL_PREFIX, CHAT_ATTACHMENT_VIEW_URL_PREFIX_REGEX_ESCAPED, CUSTOM_ITEM_ID, DEFAULT_OS_PLATFORM, DELIVERY_TASK_TYPE_OPTIONS, DESIGN_PALETTE, GENERIC_EMAIL_DOMAINS, ICON_REGISTRY, OPENFRAME_DEV_SECTIONS, OS_PLATFORMS, PLAY_ICON_PATH, ROADMAP_STATUS_OPTIONS, SCROLL_ANCHOR, SCROLL_ANCHOR_WIRE_KEY, SOURCE_ICON_NAMES, SOURCE_LABELS_BY_TABLE, TICKET_STATUS_OPTIONS, analyzeImageColor, applyProxyAuth, buildAutoContinuationDirective, buildChatAttachmentViewUrl, buildDiscussAddendum, cleanEmailDomain, clearEmbedProxyAuth, clickupTaskUrl, cn, consumeAccessCode, createUTCTimestamp, deepClone, delay, embedAuthedFetch, escapeMarkdownInline, extractDomainFromEmail, extractDominantColor, extractEntityIdFilter, extractImageEdgeColorAsync, fetchPriorityProp, flattenAssistantContent, formatAbbreviatedNumber, formatAbsoluteDate, formatBioText, formatBytes, formatBytesShort, formatChatAttachmentMarkdownForBubble, formatClassification, formatCompactMetric, formatCurrency, formatDate, formatDateRange, formatDateShort, formatDateSlashUTC, formatDateTime, formatDateTimeAt, formatDateUTC, formatDuration, formatDurationCompact, formatDurationFromMs, formatDurationFromRange, formatDurationMMSS, formatLargeNumber, formatLegalDate, formatNumber, formatPercent, formatPhoneE164, formatPrice, formatPricingModel, formatRelativeTime, formatReleaseDate, formatSingularLookupInvocation, formatTimeWithTimezone, formatUnderscoreText, formatWholeDollars, generateImageSizes, generateRandomString, getAllPlatformBaseDomains, getBaseUrl, getBestContrastColor, getConfidenceBgClass, getConfidenceBorderClass, getConfidenceColorClass, getConfidenceLabel, getConfidenceLevel, getConfidenceTextClass, getContrastRatio, getCountryByCode, getCountryPhoneData, getCurrentPlatform, getDefaultColorForPlatform, getDefaultIconForPlatform, getDetailedTimeDifference, getDynamicIcon, getEmbedProxyAuth, getFirstLastInitials, getIconComponent, getOSIcon, getOSLabel, getOSPlatformId, getOSTypeDefinition, getPersistedProxyEmail, getPlatformAccentColor, getPlatformColor, getPlatformDescription, getPlatformDisplayName, getPlatformIcon, getPlatformIconComponent, getPlatformIconComponent as getPlatformLogo, getPlatformProductionUrl, getPlatformSlogan, getProxiedImageUrl, getShellIcon, getShellLabel, getSlackCommunityJoinUrl, getSmallPlatformIcon, getSourceIconName, getSourceLabel, getStatusColorScheme, getTaskTypeLabel, getToolLabel, getToolTypeAliases, getTrendColors, hasGenericEmailDomain, hexToRgb, isCrossOriginUrl, isGenericDomain, isGenericWebsiteDomain, isOSPlatform, isToday, isValidEmailDomain, isValidToolType, isWithinMinutes, nameInitials, normalizeDomain, normalizeIconKey, normalizeOSType, normalizeToolType, normalizeToolTypeWithFallback, parseScrollAnchor, parseWireCommandOverride, platformColors, platformDescriptions, platformDisplayNames, platformHexColors, platformIconNames, platformIcons, platformSlogans, readLeadingDecisionFrame, sanitizeTitleForChat, scrollElementIntoView, setEmbedAuthAdapter, setEmbedProxyAuth, shouldProxyImage, stripChatAttachmentMarkdown, stripHtml, toToolLabel, transformPlatformConfigsToOptions, truncateString, urlPathLooksLikeSvg, validateAccessCode, validateAndConsumeAccessCode, validateEmailDomain, validateEmailDomainList, validatePhoneNumber };
3137
3201
  //# sourceMappingURL=index.js.map
3138
3202
  //# sourceMappingURL=index.js.map