@superleapai/flow-ui 2.5.13 → 2.5.14
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/core/bridge.js +24 -55
- package/core/crm.js +32 -27
- package/dist/superleap-flow.js +271 -2227
- package/dist/superleap-flow.js.map +1 -1
- package/dist/superleap-flow.min.js +2 -2
- package/index.js +43 -24
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -237,27 +237,10 @@
|
|
|
237
237
|
// Execute immediately (synchronously)
|
|
238
238
|
captureComponents();
|
|
239
239
|
|
|
240
|
-
//
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (client && typeof client.init === "function") {
|
|
245
|
-
// Check if we're NOT in an iframe context (standalone usage)
|
|
246
|
-
const isStandalone = window === window.parent;
|
|
247
|
-
if (isStandalone && !client.isAvailable()) {
|
|
248
|
-
// Auto-init with default config for standalone testing
|
|
249
|
-
client.init(client.getDefaultConfig());
|
|
250
|
-
console.log(
|
|
251
|
-
"[Superleap-Flow] SDK auto-initialized for standalone mode"
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Dispatch custom event when library is ready
|
|
257
|
-
if (typeof CustomEvent !== "undefined" && typeof document !== "undefined") {
|
|
258
|
-
// Function to dispatch the ready event
|
|
259
|
-
function dispatchReady() {
|
|
260
|
-
const event = new CustomEvent("superleap-flow:ready", {
|
|
240
|
+
// Function to dispatch the ready event
|
|
241
|
+
function dispatchReady() {
|
|
242
|
+
if (typeof CustomEvent !== "undefined" && typeof document !== "undefined") {
|
|
243
|
+
var event = new CustomEvent("superleap-flow:ready", {
|
|
261
244
|
detail: {
|
|
262
245
|
FlowUI: window.FlowUI,
|
|
263
246
|
SuperLeap: window.SuperLeap,
|
|
@@ -267,13 +250,49 @@
|
|
|
267
250
|
document.dispatchEvent(event);
|
|
268
251
|
console.log("[Superleap-Flow] Library ready - v__VERSION__");
|
|
269
252
|
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Check if we're in an iframe context with a bridgeId
|
|
256
|
+
var isInIframe = window !== window.parent;
|
|
257
|
+
var urlParams = new URLSearchParams(window.location.search);
|
|
258
|
+
var bridgeId = urlParams.get("_bridgeId");
|
|
259
|
+
|
|
260
|
+
if (isInIframe && bridgeId && window.SuperLeap && window.SuperLeap.connect) {
|
|
261
|
+
// Auto-connect to CRM — defer ready event until connected
|
|
262
|
+
function doAutoConnect() {
|
|
263
|
+
window.SuperLeap.connect({ bridgeId: bridgeId })
|
|
264
|
+
.then(function () {
|
|
265
|
+
dispatchReady();
|
|
266
|
+
})
|
|
267
|
+
.catch(function (err) {
|
|
268
|
+
console.error("[Superleap-Flow] Auto-connect failed:", err);
|
|
269
|
+
// Still dispatch ready so user code can handle the error
|
|
270
|
+
dispatchReady();
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Wait for DOM to be ready before auto-connecting
|
|
275
|
+
if (document.readyState === "loading") {
|
|
276
|
+
document.addEventListener("DOMContentLoaded", doAutoConnect);
|
|
277
|
+
} else {
|
|
278
|
+
setTimeout(doAutoConnect, 0);
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
// Standalone mode — auto-init SDK with defaults
|
|
282
|
+
var client = _components["superleapClient"];
|
|
283
|
+
if (client && typeof client.init === "function" && !isInIframe) {
|
|
284
|
+
if (!client.isAvailable()) {
|
|
285
|
+
client.init(client.getDefaultConfig());
|
|
286
|
+
console.log(
|
|
287
|
+
"[Superleap-Flow] SDK auto-initialized for standalone mode"
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
270
291
|
|
|
271
|
-
//
|
|
292
|
+
// Dispatch ready immediately (no connection needed)
|
|
272
293
|
if (document.readyState === "loading") {
|
|
273
|
-
// DOM is still loading, wait for DOMContentLoaded
|
|
274
294
|
document.addEventListener("DOMContentLoaded", dispatchReady);
|
|
275
295
|
} else {
|
|
276
|
-
// DOM is already ready, dispatch immediately (but async)
|
|
277
296
|
setTimeout(dispatchReady, 0);
|
|
278
297
|
}
|
|
279
298
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superleapai/flow-ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.14",
|
|
4
4
|
"description": "A reusable design system for building multi-step forms with comprehensive UI components. Single file, clean globals, SDK included. Only FlowUI and SuperLeap exposed.",
|
|
5
5
|
"main": "dist/superleap-flow.min.js",
|
|
6
6
|
"types": "index.d.ts",
|