@seams/wallet 0.31.0 → 0.33.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.

Potentially problematic release.


This version of @seams/wallet might be problematic. Click here for more details.

Files changed (68) hide show
  1. package/README.md +6 -6
  2. package/dist/.build-inputs.sha256 +1 -1
  3. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuFooter.js +38 -10
  4. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuSurface.js +23 -67
  5. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/RecoveryOptions.js +60 -0
  6. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/mountAuthMenuSurface.js +6 -0
  7. package/dist/esm/SeamsWeb/walletIframe/shared/authMenuPresentation.js +28 -0
  8. package/dist/esm/SeamsWeb/walletIframe/shared/messages.js +21 -10
  9. package/dist/esm/SeamsWeb/walletIframe/shared/walletAlternatives.js +4 -14
  10. package/dist/esm/core/ui/walletIcon.js +11 -3
  11. package/dist/esm/externalNear/controller.js +3 -2
  12. package/dist/esm/externalNear/meteor.js +1 -1
  13. package/dist/esm/externalNear/meteorRequest.js +8 -2
  14. package/dist/esm/react/components/HostedSeamsAuthMenu/shell.js +17 -1
  15. package/dist/esm/sdk/{host-DltV2Oan.js → host-BsVFOugh.js} +1 -1
  16. package/dist/esm/sdk/ownerNearOperation-BsIdSH0C.js +1 -0
  17. package/dist/esm/sdk/runtime-auth-CJCU2yJi.js +1 -0
  18. package/dist/{public/sdk/runtime-device-link-CGDZQK-D.js → esm/sdk/runtime-device-link-C0oXLSnz.js} +1 -1
  19. package/dist/esm/sdk/{runtime-ecdsa-tempo-BiJYKWK4.js → runtime-ecdsa-tempo-BC8u9NuI.js} +1 -1
  20. package/dist/esm/sdk/{runtime-email-otp-B0XCNDRb.js → runtime-email-otp-Cl4iu0z7.js} +1 -1
  21. package/dist/esm/sdk/{runtime-export-CXxv6KIx.js → runtime-export-BdhfErGJ.js} +1 -1
  22. package/dist/esm/sdk/{runtime-near-CuyS57wu.js → runtime-near-CT2ALBct.js} +1 -1
  23. package/dist/esm/sdk/{runtime-preferences-B2WBUZO7.js → runtime-preferences-fN2G9tct.js} +1 -1
  24. package/dist/esm/sdk/{runtime-recovery-KwVdSe94.js → runtime-recovery-n-TGLkwz.js} +1 -1
  25. package/dist/esm/sdk/{runtimeContext-Iy1vecX0.js → runtimeContext-DI28d8Qu.js} +1 -1
  26. package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
  27. package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
  28. package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
  29. package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
  30. package/dist/esm/sdk/wallet-service.css +2 -0
  31. package/dist/esm/sdk/wallet-ui.css +1 -1
  32. package/dist/public/headers.manifest.json +1 -1
  33. package/dist/public/sdk/{host-DltV2Oan.js → host-BsVFOugh.js} +1 -1
  34. package/dist/public/sdk/ownerNearOperation-BsIdSH0C.js +1 -0
  35. package/dist/public/sdk/runtime-auth-CJCU2yJi.js +1 -0
  36. package/dist/{esm/sdk/runtime-device-link-CGDZQK-D.js → public/sdk/runtime-device-link-C0oXLSnz.js} +1 -1
  37. package/dist/public/sdk/{runtime-ecdsa-tempo-BiJYKWK4.js → runtime-ecdsa-tempo-BC8u9NuI.js} +1 -1
  38. package/dist/public/sdk/{runtime-email-otp-B0XCNDRb.js → runtime-email-otp-Cl4iu0z7.js} +1 -1
  39. package/dist/public/sdk/{runtime-export-CXxv6KIx.js → runtime-export-BdhfErGJ.js} +1 -1
  40. package/dist/public/sdk/{runtime-near-CuyS57wu.js → runtime-near-CT2ALBct.js} +1 -1
  41. package/dist/public/sdk/{runtime-preferences-B2WBUZO7.js → runtime-preferences-fN2G9tct.js} +1 -1
  42. package/dist/public/sdk/{runtime-recovery-KwVdSe94.js → runtime-recovery-n-TGLkwz.js} +1 -1
  43. package/dist/public/sdk/{runtimeContext-Iy1vecX0.js → runtimeContext-DI28d8Qu.js} +1 -1
  44. package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
  45. package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
  46. package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
  47. package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
  48. package/dist/public/sdk/wallet-service.css +2 -0
  49. package/dist/public/sdk/wallet-ui.css +1 -1
  50. package/dist/public/wallet-assets.manifest.json +25 -25
  51. package/dist/public/wallet-service/index.html +4 -4
  52. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuFooter.d.ts +4 -0
  53. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuSurface.d.ts +3 -1
  54. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/RecoveryOptions.d.ts +11 -0
  55. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/mountAuthMenuSurface.d.ts +3 -0
  56. package/dist/types/wallet/src/SeamsWeb/walletIframe/shared/authMenuPresentation.d.ts +13 -0
  57. package/dist/types/wallet/src/SeamsWeb/walletIframe/shared/messages.d.ts +7 -1
  58. package/dist/types/wallet/src/core/ui/walletIcon.d.ts +1 -0
  59. package/dist/types/wallet/src/externalNear/meteorRequest.d.ts +3 -0
  60. package/dist/types/wallet/src/index.d.ts +1 -1
  61. package/dist/types/wallet/src/react/components/HostedSeamsAuthMenu/public.d.ts +1 -1
  62. package/dist/types/wallet/src/react/components/HostedSeamsAuthMenu/types.d.ts +6 -2
  63. package/dist/types/wallet/src/react/index.d.ts +1 -1
  64. package/package.json +1 -1
  65. package/dist/esm/sdk/ownerNearOperation-DCxxHcwX.js +0 -1
  66. package/dist/esm/sdk/runtime-auth-CP6P681o.js +0 -1
  67. package/dist/public/sdk/ownerNearOperation-DCxxHcwX.js +0 -1
  68. package/dist/public/sdk/runtime-auth-CP6P681o.js +0 -1
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "packageName": "@seams/wallet",
4
- "packageVersion": "0.31.0",
4
+ "packageVersion": "0.33.0",
5
5
  "assetRoot": "dist/public",
6
6
  "sdkBasePath": "/sdk",
7
7
  "walletServicePath": "/wallet-service",
8
8
  "headersManifest": "headers.manifest.json",
9
9
  "versionSkewContract": {
10
10
  "kind": "wallet_iframe_protocol_handshake",
11
- "packageVersion": "0.31.0",
12
- "protocolVersion": "20.0.0",
11
+ "packageVersion": "0.33.0",
12
+ "protocolVersion": "21.0.0",
13
13
  "readyPayloadField": "protocolVersion",
14
14
  "failureMode": "typed_error",
15
15
  "errorCode": "WALLET_IFRAME_PROTOCOL_VERSION_MISMATCH"
@@ -1258,8 +1258,8 @@
1258
1258
  ]
