@melio-eng/web-sdk 1.0.38-pr.80.dd7f025 → 1.0.38-pr.82.61e3fb4
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/flows/Flow.d.ts +3 -1
- package/dist/flows/Flow.js +7 -1
- package/dist/types.d.ts +7 -3
- package/package.json +1 -1
package/dist/flows/Flow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FlowInstance, FlowEventType, FlowEventCallback, FlowCompletionData, NavigationData, BaseFlowConfig, Environment, ErrorData } from '../types.js';
|
|
1
|
+
import { FlowInstance, FlowEventType, FlowEventCallback, FlowCompletionData, NavigationData, BaseFlowConfig, Environment, ErrorData, AnalyticsEventData } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Flow class implementation for handling iframe flows and events
|
|
4
4
|
*/
|
|
@@ -39,6 +39,7 @@ export declare class Flow implements FlowInstance {
|
|
|
39
39
|
protected emit(event: 'error', data: ErrorData): void;
|
|
40
40
|
protected emit(event: 'onboardingCompleted'): void;
|
|
41
41
|
protected emit(event: 'onboardingRequired'): void;
|
|
42
|
+
protected emit(event: 'analytics', data: AnalyticsEventData): void;
|
|
42
43
|
/**
|
|
43
44
|
* Register an event listener
|
|
44
45
|
*/
|
|
@@ -51,6 +52,7 @@ export declare class Flow implements FlowInstance {
|
|
|
51
52
|
on(event: 'loaded', callback: () => void): void;
|
|
52
53
|
on(event: 'onboardingCompleted', callback: () => void): void;
|
|
53
54
|
on(event: 'onboardingRequired', callback: () => void): void;
|
|
55
|
+
on(event: 'analytics', callback: (data: AnalyticsEventData) => void): void;
|
|
54
56
|
/**
|
|
55
57
|
* Remove an event listener
|
|
56
58
|
*/
|
package/dist/flows/Flow.js
CHANGED
|
@@ -94,7 +94,7 @@ export class Flow {
|
|
|
94
94
|
break;
|
|
95
95
|
case 'MELIO_ERROR':
|
|
96
96
|
if (data.code === 'failed_to_sync_bills') {
|
|
97
|
-
this.emit('error', { errorCode: 'billsSyncFailed'
|
|
97
|
+
this.emit('error', { errorCode: 'billsSyncFailed' });
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
100
|
case 'HEIGHT_CHANGE':
|
|
@@ -102,6 +102,12 @@ export class Flow {
|
|
|
102
102
|
this.iframe.style.height = `${data.height}px`;
|
|
103
103
|
}
|
|
104
104
|
break;
|
|
105
|
+
case 'ANALYTICS_EVENT':
|
|
106
|
+
this.emit('analytics', {
|
|
107
|
+
eventName: data.eventName,
|
|
108
|
+
properties: data.properties,
|
|
109
|
+
});
|
|
110
|
+
break;
|
|
105
111
|
}
|
|
106
112
|
};
|
|
107
113
|
window.addEventListener('message', this.messageHandler);
|
package/dist/types.d.ts
CHANGED
|
@@ -117,16 +117,19 @@ export interface FlowCompletionData {
|
|
|
117
117
|
*/
|
|
118
118
|
export interface ErrorData {
|
|
119
119
|
errorCode: 'billsSyncFailed';
|
|
120
|
-
|
|
120
|
+
}
|
|
121
|
+
export interface AnalyticsEventData {
|
|
122
|
+
eventName: string;
|
|
123
|
+
properties: Record<string, unknown>;
|
|
121
124
|
}
|
|
122
125
|
/**
|
|
123
126
|
* Event types that can be listened to
|
|
124
127
|
*/
|
|
125
|
-
export type FlowEventType = 'completed' | 'exit' | 'navigated' | 'authenticationSucceeded' | 'authenticationFailed' | 'error' | 'loaded' | 'onboardingCompleted' | 'onboardingRequired';
|
|
128
|
+
export type FlowEventType = 'completed' | 'exit' | 'navigated' | 'authenticationSucceeded' | 'authenticationFailed' | 'error' | 'loaded' | 'onboardingCompleted' | 'onboardingRequired' | 'analytics';
|
|
126
129
|
/**
|
|
127
130
|
* Event callback function types
|
|
128
131
|
*/
|
|
129
|
-
export type FlowEventCallback = ((data: FlowCompletionData | NavigationData | ErrorData) => void) | (() => void);
|
|
132
|
+
export type FlowEventCallback = ((data: FlowCompletionData | NavigationData | ErrorData | AnalyticsEventData) => void) | (() => void);
|
|
130
133
|
/**
|
|
131
134
|
* Flow instance interface for event handling
|
|
132
135
|
*/
|
|
@@ -145,6 +148,7 @@ export interface FlowInstance {
|
|
|
145
148
|
on(event: 'loaded', callback: () => void): void;
|
|
146
149
|
on(event: 'onboardingCompleted', callback: () => void): void;
|
|
147
150
|
on(event: 'onboardingRequired', callback: () => void): void;
|
|
151
|
+
on(event: 'analytics', callback: (data: AnalyticsEventData) => void): void;
|
|
148
152
|
/**
|
|
149
153
|
* Remove an event listener for this flow
|
|
150
154
|
* @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.38-pr.
|
|
3
|
+
"version": "1.0.38-pr.82.61e3fb4",
|
|
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",
|