@melio-eng/web-sdk 1.0.19 → 1.0.20

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 CHANGED
@@ -3,7 +3,6 @@ import { InitOptions, OnboardingConfig, SettingsConfig, FlowInstance, PaymentsDa
3
3
  * Main SDK implementation - now partner agnostic
4
4
  */
5
5
  export declare class MelioSDK implements MelioSDK {
6
- private keepAliveIframe;
7
6
  private keepAliveInterval;
8
7
  private environment;
9
8
  private partnerName;
@@ -13,7 +12,6 @@ export declare class MelioSDK implements MelioSDK {
13
12
  * Initialize the SDK by creating an authentication flow
14
13
  */
15
14
  init(authenticationCode: string, options: InitOptions): FlowInstance;
16
- private setupKeepAlive;
17
15
  /**
18
16
  * Launch the onboarding flow
19
17
  */
package/dist/index.js CHANGED
@@ -276,13 +276,19 @@ class InitFlow extends Flow {
276
276
  });
277
277
  return `${baseUrl}/${this.partnerName}/start?${params.toString()}`;
278
278
  }
279
+ setupKeepAlive() {
280
+ this.keepAliveInterval = window.setInterval(() => {
281
+ if (this.iframe && this.iframe.contentWindow) {
282
+ this.iframe.contentWindow.postMessage({ type: 'USER_ACTIVE_PING' }, '*');
283
+ }
284
+ }, 30000); // Send ping every 30 seconds
285
+ }
279
286
  }
280
287
  /**
281
288
  * Main SDK implementation - now partner agnostic
282
289
  */
283
290
  export class MelioSDK {
284
291
  constructor() {
285
- this.keepAliveIframe = null;
286
292
  this.keepAliveInterval = null;
287
293
  this.environment = 'production';
288
294
  this.partnerName = '';
@@ -292,7 +298,6 @@ export class MelioSDK {
292
298
  * Initialize the SDK by creating an authentication flow
293
299
  */
294
300
  init(authenticationCode, options) {
295
- // Set partner name and environment from options
296
301
  this.partnerName = options.partnerName;
297
302
  this.environment = options.environment || 'production';
298
303
  this.branchOverride = options.branchOverride;
@@ -300,22 +305,13 @@ export class MelioSDK {
300
305
  partnerName: this.partnerName,
301
306
  environment: this.environment,
302
307
  });
303
- const flow = new InitFlow('', // no need container id for init flow as it is created inside the initialization
308
+ const initFlow = new InitFlow('', // no need container id for init flow as it is created inside the initialization
304
309
  { authCode: authenticationCode, containerId: '' }, this.partnerName, this.environment, this.branchOverride);
305
- flow.initialize();
310
+ initFlow.initialize();
306
311
  console.log('InitFlow initialized successfully');
307
- this.setupKeepAlive();
308
- return flow;
309
- }
310
- setupKeepAlive() {
311
- // Send periodic pings to keep session alive
312
- this.keepAliveInterval = window.setInterval(() => {
313
- if (this.keepAliveIframe && this.keepAliveIframe.contentWindow) {
314
- this.keepAliveIframe.contentWindow.postMessage({
315
- type: 'USER_ACTIVE_PING',
316
- }, 'https://app.melio.com');
317
- }
318
- }, 30000); // Send ping every 30 seconds
312
+ if (options.keepAlive)
313
+ initFlow.setupKeepAlive();
314
+ return initFlow;
319
315
  }
320
316
  /**
321
317
  * Launch the onboarding flow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melio-eng/web-sdk",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
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",