@authsome/ui-core 0.1.7 → 0.1.9

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.mjs CHANGED
@@ -276,6 +276,40 @@ var enLocale = {
276
276
  register: "Register passkey",
277
277
  usePasskey: "Use passkey"
278
278
  },
279
+ deviceFlow: {
280
+ title: "Authorize Device",
281
+ subtitle: "Enter the code displayed on your device",
282
+ enterCode: "Authorize Device",
283
+ enterCodeDescription: "Enter the code displayed on your device or CLI",
284
+ codeLabel: "Device Code",
285
+ codePlaceholder: "XXXX-XXXX",
286
+ codeHint: "Enter the 8-character code shown on your device",
287
+ verify: "Verify Code",
288
+ verifyCode: "Verify Code",
289
+ invalidCode: "Invalid code. Please check and try again.",
290
+ noCode: "Don't have a code?",
291
+ getCodeHelp: "Get help",
292
+ authorizationTitle: "Authorize Application",
293
+ authorizationSubtitle: "An application is requesting access to your account",
294
+ authorizeTitle: "Authorize Device",
295
+ authorizeDescription: "An application is requesting access to your account",
296
+ requestingAccess: "is requesting access to:",
297
+ codeConfirm: "Confirm this is your code:",
298
+ requestedPermissions: "Requested permissions:",
299
+ securityWarning: "Only approve this request if you initiated it",
300
+ scopes: "Requested permissions",
301
+ approve: "Approve",
302
+ deny: "Deny",
303
+ authorizedTitle: "Device Authorized",
304
+ authorizedMessage: "You can now return to your device to continue",
305
+ authorizedDescription: "Your device has been successfully authorized",
306
+ authorizedHint: "You can close this window and return to your CLI or device",
307
+ returnToCli: "Return to CLI",
308
+ deniedTitle: "Access Denied",
309
+ deniedMessage: "You have denied access to this device",
310
+ deniedDescription: "The device authorization request has been denied",
311
+ deniedHint: "You can close this window"
312
+ },
279
313
  signUp: {
280
314
  title: "Create Account",
281
315
  subtitle: "Get started with your account",
@@ -1233,6 +1267,13 @@ var FlowStep = /* @__PURE__ */ ((FlowStep2) => {
1233
1267
  FlowStep2["PASSWORD_CHANGE"] = "password_change";
1234
1268
  FlowStep2["PROFILE_UPDATE"] = "profile_update";
1235
1269
  FlowStep2["PROFILE_COMPLETE"] = "profile_complete";
1270
+ FlowStep2["DEVICE_FLOW_INITIATE"] = "device_flow_initiate";
1271
+ FlowStep2["DEVICE_CODE_ENTRY"] = "device_code_entry";
1272
+ FlowStep2["DEVICE_CODE_VERIFY"] = "device_code_verify";
1273
+ FlowStep2["DEVICE_AUTHORIZE"] = "device_authorize";
1274
+ FlowStep2["DEVICE_POLLING"] = "device_polling";
1275
+ FlowStep2["DEVICE_AUTHORIZED"] = "device_authorized";
1276
+ FlowStep2["DEVICE_DENIED"] = "device_denied";
1236
1277
  FlowStep2["SUCCESS"] = "success";
1237
1278
  FlowStep2["ERROR"] = "error";
1238
1279
  FlowStep2["CANCELLED"] = "cancelled";
@@ -1250,6 +1291,7 @@ var FlowConfigType = /* @__PURE__ */ ((FlowConfigType2) => {
1250
1291
  FlowConfigType2["SECURE_SIGN_IN_FLOW"] = "secure_sign_in_flow";
1251
1292
  FlowConfigType2["PASSWORD_RESET_FLOW"] = "password_reset_flow";
1252
1293
  FlowConfigType2["EMAIL_VERIFICATION_FLOW"] = "email_verification_flow";
1294
+ FlowConfigType2["DEVICE_FLOW"] = "device_flow";
1253
1295
  FlowConfigType2["CUSTOM"] = "custom";
1254
1296
  return FlowConfigType2;
1255
1297
  })(FlowConfigType || {});
@@ -1459,6 +1501,8 @@ var simpleSignInFlow = {
1459
1501
  initialStep: "email_password_sign_in" /* EMAIL_PASSWORD_SIGN_IN */,
1460
1502
  allowedSteps: [
1461
1503
  "email_password_sign_in" /* EMAIL_PASSWORD_SIGN_IN */,
1504
+ "email_verification_required" /* EMAIL_VERIFICATION_REQUIRED */,
1505
+ "email_verification_sent" /* EMAIL_VERIFICATION_SENT */,
1462
1506
  "password_reset_request" /* PASSWORD_RESET_REQUEST */,
1463
1507
  "password_reset_sent" /* PASSWORD_RESET_SENT */,
1464
1508
  "success" /* SUCCESS */,
@@ -1469,6 +1513,14 @@ var simpleSignInFlow = {
1469
1513
  onSuccess: "success" /* SUCCESS */,
1470
1514
  onError: "email_password_sign_in" /* EMAIL_PASSWORD_SIGN_IN */
1471
1515
  },
1516
+ ["email_verification_required" /* EMAIL_VERIFICATION_REQUIRED */]: {
1517
+ onSuccess: "email_verification_sent" /* EMAIL_VERIFICATION_SENT */,
1518
+ onError: "email_verification_required" /* EMAIL_VERIFICATION_REQUIRED */
1519
+ },
1520
+ ["email_verification_sent" /* EMAIL_VERIFICATION_SENT */]: {
1521
+ onSuccess: "email_password_sign_in" /* EMAIL_PASSWORD_SIGN_IN */,
1522
+ onError: "email_verification_required" /* EMAIL_VERIFICATION_REQUIRED */
1523
+ },
1472
1524
  ["password_reset_request" /* PASSWORD_RESET_REQUEST */]: {
1473
1525
  onSuccess: "password_reset_sent" /* PASSWORD_RESET_SENT */,
1474
1526
  onBack: "email_password_sign_in" /* EMAIL_PASSWORD_SIGN_IN */
@@ -1484,6 +1536,8 @@ var signInWithMFAFlow = {
1484
1536
  initialStep: "email_password_sign_in" /* EMAIL_PASSWORD_SIGN_IN */,
1485
1537
  allowedSteps: [
1486
1538
  "email_password_sign_in" /* EMAIL_PASSWORD_SIGN_IN */,
1539
+ "email_verification_required" /* EMAIL_VERIFICATION_REQUIRED */,
1540
+ "email_verification_sent" /* EMAIL_VERIFICATION_SENT */,
1487
1541
  "mfa_required" /* MFA_REQUIRED */,
1488
1542
  "mfa_select_method" /* MFA_SELECT_METHOD */,
1489
1543
  "mfa_verify" /* MFA_VERIFY */,
@@ -1503,6 +1557,14 @@ var signInWithMFAFlow = {
1503
1557
  }
1504
1558
  ]
1505
1559
  },
1560
+ ["email_verification_required" /* EMAIL_VERIFICATION_REQUIRED */]: {
1561
+ onSuccess: "email_verification_sent" /* EMAIL_VERIFICATION_SENT */,
1562
+ onError: "email_verification_required" /* EMAIL_VERIFICATION_REQUIRED */
1563
+ },
1564
+ ["email_verification_sent" /* EMAIL_VERIFICATION_SENT */]: {
1565
+ onSuccess: "email_password_sign_in" /* EMAIL_PASSWORD_SIGN_IN */,
1566
+ onError: "email_verification_required" /* EMAIL_VERIFICATION_REQUIRED */
1567
+ },
1506
1568
  ["mfa_required" /* MFA_REQUIRED */]: {
1507
1569
  onSuccess: "mfa_verify" /* MFA_VERIFY */,
1508
1570
  conditions: [
@@ -1676,6 +1738,43 @@ var emailVerificationFlow = {
1676
1738
  }
1677
1739
  }
1678
1740
  };
1741
+ var deviceFlow = {
1742
+ name: "Device Flow",
1743
+ description: "OAuth 2.0 Device Authorization Grant for CLI/device login",
1744
+ initialStep: "device_code_entry" /* DEVICE_CODE_ENTRY */,
1745
+ allowedSteps: [
1746
+ "device_code_entry" /* DEVICE_CODE_ENTRY */,
1747
+ "device_code_verify" /* DEVICE_CODE_VERIFY */,
1748
+ "device_authorize" /* DEVICE_AUTHORIZE */,
1749
+ "device_authorized" /* DEVICE_AUTHORIZED */,
1750
+ "device_denied" /* DEVICE_DENIED */,
1751
+ "success" /* SUCCESS */,
1752
+ "error" /* ERROR */
1753
+ ],
1754
+ transitions: {
1755
+ ["device_code_entry" /* DEVICE_CODE_ENTRY */]: {
1756
+ onSuccess: "device_code_verify" /* DEVICE_CODE_VERIFY */,
1757
+ onError: "device_code_entry" /* DEVICE_CODE_ENTRY */,
1758
+ onCancel: "cancelled" /* CANCELLED */
1759
+ },
1760
+ ["device_code_verify" /* DEVICE_CODE_VERIFY */]: {
1761
+ onSuccess: "device_authorize" /* DEVICE_AUTHORIZE */,
1762
+ onError: "device_code_entry" /* DEVICE_CODE_ENTRY */,
1763
+ onBack: "device_code_entry" /* DEVICE_CODE_ENTRY */
1764
+ },
1765
+ ["device_authorize" /* DEVICE_AUTHORIZE */]: {
1766
+ onSuccess: "device_authorized" /* DEVICE_AUTHORIZED */,
1767
+ onError: "device_denied" /* DEVICE_DENIED */,
1768
+ onCancel: "device_denied" /* DEVICE_DENIED */
1769
+ },
1770
+ ["device_authorized" /* DEVICE_AUTHORIZED */]: {
1771
+ onSuccess: "success" /* SUCCESS */
1772
+ },
1773
+ ["device_denied" /* DEVICE_DENIED */]: {
1774
+ onSuccess: "error" /* ERROR */
1775
+ }
1776
+ }
1777
+ };
1679
1778
  function getFlowConfig(type) {
1680
1779
  switch (type) {
1681
1780
  case "simple_sign_in" /* SIMPLE_SIGN_IN */:
@@ -1694,6 +1793,8 @@ function getFlowConfig(type) {
1694
1793
  return passwordResetFlow;
1695
1794
  case "email_verification_flow" /* EMAIL_VERIFICATION_FLOW */:
1696
1795
  return emailVerificationFlow;
1796
+ case "device_flow" /* DEVICE_FLOW */:
1797
+ return deviceFlow;
1697
1798
  default:
1698
1799
  throw new Error(`Unknown flow type: ${type}`);
1699
1800
  }
@@ -1706,7 +1807,8 @@ var predefinedFlows = {
1706
1807
  ["phone_auth_flow" /* PHONE_AUTH_FLOW */]: phoneAuthFlow,
1707
1808
  ["oauth_sign_in" /* OAUTH_SIGN_IN */]: oauthSignInFlow,
1708
1809
  ["password_reset_flow" /* PASSWORD_RESET_FLOW */]: passwordResetFlow,
1709
- ["email_verification_flow" /* EMAIL_VERIFICATION_FLOW */]: emailVerificationFlow
1810
+ ["email_verification_flow" /* EMAIL_VERIFICATION_FLOW */]: emailVerificationFlow,
1811
+ ["device_flow" /* DEVICE_FLOW */]: deviceFlow
1710
1812
  };
1711
1813
 
1712
1814
  export { AuthClient, AuthError, AuthErrorType, AuthState, BaseAuthProvider, FlowAction, FlowConfigType, FlowEngine, FlowStep, LocalStorageAdapter, MemoryStorageAdapter, OAuthProvider, Observable, SessionStorageAdapter, TokenManager, TwoFactorMethod, completeSignUpFlow, createAuthError, createLocale, defaultLocale, emailVerificationFlow, extractCookiesFromHeaders, getFlowConfig, interpolate, isAuthError, isMFARequiredError, isNetworkError, isUnauthenticatedError, magicLinkFlow, oauthSignInFlow, parseCookie, parseCookieOptions, passwordResetFlow, phoneAuthFlow, predefinedFlows, serializeCookie, serializeCookies, signInWithMFAFlow, simpleSignInFlow, toAuthError, validate2FACode, validateEmail, validatePassword, validatePhone, validateRequired, validateUsername };