@edge-markets/connect-link 1.4.0 → 1.5.0

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/README.md CHANGED
@@ -94,11 +94,19 @@ interface EdgeLinkConfig {
94
94
  onEvent?: (event) => void // Called for analytics events
95
95
  scopes?: EdgeScope[] // Scopes to request (default: all)
96
96
  linkUrl?: string // Custom Link URL (dev only)
97
- redirectUri?: string // Custom redirect URI (default: window.location.origin + '/oauth/edge/callback')
97
+ redirectUri?: string // Legacy popup callback URI (migration only)
98
98
  }
99
99
  ```
100
100
 
101
- The `redirectUri` is automatically set to `${window.location.origin}/oauth/edge/callback` if not provided.
101
+ Popup integrations are origin-based. Register your frontend origin with EDGE
102
+ for `postMessage` validation, for example:
103
+
104
+ - `https://app.partner.com`
105
+ - `http://localhost:3000`
106
+ - `http://localhost:5173`
107
+
108
+ `redirectUri` is no longer required for popup completion. Keep it only while
109
+ migrating an older integration that still sends a registered callback URL.
102
110
 
103
111
  ## Callbacks
104
112
 
@@ -323,4 +331,3 @@ MIT
323
331
 
324
332
 
325
333
 
326
-
package/dist/index.d.mts CHANGED
@@ -53,10 +53,11 @@ export { ALL_EDGE_SCOPES, EDGE_SCOPES, EdgeEnvironment, EdgeError, EdgeLinkEvent
53
53
  */
54
54
  interface EdgeLinkConfig extends EdgeLinkConfigBase {
55
55
  /**
56
- * Custom redirect URI after authentication.
57
- * Must be registered in your OAuth client settings.
56
+ * Legacy redirect URI to include in the popup request.
58
57
  *
59
- * @default `${window.location.origin}/oauth/edge/callback`
58
+ * Popup completion uses `postMessage` to your frontend origin and does not
59
+ * require a callback path by default. Keep this only while migrating older
60
+ * integrations that still expect a registered callback URL.
60
61
  */
61
62
  redirectUri?: string;
62
63
  }
package/dist/index.d.ts CHANGED
@@ -53,10 +53,11 @@ export { ALL_EDGE_SCOPES, EDGE_SCOPES, EdgeEnvironment, EdgeError, EdgeLinkEvent
53
53
  */
54
54
  interface EdgeLinkConfig extends EdgeLinkConfigBase {
55
55
  /**
56
- * Custom redirect URI after authentication.
57
- * Must be registered in your OAuth client settings.
56
+ * Legacy redirect URI to include in the popup request.
58
57
  *
59
- * @default `${window.location.origin}/oauth/edge/callback`
58
+ * Popup completion uses `postMessage` to your frontend origin and does not
59
+ * require a callback path by default. Keep this only while migrating older
60
+ * integrations that still expect a registered callback URL.
60
61
  */
61
62
  redirectUri?: string;
62
63
  }
package/dist/index.js CHANGED
@@ -321,6 +321,16 @@ var PopupManager = class {
321
321
  };
322
322
 
323
323
  // src/edge-link.ts
324
+ var hasWarnedLegacyRedirectUri = false;
325
+ function warnLegacyRedirectUriUsage(redirectUri) {
326
+ if (hasWarnedLegacyRedirectUri) {
327
+ return;
328
+ }
329
+ hasWarnedLegacyRedirectUri = true;
330
+ console.warn(
331
+ `EdgeLink: popup flows no longer require redirectUri. Received legacy redirectUri "${redirectUri}". Register your frontend origin with EDGE and remove this option when possible.`
332
+ );
333
+ }
324
334
  var EdgeLink = class {
325
335
  /**
326
336
  * Creates a new EdgeLink instance.
@@ -481,9 +491,12 @@ var EdgeLink = class {
481
491
  url.searchParams.set("code_challenge_method", "S256");
482
492
  const formattedScopes = (0, import_connect.formatScopesForEnvironment)(scopes, this.config.environment);
483
493
  url.searchParams.set("scope", formattedScopes.join(" "));
484
- const redirectUri = this.config.redirectUri || `${window.location.origin}/oauth/edge/callback`;
485
- url.searchParams.set("redirect_uri", redirectUri);
494
+ url.searchParams.set("flow", "popup");
486
495
  url.searchParams.set("origin", window.location.origin);
496
+ if (this.config.redirectUri) {
497
+ url.searchParams.set("redirect_uri", this.config.redirectUri);
498
+ warnLegacyRedirectUriUsage(this.config.redirectUri);
499
+ }
487
500
  return url.toString();
488
501
  }
489
502
  /**
package/dist/index.mjs CHANGED
@@ -287,6 +287,16 @@ var PopupManager = class {
287
287
  };
288
288
 
289
289
  // src/edge-link.ts
290
+ var hasWarnedLegacyRedirectUri = false;
291
+ function warnLegacyRedirectUriUsage(redirectUri) {
292
+ if (hasWarnedLegacyRedirectUri) {
293
+ return;
294
+ }
295
+ hasWarnedLegacyRedirectUri = true;
296
+ console.warn(
297
+ `EdgeLink: popup flows no longer require redirectUri. Received legacy redirectUri "${redirectUri}". Register your frontend origin with EDGE and remove this option when possible.`
298
+ );
299
+ }
290
300
  var EdgeLink = class {
291
301
  /**
292
302
  * Creates a new EdgeLink instance.
@@ -447,9 +457,12 @@ var EdgeLink = class {
447
457
  url.searchParams.set("code_challenge_method", "S256");
448
458
  const formattedScopes = formatScopesForEnvironment(scopes, this.config.environment);
449
459
  url.searchParams.set("scope", formattedScopes.join(" "));
450
- const redirectUri = this.config.redirectUri || `${window.location.origin}/oauth/edge/callback`;
451
- url.searchParams.set("redirect_uri", redirectUri);
460
+ url.searchParams.set("flow", "popup");
452
461
  url.searchParams.set("origin", window.location.origin);
462
+ if (this.config.redirectUri) {
463
+ url.searchParams.set("redirect_uri", this.config.redirectUri);
464
+ warnLegacyRedirectUriUsage(this.config.redirectUri);
465
+ }
453
466
  return url.toString();
454
467
  }
455
468
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edge-markets/connect-link",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Browser SDK for EDGE Connect popup authentication",
5
5
  "author": "EdgeBoost",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@edge-markets/connect": "1.5.0"
24
+ "@edge-markets/connect": "^1.5.1"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": ">=17.0.0"