@melio-eng/web-sdk 1.0.7 → 1.0.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/index.d.ts +1 -5
- package/dist/index.js +4 -24
- package/dist/types.d.ts +3 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitOptions, OnboardingConfig, SinglePayFlowConfig, BatchPayConfig, SettingsConfig, FlowInstance, PaymentsDashboardConfig
|
|
1
|
+
import { InitOptions, OnboardingConfig, SinglePayFlowConfig, BatchPayConfig, SettingsConfig, FlowInstance, PaymentsDashboardConfig } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Main SDK implementation - now partner agnostic
|
|
4
4
|
*/
|
|
@@ -44,10 +44,6 @@ export declare class MelioSDK implements MelioSDK {
|
|
|
44
44
|
* Launch the payments dashboard flow
|
|
45
45
|
*/
|
|
46
46
|
openPaymentsDashboard(config: PaymentsDashboardConfig): FlowInstance;
|
|
47
|
-
/**
|
|
48
|
-
* Launch single payment details
|
|
49
|
-
*/
|
|
50
|
-
openSinglePayment(config: SinglePaymentConfig): FlowInstance;
|
|
51
47
|
}
|
|
52
48
|
/**
|
|
53
49
|
* Export the SDK instance
|
package/dist/index.js
CHANGED
|
@@ -73,8 +73,8 @@ class Flow {
|
|
|
73
73
|
return finalUrl;
|
|
74
74
|
}
|
|
75
75
|
setupEventListeners() {
|
|
76
|
-
//
|
|
77
|
-
//
|
|
76
|
+
// Add post message handlers for internal events - setHeight, scroll etc
|
|
77
|
+
// Also need to implement callbacks for flow completed exit etc in the platform-app
|
|
78
78
|
window.addEventListener('message', (event) => {
|
|
79
79
|
// Verify origin for security
|
|
80
80
|
if (event.origin !== 'https://app.melio.com') {
|
|
@@ -168,13 +168,13 @@ class SinglePayFlow extends Flow {
|
|
|
168
168
|
class BatchPayFlow extends Flow {
|
|
169
169
|
constructor(containerId, config, partnerName, environment) {
|
|
170
170
|
super(containerId, config, partnerName, environment);
|
|
171
|
-
this.
|
|
171
|
+
this.billIds = config.billIds;
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* Construct the specific flow URL for batch payments
|
|
175
175
|
*/
|
|
176
176
|
constructFlowUrl(baseUrl) {
|
|
177
|
-
const billIds = this.
|
|
177
|
+
const billIds = this.billIds.join(',');
|
|
178
178
|
return `${baseUrl}/${this.partnerName}/batch-payments/${billIds}`;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -197,18 +197,6 @@ class PaymentsDashboardFlow extends Flow {
|
|
|
197
197
|
return `${baseUrl}/${this.partnerName}/pay-dashboard/payments`;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
class SinglePaymentFlow extends Flow {
|
|
201
|
-
constructor(containerId, config, partnerName, environment) {
|
|
202
|
-
super(containerId, config, partnerName, environment);
|
|
203
|
-
this.paymentId = config.paymentId;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Construct the specific flow URL for single payment
|
|
207
|
-
*/
|
|
208
|
-
constructFlowUrl(baseUrl) {
|
|
209
|
-
return `${baseUrl}/${this.partnerName}/pay-dashboard/payments/${this.paymentId}`;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
200
|
/**
|
|
213
201
|
* Main SDK implementation - now partner agnostic
|
|
214
202
|
*/
|
|
@@ -322,14 +310,6 @@ export class MelioSDK {
|
|
|
322
310
|
flow.initialize();
|
|
323
311
|
return flow;
|
|
324
312
|
}
|
|
325
|
-
/**
|
|
326
|
-
* Launch single payment details
|
|
327
|
-
*/
|
|
328
|
-
openSinglePayment(config) {
|
|
329
|
-
const flow = new SinglePaymentFlow(config.containerId, config, this.partnerName, this.environment);
|
|
330
|
-
flow.initialize();
|
|
331
|
-
return flow;
|
|
332
|
-
}
|
|
333
313
|
}
|
|
334
314
|
/**
|
|
335
315
|
* Export the SDK instance
|
package/dist/types.d.ts
CHANGED
|
@@ -31,17 +31,15 @@ export interface OnboardingConfig extends BaseFlowConfig {
|
|
|
31
31
|
* Configuration for single pay flow
|
|
32
32
|
*/
|
|
33
33
|
export interface SinglePayFlowConfig extends BaseFlowConfig {
|
|
34
|
-
/** The
|
|
34
|
+
/** The bill ID to pay */
|
|
35
35
|
billId: string;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Configuration for batch pay flow
|
|
39
39
|
*/
|
|
40
40
|
export interface BatchPayConfig extends BaseFlowConfig {
|
|
41
|
-
/** Array of
|
|
42
|
-
|
|
43
|
-
billId: string;
|
|
44
|
-
}>;
|
|
41
|
+
/** Array of bill IDs to pay */
|
|
42
|
+
billIds: Array<string>;
|
|
45
43
|
}
|
|
46
44
|
/**
|
|
47
45
|
* Configuration for settings flow
|
|
@@ -53,13 +51,6 @@ export interface SettingsConfig extends BaseFlowConfig {
|
|
|
53
51
|
*/
|
|
54
52
|
export interface PaymentsDashboardConfig extends BaseFlowConfig {
|
|
55
53
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Configuration for single payment
|
|
58
|
-
*/
|
|
59
|
-
export interface SinglePaymentConfig extends BaseFlowConfig {
|
|
60
|
-
/** The Melio bill ID to pay */
|
|
61
|
-
paymentId: string;
|
|
62
|
-
}
|
|
63
54
|
/**
|
|
64
55
|
* Event payload for navigation events
|
|
65
56
|
*/
|
|
@@ -145,10 +136,4 @@ export interface MelioSDK {
|
|
|
145
136
|
* @returns Flow instance for event handling
|
|
146
137
|
*/
|
|
147
138
|
openPaymentsDashboard(config: PaymentsDashboardConfig): FlowInstance;
|
|
148
|
-
/**
|
|
149
|
-
* Launch the single payment flow
|
|
150
|
-
* @param config - Configuration for the single payment flow
|
|
151
|
-
* @returns Flow instance for event handling
|
|
152
|
-
*/
|
|
153
|
-
openSinglePayment(config: SinglePaymentConfig): FlowInstance;
|
|
154
139
|
}
|
package/package.json
CHANGED