@edge-markets/connect-link 1.5.0 → 1.5.1
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 +6 -7
- package/dist/index.js +2 -5
- package/dist/index.mjs +3 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -93,11 +93,16 @@ interface EdgeLinkConfig {
|
|
|
93
93
|
onExit?: (metadata) => void // Called when user exits
|
|
94
94
|
onEvent?: (event) => void // Called for analytics events
|
|
95
95
|
scopes?: EdgeScope[] // Scopes to request (default: all)
|
|
96
|
-
linkUrl?: string // Custom Link URL (dev only)
|
|
96
|
+
linkUrl?: string // Custom Link URL/origin (dev only)
|
|
97
97
|
redirectUri?: string // Legacy popup callback URI (migration only)
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
The SDK derives the hosted Link URL from `environment`; staging defaults to
|
|
102
|
+
`https://oauth.staging-app.edgeboost.io/oauth/link`. `linkUrl` is only needed for
|
|
103
|
+
nonstandard deployments. If provided as an origin, for example
|
|
104
|
+
`https://oauth.example.com`, the SDK appends `/oauth/link`.
|
|
105
|
+
|
|
101
106
|
Popup integrations are origin-based. Register your frontend origin with EDGE
|
|
102
107
|
for `postMessage` validation, for example:
|
|
103
108
|
|
|
@@ -325,9 +330,3 @@ function ConnectButton() {
|
|
|
325
330
|
|
|
326
331
|
MIT
|
|
327
332
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
package/dist/index.js
CHANGED
|
@@ -356,8 +356,7 @@ var EdgeLink = class {
|
|
|
356
356
|
assertCryptoAvailable();
|
|
357
357
|
this.config = config;
|
|
358
358
|
this.popup = new PopupManager();
|
|
359
|
-
|
|
360
|
-
this.expectedOrigin = config.linkUrl ? new URL(config.linkUrl).origin : new URL(envConfig.userClientUrl).origin;
|
|
359
|
+
this.expectedOrigin = new URL((0, import_connect.getLinkUrl)(config.environment, config.linkUrl)).origin;
|
|
361
360
|
this.setupMessageListener();
|
|
362
361
|
}
|
|
363
362
|
// ===========================================================================
|
|
@@ -482,9 +481,7 @@ var EdgeLink = class {
|
|
|
482
481
|
* - Returning code via postMessage
|
|
483
482
|
*/
|
|
484
483
|
buildLinkUrl(scopes) {
|
|
485
|
-
const
|
|
486
|
-
const baseUrl = this.config.linkUrl || `${envConfig.userClientUrl}/oauth/link`;
|
|
487
|
-
const url = new URL(baseUrl);
|
|
484
|
+
const url = new URL((0, import_connect.getLinkUrl)(this.config.environment, this.config.linkUrl));
|
|
488
485
|
url.searchParams.set("client_id", this.config.clientId);
|
|
489
486
|
url.searchParams.set("state", this.state);
|
|
490
487
|
url.searchParams.set("code_challenge", this.pkce.challenge);
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ALL_EDGE_SCOPES,
|
|
4
4
|
EdgePopupBlockedError,
|
|
5
5
|
formatScopesForEnvironment,
|
|
6
|
-
|
|
6
|
+
getLinkUrl
|
|
7
7
|
} from "@edge-markets/connect";
|
|
8
8
|
|
|
9
9
|
// src/pkce.ts
|
|
@@ -322,8 +322,7 @@ var EdgeLink = class {
|
|
|
322
322
|
assertCryptoAvailable();
|
|
323
323
|
this.config = config;
|
|
324
324
|
this.popup = new PopupManager();
|
|
325
|
-
|
|
326
|
-
this.expectedOrigin = config.linkUrl ? new URL(config.linkUrl).origin : new URL(envConfig.userClientUrl).origin;
|
|
325
|
+
this.expectedOrigin = new URL(getLinkUrl(config.environment, config.linkUrl)).origin;
|
|
327
326
|
this.setupMessageListener();
|
|
328
327
|
}
|
|
329
328
|
// ===========================================================================
|
|
@@ -448,9 +447,7 @@ var EdgeLink = class {
|
|
|
448
447
|
* - Returning code via postMessage
|
|
449
448
|
*/
|
|
450
449
|
buildLinkUrl(scopes) {
|
|
451
|
-
const
|
|
452
|
-
const baseUrl = this.config.linkUrl || `${envConfig.userClientUrl}/oauth/link`;
|
|
453
|
-
const url = new URL(baseUrl);
|
|
450
|
+
const url = new URL(getLinkUrl(this.config.environment, this.config.linkUrl));
|
|
454
451
|
url.searchParams.set("client_id", this.config.clientId);
|
|
455
452
|
url.searchParams.set("state", this.state);
|
|
456
453
|
url.searchParams.set("code_challenge", this.pkce.challenge);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edge-markets/connect-link",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
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.
|
|
24
|
+
"@edge-markets/connect": "^1.6.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": ">=17.0.0"
|