@melio-eng/web-sdk 1.0.36-pr.70.e2db713 → 1.0.36-pr.72.aa9151a
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/ViewPaymentFlow.d.ts +14 -0
- package/dist/flows/ViewPaymentFlow.js +23 -0
- package/dist/flows/index.d.ts +1 -0
- package/dist/flows/index.js +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +12 -1
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
}
|
package/dist/flows/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { OnboardingFlow } from './OnboardingFlow.js';
|
|
|
4
4
|
export { PayFlow } from './PayFlow.js';
|
|
5
5
|
export { SettingsFlow } from './SettingsFlow.js';
|
|
6
6
|
export { PaymentsDashboardFlow } from './PaymentsDashboardFlow.js';
|
|
7
|
+
export { ViewPaymentFlow } from './ViewPaymentFlow.js';
|
|
7
8
|
export { getBaseUrl, isEmptyString } from './utils.js';
|
package/dist/flows/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { OnboardingFlow } from './OnboardingFlow.js';
|
|
|
4
4
|
export { PayFlow } from './PayFlow.js';
|
|
5
5
|
export { SettingsFlow } from './SettingsFlow.js';
|
|
6
6
|
export { PaymentsDashboardFlow } from './PaymentsDashboardFlow.js';
|
|
7
|
+
export { ViewPaymentFlow } from './ViewPaymentFlow.js';
|
|
7
8
|
export { getBaseUrl, isEmptyString } from './utils.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitOptions, OnboardingConfig, SettingsConfig, FlowInstance, PaymentsDashboardConfig, PayFlowConfig, InitFlowInstance } from './types.js';
|
|
1
|
+
import { InitOptions, OnboardingConfig, SettingsConfig, FlowInstance, PaymentsDashboardConfig, ViewPaymentConfig, PayFlowConfig, InitFlowInstance } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Main SDK implementation - now partner agnostic
|
|
4
4
|
*/
|
|
@@ -30,6 +30,10 @@ export declare class MelioSDK implements MelioSDK {
|
|
|
30
30
|
* Launch the payments dashboard flow
|
|
31
31
|
*/
|
|
32
32
|
openPaymentsDashboard(config: PaymentsDashboardConfig): FlowInstance;
|
|
33
|
+
/**
|
|
34
|
+
* Launch the view payment flow to deep link into a specific payment
|
|
35
|
+
*/
|
|
36
|
+
openViewPayment(config: ViewPaymentConfig): FlowInstance;
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* Export the SDK instance
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitFlow, OnboardingFlow, PayFlow, SettingsFlow, PaymentsDashboardFlow, isEmptyString, } from './flows/index.js';
|
|
1
|
+
import { InitFlow, OnboardingFlow, PayFlow, SettingsFlow, PaymentsDashboardFlow, ViewPaymentFlow, isEmptyString, } from './flows/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Main SDK implementation - now partner agnostic
|
|
4
4
|
*/
|
|
@@ -79,6 +79,17 @@ export class MelioSDK {
|
|
|
79
79
|
flow.initialize();
|
|
80
80
|
return flow;
|
|
81
81
|
}
|
|
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
|
+
}
|
|
82
93
|
}
|
|
83
94
|
/**
|
|
84
95
|
* Export the SDK instance
|
package/dist/types.d.ts
CHANGED
|
@@ -66,6 +66,12 @@ export interface SettingsConfig extends BaseFlowConfig {
|
|
|
66
66
|
export interface PaymentsDashboardConfig extends BaseFlowConfig {
|
|
67
67
|
paymentId?: string;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Configuration for view payment flow (deep link into a specific payment)
|
|
71
|
+
*/
|
|
72
|
+
export interface ViewPaymentConfig extends BaseFlowConfig {
|
|
73
|
+
paymentId: string;
|
|
74
|
+
}
|
|
69
75
|
/**
|
|
70
76
|
* Configuration for init flow
|
|
71
77
|
*/
|
|
@@ -183,4 +189,10 @@ export interface MelioSDK {
|
|
|
183
189
|
* @returns Flow instance for event handling
|
|
184
190
|
*/
|
|
185
191
|
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;
|
|
186
198
|
}
|
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.72.aa9151a",
|
|
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",
|