dh-remixer-sdk 0.0.26 → 0.0.27-0fc17bb

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dh-remixer-sdk",
3
- "version": "0.0.26",
3
+ "version": "0.0.27-0fc17bb",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "templates",
@@ -8,10 +8,10 @@
8
8
  <meta name="description" content="%VITE_METADATA_DESCRIPTION%" />
9
9
  <link rel="icon" type="image/x-icon" href="%VITE_METADATA_FAVICON%" />
10
10
 
11
- <script src="https://cdn.tailwindcss.com"></script>
11
+ <script src="https://cdn.tailwindcss.com/3.4.17"></script>
12
12
  <script type="module" src="/index.tsx"></script>
13
13
  </head>
14
14
  <body class="antialiased">
15
15
  <div id="root"></div>
16
16
  </body>
17
- </html>
17
+ </html>
@@ -31,4 +31,4 @@ root.render(
31
31
  <App />
32
32
  </LanguageProvider>
33
33
  </React.StrictMode>
34
- );
34
+ );
@@ -11,6 +11,8 @@
11
11
  "remixer-sdk:update": "npm cache clean --force && npm install dh-remixer-sdk@latest && sdk-update"
12
12
  },
13
13
  "dependencies": {
14
+ "@openobserve/browser-logs": "0.3.1",
15
+ "@openobserve/browser-rum-slim": "0.3.1",
14
16
  "@internationalized/date": "3.10.0",
15
17
  "@supabase/supabase-js": "2.86.0",
16
18
  "date-fns": "4.1.0",
@@ -1,10 +1,100 @@
1
- import { defineConfig, Plugin } from "vite";
1
+ import { defineConfig, loadEnv, Plugin } from "vite";
2
2
  import react from "@vitejs/plugin-react";
3
3
  import tailwindcss from "tailwindcss";
4
4
  import autoprefixer from "autoprefixer";
5
5
  import tailwindConfig from "./tailwind.config.ts";
6
6
  import path from "path";
7
7
 
8
+ const REMIXER_LOGO_SVG = `
9
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
10
+ <path d="M18.0005 12.0025C14.6877 12.0025 12.0012 14.6889 12.0012 18.0016V24.0006H24.0024V12H18.0031L18.0005 12.0025Z" fill="url(#paint0_linear_14487_36369)"/>
11
+ <path d="M12.0012 5.99904V0H0V12.0006H5.99932C9.31215 12.0006 11.9986 9.31423 11.9986 6.00155L12.0012 5.99904Z" fill="url(#paint1_linear_14487_36369)"/>
12
+ <path d="M5.99902 11.999C9.31222 11.999 11.9988 14.6851 11.999 17.998C11.999 21.3112 9.31236 23.9971 5.99902 23.9971C2.68583 23.9969 0 21.3111 0 17.998C0.00021569 14.6852 2.68596 11.9992 5.99902 11.999ZM18 0C21.3133 0 24 2.68585 24 5.99902C24 9.3122 21.3133 11.998 18 11.998C14.6869 11.9978 12.001 9.31205 12.001 5.99902C12.001 2.68601 14.6869 0.00024737 18 0Z" fill="url(#paint2_linear_14487_36369)"/>
13
+ <path d="M12.0012 6H18.0005V11.999C14.6877 11.999 12.0012 9.31016 12.0012 6Z" fill="white"/>
14
+ <path d="M5.99927 12V6.00096H11.9986C11.9986 9.31364 9.30958 12 5.99927 12Z" fill="white"/>
15
+ <path d="M12.0012 18H6.0019L6.0019 12.001C9.31473 12.001 12.0012 14.6898 12.0012 18Z" fill="white"/>
16
+ <path d="M18.0005 12V17.999H12.0012C12.0012 14.6864 14.6902 12 18.0005 12Z" fill="white"/>
17
+ <defs>
18
+ <linearGradient id="paint0_linear_14487_36369" x1="12.0024" y1="12" x2="24.0018" y2="24" gradientUnits="userSpaceOnUse">
19
+ <stop stop-color="#3F3F46"/>
20
+ <stop offset="1" stop-color="#71717A"/>
21
+ </linearGradient>
22
+ <linearGradient id="paint1_linear_14487_36369" x1="0.001139" y1="3.18903e-07" x2="12.0005" y2="12" gradientUnits="userSpaceOnUse">
23
+ <stop stop-color="#71717A"/>
24
+ <stop offset="1" stop-color="#3F3F46"/>
25
+ </linearGradient>
26
+ <linearGradient id="paint2_linear_14487_36369" x1="-8.53364" y1="33.7017" x2="-6.30119" y2="-14.057" gradientUnits="userSpaceOnUse">
27
+ <stop stop-color="#BE59FF"/>
28
+ <stop offset="0.19" stop-color="#9D60FF"/>
29
+ <stop offset="0.74" stop-color="#4274FF"/>
30
+ <stop offset="1" stop-color="#1F7CFF"/>
31
+ </linearGradient>
32
+ </defs>
33
+ </svg>`
34
+
35
+ const ARROW_SVG = `
36
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
37
+ <path d="M11.1635 10.0004L7.60246 6.43958C7.48718 6.32417 7.42816 6.19646 7.42538 6.05646C7.42274 5.9166 7.48177 5.78625 7.60246 5.66542C7.72329 5.54472 7.85232 5.48438 7.98954 5.48438C8.12677 5.48438 8.25579 5.54472 8.37663 5.66542L12.2468 9.53563C12.3109 9.59979 12.3589 9.67167 12.391 9.75125C12.4231 9.83083 12.4391 9.91389 12.4391 10.0004C12.4391 10.0869 12.4231 10.17 12.391 10.2496C12.3589 10.3292 12.3109 10.401 12.2468 10.4652L8.37663 14.3354C8.26121 14.4507 8.13697 14.5063 8.00392 14.5021C7.871 14.4978 7.74413 14.4353 7.62329 14.3146C7.5026 14.1938 7.44225 14.0647 7.44225 13.9275C7.44225 13.7903 7.5026 13.6613 7.62329 13.5404L11.1635 10.0004Z" fill="#A18AFB" fill-opacity="0.7"/>
38
+ </svg>`
39
+
40
+ const BUILT_WITH_REMIXER_TEXT = (classes?: string) => `
41
+ <div class="flex gap-[12px] items-center">
42
+ ${REMIXER_LOGO_SVG}
43
+ <p class="${classes} text-[#FFF] text-[14px] font-[400]">Built with <span class="font-[600]">Remixer</span></p>
44
+ </div>`
45
+
46
+ const CTA_LINK = (title: string, href: string, isShowArrow: boolean = false) => `
47
+ <a href="${href}" target="_blank" class="group text-[14px] text-[#B6A3FE] font-[600] flex gap-[6px] items-center cursor-pointer relative">
48
+ ${title}
49
+ ${isShowArrow ? ARROW_SVG : ''}
50
+ <div class="bg-[#B6A3FE] absolute left-0 bottom-0 h-[1px] right-[100%] transition-all duration-150 ${isShowArrow ? 'group-hover:right-[4px]' : 'group-hover:right-[0px]'}"></div>
51
+ </a>`
52
+
53
+ const BADGE_CONTAINER = (cta_links?: string) => `
54
+ <div class="fixed bottom-[0px] right-[0px] z-[2147483647] flex p-[8px] gap-[16px] mx-[16px] mb-[16px] bg-[#09090B] border-[#3F3F46] border-[1px] border-solid rounded-[12px] items-center shadow-[0_2px_32px_0_rgba(0,0,0,0.25)]">
55
+ <div class="flex gap-[12px] items-center">
56
+ ${cta_links ?
57
+ [
58
+ BUILT_WITH_REMIXER_TEXT('hidden md:block'),
59
+ '<div class="h-[20px] w-[1px] bg-[#3F3F46]"></div>',
60
+ cta_links
61
+ ].join('\n') :
62
+ BUILT_WITH_REMIXER_TEXT()
63
+ }
64
+ </div>
65
+ </div>`
66
+
67
+ function injectRemixerBadgePlugin(): Plugin {
68
+ return {
69
+ name: "vite-plugin-inject-remixer-badge",
70
+ apply: "build",
71
+
72
+ transformIndexHtml(html) {
73
+ const IS_SHOW_REMIXER_BADGE: boolean = process.env.IS_SHOW_REMIXER_BADGE as boolean | undefined || false;
74
+ const REMIXER_BADGE_TYPE: string = process.env.REMIXER_BADGE_TYPE || 'BUILT_WITH_REMIXER';
75
+
76
+ if (!IS_SHOW_REMIXER_BADGE) return html
77
+
78
+ const DICTIONARY: Record<string, string> = {
79
+ BUILT_WITH_REMIXER: BADGE_CONTAINER(),
80
+ UPGRADE_PLAN: BADGE_CONTAINER([
81
+ CTA_LINK(`Upgrade Plan`, 'https://www.dreamhost.com/remixer-website-builder/', true)
82
+
83
+ ].join('\n')),
84
+ NAVBAR: BADGE_CONTAINER([
85
+ CTA_LINK(`Upgrade plan`, 'https://www.dreamhost.com/remixer-website-builder/'),
86
+ CTA_LINK(`Get Access`, 'https://www.dreamhost.com/remixer-website-builder/'),
87
+ CTA_LINK(`Signup`, 'https://www.dreamhost.com/remixer-website-builder/')
88
+ ].join('\n')),
89
+ }
90
+
91
+ const BADGE_CONTENT = DICTIONARY[REMIXER_BADGE_TYPE]
92
+
93
+ return html.replace(/<\/body>/, `${BADGE_CONTENT}\n</body>`);
94
+ },
95
+ };
96
+ }
97
+
8
98
  // Switches from Tailwind CDN to regular Tailwind CSS with PostCSS for production builds
9
99
  function tailwindProdPlugin(): Plugin {
10
100
  return {
@@ -52,8 +142,85 @@ function tailwindProdPlugin(): Plugin {
52
142
  };
53
143
  }
54
144
 
145
+ const VIRTUAL_OO_ID = "virtual:openobserve";
146
+ const RESOLVED_OO_ID = "\0" + VIRTUAL_OO_ID;
147
+
148
+ function openobservePlugin(): Plugin {
149
+ let env: Record<string, string> = {};
150
+
151
+ return {
152
+ name: "vite-plugin-openobserve",
153
+ apply: "build",
154
+
155
+ config(_, { mode }) {
156
+ env = loadEnv(mode, process.cwd(), "VITE_OO_");
157
+ },
158
+
159
+ resolveId(id) {
160
+ if (id === VIRTUAL_OO_ID) return RESOLVED_OO_ID;
161
+ },
162
+
163
+ load(id) {
164
+ if (id !== RESOLVED_OO_ID) return;
165
+
166
+ const token = env.VITE_OO_CLIENT_TOKEN;
167
+ if (!token) return "export default false;";
168
+
169
+ const site = env.VITE_OO_SITE || "api.openobserve.ai";
170
+ const org = env.VITE_OO_ORG || "";
171
+ const appId = env.VITE_OO_APP_ID || "";
172
+ const service = env.VITE_OO_SERVICE || "";
173
+ const version = env.VITE_OO_VERSION || "0.0.1";
174
+
175
+ return `
176
+ import { openobserveRum } from "@openobserve/browser-rum-slim";
177
+ import { openobserveLogs } from "@openobserve/browser-logs";
178
+
179
+ openobserveRum.init({
180
+ applicationId: ${JSON.stringify(appId)},
181
+ clientToken: ${JSON.stringify(token)},
182
+ site: ${JSON.stringify(site)},
183
+ organizationIdentifier: ${JSON.stringify(org)},
184
+ service: ${JSON.stringify(service)},
185
+ env: "production",
186
+ version: ${JSON.stringify(version)},
187
+ trackResources: true,
188
+ trackLongTasks: true,
189
+ trackUserInteractions: true,
190
+ insecureHTTP: false,
191
+ apiVersion: "v1",
192
+ defaultPrivacyLevel: "allow",
193
+ sessionSampleRate: 100,
194
+ });
195
+
196
+ openobserveLogs.init({
197
+ clientToken: ${JSON.stringify(token)},
198
+ site: ${JSON.stringify(site)},
199
+ organizationIdentifier: ${JSON.stringify(org)},
200
+ service: ${JSON.stringify(service)},
201
+ env: "production",
202
+ version: ${JSON.stringify(version)},
203
+ forwardErrorsToLogs: true,
204
+ insecureHTTP: false,
205
+ apiVersion: "v1",
206
+ });
207
+
208
+ export default true;
209
+ `;
210
+ },
211
+
212
+ transform(code, id) {
213
+ if (id.endsWith("/index.tsx") && !id.includes("node_modules")) {
214
+ return `import ${JSON.stringify(VIRTUAL_OO_ID)};\n` + code;
215
+ }
216
+ },
217
+ };
218
+ }
219
+
55
220
  export default defineConfig({
56
221
  plugins: [
222
+ injectRemixerBadgePlugin(),
223
+ openobservePlugin(),
57
224
  tailwindProdPlugin(),
58
225
  react(),
59
226
  ],