1259
1259
  },
1260
1260
  {
1261
- "route": "/sdk/host-DltV2Oan.js",
1262
- "sourceFile": "sdk/host-DltV2Oan.js",
1261
+ "route": "/sdk/host-BsVFOugh.js",
1262
+ "sourceFile": "sdk/host-BsVFOugh.js",
1263
1263
  "owner": "wallet_sdk_asset",
1264
1264
  "routeClass": "javascript",
1265
1265
  "contentType": "text/javascript; charset=utf-8",
@@ -1690,8 +1690,8 @@
1690
1690
  ]
1691
1691
  },
1692
1692
  {
1693
- "route": "/sdk/ownerNearOperation-DCxxHcwX.js",
1694
- "sourceFile": "sdk/ownerNearOperation-DCxxHcwX.js",
1693
+ "route": "/sdk/ownerNearOperation-BsIdSH0C.js",
1694
+ "sourceFile": "sdk/ownerNearOperation-BsIdSH0C.js",
1695
1695
  "owner": "wallet_sdk_asset",
1696
1696
  "routeClass": "javascript",
1697
1697
  "contentType": "text/javascript; charset=utf-8",
@@ -2170,8 +2170,8 @@
2170
2170
  ]
2171
2171
  },
2172
2172
  {
2173
- "route": "/sdk/runtime-auth-CP6P681o.js",
2174
- "sourceFile": "sdk/runtime-auth-CP6P681o.js",
2173
+ "route": "/sdk/runtime-auth-CJCU2yJi.js",
2174
+ "sourceFile": "sdk/runtime-auth-CJCU2yJi.js",
2175
2175
  "owner": "wallet_sdk_asset",
2176
2176
  "routeClass": "javascript",
2177
2177
  "contentType": "text/javascript; charset=utf-8",
@@ -2194,8 +2194,8 @@
2194
2194
  ]
2195
2195
  },
2196
2196
  {
2197
- "route": "/sdk/runtime-device-link-CGDZQK-D.js",
2198
- "sourceFile": "sdk/runtime-device-link-CGDZQK-D.js",
2197
+ "route": "/sdk/runtime-device-link-C0oXLSnz.js",
2198
+ "sourceFile": "sdk/runtime-device-link-C0oXLSnz.js",
2199
2199
  "owner": "wallet_sdk_asset",
2200
2200
  "routeClass": "javascript",
2201
2201
  "contentType": "text/javascript; charset=utf-8",
@@ -2218,8 +2218,8 @@
2218
2218
  ]
2219
2219
  },
2220
2220
  {
2221
- "route": "/sdk/runtime-ecdsa-tempo-BiJYKWK4.js",
2222
- "sourceFile": "sdk/runtime-ecdsa-tempo-BiJYKWK4.js",
2221
+ "route": "/sdk/runtime-ecdsa-tempo-BC8u9NuI.js",
2222
+ "sourceFile": "sdk/runtime-ecdsa-tempo-BC8u9NuI.js",
2223
2223
  "owner": "wallet_sdk_asset",
2224
2224
  "routeClass": "javascript",
2225
2225
  "contentType": "text/javascript; charset=utf-8",
@@ -2242,8 +2242,8 @@
2242
2242
  ]
2243
2243
  },
2244
2244
  {
2245
- "route": "/sdk/runtime-email-otp-B0XCNDRb.js",
2246
- "sourceFile": "sdk/runtime-email-otp-B0XCNDRb.js",
2245
+ "route": "/sdk/runtime-email-otp-Cl4iu0z7.js",
2246
+ "sourceFile": "sdk/runtime-email-otp-Cl4iu0z7.js",
2247
2247
  "owner": "wallet_sdk_asset",
2248
2248
  "routeClass": "javascript",
2249
2249
  "contentType": "text/javascript; charset=utf-8",
@@ -2266,8 +2266,8 @@
2266
2266
  ]
2267
2267
  },
2268
2268
  {
2269
- "route": "/sdk/runtime-export-CXxv6KIx.js",
2270
- "sourceFile": "sdk/runtime-export-CXxv6KIx.js",
2269
+ "route": "/sdk/runtime-export-BdhfErGJ.js",
2270
+ "sourceFile": "sdk/runtime-export-BdhfErGJ.js",
2271
2271
  "owner": "wallet_sdk_asset",
2272
2272
  "routeClass": "javascript",
2273
2273
  "contentType": "text/javascript; charset=utf-8",
@@ -2290,8 +2290,8 @@
2290
2290
  ]
2291
2291
  },
2292
2292
  {
2293
- "route": "/sdk/runtime-near-CuyS57wu.js",
2294
- "sourceFile": "sdk/runtime-near-CuyS57wu.js",
2293
+ "route": "/sdk/runtime-near-CT2ALBct.js",
2294
+ "sourceFile": "sdk/runtime-near-CT2ALBct.js",
2295
2295
  "owner": "wallet_sdk_asset",
2296
2296
  "routeClass": "javascript",
2297
2297
  "contentType": "text/javascript; charset=utf-8",
@@ -2314,8 +2314,8 @@
2314
2314
  ]
2315
2315
  },
2316
2316
  {
2317
- "route": "/sdk/runtime-preferences-B2WBUZO7.js",
2318
- "sourceFile": "sdk/runtime-preferences-B2WBUZO7.js",
2317
+ "route": "/sdk/runtime-preferences-fN2G9tct.js",
2318
+ "sourceFile": "sdk/runtime-preferences-fN2G9tct.js",
2319
2319
  "owner": "wallet_sdk_asset",
2320
2320
  "routeClass": "javascript",
2321
2321
  "contentType": "text/javascript; charset=utf-8",
@@ -2362,8 +2362,8 @@
2362
2362
  ]
2363
2363
  },
2364
2364
  {
2365
- "route": "/sdk/runtime-recovery-KwVdSe94.js",
2366
- "sourceFile": "sdk/runtime-recovery-KwVdSe94.js",
2365
+ "route": "/sdk/runtime-recovery-n-TGLkwz.js",
2366
+ "sourceFile": "sdk/runtime-recovery-n-TGLkwz.js",
2367
2367
  "owner": "wallet_sdk_asset",
2368
2368
  "routeClass": "javascript",
2369
2369
  "contentType": "text/javascript; charset=utf-8",
@@ -2386,8 +2386,8 @@
2386
2386
  ]
2387
2387
  },
