@melio-eng/web-sdk 1.0.11-pr.25.a8ef2bb → 1.0.11-pr.27.338e358
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/index.js +9 -0
- package/dist/types.d.ts +6 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -100,6 +100,15 @@ class Flow {
|
|
|
100
100
|
case 'FLOW_NAVIGATED':
|
|
101
101
|
this.emit('navigated', data);
|
|
102
102
|
break;
|
|
103
|
+
case 'AUTHENTICATION_SUCCESS':
|
|
104
|
+
this.emit('authenticationSucceeded');
|
|
105
|
+
break;
|
|
106
|
+
case 'AUTHENTICATION_FAILED':
|
|
107
|
+
this.emit('authenticationFailed');
|
|
108
|
+
break;
|
|
109
|
+
case 'ONBOARDING_COMPLETED':
|
|
110
|
+
this.emit('completed', { flowName: 'onboarding', ...data });
|
|
111
|
+
break;
|
|
103
112
|
case 'HEIGHT_CHANGE':
|
|
104
113
|
if (this.iframe) {
|
|
105
114
|
this.iframe.style.height = `${data.height}px`;
|
package/dist/types.d.ts
CHANGED
|
@@ -54,9 +54,9 @@ export interface SettingsConfig extends BaseFlowConfig {
|
|
|
54
54
|
export interface PaymentsDashboardConfig extends BaseFlowConfig {
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Event
|
|
57
|
+
* Event data for navigation events
|
|
58
58
|
*/
|
|
59
|
-
export interface
|
|
59
|
+
export interface NavigationData {
|
|
60
60
|
/** The target route or page the user navigated to */
|
|
61
61
|
target: string;
|
|
62
62
|
}
|
|
@@ -65,16 +65,17 @@ export interface NavigationPayload {
|
|
|
65
65
|
*/
|
|
66
66
|
export interface FlowCompletionData {
|
|
67
67
|
/** Any data returned from the completed flow */
|
|
68
|
+
flowName: 'onboarding' | 'payment';
|
|
68
69
|
[key: string]: any;
|
|
69
70
|
}
|
|
70
71
|
/**
|
|
71
72
|
* Event types that can be listened to
|
|
72
73
|
*/
|
|
73
|
-
export type FlowEventType = 'completed' | 'exit' | 'navigated';
|
|
74
|
+
export type FlowEventType = 'completed' | 'exit' | 'navigated' | 'authenticationSucceeded' | 'authenticationFailed';
|
|
74
75
|
/**
|
|
75
76
|
* Event callback function types
|
|
76
77
|
*/
|
|
77
|
-
export type FlowEventCallback = ((data: FlowCompletionData
|
|
78
|
+
export type FlowEventCallback = ((data: FlowCompletionData | NavigationData) => void) | (() => void);
|
|
78
79
|
/**
|
|
79
80
|
* Flow instance interface for event handling
|
|
80
81
|
*/
|
|
@@ -86,7 +87,7 @@ export interface FlowInstance {
|
|
|
86
87
|
*/
|
|
87
88
|
on(event: 'completed', callback: (data: FlowCompletionData) => void): void;
|
|
88
89
|
on(event: 'exit', callback: () => void): void;
|
|
89
|
-
on(event: 'navigated', callback: (payload:
|
|
90
|
+
on(event: 'navigated', callback: (payload: NavigationData) => void): void;
|
|
90
91
|
/**
|
|
91
92
|
* Remove an event listener for this flow
|
|
92
93
|
* @param event - The event type to remove listener for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@melio-eng/web-sdk",
|
|
3
|
-
"version": "1.0.11-pr.
|
|
3
|
+
"version": "1.0.11-pr.27.338e358",
|
|
4
4
|
"description": "Melio Web SDK - Embed core Melio workflows directly into partner UI with minimal effort",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|