@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 1.23.0 → 1.24.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 +9 -7
- package/dist/buildUpgradeUrl/buildUpgradeUrl.d.ts +5 -18
- package/dist/buildUpgradeUrl/buildUpgradeUrl.d.ts.map +1 -1
- package/dist/buildUpgradeUrl/buildUpgradeUrl.types.d.ts +23 -0
- package/dist/buildUpgradeUrl/buildUpgradeUrl.types.d.ts.map +1 -0
- package/dist/clearUpgradeRedirectParams/clearUpgradeRedirectParams.d.ts +34 -0
- package/dist/clearUpgradeRedirectParams/clearUpgradeRedirectParams.d.ts.map +1 -0
- package/dist/clearUpgradeRedirectParams/index.d.ts +2 -0
- package/dist/clearUpgradeRedirectParams/index.d.ts.map +1 -0
- package/dist/completeUpgradeRedirect/completeUpgradeRedirect.d.ts +70 -0
- package/dist/completeUpgradeRedirect/completeUpgradeRedirect.d.ts.map +1 -0
- package/dist/completeUpgradeRedirect/index.d.ts +2 -0
- package/dist/completeUpgradeRedirect/index.d.ts.map +1 -0
- package/dist/detectUpgradeRedirect/detectUpgradeRedirect.d.ts +42 -0
- package/dist/detectUpgradeRedirect/detectUpgradeRedirect.d.ts.map +1 -0
- package/dist/detectUpgradeRedirect/index.d.ts +2 -0
- package/dist/detectUpgradeRedirect/index.d.ts.map +1 -0
- package/dist/errors/InvalidUpgradeCallbackOriginError.d.ts +7 -0
- package/dist/errors/InvalidUpgradeCallbackOriginError.d.ts.map +1 -0
- package/dist/errors/InvalidUpgradeNativeRedirectUrlError.d.ts +5 -0
- package/dist/errors/InvalidUpgradeNativeRedirectUrlError.d.ts.map +1 -0
- package/dist/errors/UpgradeCallbackMissingOutcomeError.d.ts +5 -0
- package/dist/errors/UpgradeCallbackMissingOutcomeError.d.ts.map +1 -0
- package/dist/exports/index.d.ts +3 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/react.d.ts +1 -1
- package/dist/exports/react.d.ts.map +1 -1
- package/dist/index.cjs +41 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +39 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +239 -112
- package/dist/index.native.esm.js.map +1 -1
- package/dist/openUpgradeIframe/openUpgradeIframe.d.ts +1 -1
- package/dist/openUpgradeIframe/openUpgradeIframe.types.d.ts +1 -1
- package/dist/openUpgradePopup/openUpgradePopup.d.ts +1 -1
- package/dist/openUpgradePopup/openUpgradePopup.types.d.ts +1 -1
- package/dist/{openUpgradePopup-DQcEdgY_.esm.js → openUpgradePopup-DhnSl-2L.esm.js} +107 -29
- package/dist/openUpgradePopup-DhnSl-2L.esm.js.map +1 -0
- package/dist/{openUpgradePopup-C_vOjG3Q.cjs → openUpgradePopup-j9eg2-qt.cjs} +126 -30
- package/dist/openUpgradePopup-j9eg2-qt.cjs.map +1 -0
- package/dist/react/useUpgradeIframe/useUpgradeIframe.d.ts +25 -4
- package/dist/react/useUpgradeIframe/useUpgradeIframe.d.ts.map +1 -1
- package/dist/react/useUpgradePopup/useUpgradePopup.d.ts +2 -2
- package/dist/react/useUpgradeRedirectResult/index.d.ts +1 -1
- package/dist/react/useUpgradeRedirectResult/index.d.ts.map +1 -1
- package/dist/react/useUpgradeRedirectResult/useUpgradeRedirectResult.d.ts +30 -7
- package/dist/react/useUpgradeRedirectResult/useUpgradeRedirectResult.d.ts.map +1 -1
- package/dist/react.cjs +58 -26
- package/dist/react.cjs.map +1 -1
- package/dist/react.esm.js +58 -26
- package/dist/react.esm.js.map +1 -1
- package/dist/startUpgradeRedirect/startUpgradeRedirect.d.ts +5 -5
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/upgradeAppContract.d.ts +11 -3
- package/dist/upgradeAppContract.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/consumeUpgradeRedirect/consumeUpgradeRedirect.d.ts +0 -57
- package/dist/consumeUpgradeRedirect/consumeUpgradeRedirect.d.ts.map +0 -1
- package/dist/consumeUpgradeRedirect/index.d.ts +0 -2
- package/dist/consumeUpgradeRedirect/index.d.ts.map +0 -1
- package/dist/openUpgradePopup-C_vOjG3Q.cjs.map +0 -1
- package/dist/openUpgradePopup-DQcEdgY_.esm.js.map +0 -1
package/README.md
CHANGED
|
@@ -26,22 +26,24 @@ if (hasWalletsRequiringUpgrade()) {
|
|
|
26
26
|
|
|
27
27
|
## Redirect path
|
|
28
28
|
|
|
29
|
-
Navigate the top-level window to the hosted upgrade app, then
|
|
29
|
+
Navigate the top-level window to the hosted upgrade app, then handle the result when it returns. The return leg is two steps — `detectUpgradeRedirect` tells you whether the current URL is a return from the upgrade app, and `completeUpgradeRedirect` finishes it (refreshing the session on success) — mirroring how OAuth and device registration consume their redirects. You always pass the URL yourself (`window.location.href` in the browser, the deep-link URL in React Native).
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
import {
|
|
33
33
|
startUpgradeRedirect,
|
|
34
|
-
|
|
34
|
+
detectUpgradeRedirect,
|
|
35
|
+
completeUpgradeRedirect,
|
|
35
36
|
} from '@dynamic-labs-sdk/legacy-embedded-wallet-upgrade';
|
|
36
37
|
|
|
37
38
|
// on the "Upgrade via redirect" button
|
|
38
39
|
startUpgradeRedirect();
|
|
39
40
|
|
|
40
|
-
// once, on app load
|
|
41
|
-
|
|
42
|
-
const result = await
|
|
43
|
-
if (result?.status === 'error') {
|
|
44
|
-
|
|
41
|
+
// once, on app load
|
|
42
|
+
if (detectUpgradeRedirect({ url: window.location.href })) {
|
|
43
|
+
const result = await completeUpgradeRedirect({ url: window.location.href });
|
|
44
|
+
if (result?.status === 'error') {
|
|
45
|
+
showErrorToast();
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
48
|
```
|
|
47
49
|
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
type BuildUpgradeUrlParams
|
|
2
|
-
/**
|
|
3
|
-
* Base URL of the hosted upgrade app. Defaults to the production upgrade app;
|
|
4
|
-
* override it to target a local or preview build (e.g. during QA).
|
|
5
|
-
*/
|
|
6
|
-
baseUrl?: string;
|
|
7
|
-
/**
|
|
8
|
-
* Absolute https URL the upgrade app returns to (redirect flow) or
|
|
9
|
-
* postMessages (iframe flow) on completion. Defaults to the current page
|
|
10
|
-
* (`window.location.href`). The upgrade app rejects any non-https URL.
|
|
11
|
-
*/
|
|
12
|
-
redirectUrl?: string;
|
|
13
|
-
};
|
|
1
|
+
import type { BuildUpgradeUrlParams } from './buildUpgradeUrl.types';
|
|
14
2
|
/**
|
|
15
3
|
* Builds the URL that drives the hosted upgrade app for the client's Dynamic
|
|
16
4
|
* environment and a return target.
|
|
@@ -26,19 +14,18 @@ type BuildUpgradeUrlParams = {
|
|
|
26
14
|
* ```ts
|
|
27
15
|
* const src = buildUpgradeUrl();
|
|
28
16
|
* // or target a local upgrade app during QA:
|
|
29
|
-
* const localSrc = buildUpgradeUrl({ baseUrl: '
|
|
17
|
+
* const localSrc = buildUpgradeUrl({ baseUrl: 'http://localhost:3000' });
|
|
30
18
|
* ```
|
|
31
19
|
* @param [params] - Options for the generated URL.
|
|
32
|
-
* @param [params.redirectUrl] - Absolute https return URL; defaults to `window.location.href`.
|
|
20
|
+
* @param [params.redirectUrl] - Absolute https or http return URL; defaults to `window.location.href`.
|
|
33
21
|
* @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.
|
|
34
22
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
35
23
|
* @returns The fully-qualified upgrade app URL to load.
|
|
36
|
-
* @throws {InvalidUpgradeRedirectUrlError} When `redirectUrl` is not an absolute https URL.
|
|
37
|
-
* @throws {InvalidUpgradeBaseUrlError} When `baseUrl` is not an absolute https URL.
|
|
24
|
+
* @throws {InvalidUpgradeRedirectUrlError} When `redirectUrl` is not an absolute https or http URL.
|
|
25
|
+
* @throws {InvalidUpgradeBaseUrlError} When `baseUrl` is not an absolute https or http URL.
|
|
38
26
|
* @throws {UnavailableInServerSideError} When called during SSR without an explicit `redirectUrl`.
|
|
39
27
|
* @see startUpgradeRedirect
|
|
40
28
|
* @see openUpgradeIframe
|
|
41
29
|
*/
|
|
42
30
|
export declare const buildUpgradeUrl: ({ redirectUrl, baseUrl }?: BuildUpgradeUrlParams, client?: import("@dynamic-labs-sdk/client").DynamicClient) => string;
|
|
43
|
-
export {};
|
|
44
31
|
//# sourceMappingURL=buildUpgradeUrl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUpgradeUrl.d.ts","sourceRoot":"","sources":["../../src/buildUpgradeUrl/buildUpgradeUrl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildUpgradeUrl.d.ts","sourceRoot":"","sources":["../../src/buildUpgradeUrl/buildUpgradeUrl.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAarE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,eAAe,8BACuB,qBAAqB,gEAErE,MAqDF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for {@link buildUpgradeUrl}. Shared by the web and React Native
|
|
3
|
+
* builders so both platform variants keep an identical signature.
|
|
4
|
+
*
|
|
5
|
+
* @see buildUpgradeUrl
|
|
6
|
+
*/
|
|
7
|
+
export type BuildUpgradeUrlParams = {
|
|
8
|
+
/**
|
|
9
|
+
* Base URL of the hosted upgrade app. Defaults to the production upgrade app;
|
|
10
|
+
* override it to target a local or preview build (e.g. during QA).
|
|
11
|
+
*/
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
/**
|
|
14
|
+
* URL the upgrade app returns to on completion. On the web this is the page
|
|
15
|
+
* the redirect flow navigates back to (or the iframe origin postMessages);
|
|
16
|
+
* it defaults to the current page (`window.location.href`) and must be an
|
|
17
|
+
* absolute https or http URL. On React Native there is no current page, so it
|
|
18
|
+
* is required and may be either https/http or a safe custom app deeplink
|
|
19
|
+
* (e.g. `myapp://callback`).
|
|
20
|
+
*/
|
|
21
|
+
redirectUrl?: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=buildUpgradeUrl.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildUpgradeUrl.types.d.ts","sourceRoot":"","sources":["../../src/buildUpgradeUrl/buildUpgradeUrl.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the upgrade outcome parameter (`dynamicWaasMigrationStatus`) that the
|
|
3
|
+
* upgrade app appends to the return URL from the browser's current URL, leaving
|
|
4
|
+
* every other query parameter, the path, and the hash untouched.
|
|
5
|
+
*
|
|
6
|
+
* Call this once you have handled the outcome from `completeUpgradeRedirect` so a
|
|
7
|
+
* page refresh does not replay it. `completeUpgradeRedirect` never touches
|
|
8
|
+
* browser history, so clearing the param is your responsibility — this helper
|
|
9
|
+
* does it in one call, mirroring `clearSocialRedirectParams` and
|
|
10
|
+
* `clearDeviceRegistrationRedirectParams`. Unlike clearing the whole query
|
|
11
|
+
* string, it preserves any of your own parameters on the callback URL.
|
|
12
|
+
*
|
|
13
|
+
* This reads and rewrites `window.location`, so it can only run in the browser.
|
|
14
|
+
* Calling it during server-side rendering (no `window`) throws
|
|
15
|
+
* `UnavailableInServerSideError`. On React Native there is no browser address
|
|
16
|
+
* bar to clean — you own your navigation state — so a `.native` build throws
|
|
17
|
+
* instead.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const outcome = await completeUpgradeRedirect({ url: window.location.href });
|
|
22
|
+
* if (outcome) {
|
|
23
|
+
* handleOutcome(outcome);
|
|
24
|
+
* clearUpgradeRedirectParams();
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
* @returns Nothing. The current URL is rewritten in place via
|
|
28
|
+
* `window.history.replaceState`.
|
|
29
|
+
* @throws {UnavailableInServerSideError} When called during SSR (no `window`).
|
|
30
|
+
* @see completeUpgradeRedirect
|
|
31
|
+
* @see startUpgradeRedirect
|
|
32
|
+
*/
|
|
33
|
+
export declare const clearUpgradeRedirectParams: () => void;
|
|
34
|
+
//# sourceMappingURL=clearUpgradeRedirectParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearUpgradeRedirectParams.d.ts","sourceRoot":"","sources":["../../src/clearUpgradeRedirectParams/clearUpgradeRedirectParams.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,0BAA0B,QAAO,IAU7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clearUpgradeRedirectParams/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type WalletUpgradeOutcome } from '../upgradeAppContract';
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link completeUpgradeRedirect}.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* // Browser: read the outcome from the current page.
|
|
8
|
+
* await completeUpgradeRedirect({ url: window.location.href });
|
|
9
|
+
* ```
|
|
10
|
+
* @see completeUpgradeRedirect
|
|
11
|
+
* @see detectUpgradeRedirect
|
|
12
|
+
*/
|
|
13
|
+
export type CompleteUpgradeRedirectParams = {
|
|
14
|
+
/**
|
|
15
|
+
* The return URL to read the upgrade outcome from. Pass the URL yourself so
|
|
16
|
+
* the flow works everywhere: in the browser pass `window.location.href`; in
|
|
17
|
+
* React Native pass the deep-link URL you received. This mirrors how social
|
|
18
|
+
* sign-in and device registration consume their redirects, and keeps the
|
|
19
|
+
* function free of any implicit `window` dependency.
|
|
20
|
+
*/
|
|
21
|
+
url: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Completes the redirect upgrade path after {@link detectUpgradeRedirect}.
|
|
25
|
+
*
|
|
26
|
+
* The upgrade app sends the user back with the outcome in the
|
|
27
|
+
* `dynamicWaasMigrationStatus` query param. Once `detectUpgradeRedirect` tells
|
|
28
|
+
* you the return URL is an upgrade redirect, call this to finish it: it reads
|
|
29
|
+
* the param and, on success, refreshes the session (so the upgraded wallet
|
|
30
|
+
* appears) before returning the outcome. The refresh is best-effort — the
|
|
31
|
+
* upgrade already succeeded on the backend, so a failed refresh still reports
|
|
32
|
+
* success and reconciles on the next auth refresh. This detect-then-complete
|
|
33
|
+
* split mirrors the OAuth (`detectSocialRedirectUrl` + `completeSocialRedirect`)
|
|
34
|
+
* and
|
|
35
|
+
* device-registration (`detectDeviceRegistrationRedirect` +
|
|
36
|
+
* `completeDeviceRegistration`) flows. Returns `null` when a well-formed URL
|
|
37
|
+
* simply carries no upgrade result, so that common case is safe to call
|
|
38
|
+
* directly without `detectUpgradeRedirect` first. A malformed/unparseable URL
|
|
39
|
+
* rejects instead — either gate the call with `detectUpgradeRedirect` (which
|
|
40
|
+
* parses defensively) or surface the rejection (e.g. via
|
|
41
|
+
* `useUpgradeRedirectResult`'s `onError`).
|
|
42
|
+
*
|
|
43
|
+
* You always pass the URL (`window.location.href` in the browser, the deep-link
|
|
44
|
+
* URL in React Native), matching how social sign-in and device registration
|
|
45
|
+
* consume their redirects. The function never touches browser history, so you
|
|
46
|
+
* own clearing the param from your navigation state once you have the outcome.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* // Browser
|
|
51
|
+
* if (detectUpgradeRedirect({ url: window.location.href })) {
|
|
52
|
+
* const outcome = await completeUpgradeRedirect({ url: window.location.href });
|
|
53
|
+
* if (outcome?.status === 'error') showRetryToast();
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* // React Native: pass the deep-link URL you received.
|
|
59
|
+
* const outcome = await completeUpgradeRedirect({ url: deepLinkUrl });
|
|
60
|
+
* ```
|
|
61
|
+
* @param params - Options.
|
|
62
|
+
* @param params.url - Return URL to read the outcome from (e.g. `window.location.href`).
|
|
63
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
64
|
+
* @returns A promise resolving to the upgrade outcome, or `null` when there was no upgrade result to consume.
|
|
65
|
+
* @see detectUpgradeRedirect
|
|
66
|
+
* @see startUpgradeRedirect
|
|
67
|
+
* @see subscribeToUpgradeCompletion
|
|
68
|
+
*/
|
|
69
|
+
export declare const completeUpgradeRedirect: ({ url }: CompleteUpgradeRedirectParams, client?: import("@dynamic-labs-sdk/client").DynamicClient) => Promise<WalletUpgradeOutcome | null>;
|
|
70
|
+
//# sourceMappingURL=completeUpgradeRedirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completeUpgradeRedirect.d.ts","sourceRoot":"","sources":["../../src/completeUpgradeRedirect/completeUpgradeRedirect.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,uBAAuB,YACzB,6BAA6B,gEAErC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAoCrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/completeUpgradeRedirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for {@link detectUpgradeRedirect}.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* // Browser: check the current page.
|
|
7
|
+
* detectUpgradeRedirect({ url: window.location.href });
|
|
8
|
+
* ```
|
|
9
|
+
* @see detectUpgradeRedirect
|
|
10
|
+
* @see completeUpgradeRedirect
|
|
11
|
+
*/
|
|
12
|
+
export type DetectUpgradeRedirectParams = {
|
|
13
|
+
/**
|
|
14
|
+
* The return URL to check. In the browser pass `window.location.href`; in
|
|
15
|
+
* React Native pass the deep-link URL you received. Mirrors how social
|
|
16
|
+
* sign-in and device registration detect their redirects.
|
|
17
|
+
*/
|
|
18
|
+
url: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Detects whether the given URL is a return from the redirect upgrade path.
|
|
22
|
+
*
|
|
23
|
+
* Checks the `dynamicWaasMigrationStatus` query param for one of the two values
|
|
24
|
+
* the upgrade app emits (`success` / `error`). Use it to decide whether to run
|
|
25
|
+
* {@link completeUpgradeRedirect}, mirroring the detect-then-complete flow of
|
|
26
|
+
* OAuth (`detectSocialRedirectUrl` + `completeSocialRedirect`) and device
|
|
27
|
+
* registration (`detectDeviceRegistrationRedirect` + `completeDeviceRegistration`).
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* if (detectUpgradeRedirect({ url: window.location.href })) {
|
|
32
|
+
* const outcome = await completeUpgradeRedirect({ url: window.location.href });
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
* @param params - Options.
|
|
36
|
+
* @param params.url - Return URL to check (e.g. `window.location.href`).
|
|
37
|
+
* @returns `true` when the URL carries a recognized upgrade outcome, `false` otherwise.
|
|
38
|
+
* @see completeUpgradeRedirect
|
|
39
|
+
* @see startUpgradeRedirect
|
|
40
|
+
*/
|
|
41
|
+
export declare const detectUpgradeRedirect: ({ url, }: DetectUpgradeRedirectParams) => boolean;
|
|
42
|
+
//# sourceMappingURL=detectUpgradeRedirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectUpgradeRedirect.d.ts","sourceRoot":"","sources":["../../src/detectUpgradeRedirect/detectUpgradeRedirect.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,qBAAqB,aAE/B,2BAA2B,KAAG,OAahC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/detectUpgradeRedirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,2BAA2B,GACjC,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseError } from '@dynamic-labs-sdk/client';
|
|
2
|
+
export declare class InvalidUpgradeCallbackOriginError extends BaseError {
|
|
3
|
+
constructor({ expectedOrigin }: {
|
|
4
|
+
expectedOrigin: string;
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=InvalidUpgradeCallbackOriginError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidUpgradeCallbackOriginError.d.ts","sourceRoot":"","sources":["../../src/errors/InvalidUpgradeCallbackOriginError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,iCAAkC,SAAQ,SAAS;gBAClD,EAAE,cAAc,EAAE,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;CAY3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidUpgradeNativeRedirectUrlError.d.ts","sourceRoot":"","sources":["../../src/errors/InvalidUpgradeNativeRedirectUrlError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,oCAAqC,SAAQ,SAAS;gBAErD,WAAW,EAAE,MAAM,GAAG,SAAS;CAgC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpgradeCallbackMissingOutcomeError.d.ts","sourceRoot":"","sources":["../../src/errors/UpgradeCallbackMissingOutcomeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,kCAAmC,SAAQ,SAAS;;CAWhE"}
|
package/dist/exports/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ export { buildUpgradeUrl } from '../buildUpgradeUrl';
|
|
|
2
2
|
export { getWalletsRequiringUpgrade } from '../getWalletsRequiringUpgrade';
|
|
3
3
|
export { hasWalletsRequiringUpgrade } from '../hasWalletsRequiringUpgrade';
|
|
4
4
|
export { startUpgradeRedirect } from '../startUpgradeRedirect';
|
|
5
|
-
export {
|
|
5
|
+
export { detectUpgradeRedirect, type DetectUpgradeRedirectParams, } from '../detectUpgradeRedirect';
|
|
6
|
+
export { completeUpgradeRedirect, type CompleteUpgradeRedirectParams, } from '../completeUpgradeRedirect';
|
|
7
|
+
export { clearUpgradeRedirectParams } from '../clearUpgradeRedirectParams';
|
|
6
8
|
export { subscribeToUpgradeCompletion } from '../subscribeToUpgradeCompletion';
|
|
7
9
|
export { openUpgradeIframe } from '../openUpgradeIframe';
|
|
8
10
|
export type { UpgradeIframeSession } from '../openUpgradeIframe';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,qBAAqB,EACrB,KAAK,2BAA2B,GACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC"}
|
package/dist/exports/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { useWalletsRequiringUpgrade } from '../react/useWalletsRequiringUpgrade';
|
|
2
2
|
export { useHasWalletsRequiringUpgrade } from '../react/useHasWalletsRequiringUpgrade';
|
|
3
|
-
export { useUpgradeRedirectResult, type UseUpgradeRedirectResultParams, } from '../react/useUpgradeRedirectResult';
|
|
3
|
+
export { useUpgradeRedirectResult, type UseUpgradeRedirectResultParams, type UseUpgradeRedirectResult, } from '../react/useUpgradeRedirectResult';
|
|
4
4
|
export { useUpgradeIframe, type UseUpgradeIframeParams, type UseUpgradeIframeResult, } from '../react/useUpgradeIframe';
|
|
5
5
|
export { useUpgradePopup, type UseUpgradePopupParams, type UseUpgradePopupResult, } from '../react/useUpgradePopup';
|
|
6
6
|
//# sourceMappingURL=react.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/exports/react.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EACL,wBAAwB,EACxB,KAAK,8BAA8B,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/exports/react.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EACL,wBAAwB,EACxB,KAAK,8BAA8B,EACnC,KAAK,wBAAwB,GAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_openUpgradePopup = require('./openUpgradePopup-
|
|
1
|
+
const require_openUpgradePopup = require('./openUpgradePopup-j9eg2-qt.cjs');
|
|
2
2
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
3
3
|
let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
|
|
4
4
|
let _dynamic_labs_sdk_client_core = require("@dynamic-labs-sdk/client/core");
|
|
@@ -34,7 +34,7 @@ const hasWalletsRequiringUpgrade = (client = (0, _dynamic_labs_sdk_client.getDef
|
|
|
34
34
|
*
|
|
35
35
|
* Call this from an "Upgrade" button. The upgrade app runs full-page and, once
|
|
36
36
|
* finished, returns the user to `redirectUrl` with the outcome encoded in the
|
|
37
|
-
* URL — call {@link
|
|
37
|
+
* URL — call {@link completeUpgradeRedirect} on load to pick it up. The
|
|
38
38
|
* environment id and return URL are derived from the client and current page,
|
|
39
39
|
* so the common call is zero-arg.
|
|
40
40
|
*
|
|
@@ -44,15 +44,48 @@ const hasWalletsRequiringUpgrade = (client = (0, _dynamic_labs_sdk_client.getDef
|
|
|
44
44
|
* await startUpgradeRedirect();
|
|
45
45
|
* ```
|
|
46
46
|
* @param [params] - Options for the redirect.
|
|
47
|
-
* @param [params.redirectUrl] - Absolute https return URL; defaults to `window.location.href`.
|
|
47
|
+
* @param [params.redirectUrl] - Absolute https or http return URL; defaults to `window.location.href`.
|
|
48
48
|
* @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.
|
|
49
49
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
50
50
|
* @returns A promise that resolves once navigation has been initiated.
|
|
51
|
-
* @see
|
|
51
|
+
* @see completeUpgradeRedirect
|
|
52
52
|
* @see buildUpgradeUrl
|
|
53
53
|
*/
|
|
54
54
|
const startUpgradeRedirect = async (params = {}, client = (0, _dynamic_labs_sdk_client.getDefaultClient)()) => (0, _dynamic_labs_sdk_client_core.getCore)(client).navigate(require_openUpgradePopup.buildUpgradeUrl(params, client));
|
|
55
55
|
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/detectUpgradeRedirect/detectUpgradeRedirect.ts
|
|
58
|
+
/**
|
|
59
|
+
* Detects whether the given URL is a return from the redirect upgrade path.
|
|
60
|
+
*
|
|
61
|
+
* Checks the `dynamicWaasMigrationStatus` query param for one of the two values
|
|
62
|
+
* the upgrade app emits (`success` / `error`). Use it to decide whether to run
|
|
63
|
+
* {@link completeUpgradeRedirect}, mirroring the detect-then-complete flow of
|
|
64
|
+
* OAuth (`detectSocialRedirectUrl` + `completeSocialRedirect`) and device
|
|
65
|
+
* registration (`detectDeviceRegistrationRedirect` + `completeDeviceRegistration`).
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* if (detectUpgradeRedirect({ url: window.location.href })) {
|
|
70
|
+
* const outcome = await completeUpgradeRedirect({ url: window.location.href });
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
* @param params - Options.
|
|
74
|
+
* @param params.url - Return URL to check (e.g. `window.location.href`).
|
|
75
|
+
* @returns `true` when the URL carries a recognized upgrade outcome, `false` otherwise.
|
|
76
|
+
* @see completeUpgradeRedirect
|
|
77
|
+
* @see startUpgradeRedirect
|
|
78
|
+
*/
|
|
79
|
+
const detectUpgradeRedirect = ({ url }) => {
|
|
80
|
+
let status;
|
|
81
|
+
try {
|
|
82
|
+
status = new URL(url).searchParams.get(require_openUpgradePopup.UPGRADE_STATUS_PARAM);
|
|
83
|
+
} catch {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return status === require_openUpgradePopup.UPGRADE_STATUS_SUCCESS || status === require_openUpgradePopup.UPGRADE_STATUS_ERROR;
|
|
87
|
+
};
|
|
88
|
+
|
|
56
89
|
//#endregion
|
|
57
90
|
//#region src/errors/UpgradeIframeClosedError.ts
|
|
58
91
|
var UpgradeIframeClosedError = class extends _dynamic_labs_sdk_client.BaseError {
|
|
@@ -93,7 +126,7 @@ const UPGRADE_IFRAME_TITLE = "Dynamic embedded wallet upgrade";
|
|
|
93
126
|
* ```
|
|
94
127
|
* @param params - Iframe options.
|
|
95
128
|
* @param params.container - Element the upgrade iframe is appended into.
|
|
96
|
-
* @param [params.redirectUrl] - Absolute https completion URL; defaults to `window.location.href`.
|
|
129
|
+
* @param [params.redirectUrl] - Absolute https or http completion URL; defaults to `window.location.href`.
|
|
97
130
|
* @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.
|
|
98
131
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
99
132
|
* @returns A session handle exposing the `iframe`, a `close` function, and the `completed` promise.
|
|
@@ -142,7 +175,9 @@ const openUpgradeIframe = ({ container, redirectUrl, baseUrl }, client = (0, _dy
|
|
|
142
175
|
|
|
143
176
|
//#endregion
|
|
144
177
|
exports.buildUpgradeUrl = require_openUpgradePopup.buildUpgradeUrl;
|
|
145
|
-
exports.
|
|
178
|
+
exports.clearUpgradeRedirectParams = require_openUpgradePopup.clearUpgradeRedirectParams;
|
|
179
|
+
exports.completeUpgradeRedirect = require_openUpgradePopup.completeUpgradeRedirect;
|
|
180
|
+
exports.detectUpgradeRedirect = detectUpgradeRedirect;
|
|
146
181
|
exports.getWalletsRequiringUpgrade = require_openUpgradePopup.getWalletsRequiringUpgrade;
|
|
147
182
|
exports.hasWalletsRequiringUpgrade = hasWalletsRequiringUpgrade;
|
|
148
183
|
exports.openUpgradeIframe = openUpgradeIframe;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["getWalletsRequiringUpgrade","buildUpgradeUrl","BaseError","buildUpgradeUrl","resolveCompleted: ((outcome: WalletUpgradeOutcome) => void) | undefined","rejectCompleted: ((reason: UpgradeIframeClosedError) => void) | undefined","subscribeToUpgradeCompletion","packageName","packageVersion"],"sources":["../src/hasWalletsRequiringUpgrade/hasWalletsRequiringUpgrade.ts","../src/startUpgradeRedirect/startUpgradeRedirect.ts","../src/errors/UpgradeIframeClosedError.ts","../src/openUpgradeIframe/openUpgradeIframe.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client';\n\nimport { getWalletsRequiringUpgrade } from '../getWalletsRequiringUpgrade';\n\n/**\n * Returns whether the current session has any legacy Dynamic embedded wallet\n * that requires an upgrade to Dynamic WaaS.\n *\n * A boolean convenience over {@link getWalletsRequiringUpgrade} for the common\n * case where you only need to decide whether to surface the upgrade flow (e.g.\n * show a banner or gate a wallet's actions) rather than act on the specific\n * accounts.\n *\n * @example\n * ```ts\n * if (hasWalletsRequiringUpgrade()) {\n * showUpgradeToWaasBanner();\n * }\n * ```\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True when at least one wallet account requires an upgrade to Dynamic WaaS, false otherwise.\n * @see getWalletsRequiringUpgrade\n * @see startUpgradeRedirect\n */\nexport const hasWalletsRequiringUpgrade = (\n client = getDefaultClient()\n): boolean => getWalletsRequiringUpgrade(client).length > 0;\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getCore } from '@dynamic-labs-sdk/client/core';\n\nimport { buildUpgradeUrl } from '../buildUpgradeUrl';\n\ntype StartUpgradeRedirectParams = {\n /**\n * Base URL of the hosted upgrade app. Defaults to the production upgrade app;\n * override it to target a local or preview build (e.g. during QA).\n */\n baseUrl?: string;\n /**\n * Absolute https URL the upgrade app returns to on completion. Defaults to\n * the current page (`window.location.href`), so the outcome can be picked up\n * by {@link consumeUpgradeRedirect} when the user lands back.\n */\n redirectUrl?: string;\n};\n\n/**\n * Starts the redirect upgrade path by navigating the top-level window to the\n * hosted upgrade app.\n *\n * Call this from an \"Upgrade\" button. The upgrade app runs full-page and, once\n * finished, returns the user to `redirectUrl` with the outcome encoded in the\n * URL — call {@link consumeUpgradeRedirect} on load to pick it up. The\n * environment id and return URL are derived from the client and current page,\n * so the common call is zero-arg.\n *\n * @example\n * ```ts\n * // on the \"Upgrade via redirect\" button\n * await startUpgradeRedirect();\n * ```\n * @param [params] - Options for the redirect.\n * @param [params.redirectUrl] - Absolute https return URL; defaults to `window.location.href`.\n * @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves once navigation has been initiated.\n * @see consumeUpgradeRedirect\n * @see buildUpgradeUrl\n */\nexport const startUpgradeRedirect = async (\n params: StartUpgradeRedirectParams = {},\n client = getDefaultClient()\n): Promise<void> =>\n getCore(client).navigate(buildUpgradeUrl(params, client));\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class UpgradeIframeClosedError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'upgrade_iframe_closed_error',\n docsUrl: null,\n name: 'UpgradeIframeClosedError',\n shortMessage: 'Upgrade iframe was closed before the upgrade completed',\n });\n }\n}\n","/* eslint-disable no-restricted-globals */\n\nimport { getDefaultClient } from '@dynamic-labs-sdk/client';\n\nimport { buildUpgradeUrl } from '../buildUpgradeUrl';\nimport { UpgradeIframeClosedError } from '../errors/UpgradeIframeClosedError';\nimport { subscribeToUpgradeCompletion } from '../subscribeToUpgradeCompletion';\nimport type { WalletUpgradeOutcome } from '../upgradeAppContract';\nimport type {\n OpenUpgradeIframeParams,\n UpgradeIframeSession,\n} from './openUpgradeIframe.types';\n\nexport type { UpgradeIframeSession } from './openUpgradeIframe.types';\n\n// Permissions the upgrade app needs inside the iframe: clipboard writes plus\n// passkey (WebAuthn) get/create, which the embedded wallet upgrade relies on.\nconst UPGRADE_IFRAME_ALLOW =\n 'clipboard-write; publickey-credentials-get *; publickey-credentials-create *';\n\nconst UPGRADE_IFRAME_TITLE = 'Dynamic embedded wallet upgrade';\n\n/**\n * Runs the embedded upgrade path by mounting the hosted upgrade app in an\n * iframe inside a container you provide.\n *\n * The package renders no UI of its own: pass the element of your modal/sheet\n * and it appends the iframe, wires the origin-checked completion handshake, and\n * refreshes the session on success. `completed` resolves with the outcome once\n * the app reports back; call `close()` when the user dismisses the surface (or\n * after completion) to remove the iframe and detach the listener. Closing\n * before completion rejects `completed` with {@link UpgradeIframeClosedError}\n * so awaiters don't hang — wrap `await session.completed` in try/catch if you\n * allow early dismissal. For React Native or custom mounts, use\n * {@link subscribeToUpgradeCompletion} with {@link buildUpgradeUrl} instead.\n *\n * @example\n * ```ts\n * const session = openUpgradeIframe({ container: sheetBodyEl });\n * const { status } = await session.completed;\n * session.close();\n * ```\n * @param params - Iframe options.\n * @param params.container - Element the upgrade iframe is appended into.\n * @param [params.redirectUrl] - Absolute https completion URL; defaults to `window.location.href`.\n * @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A session handle exposing the `iframe`, a `close` function, and the `completed` promise.\n * @see subscribeToUpgradeCompletion\n * @see buildUpgradeUrl\n */\nexport const openUpgradeIframe = (\n { container, redirectUrl, baseUrl }: OpenUpgradeIframeParams,\n client = getDefaultClient()\n): UpgradeIframeSession => {\n const iframe = document.createElement('iframe');\n iframe.src = buildUpgradeUrl({ baseUrl, redirectUrl }, client);\n iframe.title = UPGRADE_IFRAME_TITLE;\n iframe.setAttribute('allow', UPGRADE_IFRAME_ALLOW);\n\n container.appendChild(iframe);\n\n // Executor runs synchronously, so both settlers are assigned before the\n // subscription below (or `close`) can ever fire.\n let resolveCompleted: ((outcome: WalletUpgradeOutcome) => void) | undefined;\n let rejectCompleted: ((reason: UpgradeIframeClosedError) => void) | undefined;\n const completed = new Promise<WalletUpgradeOutcome>((resolve, reject) => {\n resolveCompleted = resolve;\n rejectCompleted = reject;\n });\n\n // Callers may use `close()` purely for teardown and never await `completed`.\n // Attach a no-op catch so an early-close rejection is treated as handled\n // globally (no unhandled-rejection noise); a caller that does await\n // `completed` still receives the rejection in its own context.\n completed.catch(() => undefined);\n\n // Set the instant a valid completion message arrives — before the async\n // session refresh resolves `completed` via `onComplete`. `close()` checks\n // this so dismissing the surface during that refresh window does not reject a\n // promise for an upgrade that already succeeded.\n let hasReceivedCompletion = false;\n\n const unsubscribe = subscribeToUpgradeCompletion(\n {\n baseUrl,\n onComplete: (outcome) => resolveCompleted?.(outcome),\n onReceived: () => {\n hasReceivedCompletion = true;\n },\n },\n client\n );\n\n const close = () => {\n unsubscribe();\n iframe.remove();\n // Reject `completed` only as a genuine cancellation — i.e. no completion\n // has been received yet — so anything awaiting it doesn't hang forever. If\n // a completion already arrived, `onComplete` (after the refresh) resolves\n // `completed` with the real outcome, so we must not reject here.\n if (!hasReceivedCompletion) {\n rejectCompleted?.(new UpgradeIframeClosedError());\n }\n };\n\n return { close, completed, iframe };\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\n\nassertPackageVersion(packageName, packageVersion);\n\nexport { buildUpgradeUrl } from '../buildUpgradeUrl';\nexport { getWalletsRequiringUpgrade } from '../getWalletsRequiringUpgrade';\nexport { hasWalletsRequiringUpgrade } from '../hasWalletsRequiringUpgrade';\nexport { startUpgradeRedirect } from '../startUpgradeRedirect';\nexport {\n consumeUpgradeRedirect,\n type ConsumeUpgradeRedirectParams,\n} from '../consumeUpgradeRedirect';\nexport { subscribeToUpgradeCompletion } from '../subscribeToUpgradeCompletion';\nexport { openUpgradeIframe } from '../openUpgradeIframe';\nexport type { UpgradeIframeSession } from '../openUpgradeIframe';\nexport { openUpgradePopup } from '../openUpgradePopup';\nexport type { UpgradePopupSession } from '../openUpgradePopup';\nexport type {\n WalletUpgradeOutcome,\n WalletUpgradeStatus,\n} from '../upgradeAppContract';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,8BACX,yDAA2B,KACfA,oDAA2B,OAAO,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgB1D,MAAa,uBAAuB,OAClC,SAAqC,EAAE,EACvC,yDAA2B,gDAEnB,OAAO,CAAC,SAASC,yCAAgB,QAAQ,OAAO,CAAC;;;;AC5C3D,IAAa,2BAAb,cAA8CC,mCAAU;CACtD,cAAc;AACZ,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;;;;;;ACON,MAAM,uBACJ;AAEF,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B7B,MAAa,qBACX,EAAE,WAAW,aAAa,WAC1B,yDAA2B,KACF;CACzB,MAAM,SAAS,SAAS,cAAc,SAAS;AAC/C,QAAO,MAAMC,yCAAgB;EAAE;EAAS;EAAa,EAAE,OAAO;AAC9D,QAAO,QAAQ;AACf,QAAO,aAAa,SAAS,qBAAqB;AAElD,WAAU,YAAY,OAAO;CAI7B,IAAIC;CACJ,IAAIC;CACJ,MAAM,YAAY,IAAI,SAA+B,SAAS,WAAW;AACvE,qBAAmB;AACnB,oBAAkB;GAClB;AAMF,WAAU,YAAY,OAAU;CAMhC,IAAI,wBAAwB;CAE5B,MAAM,cAAcC,sDAClB;EACE;EACA,aAAa,YAAY,mBAAmB,QAAQ;EACpD,kBAAkB;AAChB,2BAAwB;;EAE3B,EACD,OACD;CAED,MAAM,cAAc;AAClB,eAAa;AACb,SAAO,QAAQ;AAKf,MAAI,CAAC,sBACH,mBAAkB,IAAI,0BAA0B,CAAC;;AAIrD,QAAO;EAAE;EAAO;EAAW;EAAQ;;;;;mECnGhBC,+BAAaC,iCAAe"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["getWalletsRequiringUpgrade","buildUpgradeUrl","status: string | null","UPGRADE_STATUS_PARAM","UPGRADE_STATUS_SUCCESS","UPGRADE_STATUS_ERROR","BaseError","buildUpgradeUrl","resolveCompleted: ((outcome: WalletUpgradeOutcome) => void) | undefined","rejectCompleted: ((reason: UpgradeIframeClosedError) => void) | undefined","subscribeToUpgradeCompletion","packageName","packageVersion"],"sources":["../src/hasWalletsRequiringUpgrade/hasWalletsRequiringUpgrade.ts","../src/startUpgradeRedirect/startUpgradeRedirect.ts","../src/detectUpgradeRedirect/detectUpgradeRedirect.ts","../src/errors/UpgradeIframeClosedError.ts","../src/openUpgradeIframe/openUpgradeIframe.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client';\n\nimport { getWalletsRequiringUpgrade } from '../getWalletsRequiringUpgrade';\n\n/**\n * Returns whether the current session has any legacy Dynamic embedded wallet\n * that requires an upgrade to Dynamic WaaS.\n *\n * A boolean convenience over {@link getWalletsRequiringUpgrade} for the common\n * case where you only need to decide whether to surface the upgrade flow (e.g.\n * show a banner or gate a wallet's actions) rather than act on the specific\n * accounts.\n *\n * @example\n * ```ts\n * if (hasWalletsRequiringUpgrade()) {\n * showUpgradeToWaasBanner();\n * }\n * ```\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True when at least one wallet account requires an upgrade to Dynamic WaaS, false otherwise.\n * @see getWalletsRequiringUpgrade\n * @see startUpgradeRedirect\n */\nexport const hasWalletsRequiringUpgrade = (\n client = getDefaultClient()\n): boolean => getWalletsRequiringUpgrade(client).length > 0;\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getCore } from '@dynamic-labs-sdk/client/core';\n\nimport { buildUpgradeUrl } from '../buildUpgradeUrl';\n\ntype StartUpgradeRedirectParams = {\n /**\n * Base URL of the hosted upgrade app. Defaults to the production upgrade app;\n * override it to target a local or preview build (e.g. during QA).\n */\n baseUrl?: string;\n /**\n * Absolute https or http URL the upgrade app returns to on completion. Defaults to\n * the current page (`window.location.href`), so the outcome can be picked up\n * by {@link completeUpgradeRedirect} when the user lands back.\n */\n redirectUrl?: string;\n};\n\n/**\n * Starts the redirect upgrade path by navigating the top-level window to the\n * hosted upgrade app.\n *\n * Call this from an \"Upgrade\" button. The upgrade app runs full-page and, once\n * finished, returns the user to `redirectUrl` with the outcome encoded in the\n * URL — call {@link completeUpgradeRedirect} on load to pick it up. The\n * environment id and return URL are derived from the client and current page,\n * so the common call is zero-arg.\n *\n * @example\n * ```ts\n * // on the \"Upgrade via redirect\" button\n * await startUpgradeRedirect();\n * ```\n * @param [params] - Options for the redirect.\n * @param [params.redirectUrl] - Absolute https or http return URL; defaults to `window.location.href`.\n * @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves once navigation has been initiated.\n * @see completeUpgradeRedirect\n * @see buildUpgradeUrl\n */\nexport const startUpgradeRedirect = async (\n params: StartUpgradeRedirectParams = {},\n client = getDefaultClient()\n): Promise<void> =>\n getCore(client).navigate(buildUpgradeUrl(params, client));\n","import {\n UPGRADE_STATUS_ERROR,\n UPGRADE_STATUS_PARAM,\n UPGRADE_STATUS_SUCCESS,\n} from '../upgradeAppContract';\n\n/**\n * Options for {@link detectUpgradeRedirect}.\n *\n * @example\n * ```ts\n * // Browser: check the current page.\n * detectUpgradeRedirect({ url: window.location.href });\n * ```\n * @see detectUpgradeRedirect\n * @see completeUpgradeRedirect\n */\nexport type DetectUpgradeRedirectParams = {\n /**\n * The return URL to check. In the browser pass `window.location.href`; in\n * React Native pass the deep-link URL you received. Mirrors how social\n * sign-in and device registration detect their redirects.\n */\n url: string;\n};\n\n/**\n * Detects whether the given URL is a return from the redirect upgrade path.\n *\n * Checks the `dynamicWaasMigrationStatus` query param for one of the two values\n * the upgrade app emits (`success` / `error`). Use it to decide whether to run\n * {@link completeUpgradeRedirect}, mirroring the detect-then-complete flow of\n * OAuth (`detectSocialRedirectUrl` + `completeSocialRedirect`) and device\n * registration (`detectDeviceRegistrationRedirect` + `completeDeviceRegistration`).\n *\n * @example\n * ```ts\n * if (detectUpgradeRedirect({ url: window.location.href })) {\n * const outcome = await completeUpgradeRedirect({ url: window.location.href });\n * }\n * ```\n * @param params - Options.\n * @param params.url - Return URL to check (e.g. `window.location.href`).\n * @returns `true` when the URL carries a recognized upgrade outcome, `false` otherwise.\n * @see completeUpgradeRedirect\n * @see startUpgradeRedirect\n */\nexport const detectUpgradeRedirect = ({\n url,\n}: DetectUpgradeRedirectParams): boolean => {\n let status: string | null;\n\n try {\n status = new URL(url).searchParams.get(UPGRADE_STATUS_PARAM);\n } catch {\n // A malformed URL is never one of our redirects.\n return false;\n }\n\n // Only the two values the upgrade app emits count; ignore anything else\n // (including tampered values) so a stray param cannot trigger completion.\n return status === UPGRADE_STATUS_SUCCESS || status === UPGRADE_STATUS_ERROR;\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class UpgradeIframeClosedError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'upgrade_iframe_closed_error',\n docsUrl: null,\n name: 'UpgradeIframeClosedError',\n shortMessage: 'Upgrade iframe was closed before the upgrade completed',\n });\n }\n}\n","/* eslint-disable no-restricted-globals */\n\nimport { getDefaultClient } from '@dynamic-labs-sdk/client';\n\nimport { buildUpgradeUrl } from '../buildUpgradeUrl';\nimport { UpgradeIframeClosedError } from '../errors/UpgradeIframeClosedError';\nimport { subscribeToUpgradeCompletion } from '../subscribeToUpgradeCompletion';\nimport type { WalletUpgradeOutcome } from '../upgradeAppContract';\nimport type {\n OpenUpgradeIframeParams,\n UpgradeIframeSession,\n} from './openUpgradeIframe.types';\n\nexport type { UpgradeIframeSession } from './openUpgradeIframe.types';\n\n// Permissions the upgrade app needs inside the iframe: clipboard writes plus\n// passkey (WebAuthn) get/create, which the embedded wallet upgrade relies on.\nconst UPGRADE_IFRAME_ALLOW =\n 'clipboard-write; publickey-credentials-get *; publickey-credentials-create *';\n\nconst UPGRADE_IFRAME_TITLE = 'Dynamic embedded wallet upgrade';\n\n/**\n * Runs the embedded upgrade path by mounting the hosted upgrade app in an\n * iframe inside a container you provide.\n *\n * The package renders no UI of its own: pass the element of your modal/sheet\n * and it appends the iframe, wires the origin-checked completion handshake, and\n * refreshes the session on success. `completed` resolves with the outcome once\n * the app reports back; call `close()` when the user dismisses the surface (or\n * after completion) to remove the iframe and detach the listener. Closing\n * before completion rejects `completed` with {@link UpgradeIframeClosedError}\n * so awaiters don't hang — wrap `await session.completed` in try/catch if you\n * allow early dismissal. For React Native or custom mounts, use\n * {@link subscribeToUpgradeCompletion} with {@link buildUpgradeUrl} instead.\n *\n * @example\n * ```ts\n * const session = openUpgradeIframe({ container: sheetBodyEl });\n * const { status } = await session.completed;\n * session.close();\n * ```\n * @param params - Iframe options.\n * @param params.container - Element the upgrade iframe is appended into.\n * @param [params.redirectUrl] - Absolute https or http completion URL; defaults to `window.location.href`.\n * @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A session handle exposing the `iframe`, a `close` function, and the `completed` promise.\n * @see subscribeToUpgradeCompletion\n * @see buildUpgradeUrl\n */\nexport const openUpgradeIframe = (\n { container, redirectUrl, baseUrl }: OpenUpgradeIframeParams,\n client = getDefaultClient()\n): UpgradeIframeSession => {\n const iframe = document.createElement('iframe');\n iframe.src = buildUpgradeUrl({ baseUrl, redirectUrl }, client);\n iframe.title = UPGRADE_IFRAME_TITLE;\n iframe.setAttribute('allow', UPGRADE_IFRAME_ALLOW);\n\n container.appendChild(iframe);\n\n // Executor runs synchronously, so both settlers are assigned before the\n // subscription below (or `close`) can ever fire.\n let resolveCompleted: ((outcome: WalletUpgradeOutcome) => void) | undefined;\n let rejectCompleted: ((reason: UpgradeIframeClosedError) => void) | undefined;\n const completed = new Promise<WalletUpgradeOutcome>((resolve, reject) => {\n resolveCompleted = resolve;\n rejectCompleted = reject;\n });\n\n // Callers may use `close()` purely for teardown and never await `completed`.\n // Attach a no-op catch so an early-close rejection is treated as handled\n // globally (no unhandled-rejection noise); a caller that does await\n // `completed` still receives the rejection in its own context.\n completed.catch(() => undefined);\n\n // Set the instant a valid completion message arrives — before the async\n // session refresh resolves `completed` via `onComplete`. `close()` checks\n // this so dismissing the surface during that refresh window does not reject a\n // promise for an upgrade that already succeeded.\n let hasReceivedCompletion = false;\n\n const unsubscribe = subscribeToUpgradeCompletion(\n {\n baseUrl,\n onComplete: (outcome) => resolveCompleted?.(outcome),\n onReceived: () => {\n hasReceivedCompletion = true;\n },\n },\n client\n );\n\n const close = () => {\n unsubscribe();\n iframe.remove();\n // Reject `completed` only as a genuine cancellation — i.e. no completion\n // has been received yet — so anything awaiting it doesn't hang forever. If\n // a completion already arrived, `onComplete` (after the refresh) resolves\n // `completed` with the real outcome, so we must not reject here.\n if (!hasReceivedCompletion) {\n rejectCompleted?.(new UpgradeIframeClosedError());\n }\n };\n\n return { close, completed, iframe };\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\n\nassertPackageVersion(packageName, packageVersion);\n\nexport { buildUpgradeUrl } from '../buildUpgradeUrl';\nexport { getWalletsRequiringUpgrade } from '../getWalletsRequiringUpgrade';\nexport { hasWalletsRequiringUpgrade } from '../hasWalletsRequiringUpgrade';\nexport { startUpgradeRedirect } from '../startUpgradeRedirect';\nexport {\n detectUpgradeRedirect,\n type DetectUpgradeRedirectParams,\n} from '../detectUpgradeRedirect';\nexport {\n completeUpgradeRedirect,\n type CompleteUpgradeRedirectParams,\n} from '../completeUpgradeRedirect';\nexport { clearUpgradeRedirectParams } from '../clearUpgradeRedirectParams';\nexport { subscribeToUpgradeCompletion } from '../subscribeToUpgradeCompletion';\nexport { openUpgradeIframe } from '../openUpgradeIframe';\nexport type { UpgradeIframeSession } from '../openUpgradeIframe';\nexport { openUpgradePopup } from '../openUpgradePopup';\nexport type { UpgradePopupSession } from '../openUpgradePopup';\nexport type {\n WalletUpgradeOutcome,\n WalletUpgradeStatus,\n} from '../upgradeAppContract';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,8BACX,yDAA2B,KACfA,oDAA2B,OAAO,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgB1D,MAAa,uBAAuB,OAClC,SAAqC,EAAE,EACvC,yDAA2B,gDAEnB,OAAO,CAAC,SAASC,yCAAgB,QAAQ,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;ACC3D,MAAa,yBAAyB,EACpC,UAC0C;CAC1C,IAAIC;AAEJ,KAAI;AACF,WAAS,IAAI,IAAI,IAAI,CAAC,aAAa,IAAIC,8CAAqB;SACtD;AAEN,SAAO;;AAKT,QAAO,WAAWC,mDAA0B,WAAWC;;;;;AC3DzD,IAAa,2BAAb,cAA8CC,mCAAU;CACtD,cAAc;AACZ,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;;;;;;ACON,MAAM,uBACJ;AAEF,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B7B,MAAa,qBACX,EAAE,WAAW,aAAa,WAC1B,yDAA2B,KACF;CACzB,MAAM,SAAS,SAAS,cAAc,SAAS;AAC/C,QAAO,MAAMC,yCAAgB;EAAE;EAAS;EAAa,EAAE,OAAO;AAC9D,QAAO,QAAQ;AACf,QAAO,aAAa,SAAS,qBAAqB;AAElD,WAAU,YAAY,OAAO;CAI7B,IAAIC;CACJ,IAAIC;CACJ,MAAM,YAAY,IAAI,SAA+B,SAAS,WAAW;AACvE,qBAAmB;AACnB,oBAAkB;GAClB;AAMF,WAAU,YAAY,OAAU;CAMhC,IAAI,wBAAwB;CAE5B,MAAM,cAAcC,sDAClB;EACE;EACA,aAAa,YAAY,mBAAmB,QAAQ;EACpD,kBAAkB;AAChB,2BAAwB;;EAE3B,EACD,OACD;CAED,MAAM,cAAc;AAClB,eAAa;AACb,SAAO,QAAQ;AAKf,MAAI,CAAC,sBACH,mBAAkB,IAAI,0BAA0B,CAAC;;AAIrD,QAAO;EAAE;EAAO;EAAW;EAAQ;;;;;mECnGhBC,+BAAaC,iCAAe"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as getWalletsRequiringUpgrade, c as UPGRADE_STATUS_PARAM, d as version, i as completeUpgradeRedirect, l as UPGRADE_STATUS_SUCCESS, n as subscribeToUpgradeCompletion, o as buildUpgradeUrl, r as clearUpgradeRedirectParams, s as UPGRADE_STATUS_ERROR, t as openUpgradePopup, u as name } from "./openUpgradePopup-DhnSl-2L.esm.js";
|
|
2
2
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
3
3
|
import { BaseError, getDefaultClient } from "@dynamic-labs-sdk/client";
|
|
4
4
|
import { getCore } from "@dynamic-labs-sdk/client/core";
|
|
@@ -34,7 +34,7 @@ const hasWalletsRequiringUpgrade = (client = getDefaultClient()) => getWalletsRe
|
|
|
34
34
|
*
|
|
35
35
|
* Call this from an "Upgrade" button. The upgrade app runs full-page and, once
|
|
36
36
|
* finished, returns the user to `redirectUrl` with the outcome encoded in the
|
|
37
|
-
* URL — call {@link
|
|
37
|
+
* URL — call {@link completeUpgradeRedirect} on load to pick it up. The
|
|
38
38
|
* environment id and return URL are derived from the client and current page,
|
|
39
39
|
* so the common call is zero-arg.
|
|
40
40
|
*
|
|
@@ -44,15 +44,48 @@ const hasWalletsRequiringUpgrade = (client = getDefaultClient()) => getWalletsRe
|
|
|
44
44
|
* await startUpgradeRedirect();
|
|
45
45
|
* ```
|
|
46
46
|
* @param [params] - Options for the redirect.
|
|
47
|
-
* @param [params.redirectUrl] - Absolute https return URL; defaults to `window.location.href`.
|
|
47
|
+
* @param [params.redirectUrl] - Absolute https or http return URL; defaults to `window.location.href`.
|
|
48
48
|
* @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.
|
|
49
49
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
50
50
|
* @returns A promise that resolves once navigation has been initiated.
|
|
51
|
-
* @see
|
|
51
|
+
* @see completeUpgradeRedirect
|
|
52
52
|
* @see buildUpgradeUrl
|
|
53
53
|
*/
|
|
54
54
|
const startUpgradeRedirect = async (params = {}, client = getDefaultClient()) => getCore(client).navigate(buildUpgradeUrl(params, client));
|
|
55
55
|
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/detectUpgradeRedirect/detectUpgradeRedirect.ts
|
|
58
|
+
/**
|
|
59
|
+
* Detects whether the given URL is a return from the redirect upgrade path.
|
|
60
|
+
*
|
|
61
|
+
* Checks the `dynamicWaasMigrationStatus` query param for one of the two values
|
|
62
|
+
* the upgrade app emits (`success` / `error`). Use it to decide whether to run
|
|
63
|
+
* {@link completeUpgradeRedirect}, mirroring the detect-then-complete flow of
|
|
64
|
+
* OAuth (`detectSocialRedirectUrl` + `completeSocialRedirect`) and device
|
|
65
|
+
* registration (`detectDeviceRegistrationRedirect` + `completeDeviceRegistration`).
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* if (detectUpgradeRedirect({ url: window.location.href })) {
|
|
70
|
+
* const outcome = await completeUpgradeRedirect({ url: window.location.href });
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
* @param params - Options.
|
|
74
|
+
* @param params.url - Return URL to check (e.g. `window.location.href`).
|
|
75
|
+
* @returns `true` when the URL carries a recognized upgrade outcome, `false` otherwise.
|
|
76
|
+
* @see completeUpgradeRedirect
|
|
77
|
+
* @see startUpgradeRedirect
|
|
78
|
+
*/
|
|
79
|
+
const detectUpgradeRedirect = ({ url }) => {
|
|
80
|
+
let status;
|
|
81
|
+
try {
|
|
82
|
+
status = new URL(url).searchParams.get(UPGRADE_STATUS_PARAM);
|
|
83
|
+
} catch {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return status === UPGRADE_STATUS_SUCCESS || status === UPGRADE_STATUS_ERROR;
|
|
87
|
+
};
|
|
88
|
+
|
|
56
89
|
//#endregion
|
|
57
90
|
//#region src/errors/UpgradeIframeClosedError.ts
|
|
58
91
|
var UpgradeIframeClosedError = class extends BaseError {
|
|
@@ -93,7 +126,7 @@ const UPGRADE_IFRAME_TITLE = "Dynamic embedded wallet upgrade";
|
|
|
93
126
|
* ```
|
|
94
127
|
* @param params - Iframe options.
|
|
95
128
|
* @param params.container - Element the upgrade iframe is appended into.
|
|
96
|
-
* @param [params.redirectUrl] - Absolute https completion URL; defaults to `window.location.href`.
|
|
129
|
+
* @param [params.redirectUrl] - Absolute https or http completion URL; defaults to `window.location.href`.
|
|
97
130
|
* @param [params.baseUrl] - Upgrade app base URL; defaults to the production app.
|
|
98
131
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
99
132
|
* @returns A session handle exposing the `iframe`, a `close` function, and the `completed` promise.
|
|
@@ -141,5 +174,5 @@ const openUpgradeIframe = ({ container, redirectUrl, baseUrl }, client = getDefa
|
|
|
141
174
|
assertPackageVersion(name, version);
|
|
142
175
|
|
|
143
176
|
//#endregion
|
|
144
|
-
export { buildUpgradeUrl,
|
|
177
|
+
export { buildUpgradeUrl, clearUpgradeRedirectParams, completeUpgradeRedirect, detectUpgradeRedirect, getWalletsRequiringUpgrade, hasWalletsRequiringUpgrade, openUpgradeIframe, openUpgradePopup, startUpgradeRedirect, subscribeToUpgradeCompletion };
|
|
145
178
|
//# sourceMappingURL=index.esm.js.map
|