2388
2388
  {
2389
- "route": "/sdk/runtimeContext-Iy1vecX0.js",
2390
- "sourceFile": "sdk/runtimeContext-Iy1vecX0.js",
2389
+ "route": "/sdk/runtimeContext-DI28d8Qu.js",
2390
+ "sourceFile": "sdk/runtimeContext-DI28d8Qu.js",
2391
2391
  "owner": "wallet_sdk_asset",
2392
2392
  "routeClass": "javascript",
2393
2393
  "contentType": "text/javascript; charset=utf-8",
@@ -5,14 +5,14 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Web3Authn Wallet Service</title>
7
7
  <!-- Surface styles are external so strict CSP can keep style-src 'self' -->
8
- <link rel="stylesheet" href="/sdk/wallet-ui.css?v=0.31.0" />
8
+ <link rel="stylesheet" href="/sdk/wallet-ui.css?v=0.33.0" />
9
9
  <!-- Minimal shims some ESM bundles expect (externalized to enable strict CSP) -->
10
- <script src="/sdk/wallet-shims.js?v=0.31.0"></script>
10
+ <script src="/sdk/wallet-shims.js?v=0.33.0"></script>
11
11
  <!-- Hint the browser to fetch the host script earlier -->
12
- <link rel="modulepreload" href="/sdk/wallet-iframe-host-runtime.js?v=0.31.0" crossorigin>
12
+ <link rel="modulepreload" href="/sdk/wallet-iframe-host-runtime.js?v=0.33.0" crossorigin>
13
13
  </head>
14
14
  <body>
15
15
  <!-- sdkBasePath points to the SDK root (e.g. '/sdk'). Load the host directly. -->
16
- <script type="module" src="/sdk/wallet-iframe-host-runtime.js?v=0.31.0"></script>
16
+ <script type="module" src="/sdk/wallet-iframe-host-runtime.js?v=0.33.0"></script>
17
17
  </body>
18
18
  </html>
@@ -1,8 +1,12 @@
1
1
  import { Component, type ComponentChildren } from 'preact';
2
+ import type { HostedAuthMenuFooterBrand } from '../../../shared/authMenuPresentation';
3
+ import type { WalletConnectionState } from '../../../shared/walletAlternatives';
2
4
  type AuthMenuFooterProps = {
3
5
  /** The failure to show in place of the brand line, or null when there is none. */
4
6
  readonly notice: string | null;
5
7
  readonly onRetry: () => void;
8
+ readonly brand: HostedAuthMenuFooterBrand;
9
+ readonly connection: WalletConnectionState;
6
10
  };
7
11
  /**
8
12
  * The strip along the card's bottom edge. It names who secures the menu, and a
@@ -5,8 +5,11 @@ import { type RecoveryCodeSelection } from './recovery-code-input';
5
5
  import { Component, type ComponentChildren } from 'preact';
6
6
  import type { CspStylesheetManager } from '../../../../../core/browser/walletIframe/csp-stylesheet';
7
7
  import { type AuthMenuIntent, type AuthMenuViewModel } from '../../auth-menu/domain';
8
+ import type { HostedAuthMenuFooterBrand, HostedAuthMenuRecoveryOptions } from '../../../shared/authMenuPresentation';
8
9
  type AuthMenuSurfaceProps = {
9
10
  readonly walletAlternatives: WalletAlternatives;
11
+ readonly recoveryOptions: HostedAuthMenuRecoveryOptions;
12
+ readonly footerBrand: HostedAuthMenuFooterBrand;
10
13
  readonly walletConnection: WalletConnectionState;
11
14
  readonly viewModel: AuthMenuViewModel;
12
15
  readonly element: HTMLElement;
@@ -118,7 +121,6 @@ export declare class AuthMenuSurface extends Component<AuthMenuSurfaceProps, Aut
118
121
  private readonly onWalletRowEntered;
119
122
  private renderPasskeyInput;
120
123
  private renderAuthMethods;
121
- private renderOtherOptions;
122
124
  private renderRecovery;
123
125
  private renderIntentSwitch;
124
126
  private renderWaiting;
@@ -0,0 +1,11 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from 'preact';
3
+ import type { HostedAuthMenuRecoveryOptions } from '../../../shared/authMenuPresentation';
4
+ type RecoveryOptionsProps = {
5
+ readonly display: HostedAuthMenuRecoveryOptions;
6
+ readonly onLinkDevice: () => void;
7
+ readonly onRecovery: () => void;
8
+ };
9
+ export declare function RecoveryOptions({ display, onLinkDevice, onRecovery, }: RecoveryOptionsProps): ComponentChildren;
10
+ export {};
11
+ //# sourceMappingURL=RecoveryOptions.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { HostedAuthMenuFooterBrand, HostedAuthMenuRecoveryOptions } from '../../../shared/authMenuPresentation';
1
2
  import { type WalletAlternatives, type WalletConnectionState } from '../../../shared/walletAlternatives';
2
3
  import type { AuthMenuIntent, AuthMenuViewModel } from '../../auth-menu/domain';
3
4
  export type AuthMenuSurfaceHandle = {
@@ -11,6 +12,8 @@ type MountAuthMenuSurfaceInput = {
11
12
  readonly viewModel: AuthMenuViewModel;
12
13
  readonly initialHeightCssPx?: number;
13
14
  readonly walletAlternatives?: WalletAlternatives;
15
+ readonly recoveryOptions?: HostedAuthMenuRecoveryOptions;
16
+ readonly footerBrand?: HostedAuthMenuFooterBrand;
14
17
  readonly onIntent: (intent: AuthMenuIntent) => void;
15
18
  };
16
19
  export declare function mountAuthMenuSurface(input: MountAuthMenuSurfaceInput): AuthMenuSurfaceHandle;
@@ -0,0 +1,13 @@
1
+ export type HostedAuthMenuRecoveryOptions = 'collapsible' | 'expanded' | 'hidden';
2
+ export type HostedAuthMenuFooterBrand = {
3
+ readonly kind: 'seams';
4
+ readonly logo?: never;
5
+ readonly name?: never;
6
+ } | {
7
+ readonly kind: 'custom';
8
+ readonly logo: string;
9
+ readonly name: string;
10
+ };
11
+ export declare function parseAuthMenuRecoveryOptions(value: unknown): HostedAuthMenuRecoveryOptions | null;
12
+ export declare function parseAuthMenuFooterBrand(value: unknown): HostedAuthMenuFooterBrand | null;
13
+ //# sourceMappingURL=authMenuPresentation.d.ts.map
@@ -1,3 +1,5 @@
1
+ import { type HostedAuthMenuFooterBrand, type HostedAuthMenuRecoveryOptions } from './authMenuPresentation';
2
+ export type { HostedAuthMenuFooterBrand, HostedAuthMenuRecoveryOptions, } from './authMenuPresentation';
1
3
  import { type WalletAlternatives, type WalletConnectionRequest, type WalletConnectionResolution } from './walletAlternatives';
2
4
  import type { OwnerNearCommand } from './ownerNearOperation';
3
5
  import type { WalletSessionHome } from '../../../../../shared-ts/src/device-linking/contracts';
@@ -98,6 +100,8 @@ export type HostedAuthMenuOpenRequest = {
98
100
  copy: HostedAuthMenuCopy;
99
101
  enabledExternalProviders: readonly HostedAuthMenuExternalProvider[];
100
102
  walletAlternatives: WalletAlternatives;
103
+ recoveryOptions: HostedAuthMenuRecoveryOptions;
104
+ footerBrand: HostedAuthMenuFooterBrand;
101
105
  };
102
106
  export type HostedAuthMenuExternalAuthRequest = {
103
107
  kind: 'hosted_auth_menu_external_auth_request_v1';
@@ -189,6 +193,8 @@ export declare function buildHostedAuthMenuOpenRequest(args: {
189
193
  copy?: HostedAuthMenuCopyInput;
190
194
  enabledExternalProviders?: readonly HostedAuthMenuExternalProvider[];
191
195
  walletAlternatives?: WalletAlternatives;
196
+ recoveryOptions?: HostedAuthMenuRecoveryOptions;
197
+ footerBrand?: HostedAuthMenuFooterBrand;
192
198
  }): HostedAuthMenuOpenRequest;
193
199
  export declare function parseHostedAuthMenuExternalAuthRequest(value: unknown): HostedAuthMenuExternalAuthRequest | null;
194
200
  export declare function parseHostedAuthMenuErrorEvent(value: unknown): HostedAuthMenuErrorEvent | null;
@@ -200,7 +206,7 @@ export declare function buildHostedAuthMenuCancelPayload(args: {
200
206
  reason: HostedAuthMenuCancelReason;
201
207
  }): HostedAuthMenuCancelPayload;
202
208
  export declare function parseHostedAuthMenuOutcome(value: unknown): HostedAuthMenuOutcome | null;
203
- export declare const WALLET_PROTOCOL_VERSION: '20.0.0';
209
+ export declare const WALLET_PROTOCOL_VERSION: '21.0.0';
204
210
  export declare const WALLET_IFRAME_PROTOCOL_VERSION_MISMATCH: 'WALLET_IFRAME_PROTOCOL_VERSION_MISMATCH';
205
211
  export type WalletProtocolVersion = typeof WALLET_PROTOCOL_VERSION;
206
212
  export type ParentToChildType = 'PM_SET_TRANSACTION_VIEW' | 'PM_TRANSACTION_BROADCAST_STARTED' | 'PING' | 'PM_PREPARE_WALLET_RUNTIME' | 'PM_SET_CONFIG' | 'PM_ACTIVATE_TRANSACTION_REVIEW' | 'PM_CANCEL' | 'PM_OPEN_AUTH_MENU' | 'PM_CANCEL_AUTH_MENU' | 'PM_RESOLVE_AUTH_MENU_EXTERNAL_AUTH' | 'PM_RESOLVE_WALLET_CONNECTION' | 'PM_REDEEM_HOSTED_WALLET_SEAMS_SESSION' | 'PM_REGISTER_WALLET' | 'PM_ADD_WALLET_SIGNER' | 'PM_ADD_PASSKEY' | 'PM_ACTIVATE_AUTH_METHOD' | 'PM_GET_AUTH_METHOD_AVAILABILITY' | 'PM_SET_AUTH_METHOD_ENABLED' | 'PM_ADD_EMAIL_OTP' | 'PM_REVOKE_AUTH_METHOD' | 'PM_UNLOCK' | 'PM_UNLOCK_AUTH_METHOD' | 'PM_EXTERNAL_AUTH' | 'PM_EXTERNAL_OWNER_AUTH' | 'PM_LOCK' | 'PM_LOCK_EXACT_WALLET_SESSION' | 'PM_GET_LAST_WALLET_MOVE_REQUEST' | 'PM_MOVE_WALLET' | 'PM_GET_WALLET_MOVE' | 'PM_GET_WALLET_PLACEMENT' | 'PM_GET_WALLET_SESSION' | 'PM_GET_EXACT_WALLET_SESSION_STATE' | 'PM_GET_NEAR_PROVISIONING_STATE' | 'PM_REQUEST_EMAIL_OTP_CHALLENGE' | 'PM_BEGIN_GOOGLE_EMAIL_OTP_WALLET_AUTH' | 'PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_RESEND' | 'PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_REROLL_WALLET_ID' | 'PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_SUBMIT' | 'PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_COMPLETE_REGISTRATION' | 'PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_CANCEL' | 'PM_GET_WALLET_RECOVERY_CODE_STATUS' | 'PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP' | 'PM_ROTATE_WALLET_RECOVERY_CODES' | 'PM_REQUEST_WALLET_CUSTODY_EMAIL_OTP_CHALLENGE' | 'PM_SIGN_TX_WITH_ACTIONS' | 'PM_OWNER_NEAR_TRANSACTION' | 'PM_SIGN_AND_SEND_TX' | 'PM_SEND_TRANSACTION' | 'PM_SIGN_DELEGATE_ACTION' | 'PM_SIGN_NEP413' | 'PM_SIGN_TEMPO' | 'PM_REPORT_TEMPO_BROADCAST_ACCEPTED' | 'PM_REPORT_TEMPO_BROADCAST_REJECTED' | 'PM_REPORT_TEMPO_FINALIZED' | 'PM_REPORT_TEMPO_DROPPED_OR_REPLACED' | 'PM_RECONCILE_TEMPO_NONCE_LANE' | 'PM_RESOLVE_EXACT_KEY_EXPORT_LANE' | 'PM_EXPORT_KEYPAIR_UI' | 'PM_GET_RECENT_UNLOCKS' | 'PM_SET_CONFIRM_BEHAVIOR' | 'PM_SET_CONFIRMATION_CONFIG' | 'PM_GET_CONFIRMATION_CONFIG' | 'PM_HAS_PASSKEY' | 'PM_LIST_LINKED_DEVICES' | 'PM_REVOKE_LINKED_DEVICE' | 'PM_SCAN_AND_LINK_DEVICE' | 'PM_START_DEVICE2_LINKING_FLOW' | 'PM_DEVICE_LINK_TARGET_FACTOR_ACTION' | 'PM_DEVICE_LINK_EMAIL_OTP_BASE_FACTOR_ACTION' | 'PM_CANCEL_DEVICE_LINKING' | 'PM_SYNC_ACCOUNT_FLOW';
@@ -1,3 +1,4 @@
1
1
  export declare const MAX_WALLET_ICON_LENGTH = 131072;
2
+ export declare function parseWalletImageUrl(value: unknown): string | null;
2
3
  export declare function parseWalletDataIcon(value: unknown): string | null;
3
4
  //# sourceMappingURL=walletIcon.d.ts.map
@@ -2,6 +2,9 @@ import type { ExternalNearNetwork } from './types';
2
2
  type MeteorTransport = {
3
3
  sendMessageDataAndRespond(request: object): Promise<unknown>;
4
4
  };
5
+ export declare class MeteorTransportUnavailableError extends Error {
6
+ constructor();
7
+ }
5
8
  export declare function meteorTransportFromWindow(): MeteorTransport;
6
9
  /** Heartbeats carry one request ID; they never create a second signing request. */
7
10
  export declare class MeteorRequest {
@@ -8,7 +8,7 @@ export type { AuthMenuCapability, ClientConnectionState, ConfigCapability, Conne
8
8
  export * from './externalEvm';
9
9
  export type { ExternalAuthenticateInput, ExternalAuthAttempt, ExternalAuthResult, ExternalWalletAuthentication, ExternalWalletSettings, } from '../../shared-ts/src/auth/externalAuth';
10
10
  export { buildHostedAuthMenuOpenRequest, hostedAuthMenuExternalAuthRequestIdFromBoundary, hostedAuthMenuSessionIdFromBoundary, } from './SeamsWeb/walletIframe/shared/messages';
11
- export type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalAuthRequestId, HostedAuthMenuExternalAuthResolutionInput, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId, } from './SeamsWeb/walletIframe/shared/messages';
11
+ export type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuFooterBrand, HostedAuthMenuRecoveryOptions, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalAuthRequestId, HostedAuthMenuExternalAuthResolutionInput, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId, } from './SeamsWeb/walletIframe/shared/messages';
12
12
  export { BrowserCapabilityUnavailableError } from './SeamsWeb/publicApi/capabilitySelection';
13
13
  export type { BrowserCapabilitySelectionResult, BrowserCapabilityUnavailableReason, BrowserCapabilityUnavailableSelection, } from './SeamsWeb/publicApi/capabilitySelection';
14
14
  export type { WalletIframeExactSessionIdentity, WalletIframeExactSessionState, } from './SeamsWeb/walletIframe/shared/exactSessionState';
@@ -1,7 +1,7 @@
1
1
  export { SeamsAuthMenuMock } from './SeamsAuthMenuMock';
2
2
  import { HostedSeamsAuthMenu } from './shell';
3
3
  export { HostedSeamsAuthMenu };
4
- export type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuExternalAuthBroker, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId, HostedSeamsAuthMenuProps, } from './types';
4
+ export type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuFooterBrand, HostedAuthMenuRecoveryOptions, HostedAuthMenuExternalAuthBroker, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId, HostedSeamsAuthMenuProps, } from './types';
5
5
  export default HostedSeamsAuthMenu;
