obi-sdk 0.16.0 → 0.18.0

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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +62 -0
  3. package/dist/obi-sdk.standalone.iife.js +62 -2645
  4. package/dist/src/loader.d.ts +11 -0
  5. package/dist/src/mount.d.ts +1 -0
  6. package/dist/src/sdk.d.ts +77 -0
  7. package/dist/src/types.d.ts +12 -0
  8. package/dist/src/widget.d.ts +6 -0
  9. package/package.json +11 -29
  10. package/dist/core/config-logger.d.ts +0 -30
  11. package/dist/core/constants.d.ts +0 -1
  12. package/dist/core/index.d.ts +0 -3
  13. package/dist/core/init.d.ts +0 -1
  14. package/dist/core/types.d.ts +0 -46
  15. package/dist/empty-loader.d.ts +0 -5
  16. package/dist/index.d.ts +0 -2
  17. package/dist/loader.d.ts +0 -33
  18. package/dist/modular/chunks/index-0ae60d8f.js +0 -6
  19. package/dist/modular/chunks/index-0ae60d8f.js.map +0 -1
  20. package/dist/modular/chunks/obi-widget-1f912837.js +0 -22390
  21. package/dist/modular/chunks/obi-widget-1f912837.js.map +0 -1
  22. package/dist/modular/chunks/types-f38a47f6.js +0 -22431
  23. package/dist/modular/chunks/types-f38a47f6.js.map +0 -1
  24. package/dist/modular/core.js +0 -4086
  25. package/dist/modular/core.js.map +0 -1
  26. package/dist/modular/index.js +0 -361
  27. package/dist/modular/index.js.map +0 -1
  28. package/dist/modular/ui.js +0 -110
  29. package/dist/modular/ui.js.map +0 -1
  30. package/dist/obi-sdk.standalone.iife.js.map +0 -1
  31. package/dist/react.d.ts +0 -6
  32. package/dist/react.es.js +0 -32868
  33. package/dist/react.es.js.map +0 -1
  34. package/dist/react.umd.js +0 -2842
  35. package/dist/react.umd.js.map +0 -1
  36. package/dist/ui/components/audio-equalizer.d.ts +0 -21
  37. package/dist/ui/components/courses/course-modal.d.ts +0 -20
  38. package/dist/ui/components/courses/courses.d.ts +0 -31
  39. package/dist/ui/components/courses/index.d.ts +0 -1
  40. package/dist/ui/components/dot-loader.d.ts +0 -20
  41. package/dist/ui/components/icons.d.ts +0 -6
  42. package/dist/ui/components/index.d.ts +0 -10
  43. package/dist/ui/components/nav-icon.d.ts +0 -10
  44. package/dist/ui/components/navigation-bar.d.ts +0 -19
  45. package/dist/ui/components/obi-widget/index.d.ts +0 -1
  46. package/dist/ui/components/obi-widget/obi-widget.d.ts +0 -103
  47. package/dist/ui/components/obi-widget/user-update.test.d.ts +0 -1
  48. package/dist/ui/components/searching-loader.d.ts +0 -5
  49. package/dist/ui/components/status-widget.d.ts +0 -8
  50. package/dist/ui/index.d.ts +0 -1
  51. package/dist/utils/index.d.ts +0 -2
  52. package/dist/utils/storage.d.ts +0 -45
  53. package/index.d.ts +0 -8
  54. /package/dist/{test/setup.d.ts → src/empty.test.d.ts} +0 -0
  55. /package/dist/{ui/components/obi-widget/obi-widget.test.d.ts → src/index.d.ts} +0 -0
  56. /package/dist/{sentry.d.ts → src/sentry.d.ts} +0 -0
  57. /package/dist/{utils → src}/url-matcher.d.ts +0 -0
  58. /package/dist/{utils → src}/url-matcher.test.d.ts +0 -0
