@block-auth.io/core 0.12.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1239,6 +1239,7 @@ declare function createBlockAuthClient(config: BlockAuthClientConfig): {
1239
1239
  userParams?: Record<string, string>;
1240
1240
  grantedParams?: string[];
1241
1241
  revokedParams?: string[];
1242
+ sharedEmailId?: number;
1242
1243
  }) => void;
1243
1244
  dataRequest: (txnId: number | string) => Promise<TxnDataRequest | null>;
1244
1245
  report: (slug: string) => void;
@@ -1262,11 +1263,22 @@ type BlockAuthClient = ReturnType<typeof createBlockAuthClient>;
1262
1263
 
1263
1264
  type TxnDataMode = 'required' | 'optional';
1264
1265
  type TxnDataStatus = 'shared' | 'granted' | 'consent' | 'missing';
1266
+ interface TxnDataEmail {
1267
+ id: number;
1268
+ label: string;
1269
+ email: string;
1270
+ isDefault: boolean;
1271
+ verified?: boolean;
1272
+ }
1265
1273
  interface TxnDataParam {
1266
1274
  slug: string;
1267
1275
  mode: TxnDataMode;
1268
1276
  status: TxnDataStatus;
1269
1277
  value: string | null;
1278
+ emails?: TxnDataEmail[];
1279
+ selectedEmailId?: number | null;
1280
+ emailsMax?: number;
1281
+ emailsManageUrl?: string | null;
1270
1282
  }
