@getpara/core-sdk 3.0.0-alpha.0 → 3.0.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/cjs/ParaCore.js +436 -86
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/cryptography/utils.js +5 -2
- package/dist/cjs/errors.js +10 -0
- package/dist/cjs/external/userManagementClient.js +21 -4
- package/dist/cjs/index.js +67 -1
- package/dist/cjs/services/AuthService.js +66 -47
- package/dist/cjs/services/LoginFlowService.js +30 -27
- package/dist/cjs/services/PollingService.js +100 -75
- package/dist/cjs/services/PortalUrlService.js +112 -19
- package/dist/cjs/services/PregenWalletService.js +125 -76
- package/dist/cjs/services/SessionManagementService.js +15 -8
- package/dist/cjs/services/SignupFlowService.js +52 -47
- package/dist/cjs/services/VerificationFlowService.js +13 -10
- package/dist/cjs/services/WalletService.js +51 -36
- package/dist/cjs/shares/enclave.js +46 -26
- package/dist/cjs/state/CoreStateManager.js +17 -5
- package/dist/cjs/state/actors/setupPara.js +4 -1
- package/dist/cjs/state/machines/walletStateMachine.js +22 -0
- package/dist/cjs/telemetry/config.js +15 -0
- package/dist/cjs/telemetry/init.js +185 -0
- package/dist/cjs/telemetry/modalSession.js +54 -0
- package/dist/cjs/telemetry/session.js +39 -0
- package/dist/cjs/telemetry/tracer.js +126 -0
- package/dist/cjs/telemetry/uxAction.js +30 -0
- package/dist/cjs/telemetry/uxBaggagePropagator.js +58 -0
- package/dist/cjs/telemetry/uxState.js +46 -0
- package/dist/cjs/telemetry/uxStateSpanProcessor.js +51 -0
- package/dist/cjs/utils/configEncoding.js +98 -0
- package/dist/cjs/utils/deprecation.js +13 -13
- package/dist/cjs/utils/formatting.js +5 -0
- package/dist/cjs/utils/index.js +11 -0
- package/dist/cjs/utils/partnerConfig.js +103 -0
- package/dist/cjs/utils/partnerConfigGating.js +83 -0
- package/dist/cjs/utils/stateErrorHelpers.js +6 -1
- package/dist/cjs/utils/url.js +10 -2
- package/dist/esm/ParaCore.js +441 -88
- package/dist/esm/constants.js +1 -1
- package/dist/esm/cryptography/utils.js +5 -2
- package/dist/esm/errors.js +9 -0
- package/dist/esm/external/userManagementClient.js +21 -4
- package/dist/esm/index.js +58 -4
- package/dist/esm/services/AuthService.js +66 -47
- package/dist/esm/services/LoginFlowService.js +30 -27
- package/dist/esm/services/PollingService.js +100 -75
- package/dist/esm/services/PortalUrlService.js +112 -19
- package/dist/esm/services/PregenWalletService.js +125 -76
- package/dist/esm/services/SessionManagementService.js +15 -8
- package/dist/esm/services/SignupFlowService.js +52 -47
- package/dist/esm/services/VerificationFlowService.js +13 -10
- package/dist/esm/services/WalletService.js +51 -36
- package/dist/esm/shares/enclave.js +46 -26
- package/dist/esm/state/CoreStateManager.js +17 -5
- package/dist/esm/state/actors/setupPara.js +4 -1
- package/dist/esm/state/machines/walletStateMachine.js +22 -0
- package/dist/esm/telemetry/config.js +0 -0
- package/dist/esm/telemetry/init.js +118 -0
- package/dist/esm/telemetry/modalSession.js +29 -0
- package/dist/esm/telemetry/session.js +16 -0
- package/dist/esm/telemetry/tracer.js +84 -0
- package/dist/esm/telemetry/uxAction.js +8 -0
- package/dist/esm/telemetry/uxBaggagePropagator.js +35 -0
- package/dist/esm/telemetry/uxState.js +21 -0
- package/dist/esm/telemetry/uxStateSpanProcessor.js +28 -0
- package/dist/esm/utils/configEncoding.js +45 -0
- package/dist/esm/utils/deprecation.js +11 -12
- package/dist/esm/utils/formatting.js +4 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/partnerConfig.js +67 -0
- package/dist/esm/utils/partnerConfigGating.js +61 -0
- package/dist/esm/utils/stateErrorHelpers.js +6 -1
- package/dist/esm/utils/url.js +10 -2
- package/dist/types/ParaCore.d.ts +101 -19
- package/dist/types/PlatformUtils.d.ts +1 -0
- package/dist/types/errors.d.ts +26 -0
- package/dist/types/external/userManagementClient.d.ts +2 -1
- package/dist/types/index.d.ts +15 -3
- package/dist/types/services/types/AuthServiceTypes.d.ts +10 -3
- package/dist/types/services/types/PortalUrlServiceTypes.d.ts +3 -3
- package/dist/types/services/types/WalletServiceTypes.d.ts +4 -0
- package/dist/types/state/actors/setupPara.d.ts +18 -0
- package/dist/types/state/machines/authStateMachine.d.ts +1 -1
- package/dist/types/state/machines/coreStateMachine.d.ts +30 -6
- package/dist/types/state/machines/walletStateMachine.d.ts +4 -0
- package/dist/types/state/types/core.d.ts +7 -1
- package/dist/types/telemetry/config.d.ts +4 -0
- package/dist/types/telemetry/init.d.ts +17 -0
- package/dist/types/telemetry/modalSession.d.ts +5 -0
- package/dist/types/telemetry/session.d.ts +2 -0
- package/dist/types/telemetry/tracer.d.ts +10 -0
- package/dist/types/telemetry/uxAction.d.ts +3 -0
- package/dist/types/telemetry/uxBaggagePropagator.d.ts +7 -0
- package/dist/types/telemetry/uxState.d.ts +8 -0
- package/dist/types/telemetry/uxStateSpanProcessor.d.ts +9 -0
- package/dist/types/types/config.d.ts +15 -3
- package/dist/types/types/coreApi.d.ts +7 -9
- package/dist/types/types/serviceInterfaces.d.ts +5 -3
- package/dist/types/types/util.d.ts +2 -15
- package/dist/types/utils/configEncoding.d.ts +51 -0
- package/dist/types/utils/deprecation.d.ts +3 -1
- package/dist/types/utils/formatting.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/partnerConfig.d.ts +28 -0
- package/dist/types/utils/partnerConfigGating.d.ts +48 -0
- package/dist/types/utils/url.d.ts +3 -2
- package/package.json +14 -4
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import "../chunk-7B52C2XE.js";
|
|
1
2
|
export * from "./autobind.js";
|
|
2
3
|
export * from "./config.js";
|
|
4
|
+
import { warnOnce } from "./deprecation.js";
|
|
3
5
|
export * from "./events.js";
|
|
4
6
|
export * from "./formatting.js";
|
|
5
7
|
export * from "./json.js";
|
|
6
8
|
export * from "./listeners.js";
|
|
7
9
|
export * from "./onRamps.js";
|
|
10
|
+
export * from "./partnerConfig.js";
|
|
8
11
|
export * from "./phone.js";
|
|
9
12
|
export * from "./polling.js";
|
|
10
13
|
export * from "./types.js";
|
|
11
14
|
export * from "./url.js";
|
|
12
15
|
export * from "./wallet.js";
|
|
13
16
|
export * from "./window.js";
|
|
17
|
+
export {
|
|
18
|
+
warnOnce
|
|
19
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "../chunk-7B52C2XE.js";
|
|
4
|
+
import { AuthMethod, mergePartnerAppConfig } from "@getpara/user-management-client";
|
|
5
|
+
const DEFAULT_PARTNER_APP_CONFIG = {};
|
|
6
|
+
function partnerToAppConfigLayer(partner) {
|
|
7
|
+
var _a;
|
|
8
|
+
const layer = {};
|
|
9
|
+
const themeConfig = (_a = partner.themeConfig) != null ? _a : synthesizeLegacyTheme(partner);
|
|
10
|
+
if (themeConfig) layer.themeConfig = themeConfig;
|
|
11
|
+
const authConfig = synthesizeAuthConfig(partner);
|
|
12
|
+
if (authConfig) layer.authConfig = authConfig;
|
|
13
|
+
const modalConfig = synthesizeModalConfig(partner);
|
|
14
|
+
if (modalConfig) layer.modalConfig = modalConfig;
|
|
15
|
+
if (partner.partnerLinks) layer.partnerLinks = partner.partnerLinks;
|
|
16
|
+
if (partner.externalWalletConfig) layer.externalWalletConfig = partner.externalWalletConfig;
|
|
17
|
+
if (partner.farcasterConfig) layer.farcasterConfig = partner.farcasterConfig;
|
|
18
|
+
if (partner.rpcUrl) layer.rpcUrl = partner.rpcUrl;
|
|
19
|
+
if (partner.displayName) layer.appName = partner.displayName;
|
|
20
|
+
if (partner.supportedWalletTypes) layer.supportedWalletTypes = partner.supportedWalletTypes;
|
|
21
|
+
if (partner.supportedAccountLinks) layer.supportedAccountLinks = partner.supportedAccountLinks;
|
|
22
|
+
if (partner.balancesConfig) layer.balancesConfig = partner.balancesConfig;
|
|
23
|
+
return layer;
|
|
24
|
+
}
|
|
25
|
+
function synthesizeAuthConfig(partner) {
|
|
26
|
+
const result = {};
|
|
27
|
+
const stored = partner.authConfig;
|
|
28
|
+
if (stored) {
|
|
29
|
+
if (stored.oAuthMethods != null) result.oAuthMethods = stored.oAuthMethods;
|
|
30
|
+
if (stored.disableEmailLogin != null) result.disableEmailLogin = stored.disableEmailLogin;
|
|
31
|
+
if (stored.disablePhoneLogin != null) result.disablePhoneLogin = stored.disablePhoneLogin;
|
|
32
|
+
if (stored.twoFactorAuthEnabled != null) result.twoFactorAuthEnabled = stored.twoFactorAuthEnabled;
|
|
33
|
+
if (stored.isGuestModeEnabled != null) result.isGuestModeEnabled = stored.isGuestModeEnabled;
|
|
34
|
+
if (stored.supportedAuthMethods != null) result.supportedAuthMethods = stored.supportedAuthMethods;
|
|
35
|
+
}
|
|
36
|
+
if (result.supportedAuthMethods === void 0) {
|
|
37
|
+
const legacy = partner.supportedAuthMethods;
|
|
38
|
+
const isMeaningful = legacy && !(legacy.length === 1 && legacy[0] === AuthMethod.PASSKEY);
|
|
39
|
+
if (isMeaningful) {
|
|
40
|
+
result.supportedAuthMethods = legacy;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
44
|
+
}
|
|
45
|
+
function synthesizeModalConfig(partner) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
const stored = (_a = partner.modalConfig) != null ? _a : void 0;
|
|
48
|
+
const logo = (_b = partner.logoUrl) != null ? _b : void 0;
|
|
49
|
+
if (!stored && logo === void 0) return void 0;
|
|
50
|
+
return __spreadValues(__spreadValues({}, stored != null ? stored : {}), logo !== void 0 && { logo });
|
|
51
|
+
}
|
|
52
|
+
function synthesizeLegacyTheme(partner) {
|
|
53
|
+
const hasActiveThemeData = partner.backgroundColor || partner.foregroundColor || partner.accentColor || partner.font || partner.themeMode === "DARK";
|
|
54
|
+
if (!hasActiveThemeData) return void 0;
|
|
55
|
+
const theme = {};
|
|
56
|
+
if (partner.backgroundColor) theme.backgroundColor = partner.backgroundColor;
|
|
57
|
+
if (partner.foregroundColor) theme.foregroundColor = partner.foregroundColor;
|
|
58
|
+
if (partner.accentColor) theme.accentColor = partner.accentColor;
|
|
59
|
+
if (partner.font) theme.font = partner.font;
|
|
60
|
+
if (partner.themeMode === "DARK") theme.mode = "dark";
|
|
61
|
+
return theme;
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
DEFAULT_PARTNER_APP_CONFIG,
|
|
65
|
+
mergePartnerAppConfig,
|
|
66
|
+
partnerToAppConfigLayer
|
|
67
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "../chunk-7B52C2XE.js";
|
|
2
|
+
import { PartnerConfigError } from "../errors.js";
|
|
3
|
+
function assertConfigAllowed(config, check) {
|
|
4
|
+
var _a, _b, _c, _d, _e;
|
|
5
|
+
switch (check.kind) {
|
|
6
|
+
case "email": {
|
|
7
|
+
if ((_a = config.authConfig) == null ? void 0 : _a.disableEmailLogin) {
|
|
8
|
+
throw new PartnerConfigError(
|
|
9
|
+
"EMAIL_LOGIN_DISABLED",
|
|
10
|
+
"Email login is disabled for this partner. Update partner.authConfig.disableEmailLogin in the developer portal to enable it."
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
case "phone": {
|
|
16
|
+
if ((_b = config.authConfig) == null ? void 0 : _b.disablePhoneLogin) {
|
|
17
|
+
throw new PartnerConfigError(
|
|
18
|
+
"PHONE_LOGIN_DISABLED",
|
|
19
|
+
"Phone login is disabled for this partner. Update partner.authConfig.disablePhoneLogin in the developer portal to enable it."
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
case "oauth": {
|
|
25
|
+
const allowed = (_c = config.authConfig) == null ? void 0 : _c.oAuthMethods;
|
|
26
|
+
if (allowed !== void 0 && !allowed.includes(check.method)) {
|
|
27
|
+
throw new PartnerConfigError(
|
|
28
|
+
"OAUTH_METHOD_NOT_ALLOWED",
|
|
29
|
+
`OAuth method "${check.method}" is not in the partner's allowlist. Allowed: ${allowed.length === 0 ? "(none)" : allowed.join(", ")}.`,
|
|
30
|
+
check.method
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
case "2fa": {
|
|
36
|
+
if (((_d = config.authConfig) == null ? void 0 : _d.twoFactorAuthEnabled) === false) {
|
|
37
|
+
throw new PartnerConfigError(
|
|
38
|
+
"TWO_FACTOR_DISABLED",
|
|
39
|
+
"2FA is disabled for this partner. Update partner.authConfig.twoFactorAuthEnabled in the developer portal to enable it."
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
case "guest": {
|
|
45
|
+
if (((_e = config.authConfig) == null ? void 0 : _e.isGuestModeEnabled) === false) {
|
|
46
|
+
throw new PartnerConfigError(
|
|
47
|
+
"GUEST_MODE_DISABLED",
|
|
48
|
+
"Guest mode is disabled for this partner. Update partner.authConfig.isGuestModeEnabled in the developer portal to enable it."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
default: {
|
|
54
|
+
const _exhaustive = check;
|
|
55
|
+
throw new Error(`assertConfigAllowed: unhandled ConfigCheck kind ${JSON.stringify(_exhaustive)}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
assertConfigAllowed
|
|
61
|
+
};
|
|
@@ -23,7 +23,12 @@ function formatStateError(error, defaultMessage) {
|
|
|
23
23
|
return new Error(error);
|
|
24
24
|
}
|
|
25
25
|
if (error && typeof error === "object" && "message" in error) {
|
|
26
|
-
|
|
26
|
+
const src = error;
|
|
27
|
+
const normalized = Object.assign(new Error(String(src.message)), {});
|
|
28
|
+
if ("code" in src) normalized.code = src.code;
|
|
29
|
+
if ("status" in src) normalized.status = src.status;
|
|
30
|
+
if ("data" in src) normalized.data = src.data;
|
|
31
|
+
return normalized;
|
|
27
32
|
}
|
|
28
33
|
if (error && typeof error === "object" && "error" in error) {
|
|
29
34
|
return formatStateError(error.error, defaultMessage);
|
package/dist/esm/utils/url.js
CHANGED
|
@@ -3,6 +3,10 @@ import {
|
|
|
3
3
|
} from "../chunk-7B52C2XE.js";
|
|
4
4
|
import { upload } from "../transmission/transmissionUtils.js";
|
|
5
5
|
import { Environment } from "../types/index.js";
|
|
6
|
+
function getGlobalPortalUrlOverride() {
|
|
7
|
+
const override = typeof globalThis !== "undefined" ? globalThis.__PARA_PORTAL_URL_OVERRIDE__ : void 0;
|
|
8
|
+
return typeof override === "string" && override ? override : void 0;
|
|
9
|
+
}
|
|
6
10
|
function getPortalDomain(env, isE2E, isLegacy) {
|
|
7
11
|
if (isE2E) {
|
|
8
12
|
return `localhost`;
|
|
@@ -21,7 +25,11 @@ function getPortalDomain(env, isE2E, isLegacy) {
|
|
|
21
25
|
throw new Error(`env: ${env} not supported`);
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
|
-
function getPortalBaseURL({ env, isE2E }, useLocalIp, isForWasm, isLegacy) {
|
|
28
|
+
function getPortalBaseURL({ env, isE2E, portalUrlOverride }, useLocalIp, isForWasm, isLegacy) {
|
|
29
|
+
const resolvedPortalUrlOverride = portalUrlOverride != null ? portalUrlOverride : getGlobalPortalUrlOverride();
|
|
30
|
+
if (resolvedPortalUrlOverride && !isForWasm) {
|
|
31
|
+
return new URL(resolvedPortalUrlOverride).origin;
|
|
32
|
+
}
|
|
25
33
|
if (isE2E) {
|
|
26
34
|
if (isForWasm) {
|
|
27
35
|
return `https://app.sandbox.getpara.com`;
|
|
@@ -44,7 +52,7 @@ function getParaConnectDomain(env) {
|
|
|
44
52
|
case Environment.SANDBOX:
|
|
45
53
|
return "connect.sandbox.getpara.com";
|
|
46
54
|
case Environment.BETA:
|
|
47
|
-
return "connect.
|
|
55
|
+
return "connect.getpara.com";
|
|
48
56
|
case Environment.PROD:
|
|
49
57
|
return "connect.getpara.com";
|
|
50
58
|
default:
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, PartnerEntity, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams as VerifyExternalWalletParamsServer, SupportedAccountLinks, OnRampPurchase, BalancesConfig, IssueJwtParams, TWalletScheme } from '@getpara/user-management-client';
|
|
1
|
+
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, PartnerAppConfig, PartnerEntity, SdkOverridableAppConfig, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams as VerifyExternalWalletParamsServer, SupportedAccountLinks, OnRampPurchase, BalancesConfig, IssueJwtParams, TWalletScheme, PartnerThemeConfig } from '@getpara/user-management-client';
|
|
2
2
|
import type { pki as pkiType } from 'node-forge';
|
|
3
|
-
import { Ctx, Environment, Wallet, ConstructorOpts, CoreAuthInfo, CoreMethodParams, CoreMethodResponse, CoreInterface, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse, OAuthResponse, AvailableWallet
|
|
3
|
+
import { Ctx, Environment, Wallet, ConstructorOpts, CoreAuthInfo, CoreMethodParams, CoreMethodResponse, CoreInterface, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse, OAuthResponse, AvailableWallet } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
5
|
import { AuthServiceInterface, ExternalWalletServiceInterface, PollingServiceInterface, PortalUrlServiceInterface, PregenWalletServiceInterface, SessionManagementServiceInterface, StateMachineInterface, WalletServiceInterface } from './types/serviceInterfaces.js';
|
|
6
6
|
import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, VerifyFarcasterParams, VerifyFarcasterResponse, VerifyNewAccountParams, VerifyTelegramParams, AddCredentialParams, GetNewCredentialAndUrlParams, GetNewCredentialAndUrlResponse, LoginExternalWalletParams, ResendVerificationCodeParams, SignUpOrLogInParams, VerifyOAuthProcessParams, VerifyOAuthProcessResponse, GetLoginUrlParams, GetOAuthUrlParams, PortalUrlOptions, PortalUrlType, ClaimPregenWalletsParams, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, GetPregenWalletsParams, HasPregenWalletParams, UpdatePregenWalletIdentifierParams, CreateWalletParams, CreateWalletPerTypeParams, DistributeNewWalletShareParams, FindWalletByAddressParams, FindWalletIdParams, FindWalletParams, GetDisplayAddressParams, GetIdenticonHashParams, GetWalletBalanceParams, GetWalletsByTypeParams, RequestFaucetParams, RequestFaucetResponse, RefreshShareParams, SetCurrentWalletIdsParams, SetWalletsParams, RefreshSessionParams, VerifyExternalWalletParams, InitExternalWalletProviderParams, ConnectExternalWalletParams, ExternalSignMessageParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithOAuthParams } from './services/types';
|
|
@@ -90,6 +90,20 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
90
90
|
* @returns A function that can be called to unsubscribe from the readiness state changes.
|
|
91
91
|
*/
|
|
92
92
|
onReadyStateChange(callback: (isReady: boolean) => void): () => void;
|
|
93
|
+
/**
|
|
94
|
+
* Subscribe to changes in any input to `paraCore.config`:
|
|
95
|
+
* - partner record updates (lazy load after a failed eager fetch, etc.)
|
|
96
|
+
* - SDK override layer replacement (`setSdkConfigOverrides`)
|
|
97
|
+
*
|
|
98
|
+
* The callback fires after the relevant state has settled; subscribers
|
|
99
|
+
* should re-read `paraCore.config` to get the new merged value. Returns
|
|
100
|
+
* an unsubscribe function.
|
|
101
|
+
*
|
|
102
|
+
* Used by the React layer to bump its reactive `paraConfigVersion`
|
|
103
|
+
* counter; non-React consumers (server SDK, telemetry, etc.) can wire
|
|
104
|
+
* the same signal to invalidate their caches.
|
|
105
|
+
*/
|
|
106
|
+
onConfigChange(callback: () => void): () => void;
|
|
93
107
|
get authInfo(): CoreAuthInfo | undefined;
|
|
94
108
|
get email(): AuthIdentifier<'email'> | undefined;
|
|
95
109
|
get phone(): AuthIdentifier<'phone'> | undefined;
|
|
@@ -98,6 +112,57 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
98
112
|
get externalWalletWithParaAuth(): Wallet | undefined;
|
|
99
113
|
get externalWalletConnectionType(): import("./services/types").ExternalWalletConnectionType;
|
|
100
114
|
protected partner?: PartnerEntity;
|
|
115
|
+
/**
|
|
116
|
+
* Resolved partner app config: partner ⊕ SDK overrides.
|
|
117
|
+
* Read-only view; safe to call before `getPartner` returns (yields `{}` via
|
|
118
|
+
* the merge of no layers).
|
|
119
|
+
*
|
|
120
|
+
* Memoized on `(this.partner, this.#sdkConfigOverrides)` identity. Multiple
|
|
121
|
+
* consumers read this (assertConfigAllowed at 9 sites, PortalUrlService,
|
|
122
|
+
* ExternalWalletWrapper); without memoization each access re-allocates a
|
|
123
|
+
* fresh merged object graph. Cache invalidates whenever `this.partner` is
|
|
124
|
+
* replaced (via getPartner) or `setSdkConfigOverrides` is called.
|
|
125
|
+
*/
|
|
126
|
+
get config(): PartnerAppConfig;
|
|
127
|
+
/**
|
|
128
|
+
* Read-only accessor for the raw partner record. Returns `undefined` until
|
|
129
|
+
* `getPartner` resolves (typically during `setup()`).
|
|
130
|
+
*
|
|
131
|
+
* The vast majority of partner-driven UX should consume `this.config`
|
|
132
|
+
* instead — that layer applies SDK overrides, exposes a stable shape, and
|
|
133
|
+
* is memoized. Use this getter only for fields that live on `PartnerEntity`
|
|
134
|
+
* but aren't promoted onto `PartnerAppConfig` (e.g. `logoUrl`, internal
|
|
135
|
+
* policy state). Whatever this returns is exactly what the public
|
|
136
|
+
* `getPartner(id)` API resolved on the last fetch — no additional
|
|
137
|
+
* processing.
|
|
138
|
+
*/
|
|
139
|
+
get partnerRecord(): PartnerEntity | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Replace the SDK-side override layer. Generic surface — any post-construction
|
|
142
|
+
* caller (React provider, server-sdk, custom integration) can update overrides
|
|
143
|
+
* without rebuilding the ParaCore instance.
|
|
144
|
+
*
|
|
145
|
+
* Replaces wholesale (last writer wins). Pass undefined to clear.
|
|
146
|
+
*/
|
|
147
|
+
setSdkConfigOverrides(overrides: Partial<SdkOverridableAppConfig> | undefined): void;
|
|
148
|
+
/**
|
|
149
|
+
* Read the raw SDK override layer (NOT the merged config). Used by analytics
|
|
150
|
+
* to distinguish "what the consumer passed" from "what the resolver
|
|
151
|
+
* produced." For the resolved view, use `paraCore.config`.
|
|
152
|
+
*
|
|
153
|
+
* @internal — analytics-only. App code should read `paraCore.config` instead;
|
|
154
|
+
* this getter exposes pre-merge values that can change shape across
|
|
155
|
+
* versions without notice.
|
|
156
|
+
*
|
|
157
|
+
* @remarks Redaction contract — any analytics consumer dispatching this
|
|
158
|
+
* value to an external sink MUST sanitize first. Specifically `rpcUrl`
|
|
159
|
+
* commonly embeds API keys (Alchemy `/v2/<key>`, Infura `/v3/<key>`).
|
|
160
|
+
* Today the React modal owns redaction in
|
|
161
|
+
* `react-sdk-lite/src/modal/ParaModal.tsx` (`sanitizeSdkConfigOverridesForAnalytics`).
|
|
162
|
+
* When Phase 7's non-React analytics lands here, lift that helper next
|
|
163
|
+
* to this getter so all consumers share one sanitizer.
|
|
164
|
+
*/
|
|
165
|
+
get sdkConfigOverrides(): Partial<SdkOverridableAppConfig> | undefined;
|
|
101
166
|
get userId(): string | undefined;
|
|
102
167
|
accountLinkInProgress: AccountLinkInProgress | undefined;
|
|
103
168
|
get isEnclaveUser(): boolean;
|
|
@@ -198,7 +263,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
198
263
|
* Theme to use for the portal
|
|
199
264
|
* WARNING: This theme will override portal options set within the developer portal.
|
|
200
265
|
*/
|
|
201
|
-
portalTheme?:
|
|
266
|
+
portalTheme?: PartnerThemeConfig;
|
|
202
267
|
/**
|
|
203
268
|
* Whether or not to treat external wallets as connections only, skipping all Para functionality.
|
|
204
269
|
*/
|
|
@@ -208,6 +273,21 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
208
273
|
get isNoWalletConfig(): boolean;
|
|
209
274
|
get supportedWalletTypes(): SupportedWalletTypes;
|
|
210
275
|
get cosmosPrefix(): string | undefined;
|
|
276
|
+
/**
|
|
277
|
+
* Auth methods the partner has enabled. Read off the raw partner record —
|
|
278
|
+
* partner-authoritative and excluded from `SdkOverridableAppConfig`, so it
|
|
279
|
+
* does NOT participate in the override merge chain.
|
|
280
|
+
*
|
|
281
|
+
* Named `supportedAuthMethodsList` (not `supportedAuthMethods`) to avoid
|
|
282
|
+
* colliding with the existing protected async `supportedAuthMethods(auth)`
|
|
283
|
+
* method that performs a backend lookup. Different concept, different shape.
|
|
284
|
+
*/
|
|
285
|
+
get supportedAuthMethodsList(): AuthMethod[];
|
|
286
|
+
/**
|
|
287
|
+
* Balance display config from the partner record. Partner-authoritative;
|
|
288
|
+
* excluded from `SdkOverridableAppConfig`.
|
|
289
|
+
*/
|
|
290
|
+
get balancesConfig(): BalancesConfig | undefined;
|
|
211
291
|
get supportedAccountLinks(): SupportedAccountLinks;
|
|
212
292
|
get isWalletTypeEnabled(): Partial<Record<TWalletType, boolean>>;
|
|
213
293
|
protected onRampPopup: {
|
|
@@ -280,7 +360,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
280
360
|
getExternalWalletServiceInterface(): ExternalWalletServiceInterface;
|
|
281
361
|
getPollingServiceInterface(): PollingServiceInterface;
|
|
282
362
|
private trackError;
|
|
283
|
-
private
|
|
363
|
+
private wrapMethodsWithTracing;
|
|
284
364
|
private initializeFromStorage;
|
|
285
365
|
private updateAuthInfoFromStorage;
|
|
286
366
|
private updateEnclaveJwtFromStorage;
|
|
@@ -458,6 +538,16 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
458
538
|
verifyExternalWallet(params: VerifyExternalWalletParams): Promise<import("./services/types").VerifyExternalWalletResponse>;
|
|
459
539
|
retryVerifyExternalWallet(): Promise<import("./services/types").VerifyExternalWalletResponse>;
|
|
460
540
|
signExternalWalletVerification(params: ExternalSignMessageParams): Promise<import("./services/types").BaseVerifyExternalWalletParams>;
|
|
541
|
+
signExternalWalletMessageForReauth(params: ExternalSignMessageParams & {
|
|
542
|
+
externalWallet: ExternalWalletInfo;
|
|
543
|
+
}): Promise<{
|
|
544
|
+
address: string;
|
|
545
|
+
cosmosPublicKeyHex?: string;
|
|
546
|
+
cosmosSigner?: string;
|
|
547
|
+
addressBech32?: string;
|
|
548
|
+
externalWallet: ExternalWalletInfo;
|
|
549
|
+
signedMessage: string;
|
|
550
|
+
}>;
|
|
461
551
|
protected verifyExternalWalletLink(opts: InternalMethodParams<'verifyExternalWalletLink'>): InternalMethodResponse<'verifyExternalWalletLink'>;
|
|
462
552
|
protected verifyTelegramProcess(opts: VerifyTelegramParams & {
|
|
463
553
|
isLinkAccount: false;
|
|
@@ -489,7 +579,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
489
579
|
/**
|
|
490
580
|
* Resend a verification email for the current user.
|
|
491
581
|
*/
|
|
492
|
-
resendVerificationCode({ type: reason }: ResendVerificationCodeParams): Promise<
|
|
582
|
+
resendVerificationCode({ type: reason, deliveryChannel }: ResendVerificationCodeParams): Promise<import("./services/types").ResendVerificationCodeResponse>;
|
|
493
583
|
/**
|
|
494
584
|
* Checks if the current session is active.
|
|
495
585
|
* @returns `true` if active, `false` otherwise
|
|
@@ -658,8 +748,6 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
658
748
|
**/
|
|
659
749
|
createWallet(params?: CreateWalletParams): Promise<import("./services/types").CreateWalletResponse>;
|
|
660
750
|
/**
|
|
661
|
-
* @deprecated Use the REST API (`POST /v1/wallets`) instead. See {@link https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen | migration guide}.
|
|
662
|
-
*
|
|
663
751
|
* Creates a new pregenerated wallet.
|
|
664
752
|
*
|
|
665
753
|
* @param {Object} opts the options object.
|
|
@@ -670,8 +758,6 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
670
758
|
**/
|
|
671
759
|
createPregenWallet(params: CreatePregenWalletParams): Promise<Wallet>;
|
|
672
760
|
/**
|
|
673
|
-
* @deprecated Use the REST API (`POST /v1/wallets`) instead. See {@link https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen | migration guide}.
|
|
674
|
-
*
|
|
675
761
|
* Creates new pregenerated wallets for each desired type.
|
|
676
762
|
* If no types are provided, this method will create one for each of the non-optional types
|
|
677
763
|
* specified in the instance's `supportedWalletTypes` array that are not already present.
|
|
@@ -683,8 +769,6 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
683
769
|
**/
|
|
684
770
|
createPregenWalletPerType(params: CreatePregenWalletPerTypeParams): Promise<import("./services/types").CreatePregenWalletPerTypeResponse>;
|
|
685
771
|
/**
|
|
686
|
-
* @deprecated Use the REST API (`POST /v1/wallets`) instead. See {@link https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen | migration guide}.
|
|
687
|
-
*
|
|
688
772
|
* Claims a pregenerated wallet.
|
|
689
773
|
* @param {Object} opts the options object.
|
|
690
774
|
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
@@ -693,8 +777,6 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
693
777
|
**/
|
|
694
778
|
claimPregenWallets(params?: ClaimPregenWalletsParams): Promise<string>;
|
|
695
779
|
/**
|
|
696
|
-
* @deprecated Use the REST API (`PATCH /v1/wallets/:id`) instead. See {@link https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen | migration guide}.
|
|
697
|
-
*
|
|
698
780
|
* Updates the identifier for a pregen wallet.
|
|
699
781
|
* @param {Object} opts the options object.
|
|
700
782
|
* @param {string} opts.walletId the pregen wallet ID
|
|
@@ -703,8 +785,6 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
703
785
|
**/
|
|
704
786
|
updatePregenWalletIdentifier(params: UpdatePregenWalletIdentifierParams): Promise<void>;
|
|
705
787
|
/**
|
|
706
|
-
* @deprecated Use the REST API (`GET /v1/wallets`) instead. See {@link https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen | migration guide}.
|
|
707
|
-
*
|
|
708
788
|
* Checks if a pregen Wallet exists for the given identifier with the current partner.
|
|
709
789
|
* @param {Object} opts the options object.
|
|
710
790
|
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
@@ -713,8 +793,6 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
713
793
|
**/
|
|
714
794
|
hasPregenWallet(params: HasPregenWalletParams): Promise<boolean>;
|
|
715
795
|
/**
|
|
716
|
-
* @deprecated Use the REST API (`GET /v1/wallets`) instead. See {@link https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen | migration guide}.
|
|
717
|
-
*
|
|
718
796
|
* Get pregen wallets for the given identifier.
|
|
719
797
|
* @param {Object} opts the options object.
|
|
720
798
|
* @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet
|
|
@@ -747,11 +825,11 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
747
825
|
private getOnRampTransactionUrl;
|
|
748
826
|
getWalletBalance(params: GetWalletBalanceParams): Promise<string>;
|
|
749
827
|
/**
|
|
750
|
-
*
|
|
828
|
+
* Submits a testnet faucet funding transaction for the specified wallet.
|
|
751
829
|
* @param {RequestFaucetParams} params the options object.
|
|
752
830
|
* @param {string} params.walletId the id of the wallet to fund.
|
|
753
831
|
* @param {string} [params.chain] optional chain identifier to target a specific testnet.
|
|
754
|
-
* @returns the faucet transaction details
|
|
832
|
+
* @returns the submitted faucet transaction details. Wait for the returned transaction hash to confirm before spending.
|
|
755
833
|
*/
|
|
756
834
|
requestFaucet(params: RequestFaucetParams): Promise<RequestFaucetResponse>;
|
|
757
835
|
/**
|
|
@@ -868,6 +946,10 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
868
946
|
}): Promise<import("@getpara/user-management-client").ProfileBalance>;
|
|
869
947
|
protected sendLoginCode(): Promise<{
|
|
870
948
|
userId: string;
|
|
949
|
+
deliveryChannel: import("@getpara/user-management-client").DeliveryChannel;
|
|
950
|
+
fallbackUsed: boolean;
|
|
951
|
+
fallbackChannel: import("@getpara/user-management-client").DeliveryChannel;
|
|
952
|
+
isSmsAllowed: boolean;
|
|
871
953
|
}>;
|
|
872
954
|
exportPrivateKey(args?: CoreMethodParams<'exportPrivateKey'>): CoreMethodResponse<'exportPrivateKey'>;
|
|
873
955
|
}
|
|
@@ -10,6 +10,7 @@ export type EventHandler<T = any> = (data: T) => void;
|
|
|
10
10
|
export interface PlatformUtils {
|
|
11
11
|
sdkType: SDKType;
|
|
12
12
|
getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
|
|
13
|
+
getED25519PrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
|
|
13
14
|
keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
|
|
14
15
|
sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
|
|
15
16
|
signer: string;
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -10,3 +10,29 @@ export declare class TransactionReviewTimeout extends Error {
|
|
|
10
10
|
transactionReviewUrl: string;
|
|
11
11
|
constructor(transactionReviewUrl: string, pendingTransactionId: string);
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Discriminant for a `PartnerConfigError`. Each code corresponds to a specific
|
|
15
|
+
* partner-config check that rejected an SDK call. Stable string values are
|
|
16
|
+
* part of the public surface — consumer code may switch on them to localize
|
|
17
|
+
* messages or steer recovery flows.
|
|
18
|
+
*
|
|
19
|
+
* Keep this union honest: only codes that `assertConfigAllowed` (or another
|
|
20
|
+
* runtime check) actually throws today. When Phase 7 adds wallet-type /
|
|
21
|
+
* account-link / auth-method enforcement, add `WALLET_TYPE_NOT_ALLOWED`,
|
|
22
|
+
* `ACCOUNT_LINK_NOT_ALLOWED`, `AUTH_METHOD_DISABLED` here in the same patch
|
|
23
|
+
* that introduces the matching `ConfigCheck` kinds. Pre-declaring them here
|
|
24
|
+
* would create dead `switch` branches in consumer code.
|
|
25
|
+
*/
|
|
26
|
+
export type PartnerConfigErrorCode = 'EMAIL_LOGIN_DISABLED' | 'PHONE_LOGIN_DISABLED' | 'OAUTH_METHOD_NOT_ALLOWED' | 'TWO_FACTOR_DISABLED' | 'GUEST_MODE_DISABLED';
|
|
27
|
+
/**
|
|
28
|
+
* Thrown when an SDK auth or wallet call violates a partner-config restriction.
|
|
29
|
+
* `assertConfigAllowed` runs at the affected SDK entry points so partner
|
|
30
|
+
* posture (e.g. "email login disabled", "OAuth allowlist limited to GOOGLE")
|
|
31
|
+
* is enforced for direct SDK calls too — not just the modal.
|
|
32
|
+
*/
|
|
33
|
+
export declare class PartnerConfigError extends Error {
|
|
34
|
+
readonly code: PartnerConfigErrorCode;
|
|
35
|
+
/** Optional context — e.g. for `OAUTH_METHOD_NOT_ALLOWED`, the method that was rejected. */
|
|
36
|
+
readonly detail?: string;
|
|
37
|
+
constructor(code: PartnerConfigErrorCode, message: string, detail?: string);
|
|
38
|
+
}
|
|
@@ -3,7 +3,7 @@ import { Environment } from '../types/index.js';
|
|
|
3
3
|
export declare function getBaseOAuthUrl(env: Environment): string;
|
|
4
4
|
export declare function getBaseUrl(env: Environment, scheme?: 'http' | 'ws'): string;
|
|
5
5
|
export declare function getBaseMPCNetworkUrl(env: Environment, useWebsocket?: boolean): string;
|
|
6
|
-
export declare function initClient({ env, version, apiKey, partnerId, useFetchAdapter, retrieveSessionCookie, persistSessionCookie, }: {
|
|
6
|
+
export declare function initClient({ env, version, apiKey, partnerId, useFetchAdapter, retrieveSessionCookie, persistSessionCookie, staticTraceContext, }: {
|
|
7
7
|
env: Environment;
|
|
8
8
|
version?: string;
|
|
9
9
|
apiKey: string;
|
|
@@ -11,4 +11,5 @@ export declare function initClient({ env, version, apiKey, partnerId, useFetchAd
|
|
|
11
11
|
useFetchAdapter?: boolean;
|
|
12
12
|
retrieveSessionCookie?: () => string;
|
|
13
13
|
persistSessionCookie?: (cookie: string) => void;
|
|
14
|
+
staticTraceContext?: Record<string, string>;
|
|
14
15
|
}): Client;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ParaCore } from './ParaCore.js';
|
|
2
|
-
export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, AuthMethod, type TAuthMethod, AuthMethodStatus, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TNetwork, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, type TOnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAssets, type OnRampPurchase, type OnRampAssetInfo, type ProviderAssetInfo, OnRampMethod,
|
|
2
|
+
export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, AuthMethod, type TAuthMethod, AuthMethodStatus, AuthLayout, type TAuthLayout, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type PartnerAppConfig, type WalletEntity, Network, type TNetwork, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, type TOnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAssets, type OnRampPurchase, type OnRampAssetInfo, type ProviderAssetInfo, OnRampMethod, OAuthMethod, type TOAuthMethod, type TLinkedAccountType, type SupportedAccountLinks, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type LinkedAccount, type LinkedAccounts, type TExternalWallet, type ExternalWalletInfo, type PregenAuth, type Setup2faResponse, type TelegramAuthResponse, type VerifyExternalWalletParams, type AssetMetadata, type AssetMetadataIndexed, type AssetValue, type BalancesConfig, type WalletBalance, type ProfileBalance, type OfframpDepositRequest, type WalletWithMetadata, RecoveryStatus, ThemeMode, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, LINKED_ACCOUNT_TYPES, EXTERNAL_WALLET_TYPES, EVM_WALLETS, SOLANA_WALLETS, COSMOS_WALLETS, formatAssetQuantity, formatCurrency, type EstimateTransactionOpts, type EstimateTransactionResult, type BroadcastTransactionOpts, type BroadcastTransactionResult, type PendingTransactionEntity, type SerializedDecodedTx, type SerializedTxData, type GetPendingTransactionResponse, DeliveryChannel, type PartnerThemeConfig as Theme, } from '@getpara/user-management-client';
|
|
3
3
|
export { PopupType, PregenIdentifierType, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type Wallet, type AvailableWallet, type AccountLinkInProgress, AccountLinkError, type InternalInterface, type Verify2faParams, type Verify2faResponse, type StorageType, type TelegramParams, type CreateParaSignerBaseOptions, } from './types/index.js';
|
|
4
4
|
export * from './types/smartAccounts.js';
|
|
5
5
|
export * from './types/coreApi.js';
|
|
6
6
|
export * from './types/events.js';
|
|
7
7
|
export * from './types/config.js';
|
|
8
|
-
export { getPortalDomain, dispatchEvent, onParaEvent, offParaEvent, entityToWallet, constructUrl, shortenUrl, isPortal, } from './utils/index.js';
|
|
8
|
+
export { getPortalDomain, dispatchEvent, onParaEvent, offParaEvent, entityToWallet, constructUrl, shortenUrl, isPortal, warnOnce, } from './utils/index.js';
|
|
9
9
|
export { PREFIX as STORAGE_PREFIX, PARA_PREFIX as PARA_STORAGE_PREFIX, LOCAL_STORAGE_CURRENT_WALLET_IDS, LOCAL_STORAGE_WALLETS, } from './constants.js';
|
|
10
10
|
export { distributeNewShare } from './shares/shareDistribution.js';
|
|
11
11
|
export { KeyContainer } from './shares/KeyContainer.js';
|
|
@@ -22,10 +22,22 @@ export * from './utils/phone.js';
|
|
|
22
22
|
export * from './utils/config.js';
|
|
23
23
|
export { isWalletSupported } from './utils/wallet.js';
|
|
24
24
|
export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
|
|
25
|
-
export { getPortalBaseURL } from './utils/url.js';
|
|
25
|
+
export { getPortalBaseURL, getParaConnectBaseUrl } from './utils/url.js';
|
|
26
|
+
export { encodeConfigParams, tryDecodeConfig, isCompressionStreamSupported, ENCODED_CONFIG_VERSION, } from './utils/configEncoding.js';
|
|
27
|
+
export type { EncodedConfig, EncodedAppConfig } from './utils/configEncoding.js';
|
|
26
28
|
export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
|
|
27
29
|
export type { ShareData } from './shares/enclave.js';
|
|
28
30
|
export type { StateSnapshot, AuthStateInfo } from './state/types/core';
|
|
29
31
|
export type * from './services/types';
|
|
32
|
+
export { getTracer, wrapWithSpan, wrapWithSpanInContext, extractTraceContextFromUrl, getUrlTraceCarrier, setDefaultParentContext, getDefaultParentContext, SpanStatusCode, } from './telemetry/tracer.js';
|
|
33
|
+
export type { Span, Attributes, Context } from './telemetry/tracer.js';
|
|
34
|
+
export { getOrCreateSessionId } from './telemetry/session.js';
|
|
35
|
+
export { initTelemetry, isTelemetryInitialized, onTelemetryReady, flushTelemetry } from './telemetry/init.js';
|
|
36
|
+
export { getUxState, setCurrentView, setLastInteraction } from './telemetry/uxState.js';
|
|
37
|
+
export { setCurrentUserId } from './telemetry/uxStateSpanProcessor.js';
|
|
38
|
+
export { recordActionOnSpan, type UxActionOutcome } from './telemetry/uxAction.js';
|
|
39
|
+
export { startModalSession, endModalSession, getModalSessionContext } from './telemetry/modalSession.js';
|
|
40
|
+
export type { InitTelemetryOpts } from './telemetry/init.js';
|
|
41
|
+
export type { PartnerTelemetryConfig } from './telemetry/config.js';
|
|
30
42
|
export declare const paraVersion: string;
|
|
31
43
|
export default ParaCore;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Auth, AuthExtras, AuthMethod, AuthType, ExternalWalletInfo, PrimaryAuth, PrimaryAuthInfo, ServerAuthState, ServerAuthStateLogin, TAuthMethod,
|
|
1
|
+
import type { Auth, AuthExtras, AuthMethod, AuthType, DeliveryChannel, ExternalWalletInfo, PrimaryAuth, PrimaryAuthInfo, ServerAuthState, ServerAuthStateLogin, TAuthMethod, PartnerThemeConfig, TOAuthMethod } from '@getpara/user-management-client';
|
|
2
2
|
import type { AuthState, AuthStateDone, AuthStateLogin, AuthStateSignup, AuthStateVerify, CoreAuthInfo, WithCustomTheme, WithSessionLookupId, WithShorten, WithUseShortUrls } from '../../types/index.js';
|
|
3
3
|
import type { InitOAuthPollingParams, PollingCallbacks } from './PollingServiceTypes.js';
|
|
4
4
|
import { PerformConnectExternalWalletResponse, ExternalSignMessageParams } from './ExternalWalletServiceTypes.js';
|
|
@@ -36,7 +36,7 @@ export type PrepareAuthStateMethod = <T extends ServerAuthState>(serverAuthState
|
|
|
36
36
|
}) => Promise<AuthState>;
|
|
37
37
|
export type PrepareLoginStateMethod = (loginState: ServerAuthStateLogin, options: {
|
|
38
38
|
useShortUrls?: boolean;
|
|
39
|
-
portalTheme?:
|
|
39
|
+
portalTheme?: PartnerThemeConfig;
|
|
40
40
|
sessionLookupId: string;
|
|
41
41
|
}) => Promise<AuthStateLogin>;
|
|
42
42
|
export interface AuthenticateWithEmailOrPhoneParams extends SignUpOrLogInParams {
|
|
@@ -145,6 +145,13 @@ export type AddCredentialMethod = (_: AddCredentialParams) => Promise<string | u
|
|
|
145
145
|
export type SupportedUserAuthMethodsMethod = () => Promise<Set<AuthMethod>>;
|
|
146
146
|
export interface ResendVerificationCodeParams {
|
|
147
147
|
type?: 'SIGNUP' | 'LINK_ACCOUNT' | 'LOGIN';
|
|
148
|
+
deliveryChannel?: DeliveryChannel;
|
|
148
149
|
}
|
|
149
|
-
export
|
|
150
|
+
export interface ResendVerificationCodeResponse {
|
|
151
|
+
deliveryChannel?: DeliveryChannel;
|
|
152
|
+
fallbackUsed?: boolean;
|
|
153
|
+
fallbackChannel?: DeliveryChannel;
|
|
154
|
+
isSmsAllowed?: boolean;
|
|
155
|
+
}
|
|
156
|
+
export type ResendVerificationCodeMethod = (_: ResendVerificationCodeParams) => Promise<ResendVerificationCodeResponse>;
|
|
150
157
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TAuthMethod, TOAuthMethod } from '@getpara/user-management-client';
|
|
2
|
-
import type { AccountLinkInProgress,
|
|
1
|
+
import type { TAuthMethod, TOAuthMethod, PartnerThemeConfig } from '@getpara/user-management-client';
|
|
2
|
+
import type { AccountLinkInProgress, WithAuthMethod, WithCustomTheme, WithSessionId, WithShorten } from '../../types/index.js';
|
|
3
3
|
type Device = {
|
|
4
4
|
sessionId: string;
|
|
5
5
|
encryptionKey: string;
|
|
@@ -11,7 +11,7 @@ export type PortalUrlOptions = {
|
|
|
11
11
|
thisDevice?: Device;
|
|
12
12
|
newDevice?: Device;
|
|
13
13
|
sessionId?: string;
|
|
14
|
-
portalTheme?:
|
|
14
|
+
portalTheme?: PartnerThemeConfig;
|
|
15
15
|
pathId?: string;
|
|
16
16
|
shorten?: boolean;
|
|
17
17
|
isEmbedded?: boolean;
|
|
@@ -111,6 +111,10 @@ export interface RequestFaucetParams {
|
|
|
111
111
|
chain?: string;
|
|
112
112
|
}
|
|
113
113
|
export interface RequestFaucetResponse {
|
|
114
|
+
/**
|
|
115
|
+
* Hash for the submitted faucet funding transaction. Wait for confirmation
|
|
116
|
+
* before assuming funds are spendable.
|
|
117
|
+
*/
|
|
114
118
|
transactionHash: string;
|
|
115
119
|
amount: string;
|
|
116
120
|
chain: string;
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
import { StateMachineInterface } from '../../types/serviceInterfaces.js';
|
|
2
|
+
/**
|
|
3
|
+
* Bootstraps the SDK. Runs the platform-specific `setup()` (Farcaster init,
|
|
4
|
+
* wallet-record backfill, etc.) AND an eager partner-record load via
|
|
5
|
+
* `touchSession` in parallel — both are independent network/IO tasks and
|
|
6
|
+
* the state machine only flips `isReady=true` once this actor resolves.
|
|
7
|
+
*
|
|
8
|
+
* Eager partner load lives here rather than inside each subclass's setup()
|
|
9
|
+
* so every consumer of core-sdk (ParaWeb, ParaServer, future subclasses)
|
|
10
|
+
* gets it for free — the state machine is the canonical SDK lifecycle,
|
|
11
|
+
* and "partner is loaded" is part of being ready.
|
|
12
|
+
*
|
|
13
|
+
* Skipped in the portal context where `ModalLayoutV2` runs its own
|
|
14
|
+
* getPartner fetch with separate telemetry plumbing — calling touchSession
|
|
15
|
+
* there would duplicate the call. Best-effort otherwise: a network failure
|
|
16
|
+
* keeps partner unloaded for now, partner-dependent code paths fall back
|
|
17
|
+
* to legacy props / lazy-load via `#assertPartner` at gated method
|
|
18
|
+
* call-sites, and the SDK still becomes ready.
|
|
19
|
+
*/
|
|
2
20
|
export declare const createSetupParaActor: (paraCoreInterface: StateMachineInterface) => import("xstate").PromiseActorLogic<void, {}, import("xstate").EventObject>;
|
|
@@ -842,7 +842,7 @@ export declare function createAuthStateMachine(paraCoreInterface: StateMachineIn
|
|
|
842
842
|
data: {
|
|
843
843
|
authState: ServerAuthState;
|
|
844
844
|
sessionLookupId: string;
|
|
845
|
-
portalTheme: import("
|
|
845
|
+
portalTheme: import("@getpara/user-management-client").PartnerThemeConfig;
|
|
846
846
|
useShortUrls: boolean;
|
|
847
847
|
};
|
|
848
848
|
finished: boolean;
|