@nebulr-group/bridge-svelte 1.0.0-alpha.7 → 1.0.0-alpha.8

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.
Files changed (2) hide show
  1. package/dist/core/i18n.js +10 -3
  2. package/package.json +2 -2
package/dist/core/i18n.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * the plugin's own keys, the app's `messages` from bridgeBootstrap, and a
4
4
  * component's own `messages` prop, in that order of precedence (last wins).
5
5
  */
6
- import { createTranslator, interpolate, isBridgeError, normalizeLocale, } from '@nebulr-group/bridge-auth-core';
6
+ import { createTranslator, interpolate, isBridgeError, normalizeLocale, waitMinutes, } from '@nebulr-group/bridge-auth-core';
7
7
  import { PLUGIN_EN, PLUGIN_LOCALES } from './messages.js';
8
8
  let appLocale;
9
9
  let appMessages = {};
@@ -52,8 +52,15 @@ export function errorMessage(error, t, fallback = 'error.generic') {
52
52
  return t('error.unavailable');
53
53
  case 'network':
54
54
  return t('error.network');
55
- case 'rate-limited':
56
- return t('error.rateLimited');
55
+ case 'rate-limited': {
56
+ // A locked account has no time to wait: the owner resets the password.
57
+ if (e.code === 'account_locked')
58
+ return t('login.error.accountLocked');
59
+ const minutes = e.code === 'too_many_attempts' ? waitMinutes(e) : null;
60
+ if (minutes === null)
61
+ return t('error.rateLimited');
62
+ return minutes === 1 ? t('login.error.tooManyAttemptsOneMinute') : t('login.error.tooManyAttempts', { minutes });
63
+ }
57
64
  case 'signed-out':
58
65
  case 'reauthenticate':
59
66
  return t('session.ended');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebulr-group/bridge-svelte",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-alpha.8",
4
4
  "description": "The Bridge for SvelteKit: sign-in in your own pages, workspaces, flag-based route guards, plans and checkout, the team panel and live updates, on one setting: the issuer.",
5
5
  "author": "Iman Pouya",
6
6
  "license": "MIT",
@@ -60,7 +60,7 @@
60
60
  "@sveltejs/kit": "^2.0.0"
61
61
  },
62
62
  "dependencies": {
63
- "@nebulr-group/bridge-auth-core": "1.0.0-alpha.7"
63
+ "@nebulr-group/bridge-auth-core": "1.0.0-alpha.8"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@sveltejs/kit": "^2.16.0",