6
6
  export type { WalletAlternative, WalletAlternativesConfig } from './walletAlternatives';
7
7
  //# sourceMappingURL=public.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { WalletAlternativesConfig } from './walletAlternatives';
2
2
  export type { WalletAlternative, WalletAlternativesConfig } from './walletAlternatives';
3
- import type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId } from '../../../SeamsWeb/walletIframe/shared/messages';
4
- export type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId, };
3
+ import type { HostedAuthMenuFooterBrand, HostedAuthMenuRecoveryOptions, HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId } from '../../../SeamsWeb/walletIframe/shared/messages';
4
+ export type { HostedAuthMenuFooterBrand, HostedAuthMenuRecoveryOptions, HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId, };
5
5
  /**
6
6
  * Acquires app-origin evidence for a provider interaction requested by the wallet host.
7
7
  * The request carries the exact session and provider-request identities from the iframe.
@@ -9,6 +9,10 @@ export type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuExterna
9
9
  export type HostedAuthMenuExternalAuthBroker = (request: HostedAuthMenuExternalAuthRequest) => HostedAuthMenuExternalAuthEvidence | Promise<HostedAuthMenuExternalAuthEvidence>;
10
10
  type HostedAuthMenuOutcomeHandler = (outcome: HostedAuthMenuOutcome) => void;
11
11
  export interface HostedSeamsAuthMenuProps {
12
+ /** Recovery and device-link controls. Defaults to collapsible. */
13
+ recoveryOptions?: HostedAuthMenuRecoveryOptions;
14
+ /** Replace the Seams footer with an HTTPS or image data URL and accessible name. */
15
+ footerBrand?: HostedAuthMenuFooterBrand;
12
16
  /** Explicit ordered wallet groups. Omitted or empty groups render no UI. */
