@melio-eng/web-sdk 1.0.36-pr.72.aa9151a → 1.0.36-pr.73.37dbe23
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/JustPayFlow.d.ts +16 -0
- package/dist/flows/JustPayFlow.js +29 -0
- package/dist/flows/index.d.ts +1 -1
- package/dist/flows/index.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +12 -12
- package/dist/types.d.ts +15 -12
- package/package.json +1 -1
- package/dist/flows/ViewPaymentFlow.d.ts +0 -14
- package/dist/flows/ViewPaymentFlow.js +0 -23
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JustPayFlowConfig, Environment } from '../types.js';
|
|
2
|
+
import { Flow } from './Flow.js';
|
|
3
|
+
/**
|
|
4
|
+
* JustPayFlow subclass - opens payment flow with vendor and amount prefilled
|
|
5
|
+
* Uses externalVendorIds instead of billIds
|
|
6
|
+
*/
|
|
7
|
+
export declare class JustPayFlow extends Flow {
|
|
8
|
+
private externalVendorIds;
|
|
9
|
+
private amount?;
|
|
10
|
+
private authCode;
|
|
11
|
+
constructor(containerId: string, config: JustPayFlowConfig, partnerName: string, environment: Environment, authCode: string, branchOverride?: string);
|
|
12
|
+
/**
|
|
13
|
+
* Construct the specific flow URL for vendor payment - goes through /auth
|
|
14
|
+
*/
|
|
15
|
+
protected constructFlowUrl(baseUrl: string): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Flow } from './Flow.js';
|
|
2
|
+
import { isEmptyString } from './utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* JustPayFlow subclass - opens payment flow with vendor and amount prefilled
|
|
5
|
+
* Uses externalVendorIds instead of billIds
|
|
6
|
+
*/
|
|
7
|
+
export class JustPayFlow extends Flow {
|
|
8
|
+
constructor(containerId, config, partnerName, environment, authCode, branchOverride) {
|
|
9
|
+
super(containerId, config, partnerName, environment, branchOverride);
|
|
10
|
+
this.externalVendorIds = config.externalVendorIds;
|
|
11
|
+
this.amount = config.amount;
|
|
12
|
+
this.authCode = authCode;
|
|
13
|
+
if (isEmptyString(this.authCode)) {
|
|
14
|
+
throw new Error('Authorization code is required for just pay flow. Please call init() before opening just pay flow.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Construct the specific flow URL for vendor payment - goes through /auth
|
|
19
|
+
*/
|
|
20
|
+
constructFlowUrl(baseUrl) {
|
|
21
|
+
const vendorIdsParam = this.externalVendorIds.join(',');
|
|
22
|
+
let target = `/external-entries/payment-flow?externalVendorIds=${vendorIdsParam}&externalOrigin=${this.partnerName}`;
|
|
23
|
+
if (this.amount !== undefined) {
|
|
24
|
+
target += `&amount=${this.amount}`;
|
|
25
|
+
}
|
|
26
|
+
const encodedTarget = encodeURIComponent(target);
|
|
27
|
+
return `${baseUrl}/${this.partnerName}/auth?token=${this.authCode}&redirectUrl=${encodedTarget}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
package/dist/flows/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { Flow } from './Flow.js';
|
|
|
2
2
|
export { InitFlow } from './InitFlow.js';
|
|
3
3
|
export { OnboardingFlow } from './OnboardingFlow.js';
|
|
4
4
|
export { PayFlow } from './PayFlow.js';
|
|
5
|
+
export { JustPayFlow } from './JustPayFlow.js';
|
|
5
6
|
export { SettingsFlow } from './SettingsFlow.js';
|
|
6
7
|
export { PaymentsDashboardFlow } from './PaymentsDashboardFlow.js';
|
|
7
|
-
export { ViewPaymentFlow } from './ViewPaymentFlow.js';
|
|
8
8
|
export { getBaseUrl, isEmptyString } from './utils.js';
|
package/dist/flows/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { Flow } from './Flow.js';
|
|
|
2
2
|
export { InitFlow } from './InitFlow.js';
|
|
3
3
|
export { OnboardingFlow } from './OnboardingFlow.js';
|
|
4
4
|
export { PayFlow } from './PayFlow.js';
|
|
5
|
+
export { JustPayFlow } from './JustPayFlow.js';
|
|
5
6
|
export { SettingsFlow } from './SettingsFlow.js';
|
|
6
7
|
export { PaymentsDashboardFlow } from './PaymentsDashboardFlow.js';
|
|
7
|
-
export { ViewPaymentFlow } from './ViewPaymentFlow.js';
|
|
8
8
|
export { getBaseUrl, isEmptyString } from './utils.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitOptions, OnboardingConfig, SettingsConfig, FlowInstance, PaymentsDashboardConfig,
|
|
1
|
+
import { InitOptions, OnboardingConfig, SettingsConfig, FlowInstance, PaymentsDashboardConfig, PayFlowConfig, JustPayFlowConfig, InitFlowInstance } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Main SDK implementation - now partner agnostic
|
|
4
4
|
*/
|
|
@@ -22,6 +22,10 @@ export declare class MelioSDK implements MelioSDK {
|
|
|
22
22
|
* Launch the pay flow
|
|
23
23
|
*/
|
|
24
24
|
openPayFlow(config: PayFlowConfig): FlowInstance;
|
|
25
|
+
/**
|
|
26
|
+
* Launch the just pay flow (vendor-based payment)
|
|
27
|
+
*/
|
|
28
|
+
openJustPayFlow(config: JustPayFlowConfig): FlowInstance;
|
|
25
29
|
/**
|
|
26
30
|
* Launch the settings flow
|
|
27
31
|
*/
|
|
@@ -30,10 +34,6 @@ export declare class MelioSDK implements MelioSDK {
|
|
|
30
34
|
* Launch the payments dashboard flow
|
|
31
35
|
*/
|
|
32
36
|
openPaymentsDashboard(config: PaymentsDashboardConfig): FlowInstance;
|
|
33
|
-
/**
|
|
34
|
-
* Launch the view payment flow to deep link into a specific payment
|
|
35
|
-
*/
|
|
36
|
-
openViewPayment(config: ViewPaymentConfig): FlowInstance;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Export the SDK instance
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitFlow, OnboardingFlow, PayFlow, SettingsFlow, PaymentsDashboardFlow,
|
|
1
|
+
import { InitFlow, OnboardingFlow, PayFlow, JustPayFlow, SettingsFlow, PaymentsDashboardFlow, isEmptyString, } from './flows/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Main SDK implementation - now partner agnostic
|
|
4
4
|
*/
|
|
@@ -57,6 +57,17 @@ export class MelioSDK {
|
|
|
57
57
|
flow.initialize();
|
|
58
58
|
return flow;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Launch the just pay flow (vendor-based payment)
|
|
62
|
+
*/
|
|
63
|
+
openJustPayFlow(config) {
|
|
64
|
+
if (isEmptyString(this.authCode)) {
|
|
65
|
+
throw new Error('SDK not initialized. Please call init() before opening just pay flow.');
|
|
66
|
+
}
|
|
67
|
+
const flow = new JustPayFlow(config.containerId, config, this.partnerName, this.environment, this.authCode, this.branchOverride);
|
|
68
|
+
flow.initialize();
|
|
69
|
+
return flow;
|
|
70
|
+
}
|
|
60
71
|
/**
|
|
61
72
|
* Launch the settings flow
|
|
62
73
|
*/
|
|
@@ -79,17 +90,6 @@ export class MelioSDK {
|
|
|
79
90
|
flow.initialize();
|
|
80
91
|
return flow;
|
|
81
92
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Launch the view payment flow to deep link into a specific payment
|
|
84
|
-
*/
|
|
85
|
-
openViewPayment(config) {
|
|
86
|
-
if (isEmptyString(this.authCode)) {
|
|
87
|
-
throw new Error('SDK not initialized. Please call init() before opening view payment flow.');
|
|
88
|
-
}
|
|
89
|
-
const flow = new ViewPaymentFlow(config.containerId, config, this.partnerName, this.environment, this.authCode, this.branchOverride);
|
|
90
|
-
flow.initialize();
|
|
91
|
-
return flow;
|
|
92
|
-
}
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Export the SDK instance
|
package/dist/types.d.ts
CHANGED
|
@@ -55,6 +55,15 @@ export interface OnboardingConfig extends BaseFlowConfig {
|
|
|
55
55
|
export interface PayFlowConfig extends BaseFlowConfig {
|
|
56
56
|
billIds: Array<string>;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Configuration for just pay flow (vendor-based payment)
|
|
60
|
+
*/
|
|
61
|
+
export interface JustPayFlowConfig extends BaseFlowConfig {
|
|
62
|
+
/** External vendor IDs to sync and pay */
|
|
63
|
+
externalVendorIds: Array<string>;
|
|
64
|
+
/** Optional amount to prefill in the payment flow */
|
|
65
|
+
amount?: number;
|
|
66
|
+
}
|
|
58
67
|
/**
|
|
59
68
|
* Configuration for settings flow
|
|
60
69
|
*/
|
|
@@ -66,12 +75,6 @@ export interface SettingsConfig extends BaseFlowConfig {
|
|
|
66
75
|
export interface PaymentsDashboardConfig extends BaseFlowConfig {
|
|
67
76
|
paymentId?: string;
|
|
68
77
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Configuration for view payment flow (deep link into a specific payment)
|
|
71
|
-
*/
|
|
72
|
-
export interface ViewPaymentConfig extends BaseFlowConfig {
|
|
73
|
-
paymentId: string;
|
|
74
|
-
}
|
|
75
78
|
/**
|
|
76
79
|
* Configuration for init flow
|
|
77
80
|
*/
|
|
@@ -177,6 +180,12 @@ export interface MelioSDK {
|
|
|
177
180
|
* @returns Flow instance for event handling
|
|
178
181
|
*/
|
|
179
182
|
openOnboarding(config: OnboardingConfig): FlowInstance;
|
|
183
|
+
/**
|
|
184
|
+
* Launch the just pay flow (vendor-based payment)
|
|
185
|
+
* @param config - Configuration for the just pay flow
|
|
186
|
+
* @returns Flow instance for event handling
|
|
187
|
+
*/
|
|
188
|
+
openJustPayFlow(config: JustPayFlowConfig): FlowInstance;
|
|
180
189
|
/**
|
|
181
190
|
* Launch the settings flow
|
|
182
191
|
* @param config - Configuration for the settings flow
|
|
@@ -189,10 +198,4 @@ export interface MelioSDK {
|
|
|
189
198
|
* @returns Flow instance for event handling
|
|
190
199
|
*/
|
|
191
200
|
openPaymentsDashboard(config: PaymentsDashboardConfig): FlowInstance;
|
|
192
|
-
/**
|
|
193
|
-
* Launch the view payment flow to deep link into a specific payment
|
|
194
|
-
* @param config - Configuration for the view payment flow
|
|
195
|
-
* @returns Flow instance for event handling
|
|
196
|
-
*/
|
|
197
|
-
openViewPayment(config: ViewPaymentConfig): FlowInstance;
|
|
198
201
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@melio-eng/web-sdk",
|
|
3
|
-
"version": "1.0.36-pr.
|
|
3
|
+
"version": "1.0.36-pr.73.37dbe23",
|
|
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",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ViewPaymentConfig, Environment } from '../types.js';
|
|
2
|
-
import { Flow } from './Flow.js';
|
|
3
|
-
/**
|
|
4
|
-
* ViewPaymentFlow subclass with custom URL construction for deep linking into a specific payment
|
|
5
|
-
*/
|
|
6
|
-
export declare class ViewPaymentFlow extends Flow {
|
|
7
|
-
private paymentId;
|
|
8
|
-
private authCode;
|
|
9
|
-
constructor(containerId: string, config: ViewPaymentConfig, partnerName: string, environment: Environment, authCode: string, branchOverride?: string);
|
|
10
|
-
/**
|
|
11
|
-
* Construct the specific flow URL for viewing a payment - goes through /auth
|
|
12
|
-
*/
|
|
13
|
-
protected constructFlowUrl(baseUrl: string): string;
|
|
14
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Flow } from './Flow.js';
|
|
2
|
-
import { isEmptyString } from './utils.js';
|
|
3
|
-
/**
|
|
4
|
-
* ViewPaymentFlow subclass with custom URL construction for deep linking into a specific payment
|
|
5
|
-
*/
|
|
6
|
-
export class ViewPaymentFlow extends Flow {
|
|
7
|
-
constructor(containerId, config, partnerName, environment, authCode, branchOverride) {
|
|
8
|
-
super(containerId, config, partnerName, environment, branchOverride);
|
|
9
|
-
this.paymentId = config.paymentId;
|
|
10
|
-
this.authCode = authCode;
|
|
11
|
-
if (isEmptyString(this.authCode)) {
|
|
12
|
-
throw new Error('Authorization code is required for view payment flow. Please call init() before opening view payment flow.');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Construct the specific flow URL for viewing a payment - goes through /auth
|
|
17
|
-
*/
|
|
18
|
-
constructFlowUrl(baseUrl) {
|
|
19
|
-
const target = `/pay-dashboard/payments/${this.paymentId}`;
|
|
20
|
-
const encodedTarget = encodeURIComponent(target);
|
|
21
|
-
return `${baseUrl}/${this.partnerName}/auth?token=${this.authCode}&redirectUrl=${encodedTarget}`;
|
|
22
|
-
}
|
|
23
|
-
}
|