@@ -1,361 +0,0 @@
1
- import { O as ObiWidget, s as setGlobalContext, t as trackEvent, c as captureException, w as withSentryAsyncHandler, a as withSentryHandler } from "./chunks/obi-widget-1f912837.js";
2
- import "./chunks/types-f38a47f6.js";
3
- class ConfigLogger {
4
- constructor() {
5
- this.history = [];
6
- this.currentConfig = null;
7
- }
8
- logInitialConfig(config) {
9
- const entry = {
10
- timestamp: Date.now(),
11
- source: "initial",
12
- previousConfig: null,
13
- newConfig: this.deepClone(config),
14
- diff: this.calculateDiff(null, config)
15
- };
16
- this.history.push(entry);
17
- this.currentConfig = this.deepClone(config);
18
- }
19
- logConfigUpdate(newConfig) {
20
- const previousConfig = this.currentConfig;
21
- const entry = {
22
- timestamp: Date.now(),
23
- source: "update",
24
- previousConfig: previousConfig ? this.deepClone(previousConfig) : null,
25
- newConfig: this.deepClone(newConfig),
26
- diff: this.calculateDiff(previousConfig, newConfig)
27
- };
28
- this.history.push(entry);
29
- this.currentConfig = this.deepClone(newConfig);
30
- }
31
- getHistory() {
32
- return this.history.map((entry) => this.deepClone(entry));
33
- }
34
- getLatest() {
35
- return this.currentConfig ? this.deepClone(this.currentConfig) : null;
36
- }
37
- getDiff(index) {
38
- if (index < 0 || index >= this.history.length) {
39
- return null;
40
- }
41
- return this.deepClone(this.history[index].diff);
42
- }
43
- clear() {
44
- this.history = [];
45
- this.currentConfig = null;
46
- }
47
- getFormattedHistory() {
48
- return this.history.map((entry, index) => {
49
- const time = new Date(entry.timestamp).toISOString();
50
- const diffKeys = Object.keys(entry.diff.added).concat(
51
- Object.keys(entry.diff.modified),
52
- Object.keys(entry.diff.removed)
53
- );
54
- return `${index + 1}. [${time}] ${entry.source.toUpperCase()}: ${diffKeys.length > 0 ? diffKeys.join(", ") : "No changes"}`;
55
- }).join("\n");
56
- }
57
- deepClone(obj) {
58
- if (obj === null || typeof obj !== "object") {
59
- return obj;
60
- }
61
- if (obj instanceof Date) {
62
- return new Date(obj.getTime());
63
- }
64
- if (Array.isArray(obj)) {
65
- return obj.map((item) => this.deepClone(item));
66
- }
67
- const cloned = {};
68
- for (const key in obj) {
69
- if (obj.hasOwnProperty(key)) {
70
- cloned[key] = this.deepClone(obj[key]);
71
- }
72
- }
73
- return cloned;
74
- }
75
- calculateDiff(oldConfig, newConfig) {
76
- const diff = {
77
- added: {},
78
- modified: {},
79
- removed: {}
80
- };
81
- const oldKeys = oldConfig ? Object.keys(oldConfig) : [];
82
- const newKeys = Object.keys(newConfig);
83
- for (const key of newKeys) {
84
- if (!oldConfig || !(key in oldConfig)) {
85
- diff.added[key] = newConfig[key];
86
- } else if (!this.isEqual(oldConfig[key], newConfig[key])) {
87
- diff.modified[key] = {
88
- from: oldConfig[key],
89
- to: newConfig[key]
90
- };
91
- }
92
- }
93
- if (oldConfig) {
94
- for (const key of oldKeys) {
95
- if (!(key in newConfig)) {
96
- diff.removed[key] = oldConfig[key];
97
- }
98
- }
99
- }
100
- return diff;
101
- }
102
- isEqual(a, b) {
103
- if (a === b)
104
- return true;
105
- if (a === null || b === null)
106
- return a === b;
107
- if (typeof a !== typeof b)
108
- return false;
109
- if (typeof a !== "object")
110
- return a === b;
111
- if (Array.isArray(a) !== Array.isArray(b))
112
- return false;
113
- if (Array.isArray(a)) {
114
- if (a.length !== b.length)
115
- return false;
116
- return a.every((item, index) => this.isEqual(item, b[index]));
117
- }
118
- const aKeys = Object.keys(a);
119
- const bKeys = Object.keys(b);
120
- if (aKeys.length !== bKeys.length)
121
- return false;
122
- return aKeys.every((key) => this.isEqual(a[key], b[key]));
123
- }
124
- }
125
- if (!customElements.get("obi-widget")) {
126
- customElements.define("obi-widget", ObiWidget);
127
- }
128
- const RETRY_CONFIG = {
129
- maxAttempts: 3,
130
- baseDelay: 200,
131
- // ms
132
- maxDelay: 2e3
133
- // ms
134
- };
135
- let configLogger = null;
136
- function delay(ms) {
137
- return new Promise((resolve) => setTimeout(resolve, ms));
138
- }
139
- function getRetryDelay(attempt) {
140
- const exponentialDelay = RETRY_CONFIG.baseDelay * Math.pow(2, attempt);
141
- return Math.min(exponentialDelay, RETRY_CONFIG.maxDelay);
142
- }
143
- async function retryOperation(operation, operationName, maxAttempts = RETRY_CONFIG.maxAttempts) {
144
- let lastError = null;
145
- for (let attempt = 0; attempt < maxAttempts; attempt++) {
146
- try {
147
- trackEvent(`${operationName}_attempt`, { attempt: attempt + 1 }, "init");
148
- return await operation();
149
- } catch (error) {
150
- lastError = error;
151
- console.warn(
152
- `[obi-sdk] ${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`,
153
- error
154
- );
155
- trackEvent(
156
- `${operationName}_failed`,
157
- {
158
- error: error instanceof Error ? error.message : String(error),
159
- attempt: attempt + 1,
160
- maxAttempts
161
- },
162
- "init"
163
- );
164
- if (attempt < maxAttempts - 1) {
165
- const delayMs = getRetryDelay(attempt);
166
- await delay(delayMs);
167
- }
168
- }
169
- }
170
- const finalError = new Error(
171
- `${operationName} failed after ${maxAttempts} attempts: ${lastError?.message}`
172
- );
173
- captureException(finalError, {
174
- componentName: "init",
175
- handlerName: "retryOperation",
176
- operationName,
177
- maxAttempts,
178
- lastErrorMessage: lastError?.message
179
- });
180
- throw finalError;
181
- }
182
- const mountSDK = withSentryHandler(
183
- function() {
184
- const w = window;
185
- let q = [];
186
- if (typeof w.ObiSDK === "function" || typeof w.ObiSDK === "object") {
187
- q = w.ObiSDK.q || [];
188
- }
189
- configLogger = new ConfigLogger();
190
- if (w.obiWidgetConfig) {
191
- setGlobalContext({
192
- apiKey: w.obiWidgetConfig.apiKey,
193
- userId: w.obiWidgetConfig.user?.id,
194
- userEmail: w.obiWidgetConfig.user?.email,
195
- userMetadata: w.obiWidgetConfig.user?.metadata
196
- });
197
- configLogger.logInitialConfig(w.obiWidgetConfig);
198
- }
199
- w.ObiSDK = function(command, config) {
200
- try {
201
- if (command === "update" && config) {
202
- const updatedConfig = {
203
- ...w.obiWidgetConfig,
204
- ...config
205
- };
206
- if (configLogger) {
207
- configLogger.logConfigUpdate(updatedConfig);
208
- }
209
- w.obiWidgetConfig = updatedConfig;
210
- if (config.user) {
211
- setGlobalContext({
212
- userId: config.user.id,
213
- userEmail: config.user.email,
214
- userMetadata: config.user.metadata
215
- });
216
- }
217
- const widgets = document.querySelectorAll("obi-widget");
218
- widgets.forEach((widget) => {
219
- widget.dispatchEvent(
220
- new CustomEvent("obi-config-updated", {
221
- detail: config,
222
- bubbles: true,
223
- composed: true
224
- })
225
- );
226
- });
227
- trackEvent(
228
- "SDK_config_updated",
229
- {
230
- hasUser: !!config.user,
231
- configKeys: Object.keys(config)
232
- },
233
- "init"
234
- );
235
- }
236
- } catch (error) {
237
- captureException(error, {
238
- componentName: "init",
239
- handlerName: "ObiSDK.update",
240
- command
241
- });
242
- throw error;
243
- }
244
- };
245
- w.ObiSDK.q = q;
246
- w.ObiSDK.log = configLogger;
247
- },
248
- "mountSDK",
249
- "init"
250
- );
251
- const mountWidget = withSentryAsyncHandler(
252
- async function() {
253
- return retryOperation(async () => {
254
- if (document.querySelector("obi-widget")) {
255
- trackEvent("widget_already_exists", {}, "init");
256
- return;
257
- }
258
- if (!document.body) {
259
- throw new Error("document.body not available");
260
- }
261
- const widget = document.createElement("obi-widget");
262
- document.body.appendChild(widget);
263
- console.log("[obi-sdk] widget mounted");
264
- trackEvent("widget_mounted", {}, "init");
265
- }, "widget mounting");
266
- },
267
- "mountWidget",
268
- "init"
269
- );
270
- const processQueue = withSentryHandler(
271
- function() {
272
- const w = window;
273
- if (w.ObiSDK && Array.isArray(w.ObiSDK.q)) {
274
- const queueLength = w.ObiSDK.q.length;
275
- trackEvent("queue_processing", { queueLength }, "init");
276
- (w.ObiSDK.q || []).forEach((args) => {
277
- w.ObiSDK(...args);
278
- });
279
- w.ObiSDK.q = [];
280
- if (queueLength > 0) {
281
- trackEvent("queue_processed", { queueLength }, "init");
282
- }
283
- }
284
- },
285
- "processQueue",
286
- "init"
287
- );
288
- const loadFonts = withSentryAsyncHandler(
289
- async function() {
290
- await loadFont("https://fonts.cdnfonts.com/css/satoshi");
291
- await loadFont(
292
- "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
293
- );
294
- },
295
- "loadFonts",
296
- "init"
297
- );
298
- const loadFont = withSentryAsyncHandler(
299
- async function(fontUrl) {
300
- return retryOperation(async () => {
301
- if (!document.head) {
302
- throw new Error("document.head not available");
303
- }
304
- const link = document.createElement("link");
305
- link.href = fontUrl;
306
- link.rel = "stylesheet";
307
- document.head.appendChild(link);
308
- trackEvent("font_loaded", { fontUrl }, "init");
309
- }, "font loading");
310
- },
311
- "loadFont",
312
- "init"
313
- );
314
- const safeInitialize = withSentryAsyncHandler(
315
- async function() {
316
- trackEvent("SDK_initialization_started", {}, "init");
317
- await new Promise((resolve) => setTimeout(resolve, 500));
318
- mountSDK();
319
- await loadFonts();
320
- await mountWidget();
321
- processQueue();
322
- trackEvent("SDK_initialization_completed", {}, "init");
323
- },
324
- "safeInitialize",
325
- "init"
326
- );
327
- const initializeObiWidget = withSentryAsyncHandler(
328
- async function() {
329
- if (document.readyState === "loading") {
330
- trackEvent("DOM_not_ready", {}, "init");
331
- document.addEventListener("DOMContentLoaded", async () => {
332
- try {
333
- await safeInitialize();
334
- } catch (error) {
335
- captureException(error, { componentName: "init", handlerName: "DOMContentLoaded" });
336
- console.error("[obi-sdk] initialization failed:", error);
337
- }
338
- });
339
- } else {
340
- trackEvent("DOM_ready", {}, "init");
341
- await safeInitialize();
342
- }
343
- },
344
- "initializeObiWidget",
345
- "init"
346
- );
347
- try {
348
- setGlobalContext({ componentName: "init" });
349
- trackEvent("SDK_script_loaded", {}, "init");
350
- initializeObiWidget().catch((error) => {
351
- captureException(error, { componentName: "init", handlerName: "initializeObiWidget" });
352
- console.error("[obi-sdk] initialization failed:", error);
353
- });
354
- } catch (error) {
355
- captureException(error, { componentName: "init", handlerName: "top-level" });
356
- console.error("[obi-sdk] initialization failed:", error);
357
- }
358
- export {
359
- ObiWidget
360
- };
361
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/core/config-logger.ts","../../src/core/init.ts"],"sourcesContent":["import { ObiAssistantConfig } from \"../types/sdk\"\n\nexport interface ConfigLogEntry {\n timestamp: number\n source: 'initial' | 'update'\n previousConfig: ObiAssistantConfig | null\n newConfig: ObiAssistantConfig\n diff: ConfigDiff\n}\n\nexport interface ConfigDiff {\n added: Record<string, any>\n modified: Record<string, { from: any; to: any }>\n removed: Record<string, any>\n}\n\nexport class ConfigLogger {\n private history: ConfigLogEntry[] = []\n private currentConfig: ObiAssistantConfig | null = null\n\n logInitialConfig(config: ObiAssistantConfig): void {\n const entry: ConfigLogEntry = {\n timestamp: Date.now(),\n source: 'initial',\n previousConfig: null,\n newConfig: this.deepClone(config),\n diff: this.calculateDiff(null, config)\n }\n \n this.history.push(entry)\n this.currentConfig = this.deepClone(config)\n }\n\n logConfigUpdate(newConfig: ObiAssistantConfig): void {\n const previousConfig = this.currentConfig\n const entry: ConfigLogEntry = {\n timestamp: Date.now(),\n source: 'update',\n previousConfig: previousConfig ? this.deepClone(previousConfig) : null,\n newConfig: this.deepClone(newConfig),\n diff: this.calculateDiff(previousConfig, newConfig)\n }\n \n this.history.push(entry)\n this.currentConfig = this.deepClone(newConfig)\n }\n\n getHistory(): ConfigLogEntry[] {\n return this.history.map(entry => this.deepClone(entry))\n }\n\n getLatest(): ObiAssistantConfig | null {\n return this.currentConfig ? this.deepClone(this.currentConfig) : null\n }\n\n getDiff(index: number): ConfigDiff | null {\n if (index < 0 || index >= this.history.length) {\n return null\n }\n return this.deepClone(this.history[index].diff)\n }\n\n clear(): void {\n this.history = []\n this.currentConfig = null\n }\n\n getFormattedHistory(): string {\n return this.history.map((entry, index) => {\n const time = new Date(entry.timestamp).toISOString()\n const diffKeys = Object.keys(entry.diff.added).concat(\n Object.keys(entry.diff.modified),\n Object.keys(entry.diff.removed)\n )\n \n return `${index + 1}. [${time}] ${entry.source.toUpperCase()}: ${diffKeys.length > 0 ? diffKeys.join(', ') : 'No changes'}`\n }).join('\\n')\n }\n\n private deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== 'object') {\n return obj\n }\n \n if (obj instanceof Date) {\n return new Date(obj.getTime()) as unknown as T\n }\n \n if (Array.isArray(obj)) {\n return obj.map(item => this.deepClone(item)) as unknown as T\n }\n \n const cloned = {} as T\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n cloned[key] = this.deepClone(obj[key])\n }\n }\n \n return cloned\n }\n\n private calculateDiff(oldConfig: ObiAssistantConfig | null, newConfig: ObiAssistantConfig): ConfigDiff {\n const diff: ConfigDiff = {\n added: {},\n modified: {},\n removed: {}\n }\n\n const oldKeys = oldConfig ? Object.keys(oldConfig) : []\n const newKeys = Object.keys(newConfig)\n \n for (const key of newKeys) {\n if (!oldConfig || !(key in oldConfig)) {\n diff.added[key] = newConfig[key as keyof ObiAssistantConfig]\n } else if (!this.isEqual(oldConfig[key as keyof ObiAssistantConfig], newConfig[key as keyof ObiAssistantConfig])) {\n diff.modified[key] = {\n from: oldConfig[key as keyof ObiAssistantConfig],\n to: newConfig[key as keyof ObiAssistantConfig]\n }\n }\n }\n\n if (oldConfig) {\n for (const key of oldKeys) {\n if (!(key in newConfig)) {\n diff.removed[key] = oldConfig[key as keyof ObiAssistantConfig]\n }\n }\n }\n\n return diff\n }\n\n private isEqual(a: any, b: any): boolean {\n if (a === b) return true\n \n if (a === null || b === null) return a === b\n \n if (typeof a !== typeof b) return false\n \n if (typeof a !== 'object') return a === b\n \n if (Array.isArray(a) !== Array.isArray(b)) return false\n \n if (Array.isArray(a)) {\n if (a.length !== b.length) return false\n return a.every((item, index) => this.isEqual(item, b[index]))\n }\n \n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n \n if (aKeys.length !== bKeys.length) return false\n \n return aKeys.every(key => this.isEqual(a[key], b[key]))\n }\n}","import {\n captureException,\n setGlobalContext,\n trackEvent,\n withSentryAsyncHandler,\n withSentryHandler,\n} from \"../sentry\"\nimport { ObiWidget } from \"../ui/components/obi-widget\"\nimport { ConfigLogger } from \"./config-logger\"\n\nif (!customElements.get(\"obi-widget\")) {\n customElements.define(\"obi-widget\", ObiWidget)\n}\n\n// Retry configuration\nconst RETRY_CONFIG = {\n maxAttempts: 3,\n baseDelay: 200, // ms\n maxDelay: 2000, // ms\n}\n\n// Global configuration logger instance\nlet configLogger: ConfigLogger | null = null\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nfunction getRetryDelay(attempt: number): number {\n const exponentialDelay = RETRY_CONFIG.baseDelay * Math.pow(2, attempt)\n return Math.min(exponentialDelay, RETRY_CONFIG.maxDelay)\n}\n\nasync function retryOperation<T>(\n operation: () => Promise<T> | T,\n operationName: string,\n maxAttempts: number = RETRY_CONFIG.maxAttempts\n): Promise<T> {\n let lastError: Error | null = null\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n try {\n trackEvent(`${operationName}_attempt`, { attempt: attempt + 1 }, \"init\")\n return await operation()\n } catch (error) {\n lastError = error as Error\n console.warn(\n `[obi-sdk] ${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`,\n error\n )\n\n trackEvent(\n `${operationName}_failed`,\n {\n error: error instanceof Error ? error.message : String(error),\n attempt: attempt + 1,\n maxAttempts,\n },\n \"init\"\n )\n\n if (attempt < maxAttempts - 1) {\n const delayMs = getRetryDelay(attempt)\n await delay(delayMs)\n }\n }\n }\n\n const finalError = new Error(\n `${operationName} failed after ${maxAttempts} attempts: ${lastError?.message}`\n )\n captureException(finalError, {\n componentName: \"init\",\n handlerName: \"retryOperation\",\n operationName,\n maxAttempts,\n lastErrorMessage: lastError?.message,\n })\n throw finalError\n}\n\nconst mountSDK = withSentryHandler(\n function (): void {\n const w = window as any\n\n // The \"q\" here is a queue of commands that are sent to the SDK before it is initialized, typically\n // from the loader. We need to save it here so that we can restore it after the SDK is initialized.\n let q: any[] = []\n if (typeof w.ObiSDK === \"function\" || typeof w.ObiSDK === \"object\") {\n q = w.ObiSDK.q || []\n }\n\n // Initialize configuration logger\n configLogger = new ConfigLogger()\n \n // Set up global context from config if available\n if (w.obiWidgetConfig) {\n setGlobalContext({\n apiKey: w.obiWidgetConfig.apiKey,\n userId: w.obiWidgetConfig.user?.id,\n userEmail: w.obiWidgetConfig.user?.email,\n userMetadata: w.obiWidgetConfig.user?.metadata,\n })\n \n // Log initial configuration\n configLogger.logInitialConfig(w.obiWidgetConfig)\n }\n\n // The loader will have already set the ObiSDK value, but it's function is designed to just add\n // the command to the queue. We need to override it here so that we can handle the commands.\n w.ObiSDK = function (command: string, config?: any) {\n try {\n if (command === \"update\" && config) {\n const updatedConfig = {\n ...w.obiWidgetConfig,\n ...config,\n }\n \n // Log configuration change\n if (configLogger) {\n configLogger.logConfigUpdate(updatedConfig)\n }\n \n w.obiWidgetConfig = updatedConfig\n\n // Update Sentry context when config changes\n if (config.user) {\n setGlobalContext({\n userId: config.user.id,\n userEmail: config.user.email,\n userMetadata: config.user.metadata,\n })\n }\n\n // Notify all mounted obi-widget elements about the configuration update.\n const widgets = document.querySelectorAll(\"obi-widget\")\n widgets.forEach((widget) => {\n widget.dispatchEvent(\n new CustomEvent(\"obi-config-updated\", {\n detail: config,\n bubbles: true,\n composed: true,\n })\n )\n })\n\n trackEvent(\n \"SDK_config_updated\",\n {\n hasUser: !!config.user,\n configKeys: Object.keys(config),\n },\n \"init\"\n )\n }\n } catch (error) {\n captureException(error, {\n componentName: \"init\",\n handlerName: \"ObiSDK.update\",\n command,\n })\n throw error\n }\n }\n\n // Restore the queue, so it can be processed in the `processQueue` function.\n w.ObiSDK.q = q\n \n // Expose the logger on the SDK for debugging\n w.ObiSDK.log = configLogger\n },\n \"mountSDK\",\n \"init\"\n)\n\nconst mountWidget = withSentryAsyncHandler(\n async function (): Promise<void> {\n return retryOperation(async () => {\n if (document.querySelector(\"obi-widget\")) {\n trackEvent(\"widget_already_exists\", {}, \"init\")\n return\n }\n\n if (!document.body) {\n throw new Error(\"document.body not available\")\n }\n\n const widget = document.createElement(\"obi-widget\")\n document.body.appendChild(widget)\n console.log(\"[obi-sdk] widget mounted\")\n trackEvent(\"widget_mounted\", {}, \"init\")\n }, \"widget mounting\")\n },\n \"mountWidget\",\n \"init\"\n)\n\n// Optionally process a queue if you want to support it\nconst processQueue = withSentryHandler(\n function () {\n const w = window as any\n if (w.ObiSDK && Array.isArray(w.ObiSDK.q)) {\n const queueLength = w.ObiSDK.q.length\n trackEvent(\"queue_processing\", { queueLength }, \"init\")\n ;(w.ObiSDK.q || []).forEach((args: any[]) => {\n w.ObiSDK(...args)\n })\n w.ObiSDK.q = []\n\n if (queueLength > 0) {\n trackEvent(\"queue_processed\", { queueLength }, \"init\")\n }\n }\n },\n \"processQueue\",\n \"init\"\n)\n\nconst loadFonts = withSentryAsyncHandler(\n async function () {\n await loadFont(\"https://fonts.cdnfonts.com/css/satoshi\")\n await loadFont(\n \"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap\"\n )\n },\n \"loadFonts\",\n \"init\"\n)\n\nconst loadFont = withSentryAsyncHandler(\n async function (fontUrl: string) {\n return retryOperation(async () => {\n if (!document.head) {\n throw new Error(\"document.head not available\")\n }\n\n const link = document.createElement(\"link\")\n link.href = fontUrl\n link.rel = \"stylesheet\"\n\n document.head.appendChild(link)\n trackEvent(\"font_loaded\", { fontUrl }, \"init\")\n }, \"font loading\")\n },\n \"loadFont\",\n \"init\"\n)\n\nconst safeInitialize = withSentryAsyncHandler(\n async function (): Promise<void> {\n // Track initialization start\n trackEvent(\"SDK_initialization_started\", {}, \"init\")\n\n // Wait for a moment to ensure any write to localStorage from the obi loader is complete.\n await new Promise((resolve) => setTimeout(resolve, 500))\n\n mountSDK()\n await loadFonts()\n await mountWidget()\n processQueue()\n\n trackEvent(\"SDK_initialization_completed\", {}, \"init\")\n },\n \"safeInitialize\",\n \"init\"\n)\n\nexport const initializeObiWidget = withSentryAsyncHandler(\n async function () {\n if (document.readyState === \"loading\") {\n trackEvent(\"DOM_not_ready\", {}, \"init\")\n document.addEventListener(\"DOMContentLoaded\", async () => {\n try {\n await safeInitialize()\n } catch (error) {\n captureException(error, { componentName: \"init\", handlerName: \"DOMContentLoaded\" })\n console.error(\"[obi-sdk] initialization failed:\", error)\n }\n })\n } else {\n trackEvent(\"DOM_ready\", {}, \"init\")\n await safeInitialize()\n }\n },\n \"initializeObiWidget\",\n \"init\"\n)\n\ntry {\n // Set initial context\n setGlobalContext({ componentName: \"init\" })\n trackEvent(\"SDK_script_loaded\", {}, \"init\")\n\n initializeObiWidget().catch((error) => {\n // This is a catches errors from the initializeObiWidget function,\n // which due to async will not be caught by the try/catch block.\n captureException(error, { componentName: \"init\", handlerName: \"initializeObiWidget\" })\n console.error(\"[obi-sdk] initialization failed:\", error)\n })\n} catch (error) {\n captureException(error, { componentName: \"init\", handlerName: \"top-level\" })\n console.error(\"[obi-sdk] initialization failed:\", error)\n}\n"],"names":[],"mappings":"AAgBO,SAAA,KAAA,WAAA,KAAA,kBAAA,KAAA,YAAA,KAAA,kBAAA,KAAA,wBAAA,KAAA,yBAAA;AAAA,OAAA;AAAA,MAAM,aAAa;AAAA,EAAnB,cAAA;AACL,SAAQ,UAA4B;AACpC,SAAQ,gBAA2C;AAAA,EAAA;AAAA,EAEnD,iBAAiB,QAAkC;AACjD,UAAM,QAAwB;AAAA,MAC5B,WAAW,KAAK,IAAI;AAAA,MACpB,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,WAAW,KAAK,UAAU,MAAM;AAAA,MAChC,MAAM,KAAK,cAAc,MAAM,MAAM;AAAA,IAAA;AAGlC,SAAA,QAAQ,KAAK,KAAK;AAClB,SAAA,gBAAgB,KAAK,UAAU,MAAM;AAAA,EAC5C;AAAA,EAEA,gBAAgB,WAAqC;AACnD,UAAM,iBAAiB,KAAK;AAC5B,UAAM,QAAwB;AAAA,MAC5B,WAAW,KAAK,IAAI;AAAA,MACpB,QAAQ;AAAA,MACR,gBAAgB,iBAAiB,KAAK,UAAU,cAAc,IAAI;AAAA,MAClE,WAAW,KAAK,UAAU,SAAS;AAAA,MACnC,MAAM,KAAK,cAAc,gBAAgB,SAAS;AAAA,IAAA;AAG/C,SAAA,QAAQ,KAAK,KAAK;AAClB,SAAA,gBAAgB,KAAK,UAAU,SAAS;AAAA,EAC/C;AAAA,EAEA,aAA+B;AAC7B,WAAO,KAAK,QAAQ,IAAI,WAAS,KAAK,UAAU,KAAK,CAAC;AAAA,EACxD;AAAA,EAEA,YAAuC;AACrC,WAAO,KAAK,gBAAgB,KAAK,UAAU,KAAK,aAAa,IAAI;AAAA,EACnE;AAAA,EAEA,QAAQ,OAAkC;AACxC,QAAI,QAAQ,KAAK,SAAS,KAAK,QAAQ,QAAQ;AACtC,aAAA;AAAA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AAM,oCAAoC,KAAK;AAAA,EAAA,CACxD;AACH,SAAS,OAAO;AACd,mBAAiB,OAAO,EAAE,eAAe,QAAQ,aAAa,aAAa;AACnE,UAAA,MAAM,oCAAoC,KAAK;AACzD;"}
@@ -1,110 +0,0 @@
1
- import { S as SDKState } from "./chunks/types-f38a47f6.js";
2
- import { i, n, b as i$1, x } from "./chunks/obi-widget-1f912837.js";
3
- import { A, C, e, f, D, N, d, O, S } from "./chunks/obi-widget-1f912837.js";
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __decorateClass = (decorators, target, key, kind) => {
7
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
8
- for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
9
- if (decorator = decorators[i2])
10
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11
- if (kind && result)
12
- __defProp(target, key, result);
13
- return result;
14
- };
15
- class ObiStatusWidget extends i$1 {
16
- constructor() {
17
- super(...arguments);
18
- this.state = SDKState.READY;
19
- }
20
- render() {
21
- return x`
22
- <div class="status-container">
23
- <div class="status-indicator ${this.state}"></div>
24
- <div class="status-text">${this.getStatusText()}</div>
25
- </div>
26
- `;
27
- }
28
- getStatusText() {
29
- switch (this.state) {
30
- case SDKState.READY:
31
- return "Ready";
32
- case SDKState.ERROR:
33
- return "Error";
34
- default:
35
- return "Unknown";
36
- }
37
- }
38
- }
39
- ObiStatusWidget.styles = i`
40
- :host {
41
- display: inline-block;
42
- font-family: Arial, sans-serif;
43
- }
44
-
45
- .status-container {
46
- display: flex;
47
- align-items: center;
48
- padding: 8px 12px;
49
- border-radius: 16px;
50
- background-color: #f3f4f6;
51
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
52
- }
53
-
54
- .status-indicator {
55
- width: 10px;
56
- height: 10px;
57
- border-radius: 50%;
58
- margin-right: 8px;
59
- }
60
-
61
- .ready {
62
- background-color: #10b981;
63
- }
64
-
65
- .active {
66
- background-color: #3b82f6;
67
- }
68
-
69
- .error {
70
- background-color: #ef4444;
71
- }
72
-
73
- .status-text {
74
- font-size: 14px;
75
- font-weight: 500;
76
- color: #1f2937;
77
- }
78
- `;
79
- __decorateClass([
80
- n({ type: String })
81
- ], ObiStatusWidget.prototype, "state", 2);
82
- if (!customElements.get("obi-status-widget")) {
83
- customElements.define("obi-status-widget", ObiStatusWidget);
84
- }
85
- const statusWidget = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, ObiStatusWidget }, Symbol.toStringTag, { value: "Module" }));
86
- function defineCustomElements() {
87
- Promise.resolve().then(() => statusWidget);
88
- import("./chunks/index-0ae60d8f.js");
89
- import("./chunks/obi-widget-1f912837.js").then((n2) => n2.l);
90
- import("./chunks/obi-widget-1f912837.js").then((n2) => n2.m);
91
- import("./chunks/obi-widget-1f912837.js").then((n2) => n2.g);
92
- import("./chunks/obi-widget-1f912837.js").then((n2) => n2.h);
93
- import("./chunks/obi-widget-1f912837.js").then((n2) => n2.o);
94
- import("./chunks/obi-widget-1f912837.js").then((n2) => n2.j);
95
- import("./chunks/obi-widget-1f912837.js").then((n2) => n2.k);
96
- }
97
- export {
98
- A as AudioEqualizer,
99
- C as Course,
100
- e as CourseList,
101
- f as CourseModal,
102
- D as DotLoader,
103
- N as NavIcon,
104
- d as NavigationBar,
105
- ObiStatusWidget,
106
- O as ObiWidget,
107
- S as SearchingLoader,
108
- defineCustomElements
109
- };
110
- //# sourceMappingURL=ui.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ui.js","sources":["../../src/ui/components/status-widget.ts","../../src/ui/components/index.ts"],"sourcesContent":["import { SDKState } from \"@obi/obi-session\"\nimport { LitElement, html, css } from \"lit\"\nimport { property } from \"lit/decorators.js\"\n\nexport class ObiStatusWidget extends LitElement {\n @property({ type: String })\n state: SDKState = SDKState.READY\n\n static styles = css`\n :host {\n display: inline-block;\n font-family: Arial, sans-serif;\n }\n\n .status-container {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n border-radius: 16px;\n background-color: #f3f4f6;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);\n }\n\n .status-indicator {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n margin-right: 8px;\n }\n\n .ready {\n background-color: #10b981;\n }\n\n .active {\n background-color: #3b82f6;\n }\n\n .error {\n background-color: #ef4444;\n }\n\n .status-text {\n font-size: 14px;\n font-weight: 500;\n color: #1f2937;\n }\n `\n\n render() {\n return html`\n <div class=\"status-container\">\n <div class=\"status-indicator ${this.state}\"></div>\n <div class=\"status-text\">${this.getStatusText()}</div>\n </div>\n `\n }\n\n private getStatusText(): string {\n switch (this.state) {\n case SDKState.READY:\n return \"Ready\"\n case SDKState.ERROR:\n return \"Error\"\n default:\n return \"Unknown\"\n }\n }\n}\n\nif (!customElements.get(\"obi-status-widget\")) {\n customElements.define(\"obi-status-widget\", ObiStatusWidget)\n}\n","export * from \"./status-widget\"\nexport * from \"./obi-widget\"\nexport * from \"./audio-equalizer\"\nexport * from \"./dot-loader\"\nexport * from \"./nav-icon\"\nexport * from \"./navigation-bar\"\nexport * from \"./searching-loader\"\nexport * from \"./courses/courses\"\nexport * from \"./courses/course-modal\"\n\n// Function to define all custom elements at once for development\nexport function defineCustomElements() {\n // Import all components to ensure they're registered\n // This is primarily useful for development\n import(\"./status-widget\")\n import(\"./obi-widget\")\n import(\"./audio-equalizer\")\n import(\"./dot-loader\")\n import(\"./nav-icon\")\n import(\"./navigation-bar\")\n import(\"./searching-loader\")\n import(\"./courses/courses\")\n import(\"./courses/course-modal\")\n}\n"],"names":["LitElement","html","css","property","n"],"mappings":";;;;;;;;;;;;;;AAIO,MAAM,wBAAwBA,IAAW;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AAEL,SAAA,QAAkB,SAAS;AAAA,EAAA;AAAA,EA2C3B,SAAS;AACA,WAAAC;AAAAA;AAAAA,uCAE4B,KAAK,KAAK;AAAA,mCAC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