13
17
  walletAlternatives?: WalletAlternativesConfig;
14
18
  /** Initial panel height for a continuous transition from an app-origin menu. */
@@ -65,7 +65,7 @@ export { ShowQRCode } from './components/ShowQRCode';
65
65
  export type { ShowQRCodeProps } from './components/ShowQRCode';
66
66
  export { HostedSeamsAuthMenu, SeamsAuthMenuMock } from './components/HostedSeamsAuthMenu/public';
67
67
  export type { WalletAlternative, WalletAlternativesConfig, } from './components/HostedSeamsAuthMenu/walletAlternatives';
68
- export type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuExternalAuthBroker, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId, HostedSeamsAuthMenuProps, } from './components/HostedSeamsAuthMenu/public';
68
+ export type { HostedAuthMenuCopy, HostedAuthMenuCopyInput, HostedAuthMenuFooterBrand, HostedAuthMenuRecoveryOptions, HostedAuthMenuExternalAuthBroker, HostedAuthMenuExternalAuthEvidence, HostedAuthMenuExternalAuthRequest, HostedAuthMenuExternalProvider, HostedAuthMenuMode, HostedAuthMenuOpenRequest, HostedAuthMenuOutcome, HostedAuthMenuRegistrationAccountInput, HostedAuthMenuSessionId, HostedSeamsAuthMenuProps, } from './components/HostedSeamsAuthMenu/public';
69
69
  export { default as TouchIcon } from './components/AccountMenuButton/icons/TouchIcon';
70
70
  export { default as QRCodeIcon } from './components/QRCodeIcon';
71
71
  export { default as SunIcon } from './components/AccountMenuButton/icons/SunIcon';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seams/wallet",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "type": "module",
5
5
  "description": "Seams web and runtime TypeScript SDK for NEAR and EVM-family wallets",
6
6
  "main": "./dist/esm/index.js",
