@melio-eng/web-sdk 1.0.37 → 1.0.38-pr.76.b08b8f0
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 +1 -0
- package/dist/flows/JustPayFlow.js +3 -1
- package/dist/flows/OnboardingFlow.d.ts +1 -0
- package/dist/flows/OnboardingFlow.js +4 -2
- package/dist/flows/PayFlow.d.ts +1 -0
- package/dist/flows/PayFlow.js +3 -1
- package/dist/types.d.ts +11 -0
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export declare class JustPayFlow extends Flow {
|
|
|
8
8
|
private externalVendorIds;
|
|
9
9
|
private amount?;
|
|
10
10
|
private authCode;
|
|
11
|
+
private entryPoint?;
|
|
11
12
|
constructor(containerId: string, config: JustPayFlowConfig, partnerName: string, environment: Environment, authCode: string, branchOverride?: string);
|
|
12
13
|
/**
|
|
13
14
|
* Construct the specific flow URL for vendor payment - goes through /auth
|
|
@@ -10,6 +10,7 @@ export class JustPayFlow extends Flow {
|
|
|
10
10
|
this.externalVendorIds = config.externalVendorIds;
|
|
11
11
|
this.amount = config.amount;
|
|
12
12
|
this.authCode = authCode;
|
|
13
|
+
this.entryPoint = config.entryPoint;
|
|
13
14
|
if (isEmptyString(this.authCode)) {
|
|
14
15
|
throw new Error('Authorization code is required for just pay flow. Please call init() before opening just pay flow.');
|
|
15
16
|
}
|
|
@@ -19,7 +20,8 @@ export class JustPayFlow extends Flow {
|
|
|
19
20
|
*/
|
|
20
21
|
constructFlowUrl(baseUrl) {
|
|
21
22
|
const vendorIdsParam = this.externalVendorIds.join(',');
|
|
22
|
-
|
|
23
|
+
const externalOrigin = this.entryPoint ? `${this.partnerName}-${this.entryPoint}` : this.partnerName;
|
|
24
|
+
let target = `/external-entries/payment-flow?externalVendorIds=${vendorIdsParam}&externalOrigin=${externalOrigin}`;
|
|
23
25
|
if (this.amount !== undefined) {
|
|
24
26
|
target += `&amount=${this.amount}`;
|
|
25
27
|
}
|
|
@@ -7,6 +7,7 @@ export declare class OnboardingFlow extends Flow {
|
|
|
7
7
|
private preFilledParams;
|
|
8
8
|
private enforceOnboarding?;
|
|
9
9
|
private authCode;
|
|
10
|
+
private entryPoint?;
|
|
10
11
|
constructor(containerId: string, config: OnboardingConfig, partnerName: string, environment: Environment, authCode: string, branchOverride?: string);
|
|
11
12
|
/**
|
|
12
13
|
* Construct the specific flow URL for onboarding - now goes through /auth
|
|
@@ -6,10 +6,11 @@ import { isEmptyString } from './utils.js';
|
|
|
6
6
|
export class OnboardingFlow extends Flow {
|
|
7
7
|
constructor(containerId, config, partnerName, environment, authCode, branchOverride) {
|
|
8
8
|
super(containerId, config, partnerName, environment, branchOverride);
|
|
9
|
-
const { userDetails, organizationDetails, enforceOnboarding } = config;
|
|
9
|
+
const { userDetails, organizationDetails, enforceOnboarding, entryPoint } = config;
|
|
10
10
|
this.preFilledParams = { userDetails, organizationDetails };
|
|
11
11
|
this.enforceOnboarding = enforceOnboarding;
|
|
12
12
|
this.authCode = authCode;
|
|
13
|
+
this.entryPoint = entryPoint;
|
|
13
14
|
if (isEmptyString(this.authCode)) {
|
|
14
15
|
throw new Error('Authorization code is required for onboarding flow. Please call init() before opening onboarding flow.');
|
|
15
16
|
}
|
|
@@ -29,6 +30,7 @@ export class OnboardingFlow extends Flow {
|
|
|
29
30
|
preFilledBase64 = '';
|
|
30
31
|
}
|
|
31
32
|
}
|
|
33
|
+
const externalOrigin = this.entryPoint ? `${this.partnerName}-${this.entryPoint}` : this.partnerName;
|
|
32
34
|
const targetQueryParams = [];
|
|
33
35
|
if (preFilledBase64) {
|
|
34
36
|
targetQueryParams.push(`preFilledParams=${encodeURIComponent(preFilledBase64)}`);
|
|
@@ -36,7 +38,7 @@ export class OnboardingFlow extends Flow {
|
|
|
36
38
|
if (this.enforceOnboarding !== undefined) {
|
|
37
39
|
targetQueryParams.push(`enforceOnboarding=${this.enforceOnboarding}`);
|
|
38
40
|
}
|
|
39
|
-
targetQueryParams.push(`externalOrigin=${
|
|
41
|
+
targetQueryParams.push(`externalOrigin=${externalOrigin}`);
|
|
40
42
|
const target = `/welcome?${targetQueryParams.join('&')}`;
|
|
41
43
|
const encodedTarget = encodeURIComponent(target);
|
|
42
44
|
return `${baseUrl}/${this.partnerName}/auth?token=${this.authCode}&redirectUrl=${encodedTarget}`;
|
package/dist/flows/PayFlow.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Flow } from './Flow.js';
|
|
|
6
6
|
export declare class PayFlow extends Flow {
|
|
7
7
|
private billIds;
|
|
8
8
|
private authCode;
|
|
9
|
+
private entryPoint?;
|
|
9
10
|
constructor(containerId: string, config: PayFlowConfig, partnerName: string, environment: Environment, authCode: string, branchOverride?: string);
|
|
10
11
|
/**
|
|
11
12
|
* Construct the specific flow URL for bill payment - now goes through /auth
|
package/dist/flows/PayFlow.js
CHANGED
|
@@ -8,6 +8,7 @@ export class PayFlow extends Flow {
|
|
|
8
8
|
super(containerId, config, partnerName, environment, branchOverride);
|
|
9
9
|
this.billIds = config.billIds;
|
|
10
10
|
this.authCode = authCode;
|
|
11
|
+
this.entryPoint = config.entryPoint;
|
|
11
12
|
if (isEmptyString(this.authCode)) {
|
|
12
13
|
throw new Error('Authorization code is required for pay flow. Please call init() before opening pay flow.');
|
|
13
14
|
}
|
|
@@ -17,7 +18,8 @@ export class PayFlow extends Flow {
|
|
|
17
18
|
*/
|
|
18
19
|
constructFlowUrl(baseUrl) {
|
|
19
20
|
const billIdsParam = this.billIds.join(',');
|
|
20
|
-
const
|
|
21
|
+
const externalOrigin = this.entryPoint ? `${this.partnerName}-${this.entryPoint}` : this.partnerName;
|
|
22
|
+
const target = `/external-entries/payment-flow?billIds=${billIdsParam}&externalOrigin=${externalOrigin}`;
|
|
21
23
|
const encodedTarget = encodeURIComponent(target);
|
|
22
24
|
return `${baseUrl}/${this.partnerName}/auth?token=${this.authCode}&redirectUrl=${encodedTarget}`;
|
|
23
25
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -41,6 +41,11 @@ export interface UserDetails {
|
|
|
41
41
|
lastName?: string;
|
|
42
42
|
dateOfBirth?: string;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Entry point context for the flow, used to construct the externalOrigin parameter.
|
|
46
|
+
* When provided, the externalOrigin becomes `${partnerName}-${entryPoint}` (e.g., 'xero-contacts').
|
|
47
|
+
*/
|
|
48
|
+
export type ExternalEntryPoint = 'contacts';
|
|
44
49
|
/**
|
|
45
50
|
* Configuration for onboarding flow
|
|
46
51
|
*/
|
|
@@ -48,12 +53,16 @@ export interface OnboardingConfig extends BaseFlowConfig {
|
|
|
48
53
|
userDetails?: UserDetails;
|
|
49
54
|
organizationDetails?: OrganizationDetails;
|
|
50
55
|
enforceOnboarding?: boolean;
|
|
56
|
+
/** Optional entry point context — affects the externalOrigin passed to the platform */
|
|
57
|
+
entryPoint?: ExternalEntryPoint;
|
|
51
58
|
}
|
|
52
59
|
/**
|
|
53
60
|
* Configuration for pay flow
|
|
54
61
|
*/
|
|
55
62
|
export interface PayFlowConfig extends BaseFlowConfig {
|
|
56
63
|
billIds: Array<string>;
|
|
64
|
+
/** Optional entry point context — affects the externalOrigin passed to the platform */
|
|
65
|
+
entryPoint?: ExternalEntryPoint;
|
|
57
66
|
}
|
|
58
67
|
/**
|
|
59
68
|
* Configuration for just pay flow (vendor-based payment)
|
|
@@ -63,6 +72,8 @@ export interface JustPayFlowConfig extends BaseFlowConfig {
|
|
|
63
72
|
externalVendorIds: Array<string>;
|
|
64
73
|
/** Optional amount to prefill in the payment flow */
|
|
65
74
|
amount?: number;
|
|
75
|
+
/** Optional entry point context — affects the externalOrigin passed to the platform */
|
|
76
|
+
entryPoint?: ExternalEntryPoint;
|
|
66
77
|
}
|
|
67
78
|
/**
|
|
68
79
|
* Configuration for settings flow
|
package/package.json
CHANGED