@edge-markets/connect-link 1.7.0 → 1.8.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 +8 -9
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -0
- package/dist/index.mjs +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ import { EdgeLink } from '@edge-markets/connect-link'
|
|
|
29
29
|
// 1. Create instance (do this once)
|
|
30
30
|
const link = new EdgeLink({
|
|
31
31
|
clientId: 'your-client-id',
|
|
32
|
-
environment: '
|
|
32
|
+
environment: 'sandbox',
|
|
33
33
|
onSuccess: (result) => {
|
|
34
34
|
// Send to your backend for token exchange
|
|
35
35
|
fetch('/api/edge/exchange', {
|
|
@@ -86,7 +86,7 @@ button.onclick = () => {
|
|
|
86
86
|
interface EdgeLinkConfig {
|
|
87
87
|
// Required
|
|
88
88
|
clientId: string // Your OAuth client ID
|
|
89
|
-
environment: EdgeEnvironment // 'production' | '
|
|
89
|
+
environment: EdgeEnvironment // 'production' | 'sandbox'
|
|
90
90
|
onSuccess: (result) => void // Called on successful auth
|
|
91
91
|
|
|
92
92
|
// Optional
|
|
@@ -98,8 +98,8 @@ interface EdgeLinkConfig {
|
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
The SDK derives the hosted Link URL from `environment`;
|
|
102
|
-
`https://oauth.staging-app.edgeboost.io/oauth/link`. `linkUrl` is only needed for
|
|
101
|
+
The SDK derives the hosted Link URL from `environment`; sandbox defaults to
|
|
102
|
+
`https://sandbox-oauth.staging-app.edgeboost.io/oauth/link`. `linkUrl` is only needed for
|
|
103
103
|
nonstandard deployments. If provided as an origin, for example
|
|
104
104
|
`https://oauth.example.com`, the SDK appends `/oauth/link`.
|
|
105
105
|
|
|
@@ -184,11 +184,11 @@ import { EdgeLink, EDGE_SCOPES } from '@edge-markets/connect-link'
|
|
|
184
184
|
|
|
185
185
|
const link = new EdgeLink({
|
|
186
186
|
clientId: 'your-client-id',
|
|
187
|
-
environment: '
|
|
187
|
+
environment: 'sandbox',
|
|
188
188
|
scopes: [
|
|
189
189
|
EDGE_SCOPES.USER_READ, // Read profile
|
|
190
190
|
EDGE_SCOPES.BALANCE_READ, // Read balance
|
|
191
|
-
// EDGE_SCOPES.TRANSFER_WRITE
|
|
191
|
+
// EDGE_SCOPES.TRANSFER_WRITE is reserved and currently unavailable
|
|
192
192
|
],
|
|
193
193
|
onSuccess: handleSuccess,
|
|
194
194
|
})
|
|
@@ -204,7 +204,7 @@ import { useEdgeLink } from '@edge-markets/connect-link'
|
|
|
204
204
|
function ConnectButton() {
|
|
205
205
|
const { open, ready, isOpen, error } = useEdgeLink({
|
|
206
206
|
clientId: process.env.NEXT_PUBLIC_EDGE_CLIENT_ID!,
|
|
207
|
-
environment: '
|
|
207
|
+
environment: 'sandbox',
|
|
208
208
|
onSuccess: async (result) => {
|
|
209
209
|
await fetch('/api/edge/exchange', {
|
|
210
210
|
method: 'POST',
|
|
@@ -254,7 +254,7 @@ function ConnectButton() {
|
|
|
254
254
|
useEffect(() => {
|
|
255
255
|
linkRef.current = new EdgeLink({
|
|
256
256
|
clientId: process.env.NEXT_PUBLIC_EDGE_CLIENT_ID!,
|
|
257
|
-
environment: '
|
|
257
|
+
environment: 'sandbox',
|
|
258
258
|
onSuccess: async (result) => {
|
|
259
259
|
await fetch('/api/edge/exchange', {
|
|
260
260
|
method: 'POST',
|
|
@@ -329,4 +329,3 @@ function ConnectButton() {
|
|
|
329
329
|
## License
|
|
330
330
|
|
|
331
331
|
MIT
|
|
332
|
-
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EdgeLinkConfigBase, EdgeScope, SdkGeolocation, EdgeLinkSuccess, EdgeLinkExit, PKCEPair } from '@edge-markets/connect';
|
|
2
|
-
export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, EDGE_CONNECT_FEATURE_UNAVAILABLE_MESSAGE, EDGE_SCOPES, EdgeEnvironment, EdgeError, EdgeFeatureUnavailableError, EdgeLinkEvent, EdgeLinkEventName, EdgeLinkExit, EdgeLinkSuccess, EdgePopupBlockedError, EdgeScope, EdgeStateMismatchError, PKCEPair, SdkGeolocation, isEdgeError, isFeatureUnavailableError } from '@edge-markets/connect';
|
|
2
|
+
export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, EDGE_CONNECT_FEATURE_UNAVAILABLE_MESSAGE, EDGE_SCOPES, EdgeEnvironment, EdgeError, EdgeFeatureUnavailableError, EdgeLinkEvent, EdgeLinkEventName, EdgeLinkExit, EdgeLinkSuccess, EdgePopupBlockedError, EdgeScope, EdgeStateMismatchError, PKCEPair, RESERVED_EDGE_SCOPES, SdkGeolocation, isEdgeError, isFeatureUnavailableError } from '@edge-markets/connect';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* EdgeLink - Popup Authentication for EDGE Connect
|
|
@@ -22,7 +22,7 @@ export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, EDGE_CONNECT_FEATURE_UNAVAILABLE_M
|
|
|
22
22
|
*
|
|
23
23
|
* const link = new EdgeLink({
|
|
24
24
|
* clientId: 'your-client-id',
|
|
25
|
-
* environment: '
|
|
25
|
+
* environment: 'sandbox',
|
|
26
26
|
* onSuccess: (result) => {
|
|
27
27
|
* // Send to your backend for token exchange
|
|
28
28
|
* fetch('/api/edge/exchange', {
|
|
@@ -80,7 +80,7 @@ interface EdgeLinkOpenOptions {
|
|
|
80
80
|
* // Create instance once
|
|
81
81
|
* const link = new EdgeLink({
|
|
82
82
|
* clientId: 'your-client-id',
|
|
83
|
-
* environment: '
|
|
83
|
+
* environment: 'sandbox',
|
|
84
84
|
* onSuccess: handleSuccess,
|
|
85
85
|
* onExit: handleExit,
|
|
86
86
|
* })
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EdgeLinkConfigBase, EdgeScope, SdkGeolocation, EdgeLinkSuccess, EdgeLinkExit, PKCEPair } from '@edge-markets/connect';
|
|
2
|
-
export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, EDGE_CONNECT_FEATURE_UNAVAILABLE_MESSAGE, EDGE_SCOPES, EdgeEnvironment, EdgeError, EdgeFeatureUnavailableError, EdgeLinkEvent, EdgeLinkEventName, EdgeLinkExit, EdgeLinkSuccess, EdgePopupBlockedError, EdgeScope, EdgeStateMismatchError, PKCEPair, SdkGeolocation, isEdgeError, isFeatureUnavailableError } from '@edge-markets/connect';
|
|
2
|
+
export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, EDGE_CONNECT_FEATURE_UNAVAILABLE_MESSAGE, EDGE_SCOPES, EdgeEnvironment, EdgeError, EdgeFeatureUnavailableError, EdgeLinkEvent, EdgeLinkEventName, EdgeLinkExit, EdgeLinkSuccess, EdgePopupBlockedError, EdgeScope, EdgeStateMismatchError, PKCEPair, RESERVED_EDGE_SCOPES, SdkGeolocation, isEdgeError, isFeatureUnavailableError } from '@edge-markets/connect';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* EdgeLink - Popup Authentication for EDGE Connect
|
|
@@ -22,7 +22,7 @@ export { ACTIVE_EDGE_SCOPES, ALL_EDGE_SCOPES, EDGE_CONNECT_FEATURE_UNAVAILABLE_M
|
|
|
22
22
|
*
|
|
23
23
|
* const link = new EdgeLink({
|
|
24
24
|
* clientId: 'your-client-id',
|
|
25
|
-
* environment: '
|
|
25
|
+
* environment: 'sandbox',
|
|
26
26
|
* onSuccess: (result) => {
|
|
27
27
|
* // Send to your backend for token exchange
|
|
28
28
|
* fetch('/api/edge/exchange', {
|
|
@@ -80,7 +80,7 @@ interface EdgeLinkOpenOptions {
|
|
|
80
80
|
* // Create instance once
|
|
81
81
|
* const link = new EdgeLink({
|
|
82
82
|
* clientId: 'your-client-id',
|
|
83
|
-
* environment: '
|
|
83
|
+
* environment: 'sandbox',
|
|
84
84
|
* onSuccess: handleSuccess,
|
|
85
85
|
* onExit: handleExit,
|
|
86
86
|
* })
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(index_exports, {
|
|
|
31
31
|
EdgeStateMismatchError: () => import_connect3.EdgeStateMismatchError,
|
|
32
32
|
EdgeTransferVerify: () => EdgeTransferVerify,
|
|
33
33
|
IframeManager: () => IframeManager,
|
|
34
|
+
RESERVED_EDGE_SCOPES: () => import_connect4.RESERVED_EDGE_SCOPES,
|
|
34
35
|
assertCryptoAvailable: () => assertCryptoAvailable,
|
|
35
36
|
collectGeolocation: () => collectGeolocation,
|
|
36
37
|
generatePKCE: () => generatePKCE,
|
|
@@ -490,6 +491,7 @@ var EdgeLink = class {
|
|
|
490
491
|
buildLinkUrl(scopes) {
|
|
491
492
|
const url = new URL((0, import_connect.getLinkUrl)(this.config.environment, this.config.linkUrl));
|
|
492
493
|
url.searchParams.set("client_id", this.config.clientId);
|
|
494
|
+
url.searchParams.set("environment", this.config.environment);
|
|
493
495
|
url.searchParams.set("state", this.state);
|
|
494
496
|
url.searchParams.set("code_challenge", this.pkce.challenge);
|
|
495
497
|
url.searchParams.set("code_challenge_method", "S256");
|
|
@@ -1376,6 +1378,7 @@ var import_connect4 = require("@edge-markets/connect");
|
|
|
1376
1378
|
EdgeStateMismatchError,
|
|
1377
1379
|
EdgeTransferVerify,
|
|
1378
1380
|
IframeManager,
|
|
1381
|
+
RESERVED_EDGE_SCOPES,
|
|
1379
1382
|
assertCryptoAvailable,
|
|
1380
1383
|
collectGeolocation,
|
|
1381
1384
|
generatePKCE,
|
package/dist/index.mjs
CHANGED
|
@@ -453,6 +453,7 @@ var EdgeLink = class {
|
|
|
453
453
|
buildLinkUrl(scopes) {
|
|
454
454
|
const url = new URL(getLinkUrl(this.config.environment, this.config.linkUrl));
|
|
455
455
|
url.searchParams.set("client_id", this.config.clientId);
|
|
456
|
+
url.searchParams.set("environment", this.config.environment);
|
|
456
457
|
url.searchParams.set("state", this.state);
|
|
457
458
|
url.searchParams.set("code_challenge", this.pkce.challenge);
|
|
458
459
|
url.searchParams.set("code_challenge_method", "S256");
|
|
@@ -1333,7 +1334,7 @@ import {
|
|
|
1333
1334
|
isEdgeError,
|
|
1334
1335
|
isFeatureUnavailableError
|
|
1335
1336
|
} from "@edge-markets/connect";
|
|
1336
|
-
import { ACTIVE_EDGE_SCOPES as ACTIVE_EDGE_SCOPES2, ALL_EDGE_SCOPES, EDGE_SCOPES } from "@edge-markets/connect";
|
|
1337
|
+
import { ACTIVE_EDGE_SCOPES as ACTIVE_EDGE_SCOPES2, ALL_EDGE_SCOPES, EDGE_SCOPES, RESERVED_EDGE_SCOPES } from "@edge-markets/connect";
|
|
1337
1338
|
export {
|
|
1338
1339
|
ACTIVE_EDGE_SCOPES2 as ACTIVE_EDGE_SCOPES,
|
|
1339
1340
|
ALL_EDGE_SCOPES,
|
|
@@ -1346,6 +1347,7 @@ export {
|
|
|
1346
1347
|
EdgeStateMismatchError,
|
|
1347
1348
|
EdgeTransferVerify,
|
|
1348
1349
|
IframeManager,
|
|
1350
|
+
RESERVED_EDGE_SCOPES,
|
|
1349
1351
|
assertCryptoAvailable,
|
|
1350
1352
|
collectGeolocation,
|
|
1351
1353
|
generatePKCE,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edge-markets/connect-link",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.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.9.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": ">=17.0.0"
|