@melio-eng/web-sdk 1.0.16-pr.31.45a86e9 → 1.0.16-pr.31.f5ce3e3
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 +2 -2
- package/dist/index.js +5 -5
- package/dist/types.d.ts +3 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitOptions,
|
|
1
|
+
import { InitOptions, OnboardingConfig, SettingsConfig, FlowInstance, PaymentsDashboardConfig, PayFlowConfig } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Main SDK implementation - now partner agnostic
|
|
4
4
|
*/
|
|
@@ -12,7 +12,7 @@ export declare class MelioSDK implements MelioSDK {
|
|
|
12
12
|
/**
|
|
13
13
|
* Initialize the SDK by creating an authentication flow
|
|
14
14
|
*/
|
|
15
|
-
init(
|
|
15
|
+
init(authenticationCode: string, options: InitOptions): FlowInstance;
|
|
16
16
|
private setupKeepAlive;
|
|
17
17
|
/**
|
|
18
18
|
* Launch the onboarding flow
|
package/dist/index.js
CHANGED
|
@@ -80,8 +80,7 @@ class Flow {
|
|
|
80
80
|
// Add post message handlers for internal events - setHeight, scroll etc
|
|
81
81
|
// Also need to implement callbacks for flow completed exit etc in the platform-app
|
|
82
82
|
window.addEventListener('message', (event) => {
|
|
83
|
-
|
|
84
|
-
if (event.origin !== 'https://app.melio.com') {
|
|
83
|
+
if (!/melio\.com|melioservices\.com/.test(event.origin)) {
|
|
85
84
|
return;
|
|
86
85
|
}
|
|
87
86
|
const { type, data } = event.data;
|
|
@@ -237,7 +236,7 @@ class PaymentsDashboardFlow extends Flow {
|
|
|
237
236
|
class InitFlow extends Flow {
|
|
238
237
|
constructor(containerId, config, partnerName, environment, branchOverride) {
|
|
239
238
|
super(containerId, config, partnerName, environment, branchOverride);
|
|
240
|
-
this.authorizationCode = config.
|
|
239
|
+
this.authorizationCode = config.authCode;
|
|
241
240
|
}
|
|
242
241
|
/**
|
|
243
242
|
* Initialize the init flow by creating and injecting a hidden iframe
|
|
@@ -278,12 +277,13 @@ export class MelioSDK {
|
|
|
278
277
|
/**
|
|
279
278
|
* Initialize the SDK by creating an authentication flow
|
|
280
279
|
*/
|
|
281
|
-
init(
|
|
280
|
+
init(authenticationCode, options) {
|
|
282
281
|
// Set partner name and environment from options
|
|
283
282
|
this.partnerName = options.partnerName;
|
|
284
283
|
this.environment = options.environment || 'production';
|
|
285
284
|
this.branchOverride = options.branchOverride;
|
|
286
|
-
const flow = new InitFlow(
|
|
285
|
+
const flow = new InitFlow('', // no need container id for init flow as it is created inside the initialization
|
|
286
|
+
{ authCode: authenticationCode, containerId: '' }, this.partnerName, this.environment, this.branchOverride);
|
|
287
287
|
flow.initialize();
|
|
288
288
|
this.setupKeepAlive();
|
|
289
289
|
return flow;
|
package/dist/types.d.ts
CHANGED
|
@@ -68,8 +68,7 @@ export interface PaymentsDashboardConfig extends BaseFlowConfig {
|
|
|
68
68
|
* Configuration for init flow
|
|
69
69
|
*/
|
|
70
70
|
export interface InitConfig extends BaseFlowConfig {
|
|
71
|
-
|
|
72
|
-
authorizationCode: string;
|
|
71
|
+
authCode: string;
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
74
|
* Event data for navigation events
|
|
@@ -125,11 +124,11 @@ export interface FlowInstance {
|
|
|
125
124
|
export interface MelioSDK {
|
|
126
125
|
/**
|
|
127
126
|
* Initialize the SDK with the provided authorization code
|
|
128
|
-
* @param
|
|
127
|
+
* @param authorizationCode - OAuth code received from the partner
|
|
129
128
|
* @param options - Initialization options
|
|
130
129
|
* @returns Flow instance for event handling
|
|
131
130
|
*/
|
|
132
|
-
init(
|
|
131
|
+
init(authorizationCode: string, options: InitOptions): FlowInstance;
|
|
133
132
|
/**
|
|
134
133
|
* Launch the onboarding flow
|
|
135
134
|
* @param config - Configuration for the onboarding flow
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@melio-eng/web-sdk",
|
|
3
|
-
"version": "1.0.16-pr.31.
|
|
3
|
+
"version": "1.0.16-pr.31.f5ce3e3",
|
|
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",
|