PageSourceSearch

https://www.tiram.ai/scripts/main.js

js tiram.ai collected 2026-10-02 01:12:03 UTC 4,956 bytes, 162 lines download raw bytes

1import { env } from "./env.js";
2import "./theme/tailwind.config.js";
3// Import navigation functions
4import { navigation } from "../lib/navigation/index.js";
5import { getNavItems } from "../lib/navigation/config.js";
6// Import feedback module
7import { FeedbackButton } from "../lib/feedback/index.js";
8// Import action hub functions
9import { initActionHub } from "../lib/action-hub/index.js";
10// Import toast functions
11import { showToast } from "../lib/toast/toast.js";
12// Import modal functions
13import { Modal, ModalUtils } from "../lib/modal/modal-min.js";
14// Import loader functions
15import { showLoader, hideLoader } from "./loader.js";
16// Import auth functions from the dedicated module
17import { initializeAuthGuard, authStatePromise } from "./auth.js";
18// Import interceptor initializer
19import { initializeFetchInterceptor } from "./interceptors.js";
20
21// Initialize nav when DOM is loaded
22document.addEventListener("DOMContentLoaded", async () => {
23  try {
24    const themePref = localStorage.getItem("theme-preference");
25    if (themePref !== "light") {
26      localStorage.setItem("theme-preference", "light");
27    }
28    if (localStorage.getItem("theme-preset") !== null) {
29      localStorage.removeItem("theme-preset");
30    }
31  } catch (e) { }
32
33  // Wait for Firebase auth to settle
34  const user = await authStatePromise;
35
36  // Generate nav items based on user state
37  const navItems = getNavItems(user);
38
39  // Initialize navigation
40  navigation(navItems);
41
42  // Use ActionHub if enabled (preferred approach)
43  if (env.ACTION_HUB && env.ACTION_HUB.enabled) {
44    console.log("[Main] Initializing ActionHub");
45    initActionHub();
46  } else {
47    // Only show feedback if feature toggle is on AND user is signed-in
48    if (
49      env.FEEDBACK_ENABLED &&
50      user &&
51      user.email &&
52      (user.email.includes("@zpqv.com") ||
53        user.email.includes("@thinkbridge.com") ||
54        user.email.includes("@thinkbridge.in"))
55    ) {
56      const feedbackButton = new FeedbackButton();
57      document.body.appendChild(feedbackButton.button);
58    }
59  }
60  if (env?.TIRAM_AI_TAG_ENABLED) renderTiramAITag();
61});
62
63// Initialize the Auth Guard from the auth module
64initializeAuthGuard();
65// Initialize the Fetch Interceptor
66initializeFetchInterceptor();
67
68/**
69 * Render Made with ❤️ by TiramAi tag
70 */
71const renderTiramAITag = () => {
72  const tiramAiTag = document.createElement("div");
73  tiramAiTag.id = "tiram-ai-tag";
74  tiramAiTag.innerHTML = `
75    <style>
76      .tiram-ai-tag {
77        position: fixed;
78        bottom: 24px;
79        right: 24px;
80        background: rgba(255, 255, 255, 0.95);
81        padding: 12px 24px;
82        border-radius: 40px;
83        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
84        backdrop-filter: blur(8px);
85        border: 1px solid rgba(0, 0, 0, 0.05);
86        transition: all 0.2s ease;
87      }
88      .tiram-ai-tag:hover {
89        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
90        transform: translateY(-1px);
91      }
92      .tiram-ai-tag .content {
93        display: flex;
94        align-items: center;
95        gap: 8px;
96        font-size: 14px;
97        color: #1a202c;
98        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
99      }
100      .tiram-ai-tag .heart {
101        color: #e53e3e;
102        transition: transform 0.2s ease;
103      }
104      .tiram-ai-tag:hover .heart {
105        transform: scale(1.1);
106      }
107      .tiram-ai-tag a {
108        color: #3182ce;
109        font-weight: 600;
110        text-decoration: none;
111        position: relative;
112        padding-bottom: 2px;
113      }
114      .tiram-ai-tag a::after {
115        content: '';
116        position: absolute;
117        width: 100%;
118        height: 1px;
119        bottom: 0;
120        left: 0;
121        background-color: #3182ce;
122        transform: scaleX(0);
123        transform-origin: right;
124        transition: transform 0.2s ease;
125      }
126      .tiram-ai-tag a:hover::after {
127        transform: scaleX(1);
128        transform-origin: left;
129      }
130    </style>
131    <div class="tiram-ai-tag">
132      <div class="content">
133        <span>Smartly Crafted</span>
134        <span class="heart">❤️</span>
135        <span>by</span>
136        <a href="https://www.tiram.ai/" target="_blank" rel="noopener noreferrer">TiramAI</a>
137      </div>
138    </div>
139  `;
140  document.body.appendChild(tiramAiTag);
141};
142
143// Initialize Microsoft Clarity
144(function (c, l, a, r, i, t, y) {
145  c[a] =
146    c[a] ||
147    function () {
148      (c[a].q = c[a].q || []).push(arguments);
149    };
150  t = l.createElement(r);
151  t.async = 1;
152  t.src = "https://www.clarity.ms/tag/" + i;
153  y = l.getElementsByTagName(r)[0];
154  y.parentNode.insertBefore(t, y);
155})(window, document, "clarity", "script", "pmiuvhd6tc");
156
157// Set custom tags for Clarity
158clarity("set", "business_idea_id", env.app.businessIdeaId);
159clarity("set", "persona_name", env.app.personaRole);
160
161// Re-export everything that might be needed by HTML pages
162export { showToast, Modal, ModalUtils, showLoader, hideLoader, env };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.