@imtbl/passport 2.6.0 → 2.6.2-alpha.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/dist/browser/index.js +106 -40
- package/dist/node/index.cjs +116 -50
- package/dist/node/index.js +107 -41
- package/dist/types/Passport.d.ts +5 -2
- package/dist/types/authManager.d.ts +4 -2
- package/dist/types/confirmation/embeddedLoginPrompt.d.ts +10 -0
- package/dist/types/confirmation/index.d.ts +1 -0
- package/dist/types/confirmation/types.d.ts +20 -3
- package/dist/types/overlay/{index.d.ts → confirmationOverlay.d.ts} +1 -1
- package/dist/types/overlay/confirmationOverlay.test.d.ts +1 -0
- package/dist/types/overlay/constants.d.ts +1 -0
- package/dist/types/overlay/elements.d.ts +2 -0
- package/dist/types/overlay/embeddedLoginPromptOverlay.d.ts +7 -0
- package/dist/types/overlay/embeddedLoginPromptOverlay.test.d.ts +1 -0
- package/dist/types/types.d.ts +1 -1
- package/package.json +7 -7
- /package/dist/types/{overlay/overlay.test.d.ts → confirmation/embeddedLoginPrompt.test.d.ts} +0 -0
package/dist/types/Passport.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import MagicAdapter from './magic/magicAdapter';
|
|
|
6
6
|
import { PassportImxProviderFactory } from './starkEx';
|
|
7
7
|
import { PassportConfiguration } from './config';
|
|
8
8
|
import { DirectLoginOptions, DeviceTokenResponse, LinkedWallet, LinkWalletParams, PassportEventMap, PassportModuleConfiguration, UserProfile } from './types';
|
|
9
|
-
import { ConfirmationScreen } from './confirmation';
|
|
9
|
+
import { ConfirmationScreen, EmbeddedLoginPrompt } from './confirmation';
|
|
10
10
|
import { Provider } from './zkEvm/types';
|
|
11
11
|
import TypedEventEmitter from './utils/typedEventEmitter';
|
|
12
12
|
import GuardianClient from './guardian';
|
|
@@ -15,6 +15,7 @@ export declare const buildPrivateVars: (passportModuleConfiguration: PassportMod
|
|
|
15
15
|
authManager: AuthManager;
|
|
16
16
|
magicAdapter: MagicAdapter;
|
|
17
17
|
confirmationScreen: ConfirmationScreen;
|
|
18
|
+
embeddedLoginPrompt: EmbeddedLoginPrompt;
|
|
18
19
|
immutableXClient: IMXClient;
|
|
19
20
|
multiRollupApiClients: MultiRollupApiClients;
|
|
20
21
|
passportEventEmitter: TypedEventEmitter<PassportEventMap>;
|
|
@@ -25,6 +26,7 @@ export declare class Passport {
|
|
|
25
26
|
private readonly authManager;
|
|
26
27
|
private readonly config;
|
|
27
28
|
private readonly confirmationScreen;
|
|
29
|
+
private readonly embeddedLoginPrompt;
|
|
28
30
|
private readonly immutableXClient;
|
|
29
31
|
private readonly magicAdapter;
|
|
30
32
|
private readonly multiRollupApiClients;
|
|
@@ -83,9 +85,10 @@ export declare class Passport {
|
|
|
83
85
|
/**
|
|
84
86
|
* Initiates a PKCE flow login.
|
|
85
87
|
* @param {DirectLoginOptions} [directLoginOptions] - If provided, directly redirects to the specified login method
|
|
88
|
+
* @param {string} [imPassportTraceId] - The trace ID for the PKCE flow
|
|
86
89
|
* @returns {string} The authorization URL for the PKCE flow
|
|
87
90
|
*/
|
|
88
|
-
loginWithPKCEFlow(directLoginOptions?: DirectLoginOptions): Promise<string>;
|
|
91
|
+
loginWithPKCEFlow(directLoginOptions?: DirectLoginOptions, imPassportTraceId?: string): Promise<string>;
|
|
89
92
|
/**
|
|
90
93
|
* Handles the PKCE flow login callback.
|
|
91
94
|
* @param {string} authorizationCode - The authorization code received from the OAuth provider
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { DirectLoginOptions, User, DeviceTokenResponse, UserZkEvm, UserImx } from './types';
|
|
2
2
|
import { PassportConfiguration } from './config';
|
|
3
|
+
import { EmbeddedLoginPrompt } from './confirmation';
|
|
3
4
|
export default class AuthManager {
|
|
4
5
|
private userManager;
|
|
5
6
|
private deviceCredentialsManager;
|
|
6
7
|
private readonly config;
|
|
8
|
+
private readonly embeddedLoginPrompt;
|
|
7
9
|
private readonly logoutMode;
|
|
8
10
|
/**
|
|
9
11
|
* Promise that is used to prevent multiple concurrent calls to the refresh token endpoint.
|
|
10
12
|
*/
|
|
11
13
|
private refreshingPromise;
|
|
12
|
-
constructor(config: PassportConfiguration);
|
|
14
|
+
constructor(config: PassportConfiguration, embeddedLoginPrompt: EmbeddedLoginPrompt);
|
|
13
15
|
private static mapOidcUserToDomainModel;
|
|
14
16
|
private static mapDeviceTokenResponseToOidcUser;
|
|
15
17
|
private buildExtraQueryParams;
|
|
@@ -26,7 +28,7 @@ export default class AuthManager {
|
|
|
26
28
|
getUserOrLogin(): Promise<User>;
|
|
27
29
|
private static shouldUseSigninPopupCallback;
|
|
28
30
|
loginCallback(): Promise<undefined | User>;
|
|
29
|
-
getPKCEAuthorizationUrl(directLoginOptions?: DirectLoginOptions): Promise<string>;
|
|
31
|
+
getPKCEAuthorizationUrl(directLoginOptions?: DirectLoginOptions, imPassportTraceId?: string): Promise<string>;
|
|
30
32
|
loginWithPKCEFlowCallback(authorizationCode: string, state: string): Promise<User>;
|
|
31
33
|
private getPKCEToken;
|
|
32
34
|
storeTokens(tokenResponse: DeviceTokenResponse): Promise<User>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EmbeddedLoginPromptResult } from './types';
|
|
2
|
+
import { PassportConfiguration } from '../config';
|
|
3
|
+
export default class EmbeddedLoginPrompt {
|
|
4
|
+
private config;
|
|
5
|
+
constructor(config: PassportConfiguration);
|
|
6
|
+
private getHref;
|
|
7
|
+
private static appendIFrameStylesIfNeeded;
|
|
8
|
+
private getEmbeddedLoginIFrame;
|
|
9
|
+
displayEmbeddedLoginPrompt(): Promise<EmbeddedLoginPromptResult>;
|
|
10
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { DirectLoginMethod, MarketingConsentStatus } from '../types';
|
|
2
|
+
export declare enum ConfirmationSendMessage {
|
|
2
3
|
CONFIRMATION_START = "confirmation_start"
|
|
3
4
|
}
|
|
4
|
-
export declare enum
|
|
5
|
+
export declare enum ConfirmationReceiveMessage {
|
|
5
6
|
CONFIRMATION_WINDOW_READY = "confirmation_window_ready",
|
|
6
7
|
TRANSACTION_CONFIRMED = "transaction_confirmed",
|
|
7
8
|
TRANSACTION_ERROR = "transaction_error",
|
|
@@ -10,7 +11,23 @@ export declare enum ReceiveMessage {
|
|
|
10
11
|
MESSAGE_ERROR = "message_error",
|
|
11
12
|
MESSAGE_REJECTED = "message_rejected"
|
|
12
13
|
}
|
|
14
|
+
export declare enum EmbeddedLoginPromptReceiveMessage {
|
|
15
|
+
LOGIN_METHOD_SELECTED = "login_method_selected",
|
|
16
|
+
LOGIN_PROMPT_ERROR = "login_prompt_error",
|
|
17
|
+
LOGIN_PROMPT_CLOSED = "login_prompt_closed"
|
|
18
|
+
}
|
|
13
19
|
export type ConfirmationResult = {
|
|
14
20
|
confirmed: boolean;
|
|
15
21
|
};
|
|
16
|
-
export
|
|
22
|
+
export type EmbeddedLoginPromptResult = {
|
|
23
|
+
marketingConsentStatus: MarketingConsentStatus;
|
|
24
|
+
imPassportTraceId: string;
|
|
25
|
+
} & ({
|
|
26
|
+
directLoginMethod: 'email';
|
|
27
|
+
email: string;
|
|
28
|
+
} | {
|
|
29
|
+
directLoginMethod: Exclude<DirectLoginMethod, 'email'>;
|
|
30
|
+
email?: never;
|
|
31
|
+
});
|
|
32
|
+
export declare const PASSPORT_CONFIRMATION_EVENT_TYPE = "imx_passport_confirmation";
|
|
33
|
+
export declare const EMBEDDED_LOGIN_PROMPT_EVENT_TYPE = "im_passport_embedded_login_prompt";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const PASSPORT_OVERLAY_ID = "passport-overlay";
|
|
2
|
+
export declare const PASSPORT_OVERLAY_CONTENTS_ID = "passport-overlay-contents";
|
|
2
3
|
export declare const PASSPORT_OVERLAY_CLOSE_ID = "passport-overlay-close";
|
|
3
4
|
export declare const PASSPORT_OVERLAY_TRY_AGAIN_ID = "passport-overlay-try-again";
|
|
4
5
|
export declare const CLOSE_BUTTON_SVG = "\n <svg\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style=\"width: 20px !important;\"\n >\n <path\n d=\"M16.25 5.75833L14.2417 3.75L10 7.99167L5.75833 3.75L3.75 5.75833L7.99167 10L3.75 14.2417L5.75833 16.25L10 12.0083L14.2417 16.25L16.25 14.2417L12.0083 10L16.25 5.75833Z\"\n fill=\"#F3F3F3\"\n />\n </svg>\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export interface PassportOverrides {
|
|
|
79
79
|
export interface PopupOverlayOptions {
|
|
80
80
|
disableGenericPopupOverlay?: boolean;
|
|
81
81
|
disableBlockedPopupOverlay?: boolean;
|
|
82
|
+
disableHeadlessLoginPromptOverlay?: boolean;
|
|
82
83
|
}
|
|
83
84
|
export interface PassportModuleConfiguration extends ModuleConfiguration<PassportOverrides>, OidcConfiguration {
|
|
84
85
|
/**
|
|
@@ -157,7 +158,6 @@ export declare enum MarketingConsentStatus {
|
|
|
157
158
|
Unsubscribed = "unsubscribed"
|
|
158
159
|
}
|
|
159
160
|
export type DirectLoginOptions = {
|
|
160
|
-
directLoginMethod: DirectLoginMethod;
|
|
161
161
|
marketingConsentStatus?: MarketingConsentStatus;
|
|
162
162
|
} & ({
|
|
163
163
|
directLoginMethod: 'email';
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/passport",
|
|
3
3
|
"description": "Passport module for Immutable SDK",
|
|
4
|
-
"version": "2.6.0",
|
|
4
|
+
"version": "2.6.2-alpha.0",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@0xsequence/abi": "^2.0.25",
|
|
9
9
|
"@0xsequence/core": "^2.0.25",
|
|
10
|
-
"@imtbl/config": "2.6.0",
|
|
11
|
-
"@imtbl/generated-clients": "2.6.0",
|
|
12
|
-
"@imtbl/metrics": "2.6.0",
|
|
13
|
-
"@imtbl/toolkit": "2.6.0",
|
|
14
|
-
"@imtbl/x-client": "2.6.0",
|
|
15
|
-
"@imtbl/x-provider": "2.6.0",
|
|
10
|
+
"@imtbl/config": "2.6.2-alpha.0",
|
|
11
|
+
"@imtbl/generated-clients": "2.6.2-alpha.0",
|
|
12
|
+
"@imtbl/metrics": "2.6.2-alpha.0",
|
|
13
|
+
"@imtbl/toolkit": "2.6.2-alpha.0",
|
|
14
|
+
"@imtbl/x-client": "2.6.2-alpha.0",
|
|
15
|
+
"@imtbl/x-provider": "2.6.2-alpha.0",
|
|
16
16
|
"@magic-ext/oidc": "12.0.5",
|
|
17
17
|
"@magic-sdk/provider": "^29.0.5",
|
|
18
18
|
"@metamask/detect-provider": "^2.0.0",
|
/package/dist/types/{overlay/overlay.test.d.ts → confirmation/embeddedLoginPrompt.test.d.ts}
RENAMED
|
File without changes
|