@melio-eng/web-sdk 1.0.16 → 1.0.17-pr.34.2f432bc

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
@@ -13,7 +13,6 @@ export declare class MelioSDK implements MelioSDK {
13
13
  * Initialize the SDK by creating an authentication flow
14
14
  */
15
15
  init(authenticationCode: string, options: InitOptions): FlowInstance;
16
- private setupKeepAlive;
17
16
  /**
18
17
  * Launch the onboarding flow
19
18
  */
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
  /**
@@ -260,7 +260,17 @@ class InitFlow extends Flow {
260
260
  token: this.authorizationCode,
261
261
  theme: this.partnerName,
262
262
  });
263
- return `${baseUrl}/${this.partnerName}/start?${params.toString()}`;
263
+ return `${baseUrl}/${this.partnerName}/start?${params.toString()}&cdn_branch_override=refresh_token_on_user_ping`;
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
+ }, '*');
272
+ }
273
+ }, 30000); // Send ping every 30 seconds
264
274
  }
265
275
  }
266
276
  /**
@@ -278,25 +288,15 @@ 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 flow = new InitFlow('', // no need container id for init flow as it is created inside the initialization
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
- flow.initialize();
288
- this.setupKeepAlive();
289
- return flow;
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
+ if (options.keepAlive)
298
+ initFlow.setupKeepAlive();
299
+ return initFlow;
300
300
  }
301
301
  /**
302
302
  * 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.16",
3
+ "version": "1.0.17-pr.34.2f432bc",
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",