@dloizides/auth-web 1.12.1 → 1.13.0
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/CHANGELOG.md +431 -386
- package/dist/index.d.mts +81 -9
- package/dist/index.d.ts +81 -9
- package/dist/index.js +137 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +137 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -281,7 +281,9 @@ var DEFAULT_DEMO_CREDENTIALS_HINT_LABELS = {
|
|
|
281
281
|
usernameLabel: "Username",
|
|
282
282
|
passwordLabel: "Password",
|
|
283
283
|
useCredentials: "Use these credentials",
|
|
284
|
-
useCredentialsHint: "Fill the sign-in form with the demo username and password"
|
|
284
|
+
useCredentialsHint: "Fill the sign-in form with the demo username and password",
|
|
285
|
+
toggle: "Try the demo",
|
|
286
|
+
toggleHint: "Show the demo account username and password"
|
|
285
287
|
};
|
|
286
288
|
|
|
287
289
|
// src/components/labels/resetPasswordLabels.ts
|
|
@@ -378,7 +380,9 @@ var AuthTestIds = {
|
|
|
378
380
|
demoCredentialsHint: "auth-demo-credentials-hint",
|
|
379
381
|
demoCredentialsUsername: "auth-demo-credentials-username",
|
|
380
382
|
demoCredentialsPassword: "auth-demo-credentials-password",
|
|
381
|
-
demoCredentialsUseButton: "auth-demo-credentials-use"
|
|
383
|
+
demoCredentialsUseButton: "auth-demo-credentials-use",
|
|
384
|
+
// The collapsed disclosure trigger (`disclosure` variant only).
|
|
385
|
+
demoCredentialsToggle: "auth-demo-credentials-toggle"
|
|
382
386
|
};
|
|
383
387
|
function withTestIdPrefix(baseId, prefix) {
|
|
384
388
|
return prefix === void 0 || prefix === "" ? baseId : `${prefix}-${baseId}`;
|
|
@@ -3215,7 +3219,62 @@ function PreferredMethodHint({
|
|
|
3215
3219
|
}
|
|
3216
3220
|
return /* @__PURE__ */ jsx(View, { testID: withTestIdPrefix(AuthTestIds.preferredMethodHint, testIdPrefix), children: /* @__PURE__ */ jsx(Text, { style: styles3.helperText, children: text }) });
|
|
3217
3221
|
}
|
|
3222
|
+
function DemoCredentialsBody({
|
|
3223
|
+
credentials,
|
|
3224
|
+
labels,
|
|
3225
|
+
styles: styles3,
|
|
3226
|
+
authStyles,
|
|
3227
|
+
testIdPrefix,
|
|
3228
|
+
onUse
|
|
3229
|
+
}) {
|
|
3230
|
+
return /* @__PURE__ */ jsxs(View, { children: [
|
|
3231
|
+
/* @__PURE__ */ jsxs(View, { style: styles3.row, children: [
|
|
3232
|
+
/* @__PURE__ */ jsx(Text, { style: styles3.rowLabel, children: labels.usernameLabel }),
|
|
3233
|
+
/* @__PURE__ */ jsx(
|
|
3234
|
+
Text,
|
|
3235
|
+
{
|
|
3236
|
+
selectable: true,
|
|
3237
|
+
style: styles3.rowValue,
|
|
3238
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsUsername, testIdPrefix),
|
|
3239
|
+
children: credentials.username
|
|
3240
|
+
}
|
|
3241
|
+
)
|
|
3242
|
+
] }),
|
|
3243
|
+
/* @__PURE__ */ jsxs(View, { style: styles3.row, children: [
|
|
3244
|
+
/* @__PURE__ */ jsx(Text, { style: styles3.rowLabel, children: labels.passwordLabel }),
|
|
3245
|
+
/* @__PURE__ */ jsx(
|
|
3246
|
+
Text,
|
|
3247
|
+
{
|
|
3248
|
+
selectable: true,
|
|
3249
|
+
style: styles3.rowValue,
|
|
3250
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsPassword, testIdPrefix),
|
|
3251
|
+
children: credentials.password
|
|
3252
|
+
}
|
|
3253
|
+
)
|
|
3254
|
+
] }),
|
|
3255
|
+
onUse !== void 0 ? /* @__PURE__ */ jsx(
|
|
3256
|
+
TouchableOpacity,
|
|
3257
|
+
{
|
|
3258
|
+
accessibilityHint: labels.useCredentialsHint,
|
|
3259
|
+
accessibilityLabel: labels.useCredentials,
|
|
3260
|
+
accessibilityRole: "button",
|
|
3261
|
+
style: [authStyles.secondaryButton, styles3.useButton],
|
|
3262
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsUseButton, testIdPrefix),
|
|
3263
|
+
onPress: onUse,
|
|
3264
|
+
children: /* @__PURE__ */ jsx(Text, { style: authStyles.secondaryButtonText, children: labels.useCredentials })
|
|
3265
|
+
}
|
|
3266
|
+
) : null
|
|
3267
|
+
] });
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3270
|
+
// src/components/DemoCredentialsHintVariant.ts
|
|
3271
|
+
var DemoCredentialsHintVariant = /* @__PURE__ */ ((DemoCredentialsHintVariant2) => {
|
|
3272
|
+
DemoCredentialsHintVariant2["Panel"] = "panel";
|
|
3273
|
+
DemoCredentialsHintVariant2["Disclosure"] = "disclosure";
|
|
3274
|
+
return DemoCredentialsHintVariant2;
|
|
3275
|
+
})(DemoCredentialsHintVariant || {});
|
|
3218
3276
|
var PANEL_BORDER_WIDTH = 1;
|
|
3277
|
+
var TRIGGER_MIN_HEIGHT = 32;
|
|
3219
3278
|
var ACCENT_RAIL_WIDTH = 3;
|
|
3220
3279
|
var TITLE_LETTER_SPACING = 0.8;
|
|
3221
3280
|
var DESCRIPTION_LINE_HEIGHT_RATIO = 1.45;
|
|
@@ -3276,6 +3335,40 @@ function useDemoCredentialsStyles(theme) {
|
|
|
3276
3335
|
flexShrink: 1,
|
|
3277
3336
|
backgroundColor: colors.surface,
|
|
3278
3337
|
color: colors.text
|
|
3338
|
+
},
|
|
3339
|
+
// ── Disclosure variant ──────────────────────────────────────────────
|
|
3340
|
+
// No panel fill, no border, no brand rail: the collapsed state is one
|
|
3341
|
+
// line of text and nothing else, so on a page a real customer uses it
|
|
3342
|
+
// reads as a footnote rather than as a second call to action.
|
|
3343
|
+
disclosure: {
|
|
3344
|
+
marginTop: spacing.md,
|
|
3345
|
+
alignSelf: "stretch"
|
|
3346
|
+
},
|
|
3347
|
+
disclosureTrigger: {
|
|
3348
|
+
alignSelf: "center",
|
|
3349
|
+
justifyContent: "center",
|
|
3350
|
+
minHeight: TRIGGER_MIN_HEIGHT,
|
|
3351
|
+
paddingHorizontal: spacing.xs
|
|
3352
|
+
},
|
|
3353
|
+
disclosureTriggerText: {
|
|
3354
|
+
fontSize: typography.caption,
|
|
3355
|
+
textDecorationLine: "underline",
|
|
3356
|
+
// `textSecondary`, NOT a dimmed `text`. This is the same token the rest
|
|
3357
|
+
// of the helper copy uses, so it inherits whatever AA contrast the
|
|
3358
|
+
// consuming app already guarantees. Discretion here is carried by the
|
|
3359
|
+
// caption size, the centred placement below the form, and the absence
|
|
3360
|
+
// of any fill or border — never by fading the text toward the
|
|
3361
|
+
// background, which is how "discreet" quietly becomes a contrast bug.
|
|
3362
|
+
color: colors.textSecondary
|
|
3363
|
+
},
|
|
3364
|
+
disclosureBody: {
|
|
3365
|
+
marginTop: spacing.sm,
|
|
3366
|
+
paddingTop: spacing.sm,
|
|
3367
|
+
borderTopWidth: PANEL_BORDER_WIDTH,
|
|
3368
|
+
borderTopColor: colors.border
|
|
3369
|
+
},
|
|
3370
|
+
useButton: {
|
|
3371
|
+
alignSelf: "stretch"
|
|
3279
3372
|
}
|
|
3280
3373
|
});
|
|
3281
3374
|
}, [theme]);
|
|
@@ -3296,6 +3389,7 @@ function resolveDemoCredentials(credentials) {
|
|
|
3296
3389
|
}
|
|
3297
3390
|
function DemoCredentialsHint({
|
|
3298
3391
|
credentials,
|
|
3392
|
+
variant = "disclosure" /* Disclosure */,
|
|
3299
3393
|
theme: themeProp,
|
|
3300
3394
|
labels: labelsProp,
|
|
3301
3395
|
testIdPrefix,
|
|
@@ -3304,6 +3398,7 @@ function DemoCredentialsHint({
|
|
|
3304
3398
|
const theme = useAuthTheme(themeProp);
|
|
3305
3399
|
const authStyles = useAuthStyles(theme);
|
|
3306
3400
|
const styles3 = useDemoCredentialsStyles(theme);
|
|
3401
|
+
const [expanded, setExpanded] = useState(false);
|
|
3307
3402
|
const labels = useMemo(
|
|
3308
3403
|
() => ({ ...DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, ...labelsProp }),
|
|
3309
3404
|
[labelsProp]
|
|
@@ -3314,53 +3409,57 @@ function DemoCredentialsHint({
|
|
|
3314
3409
|
onUse(resolved);
|
|
3315
3410
|
}
|
|
3316
3411
|
}, [resolved, onUse]);
|
|
3412
|
+
const handleToggle = useCallback(() => {
|
|
3413
|
+
setExpanded((current) => !current);
|
|
3414
|
+
}, []);
|
|
3317
3415
|
if (resolved === null) {
|
|
3318
3416
|
return null;
|
|
3319
3417
|
}
|
|
3418
|
+
const body = /* @__PURE__ */ jsx(
|
|
3419
|
+
DemoCredentialsBody,
|
|
3420
|
+
{
|
|
3421
|
+
authStyles,
|
|
3422
|
+
credentials: resolved,
|
|
3423
|
+
labels,
|
|
3424
|
+
styles: styles3,
|
|
3425
|
+
testIdPrefix,
|
|
3426
|
+
onUse: onUse === void 0 ? void 0 : handleUse
|
|
3427
|
+
}
|
|
3428
|
+
);
|
|
3429
|
+
if (variant === "panel" /* Panel */) {
|
|
3430
|
+
return /* @__PURE__ */ jsxs(
|
|
3431
|
+
View,
|
|
3432
|
+
{
|
|
3433
|
+
style: styles3.panel,
|
|
3434
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsHint, testIdPrefix),
|
|
3435
|
+
children: [
|
|
3436
|
+
/* @__PURE__ */ jsx(Text, { style: styles3.title, children: labels.title }),
|
|
3437
|
+
/* @__PURE__ */ jsx(Text, { style: styles3.description, children: labels.description }),
|
|
3438
|
+
body
|
|
3439
|
+
]
|
|
3440
|
+
}
|
|
3441
|
+
);
|
|
3442
|
+
}
|
|
3320
3443
|
return /* @__PURE__ */ jsxs(
|
|
3321
3444
|
View,
|
|
3322
3445
|
{
|
|
3323
|
-
style: styles3.
|
|
3446
|
+
style: styles3.disclosure,
|
|
3324
3447
|
testID: withTestIdPrefix(AuthTestIds.demoCredentialsHint, testIdPrefix),
|
|
3325
3448
|
children: [
|
|
3326
|
-
/* @__PURE__ */ jsx(
|
|
3327
|
-
/* @__PURE__ */ jsx(Text, { style: styles3.description, children: labels.description }),
|
|
3328
|
-
/* @__PURE__ */ jsxs(View, { style: styles3.row, children: [
|
|
3329
|
-
/* @__PURE__ */ jsx(Text, { style: styles3.rowLabel, children: labels.usernameLabel }),
|
|
3330
|
-
/* @__PURE__ */ jsx(
|
|
3331
|
-
Text,
|
|
3332
|
-
{
|
|
3333
|
-
selectable: true,
|
|
3334
|
-
style: styles3.rowValue,
|
|
3335
|
-
testID: withTestIdPrefix(AuthTestIds.demoCredentialsUsername, testIdPrefix),
|
|
3336
|
-
children: resolved.username
|
|
3337
|
-
}
|
|
3338
|
-
)
|
|
3339
|
-
] }),
|
|
3340
|
-
/* @__PURE__ */ jsxs(View, { style: styles3.row, children: [
|
|
3341
|
-
/* @__PURE__ */ jsx(Text, { style: styles3.rowLabel, children: labels.passwordLabel }),
|
|
3342
|
-
/* @__PURE__ */ jsx(
|
|
3343
|
-
Text,
|
|
3344
|
-
{
|
|
3345
|
-
selectable: true,
|
|
3346
|
-
style: styles3.rowValue,
|
|
3347
|
-
testID: withTestIdPrefix(AuthTestIds.demoCredentialsPassword, testIdPrefix),
|
|
3348
|
-
children: resolved.password
|
|
3349
|
-
}
|
|
3350
|
-
)
|
|
3351
|
-
] }),
|
|
3352
|
-
onUse !== void 0 ? /* @__PURE__ */ jsx(
|
|
3449
|
+
/* @__PURE__ */ jsx(
|
|
3353
3450
|
TouchableOpacity,
|
|
3354
3451
|
{
|
|
3355
|
-
accessibilityHint: labels.
|
|
3356
|
-
accessibilityLabel: labels.
|
|
3452
|
+
accessibilityHint: labels.toggleHint,
|
|
3453
|
+
accessibilityLabel: labels.toggle,
|
|
3357
3454
|
accessibilityRole: "button",
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3455
|
+
accessibilityState: { expanded },
|
|
3456
|
+
style: styles3.disclosureTrigger,
|
|
3457
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsToggle, testIdPrefix),
|
|
3458
|
+
onPress: handleToggle,
|
|
3459
|
+
children: /* @__PURE__ */ jsx(Text, { style: styles3.disclosureTriggerText, children: labels.toggle })
|
|
3362
3460
|
}
|
|
3363
|
-
)
|
|
3461
|
+
),
|
|
3462
|
+
expanded ? /* @__PURE__ */ jsx(View, { style: styles3.disclosureBody, children: body }) : null
|
|
3364
3463
|
]
|
|
3365
3464
|
}
|
|
3366
3465
|
);
|
|
@@ -3606,6 +3705,6 @@ async function performBffLogout(options) {
|
|
|
3606
3705
|
runGuarded(onRedirect, onError);
|
|
3607
3706
|
}
|
|
3608
3707
|
|
|
3609
|
-
export { AuthScreen, AuthTestIds, AuthThemeProvider, BffAuthStatus, DEFAULT_AUTH_CARD_MAX_WIDTH, DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, DEFAULT_DEVICE_PIN_ENROLL_LABELS, DEFAULT_DEVICE_PIN_SETTINGS_LABELS, DEFAULT_DEVICE_PIN_UNLOCK_LABELS, DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS, DEFAULT_FORGOT_PASSWORD_LABELS, DEFAULT_LOGIN_LABELS, DEFAULT_OTP_LABELS, DEFAULT_PASSKEY_LOGIN_LABELS, DEFAULT_PASSKEY_SETTINGS_LABELS, DEFAULT_PIN_LABELS, DEFAULT_PREFERRED_METHOD_HINT_LABELS, DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEVICE_PIN_ALLOWED_DIGITS, DEVICE_PIN_DEFAULT_DIGITS, DemoCredentialsHint, DevicePinEnrollErrorKey, DevicePinEnrollForm, DevicePinErrorKey, DevicePinInput, DevicePinLengthPicker, DevicePinOffer, DevicePinSettingsCard, DevicePinUnlockScreen, ForgotPasswordFields, ForgotPasswordForm, LoginForm, OtpForm, OtpLoginStep, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasskeyCeremonyMode, PasskeyCeremonyStatus, PasskeyLoginButton, PasskeySettingsCard, PasswordPolicyError, PinForm, PreferredMethodHint, PreferredMethodSettingsCard, PrefillIntent, ResetPasswordError, ResetPasswordForm, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
|
3708
|
+
export { AuthScreen, AuthTestIds, AuthThemeProvider, BffAuthStatus, DEFAULT_AUTH_CARD_MAX_WIDTH, DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, DEFAULT_DEVICE_PIN_ENROLL_LABELS, DEFAULT_DEVICE_PIN_SETTINGS_LABELS, DEFAULT_DEVICE_PIN_UNLOCK_LABELS, DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS, DEFAULT_FORGOT_PASSWORD_LABELS, DEFAULT_LOGIN_LABELS, DEFAULT_OTP_LABELS, DEFAULT_PASSKEY_LOGIN_LABELS, DEFAULT_PASSKEY_SETTINGS_LABELS, DEFAULT_PIN_LABELS, DEFAULT_PREFERRED_METHOD_HINT_LABELS, DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEVICE_PIN_ALLOWED_DIGITS, DEVICE_PIN_DEFAULT_DIGITS, DemoCredentialsHint, DemoCredentialsHintVariant, DevicePinEnrollErrorKey, DevicePinEnrollForm, DevicePinErrorKey, DevicePinInput, DevicePinLengthPicker, DevicePinOffer, DevicePinSettingsCard, DevicePinUnlockScreen, ForgotPasswordFields, ForgotPasswordForm, LoginForm, OtpForm, OtpLoginStep, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasskeyCeremonyMode, PasskeyCeremonyStatus, PasskeyLoginButton, PasskeySettingsCard, PasswordPolicyError, PinForm, PreferredMethodHint, PreferredMethodSettingsCard, PrefillIntent, ResetPasswordError, ResetPasswordForm, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
|
3610
3709
|
//# sourceMappingURL=index.mjs.map
|
|
3611
3710
|
//# sourceMappingURL=index.mjs.map
|