@superleapai/flow-ui 2.6.21 → 2.6.23
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/CHANGELOG.md +2 -2
- package/LICENSE +1 -1
- package/README.md +38 -38
- package/components/enum-multiselect.js +2 -2
- package/components/enum-select.js +2 -2
- package/components/file-input.js +1 -1
- package/components/record-multiselect.js +82 -10
- package/components/record-select.js +85 -10
- package/core/bridge.js +4 -4
- package/core/crm.js +9 -9
- package/core/flow.js +36 -11
- package/core/superleapClient.js +3 -3
- package/dist/superleap-flow.js +19921 -0
- package/dist/superleap-flow.js.map +1 -0
- package/dist/superleap-flow.min.js +2 -2
- package/index.d.ts +10 -9
- package/index.js +32 -32
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -29,13 +29,13 @@ declare module "@superleapai/flow-ui" {
|
|
|
29
29
|
// CRM BRIDGE TYPES
|
|
30
30
|
// ============================================================================
|
|
31
31
|
|
|
32
|
-
/** Configuration passed to
|
|
32
|
+
/** Configuration passed to SuperLeap.connect() */
|
|
33
33
|
export interface ConnectOptions {
|
|
34
34
|
/** Unique identifier for this flow/form (must match CRM-side registration) */
|
|
35
35
|
flowId: string;
|
|
36
36
|
/** Expected CRM origin for validation (e.g., "https://app.superleap.com"). Optional for RN. */
|
|
37
37
|
crmOrigin?: string;
|
|
38
|
-
/** Whether to auto-call
|
|
38
|
+
/** Whether to auto-call SuperLeap.init() with the SDK config from the CRM. Default: true */
|
|
39
39
|
autoInit?: boolean;
|
|
40
40
|
/** Handshake timeout in milliseconds. Default: 5000 */
|
|
41
41
|
timeout?: number;
|
|
@@ -61,13 +61,13 @@ declare module "@superleapai/flow-ui" {
|
|
|
61
61
|
|
|
62
62
|
/** Configuration received from the CRM */
|
|
63
63
|
export interface CRMConfig {
|
|
64
|
-
/** SDK configuration for
|
|
64
|
+
/** SDK configuration for SuperLeap.init() */
|
|
65
65
|
sdkConfig?: SuperLeapConfig;
|
|
66
66
|
/** Any additional configuration */
|
|
67
67
|
[key: string]: any;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/** Result of a successful
|
|
70
|
+
/** Result of a successful SuperLeap.connect() call */
|
|
71
71
|
export interface ConnectResult {
|
|
72
72
|
/** Context data from the CRM */
|
|
73
73
|
context: CRMContext;
|
|
@@ -75,10 +75,10 @@ declare module "@superleapai/flow-ui" {
|
|
|
75
75
|
config: CRMConfig;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
/** Unsubscribe function returned by
|
|
78
|
+
/** Unsubscribe function returned by SuperLeap.on() */
|
|
79
79
|
export type EventUnsubscribe = () => void;
|
|
80
80
|
|
|
81
|
-
export interface
|
|
81
|
+
export interface SuperLeap {
|
|
82
82
|
// SDK Methods (from superleapClient.js)
|
|
83
83
|
init(config?: SuperLeapConfig): void;
|
|
84
84
|
getSdk(): any;
|
|
@@ -166,7 +166,7 @@ declare module "@superleapai/flow-ui" {
|
|
|
166
166
|
off(event: string, callback: (payload: any) => void): void;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
export const
|
|
169
|
+
export const SuperLeap: SuperLeap;
|
|
170
170
|
|
|
171
171
|
// ============================================================================
|
|
172
172
|
// STATE MANAGEMENT
|
|
@@ -334,6 +334,7 @@ declare module "@superleapai/flow-ui" {
|
|
|
334
334
|
variant?: "default" | "error" | "warning" | "borderless" | "inline";
|
|
335
335
|
size?: "default" | "large" | "small";
|
|
336
336
|
canClear?: boolean;
|
|
337
|
+
showDisplayFields?: boolean;
|
|
337
338
|
initialLimit?: number;
|
|
338
339
|
helpText?: string;
|
|
339
340
|
}
|
|
@@ -349,8 +350,8 @@ declare module "@superleapai/flow-ui" {
|
|
|
349
350
|
disabled?: boolean;
|
|
350
351
|
variant?: "default" | "error" | "warning" | "borderless" | "inline";
|
|
351
352
|
size?: "default" | "large" | "small";
|
|
353
|
+
showDisplayFields?: boolean;
|
|
352
354
|
initialLimit?: number;
|
|
353
|
-
displayFields?: string[];
|
|
354
355
|
helpText?: string;
|
|
355
356
|
}
|
|
356
357
|
|
|
@@ -687,6 +688,6 @@ declare module "@superleapai/flow-ui" {
|
|
|
687
688
|
declare global {
|
|
688
689
|
interface Window {
|
|
689
690
|
FlowUI: FlowUI;
|
|
690
|
-
|
|
691
|
+
SuperLeap: SuperLeap;
|
|
691
692
|
}
|
|
692
693
|
}
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* SuperLeap-Flow Library Entry Point
|
|
3
3
|
* @superleapai/flow-ui
|
|
4
4
|
*
|
|
5
|
-
* Single-file bundle that includes
|
|
6
|
-
* Only FlowUI and
|
|
5
|
+
* Single-file bundle that includes SuperLeap SDK and all components.
|
|
6
|
+
* Only FlowUI and SuperLeap are exposed to global scope.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
9
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* <script src="path/to/superleap-flow/index.js"></script>
|
|
12
12
|
* <script>
|
|
13
13
|
* // Connect to CRM (inside an iframe)
|
|
14
|
-
* const { context, config } = await
|
|
14
|
+
* const { context, config } = await SuperLeap.connect({
|
|
15
15
|
* flowId: 'my-flow'
|
|
16
16
|
* });
|
|
17
17
|
* // SDK is auto-initialized, context has orgId/userId/etc.
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
* FlowUI.initState({ name: '' });
|
|
21
21
|
*
|
|
22
22
|
* // CRM actions
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* SuperLeap.toast('Saved!', 'success');
|
|
24
|
+
* SuperLeap.closeForm();
|
|
25
25
|
* </script>
|
|
26
26
|
*
|
|
27
27
|
* ES Module:
|
|
28
|
-
* import { FlowUI,
|
|
28
|
+
* import { FlowUI, SuperLeap } from '@superleapai/flow-ui';
|
|
29
29
|
*
|
|
30
30
|
* CommonJS:
|
|
31
|
-
* const { FlowUI,
|
|
31
|
+
* const { FlowUI, SuperLeap } = require('@superleapai/flow-ui');
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
(function (global) {
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
|
|
42
42
|
// In Node.js/CommonJS environment, load all modules
|
|
43
43
|
if (isNode && !isBrowser) {
|
|
44
|
-
// Note: In Node.js,
|
|
44
|
+
// Note: In Node.js, SuperLeap SDK should be installed separately via npm
|
|
45
45
|
// npm install superleap-sdk
|
|
46
46
|
try {
|
|
47
47
|
global.createSuperLeapSDK = require("superleap-sdk");
|
|
48
48
|
} catch (e) {
|
|
49
49
|
console.warn(
|
|
50
|
-
"[
|
|
50
|
+
"[SuperLeap-Flow] SuperLeap SDK not found. Install with: npm install superleap-sdk",
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
require("./components/tabs.js");
|
|
98
98
|
require("./components/steps.js");
|
|
99
99
|
|
|
100
|
-
// Export FlowUI and
|
|
100
|
+
// Export FlowUI and SuperLeap from global scope
|
|
101
101
|
if (typeof global !== "undefined" && global.FlowUI) {
|
|
102
|
-
// Create
|
|
103
|
-
const
|
|
102
|
+
// Create SuperLeap export
|
|
103
|
+
const SuperLeap = global.superleapClient
|
|
104
104
|
? {
|
|
105
105
|
init: global.superleapClient.init,
|
|
106
106
|
getSdk: global.superleapClient.getSdk,
|
|
@@ -111,11 +111,11 @@
|
|
|
111
111
|
|
|
112
112
|
module.exports = {
|
|
113
113
|
FlowUI: global.FlowUI,
|
|
114
|
-
|
|
114
|
+
SuperLeap: SuperLeap,
|
|
115
115
|
};
|
|
116
116
|
} else if (typeof window !== "undefined" && window.FlowUI) {
|
|
117
|
-
// Create
|
|
118
|
-
const
|
|
117
|
+
// Create SuperLeap export
|
|
118
|
+
const SuperLeap = window.superleapClient
|
|
119
119
|
? {
|
|
120
120
|
init: window.superleapClient.init,
|
|
121
121
|
getSdk: window.superleapClient.getSdk,
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
|
|
127
127
|
module.exports = {
|
|
128
128
|
FlowUI: window.FlowUI,
|
|
129
|
-
|
|
129
|
+
SuperLeap: SuperLeap,
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
} else if (isBrowser) {
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
_components[name] = window[name];
|
|
183
183
|
|
|
184
184
|
// Clean up global scope - remove all component globals
|
|
185
|
-
// Only FlowUI and
|
|
185
|
+
// Only FlowUI and SuperLeap will remain
|
|
186
186
|
delete window[name];
|
|
187
187
|
}
|
|
188
188
|
});
|
|
@@ -194,11 +194,11 @@
|
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
// Expose
|
|
197
|
+
// Expose SuperLeap from captured superleapClient (must use _components - superleapClient was already deleted from window)
|
|
198
198
|
// Note: crm.js has already extended superleapClient with bridge methods (connect, toast, etc.)
|
|
199
199
|
const client = _components["superleapClient"];
|
|
200
200
|
if (client) {
|
|
201
|
-
window.
|
|
201
|
+
window.SuperLeap = {
|
|
202
202
|
// SDK methods (from superleapClient.js)
|
|
203
203
|
init: client.init.bind(client),
|
|
204
204
|
getSdk: client.getSdk.bind(client),
|
|
@@ -246,12 +246,12 @@
|
|
|
246
246
|
var event = new CustomEvent("superleap-flow:ready", {
|
|
247
247
|
detail: {
|
|
248
248
|
FlowUI: window.FlowUI,
|
|
249
|
-
|
|
249
|
+
SuperLeap: window.SuperLeap,
|
|
250
250
|
components: _components,
|
|
251
251
|
},
|
|
252
252
|
});
|
|
253
253
|
document.dispatchEvent(event);
|
|
254
|
-
console.log("[
|
|
254
|
+
console.log("[SuperLeap-Flow] Library ready - v__VERSION__");
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
@@ -263,24 +263,24 @@
|
|
|
263
263
|
if (
|
|
264
264
|
isInIframe &&
|
|
265
265
|
bridgeId &&
|
|
266
|
-
window.
|
|
267
|
-
window.
|
|
266
|
+
window.SuperLeap &&
|
|
267
|
+
window.SuperLeap.connect
|
|
268
268
|
) {
|
|
269
269
|
// Auto-connect to CRM — defer ready event until connected
|
|
270
270
|
function doAutoConnect() {
|
|
271
|
-
window.
|
|
271
|
+
window.SuperLeap.connect({ bridgeId: bridgeId })
|
|
272
272
|
.then(function () {
|
|
273
273
|
// Expose SDK as a direct global so users can write sdkInstance.getModel() directly
|
|
274
274
|
if (
|
|
275
|
-
window.
|
|
276
|
-
typeof window.
|
|
275
|
+
window.SuperLeap &&
|
|
276
|
+
typeof window.SuperLeap.getSdk === "function"
|
|
277
277
|
) {
|
|
278
|
-
window.sdkInstance = window.
|
|
278
|
+
window.sdkInstance = window.SuperLeap.getSdk();
|
|
279
279
|
}
|
|
280
280
|
dispatchReady();
|
|
281
281
|
})
|
|
282
282
|
.catch(function (err) {
|
|
283
|
-
console.error("[
|
|
283
|
+
console.error("[SuperLeap-Flow] Auto-connect failed:", err);
|
|
284
284
|
// Still dispatch ready so user code can handle the error
|
|
285
285
|
dispatchReady();
|
|
286
286
|
});
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
setTimeout(doAutoConnect, 0);
|
|
294
294
|
}
|
|
295
295
|
} else {
|
|
296
|
-
// Standalone mode — user must call
|
|
296
|
+
// Standalone mode — user must call SuperLeap.init(config) manually
|
|
297
297
|
// Dispatch ready immediately (no connection needed)
|
|
298
298
|
if (document.readyState === "loading") {
|
|
299
299
|
document.addEventListener("DOMContentLoaded", dispatchReady);
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
if (typeof window !== "undefined" && window.FlowUI) {
|
|
308
308
|
if (typeof exports !== "undefined") {
|
|
309
309
|
exports.FlowUI = window.FlowUI;
|
|
310
|
-
exports.
|
|
310
|
+
exports.SuperLeap = window.SuperLeap;
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
|
|
@@ -318,6 +318,6 @@
|
|
|
318
318
|
typeof exports !== "undefined"
|
|
319
319
|
) {
|
|
320
320
|
exports.FlowUI = global.FlowUI;
|
|
321
|
-
exports.
|
|
321
|
+
exports.SuperLeap = global.SuperLeap;
|
|
322
322
|
}
|
|
323
323
|
})(typeof window !== "undefined" ? window : this);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superleapai/flow-ui",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.23",
|
|
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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"notifications",
|
|
51
51
|
"superleap"
|
|
52
52
|
],
|
|
53
|
-
"author": "
|
|
53
|
+
"author": "SuperLeap",
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|