@@ -1 +0,0 @@
1
- import{E as e,k as t}from"./domainIds-t1lp25yU.js";import{S as n,b as r,g as i,x as a}from"./digests-BIaE0DMd.js";import{N as o,r as s}from"./activeWalletSession-HAOgRKzn.js";import{t as c}from"./walletIframeIdentity-Cz82I_Uh.js";import{r as l}from"./canonicalPrimitives-DKeS3M40.js";import{o as u}from"./errors-BJBDbwHk.js";import{s as d}from"./nearRpcResults-CeHdqaS4.js";import{n as f}from"./ed25519OperationFingerprint-Dev4P6Og.js";import{r as ee}from"./types-D2Zk1W7I.js";import{t as te}from"./accountIds-DGWFzEnw.js";import{t as p}from"./actions-7SvZZut1.js";const m=`__SEAMS_WALLET_SDK_BASE__`,h=`SEAMS_WALLET_SDK_BASE_CHANGED`,g=`__SEAMS_WALLET_ASSET_VERSION__`;function ne(){if(typeof window>`u`)return;let e=window[m];return typeof e==`string`&&e.length>0?e:void 0}function _(e){if(typeof window>`u`)return;let t=window;t[m]=e,window.dispatchEvent(new CustomEvent(h,{detail:e}))}function v(){if(typeof window>`u`)return;let e=window[g];return typeof e==`string`&&e.length>0?e:void 0}function re(e){if(typeof window>`u`)return;let t=e.trim();t&&(window[g]=t)}function ie(e){if(typeof window>`u`)return()=>{};let t=t=>{let n=t.detail;typeof n==`string`&&n.length>0&&e(n)};return window.addEventListener(h,t,{passive:!0}),()=>window.removeEventListener(h,t)}function ae(e){return typeof e!=`string`||e.length>131072||!/^data:image\/(?:png|webp|jpeg|svg\+xml)[;,]/i.test(e)?null:e}function y(){return{primary:[],secondary:[]}}function b(e){return typeof e==`string`&&e.trim().length>0&&e.length<=512}function x(e){if(e===null)return{ok:!0,value:null};let t=ae(e);if(t!==null)return{ok:!0,value:t};if(typeof e!=`string`||e.length>131072)return{ok:!1};try{if(new URL(e).protocol===`https:`)return{ok:!0,value:e}}catch{return{ok:!1}}return{ok:!1}}function S(e,t){if(!Array.isArray(e)||e.length>32)return null;let n=[];for(let r of e){if(!i(r)||!b(r.id)||!b(r.label)||typeof r.description!=`string`||r.description.length>512||t.has(r.id))return null;let e=x(r.icon);if(!e.ok)return null;t.add(r.id),n.push({id:r.id,label:r.label,description:r.description,icon:e.value})}return n}function oe(e){if(!i(e))return null;let t=new Set,n=S(e.primary,t),r=S(e.secondary,t);return n&&r?{primary:n,secondary:r}:null}function se(e){if(!i(e)||!i(e.result))return null;let t=O(e.authMenuSessionId),n;try{n=c(e.requestId)}catch{return null}if(!t||!b(e.connectionRequestId))return null;let r;switch(e.result.kind){case`connected`:case`cancelled`:if(e.result.message!==void 0)return null;r={kind:e.result.kind};break;case`failed`:if(!b(e.result.message))return null;r={kind:`failed`,message:e.result.message};break;default:return null}return{authMenuSessionId:t,requestId:n,connectionRequestId:e.connectionRequestId,result:r}}const C={login:{title:`Welcome back`,subtitle:``,passkeyCta:`Unlock with passkey`},register:{title:`Create a wallet`,subtitle:``,passkeyNameLabel:`Wallet name`,passkeyCta:`Create wallet with passkey`},common:{closeLabel:`Close`}};function w(e,t){return typeof e==`string`&&e.trim()||null}function T(e,t){let n=w(e,t);return n===null?null:n}function E(e){try{return c(e)}catch{return null}}function D(e,t){let n=new Set(t);return Object.keys(e).every(e=>n.has(e))}function O(e){return T(e,`authMenuSessionId`)}function k(e){return T(e,`externalAuthRequestId`)}function A(e){return i(e)?e:null}function j(e,t=new Set,n=!1){if(e===void 0)return n;if(e===null||typeof e==`string`||typeof e==`boolean`)return!0;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`||t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>j(e,t,n));let r=A(e);return r!==null&&Object.values(r).every(e=>j(e,t,n))}function M(e,t){return w(e,`copy`)??t}function N(e,t){let n=A(e);return{title:M(n?.title,t.title),subtitle:M(n?.subtitle,t.subtitle),passkeyCta:M(n?.passkeyCta,t.passkeyCta)}}function ce(e){let t=A(e),n=A(t?.register);return{login:N(t?.login,C.login),register:{...N(t?.register,C.register),passkeyNameLabel:M(n?.passkeyNameLabel,C.register.passkeyNameLabel)},common:{closeLabel:M(A(t?.common)?.closeLabel,C.common.closeLabel)}}}function P(e){return e===`google`?e:null}function F(e){return e===`login`||e===`register`?e:null}function I(e){return e===`implicit_wallet`||e===`sponsored_named_near_account`?e:null}function L(e){return e===`close_button`||e===`component_unmounted`||e===`connection_closed`?e:null}function R(e,t){if(e===void 0)return!0;let n=A(e);return n!==null&&D(n,t)}function z(e){let t=A(e);return!t||!D(t,[`login`,`register`,`common`])?!1:R(t.login,[`title`,`subtitle`,`passkeyCta`])&&R(t.register,[`title`,`subtitle`,`passkeyCta`,`passkeyNameLabel`])&&R(t.common,[`closeLabel`])}function B(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=P(n);if(!e)return null;t.push(e)}return t}function V(e){let n=A(e);if(!n||!j(n,new Set,!0)||n.kind!==`hosted_auth_menu_open_v1`||!D(n,[`kind`,`authMenuSessionId`,`initialMode`,`initialHeightCssPx`,`loginTarget`,`registrationAccountInput`,`showRegistrationInput`,`showProgress`,`copy`,`enabledExternalProviders`,`walletAlternatives`])||!z(n.copy))return null;let r=O(n.authMenuSessionId),i=F(n.initialMode),a=n.initialHeightCssPx;if(a!==void 0&&(typeof a!=`number`||!Number.isFinite(a)||a<=0))return null;let o=A(n.loginTarget),s=o?.kind===`wallet`||o?.kind===`wallet_sync`?t(o.walletId):null,c=o?.kind===`discoverable`&&D(o,[`kind`])?{kind:`discoverable`}:o?.kind===`wallet`&&D(o,[`kind`,`walletId`])&&s?.ok?{kind:`wallet`,walletId:s.value}:o?.kind===`wallet_sync`&&D(o,[`kind`,`walletId`])&&s?.ok?{kind:`wallet_sync`,walletId:s.value}:null,l=I(n.registrationAccountInput),u=B(n.enabledExternalProviders),d=n.walletAlternatives===void 0?y():oe(n.walletAlternatives);return!r||!i||!c||!l||typeof n.showRegistrationInput!=`boolean`||typeof n.showProgress!=`boolean`||!u||!d||!j(n.copy,new Set,!0)?null:{kind:`hosted_auth_menu_open_v1`,authMenuSessionId:r,initialMode:i,initialHeightCssPx:a,loginTarget:c,registrationAccountInput:l,showRegistrationInput:n.showRegistrationInput,showProgress:n.showProgress,copy:ce(n.copy),enabledExternalProviders:u,walletAlternatives:d}}function H(e){let t=A(e);if(!t||!j(t)||t.kind!==`hosted_auth_menu_error_v1`||!D(t,[`kind`,`authMenuSessionId`,`mode`,`message`]))return null;let n=O(t.authMenuSessionId),r=F(t.mode),i=w(t.message,`message`);return n&&r&&i?{kind:t.kind,authMenuSessionId:n,mode:r,message:i}:null}function U(e){let t=A(e);if(!t||!j(t))return null;switch(t.kind){case`google_id_token`:{if(!D(t,[`kind`,`idToken`]))return null;let e=w(t.idToken,`idToken`);return e?{kind:t.kind,idToken:e}:null}case`cancelled`:return D(t,[`kind`,`reason`])&&t.reason===`user_cancelled`?{kind:t.kind,reason:t.reason}:null;case`failed`:{if(!D(t,[`kind`,`code`,`message`]))return null;let e=t.code===`provider_unavailable`||t.code===`provider_error`||t.code===`invalid_evidence`?t.code:null,n=w(t.message,`message`);return e&&n?{kind:t.kind,code:e,message:n}:null}default:return null}}function W(e){let t=A(e);if(!t||!j(t)||t.kind!==`hosted_auth_menu_external_auth_resolution_v1`||!D(t,[`kind`,`authMenuSessionId`,`externalAuthRequestId`,`requestId`,`evidence`]))return null;let n=O(t.authMenuSessionId),r=k(t.externalAuthRequestId),i=E(t.requestId),a=U(t.evidence);return!n||!r||!i||!a?null:{kind:t.kind,authMenuSessionId:n,externalAuthRequestId:r,requestId:i,evidence:a}}function G(e){let t=A(e);if(!t||!j(t)||t.kind!==`hosted_auth_menu_cancel_v1`||!D(t,[`kind`,`authMenuSessionId`,`requestId`,`reason`]))return null;let n=O(t.authMenuSessionId),r=E(t.requestId),i=L(t.reason);return n&&r&&i?{kind:t.kind,authMenuSessionId:n,requestId:r,reason:i}:null}const le=`20.0.0`,ue=`WALLET_IFRAME_PROTOCOL_VERSION_MISMATCH`,K=[`home`,`exchangeCode`,`nonce`,`appOrigin`,`walletOrigin`,`relayUrl`];function q(e,t){if(typeof e!=`string`||e.length===0||e.length>512||e.trim()!==e||/[\s\u0000-\u001f\u007f]/.test(e))throw Error(`${t} must be a compact opaque identifier`);return e}function J(e,t){if(typeof e!=`string`||e.length===0||e.trim()!==e)throw Error(`${t} must be a canonical HTTP origin`);let n;try{n=new URL(e)}catch{throw Error(`${t} must be a canonical HTTP origin`)}if(n.protocol!==`https:`&&n.protocol!==`http:`||n.origin!==e||n.pathname!==`/`||n.search!==``||n.hash!==``)throw Error(`${t} must be a canonical HTTP origin`);return n.origin}function de(e){if(!i(e))throw Error(`hosted-wallet redemption payload must be an exact object`);if(Object.keys(e).length!==K.length)throw Error(`hosted-wallet redemption payload fields are invalid`);for(let t of K)if(!Object.hasOwn(e,t))throw Error(`hosted-wallet redemption payload fields are invalid`);return{home:s(e.home),exchangeCode:q(e.exchangeCode,`exchangeCode`),nonce:q(e.nonce,`nonce`),appOrigin:J(e.appOrigin,`appOrigin`),walletOrigin:J(e.walletOrigin,`walletOrigin`),relayUrl:q(e.relayUrl,`relayUrl`)}}function fe(t){if(!i(t)||!D(t,[`scanRequestId`,`action`])||typeof t.scanRequestId!=`string`||t.scanRequestId.length===0||!i(t.action))return null;let n=t.action;if(n.kind===`cancel`)return D(n,[`kind`])?{scanRequestId:t.scanRequestId,action:{kind:n.kind}}:null;if(n.kind!==`select`||!D(n,[`kind`,`baseWalletAuthMethodId`]))return null;let r=e(n.baseWalletAuthMethodId);return r.ok?{scanRequestId:t.scanRequestId,action:{kind:n.kind,baseWalletAuthMethodId:r.value}}:null}function pe(e){if(!i(e)||!D(e,[`activationId`,`action`])||typeof e.activationId!=`string`||e.activationId.length===0||!i(e.action))return null;let t=e.action;switch(t.kind){case`create_passkey`:case`send_email_otp`:case`resend_email_otp`:return D(t,[`kind`])?{activationId:e.activationId,action:{kind:t.kind}}:null;case`submit_email_otp`:return D(t,[`kind`,`otpCode`])&&typeof t.otpCode==`string`&&/^\d{6}$/.test(t.otpCode)?{activationId:e.activationId,action:{kind:t.kind,otpCode:t.otpCode}}:null;default:return null}}function me(e){let t=n(e,`NEAR transaction result`);if(t.success===!0){let e=r(t.transactionId,`transactionId`),n=d(t.result);if(e!==n.transaction.hash)throw Error(`NEAR transaction result contains different transaction hashes`);return typeof n.status==`object`&&`Failure`in n.status?Y(e,Error(`NEAR transaction execution failed`)):{success:!0,transactionId:e,result:n}}if(t.success!==!1)throw Error(`Invalid NEAR transaction result`);let i=a(t.error,`NEAR transaction error`);switch(t.kind){case`not_submitted`:return{success:!1,kind:`not_submitted`,error:i};case`submission_unknown`:return{success:!1,kind:`submission_unknown`,error:i};case`unresolved`:return{success:!1,kind:`unresolved`,transactionId:r(t.transactionId,`transactionId`),error:i};default:throw Error(`Invalid NEAR transaction failure`)}}function he(e,t){return{success:!1,kind:t,error:u(e)||`NEAR transaction failed`}}function Y(e,t){return{success:!1,kind:`unresolved`,transactionId:e,error:u(t)}}function ge(){return{appIdentity:{kind:`anonymous`},authentication:{kind:`signed_out`},capabilityProjection:{kind:`not_requested`},nonceDiagnostics:null}}let X=0;function _e(){return X+=1,X}const ve=`/wallet/external-auth`;function ye(e){let t=n(e,`external identity`),i=t.provider,a=r(t.issuer,`issuer`),o=r(t.subject,`subject`);switch(i){case`google`:if(a!==`https://accounts.google.com`)throw Error(`Invalid Google issuer`);return{provider:i,issuer:a,subject:o};case`application`:return{provider:i,issuer:a,subject:o};default:throw Error(`Invalid external identity provider`)}}function be(e){let i=n(e,`external owner challenge`),a=t(i.walletId);if(!a.ok)throw Error(`Invalid owner challenge wallet`);let s=a.value,c=r(i.attemptId,`attemptId`),u=ye(i.identity),d=l(i.challengeB64u),f=o(i.expiresAtMs,`owner challenge expiry`);switch(i.kind){case`associate`:return{kind:`associate`,walletId:s,attemptId:c,identity:u,challengeB64u:d,expiresAtMs:f};case`unlink`:return{kind:`unlink`,walletId:s,attemptId:c,identity:u,challengeB64u:d,expiresAtMs:f,associationId:r(i.associationId,`associationId`)};default:throw Error(`Invalid owner challenge purpose`)}}function xe(e){let t=n(e,`external auth command`);if(t.action===`prepare`||t.action===`prepare_association`)return{action:t.action,walletId:r(t.walletId,`walletId`)};if(t.action===`unlink`)return{action:`unlink`,walletId:r(t.walletId,`walletId`),associationId:r(t.associationId,`associationId`)};if(t.action!==`authenticate`&&t.action!==`associate`)throw Error(`Invalid external authentication command`);let i=n(t.input,`authentication input`),a=r(i.walletId,`walletId`);if(i.method===`google`)return{action:t.action,input:{method:`google`,walletId:a,idToken:r(i.idToken,`idToken`)}};if(i.method===`handoff`)return{action:t.action,input:{method:`handoff`,walletId:a,attemptId:r(i.attemptId,`attemptId`),code:r(i.code,`code`)}};throw Error(`Unsupported external authentication method`)}function Z(e){let i=n(e,`external authentication`),a=t(i.walletId);if(!a.ok||i.kind!==`external_authenticated`||i.provider!==`google`&&i.provider!==`application`||i.permission!==`wallet_settings_read`||`authMethod`in i)throw Error(`External authentication is invalid`);return{kind:`external_authenticated`,walletId:a.value,sessionId:r(i.sessionId,`sessionId`),associationId:r(i.associationId,`associationId`),environmentId:r(i.environmentId,`environmentId`),provider:i.provider,permission:`wallet_settings_read`,expiresAtMs:o(i.expiresAtMs,`expiresAtMs`)}}function Q(e){return{ok:!1,code:e,message:`Wallet authentication could not be completed.`}}function Se(e){let t=n(e,`external authentication failure`);switch(t.code){case`invalid_request`:case`invalid_credential`:case`access_denied`:case`expired`:case`superseded`:case`unavailable`:case`rate_limited`:case`cancelled`:return Q(t.code);default:return Q(`unavailable`)}}function Ce(e){let t=n(e,`external settings`);if(!Array.isArray(t.accounts)||!Array.isArray(t.methods)||!Array.isArray(t.devices))throw Error(`Invalid wallet settings`);return{authentication:Z(t.authentication),accounts:t.accounts.map(we),methods:t.methods.map(Te),devices:t.devices.map(Ee)}}function we(e){let t=n(e,`account`);if(t.family!==`ed25519`&&t.family!==`ecdsa`)throw Error(`Invalid account family`);return{family:t.family,address:r(t.address,`address`),publicKey:r(t.publicKey,`publicKey`)}}function Te(e){let t=n(e,`method`);if(t.kind!==`passkey`&&t.kind!==`email_otp`&&t.kind!==`voiceid`)throw Error(`Invalid method`);return{id:r(t.id,`id`),kind:t.kind}}function Ee(e){return{id:r(n(e,`device`).id,`id`)}}function $(e){let i=n(e,`owner operation recovery`),a=r(i.operationId,`operationId`);if(!/^owner-near:[A-Za-z0-9_-]{32,64}$/.test(a))throw Error(`Invalid owner operation ID.`);let o=t(i.walletId);if(!o.ok)throw Error(`Invalid owner operation wallet.`);return{operationId:ee.signingOperation(a),walletId:o.value,nearAccountId:te(r(i.nearAccountId,`nearAccountId`))}}function De(e){let t=n(e,`owner operation command`),r=Z(t.authentication),i=$(t.recovery);if(i.walletId!==String(r.walletId))throw Error(`Owner operation wallet mismatch.`);switch(t.action){case`recover`:return{action:`recover`,authentication:r,recovery:i};case`approve`:{let e=n(t.transaction,`transaction`),a=f({nearAccountId:i.nearAccountId,receiverId:e.receiverId,actions:e.actions},`transaction`);if(a.nearAccountId!==String(i.nearAccountId))throw Error(`Owner operation account mismatch.`);let o=t.expiresAtMs;if(typeof o!=`number`||!Number.isSafeInteger(o)||o<=0)throw Error(`Invalid owner operation expiry.`);return{action:`approve`,authentication:r,recovery:i,expiresAtMs:o,transaction:{receiverId:a.receiverId,actions:a.actions.map(ke)}}}default:throw Error(`Invalid owner operation action.`)}}function Oe(e){let t=n(e,`owner operation outcome`);switch(t.kind){case`completed`:{let e=me(t.result);if(!e.success)throw Error(`A completed owner operation requires a successful transaction.`);return{kind:`completed`,result:e}}case`reverted`:return{kind:`reverted`,transactionId:r(t.transactionId,`transactionId`),error:r(t.error,`error`)};case`cancelled`:return{kind:`cancelled`};case`expired`:return{kind:`expired`};case`failed`:return{kind:`failed`,error:r(t.error,`error`)};case`unknown`:return{kind:`unknown`,recovery:$(t.recovery)};default:throw Error(`Invalid owner operation outcome.`)}}function ke(e){switch(e.action_type){case`CreateAccount`:return{action_type:p.CreateAccount};case`DeployContract`:return{action_type:p.DeployContract,code:[...e.code]};case`FunctionCall`:return{action_type:p.FunctionCall,method_name:e.method_name,args:e.args,gas:e.gas,deposit:e.deposit};case`Transfer`:return{action_type:p.Transfer,deposit:e.deposit};case`Stake`:return{action_type:p.Stake,stake:e.stake,public_key:e.public_key};case`AddKey`:return{action_type:p.AddKey,public_key:e.public_key,access_key:e.access_key};case`DeleteKey`:return{action_type:p.DeleteKey,public_key:e.public_key};case`DeleteAccount`:return{action_type:p.DeleteAccount,beneficiary_id:e.beneficiary_id};case`DeployGlobalContract`:return{action_type:p.DeployGlobalContract,code:[...e.code],deploy_mode:e.deploy_mode};case`UseGlobalContract`:return e.account_id===void 0?{action_type:p.UseGlobalContract,code_hash:e.code_hash}:{action_type:p.UseGlobalContract,account_id:e.account_id};case`SignedDelegate`:throw Error(`Use the delegate API for delegated actions.`);default:throw Error(`Unsupported owner transaction action.`)}}export{_ as A,de as C,ne as D,v as E,ie as O,V as S,se as T,fe as _,Q as a,H as b,be as c,ge as d,he as f,k as g,le as h,ve as i,re as k,Ce as l,ue as m,Oe as n,xe as o,Y as p,$ as r,Se as s,De as t,_e as u,pe as v,y as w,W as x,G as y};