@dloizides/auth-web 1.2.0 → 1.2.2
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.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +110 -110
package/dist/index.d.mts
CHANGED
|
@@ -28,6 +28,9 @@ interface LoginFormLabels {
|
|
|
28
28
|
submitting: string;
|
|
29
29
|
/** The "Forgot password?" link text. */
|
|
30
30
|
forgotPassword: string;
|
|
31
|
+
/** The "Create account" link shown below the submit button when an
|
|
32
|
+
* `onSignUp` handler is supplied. Omit the handler to hide the link. */
|
|
33
|
+
signUp: string;
|
|
31
34
|
/** Generic credentials-rejected message. */
|
|
32
35
|
invalidCredentials: string;
|
|
33
36
|
/** Shown when one or both fields are empty on submit. */
|
|
@@ -233,11 +236,18 @@ interface LoginFormProps {
|
|
|
233
236
|
onSuccess: (user: BffUser) => void;
|
|
234
237
|
/** Called when the user taps the "Forgot password?" link. Omit to hide the link. */
|
|
235
238
|
onForgotPassword?: () => void;
|
|
239
|
+
/**
|
|
240
|
+
* Called when the user taps the "Create account" link. Omit to hide the link
|
|
241
|
+
* (the registration UI then has to be reached some other way — direct nav,
|
|
242
|
+
* marketing CTA, etc.). The consuming app decides where the link routes;
|
|
243
|
+
* `<LoginForm>` just surfaces the entry point.
|
|
244
|
+
*/
|
|
245
|
+
onSignUp?: () => void;
|
|
236
246
|
/** Prefix applied to every `testID` so multiple forms can share a screen. */
|
|
237
247
|
testIdPrefix?: string;
|
|
238
248
|
}
|
|
239
249
|
/** Themeable password-login form built on `useBffAuth`. */
|
|
240
|
-
declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, testIdPrefix, }: Readonly<LoginFormProps>): ReactElement;
|
|
250
|
+
declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, onSignUp, testIdPrefix, }: Readonly<LoginFormProps>): ReactElement;
|
|
241
251
|
|
|
242
252
|
/**
|
|
243
253
|
* `<ForgotPasswordForm>` — the ready-made, themeable "request a reset link"
|
|
@@ -423,6 +433,7 @@ declare const AuthTestIds: {
|
|
|
423
433
|
readonly loginPasswordInput: "auth-login-password";
|
|
424
434
|
readonly loginSubmitButton: "auth-login-submit";
|
|
425
435
|
readonly loginForgotLink: "auth-login-forgot-link";
|
|
436
|
+
readonly loginSignUpLink: "auth-login-signup-link";
|
|
426
437
|
readonly loginError: "auth-login-error";
|
|
427
438
|
readonly forgotPasswordForm: "auth-forgot-form";
|
|
428
439
|
readonly forgotPasswordEmailInput: "auth-forgot-email";
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ interface LoginFormLabels {
|
|
|
28
28
|
submitting: string;
|
|
29
29
|
/** The "Forgot password?" link text. */
|
|
30
30
|
forgotPassword: string;
|
|
31
|
+
/** The "Create account" link shown below the submit button when an
|
|
32
|
+
* `onSignUp` handler is supplied. Omit the handler to hide the link. */
|
|
33
|
+
signUp: string;
|
|
31
34
|
/** Generic credentials-rejected message. */
|
|
32
35
|
invalidCredentials: string;
|
|
33
36
|
/** Shown when one or both fields are empty on submit. */
|
|
@@ -233,11 +236,18 @@ interface LoginFormProps {
|
|
|
233
236
|
onSuccess: (user: BffUser) => void;
|
|
234
237
|
/** Called when the user taps the "Forgot password?" link. Omit to hide the link. */
|
|
235
238
|
onForgotPassword?: () => void;
|
|
239
|
+
/**
|
|
240
|
+
* Called when the user taps the "Create account" link. Omit to hide the link
|
|
241
|
+
* (the registration UI then has to be reached some other way — direct nav,
|
|
242
|
+
* marketing CTA, etc.). The consuming app decides where the link routes;
|
|
243
|
+
* `<LoginForm>` just surfaces the entry point.
|
|
244
|
+
*/
|
|
245
|
+
onSignUp?: () => void;
|
|
236
246
|
/** Prefix applied to every `testID` so multiple forms can share a screen. */
|
|
237
247
|
testIdPrefix?: string;
|
|
238
248
|
}
|
|
239
249
|
/** Themeable password-login form built on `useBffAuth`. */
|
|
240
|
-
declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, testIdPrefix, }: Readonly<LoginFormProps>): ReactElement;
|
|
250
|
+
declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, onSignUp, testIdPrefix, }: Readonly<LoginFormProps>): ReactElement;
|
|
241
251
|
|
|
242
252
|
/**
|
|
243
253
|
* `<ForgotPasswordForm>` — the ready-made, themeable "request a reset link"
|
|
@@ -423,6 +433,7 @@ declare const AuthTestIds: {
|
|
|
423
433
|
readonly loginPasswordInput: "auth-login-password";
|
|
424
434
|
readonly loginSubmitButton: "auth-login-submit";
|
|
425
435
|
readonly loginForgotLink: "auth-login-forgot-link";
|
|
436
|
+
readonly loginSignUpLink: "auth-login-signup-link";
|
|
426
437
|
readonly loginError: "auth-login-error";
|
|
427
438
|
readonly forgotPasswordForm: "auth-forgot-form";
|
|
428
439
|
readonly forgotPasswordEmailInput: "auth-forgot-email";
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var DEFAULT_LOGIN_LABELS = {
|
|
|
19
19
|
submit: "Sign in",
|
|
20
20
|
submitting: "Signing in...",
|
|
21
21
|
forgotPassword: "Forgot password?",
|
|
22
|
+
signUp: "Create an account",
|
|
22
23
|
invalidCredentials: "Incorrect username or password.",
|
|
23
24
|
missingFields: "Enter both your username and password."
|
|
24
25
|
};
|
|
@@ -86,6 +87,7 @@ var AuthTestIds = {
|
|
|
86
87
|
loginPasswordInput: "auth-login-password",
|
|
87
88
|
loginSubmitButton: "auth-login-submit",
|
|
88
89
|
loginForgotLink: "auth-login-forgot-link",
|
|
90
|
+
loginSignUpLink: "auth-login-signup-link",
|
|
89
91
|
loginError: "auth-login-error",
|
|
90
92
|
forgotPasswordForm: "auth-forgot-form",
|
|
91
93
|
forgotPasswordEmailInput: "auth-forgot-email",
|
|
@@ -359,6 +361,7 @@ function LoginForm({
|
|
|
359
361
|
labels: labelsProp,
|
|
360
362
|
onSuccess,
|
|
361
363
|
onForgotPassword,
|
|
364
|
+
onSignUp,
|
|
362
365
|
testIdPrefix
|
|
363
366
|
}) {
|
|
364
367
|
const theme = useAuthTheme(themeProp);
|
|
@@ -465,7 +468,20 @@ function LoginForm({
|
|
|
465
468
|
onPress: handleSubmit,
|
|
466
469
|
children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.onPrimary, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles.primaryButtonText, children: labels.submit })
|
|
467
470
|
}
|
|
468
|
-
)
|
|
471
|
+
),
|
|
472
|
+
onSignUp !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
473
|
+
reactNative.TouchableOpacity,
|
|
474
|
+
{
|
|
475
|
+
accessibilityHint: labels.signUp,
|
|
476
|
+
accessibilityLabel: labels.signUp,
|
|
477
|
+
accessibilityRole: "link",
|
|
478
|
+
disabled: isSubmitting,
|
|
479
|
+
style: styles.fieldGroup,
|
|
480
|
+
testID: withTestIdPrefix(AuthTestIds.loginSignUpLink, testIdPrefix),
|
|
481
|
+
onPress: onSignUp,
|
|
482
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles.linkText, children: labels.signUp })
|
|
483
|
+
}
|
|
484
|
+
) : null
|
|
469
485
|
] }) });
|
|
470
486
|
}
|
|
471
487
|
function useBffForgotPassword(options) {
|