@melio-eng/web-sdk 1.0.16 → 1.0.17-pr.34.f5d0d62
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 +0 -1
- package/dist/index.js +15 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -202,7 +202,7 @@ class PayFlow extends Flow {
|
|
|
202
202
|
* Construct the specific flow URL for bill payment
|
|
203
203
|
*/
|
|
204
204
|
constructFlowUrl(baseUrl) {
|
|
205
|
-
return `${baseUrl}/${this.partnerName}/external-entries/payment-flow?billIds=${this.billIds.join(',')}`;
|
|
205
|
+
return `${baseUrl}/${this.partnerName}/external-entries/payment-flow?billIds=${this.billIds.join(',')}&externalOrigin=${this.partnerName}`;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -262,6 +262,16 @@ class InitFlow extends Flow {
|
|
|
262
262
|
});
|
|
263
263
|
return `${baseUrl}/${this.partnerName}/start?${params.toString()}`;
|
|
264
264
|
}
|
|
265
|
+
setupKeepAlive() {
|
|
266
|
+
this.keepAliveInterval = window.setInterval(() => {
|
|
267
|
+
if (this.iframe && this.iframe.contentWindow) {
|
|
268
|
+
console.log('Sending keep-alive ping!');
|
|
269
|
+
this.iframe.contentWindow.postMessage({
|
|
270
|
+
type: 'USER_ACTIVE_PING',
|
|
271
|
+
}, 'https://app.melio.com');
|
|
272
|
+
}
|
|
273
|
+
}, 30000); // Send ping every 30 seconds
|
|
274
|
+
}
|
|
265
275
|
}
|
|
266
276
|
/**
|
|
267
277
|
* Main SDK implementation - now partner agnostic
|
|
@@ -278,25 +288,14 @@ export class MelioSDK {
|
|
|
278
288
|
* Initialize the SDK by creating an authentication flow
|
|
279
289
|
*/
|
|
280
290
|
init(authenticationCode, options) {
|
|
281
|
-
// Set partner name and environment from options
|
|
282
291
|
this.partnerName = options.partnerName;
|
|
283
292
|
this.environment = options.environment || 'production';
|
|
284
293
|
this.branchOverride = options.branchOverride;
|
|
285
|
-
const
|
|
294
|
+
const initFlow = new InitFlow('', // no need container id for init flow as it is created inside the initialization
|
|
286
295
|
{ authCode: authenticationCode, containerId: '' }, this.partnerName, this.environment, this.branchOverride);
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
return
|
|
290
|
-
}
|
|
291
|
-
setupKeepAlive() {
|
|
292
|
-
// Send periodic pings to keep session alive
|
|
293
|
-
this.keepAliveInterval = window.setInterval(() => {
|
|
294
|
-
if (this.keepAliveIframe && this.keepAliveIframe.contentWindow) {
|
|
295
|
-
this.keepAliveIframe.contentWindow.postMessage({
|
|
296
|
-
type: 'USER_ACTIVE_PING',
|
|
297
|
-
}, 'https://app.melio.com');
|
|
298
|
-
}
|
|
299
|
-
}, 30000); // Send ping every 30 seconds
|
|
296
|
+
initFlow.initialize();
|
|
297
|
+
initFlow.setupKeepAlive();
|
|
298
|
+
return initFlow;
|
|
300
299
|
}
|
|
301
300
|
/**
|
|
302
301
|
* Launch the onboarding flow
|
package/package.json
CHANGED