1271
1283
  interface TxnDataRequest {
1272
1284
  txnId: number | string;
@@ -1402,6 +1414,18 @@ declare const TEXTS: {
1402
1414
  readonly es: "Guardar";
1403
1415
  readonly en: "Save";
1404
1416
  };
1417
+ readonly emailUnverified: {
1418
+ readonly es: "no verificado";
1419
+ readonly en: "not verified";
1420
+ };
1421
+ readonly emailNoneVerified: {
1422
+ readonly es: "Ningún correo verificado";
1423
+ readonly en: "No verified email";
1424
+ };
1425
+ readonly emailsManage: {
1426
+ readonly es: "Añadir o gestionar correos en Identity";
1427
+ readonly en: "Add or manage emails in Identity";
1428
+ };
1405
1429
  readonly undoChange: {
1406
1430
  readonly es: "Deshacer";
1407
1431
  readonly en: "Undo";
@@ -1556,13 +1580,16 @@ declare const formatParamValue: (slug: string, value: string) => string;
1556
1580
  declare const normalizeParamValue: (slug: string, value: string) => string;
1557
1581
  declare const PARAM_ERROR_KEYS: Record<string, TextKey>;
1558
1582
  type SolicitedParam = TxnDataParam;
1583
+ type SolicitedEmailChoice = number | null;
1559
1584
  interface SolicitedDataForm {
1560
1585
  values: Record<string, string>;
1561
1586
  shared: Record<string, boolean>;
1562
1587
  saved: Record<string, string>;
1588
+ emailChoice?: SolicitedEmailChoice;
1563
1589
  }
1564
1590
  declare const EMPTY_SOLICITED_DATA_FORM: SolicitedDataForm;
1565
1591
  interface SolicitedField extends SolicitedParam {
1592
+ emailChoice?: SolicitedEmailChoice;
1566
1593
  profileValue: string;
1567
1594
  inputValue: string;
1568
1595
  isEmpty: boolean;
@@ -1576,7 +1603,16 @@ interface SolicitedAcceptParams {
1576
1603
  userParams: Record<string, string>;
1577
1604
  grantedParams: string[];
1578
1605
  revokedParams: string[];
1606
+ sharedEmailId?: number;
1579
1607
  }
1608
+ declare const isSolicitedEmailSelectable: (email: {
1609
+ verified?: boolean;
1610
+ }) => boolean;
1611
+ declare const formatSolicitedEmailOption: (email: {
1612
+ label: string;
1613
+ email: string;
1614
+ verified?: boolean;
1615
+ }, unverifiedText?: string) => string;
1580
1616
  declare const isValidParamValue: (slug: string, value: string) => boolean;
1581
1617
  declare function getSolicitedParams({ params, requiredParams, optionalParams, }: {
1582
1618
  params?: TxnDataParam[] | null;
@@ -1592,6 +1628,7 @@ declare const setSolicitedValue: (form: SolicitedDataForm, item: SolicitedParam,
1592
1628
  declare const setSolicitedShared: (form: SolicitedDataForm, slug: string, shared: boolean) => SolicitedDataForm;
1593
1629
  declare const saveSolicitedValue: (form: SolicitedDataForm, slug: string) => SolicitedDataForm;
1594
1630
  declare const undoSolicitedValue: (form: SolicitedDataForm, item: SolicitedParam) => SolicitedDataForm;
1631
+ declare const setSolicitedEmailChoice: (form: SolicitedDataForm, emailChoice: SolicitedEmailChoice) => SolicitedDataForm;
1595
1632
 
1596
1633
  interface LoginPopupResult {
1597
1634
  code: string;
@@ -2180,4 +2217,4 @@ declare function resetExtensionSyncModuleState(): void;
2180
2217
  */
2181
2218
  declare function startExtensionSync(): () => void;
2182
2219
 
2183
- export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, type AuthRuntime, type AuthRuntimeCallbacks, type BlockAuthClient, type BlockAuthClientConfig, BlockAuthProvider, type BlockAuthProviderOptions, type BlockAuthUserProfile, type BlockAuthUserRole, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, type DeletionServiceDeps, EMPTY_SOLICITED_DATA_FORM, type EvmOptions, type EvmWallet, type ExtensionState, type HostedLoginUser, type Locale, type LoginPopupResult, type ModalName, type OpenLoginPopupOptions, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, type PhoneCountry, type PhoneCountryCode, type PhoneDraft, type PhoneParts, type PopupAuthCode, type PopupLoginOptions, type PopupLoginResult, type RestoreResult, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, type SolanaWallet, type SolicitedAcceptParams, type SolicitedDataForm, type SolicitedField, type SolicitedParam, TEXTS, type TextKey, type TxnDataMode, type TxnDataParam, type TxnDataRequest, type TxnDataStatus, type TxnRequest, type UiState, type UserProfileProvider, type UserState, type WalletKind, type WalletState, type Web3SignupState, WsClient, type WsState, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, index$1 as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, index as utils };
2220
+ export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, type AuthRuntime, type AuthRuntimeCallbacks, type BlockAuthClient, type BlockAuthClientConfig, BlockAuthProvider, type BlockAuthProviderOptions, type BlockAuthUserProfile, type BlockAuthUserRole, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, type DeletionServiceDeps, EMPTY_SOLICITED_DATA_FORM, type EvmOptions, type EvmWallet, type ExtensionState, type HostedLoginUser, type Locale, type LoginPopupResult, type ModalName, type OpenLoginPopupOptions, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, type PhoneCountry, type PhoneCountryCode, type PhoneDraft, type PhoneParts, type PopupAuthCode, type PopupLoginOptions, type PopupLoginResult, type RestoreResult, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, type SolanaWallet, type SolicitedAcceptParams, type SolicitedDataForm, type SolicitedEmailChoice, type SolicitedField, type SolicitedParam, TEXTS, type TextKey, type TxnDataEmail, type TxnDataMode, type TxnDataParam, type TxnDataRequest, type TxnDataStatus, type TxnRequest, type UiState, type UserProfileProvider, type UserState, type WalletKind, type WalletState, type Web3SignupState, WsClient, type WsState, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, formatSolicitedEmailOption, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedEmailSelectable, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, index$1 as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedEmailChoice, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, index as utils };
package/dist/index.d.ts CHANGED
@@ -1239,6 +1239,7 @@ declare function createBlockAuthClient(config: BlockAuthClientConfig): {
1239
1239
  userParams?: Record<string, string>;
1240
1240
  grantedParams?: string[];
1241
1241
  revokedParams?: string[];
1242
+ sharedEmailId?: number;
1242
1243
  }) => void;
1243
1244
  dataRequest: (txnId: number | string) => Promise<TxnDataRequest | null>;
1244
1245
  report: (slug: string) => void;
@@ -1262,11 +1263,22 @@ type BlockAuthClient = ReturnType<typeof createBlockAuthClient>;
1262
1263
 
1263
1264
  type TxnDataMode = 'required' | 'optional';
1264
1265
  type TxnDataStatus = 'shared' | 'granted' | 'consent' | 'missing';
1266
+ interface TxnDataEmail {
1267
+ id: number;
1268
+ label: string;
1269
+ email: string;
1270
+ isDefault: boolean;
1271
+ verified?: boolean;
1272
+ }
1265
1273
  interface TxnDataParam {
1266
1274
  slug: string;
1267
1275
  mode: TxnDataMode;
1268
1276
  status: TxnDataStatus;
1269
1277
  value: string | null;
1278
+ emails?: TxnDataEmail[];
1279
+ selectedEmailId?: number | null;
1280
+ emailsMax?: number;
1281
+ emailsManageUrl?: string | null;
1270
1282
  }
1271
1283
  interface TxnDataRequest {
1272
1284
  txnId: number | string;
@@ -1402,6 +1414,18 @@ declare const TEXTS: {
1402
1414
  readonly es: "Guardar";
1403
1415
  readonly en: "Save";
1404
1416
  };
1417
+ readonly emailUnverified: {
1418
+ readonly es: "no verificado";
1419
+ readonly en: "not verified";
1420
+ };
1421
+ readonly emailNoneVerified: {
1422
+ readonly es: "Ningún correo verificado";
1423
+ readonly en: "No verified email";
1424
+ };
1425
+ readonly emailsManage: {
1426
+ readonly es: "Añadir o gestionar correos en Identity";
1427
+ readonly en: "Add or manage emails in Identity";
1428
+ };
1405
1429
  readonly undoChange: {
1406
1430
  readonly es: "Deshacer";
1407
1431
  readonly en: "Undo";
@@ -1556,13 +1580,16 @@ declare const formatParamValue: (slug: string, value: string) => string;
1556
1580
  declare const normalizeParamValue: (slug: string, value: string) => string;
1557
1581
  declare const PARAM_ERROR_KEYS: Record<string, TextKey>;
1558
1582
  type SolicitedParam = TxnDataParam;
1583
+ type SolicitedEmailChoice = number | null;
1559
1584
  interface SolicitedDataForm {
1560
1585
  values: Record<string, string>;
1561
1586
  shared: Record<string, boolean>;
1562
1587
  saved: Record<string, string>;
1588
+ emailChoice?: SolicitedEmailChoice;
1563
1589
  }
1564
1590
  declare const EMPTY_SOLICITED_DATA_FORM: SolicitedDataForm;
1565
1591
  interface SolicitedField extends SolicitedParam {
1592
+ emailChoice?: SolicitedEmailChoice;
1566
1593
  profileValue: string;
1567
1594
  inputValue: string;
1568
1595
  isEmpty: boolean;
@@ -1576,7 +1603,16 @@ interface SolicitedAcceptParams {
1576
1603
  userParams: Record<string, string>;
1577
1604
  grantedParams: string[];
1578
1605
  revokedParams: string[];
1606
+ sharedEmailId?: number;
1579
1607
  }
1608
+ declare const isSolicitedEmailSelectable: (email: {
1609
+ verified?: boolean;
1610
+ }) => boolean;
1611
+ declare const formatSolicitedEmailOption: (email: {
1612
+ label: string;
1613
+ email: string;
1614
+ verified?: boolean;
1615
+ }, unverifiedText?: string) => string;
1580
1616
  declare const isValidParamValue: (slug: string, value: string) => boolean;
1581
1617
  declare function getSolicitedParams({ params, requiredParams, optionalParams, }: {
1582
1618
  params?: TxnDataParam[] | null;
@@ -1592,6 +1628,7 @@ declare const setSolicitedValue: (form: SolicitedDataForm, item: SolicitedParam,
1592
1628
  declare const setSolicitedShared: (form: SolicitedDataForm, slug: string, shared: boolean) => SolicitedDataForm;
1593
1629
  declare const saveSolicitedValue: (form: SolicitedDataForm, slug: string) => SolicitedDataForm;
1594
1630
  declare const undoSolicitedValue: (form: SolicitedDataForm, item: SolicitedParam) => SolicitedDataForm;
1631
+ declare const setSolicitedEmailChoice: (form: SolicitedDataForm, emailChoice: SolicitedEmailChoice) => SolicitedDataForm;
1595
1632
 
1596
1633
  interface LoginPopupResult {
1597
1634
  code: string;
@@ -2180,4 +2217,4 @@ declare function resetExtensionSyncModuleState(): void;
2180
2217
  */
2181
2218
  declare function startExtensionSync(): () => void;
2182
2219
 
2183
- export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, type AuthRuntime, type AuthRuntimeCallbacks, type BlockAuthClient, type BlockAuthClientConfig, BlockAuthProvider, type BlockAuthProviderOptions, type BlockAuthUserProfile, type BlockAuthUserRole, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, type DeletionServiceDeps, EMPTY_SOLICITED_DATA_FORM, type EvmOptions, type EvmWallet, type ExtensionState, type HostedLoginUser, type Locale, type LoginPopupResult, type ModalName, type OpenLoginPopupOptions, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, type PhoneCountry, type PhoneCountryCode, type PhoneDraft, type PhoneParts, type PopupAuthCode, type PopupLoginOptions, type PopupLoginResult, type RestoreResult, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, type SolanaWallet, type SolicitedAcceptParams, type SolicitedDataForm, type SolicitedField, type SolicitedParam, TEXTS, type TextKey, type TxnDataMode, type TxnDataParam, type TxnDataRequest, type TxnDataStatus, type TxnRequest, type UiState, type UserProfileProvider, type UserState, type WalletKind, type WalletState, type Web3SignupState, WsClient, type WsState, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, index$1 as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, index as utils };
2220
+ export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, type AuthRuntime, type AuthRuntimeCallbacks, type BlockAuthClient, type BlockAuthClientConfig, BlockAuthProvider, type BlockAuthProviderOptions, type BlockAuthUserProfile, type BlockAuthUserRole, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, type DeletionServiceDeps, EMPTY_SOLICITED_DATA_FORM, type EvmOptions, type EvmWallet, type ExtensionState, type HostedLoginUser, type Locale, type LoginPopupResult, type ModalName, type OpenLoginPopupOptions, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, type PhoneCountry, type PhoneCountryCode, type PhoneDraft, type PhoneParts, type PopupAuthCode, type PopupLoginOptions, type PopupLoginResult, type RestoreResult, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, type SolanaWallet, type SolicitedAcceptParams, type SolicitedDataForm, type SolicitedEmailChoice, type SolicitedField, type SolicitedParam, TEXTS, type TextKey, type TxnDataEmail, type TxnDataMode, type TxnDataParam, type TxnDataRequest, type TxnDataStatus, type TxnRequest, type UiState, type UserProfileProvider, type UserState, type WalletKind, type WalletState, type Web3SignupState, WsClient, type WsState, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, formatSolicitedEmailOption, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedEmailSelectable, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, index$1 as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedEmailChoice, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, index as utils };
package/dist/index.js CHANGED
@@ -1566,13 +1566,27 @@ var toTxnDataParam = (raw) => {
1566
1566
  if (!raw || typeof raw.slug !== "string") return null;
1567
1567
  if (!TXN_DATA_MODES.includes(raw.mode)) return null;
1568
1568
  if (!TXN_DATA_STATUSES.includes(raw.status)) return null;
1569
- return {
1569
+ const param = {
1570
1570
  slug: raw.slug,
1571
1571
  mode: raw.mode,
1572
1572
  status: raw.status,
1573
1573
  value: typeof raw.value === "string" ? raw.value : null
1574
1574
  };
1575
+ if (Array.isArray(raw.emails)) {
1576
+ param.emails = raw.emails.filter(isTxnDataEmail).map((email) => ({
1577
+ id: email.id,
1578
+ label: typeof email.label === "string" ? email.label : "",
1579
+ email: email.email,
1580
+ isDefault: email.isDefault === true,
1581
+ ...typeof email.verified === "boolean" && { verified: email.verified }
1582
+ }));
1583
+ param.selectedEmailId = typeof raw.selectedEmailId === "number" ? raw.selectedEmailId : null;
1584
+ param.emailsMax = typeof raw.emailsMax === "number" ? raw.emailsMax : 0;
1585
+ param.emailsManageUrl = typeof raw.emailsManageUrl === "string" && /^https?:\/\//i.test(raw.emailsManageUrl) ? raw.emailsManageUrl : null;
1586
+ }
1587
+ return param;
1575
1588
  };
1589
+ var isTxnDataEmail = (raw) => !!raw && typeof raw.id === "number" && typeof raw.email === "string";
1576
1590
  function requestSignin(args) {
1577
1591
  const { wsc, token, url, service, apiKey, sessionId } = args;
1578
1592
  wsc.emit("user:txns:create", { token, url, service, apiKey, sessionId });
@@ -1592,6 +1606,7 @@ function acceptTxn(args) {
1592
1606
  userParams,
1593
1607
  grantedParams,
1594
1608
  revokedParams,
1609
+ sharedEmailId,
1595
1610
  sessionId
1596
1611
  } = args;
1597
1612
  wsc.emit("provider:signin", {
@@ -1602,6 +1617,7 @@ function acceptTxn(args) {
1602
1617
  userParams: userParams ?? {},
1603
1618
  grantedParams: grantedParams ?? [],
1604
1619
  revokedParams: revokedParams ?? [],
1620
+ sharedEmailId,
1605
1621
  sessionId
1606
1622
  });
1607
1623
  }
@@ -2627,6 +2643,7 @@ function createBlockAuthClient(config3) {
2627
2643
  userParams: opts.userParams,
2628
2644
  grantedParams: opts.grantedParams,
2629
2645
  revokedParams: opts.revokedParams,
2646
+ sharedEmailId: opts.sharedEmailId,
2630
2647
  sessionId: browserBase.getDeviceSessionId()
2631
2648
  }),
2632
2649
  dataRequest: (txnId) => requestTxnData({
@@ -2912,6 +2929,21 @@ var EMPTY_SOLICITED_DATA_FORM = {
2912
2929
  shared: {},
2913
2930
  saved: {}
2914
2931
  };
2932
+ var EMAIL_SLUG = "users-email";
2933
+ var isSolicitedEmailSelectable = (email) => email.verified !== false;
2934
+ function emailChoiceOf(item, form) {
2935
+ if (item.slug !== EMAIL_SLUG || !item.emails) return void 0;
2936
+ if (form.emailChoice !== void 0) return form.emailChoice;
2937
+ const selectable = item.emails.filter(isSolicitedEmailSelectable);
2938
+ const selected = selectable.find(
2939
+ (email) => email.id === item.selectedEmailId
2940
+ );
2941
+ return selected?.id ?? selectable.find((email) => email.isDefault)?.id ?? selectable[0]?.id ?? null;
2942
+ }
2943
+ var formatSolicitedEmailOption = (email, unverifiedText = "") => {
2944
+ const text = email.label ? `${email.label} \xB7 ${email.email}` : email.email;
2945
+ return email.verified === false && unverifiedText ? `${text} (${unverifiedText})` : text;
2946
+ };
2915
2947
  var omitKey = (record, key) => Object.fromEntries(
2916
2948
  Object.entries(record).filter(([entryKey]) => entryKey !== key)
2917
2949
  );
@@ -2947,14 +2979,18 @@ function getSolicitedParams({
2947
2979
  }
2948
2980
  function getSolicitedFields(items, form = EMPTY_SOLICITED_DATA_FORM, withConsent = true) {
2949
2981
  return items.map((item) => {
2950
- const profileValue = item.value ?? "";
2951
- const inputValue = form.values[item.slug] ?? profileValue;
2982
+ const emailChoice = emailChoiceOf(item, form);
2983
+ const chosenEmail = typeof emailChoice === "number" ? item.emails?.find((email) => email.id === emailChoice)?.email : void 0;
2984
+ const emailFields = emailChoice !== void 0 ? { emailChoice } : {};
2985
+ const profileValue = chosenEmail ?? (emailChoice === null ? "" : item.value ?? "");
2986
+ const inputValue = chosenEmail ?? form.values[item.slug] ?? profileValue;
2952
2987
  const trimmed = inputValue.trim();
2953
2988
  const isEmpty = !trimmed;
2954
2989
  const isValid = isValidParamValue(item.slug, inputValue);
2955
2990
  if (!withConsent) {
2956
2991
  return {
2957
2992
  ...item,
2993
+ ...emailFields,
2958
2994
  profileValue,
2959
2995
  inputValue,
2960
2996
  isEmpty,
@@ -2972,6 +3008,7 @@ function getSolicitedFields(items, form = EMPTY_SOLICITED_DATA_FORM, withConsent
2972
3008
  const isComplete = isShared ? isValid && (!isChanged || isSaved) : item.mode !== "required";
2973
3009
  return {
2974
3010
  ...item,
3011
+ ...emailFields,
2975
3012
  profileValue,
2976
3013
  inputValue,
2977
3014
  isEmpty,
@@ -2994,6 +3031,7 @@ function getSolicitedAcceptParams(fields) {
2994
3031
  const userParams = {};
2995
3032
  const grantedParams = [];
2996
3033
  const revokedParams = [];
3034
+ const email = {};
2997
3035
  fields.forEach((field) => {
2998
3036
  if (!field.isShared) {
2999
3037
  if ((field.status === "granted" || field.status === "shared") && field.mode === "optional")
@@ -3002,17 +3040,20 @@ function getSolicitedAcceptParams(fields) {
3002
3040
  }
3003
3041
  if (!field.isValid) return;
3004
3042
  if (field.isChanged) {
3005
- if (field.isSaved)
3043
+ if (field.isSaved) {
3006
3044
  userParams[field.slug] = normalizeParamValue(
3007
3045
  field.slug,
3008
3046
  field.inputValue
3009
3047
  );
3048
+ }
3010
3049
  return;
3011
3050
  }
3051
+ if (typeof field.emailChoice === "number")
3052
+ email.sharedEmailId = field.emailChoice;
3012
3053
  if (field.status === "consent" || field.status === "granted")
3013
3054
  grantedParams.push(field.slug);
3014
3055
  });
3015
- return { userParams, grantedParams, revokedParams };
3056
+ return { userParams, grantedParams, revokedParams, ...email };
3016
3057
  }
3017
3058
  var setSolicitedValue = (form, item, value) => ({
3018
3059
  ...form,
@@ -3031,10 +3072,18 @@ var saveSolicitedValue = (form, slug) => {
3031
3072
  };
3032
3073
  };
3033
3074
  var undoSolicitedValue = (form, item) => ({
3075
+ ...form,
3034
3076
  values: omitKey(form.values, item.slug),
3035
3077
  saved: omitKey(form.saved, item.slug),
3036
3078
  shared: (item.value ?? "").trim() ? form.shared : omitKey(form.shared, item.slug)
3037
3079
  });
3080
+ var setSolicitedEmailChoice = (form, emailChoice) => ({
3081
+ ...form,
3082
+ emailChoice,
3083
+ values: omitKey(form.values, EMAIL_SLUG),
3084
+ saved: omitKey(form.saved, EMAIL_SLUG),
3085
+ shared: omitKey(form.shared, EMAIL_SLUG)
3086
+ });
3038
3087
 
3039
3088
  // src/auth/redirectPopup.ts
3040
3089
  var AUTH_CODE_MESSAGE2 = "blockauth:auth-code";
@@ -3754,6 +3803,13 @@ function createAuthRuntime(client, callbacks = {}) {
3754
3803
  );
3755
3804
  });
3756
3805
  };
3806
+ const onSocketReconnect = () => {
3807
+ if (stopped || hookState.isLoggingOut || !hookState.isSigned) return;
3808
+ const externalService = browserBase.getExternalService();
3809
+ const did = externalService.service && externalService.service !== "blockauth" ? externalService.did : browserBase.getSession().did;
3810
+ if (!did) return;
3811
+ emitSdkSign(wsc().accessToken, did);
3812
+ };
3757
3813
  const onSdkUserRolesChanged = async (data) => {
3758
3814
  const { success, message } = data || {};
3759
3815
  if (!success || !message?.address) return;
@@ -3863,6 +3919,7 @@ function createAuthRuntime(client, callbacks = {}) {
3863
3919
  wsc().on("sdk:user:roles:changed", onSdkUserRolesChanged);
3864
3920
  wsc().on("sdk:restore", onSdkRestore);
3865
3921
  wsc().ws?.onAny(onAnyServerEvent);
3922
+ wsc().ws?.on("connect", onSocketReconnect);
3866
3923
  if (typeof window !== "undefined") {
3867
3924
  window.addEventListener("storage", onStorageLogout);
3868
3925
  }
@@ -3912,6 +3969,7 @@ function createAuthRuntime(client, callbacks = {}) {
3912
3969
  w.off("sdk:user:roles:changed", onSdkUserRolesChanged);
3913
3970
  w.off("sdk:restore", onSdkRestore);
3914
3971
  w.ws?.offAny(onAnyServerEvent);
3972
+ w.ws?.off("connect", onSocketReconnect);
3915
3973
  }
3916
3974
  if (typeof window !== "undefined") {
3917
3975
  window.removeEventListener("storage", onStorageLogout);
@@ -4070,6 +4128,15 @@ var TEXTS = {
4070
4128
  },
4071
4129
  shareData: { es: "Ceder", en: "Share" },
4072
4130
  saveData: { es: "Guardar", en: "Save" },
4131
+ emailUnverified: { es: "no verificado", en: "not verified" },
4132
+ emailNoneVerified: {
4133
+ es: "Ning\xFAn correo verificado",
4134
+ en: "No verified email"
4135
+ },
4136
+ emailsManage: {
4137
+ es: "A\xF1adir o gestionar correos en Identity",
4138
+ en: "Add or manage emails in Identity"
4139
+ },
4073
4140
  undoChange: { es: "Deshacer", en: "Undo" },
4074
4141
  savedToProfileHint: {
4075
4142
  es: "Se guardar\xE1 en tu perfil al aceptar",
@@ -4174,6 +4241,6 @@ function t(key, locale = "en") {
4174
4241
  return entry?.[locale] ?? entry?.en ?? key;
4175
4242
  }
4176
4243
 
4177
- export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, BlockAuthProvider, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, EMPTY_SOLICITED_DATA_FORM, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, TEXTS, WsClient, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, oauth_exports as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, utils_exports as utils };
4244
+ export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, BlockAuthProvider, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, EMPTY_SOLICITED_DATA_FORM, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, TEXTS, WsClient, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, formatSolicitedEmailOption, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedEmailSelectable, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, oauth_exports as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedEmailChoice, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, utils_exports as utils };
4178
4245
  //# sourceMappingURL=index.js.map
4179
4246
  //# sourceMappingURL=index.js.map