@sjolystinnovation/app-kit 1.0.0 → 1.0.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/README.md
CHANGED
|
@@ -977,11 +977,11 @@ const params = useSearchParams();
|
|
|
977
977
|
| Prop | Type | Description |
|
|
978
978
|
| --- | --- | --- |
|
|
979
979
|
| `requestReset` | `(data: { email }) => Promise<unknown>` | Asks the API to email a code. |
|
|
980
|
-
| `reset` | `(data: { email, code, newPassword }) => Promise<unknown>` | Sets the password. When it succeeds, the flow shows
|
|
980
|
+
| `reset` | `(data: { email, code, newPassword }) => Promise<unknown>` | Sets the password. When it succeeds, the flow shows `strings.done`. |
|
|
981
981
|
| `loginHref` | `string` | Where the sign-in links go. |
|
|
982
982
|
| `initialEmail`, `initialCode` | `string` | The values from the emailed link. A code opens the second step. |
|
|
983
983
|
| `className` | `string` | Replaces the outer `max-w-md mx-auto px-4 py-16`, such as to sit in the app's own card. |
|
|
984
|
-
| `strings` | `TextOverrides<ResetPasswordFlowStrings>` | The page's text. Set `signInPrompt`, `intro`, `codeSent`, or `passwordHint` to `null` to leave it out. `done` set to `null` shows the API's message, or only the sign-in link when it sends none. `passwordInvalid` set to `null` lists every broken rule. `validation` and `errors` may name only some codes. |
|
|
984
|
+
| `strings` | `TextOverrides<ResetPasswordFlowStrings>` | The page's text. The English defaults include an intro, the password rules as `passwordHint`, and a `done` text. Set `signInPrompt`, `intro`, `codeSent`, or `passwordHint` to `null` to leave it out. `done` set to `null` shows the API's message, or only the sign-in link when it sends none. `passwordInvalid` set to `null` lists every broken rule. `validation` and `errors` may name only some codes. |
|
|
985
985
|
| `passwordStrings` | `TextOverrides<PasswordStrings>` | The rule messages, in the app's language. |
|
|
986
986
|
|
|
987
987
|
A password that breaks the rules is marked under the new password field, without a call to the API.
|
|
@@ -1221,7 +1221,7 @@ image and toasts it. A successful save clears it. See
|
|
|
1221
1221
|
```tsx
|
|
1222
1222
|
<BrandingManager
|
|
1223
1223
|
save={form => BrandingService.update(form)}
|
|
1224
|
-
strings={{ validation: { invalidImage: "
|
|
1224
|
+
strings={{ validation: { invalidImage: "Ugyldig filformat. Last opp en bildefil.", imageTooLarge: "Filen er for stor. Last opp en fil på 2 MB eller mindre." } }}
|
|
1225
1225
|
/>
|
|
1226
1226
|
```
|
|
1227
1227
|
|
package/package.json
CHANGED
|
@@ -43,7 +43,7 @@ export const defaultBrandingManagerStrings: BrandingManagerStrings = {
|
|
|
43
43
|
saved: "Branding saved",
|
|
44
44
|
saveFailed: "Failed to save branding",
|
|
45
45
|
validation: {
|
|
46
|
-
invalidImage: "
|
|
47
|
-
imageTooLarge: "The
|
|
46
|
+
invalidImage: "Invalid file format. Upload a PNG, JPEG, WebP, GIF or ICO image.",
|
|
47
|
+
imageTooLarge: "The file is too large. Upload a file of 2 MB or less.",
|
|
48
48
|
},
|
|
49
49
|
};
|
|
@@ -9,7 +9,7 @@ export interface SectionsEditorStrings {
|
|
|
9
9
|
moveUp: string;
|
|
10
10
|
moveDown: string;
|
|
11
11
|
duplicate: string;
|
|
12
|
-
/** The title of the button that
|
|
12
|
+
/** The title of the button that deletes a section. Keep it apart from `removeImage`, since both can show on one section. */
|
|
13
13
|
remove: string;
|
|
14
14
|
addSection: string;
|
|
15
15
|
heading: string;
|
|
@@ -56,7 +56,7 @@ export const defaultSectionsEditorStrings: SectionsEditorStrings = {
|
|
|
56
56
|
moveUp: "Move up",
|
|
57
57
|
moveDown: "Move down",
|
|
58
58
|
duplicate: "Duplicate",
|
|
59
|
-
remove: "
|
|
59
|
+
remove: "Delete section",
|
|
60
60
|
addSection: "Add section",
|
|
61
61
|
heading: "Heading",
|
|
62
62
|
headingOptional: "Heading (optional)",
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// Plain values, with no "use client", so a server component can import them.
|
|
2
2
|
|
|
3
|
+
import { PASSWORD_MIN_LENGTH } from "../validation/passwordRules";
|
|
4
|
+
|
|
5
|
+
// The rules passwordProblems checks, for the hint and the weak password text.
|
|
6
|
+
const passwordRules = `Use at least ${PASSWORD_MIN_LENGTH} characters, with at least one lowercase and one uppercase letter from A to Z and one digit from 0 to 9.`;
|
|
7
|
+
|
|
3
8
|
/**
|
|
4
9
|
* The flow's text for each field error code of SjolystInnovation.AppKit.Auth's reset endpoints,
|
|
5
10
|
* shown under the email, code or new password field. `{max}` in `passwordTooShort` becomes the
|
|
@@ -67,18 +72,18 @@ export const defaultResetPasswordFlowStrings: ResetPasswordFlowStrings = {
|
|
|
67
72
|
signInPrompt: "Remembered it?",
|
|
68
73
|
signIn: "Sign in",
|
|
69
74
|
backToSignIn: "Back to sign in →",
|
|
70
|
-
intro:
|
|
75
|
+
intro: "Enter your email address and we will send you a code.",
|
|
71
76
|
codeSent: "Check your email for the reset code.",
|
|
72
77
|
email: "Email",
|
|
73
78
|
code: "Reset code",
|
|
74
79
|
newPassword: "New password",
|
|
75
|
-
passwordHint:
|
|
80
|
+
passwordHint: passwordRules,
|
|
76
81
|
requestCode: "Send reset code",
|
|
77
82
|
requestingCode: "Sending…",
|
|
78
83
|
setPassword: "Reset password",
|
|
79
84
|
settingPassword: "Resetting…",
|
|
80
|
-
done:
|
|
81
|
-
passwordInvalid:
|
|
85
|
+
done: "Your password has been changed. You can sign in now.",
|
|
86
|
+
passwordInvalid: `The password does not meet the requirements. ${passwordRules}`,
|
|
82
87
|
somethingWentWrong: "Something went wrong",
|
|
83
88
|
validation: {
|
|
84
89
|
required: "Required.",
|