obi-sdk 0.6.6 → 0.6.8
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/modular/chunks/index-fa4a7611.js +6 -0
- package/dist/modular/chunks/index-fa4a7611.js.map +1 -0
- package/dist/modular/chunks/{obi-widget-94e8c026.js → obi-widget-46e82ee8.js} +62 -11
- package/dist/modular/chunks/obi-widget-46e82ee8.js.map +1 -0
- package/dist/modular/index.js +172 -126
- package/dist/modular/index.js.map +1 -1
- package/dist/modular/ui.js +10 -10
- package/dist/obi-sdk.standalone.iife.js +43 -8
- package/dist/obi-sdk.standalone.iife.js.map +1 -1
- package/dist/react.es.js +1234 -1189
- package/dist/react.es.js.map +1 -1
- package/dist/react.umd.js +67 -32
- package/dist/react.umd.js.map +1 -1
- package/dist/ui/components/courses/course-modal.d.ts +1 -0
- package/package.json +4 -3
- package/dist/modular/chunks/index-d7a5d2f6.js +0 -6
- package/dist/modular/chunks/index-d7a5d2f6.js.map +0 -1
- package/dist/modular/chunks/obi-widget-94e8c026.js.map +0 -1
package/dist/modular/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as ObiWidget, s as setGlobalContext, t as trackEvent, c as captureException, w as withSentryAsyncHandler, a as withSentryHandler } from "./chunks/obi-widget-
|
|
1
|
+
import { O as ObiWidget, s as setGlobalContext, t as trackEvent, c as captureException, w as withSentryAsyncHandler, a as withSentryHandler } from "./chunks/obi-widget-46e82ee8.js";
|
|
2
2
|
import "./chunks/types-e0297e7b.js";
|
|
3
3
|
if (!customElements.get("obi-widget")) {
|
|
4
4
|
customElements.define("obi-widget", ObiWidget);
|
|
@@ -25,19 +25,28 @@ async function retryOperation(operation, operationName, maxAttempts = RETRY_CONF
|
|
|
25
25
|
return await operation();
|
|
26
26
|
} catch (error) {
|
|
27
27
|
lastError = error;
|
|
28
|
-
console.warn(
|
|
29
|
-
|
|
30
|
-
error
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
console.warn(
|
|
29
|
+
`[obi-sdk] ${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`,
|
|
30
|
+
error
|
|
31
|
+
);
|
|
32
|
+
trackEvent(
|
|
33
|
+
`${operationName}_failed`,
|
|
34
|
+
{
|
|
35
|
+
error: error instanceof Error ? error.message : String(error),
|
|
36
|
+
attempt: attempt + 1,
|
|
37
|
+
maxAttempts
|
|
38
|
+
},
|
|
39
|
+
"init"
|
|
40
|
+
);
|
|
34
41
|
if (attempt < maxAttempts - 1) {
|
|
35
42
|
const delayMs = getRetryDelay(attempt);
|
|
36
43
|
await delay(delayMs);
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
|
-
const finalError = new Error(
|
|
47
|
+
const finalError = new Error(
|
|
48
|
+
`${operationName} failed after ${maxAttempts} attempts: ${lastError?.message}`
|
|
49
|
+
);
|
|
41
50
|
captureException(finalError, {
|
|
42
51
|
componentName: "init",
|
|
43
52
|
handlerName: "retryOperation",
|
|
@@ -47,134 +56,171 @@ async function retryOperation(operation, operationName, maxAttempts = RETRY_CONF
|
|
|
47
56
|
});
|
|
48
57
|
throw finalError;
|
|
49
58
|
}
|
|
50
|
-
const mountSDK = withSentryHandler(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
const mountSDK = withSentryHandler(
|
|
60
|
+
function() {
|
|
61
|
+
const w = window;
|
|
62
|
+
let q = [];
|
|
63
|
+
if (typeof w.ObiSDK === "function" || typeof w.ObiSDK === "object") {
|
|
64
|
+
q = w.ObiSDK.q || [];
|
|
65
|
+
}
|
|
66
|
+
if (w.obiWidgetConfig) {
|
|
67
|
+
setGlobalContext({
|
|
68
|
+
apiKey: w.obiWidgetConfig.apiKey,
|
|
69
|
+
userId: w.obiWidgetConfig.user?.id,
|
|
70
|
+
userEmail: w.obiWidgetConfig.user?.email,
|
|
71
|
+
userMetadata: w.obiWidgetConfig.user?.metadata
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
w.ObiSDK = function(command, config) {
|
|
75
|
+
try {
|
|
76
|
+
if (command === "update" && config) {
|
|
77
|
+
w.obiWidgetConfig = {
|
|
78
|
+
...w.obiWidgetConfig,
|
|
79
|
+
...config
|
|
80
|
+
};
|
|
81
|
+
if (config.user) {
|
|
82
|
+
setGlobalContext({
|
|
83
|
+
userId: config.user.id,
|
|
84
|
+
userEmail: config.user.email,
|
|
85
|
+
userMetadata: config.user.metadata
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const widgets = document.querySelectorAll("obi-widget");
|
|
89
|
+
widgets.forEach((widget) => {
|
|
90
|
+
widget.dispatchEvent(
|
|
91
|
+
new CustomEvent("obi-config-updated", {
|
|
92
|
+
detail: config,
|
|
93
|
+
bubbles: true,
|
|
94
|
+
composed: true
|
|
95
|
+
})
|
|
96
|
+
);
|
|
76
97
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
composed: true
|
|
85
|
-
})
|
|
98
|
+
trackEvent(
|
|
99
|
+
"SDK_config_updated",
|
|
100
|
+
{
|
|
101
|
+
hasUser: !!config.user,
|
|
102
|
+
configKeys: Object.keys(config)
|
|
103
|
+
},
|
|
104
|
+
"init"
|
|
86
105
|
);
|
|
106
|
+
}
|
|
107
|
+
} catch (error) {
|
|
108
|
+
captureException(error, {
|
|
109
|
+
componentName: "init",
|
|
110
|
+
handlerName: "ObiSDK.update",
|
|
111
|
+
command
|
|
87
112
|
});
|
|
88
|
-
|
|
89
|
-
hasUser: !!config.user,
|
|
90
|
-
configKeys: Object.keys(config)
|
|
91
|
-
}, "init");
|
|
113
|
+
throw error;
|
|
92
114
|
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
115
|
+
};
|
|
116
|
+
w.ObiSDK.q = q;
|
|
117
|
+
},
|
|
118
|
+
"mountSDK",
|
|
119
|
+
"init"
|
|
120
|
+
);
|
|
121
|
+
const mountWidget = withSentryAsyncHandler(
|
|
122
|
+
async function() {
|
|
123
|
+
return retryOperation(async () => {
|
|
124
|
+
if (document.querySelector("obi-widget")) {
|
|
125
|
+
trackEvent("widget_already_exists", {}, "init");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!document.body) {
|
|
129
|
+
throw new Error("document.body not available");
|
|
130
|
+
}
|
|
131
|
+
const widget = document.createElement("obi-widget");
|
|
132
|
+
document.body.appendChild(widget);
|
|
133
|
+
console.log("[obi-sdk] widget mounted");
|
|
134
|
+
trackEvent("widget_mounted", {}, "init");
|
|
135
|
+
}, "widget mounting");
|
|
136
|
+
},
|
|
137
|
+
"mountWidget",
|
|
138
|
+
"init"
|
|
139
|
+
);
|
|
140
|
+
const processQueue = withSentryHandler(
|
|
141
|
+
function() {
|
|
142
|
+
const w = window;
|
|
143
|
+
if (w.ObiSDK && Array.isArray(w.ObiSDK.q)) {
|
|
144
|
+
const queueLength = w.ObiSDK.q.length;
|
|
145
|
+
trackEvent("queue_processing", { queueLength }, "init");
|
|
146
|
+
(w.ObiSDK.q || []).forEach((args) => {
|
|
147
|
+
w.ObiSDK(...args);
|
|
98
148
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}, "mountSDK", "init");
|
|
104
|
-
const mountWidget = withSentryAsyncHandler(async function() {
|
|
105
|
-
return retryOperation(async () => {
|
|
106
|
-
if (document.querySelector("obi-widget")) {
|
|
107
|
-
trackEvent("widget_already_exists", {}, "init");
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
if (!document.body) {
|
|
111
|
-
throw new Error("document.body not available");
|
|
112
|
-
}
|
|
113
|
-
const widget = document.createElement("obi-widget");
|
|
114
|
-
document.body.appendChild(widget);
|
|
115
|
-
console.log("[obi-sdk] widget mounted");
|
|
116
|
-
trackEvent("widget_mounted", {}, "init");
|
|
117
|
-
}, "widget mounting");
|
|
118
|
-
}, "mountWidget", "init");
|
|
119
|
-
const processQueue = withSentryHandler(function() {
|
|
120
|
-
const w = window;
|
|
121
|
-
if (w.ObiSDK && Array.isArray(w.ObiSDK.q)) {
|
|
122
|
-
const queueLength = w.ObiSDK.q.length;
|
|
123
|
-
trackEvent("queue_processing", { queueLength }, "init");
|
|
124
|
-
(w.ObiSDK.q || []).forEach((args) => {
|
|
125
|
-
w.ObiSDK(...args);
|
|
126
|
-
});
|
|
127
|
-
w.ObiSDK.q = [];
|
|
128
|
-
if (queueLength > 0) {
|
|
129
|
-
trackEvent("queue_processed", { queueLength }, "init");
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}, "processQueue", "init");
|
|
133
|
-
const loadFonts = withSentryAsyncHandler(async function() {
|
|
134
|
-
await loadFont("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Syne:wght@400..800&display=swap");
|
|
135
|
-
await loadFont("https://fonts.cdnfonts.com/css/satoshi");
|
|
136
|
-
}, "loadFonts", "init");
|
|
137
|
-
const loadFont = withSentryAsyncHandler(async function(fontUrl) {
|
|
138
|
-
return retryOperation(async () => {
|
|
139
|
-
if (!document.head) {
|
|
140
|
-
throw new Error("document.head not available");
|
|
149
|
+
w.ObiSDK.q = [];
|
|
150
|
+
if (queueLength > 0) {
|
|
151
|
+
trackEvent("queue_processed", { queueLength }, "init");
|
|
152
|
+
}
|
|
141
153
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
document.addEventListener("DOMContentLoaded", async () => {
|
|
162
|
-
try {
|
|
163
|
-
await safeInitialize();
|
|
164
|
-
} catch (error) {
|
|
165
|
-
captureException(error, { componentName: "init", handlerName: "DOMContentLoaded" });
|
|
166
|
-
console.error("[obi-sdk] initialization failed:", error);
|
|
154
|
+
},
|
|
155
|
+
"processQueue",
|
|
156
|
+
"init"
|
|
157
|
+
);
|
|
158
|
+
const loadFonts = withSentryAsyncHandler(
|
|
159
|
+
async function() {
|
|
160
|
+
await loadFont("https://fonts.cdnfonts.com/css/satoshi");
|
|
161
|
+
await loadFont(
|
|
162
|
+
"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
"loadFonts",
|
|
166
|
+
"init"
|
|
167
|
+
);
|
|
168
|
+
const loadFont = withSentryAsyncHandler(
|
|
169
|
+
async function(fontUrl) {
|
|
170
|
+
return retryOperation(async () => {
|
|
171
|
+
if (!document.head) {
|
|
172
|
+
throw new Error("document.head not available");
|
|
167
173
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}, "
|
|
174
|
+
const link = document.createElement("link");
|
|
175
|
+
link.href = fontUrl;
|
|
176
|
+
link.rel = "stylesheet";
|
|
177
|
+
document.head.appendChild(link);
|
|
178
|
+
trackEvent("font_loaded", { fontUrl }, "init");
|
|
179
|
+
}, "font loading");
|
|
180
|
+
},
|
|
181
|
+
"loadFont",
|
|
182
|
+
"init"
|
|
183
|
+
);
|
|
184
|
+
const safeInitialize = withSentryAsyncHandler(
|
|
185
|
+
async function() {
|
|
186
|
+
trackEvent("SDK_initialization_started", {}, "init");
|
|
187
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
188
|
+
mountSDK();
|
|
189
|
+
await loadFonts();
|
|
190
|
+
await mountWidget();
|
|
191
|
+
processQueue();
|
|
192
|
+
trackEvent("SDK_initialization_completed", {}, "init");
|
|
193
|
+
},
|
|
194
|
+
"safeInitialize",
|
|
195
|
+
"init"
|
|
196
|
+
);
|
|
197
|
+
const initializeObiWidget = withSentryAsyncHandler(
|
|
198
|
+
async function() {
|
|
199
|
+
if (document.readyState === "loading") {
|
|
200
|
+
trackEvent("DOM_not_ready", {}, "init");
|
|
201
|
+
document.addEventListener("DOMContentLoaded", async () => {
|
|
202
|
+
try {
|
|
203
|
+
await safeInitialize();
|
|
204
|
+
} catch (error) {
|
|
205
|
+
captureException(error, { componentName: "init", handlerName: "DOMContentLoaded" });
|
|
206
|
+
console.error("[obi-sdk] initialization failed:", error);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
} else {
|
|
210
|
+
trackEvent("DOM_ready", {}, "init");
|
|
211
|
+
await safeInitialize();
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"initializeObiWidget",
|
|
215
|
+
"init"
|
|
216
|
+
);
|
|
174
217
|
try {
|
|
175
218
|
setGlobalContext({ componentName: "init" });
|
|
176
219
|
trackEvent("SDK_script_loaded", {}, "init");
|
|
177
|
-
initializeObiWidget()
|
|
220
|
+
initializeObiWidget().catch((error) => {
|
|
221
|
+
captureException(error, { componentName: "init", handlerName: "initializeObiWidget" });
|
|
222
|
+
console.error("[obi-sdk] initialization failed:", error);
|
|
223
|
+
});
|
|
178
224
|
} catch (error) {
|
|
179
225
|
captureException(error, { componentName: "init", handlerName: "top-level" });
|
|
180
226
|
console.error("[obi-sdk] initialization failed:", error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/core/init.ts"],"sourcesContent":["import { ObiWidget } from \"../ui/components/obi-widget\"\nimport { \n captureException, \n setGlobalContext, \n trackEvent, \n withSentryAsyncHandler,\n withSentryHandler \n} from \"../sentry\"\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\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(`[obi-sdk] ${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`, error)\n \n trackEvent(`${operationName}_failed`, {\n error: error instanceof Error ? error.message : String(error),\n attempt: attempt + 1,\n maxAttempts\n }, 'init');\n\n if (attempt < maxAttempts - 1) {\n const delayMs = getRetryDelay(attempt)\n await delay(delayMs)\n }\n }\n }\n\n const finalError = new Error(`${operationName} failed after ${maxAttempts} attempts: ${lastError?.message}`)\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(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 // 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\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 w.obiWidgetConfig = {\n ...w.obiWidgetConfig,\n ...config,\n }\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('SDK_config_updated', { \n hasUser: !!config.user,\n configKeys: Object.keys(config) \n }, 'init');\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}, 'mountSDK', 'init');\n\nconst mountWidget = withSentryAsyncHandler(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}, 'mountWidget', 'init');\n\n// Optionally process a queue if you want to support it\nconst processQueue = withSentryHandler(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 \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}, 'processQueue', 'init');\n\nconst loadFonts = withSentryAsyncHandler(async function() {\n await loadFont(\"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Syne:wght@400..800&display=swap\")\n await loadFont(\"https://fonts.cdnfonts.com/css/satoshi\")\n}, 'loadFonts', 'init');\n\nconst loadFont = withSentryAsyncHandler(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}, 'loadFont', 'init');\n\nconst safeInitialize = withSentryAsyncHandler(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}, 'safeInitialize', 'init');\n\nexport const initializeObiWidget = withSentryAsyncHandler(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}, 'initializeObiWidget', 'init');\n\ntry {\n // Set initial context\n setGlobalContext({ componentName: 'init' });\n trackEvent('SDK_script_loaded', {}, 'init');\n \n initializeObiWidget()\n} catch (error) {\n captureException(error, { componentName: 'init', handlerName: 'top-level' })\n console.error(\"[obi-sdk] initialization failed:\", error)\n}\n"],"names":[],"mappings":"AASA,SAAA,KAAA,WAAA,KAAA,kBAAA,KAAA,YAAA,KAAA,kBAAA,KAAA,wBAAA,KAAA,yBAAA;AAAA,OAAA;AAAA,IAAI,CAAC,eAAe,IAAI,YAAY,GAAG;AACtB,iBAAA,OAAO,cAAc,SAAS;AAC/C;AAGA,MAAM,eAAe;AAAA,EACnB,aAAa;AAAA,EACb,WAAW;AAAA;AAAA,EACX,UAAU;AAAA;AACZ;AAEA,SAAS,MAAM,IAA2B;AACxC,SAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AACzD;AAEA,SAAS,cAAc,SAAyB;AAC9C,QAAM,mBAAmB,aAAa,YAAY,KAAK,IAAI,GAAG,OAAO;AACrE,SAAO,KAAK,IAAI,kBAAkB,aAAa,QAAQ;AACzD;AAEA,eAAe,eACb,WACA,eACA,cAAsB,aAAa,aACvB;AACZ,MAAI,YAA0B;AAE9B,WAAS,UAAU,GAAG,UAAU,aAAa,WAAW;AAClD,QAAA;AACS,iBAAA,GAAG,aAAa,YAAY,EAAE,SAAS,UAAU,KAAK,MAAM;AACvE,aAAO,MAAM,UAAU;AAAA,aAChB,OAAO;AACF,kBAAA;AACJ,cAAA,KAAK,aAAa,aAAa,oBAAoB,UAAU,CAAC,IAAI,WAAW,MAAM,KAAK;AAErF,iBAAA,GAAG,aAAa,WAAW;AAAA,QACpC,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,QAC5D,SAAS,UAAU;AAAA,QACnB;AAAA,SACC,MAAM;AAEL,UAAA,UAAU,cAAc,GAAG;AACvB,cAAA,UAAU,cAAc,OAAO;AACrC,cAAM,MAAM,OAAO;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAEM,QAAA,aAAa,IAAI,MAAM,GAAG,aAAa,iBAAiB,WAAW,cAAc,WAAW,OAA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;AAAA,IAC/C;AAEM,UAAA,OAAO,SAAS,cAAc,MAAM;AAC1C,SAAK,OAAO;AACZ,SAAK,MAAM;AAEF,aAAA,KAAK,YAAY,IAAI;AAC9B,eAAW,eAAe,EAAE,QAAQ,GAAG,MAAM;AAAA,KAC5C,cAAc;AACnB,GAAG,YAAY,MAAM;AAErB,MAAM,iBAAiB,uBAAuB,iBAAgC;AAEjE,aAAA,8BAA8B,IAAI,MAAM;AAGnD,QAAM,IAAI,QAAQ,CAAA,YAAW,WAAW,SAAS,GAAG,CAAC;AAE5C;AACT,QAAM,UAAU;AAChB,QAAM,YAAY;AACL;AAEF,aAAA,gCAAgC,IAAI,MAAM;AACvD,GAAG,kBAAkB,MAAM;AAEd,MAAA,sBAAsB,uBAAuB,iBAAiB;AACrE,MAAA,SAAS,eAAe,WAAW;AAC1B,eAAA,iBAAiB,IAAI,MAAM;AAC7B,aAAA,iBAAiB,oBAAoB,YAAY;AACpD,UAAA;AACF,cAAM,eAAe;AAAA,eACd,OAAO;AACd,yBAAiB,OAAO,EAAE,eAAe,QAAQ,aAAa,oBAAoB;AAC1E,gBAAA,MAAM,oCAAoC,KAAK;AAAA,MACzD;AAAA,IAAA,CACD;AAAA,EAAA,OACI;AACM,eAAA,aAAa,IAAI,MAAM;AAClC,UAAM,eAAe;AAAA,EACvB;AACF,GAAG,uBAAuB,MAAM;AAEhC,IAAI;AAEe,mBAAA,EAAE,eAAe,OAAA,CAAQ;AAC/B,aAAA,qBAAqB,IAAI,MAAM;AAEtB;AACtB,SAAS,OAAO;AACd,mBAAiB,OAAO,EAAE,eAAe,QAAQ,aAAa,aAAa;AACnE,UAAA,MAAM,oCAAoC,KAAK;AACzD;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/core/init.ts"],"sourcesContent":["import {\n captureException,\n setGlobalContext,\n trackEvent,\n withSentryAsyncHandler,\n withSentryHandler,\n} from \"../sentry\"\nimport { ObiWidget } from \"../ui/components/obi-widget\"\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\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 // 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\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 w.obiWidgetConfig = {\n ...w.obiWidgetConfig,\n ...config,\n }\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 \"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":"AASA,SAAA,KAAA,WAAA,KAAA,kBAAA,KAAA,YAAA,KAAA,kBAAA,KAAA,wBAAA,KAAA,yBAAA;AAAA,OAAA;AAAA,IAAI,CAAC,eAAe,IAAI,YAAY,GAAG;AACtB,iBAAA,OAAO,cAAc,SAAS;AAC/C;AAGA,MAAM,eAAe;AAAA,EACnB,aAAa;AAAA,EACb,WAAW;AAAA;AAAA,EACX,UAAU;AAAA;AACZ;AAEA,SAAS,MAAM,IAA2B;AACxC,SAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AACzD;AAEA,SAAS,cAAc,SAAyB;AAC9C,QAAM,mBAAmB,aAAa,YAAY,KAAK,IAAI,GAAG,OAAO;AACrE,SAAO,KAAK,IAAI,kBAAkB,aAAa,QAAQ;AACzD;AAEA,eAAe,eACb,WACA,eACA,cAAsB,aAAa,aACvB;AACZ,MAAI,YAA0B;AAE9B,WAAS,UAAU,GAAG,UAAU,aAAa,WAAW;AAClD,QAAA;AACS,iBAAA,GAAG,aAAa,YAAY,EAAE,SAAS,UAAU,KAAK,MAAM;AACvE,aAAO,MAAM,UAAU;AAAA,aAChB,OAAO;AACF,kBAAA;AACJ,cAAA;AAAA,QACN,aAAa,aAAa,oBAAoB,UAAU,CAAC,IAAI,WAAW;AAAA,QACxE;AAAA,MAAA;AAGF;AAAA,QACE,GAAG,aAAa;AAAA,QAChB;AAAA,UACE,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,UAC5D,SAA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F;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAI;AAEe,mBAAA,EAAE,eAAe,OAAA,CAAQ;AAC/B,aAAA,qBAAqB,IAAI,MAAM;AAEtB,sBAAA,EAAE,MAAM,CAAC,UAAU;AAGrC,qBAAiB,OAAO,EAAE,eAAe,QAAQ,aAAa,uBAAuB;AAC7E,YAAA,MAAM,oCAAoC,KAAK;AAAA,EAAA,CACxD;AACH,SAAS,OAAO;AACd,mBAAiB,OAAO,EAAE,eAAe,QAAQ,aAAa,aAAa;AACnE,UAAA,MAAM,oCAAoC,KAAK;AACzD;"}
|
package/dist/modular/ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SDKState } from "./chunks/types-e0297e7b.js";
|
|
2
|
-
import { i, n, b as i$1, x } from "./chunks/obi-widget-
|
|
3
|
-
import { A, C, e, f, D, N, d, O, S } from "./chunks/obi-widget-
|
|
2
|
+
import { i, n, b as i$1, x } from "./chunks/obi-widget-46e82ee8.js";
|
|
3
|
+
import { A, C, e, f, D, N, d, O, S } from "./chunks/obi-widget-46e82ee8.js";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -85,14 +85,14 @@ if (!customElements.get("obi-status-widget")) {
|
|
|
85
85
|
const statusWidget = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, ObiStatusWidget }, Symbol.toStringTag, { value: "Module" }));
|
|
86
86
|
function defineCustomElements() {
|
|
87
87
|
Promise.resolve().then(() => statusWidget);
|
|
88
|
-
import("./chunks/index-
|
|
89
|
-
import("./chunks/obi-widget-
|
|
90
|
-
import("./chunks/obi-widget-
|
|
91
|
-
import("./chunks/obi-widget-
|
|
92
|
-
import("./chunks/obi-widget-
|
|
93
|
-
import("./chunks/obi-widget-
|
|
94
|
-
import("./chunks/obi-widget-
|
|
95
|
-
import("./chunks/obi-widget-
|
|
88
|
+
import("./chunks/index-fa4a7611.js");
|
|
89
|
+
import("./chunks/obi-widget-46e82ee8.js").then((n2) => n2.l);
|
|
90
|
+
import("./chunks/obi-widget-46e82ee8.js").then((n2) => n2.m);
|
|
91
|
+
import("./chunks/obi-widget-46e82ee8.js").then((n2) => n2.g);
|
|
92
|
+
import("./chunks/obi-widget-46e82ee8.js").then((n2) => n2.h);
|
|
93
|
+
import("./chunks/obi-widget-46e82ee8.js").then((n2) => n2.o);
|
|
94
|
+
import("./chunks/obi-widget-46e82ee8.js").then((n2) => n2.j);
|
|
95
|
+
import("./chunks/obi-widget-46e82ee8.js").then((n2) => n2.k);
|
|
96
96
|
}
|
|
97
97
|
export {
|
|
98
98
|
A as AudioEqualizer,
|