@wow-two-beta/fe-identity 0.0.4 → 0.0.5

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.
@@ -44,8 +44,29 @@ const PasswordChangeConfirmationType = {
44
44
  /** A one-time link, sent to a verified channel, is the only way to the change form. */
45
45
  Link: "Link"
46
46
  };
47
+ const SignInRuleCodeConstants = {
48
+ /** A value must be present. */
49
+ required: "required",
50
+ /** At least `min` of `unit`. */
51
+ min: "min",
52
+ /** At most `max` of `unit`. */
53
+ max: "max",
54
+ /** Exactly `length` of `unit`. */
55
+ length: "length",
56
+ /** The value holds a match of `pattern`, a JavaScript regular expression with the `u` flag. */
57
+ pattern: "pattern",
58
+ /** The value differs from each field of `fields`, ignoring case when `isCaseIgnored`. */
59
+ notEqual: "notEqual",
60
+ /** A rule the vocabulary has no code for, named by `rule`, such as `distinctCharacters`. */
61
+ custom: "custom",
62
+ /** The `unit` operand of a size rule counted in characters. */
63
+ charactersUnit: "characters",
64
+ /** The `rule` operand of a `custom` rule needing at least `min` different characters. */
65
+ distinctCharactersRule: "distinctCharacters"
66
+ };
47
67
  export {
48
68
  AccountRouteConstants as A,
49
- PasswordChangeConfirmationType as P
69
+ PasswordChangeConfirmationType as P,
70
+ SignInRuleCodeConstants as S
50
71
  };
51
- //# sourceMappingURL=PasswordChangeConfirmationType-Gtvfpkl5.js.map
72
+ //# sourceMappingURL=SignInRuleCodeConstants-C7yJwhTY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignInRuleCodeConstants-C7yJwhTY.js","sources":["../../src/contracts/AccountRouteConstants.ts","../../src/contracts/PasswordChangeConfirmationType.ts","../../src/contracts/SignInRuleCodeConstants.ts"],"sourcesContent":["/** Mirrors the account API's routes: relative to the service or consumer origin, under the contract's HTTP mirror. */\nexport const AccountRouteConstants = {\n /** The account API's mount point. */\n base: '/api/account',\n /** `POST`: signs an account up while sign-up is on. */\n signUp: '/sign-up',\n /** `POST`: signs in with an identifier and password. */\n signIn: '/sign-in',\n /** `GET`: confirms an email with the emailed `userId` and `token`. */\n confirmEmail: '/confirm-email',\n /** `POST`: sends the confirmation email again; always `204`. */\n resendConfirmationEmail: '/resend-confirmation-email',\n /** `POST`: sends a password reset email; always `204`. */\n forgotPassword: '/forgot-password',\n /** `POST`: sets a new password with the emailed reset token. */\n resetPassword: '/reset-password',\n /** `GET`: the signed-in account. */\n manageInfo: '/manage/info',\n /** `POST`: starts a password change, signed in or with a ticket, and answers how it is confirmed. */\n managePasswordConfirmation: '/manage/password/confirmation',\n /** `POST`: changes the password of the signed-in person or of the one a ticket names. */\n managePassword: '/manage/password',\n /** `POST`: changes a password with the one-time token a change link carries; anonymous. */\n passwordChange: '/password/change',\n /** `POST`: sends a phone sign-in code. */\n phoneSignInSend: '/phone-sign-in/send',\n /** `POST`: signs in with a phone and the code sent to it. */\n phoneSignIn: '/phone-sign-in',\n /** `POST`: ends the cookie's session. */\n signOut: '/sign-out',\n /** `GET`, anonymous: the sign-in declaration, the look and the enabled methods with their rules; `?clientId=`, `?locale=`. */\n signInOptions: '/sign-in-options',\n /** The query parameter that asks a sign-in route for a cookie instead of a bearer session. */\n useCookiesParameter: 'useCookies',\n /** The query parameter that names the OIDC client a sign-in serves, for the sign-in log; the look is the instance's. */\n clientIdParameter: 'clientId',\n /** The query parameter that picks the locale of the declaration's messages: `uz`, `ru` or `en`. */\n localeParameter: 'locale',\n} as const;\n","/** Mirrors `PasswordChangeConfirmationType` of the be contract: how a password change is confirmed. */\nexport const PasswordChangeConfirmationType = {\n /** The current password is the only proof; the change form opens at once. */\n None: 'None',\n /** A one-time code, sent to a verified channel, is entered beside the new password. */\n Code: 'Code',\n /** A one-time link, sent to a verified channel, is the only way to the change form. */\n Link: 'Link',\n} as const;\nexport type PasswordChangeConfirmationType =\n (typeof PasswordChangeConfirmationType)[keyof typeof PasswordChangeConfirmationType];\n","/**\n * Mirrors `SignInRuleCodeConstants` of the be contract: the rule codes the declaration uses, the fe sdk\n * `ValidationCodes` names, and the fixed operand values some of them carry.\n */\nexport const SignInRuleCodeConstants = {\n /** A value must be present. */\n required: 'required',\n /** At least `min` of `unit`. */\n min: 'min',\n /** At most `max` of `unit`. */\n max: 'max',\n /** Exactly `length` of `unit`. */\n length: 'length',\n /** The value holds a match of `pattern`, a JavaScript regular expression with the `u` flag. */\n pattern: 'pattern',\n /** The value differs from each field of `fields`, ignoring case when `isCaseIgnored`. */\n notEqual: 'notEqual',\n /** A rule the vocabulary has no code for, named by `rule`, such as `distinctCharacters`. */\n custom: 'custom',\n /** The `unit` operand of a size rule counted in characters. */\n charactersUnit: 'characters',\n /** The `rule` operand of a `custom` rule needing at least `min` different characters. */\n distinctCharactersRule: 'distinctCharacters',\n} as const;\n"],"names":[],"mappings":"AACO,MAAM,wBAAwB;AAAA;AAAA,EAEnC,MAAM;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,QAAQ;AAAA;AAAA,EAER,cAAc;AAAA;AAAA,EAEd,yBAAyB;AAAA;AAAA,EAEzB,gBAAgB;AAAA;AAAA,EAEhB,eAAe;AAAA;AAAA,EAEf,YAAY;AAAA;AAAA,EAEZ,4BAA4B;AAAA;AAAA,EAE5B,gBAAgB;AAAA;AAAA,EAEhB,gBAAgB;AAAA;AAAA,EAEhB,iBAAiB;AAAA;AAAA,EAEjB,aAAa;AAAA;AAAA,EAEb,SAAS;AAAA;AAAA,EAET,eAAe;AAAA;AAAA,EAEf,qBAAqB;AAAA;AAAA,EAErB,mBAAmB;AAAA;AAAA,EAEnB,iBAAiB;AACnB;ACrCO,MAAM,iCAAiC;AAAA;AAAA,EAE5C,MAAM;AAAA;AAAA,EAEN,MAAM;AAAA;AAAA,EAEN,MAAM;AACR;ACJO,MAAM,0BAA0B;AAAA;AAAA,EAErC,UAAU;AAAA;AAAA,EAEV,KAAK;AAAA;AAAA,EAEL,KAAK;AAAA;AAAA,EAEL,QAAQ;AAAA;AAAA,EAER,SAAS;AAAA;AAAA,EAET,UAAU;AAAA;AAAA,EAEV,QAAQ;AAAA;AAAA,EAER,gBAAgB;AAAA;AAAA,EAEhB,wBAAwB;AAC1B;"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Mirrors `SignInRuleCodeConstants` of the be contract: the rule codes the declaration uses, the fe sdk
3
+ * `ValidationCodes` names, and the fixed operand values some of them carry.
4
+ */
5
+ export declare const SignInRuleCodeConstants: {
6
+ /** A value must be present. */
7
+ readonly required: "required";
8
+ /** At least `min` of `unit`. */
9
+ readonly min: "min";
10
+ /** At most `max` of `unit`. */
11
+ readonly max: "max";
12
+ /** Exactly `length` of `unit`. */
13
+ readonly length: "length";
14
+ /** The value holds a match of `pattern`, a JavaScript regular expression with the `u` flag. */
15
+ readonly pattern: "pattern";
16
+ /** The value differs from each field of `fields`, ignoring case when `isCaseIgnored`. */
17
+ readonly notEqual: "notEqual";
18
+ /** A rule the vocabulary has no code for, named by `rule`, such as `distinctCharacters`. */
19
+ readonly custom: "custom";
20
+ /** The `unit` operand of a size rule counted in characters. */
21
+ readonly charactersUnit: "characters";
22
+ /** The `rule` operand of a `custom` rule needing at least `min` different characters. */
23
+ readonly distinctCharactersRule: "distinctCharacters";
24
+ };
@@ -19,6 +19,7 @@ export type { SignInMethodDto } from './SignInMethodDto';
19
19
  export { SignInMethodIdConstants } from './SignInMethodIdConstants';
20
20
  export type { SignInOptionsDto } from './SignInOptionsDto';
21
21
  export type { SignInRequirementsDto } from './SignInRequirementsDto';
22
+ export { SignInRuleCodeConstants } from './SignInRuleCodeConstants';
22
23
  export type { SignInRuleDto } from './SignInRuleDto';
23
24
  export type { SignUpApiRequest } from './SignUpApiRequest';
24
25
  export type { SignedUpAccountDto } from './SignedUpAccountDto';
@@ -1,4 +1,4 @@
1
- import { A, P } from "../chunks/PasswordChangeConfirmationType-Gtvfpkl5.js";
1
+ import { A, P, S } from "../chunks/SignInRuleCodeConstants-C7yJwhTY.js";
2
2
  const HostedPageRouteConstants = {
3
3
  /** Signs a person in by every enabled method, then continues to `returnUrl`. */
4
4
  signIn: "/sign-in",
@@ -35,6 +35,7 @@ export {
35
35
  A as AccountRouteConstants,
36
36
  HostedPageRouteConstants,
37
37
  P as PasswordChangeConfirmationType,
38
- SignInMethodIdConstants
38
+ SignInMethodIdConstants,
39
+ S as SignInRuleCodeConstants
39
40
  };
40
41
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,3 @@
1
1
  export { createAccountClient, type AccountClient, type AccountClientOptions, type AccountSignInOptions, type SignInOptionsQuery, } from './CreateAccountClient';
2
2
  export { useAccountText, type AccountClientSource, type AccountText } from './hooks';
3
+ export { passwordRule, passwordRuleMessages, type PasswordAccount } from './validation';
@@ -0,0 +1,8 @@
1
+ import { StringValidator } from '@wow-two-beta/fe/foundation/validators';
2
+ /**
3
+ * Wraps `inner` so the empty string fails as `required`, with the fe sdk's own message unless `message` replaces it; any
4
+ * other value goes to `inner`. A form checks presence first, so the format or size rules never complain about nothing.
5
+ */
6
+ export declare function requiredText(inner?: StringValidator, message?: string): StringValidator;
7
+ /** Accepts an email-shaped value: required, then the fe sdk's pragmatic format check. */
8
+ export declare function emailRule(): StringValidator;
@@ -0,0 +1,17 @@
1
+ import { StringValidator, type ValidationMessageCatalogue } from '@wow-two-beta/fe/foundation/validators';
2
+ import { type SignInRuleDto } from '../../../contracts';
3
+ /** Holds the account values a `notEqual` rule compares a password with, under the field names the declaration uses. */
4
+ export type PasswordAccount = Readonly<Partial<Record<'userName' | 'email', string | null>>>;
5
+ /** Renders every rule the declaration carries from its own message, which is in the request's locale. */
6
+ export declare const passwordRuleMessages: ValidationMessageCatalogue;
7
+ /**
8
+ * Maps the rules a declaration lists for a new password onto fe sdk validators: `min`, `max`, `length`, `pattern`,
9
+ * `custom` (`distinctCharacters`) and `notEqual`, plus `required` for the message of the presence check. A code or
10
+ * operand it does not know is skipped, since the server still checks everything. An empty value fails as `required`
11
+ * alone, anything else reports every rule it breaks. Each failure carries the declaration's message, the fe sdk's own
12
+ * when that is empty; pass {@link passwordRuleMessages} to the form so the catalogue does not replace it.
13
+ *
14
+ * @param rules The declaration's `passwordRules`; with none, only presence is checked.
15
+ * @param account The account values a `notEqual` rule compares with; a rule naming none of them is skipped.
16
+ */
17
+ export declare function passwordRule(rules: ReadonlyArray<SignInRuleDto> | null | undefined, account?: PasswordAccount): StringValidator;
@@ -0,0 +1,2 @@
1
+ export { emailRule, requiredText } from './FieldRules';
2
+ export { passwordRule, passwordRuleMessages, type PasswordAccount } from './PasswordRules';
package/dist/kit/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString, createCommentVNode, shallowRef, onMounted, createElementBlock, Fragment, createVNode, createElementVNode } from "vue";
2
+ import { StringValidator, invalid, string, email, object, phone, Validator } from "@wow-two-beta/fe/foundation/validators";
2
3
  import { Button } from "@wow-two-beta/fe/presentation/actions";
3
4
  import { AlertSimple } from "@wow-two-beta/fe/presentation/feedback";
4
5
  import { Field, PasswordInput, TextInput, EmailInput, PhoneInput } from "@wow-two-beta/fe/presentation/forms";
5
- import { A as AccountRouteConstants, P as PasswordChangeConfirmationType } from "../chunks/PasswordChangeConfirmationType-Gtvfpkl5.js";
6
+ import { A as AccountRouteConstants, P as PasswordChangeConfirmationType, S as SignInRuleCodeConstants } from "../chunks/SignInRuleCodeConstants-C7yJwhTY.js";
6
7
  import { createApiClient, ApiFailureFactory, ApiFailureExtensions } from "@wow-two-beta/fe/foundation/http";
7
8
  import { ResultExtensions, AppErrorType, AppErrorFactory } from "@wow-two-beta/fe/foundation/results";
8
9
  import { useLocale } from "@wow-two-beta/fe/foundation/i18n";
9
10
  import { useAppForm } from "@wow-two-beta/fe/forms-engine/house";
10
- import { object, phone } from "@wow-two-beta/fe/foundation/validators";
11
11
  const protocolFailure = () => ResultExtensions.fail(ApiFailureFactory.create("protocol"));
12
12
  function record(value) {
13
13
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -182,6 +182,111 @@ function useAccountText() {
182
182
  const locale = useLocale();
183
183
  return (key, fallback, values) => locale.t(`IdentityKit.${key}`, values, fallback);
184
184
  }
185
+ function requiredText(inner = string(), message) {
186
+ return new StringValidator(
187
+ inner.typeName,
188
+ (value, path) => value === "" ? invalid([{ path, message: message ?? "is required", code: SignInRuleCodeConstants.required }]) : inner.parseAt(value, path)
189
+ );
190
+ }
191
+ function emailRule() {
192
+ return requiredText(email());
193
+ }
194
+ const passwordRuleMessages = Object.freeze({
195
+ required: (context) => context.message,
196
+ min: (context) => context.message,
197
+ max: (context) => context.message,
198
+ length: (context) => context.message,
199
+ notEqual: (context) => context.message
200
+ });
201
+ const operand = (params, name) => {
202
+ const value = params?.[name];
203
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
204
+ };
205
+ const isCounted = (params) => params?.unit === void 0 || params.unit === SignInRuleCodeConstants.charactersUnit;
206
+ const declaredMessage = (rule) => rule.message === "" ? void 0 : rule.message;
207
+ function accountValue(account, field) {
208
+ if (!Object.hasOwn(account, field)) return null;
209
+ const value = account[field];
210
+ return value ? value : null;
211
+ }
212
+ function toAccountCheck(rule, account) {
213
+ const fields = rule.params?.fields;
214
+ if (!Array.isArray(fields)) return null;
215
+ const names = fields.filter((field) => typeof field === "string");
216
+ const values = names.flatMap((name) => {
217
+ const value = accountValue(account, name);
218
+ return value === null ? [] : [value];
219
+ });
220
+ if (values.length === 0) return null;
221
+ const fold = rule.params?.isCaseIgnored === true ? (text2) => text2.toLowerCase() : (text2) => text2;
222
+ return string().refine(
223
+ (password) => values.every((value) => fold(value) !== fold(password)),
224
+ declaredMessage(rule) ?? "must differ from the user name and email",
225
+ SignInRuleCodeConstants.notEqual,
226
+ { fields: names }
227
+ );
228
+ }
229
+ function toCheck(rule, account) {
230
+ const { code, params } = rule;
231
+ const message = declaredMessage(rule);
232
+ switch (code) {
233
+ case SignInRuleCodeConstants.min: {
234
+ const limit = operand(params, "min");
235
+ return limit !== null && isCounted(params) ? string().min(limit, message) : null;
236
+ }
237
+ case SignInRuleCodeConstants.max: {
238
+ const limit = operand(params, "max");
239
+ return limit !== null && isCounted(params) ? string().max(limit, message) : null;
240
+ }
241
+ case SignInRuleCodeConstants.length: {
242
+ const exact = operand(params, "length");
243
+ return exact !== null && isCounted(params) ? string().length(exact, message) : null;
244
+ }
245
+ case SignInRuleCodeConstants.pattern: {
246
+ const source = params?.pattern;
247
+ if (typeof source !== "string") return null;
248
+ try {
249
+ return string().pattern(new RegExp(source, "u"), message);
250
+ } catch {
251
+ return null;
252
+ }
253
+ }
254
+ case SignInRuleCodeConstants.custom: {
255
+ const limit = operand(params, "min");
256
+ if (params?.rule !== SignInRuleCodeConstants.distinctCharactersRule || limit === null) return null;
257
+ return string().refine(
258
+ (password) => new Set(password.split("")).size >= limit,
259
+ message ?? `must use at least ${limit} different characters`,
260
+ SignInRuleCodeConstants.custom,
261
+ { rule: SignInRuleCodeConstants.distinctCharactersRule, min: limit }
262
+ );
263
+ }
264
+ case SignInRuleCodeConstants.notEqual:
265
+ return toAccountCheck(rule, account);
266
+ default:
267
+ return null;
268
+ }
269
+ }
270
+ function passwordRule(rules, account = {}) {
271
+ const declared = rules ?? [];
272
+ const checks = declared.flatMap((rule) => {
273
+ const check = toCheck(rule, account);
274
+ return check ? [check] : [];
275
+ });
276
+ const required = declared.find((rule) => rule.code === SignInRuleCodeConstants.required);
277
+ const text2 = string();
278
+ const all = new StringValidator("password", (value, path) => {
279
+ const parsed = text2.parseAt(value, path);
280
+ if (!parsed.ok) return parsed;
281
+ const issues = [];
282
+ for (const check of checks) {
283
+ const result = check.parseAt(parsed.value, path);
284
+ if (!result.ok) issues.push(...result.failure.issues);
285
+ }
286
+ return issues.length === 0 ? parsed : invalid(issues);
287
+ });
288
+ return requiredText(all, required ? declaredMessage(required) : void 0);
289
+ }
185
290
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
186
291
  ...{ name: "FailureAlert" },
187
292
  __name: "FailureAlert",
@@ -229,7 +334,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
229
334
  baseUrl: { default: void 0 },
230
335
  token: { default: null },
231
336
  ticket: { default: null },
232
- confirmation: { default: null }
337
+ confirmation: { default: null },
338
+ passwordRules: { default: void 0 }
233
339
  },
234
340
  emits: ["changed"],
235
341
  setup(__props, { emit: __emit }) {
@@ -247,8 +353,18 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
247
353
  const isStarting = shallowRef(false);
248
354
  const startFailure = shallowRef(null);
249
355
  const isCodeRequired = computed(() => started.value?.confirmation === PasswordChangeConfirmationType.Code);
250
- const form = useAppForm({
356
+ const schema = computed(
357
+ () => object({
358
+ currentPassword: props.token || props.ticket ? string() : requiredText(),
359
+ newPassword: passwordRule(props.passwordRules),
360
+ code: isCodeRequired.value ? requiredText() : string()
361
+ })
362
+ );
363
+ const form = useAppForm(() => ({
251
364
  defaultValues: { currentPassword: "", newPassword: "", code: "" },
365
+ schema: schema.value,
366
+ validateOn: "blur",
367
+ messages: passwordRuleMessages,
252
368
  onSubmit: async (values, { signal }) => {
253
369
  const result = props.token ? await client.changePasswordWithLink({ token: props.token, newPassword: values.newPassword }, signal) : await client.changePassword(
254
370
  {
@@ -264,7 +380,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
264
380
  }
265
381
  return result;
266
382
  }
267
- });
383
+ }));
268
384
  async function start() {
269
385
  isStarting.value = true;
270
386
  startFailure.value = null;
@@ -974,7 +1090,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
974
1090
  baseUrl: { default: void 0 },
975
1091
  email: {},
976
1092
  token: {},
977
- signInHref: { default: void 0 }
1093
+ signInHref: { default: void 0 },
1094
+ passwordRules: { default: void 0 }
978
1095
  },
979
1096
  emits: ["reset"],
980
1097
  setup(__props, { emit: __emit }) {
@@ -983,8 +1100,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
983
1100
  const client = useAccountClient(props);
984
1101
  const t = useAccountText();
985
1102
  const isReset = shallowRef(false);
986
- const form = useAppForm({
1103
+ const schema = computed(() => object({ newPassword: passwordRule(props.passwordRules, { email: props.email }) }));
1104
+ const form = useAppForm(() => ({
987
1105
  defaultValues: { newPassword: "" },
1106
+ schema: schema.value,
1107
+ validateOn: "blur",
1108
+ messages: passwordRuleMessages,
988
1109
  onSubmit: async (values, { signal }) => {
989
1110
  const result = await client.resetPassword(
990
1111
  { email: props.email, resetToken: props.token, newPassword: values.newPassword },
@@ -996,7 +1117,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
996
1117
  }
997
1118
  return result;
998
1119
  }
999
- });
1120
+ }));
1000
1121
  return (_ctx, _cache) => {
1001
1122
  return isReset.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
1002
1123
  createVNode(unref(AlertSimple), { severity: "success" }, {
@@ -1062,6 +1183,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1062
1183
  };
1063
1184
  }
1064
1185
  });
1186
+ function emailOf(value) {
1187
+ const email2 = typeof value === "object" && value !== null ? value.email : void 0;
1188
+ return typeof email2 === "string" ? email2 : null;
1189
+ }
1190
+ function signUpSchema(passwordRules) {
1191
+ return new Validator("sign-up", (value, path) => {
1192
+ const email2 = emailOf(value);
1193
+ return object({
1194
+ email: emailRule(),
1195
+ password: passwordRule(passwordRules, { userName: email2, email: email2 })
1196
+ }).parseAt(value, path);
1197
+ });
1198
+ }
1065
1199
  const _hoisted_1 = {
1066
1200
  key: 0,
1067
1201
  class: "flex flex-col gap-4"
@@ -1073,7 +1207,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1073
1207
  props: {
1074
1208
  client: { default: void 0 },
1075
1209
  baseUrl: { default: void 0 },
1076
- signInHref: { default: void 0 }
1210
+ signInHref: { default: void 0 },
1211
+ passwordRules: { default: void 0 }
1077
1212
  },
1078
1213
  emits: ["signedUp"],
1079
1214
  setup(__props, { emit: __emit }) {
@@ -1082,8 +1217,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1082
1217
  const client = useAccountClient(props);
1083
1218
  const t = useAccountText();
1084
1219
  const created = shallowRef(null);
1085
- const form = useAppForm({
1220
+ const schema = computed(() => signUpSchema(props.passwordRules));
1221
+ const form = useAppForm(() => ({
1086
1222
  defaultValues: { email: "", password: "" },
1223
+ schema: schema.value,
1224
+ validateOn: "blur",
1225
+ messages: passwordRuleMessages,
1087
1226
  onSubmit: async (values, { signal }) => {
1088
1227
  const result = await client.signUp(values, signal);
1089
1228
  if (result.ok) {
@@ -1092,7 +1231,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1092
1231
  }
1093
1232
  return result;
1094
1233
  }
1095
- });
1234
+ }));
1096
1235
  return (_ctx, _cache) => {
1097
1236
  return created.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
1098
1237
  createVNode(unref(AlertSimple), { severity: "success" }, {
@@ -1195,6 +1334,8 @@ export {
1195
1334
  _sfc_main$1 as ResetPasswordForm,
1196
1335
  _sfc_main as SignUpForm,
1197
1336
  createAccountClient,
1337
+ passwordRule,
1338
+ passwordRuleMessages,
1198
1339
  useAccountText
1199
1340
  };
1200
1341
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/kit/account/CreateAccountClient.ts","../../src/kit/account/hooks/UseAccountClient.ts","../../src/kit/account/hooks/UseAccountText.ts","../../src/kit/presentation/feedback/failureAlert/FailureAlert.vue","../../src/kit/presentation/forms/changePasswordForm/ChangePasswordStage.ts","../../src/kit/presentation/forms/changePasswordForm/ChangePasswordForm.vue","../../src/kit/presentation/forms/forgotPasswordForm/ForgotPasswordForm.vue","../../src/kit/presentation/forms/passwordSignIn/PasswordSignIn.vue","../../src/kit/presentation/forms/phoneCodeSignIn/PhoneSignInStep.ts","../../src/kit/presentation/forms/phoneCodeSignIn/PhoneCodeSignIn.vue","../../src/kit/presentation/forms/resetPasswordForm/ResetPasswordForm.vue","../../src/kit/presentation/forms/signUpForm/SignUpForm.vue"],"sourcesContent":["import { ApiFailureFactory, createApiClient, type ApiFailure } from '@wow-two-beta/fe/foundation/http';\nimport { ResultExtensions, type Result } from '@wow-two-beta/fe/foundation/results';\nimport {\n AccountRouteConstants,\n PasswordChangeConfirmationType,\n type AccountInfoDto,\n type ConfirmEmailApiRequest,\n type EmailAddressApiRequest,\n type PasswordChangeApiRequest,\n type PasswordChangeConfirmationApiRequest,\n type PasswordChangeConfirmationDto,\n type PasswordChangeLinkApiRequest,\n type PasswordChangeRequiredDto,\n type PhoneSignInApiRequest,\n type PhoneSignInSendApiRequest,\n type PhoneSignInSentDto,\n type ResetPasswordApiRequest,\n type SignInApiRequest,\n type SignInFieldDto,\n type SignInMethodDto,\n type SignInOptionsDto,\n type SignInRuleDto,\n type SignUpApiRequest,\n type SignedUpAccountDto,\n} from '../../contracts';\n\n/** Configures where the account API is reached. */\nexport interface AccountClientOptions {\n /** The origin serving the API: empty for the consumer's own backend (Form 1), the service's URL otherwise. */\n readonly baseUrl?: string;\n /**\n * Whether the browser sends the session cookie. Default `same-origin`, or `include` when `baseUrl` is set, which\n * the service's CORS policy must allow.\n */\n readonly credentials?: RequestCredentials;\n /** Replaces the global fetch, for tests. */\n readonly fetch?: typeof globalThis.fetch;\n}\n\n/** Describes a sign-in call beyond its body. */\nexport interface AccountSignInOptions {\n /** The OIDC client the sign-in serves, recorded by the sign-in log. */\n readonly clientId?: string | null;\n /** Cancels the request. */\n readonly signal?: AbortSignal;\n}\n\n/** Describes a sign-in declaration request. */\nexport interface SignInOptionsQuery {\n /** The OIDC client the sign-in serves, recorded by the sign-in log; the look stays the instance's. */\n readonly clientId?: string | null;\n /** The locale of the rule messages (`uz`, `ru`, `en`); the browser's `Accept-Language` when omitted. */\n readonly locale?: string | null;\n /** Cancels the request. */\n readonly signal?: AbortSignal;\n}\n\n/** Calls the account API over HTTP, signing in with cookie sessions. */\nexport interface AccountClient {\n /**\n * Reads the sign-in declaration: the hosted pages' look, whether sign-up is open, and each enabled method in layout\n * order with its fields and rules. The look is the instance's, whatever `clientId` names.\n */\n getSignInOptions(query?: SignInOptionsQuery): Promise<Result<SignInOptionsDto, ApiFailure>>;\n /** Signs an account up while sign-up is on; `403` while it is closed. */\n signUp(request: SignUpApiRequest, signal?: AbortSignal): Promise<Result<SignedUpAccountDto, ApiFailure>>;\n /**\n * Signs in with an identifier and password: `null` once the session cookie is set, or the ticket of a required\n * password change, which sets no session.\n */\n signIn(\n request: SignInApiRequest,\n options?: AccountSignInOptions,\n ): Promise<Result<PasswordChangeRequiredDto | null, ApiFailure>>;\n /** Confirms an email with the emailed token. */\n confirmEmail(request: ConfirmEmailApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Sends the confirmation email again; succeeds whether or not the account exists. */\n resendConfirmationEmail(request: EmailAddressApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Sends a password reset email; succeeds whether or not the account exists. */\n forgotPassword(request: EmailAddressApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Sets a new password with the emailed reset token. */\n resetPassword(request: ResetPasswordApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Reads the signed-in account; `401` when nobody is signed in. */\n getAccountInfo(signal?: AbortSignal): Promise<Result<AccountInfoDto, ApiFailure>>;\n /**\n * Starts a password change, signed in or with a required change's ticket: answers how it is confirmed, and sends the\n * code or link the setting asks for.\n */\n startPasswordChange(\n request?: PasswordChangeConfirmationApiRequest,\n signal?: AbortSignal,\n ): Promise<Result<PasswordChangeConfirmationDto, ApiFailure>>;\n /** Changes the password of the signed-in person, or of the one a required change's ticket names. */\n changePassword(request: PasswordChangeApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Changes a password with the one-time token a change link carries. */\n changePasswordWithLink(\n request: PasswordChangeLinkApiRequest,\n signal?: AbortSignal,\n ): Promise<Result<void, ApiFailure>>;\n /** Sends a phone sign-in code, or answers the Telegram link that sends one once the contact is shared. */\n sendPhoneSignInCode(\n request: PhoneSignInSendApiRequest,\n signal?: AbortSignal,\n ): Promise<Result<PhoneSignInSentDto, ApiFailure>>;\n /** Signs in with a phone and its code and sets the session cookie. */\n signInWithPhone(request: PhoneSignInApiRequest, options?: AccountSignInOptions): Promise<Result<void, ApiFailure>>;\n /** Ends the cookie's session. */\n signOut(signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n}\n\ntype Decoded<T> = Result<T, ApiFailure>;\n\nconst protocolFailure = () => ResultExtensions.fail(ApiFailureFactory.create('protocol'));\n\nfunction record(value: unknown): Readonly<Record<string, unknown>> | null {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction decodeSignedUp(value: unknown): Decoded<SignedUpAccountDto> {\n const body = record(value);\n if (body && typeof body.userId === 'string') {\n return ResultExtensions.ok({ userId: body.userId, isConfirmationSent: body.isConfirmationSent === true });\n }\n return protocolFailure();\n}\n\nfunction decodeAccountInfo(value: unknown): Decoded<AccountInfoDto> {\n const body = record(value);\n if (body && typeof body.userId === 'string') {\n return ResultExtensions.ok({\n userId: body.userId,\n userName: typeof body.userName === 'string' ? body.userName : null,\n email: typeof body.email === 'string' ? body.email : null,\n isEmailConfirmed: body.isEmailConfirmed === true,\n isTwoFactorEnabled: body.isTwoFactorEnabled === true,\n });\n }\n return protocolFailure();\n}\n\nconst confirmationTypes = Object.values(PasswordChangeConfirmationType);\n\n/** Reads a confirmation type whatever its case; `undefined` for anything else. */\nfunction confirmationOf(value: unknown): PasswordChangeConfirmationType | undefined {\n return typeof value === 'string'\n ? confirmationTypes.find((type) => type.toLowerCase() === value.toLowerCase())\n : undefined;\n}\n\nfunction decodeConfirmation(value: unknown): Decoded<PasswordChangeConfirmationDto> {\n const body = record(value);\n const confirmation = confirmationOf(body?.confirmation);\n if (body && confirmation) return ResultExtensions.ok({ confirmation, isSent: body.isSent === true });\n return protocolFailure();\n}\n\nfunction decodeCodeSent(value: unknown): Decoded<PhoneSignInSentDto> {\n const body = record(value);\n if (!body) return protocolFailure();\n const link =\n typeof body.telegramLinkUrl === 'string' && body.telegramLinkUrl.length > 0 ? body.telegramLinkUrl : null;\n return ResultExtensions.ok({ isCodeSent: body.isCodeSent === true, telegramLinkUrl: link });\n}\n\nfunction text(value: unknown): string | null {\n return typeof value === 'string' ? value : null;\n}\n\nfunction strings(value: unknown): ReadonlyArray<string> | null {\n return Array.isArray(value) && value.every((item): item is string => typeof item === 'string') ? value : null;\n}\n\n/** Decodes each item of a list, or `null` when it is no list or any item fails. */\nfunction list<T>(value: unknown, decode: (item: unknown) => T | null): ReadonlyArray<T> | null {\n if (!Array.isArray(value)) return null;\n const items = value.map(decode);\n return items.every((item): item is T => item !== null) ? items : null;\n}\n\nfunction decodeRule(value: unknown): SignInRuleDto | null {\n const body = record(value);\n const code = text(body?.code);\n const message = text(body?.message);\n return body && code && message !== null ? { code, params: record(body.params), message } : null;\n}\n\nfunction decodeField(value: unknown): SignInFieldDto | null {\n const body = record(value);\n const name = text(body?.name);\n const kind = text(body?.kind);\n const rules = list(body?.rules, decodeRule);\n return body && name && kind && rules ? { name, kind, countries: strings(body.countries), rules } : null;\n}\n\nfunction decodeMethod(value: unknown): SignInMethodDto | null {\n const body = record(value);\n const id = text(body?.id);\n const fields = list(body?.fields, decodeField);\n if (!body || !id || !fields) return null;\n const passwordRules = body.passwordRules == null ? null : list(body.passwordRules, decodeRule);\n if (body.passwordRules != null && passwordRules === null) return null;\n return { id, channels: strings(body.channels) ?? [], fields, passwordRules };\n}\n\nfunction decodeSignInOptions(value: unknown): Decoded<SignInOptionsDto> {\n const body = record(value);\n const brandName = text(body?.brandName);\n const theme = text(body?.theme);\n const methods = list(body?.methods, decodeMethod);\n if (!body || !brandName || !theme || !methods) return protocolFailure();\n const requirements = record(body.requirements);\n return ResultExtensions.ok({\n brandName,\n theme,\n backgroundUrl: text(body.backgroundUrl) || null,\n isSignUpEnabled: body.isSignUpEnabled === true,\n locale: text(body.locale) ?? 'en',\n locales: strings(body.locales) ?? [],\n methods,\n requirements: {\n isConfirmedEmailRequired: requirements?.isConfirmedEmailRequired === true,\n isConfirmedPhoneNumberRequired: requirements?.isConfirmedPhoneNumberRequired === true,\n isSecondFactorRequired: requirements?.isSecondFactorRequired === true,\n },\n });\n}\n\n/**\n * Reads a cookie sign-in's answer: `204` set the session; a body flagged `isPasswordChangeRequired`, enveloped or\n * bare, holds the change's ticket instead.\n */\nfunction decodeSignedIn(text: string): Decoded<PasswordChangeRequiredDto | null> {\n if (text.trim() === '') return ResultExtensions.ok(null);\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch {\n return protocolFailure();\n }\n const outer = record(parsed);\n const body = record(outer?.data) ?? outer;\n if (body?.isPasswordChangeRequired !== true) return body ? ResultExtensions.ok(null) : protocolFailure();\n if (typeof body.ticket !== 'string' || body.ticket === '') return protocolFailure();\n return ResultExtensions.ok({\n isPasswordChangeRequired: true,\n confirmation: confirmationOf(body.confirmation) ?? PasswordChangeConfirmationType.None,\n ticket: body.ticket,\n });\n}\n\n/** Creates a client for the account API at `baseUrl` (same origin by default). */\nexport function createAccountClient(options: AccountClientOptions = {}): AccountClient {\n const baseUrl = options.baseUrl?.replace(/\\/+$/, '') ?? '';\n const credentials = options.credentials ?? (baseUrl ? 'include' : undefined);\n const client = createApiClient({\n baseUrl: `${baseUrl}${AccountRouteConstants.base}`,\n ...(credentials !== undefined ? { credentials } : {}),\n ...(options.fetch !== undefined ? { fetch: options.fetch } : {}),\n });\n const signInQuery = (clientId?: string | null) => ({\n [AccountRouteConstants.useCookiesParameter]: true,\n ...(clientId ? { [AccountRouteConstants.clientIdParameter]: clientId } : {}),\n });\n const send = (path: string, body: unknown, signal?: AbortSignal) =>\n client.post(path, { body, response: 'empty', signal });\n\n return {\n getSignInOptions: ({ clientId, locale, signal } = {}) =>\n client.get(AccountRouteConstants.signInOptions, {\n query: {\n ...(clientId ? { [AccountRouteConstants.clientIdParameter]: clientId } : {}),\n ...(locale ? { [AccountRouteConstants.localeParameter]: locale } : {}),\n },\n signal,\n decode: decodeSignInOptions,\n }),\n signUp: (request, signal) =>\n client.post(AccountRouteConstants.signUp, { body: request, signal, decode: decodeSignedUp }),\n async signIn(request, { clientId, signal } = {}) {\n const answered = await client.post(AccountRouteConstants.signIn, {\n query: signInQuery(clientId),\n body: request,\n response: 'text',\n signal,\n });\n return answered.ok ? decodeSignedIn(answered.value) : answered;\n },\n confirmEmail: (request, signal) =>\n client.get(AccountRouteConstants.confirmEmail, { query: { ...request }, response: 'empty', signal }),\n resendConfirmationEmail: (request, signal) => send(AccountRouteConstants.resendConfirmationEmail, request, signal),\n forgotPassword: (request, signal) => send(AccountRouteConstants.forgotPassword, request, signal),\n resetPassword: (request, signal) => send(AccountRouteConstants.resetPassword, request, signal),\n getAccountInfo: (signal) => client.get(AccountRouteConstants.manageInfo, { signal, decode: decodeAccountInfo }),\n startPasswordChange: (request, signal) =>\n client.post(AccountRouteConstants.managePasswordConfirmation, {\n body: request ?? {},\n signal,\n decode: decodeConfirmation,\n }),\n changePassword: (request, signal) => send(AccountRouteConstants.managePassword, request, signal),\n changePasswordWithLink: (request, signal) => send(AccountRouteConstants.passwordChange, request, signal),\n sendPhoneSignInCode: (request, signal) =>\n client.post(AccountRouteConstants.phoneSignInSend, { body: request, signal, decode: decodeCodeSent }),\n signInWithPhone: (request, { clientId, signal } = {}) =>\n client.post(AccountRouteConstants.phoneSignIn, {\n query: signInQuery(clientId),\n body: request,\n response: 'empty',\n signal,\n }),\n signOut: (signal) => client.post(AccountRouteConstants.signOut, { response: 'empty', signal }),\n };\n}\n","import { createAccountClient, type AccountClient } from '../CreateAccountClient';\n\n/** Names where a kit component reaches the account API. */\nexport interface AccountClientSource {\n /** The client to call; built from `baseUrl` when omitted. */\n readonly client?: AccountClient;\n /** The service's origin; the consumer's own origin (Form 1) when omitted. */\n readonly baseUrl?: string;\n}\n\n/** Returns the component's account client, read once at setup: the given one, or one for `baseUrl`. */\nexport function useAccountClient(source: AccountClientSource): AccountClient {\n return source.client ?? createAccountClient(source.baseUrl ? { baseUrl: source.baseUrl } : {});\n}\n","import { useLocale } from '@wow-two-beta/fe/foundation/i18n';\n\n/** Resolves one kit message: its key under `IdentityKit.`, the English fallback, and the values it interpolates. */\nexport type AccountText = (key: string, fallback: string, values?: Readonly<Record<string, string | number>>) => string;\n\n/**\n * Returns the kit's message resolver: the consumer's `LocaleProvider` messages for `IdentityKit.{key}`, else the\n * English fallback. Call it in `setup()`.\n */\nexport function useAccountText(): AccountText {\n const locale = useLocale();\n return (key, fallback, values) => locale.t(`IdentityKit.${key}`, values, fallback);\n}\n","<script setup lang=\"ts\">\nimport { ApiFailureExtensions } from '@wow-two-beta/fe/foundation/http';\nimport { AppErrorType, type AppError } from '@wow-two-beta/fe/foundation/results';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { computed } from 'vue';\n\n/** Says why a request failed: the problem's own text, else the failure's display-safe message. */\ndefineOptions({ name: 'FailureAlert' });\n\nconst props = defineProps<{\n /** The failure to explain; nothing renders without one. */\n failure: AppError | null;\n}>();\n\nconst reason = computed(() =>\n props.failure && props.failure.type !== AppErrorType.Cancelled ? ApiFailureExtensions.reason(props.failure) : '',\n);\n</script>\n\n<template>\n <AlertSimple v-if=\"reason\" severity=\"danger\">{{ reason }}</AlertSimple>\n</template>\n","/** Defines where a password change stands. */\nexport const ChangePasswordStage = {\n /** Refers to the change not started: the instance has not said how it is confirmed. */\n Idle: 'idle',\n /** Refers to the change form, with the code field under the `Code` confirmation. */\n Form: 'form',\n /** Refers to the `Link` confirmation: only the emailed link opens the form. */\n LinkSent: 'link-sent',\n /** Refers to the password changed. */\n Done: 'done',\n} as const;\nexport type ChangePasswordStage = (typeof ChangePasswordStage)[keyof typeof ChangePasswordStage];\n","<script setup lang=\"ts\">\nimport type { AppError } from '@wow-two-beta/fe/foundation/results';\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { Field, PasswordInput, TextInput } from '@wow-two-beta/fe/presentation/forms';\nimport { computed, onMounted, shallowRef } from 'vue';\nimport { PasswordChangeConfirmationType, type PasswordChangeConfirmationDto } from '../../../../contracts';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\nimport { ChangePasswordStage } from './ChangePasswordStage';\n\n/**\n * Changes a password under the instance's confirmation setting. Signed in, it starts the change and asks for the\n * current password, plus the sent code under `Code`, or says a link went out under `Link`. With the ticket of a\n * sign-in that requires the change, it starts at once and skips the current password. With the token a change link\n * carried, it asks only for the new password.\n */\ndefineOptions({ name: 'ChangePasswordForm' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The one-time token a change link carried. */\n token?: string | null;\n /** The ticket a sign-in answered with when the password breaks the current rules. */\n ticket?: string | null;\n /** How the ticket's change is confirmed, as the sign-in answered; asked of the instance when omitted. */\n confirmation?: PasswordChangeConfirmationType | null;\n }>(),\n { client: undefined, baseUrl: undefined, token: null, ticket: null, confirmation: null },\n);\n\nconst emit = defineEmits<{\n /** Fires once the password is changed. */\n changed: [];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\n/** The ticketed change under `None` needs no round trip: the sign-in already said so, and nothing is sent. */\nconst isOpenAtOnce = Boolean(props.ticket) && props.confirmation === PasswordChangeConfirmationType.None;\nconst stage = shallowRef<ChangePasswordStage>(\n props.token || isOpenAtOnce ? ChangePasswordStage.Form : ChangePasswordStage.Idle,\n);\n/** How the change is confirmed, once known, and whether its code or link went out. */\nconst started = shallowRef<PasswordChangeConfirmationDto | null>(\n isOpenAtOnce ? { confirmation: PasswordChangeConfirmationType.None, isSent: false } : null,\n);\nconst isStarting = shallowRef(false);\nconst startFailure = shallowRef<AppError | null>(null);\nconst isCodeRequired = computed(() => started.value?.confirmation === PasswordChangeConfirmationType.Code);\n\nconst form = useAccountForm({\n defaultValues: { currentPassword: '', newPassword: '', code: '' },\n onSubmit: async (values, { signal }) => {\n const result = props.token\n ? await client.changePasswordWithLink({ token: props.token, newPassword: values.newPassword }, signal)\n : await client.changePassword(\n {\n ...(props.ticket ? { ticket: props.ticket } : { currentPassword: values.currentPassword }),\n newPassword: values.newPassword,\n ...(isCodeRequired.value ? { code: values.code.trim() } : {}),\n },\n signal,\n );\n if (result.ok) {\n stage.value = ChangePasswordStage.Done;\n emit('changed');\n }\n return result;\n },\n});\n\n/** Asks the instance how the change is confirmed, which sends the code or link that setting calls for. */\nasync function start() {\n isStarting.value = true;\n startFailure.value = null;\n const result = await client.startPasswordChange(props.ticket ? { ticket: props.ticket } : undefined);\n isStarting.value = false;\n if (!result.ok) {\n startFailure.value = result.failure;\n return;\n }\n started.value = result.value;\n stage.value =\n result.value.confirmation === PasswordChangeConfirmationType.Link\n ? ChangePasswordStage.LinkSent\n : ChangePasswordStage.Form;\n}\n\nonMounted(() => {\n if (props.ticket && !isOpenAtOnce) void start();\n});\n</script>\n\n<template>\n <div class=\"flex flex-col gap-4\">\n <p v-if=\"ticket && stage !== ChangePasswordStage.Done\" class=\"text-sm text-muted-foreground\">\n {{\n t(\n 'ChangePasswordForm.required',\n 'Your password no longer meets the rules here. Choose a new one, then sign in with it.',\n )\n }}\n </p>\n\n <template v-if=\"stage === ChangePasswordStage.Idle\">\n <FailureAlert :failure=\"startFailure\" />\n <Button type=\"button\" is-full-width :is-loading=\"isStarting\" @click=\"start\">\n {{ t('ChangePasswordForm.start', 'Change the password') }}\n </Button>\n </template>\n\n <template v-else-if=\"stage === ChangePasswordStage.LinkSent\">\n <AlertSimple v-if=\"started?.isSent\" severity=\"info\">\n {{ t('ChangePasswordForm.linkSent', 'We sent you a link to change the password. Open it to continue.') }}\n </AlertSimple>\n <AlertSimple v-else severity=\"warning\">\n {{ t('ChangePasswordForm.linkNotSent', 'We could not send the link. Try again in a minute.') }}\n </AlertSimple>\n <FailureAlert :failure=\"startFailure\" />\n <Button type=\"button\" variant=\"outline\" tone=\"neutral\" :is-loading=\"isStarting\" @click=\"start\">\n {{ t('ChangePasswordForm.resendLink', 'Send the link again') }}\n </Button>\n </template>\n\n <form\n v-else-if=\"stage === ChangePasswordStage.Form\"\n class=\"flex flex-col gap-4\"\n novalidate\n @submit=\"form.handleSubmit\"\n >\n <template v-if=\"isCodeRequired\">\n <AlertSimple v-if=\"started?.isSent\" severity=\"info\">\n {{ t('ChangePasswordForm.codeSent', 'We sent you a code. Enter it beside the new password.') }}\n </AlertSimple>\n <AlertSimple v-else severity=\"warning\">\n {{ t('ChangePasswordForm.codeNotSent', 'We could not send a code. Try again in a minute.') }}\n </AlertSimple>\n </template>\n <form.Field v-if=\"!token && !ticket\" v-slot=\"field\" name=\"currentPassword\" is-required>\n <Field :label=\"t('ChangePasswordForm.currentPassword', 'Current password')\">\n <PasswordInput\n v-model=\"field.value\"\n name=\"currentPassword\"\n autocomplete=\"current-password\"\n @blur=\"field.onBlur\"\n />\n </Field>\n </form.Field>\n <form.Field v-slot=\"field\" name=\"newPassword\" is-required>\n <Field :label=\"t('ChangePasswordForm.newPassword', 'New password')\">\n <PasswordInput v-model=\"field.value\" name=\"newPassword\" autocomplete=\"new-password\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <form.Field v-if=\"isCodeRequired\" v-slot=\"field\" name=\"code\" is-required>\n <Field :label=\"t('ChangePasswordForm.code', 'Code')\">\n <TextInput\n v-model=\"field.value\"\n name=\"code\"\n inputmode=\"numeric\"\n autocomplete=\"one-time-code\"\n @blur=\"field.onBlur\"\n />\n </Field>\n </form.Field>\n <FailureAlert :failure=\"form.state.submitError\" />\n <FailureAlert :failure=\"startFailure\" />\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('ChangePasswordForm.submit', 'Change the password') }}\n </Button>\n <Button\n v-if=\"isCodeRequired\"\n type=\"button\"\n variant=\"ghost\"\n tone=\"neutral\"\n :is-loading=\"isStarting\"\n @click=\"start\"\n >\n {{ t('ChangePasswordForm.resendCode', 'Send a new code') }}\n </Button>\n </form>\n\n <AlertSimple v-else severity=\"success\">\n {{ t('ChangePasswordForm.done', 'Your password is changed.') }}\n </AlertSimple>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { EmailInput, Field } from '@wow-two-beta/fe/presentation/forms';\nimport { shallowRef } from 'vue';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\n\n/** Sends a password reset link to an email; it says the same whether or not an account uses it. */\ndefineOptions({ name: 'ForgotPasswordForm' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The email the field starts with. */\n initialEmail?: string;\n }>(),\n { client: undefined, baseUrl: undefined, initialEmail: '' },\n);\n\nconst emit = defineEmits<{\n /** Fires once the reset email is requested. */\n sent: [email: string];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\nconst sentTo = shallowRef<string | null>(null);\n\nconst form = useAccountForm({\n defaultValues: { email: props.initialEmail },\n onSubmit: async (values, { signal }) => {\n const result = await client.forgotPassword(values, signal);\n if (result.ok) {\n sentTo.value = values.email;\n emit('sent', values.email);\n }\n return result;\n },\n});\n</script>\n\n<template>\n <AlertSimple v-if=\"sentTo\" severity=\"success\">\n {{\n t('ForgotPasswordForm.sent', 'If an account uses {email}, we sent it a link to reset the password.', {\n email: sentTo,\n })\n }}\n </AlertSimple>\n <form v-else class=\"flex flex-col gap-4\" novalidate @submit=\"form.handleSubmit\">\n <form.Field v-slot=\"field\" name=\"email\" is-required>\n <Field :label=\"t('ForgotPasswordForm.email', 'Email')\">\n <EmailInput v-model=\"field.value\" name=\"email\" autocomplete=\"email\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <FailureAlert :failure=\"form.state.submitError\" />\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('ForgotPasswordForm.submit', 'Send the reset link') }}\n </Button>\n </form>\n</template>\n","<script setup lang=\"ts\">\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { Field, PasswordInput, TextInput } from '@wow-two-beta/fe/presentation/forms';\nimport { shallowRef } from 'vue';\nimport type { PasswordChangeRequiredDto } from '../../../../contracts';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\n\n/** Signs a person in with an identifier and password, by cookie session — on the hosted page or embedded in a product. */\ndefineOptions({ name: 'PasswordSignIn' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The OIDC client the sign-in serves, recorded by the sign-in log. */\n clientId?: string | null;\n /** Where \"Forgot your password?\" leads; no link when omitted. */\n forgotPasswordHref?: string;\n /** The identifier the field starts with. */\n initialIdentifier?: string;\n }>(),\n { client: undefined, baseUrl: undefined, clientId: null, forgotPasswordHref: undefined, initialIdentifier: '' },\n);\n\nconst emit = defineEmits<{\n /** Fires once the session cookie is set. */\n signedIn: [];\n /** Fires when the password matched but breaks the current rules: no session, only the change's ticket. */\n passwordChangeRequired: [required: PasswordChangeRequiredDto];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\n/** The email of an account that must confirm it before signing in, when the identifier was one. */\nconst unconfirmedEmail = shallowRef<string | null>(null);\nconst isResent = shallowRef(false);\nconst isResending = shallowRef(false);\n\nconst form = useAccountForm({\n defaultValues: { identifier: props.initialIdentifier, password: '' },\n onSubmit: async (values, { signal }) => {\n unconfirmedEmail.value = null;\n isResent.value = false;\n const result = await client.signIn(values, { clientId: props.clientId, signal });\n if (result.ok) {\n if (result.value) emit('passwordChangeRequired', result.value);\n else emit('signedIn');\n } else if (result.failure.status === 403 && values.identifier.includes('@')) {\n unconfirmedEmail.value = values.identifier;\n }\n return result;\n },\n});\n\nasync function resendConfirmation() {\n if (!unconfirmedEmail.value) return;\n isResending.value = true;\n const result = await client.resendConfirmationEmail({ email: unconfirmedEmail.value });\n isResending.value = false;\n isResent.value = result.ok;\n}\n</script>\n\n<template>\n <form class=\"flex flex-col gap-4\" novalidate @submit=\"form.handleSubmit\">\n <form.Field v-slot=\"field\" name=\"identifier\" is-required>\n <Field :label=\"t('PasswordSignIn.identifier', 'Email or user name')\">\n <TextInput v-model=\"field.value\" name=\"identifier\" autocomplete=\"username\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <form.Field v-slot=\"field\" name=\"password\" is-required>\n <Field :label=\"t('PasswordSignIn.password', 'Password')\">\n <PasswordInput v-model=\"field.value\" name=\"password\" autocomplete=\"current-password\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <a\n v-if=\"forgotPasswordHref\"\n :href=\"forgotPasswordHref\"\n class=\"-mt-2 self-end text-sm text-primary underline-offset-4 hover:underline\"\n >\n {{ t('PasswordSignIn.forgotPassword', 'Forgot your password?') }}\n </a>\n <FailureAlert :failure=\"form.state.submitError\" />\n <template v-if=\"unconfirmedEmail\">\n <AlertSimple v-if=\"isResent\" severity=\"success\">\n {{\n t('PasswordSignIn.confirmationResent', 'We sent the confirmation link to {email} again.', {\n email: unconfirmedEmail,\n })\n }}\n </AlertSimple>\n <Button\n v-else\n type=\"button\"\n variant=\"outline\"\n tone=\"neutral\"\n :is-loading=\"isResending\"\n @click=\"resendConfirmation\"\n >\n {{ t('PasswordSignIn.resendConfirmation', 'Send the confirmation email again') }}\n </Button>\n </template>\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('PasswordSignIn.submit', 'Sign in') }}\n </Button>\n </form>\n</template>\n","/** Defines where a phone sign-in stands. */\nexport const PhoneSignInStep = {\n /** Refers to entering the phone a code goes to. */\n Phone: 'phone',\n /** Refers to opening the Telegram bot and sharing the contact, after which the bot sends the code. */\n Telegram: 'telegram',\n /** Refers to entering the code. */\n Code: 'code',\n} as const;\nexport type PhoneSignInStep = (typeof PhoneSignInStep)[keyof typeof PhoneSignInStep];\n","<script setup lang=\"ts\">\nimport { AppErrorFactory, ResultExtensions, type AppError } from '@wow-two-beta/fe/foundation/results';\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { object, phone as phoneRule } from '@wow-two-beta/fe/foundation/validators';\nimport { Field, PhoneInput, TextInput } from '@wow-two-beta/fe/presentation/forms';\nimport { shallowRef } from 'vue';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\nimport { PhoneSignInStep } from './PhoneSignInStep';\n\n/**\n * Signs a person in by a code sent to their phone: the phone first, then the code. A phone with no linked Telegram\n * chat first opens the bot, where sharing the contact links it and brings the code.\n */\ndefineOptions({ name: 'PhoneCodeSignIn' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The OIDC client the sign-in serves, recorded by the sign-in log. */\n clientId?: string | null;\n /** The ISO codes of the countries a phone may come from, in display order; every country when omitted. */\n countries?: ReadonlyArray<string>;\n /** The ISO code selected first; the first allowed country when omitted. */\n defaultCountry?: string;\n }>(),\n { client: undefined, baseUrl: undefined, clientId: null, countries: undefined, defaultCountry: undefined },\n);\n\nconst emit = defineEmits<{\n /** Fires once the session cookie is set. */\n signedIn: [];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\nconst step = shallowRef<PhoneSignInStep>(PhoneSignInStep.Phone);\n/** The phone the current code was sent to. */\nconst phone = shallowRef('');\nconst telegramLinkUrl = shallowRef<string | null>(null);\nconst isResending = shallowRef(false);\nconst isResent = shallowRef(false);\nconst resendFailure = shallowRef<AppError | null>(null);\n\nconst notSent = () =>\n ResultExtensions.fail({\n ...AppErrorFactory.unavailable(),\n message: t('PhoneCodeSignIn.notSent', 'We could not send a code. Try again in a minute.'),\n });\n\nasync function send(value: string, signal?: AbortSignal) {\n const result = await client.sendPhoneSignInCode({ phone: value }, signal);\n if (!result.ok) return result;\n if (!result.value.isCodeSent && !result.value.telegramLinkUrl) return notSent();\n phone.value = value;\n telegramLinkUrl.value = result.value.telegramLinkUrl;\n return result;\n}\n\nconst phoneForm = useAccountForm({\n defaultValues: { phone: '' },\n schema: object({ phone: phoneRule({ countries: props.countries }) }),\n onSubmit: async (values, { signal }) => {\n const result = await send(values.phone, signal);\n if (result.ok) {\n codeForm.reset();\n isResent.value = false;\n resendFailure.value = null;\n step.value = telegramLinkUrl.value ? PhoneSignInStep.Telegram : PhoneSignInStep.Code;\n }\n return result;\n },\n});\n\nconst codeForm = useAccountForm({\n defaultValues: { code: '' },\n onSubmit: async (values, { signal }) => {\n const result = await client.signInWithPhone(\n { phone: phone.value, code: values.code.trim() },\n { clientId: props.clientId, signal },\n );\n if (result.ok) emit('signedIn');\n return result;\n },\n});\n\nasync function resend() {\n isResending.value = true;\n isResent.value = false;\n resendFailure.value = null;\n const result = await send(phone.value);\n isResending.value = false;\n if (result.ok) isResent.value = true;\n else resendFailure.value = result.failure;\n}\n\nfunction useAnotherPhone() {\n step.value = PhoneSignInStep.Phone;\n telegramLinkUrl.value = null;\n}\n</script>\n\n<template>\n <form v-if=\"step === PhoneSignInStep.Phone\" class=\"flex flex-col gap-4\" novalidate @submit=\"phoneForm.handleSubmit\">\n <phoneForm.Field v-slot=\"field\" name=\"phone\" is-required>\n <Field :label=\"t('PhoneCodeSignIn.phone', 'Phone number')\">\n <PhoneInput\n v-model=\"field.value\"\n name=\"phone\"\n class=\"w-full [&>span]:shrink-0 [&>span]:whitespace-nowrap\"\n :countries=\"countries\"\n :default-country=\"defaultCountry\"\n @blur=\"field.onBlur\"\n />\n </Field>\n </phoneForm.Field>\n <FailureAlert :failure=\"phoneForm.state.submitError\" />\n <Button type=\"submit\" is-full-width :is-loading=\"phoneForm.state.isSubmitting\">\n {{ t('PhoneCodeSignIn.send', 'Send a code') }}\n </Button>\n </form>\n\n <div v-else-if=\"step === PhoneSignInStep.Telegram\" class=\"flex flex-col gap-4\">\n <p class=\"text-sm text-muted-foreground\">\n {{\n t(\n 'PhoneCodeSignIn.telegramIntro',\n 'Open our Telegram bot, press Start and share your contact. The bot then sends your code for {phone}.',\n { phone },\n )\n }}\n </p>\n <Button as-child is-full-width>\n <a\n :href=\"telegramLinkUrl ?? undefined\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n @click=\"step = PhoneSignInStep.Code\"\n >\n {{ t('PhoneCodeSignIn.openTelegram', 'Open Telegram') }}\n </a>\n </Button>\n <Button type=\"button\" variant=\"outline\" tone=\"neutral\" is-full-width @click=\"step = PhoneSignInStep.Code\">\n {{ t('PhoneCodeSignIn.haveCode', 'I have the code') }}\n </Button>\n <Button type=\"button\" variant=\"ghost\" tone=\"neutral\" @click=\"useAnotherPhone\">\n {{ t('PhoneCodeSignIn.otherPhone', 'Use another number') }}\n </Button>\n </div>\n\n <form v-else class=\"flex flex-col gap-4\" novalidate @submit=\"codeForm.handleSubmit\">\n <p class=\"text-sm text-muted-foreground\">\n <template v-if=\"telegramLinkUrl\">\n {{ t('PhoneCodeSignIn.codeFromTelegram', 'Enter the code the bot sent you in Telegram.') }}\n <a\n :href=\"telegramLinkUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"text-primary underline-offset-4 hover:underline\"\n >\n {{ t('PhoneCodeSignIn.openTelegramAgain', 'Open Telegram') }}\n </a>\n </template>\n <template v-else>{{ t('PhoneCodeSignIn.codeSent', 'We sent a code to {phone}.', { phone }) }}</template>\n </p>\n <codeForm.Field v-slot=\"field\" name=\"code\" is-required>\n <Field :label=\"t('PhoneCodeSignIn.code', 'Code')\">\n <TextInput\n v-model=\"field.value\"\n name=\"code\"\n inputmode=\"numeric\"\n autocomplete=\"one-time-code\"\n @blur=\"field.onBlur\"\n />\n </Field>\n </codeForm.Field>\n <FailureAlert :failure=\"codeForm.state.submitError\" />\n <FailureAlert :failure=\"resendFailure\" />\n <AlertSimple v-if=\"isResent\" severity=\"success\">\n {{ t('PhoneCodeSignIn.resent', 'We sent a new code.') }}\n </AlertSimple>\n <Button type=\"submit\" is-full-width :is-loading=\"codeForm.state.isSubmitting\">\n {{ t('PhoneCodeSignIn.submit', 'Sign in') }}\n </Button>\n <div class=\"flex flex-wrap justify-between gap-2\">\n <Button type=\"button\" variant=\"ghost\" tone=\"neutral\" :is-loading=\"isResending\" @click=\"resend\">\n {{ t('PhoneCodeSignIn.resend', 'Send a new code') }}\n </Button>\n <Button type=\"button\" variant=\"ghost\" tone=\"neutral\" @click=\"useAnotherPhone\">\n {{ t('PhoneCodeSignIn.otherPhone', 'Use another number') }}\n </Button>\n </div>\n </form>\n</template>\n","<script setup lang=\"ts\">\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { Field, PasswordInput } from '@wow-two-beta/fe/presentation/forms';\nimport { shallowRef } from 'vue';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\n\n/** Sets a new password with the token a reset email carried. */\ndefineOptions({ name: 'ResetPasswordForm' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The account email the reset link named. */\n email: string;\n /** The reset token the link carried. */\n token: string;\n /** Where the person signs in once the password is set; no link when omitted. */\n signInHref?: string;\n }>(),\n { client: undefined, baseUrl: undefined, signInHref: undefined },\n);\n\nconst emit = defineEmits<{\n /** Fires once the new password is set. */\n reset: [];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\nconst isReset = shallowRef(false);\n\nconst form = useAccountForm({\n defaultValues: { newPassword: '' },\n onSubmit: async (values, { signal }) => {\n const result = await client.resetPassword(\n { email: props.email, resetToken: props.token, newPassword: values.newPassword },\n signal,\n );\n if (result.ok) {\n isReset.value = true;\n emit('reset');\n }\n return result;\n },\n});\n</script>\n\n<template>\n <div v-if=\"isReset\" class=\"flex flex-col gap-4\">\n <AlertSimple severity=\"success\">{{ t('ResetPasswordForm.done', 'Your password is changed.') }}</AlertSimple>\n <Button v-if=\"signInHref\" as-child is-full-width>\n <a :href=\"signInHref\">{{ t('ResetPasswordForm.signIn', 'Sign in') }}</a>\n </Button>\n </div>\n <form v-else class=\"flex flex-col gap-4\" novalidate @submit=\"form.handleSubmit\">\n <p class=\"text-sm text-muted-foreground\">\n {{ t('ResetPasswordForm.intro', 'Choose a new password for {email}.', { email }) }}\n </p>\n <form.Field v-slot=\"field\" name=\"newPassword\" is-required>\n <Field :label=\"t('ResetPasswordForm.newPassword', 'New password')\">\n <PasswordInput v-model=\"field.value\" name=\"newPassword\" autocomplete=\"new-password\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <FailureAlert :failure=\"form.state.submitError\" />\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('ResetPasswordForm.submit', 'Set the password') }}\n </Button>\n </form>\n</template>\n","<script setup lang=\"ts\">\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { EmailInput, Field, PasswordInput } from '@wow-two-beta/fe/presentation/forms';\nimport { shallowRef } from 'vue';\nimport type { SignedUpAccountDto } from '../../../../contracts';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\n\n/** Creates an account with an email and password while the instance keeps sign-up on, then says what comes next. */\ndefineOptions({ name: 'SignUpForm' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** Where the person signs in once the account exists; no link when omitted. */\n signInHref?: string;\n }>(),\n { client: undefined, baseUrl: undefined, signInHref: undefined },\n);\n\nconst emit = defineEmits<{\n /** Fires with the account a sign-up created. */\n signedUp: [account: SignedUpAccountDto];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\nconst created = shallowRef<{ account: SignedUpAccountDto; email: string } | null>(null);\n\nconst form = useAccountForm({\n defaultValues: { email: '', password: '' },\n onSubmit: async (values, { signal }) => {\n const result = await client.signUp(values, signal);\n if (result.ok) {\n created.value = { account: result.value, email: values.email };\n emit('signedUp', result.value);\n }\n return result;\n },\n});\n</script>\n\n<template>\n <div v-if=\"created\" class=\"flex flex-col gap-4\">\n <AlertSimple severity=\"success\">\n <template v-if=\"created.account.isConfirmationSent\">\n {{\n t('SignUpForm.confirmationSent', 'Check your inbox: we sent a link to {email} to confirm the address.', {\n email: created.email,\n })\n }}\n </template>\n <template v-else>{{ t('SignUpForm.created', 'Your account is ready.') }}</template>\n </AlertSimple>\n <Button v-if=\"signInHref\" as-child is-full-width>\n <a :href=\"signInHref\">{{ t('SignUpForm.signIn', 'Sign in') }}</a>\n </Button>\n </div>\n <form v-else class=\"flex flex-col gap-4\" novalidate @submit=\"form.handleSubmit\">\n <form.Field v-slot=\"field\" name=\"email\" is-required>\n <Field :label=\"t('SignUpForm.email', 'Email')\">\n <EmailInput v-model=\"field.value\" name=\"email\" autocomplete=\"email\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <form.Field v-slot=\"field\" name=\"password\" is-required>\n <Field :label=\"t('SignUpForm.password', 'Password')\">\n <PasswordInput v-model=\"field.value\" name=\"password\" autocomplete=\"new-password\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <FailureAlert :failure=\"form.state.submitError\" />\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('SignUpForm.submit', 'Create the account') }}\n </Button>\n </form>\n</template>\n"],"names":["text","_createBlock","_unref","useAccountForm","_openBlock","_createElementBlock","_hoisted_1","_hoisted_2","_toDisplayString","_Fragment","_createVNode","FailureAlert","_withCtx","phone","phoneRule","_createElementVNode","_hoisted_3","_createTextVNode"],"mappings":";;;;;;;;;;AAgHA,MAAM,kBAAkB,MAAM,iBAAiB,KAAK,kBAAkB,OAAO,UAAU,CAAC;AAExF,SAAS,OAAO,OAA0D;AACxE,SAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IACrE,QACD;AACN;AAEA,SAAS,eAAe,OAA6C;AACnE,QAAM,OAAO,OAAO,KAAK;AACzB,MAAI,QAAQ,OAAO,KAAK,WAAW,UAAU;AAC3C,WAAO,iBAAiB,GAAG,EAAE,QAAQ,KAAK,QAAQ,oBAAoB,KAAK,uBAAuB,MAAM;AAAA,EAC1G;AACA,SAAO,gBAAA;AACT;AAEA,SAAS,kBAAkB,OAAyC;AAClE,QAAM,OAAO,OAAO,KAAK;AACzB,MAAI,QAAQ,OAAO,KAAK,WAAW,UAAU;AAC3C,WAAO,iBAAiB,GAAG;AAAA,MACzB,QAAQ,KAAK;AAAA,MACb,UAAU,OAAO,KAAK,aAAa,WAAW,KAAK,WAAW;AAAA,MAC9D,OAAO,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ;AAAA,MACrD,kBAAkB,KAAK,qBAAqB;AAAA,MAC5C,oBAAoB,KAAK,uBAAuB;AAAA,IAAA,CACjD;AAAA,EACH;AACA,SAAO,gBAAA;AACT;AAEA,MAAM,oBAAoB,OAAO,OAAO,8BAA8B;AAGtE,SAAS,eAAe,OAA4D;AAClF,SAAO,OAAO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BAAA,oBAAA,CAAA,GAAA,CAAA;AAAA,UAAA;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/kit/account/CreateAccountClient.ts","../../src/kit/account/hooks/UseAccountClient.ts","../../src/kit/account/hooks/UseAccountText.ts","../../src/kit/account/validation/FieldRules.ts","../../src/kit/account/validation/PasswordRules.ts","../../src/kit/presentation/feedback/failureAlert/FailureAlert.vue","../../src/kit/presentation/forms/changePasswordForm/ChangePasswordStage.ts","../../src/kit/presentation/forms/changePasswordForm/ChangePasswordForm.vue","../../src/kit/presentation/forms/forgotPasswordForm/ForgotPasswordForm.vue","../../src/kit/presentation/forms/passwordSignIn/PasswordSignIn.vue","../../src/kit/presentation/forms/phoneCodeSignIn/PhoneSignInStep.ts","../../src/kit/presentation/forms/phoneCodeSignIn/PhoneCodeSignIn.vue","../../src/kit/presentation/forms/resetPasswordForm/ResetPasswordForm.vue","../../src/kit/presentation/forms/signUpForm/SignUpSchema.ts","../../src/kit/presentation/forms/signUpForm/SignUpForm.vue"],"sourcesContent":["import { ApiFailureFactory, createApiClient, type ApiFailure } from '@wow-two-beta/fe/foundation/http';\nimport { ResultExtensions, type Result } from '@wow-two-beta/fe/foundation/results';\nimport {\n AccountRouteConstants,\n PasswordChangeConfirmationType,\n type AccountInfoDto,\n type ConfirmEmailApiRequest,\n type EmailAddressApiRequest,\n type PasswordChangeApiRequest,\n type PasswordChangeConfirmationApiRequest,\n type PasswordChangeConfirmationDto,\n type PasswordChangeLinkApiRequest,\n type PasswordChangeRequiredDto,\n type PhoneSignInApiRequest,\n type PhoneSignInSendApiRequest,\n type PhoneSignInSentDto,\n type ResetPasswordApiRequest,\n type SignInApiRequest,\n type SignInFieldDto,\n type SignInMethodDto,\n type SignInOptionsDto,\n type SignInRuleDto,\n type SignUpApiRequest,\n type SignedUpAccountDto,\n} from '../../contracts';\n\n/** Configures where the account API is reached. */\nexport interface AccountClientOptions {\n /** The origin serving the API: empty for the consumer's own backend (Form 1), the service's URL otherwise. */\n readonly baseUrl?: string;\n /**\n * Whether the browser sends the session cookie. Default `same-origin`, or `include` when `baseUrl` is set, which\n * the service's CORS policy must allow.\n */\n readonly credentials?: RequestCredentials;\n /** Replaces the global fetch, for tests. */\n readonly fetch?: typeof globalThis.fetch;\n}\n\n/** Describes a sign-in call beyond its body. */\nexport interface AccountSignInOptions {\n /** The OIDC client the sign-in serves, recorded by the sign-in log. */\n readonly clientId?: string | null;\n /** Cancels the request. */\n readonly signal?: AbortSignal;\n}\n\n/** Describes a sign-in declaration request. */\nexport interface SignInOptionsQuery {\n /** The OIDC client the sign-in serves, recorded by the sign-in log; the look stays the instance's. */\n readonly clientId?: string | null;\n /** The locale of the rule messages (`uz`, `ru`, `en`); the browser's `Accept-Language` when omitted. */\n readonly locale?: string | null;\n /** Cancels the request. */\n readonly signal?: AbortSignal;\n}\n\n/** Calls the account API over HTTP, signing in with cookie sessions. */\nexport interface AccountClient {\n /**\n * Reads the sign-in declaration: the hosted pages' look, whether sign-up is open, and each enabled method in layout\n * order with its fields and rules. The look is the instance's, whatever `clientId` names.\n */\n getSignInOptions(query?: SignInOptionsQuery): Promise<Result<SignInOptionsDto, ApiFailure>>;\n /** Signs an account up while sign-up is on; `403` while it is closed. */\n signUp(request: SignUpApiRequest, signal?: AbortSignal): Promise<Result<SignedUpAccountDto, ApiFailure>>;\n /**\n * Signs in with an identifier and password: `null` once the session cookie is set, or the ticket of a required\n * password change, which sets no session.\n */\n signIn(\n request: SignInApiRequest,\n options?: AccountSignInOptions,\n ): Promise<Result<PasswordChangeRequiredDto | null, ApiFailure>>;\n /** Confirms an email with the emailed token. */\n confirmEmail(request: ConfirmEmailApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Sends the confirmation email again; succeeds whether or not the account exists. */\n resendConfirmationEmail(request: EmailAddressApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Sends a password reset email; succeeds whether or not the account exists. */\n forgotPassword(request: EmailAddressApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Sets a new password with the emailed reset token. */\n resetPassword(request: ResetPasswordApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Reads the signed-in account; `401` when nobody is signed in. */\n getAccountInfo(signal?: AbortSignal): Promise<Result<AccountInfoDto, ApiFailure>>;\n /**\n * Starts a password change, signed in or with a required change's ticket: answers how it is confirmed, and sends the\n * code or link the setting asks for.\n */\n startPasswordChange(\n request?: PasswordChangeConfirmationApiRequest,\n signal?: AbortSignal,\n ): Promise<Result<PasswordChangeConfirmationDto, ApiFailure>>;\n /** Changes the password of the signed-in person, or of the one a required change's ticket names. */\n changePassword(request: PasswordChangeApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n /** Changes a password with the one-time token a change link carries. */\n changePasswordWithLink(\n request: PasswordChangeLinkApiRequest,\n signal?: AbortSignal,\n ): Promise<Result<void, ApiFailure>>;\n /** Sends a phone sign-in code, or answers the Telegram link that sends one once the contact is shared. */\n sendPhoneSignInCode(\n request: PhoneSignInSendApiRequest,\n signal?: AbortSignal,\n ): Promise<Result<PhoneSignInSentDto, ApiFailure>>;\n /** Signs in with a phone and its code and sets the session cookie. */\n signInWithPhone(request: PhoneSignInApiRequest, options?: AccountSignInOptions): Promise<Result<void, ApiFailure>>;\n /** Ends the cookie's session. */\n signOut(signal?: AbortSignal): Promise<Result<void, ApiFailure>>;\n}\n\ntype Decoded<T> = Result<T, ApiFailure>;\n\nconst protocolFailure = () => ResultExtensions.fail(ApiFailureFactory.create('protocol'));\n\nfunction record(value: unknown): Readonly<Record<string, unknown>> | null {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction decodeSignedUp(value: unknown): Decoded<SignedUpAccountDto> {\n const body = record(value);\n if (body && typeof body.userId === 'string') {\n return ResultExtensions.ok({ userId: body.userId, isConfirmationSent: body.isConfirmationSent === true });\n }\n return protocolFailure();\n}\n\nfunction decodeAccountInfo(value: unknown): Decoded<AccountInfoDto> {\n const body = record(value);\n if (body && typeof body.userId === 'string') {\n return ResultExtensions.ok({\n userId: body.userId,\n userName: typeof body.userName === 'string' ? body.userName : null,\n email: typeof body.email === 'string' ? body.email : null,\n isEmailConfirmed: body.isEmailConfirmed === true,\n isTwoFactorEnabled: body.isTwoFactorEnabled === true,\n });\n }\n return protocolFailure();\n}\n\nconst confirmationTypes = Object.values(PasswordChangeConfirmationType);\n\n/** Reads a confirmation type whatever its case; `undefined` for anything else. */\nfunction confirmationOf(value: unknown): PasswordChangeConfirmationType | undefined {\n return typeof value === 'string'\n ? confirmationTypes.find((type) => type.toLowerCase() === value.toLowerCase())\n : undefined;\n}\n\nfunction decodeConfirmation(value: unknown): Decoded<PasswordChangeConfirmationDto> {\n const body = record(value);\n const confirmation = confirmationOf(body?.confirmation);\n if (body && confirmation) return ResultExtensions.ok({ confirmation, isSent: body.isSent === true });\n return protocolFailure();\n}\n\nfunction decodeCodeSent(value: unknown): Decoded<PhoneSignInSentDto> {\n const body = record(value);\n if (!body) return protocolFailure();\n const link =\n typeof body.telegramLinkUrl === 'string' && body.telegramLinkUrl.length > 0 ? body.telegramLinkUrl : null;\n return ResultExtensions.ok({ isCodeSent: body.isCodeSent === true, telegramLinkUrl: link });\n}\n\nfunction text(value: unknown): string | null {\n return typeof value === 'string' ? value : null;\n}\n\nfunction strings(value: unknown): ReadonlyArray<string> | null {\n return Array.isArray(value) && value.every((item): item is string => typeof item === 'string') ? value : null;\n}\n\n/** Decodes each item of a list, or `null` when it is no list or any item fails. */\nfunction list<T>(value: unknown, decode: (item: unknown) => T | null): ReadonlyArray<T> | null {\n if (!Array.isArray(value)) return null;\n const items = value.map(decode);\n return items.every((item): item is T => item !== null) ? items : null;\n}\n\nfunction decodeRule(value: unknown): SignInRuleDto | null {\n const body = record(value);\n const code = text(body?.code);\n const message = text(body?.message);\n return body && code && message !== null ? { code, params: record(body.params), message } : null;\n}\n\nfunction decodeField(value: unknown): SignInFieldDto | null {\n const body = record(value);\n const name = text(body?.name);\n const kind = text(body?.kind);\n const rules = list(body?.rules, decodeRule);\n return body && name && kind && rules ? { name, kind, countries: strings(body.countries), rules } : null;\n}\n\nfunction decodeMethod(value: unknown): SignInMethodDto | null {\n const body = record(value);\n const id = text(body?.id);\n const fields = list(body?.fields, decodeField);\n if (!body || !id || !fields) return null;\n const passwordRules = body.passwordRules == null ? null : list(body.passwordRules, decodeRule);\n if (body.passwordRules != null && passwordRules === null) return null;\n return { id, channels: strings(body.channels) ?? [], fields, passwordRules };\n}\n\nfunction decodeSignInOptions(value: unknown): Decoded<SignInOptionsDto> {\n const body = record(value);\n const brandName = text(body?.brandName);\n const theme = text(body?.theme);\n const methods = list(body?.methods, decodeMethod);\n if (!body || !brandName || !theme || !methods) return protocolFailure();\n const requirements = record(body.requirements);\n return ResultExtensions.ok({\n brandName,\n theme,\n backgroundUrl: text(body.backgroundUrl) || null,\n isSignUpEnabled: body.isSignUpEnabled === true,\n locale: text(body.locale) ?? 'en',\n locales: strings(body.locales) ?? [],\n methods,\n requirements: {\n isConfirmedEmailRequired: requirements?.isConfirmedEmailRequired === true,\n isConfirmedPhoneNumberRequired: requirements?.isConfirmedPhoneNumberRequired === true,\n isSecondFactorRequired: requirements?.isSecondFactorRequired === true,\n },\n });\n}\n\n/**\n * Reads a cookie sign-in's answer: `204` set the session; a body flagged `isPasswordChangeRequired`, enveloped or\n * bare, holds the change's ticket instead.\n */\nfunction decodeSignedIn(text: string): Decoded<PasswordChangeRequiredDto | null> {\n if (text.trim() === '') return ResultExtensions.ok(null);\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch {\n return protocolFailure();\n }\n const outer = record(parsed);\n const body = record(outer?.data) ?? outer;\n if (body?.isPasswordChangeRequired !== true) return body ? ResultExtensions.ok(null) : protocolFailure();\n if (typeof body.ticket !== 'string' || body.ticket === '') return protocolFailure();\n return ResultExtensions.ok({\n isPasswordChangeRequired: true,\n confirmation: confirmationOf(body.confirmation) ?? PasswordChangeConfirmationType.None,\n ticket: body.ticket,\n });\n}\n\n/** Creates a client for the account API at `baseUrl` (same origin by default). */\nexport function createAccountClient(options: AccountClientOptions = {}): AccountClient {\n const baseUrl = options.baseUrl?.replace(/\\/+$/, '') ?? '';\n const credentials = options.credentials ?? (baseUrl ? 'include' : undefined);\n const client = createApiClient({\n baseUrl: `${baseUrl}${AccountRouteConstants.base}`,\n ...(credentials !== undefined ? { credentials } : {}),\n ...(options.fetch !== undefined ? { fetch: options.fetch } : {}),\n });\n const signInQuery = (clientId?: string | null) => ({\n [AccountRouteConstants.useCookiesParameter]: true,\n ...(clientId ? { [AccountRouteConstants.clientIdParameter]: clientId } : {}),\n });\n const send = (path: string, body: unknown, signal?: AbortSignal) =>\n client.post(path, { body, response: 'empty', signal });\n\n return {\n getSignInOptions: ({ clientId, locale, signal } = {}) =>\n client.get(AccountRouteConstants.signInOptions, {\n query: {\n ...(clientId ? { [AccountRouteConstants.clientIdParameter]: clientId } : {}),\n ...(locale ? { [AccountRouteConstants.localeParameter]: locale } : {}),\n },\n signal,\n decode: decodeSignInOptions,\n }),\n signUp: (request, signal) =>\n client.post(AccountRouteConstants.signUp, { body: request, signal, decode: decodeSignedUp }),\n async signIn(request, { clientId, signal } = {}) {\n const answered = await client.post(AccountRouteConstants.signIn, {\n query: signInQuery(clientId),\n body: request,\n response: 'text',\n signal,\n });\n return answered.ok ? decodeSignedIn(answered.value) : answered;\n },\n confirmEmail: (request, signal) =>\n client.get(AccountRouteConstants.confirmEmail, { query: { ...request }, response: 'empty', signal }),\n resendConfirmationEmail: (request, signal) => send(AccountRouteConstants.resendConfirmationEmail, request, signal),\n forgotPassword: (request, signal) => send(AccountRouteConstants.forgotPassword, request, signal),\n resetPassword: (request, signal) => send(AccountRouteConstants.resetPassword, request, signal),\n getAccountInfo: (signal) => client.get(AccountRouteConstants.manageInfo, { signal, decode: decodeAccountInfo }),\n startPasswordChange: (request, signal) =>\n client.post(AccountRouteConstants.managePasswordConfirmation, {\n body: request ?? {},\n signal,\n decode: decodeConfirmation,\n }),\n changePassword: (request, signal) => send(AccountRouteConstants.managePassword, request, signal),\n changePasswordWithLink: (request, signal) => send(AccountRouteConstants.passwordChange, request, signal),\n sendPhoneSignInCode: (request, signal) =>\n client.post(AccountRouteConstants.phoneSignInSend, { body: request, signal, decode: decodeCodeSent }),\n signInWithPhone: (request, { clientId, signal } = {}) =>\n client.post(AccountRouteConstants.phoneSignIn, {\n query: signInQuery(clientId),\n body: request,\n response: 'empty',\n signal,\n }),\n signOut: (signal) => client.post(AccountRouteConstants.signOut, { response: 'empty', signal }),\n };\n}\n","import { createAccountClient, type AccountClient } from '../CreateAccountClient';\n\n/** Names where a kit component reaches the account API. */\nexport interface AccountClientSource {\n /** The client to call; built from `baseUrl` when omitted. */\n readonly client?: AccountClient;\n /** The service's origin; the consumer's own origin (Form 1) when omitted. */\n readonly baseUrl?: string;\n}\n\n/** Returns the component's account client, read once at setup: the given one, or one for `baseUrl`. */\nexport function useAccountClient(source: AccountClientSource): AccountClient {\n return source.client ?? createAccountClient(source.baseUrl ? { baseUrl: source.baseUrl } : {});\n}\n","import { useLocale } from '@wow-two-beta/fe/foundation/i18n';\n\n/** Resolves one kit message: its key under `IdentityKit.`, the English fallback, and the values it interpolates. */\nexport type AccountText = (key: string, fallback: string, values?: Readonly<Record<string, string | number>>) => string;\n\n/**\n * Returns the kit's message resolver: the consumer's `LocaleProvider` messages for `IdentityKit.{key}`, else the\n * English fallback. Call it in `setup()`.\n */\nexport function useAccountText(): AccountText {\n const locale = useLocale();\n return (key, fallback, values) => locale.t(`IdentityKit.${key}`, values, fallback);\n}\n","import { email, invalid, string, StringValidator } from '@wow-two-beta/fe/foundation/validators';\nimport { SignInRuleCodeConstants } from '../../../contracts';\n\n/**\n * Wraps `inner` so the empty string fails as `required`, with the fe sdk's own message unless `message` replaces it; any\n * other value goes to `inner`. A form checks presence first, so the format or size rules never complain about nothing.\n */\nexport function requiredText(inner: StringValidator = string(), message?: string): StringValidator {\n return new StringValidator(inner.typeName, (value, path) =>\n value === ''\n ? invalid([{ path, message: message ?? 'is required', code: SignInRuleCodeConstants.required }])\n : inner.parseAt(value, path),\n );\n}\n\n/** Accepts an email-shaped value: required, then the fe sdk's pragmatic format check. */\nexport function emailRule(): StringValidator {\n return requiredText(email());\n}\n","import {\n invalid,\n string,\n StringValidator,\n type ValidationIssue,\n type ValidationMessageCatalogue,\n} from '@wow-two-beta/fe/foundation/validators';\nimport { SignInRuleCodeConstants, type SignInRuleDto } from '../../../contracts';\nimport { requiredText } from './FieldRules';\n\ntype RuleParams = Readonly<Record<string, unknown>> | null;\n\n/** Holds the account values a `notEqual` rule compares a password with, under the field names the declaration uses. */\nexport type PasswordAccount = Readonly<Partial<Record<'userName' | 'email', string | null>>>;\n\n/** Renders every rule the declaration carries from its own message, which is in the request's locale. */\nexport const passwordRuleMessages: ValidationMessageCatalogue = Object.freeze({\n required: (context) => context.message,\n min: (context) => context.message,\n max: (context) => context.message,\n length: (context) => context.message,\n notEqual: (context) => context.message,\n});\n\nconst operand = (params: RuleParams, name: string): number | null => {\n const value = params?.[name];\n return typeof value === 'number' && Number.isFinite(value) ? value : null;\n};\n\n/** Reads whether a size rule counts characters, as the server does; an operand-less unit counts them too. */\nconst isCounted = (params: RuleParams): boolean =>\n params?.unit === undefined || params.unit === SignInRuleCodeConstants.charactersUnit;\n\n/** Leaves the fe sdk's own message in place for a rule whose message came empty. */\nconst declaredMessage = (rule: SignInRuleDto): string | undefined => (rule.message === '' ? undefined : rule.message);\n\nfunction accountValue(account: PasswordAccount, field: string): string | null {\n if (!Object.hasOwn(account, field)) return null;\n const value = (account as Readonly<Record<string, string | null | undefined>>)[field];\n return value ? value : null;\n}\n\n/** Maps a `notEqual` rule onto the account values at hand; `null` when it names none of them. */\nfunction toAccountCheck(rule: SignInRuleDto, account: PasswordAccount): StringValidator | null {\n const fields = rule.params?.fields;\n if (!Array.isArray(fields)) return null;\n const names = fields.filter((field): field is string => typeof field === 'string');\n const values = names.flatMap((name) => {\n const value = accountValue(account, name);\n return value === null ? [] : [value];\n });\n if (values.length === 0) return null;\n const fold = rule.params?.isCaseIgnored === true ? (text: string) => text.toLowerCase() : (text: string) => text;\n return string().refine(\n (password) => values.every((value) => fold(value) !== fold(password)),\n declaredMessage(rule) ?? 'must differ from the user name and email',\n SignInRuleCodeConstants.notEqual,\n { fields: names },\n );\n}\n\n/** Maps one declared rule onto an fe sdk validator; `null` for a code or operands it does not know. */\nfunction toCheck(rule: SignInRuleDto, account: PasswordAccount): StringValidator | null {\n const { code, params } = rule;\n const message = declaredMessage(rule);\n switch (code) {\n case SignInRuleCodeConstants.min: {\n const limit = operand(params, 'min');\n return limit !== null && isCounted(params) ? string().min(limit, message) : null;\n }\n case SignInRuleCodeConstants.max: {\n const limit = operand(params, 'max');\n return limit !== null && isCounted(params) ? string().max(limit, message) : null;\n }\n case SignInRuleCodeConstants.length: {\n const exact = operand(params, 'length');\n return exact !== null && isCounted(params) ? string().length(exact, message) : null;\n }\n case SignInRuleCodeConstants.pattern: {\n const source = params?.pattern;\n if (typeof source !== 'string') return null;\n try {\n return string().pattern(new RegExp(source, 'u'), message);\n } catch {\n return null;\n }\n }\n case SignInRuleCodeConstants.custom: {\n const limit = operand(params, 'min');\n if (params?.rule !== SignInRuleCodeConstants.distinctCharactersRule || limit === null) return null;\n // Counted by UTF-16 code unit, as the server counts, so the browser never refuses what the server accepts.\n return string().refine(\n (password) => new Set(password.split('')).size >= limit,\n message ?? `must use at least ${limit} different characters`,\n SignInRuleCodeConstants.custom,\n { rule: SignInRuleCodeConstants.distinctCharactersRule, min: limit },\n );\n }\n case SignInRuleCodeConstants.notEqual:\n return toAccountCheck(rule, account);\n default:\n return null;\n }\n}\n\n/**\n * Maps the rules a declaration lists for a new password onto fe sdk validators: `min`, `max`, `length`, `pattern`,\n * `custom` (`distinctCharacters`) and `notEqual`, plus `required` for the message of the presence check. A code or\n * operand it does not know is skipped, since the server still checks everything. An empty value fails as `required`\n * alone, anything else reports every rule it breaks. Each failure carries the declaration's message, the fe sdk's own\n * when that is empty; pass {@link passwordRuleMessages} to the form so the catalogue does not replace it.\n *\n * @param rules The declaration's `passwordRules`; with none, only presence is checked.\n * @param account The account values a `notEqual` rule compares with; a rule naming none of them is skipped.\n */\nexport function passwordRule(\n rules: ReadonlyArray<SignInRuleDto> | null | undefined,\n account: PasswordAccount = {},\n): StringValidator {\n const declared = rules ?? [];\n const checks = declared.flatMap((rule) => {\n const check = toCheck(rule, account);\n return check ? [check] : [];\n });\n const required = declared.find((rule) => rule.code === SignInRuleCodeConstants.required);\n const text = string();\n const all = new StringValidator('password', (value, path) => {\n const parsed = text.parseAt(value, path);\n if (!parsed.ok) return parsed;\n const issues: ValidationIssue[] = [];\n for (const check of checks) {\n const result = check.parseAt(parsed.value, path);\n if (!result.ok) issues.push(...result.failure.issues);\n }\n return issues.length === 0 ? parsed : invalid(issues);\n });\n return requiredText(all, required ? declaredMessage(required) : undefined);\n}\n","<script setup lang=\"ts\">\nimport { ApiFailureExtensions } from '@wow-two-beta/fe/foundation/http';\nimport { AppErrorType, type AppError } from '@wow-two-beta/fe/foundation/results';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { computed } from 'vue';\n\n/** Says why a request failed: the problem's own text, else the failure's display-safe message. */\ndefineOptions({ name: 'FailureAlert' });\n\nconst props = defineProps<{\n /** The failure to explain; nothing renders without one. */\n failure: AppError | null;\n}>();\n\nconst reason = computed(() =>\n props.failure && props.failure.type !== AppErrorType.Cancelled ? ApiFailureExtensions.reason(props.failure) : '',\n);\n</script>\n\n<template>\n <AlertSimple v-if=\"reason\" severity=\"danger\">{{ reason }}</AlertSimple>\n</template>\n","/** Defines where a password change stands. */\nexport const ChangePasswordStage = {\n /** Refers to the change not started: the instance has not said how it is confirmed. */\n Idle: 'idle',\n /** Refers to the change form, with the code field under the `Code` confirmation. */\n Form: 'form',\n /** Refers to the `Link` confirmation: only the emailed link opens the form. */\n LinkSent: 'link-sent',\n /** Refers to the password changed. */\n Done: 'done',\n} as const;\nexport type ChangePasswordStage = (typeof ChangePasswordStage)[keyof typeof ChangePasswordStage];\n","<script setup lang=\"ts\">\nimport type { AppError } from '@wow-two-beta/fe/foundation/results';\nimport { object, string } from '@wow-two-beta/fe/foundation/validators';\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { Field, PasswordInput, TextInput } from '@wow-two-beta/fe/presentation/forms';\nimport { computed, onMounted, shallowRef } from 'vue';\nimport {\n PasswordChangeConfirmationType,\n type PasswordChangeConfirmationDto,\n type SignInRuleDto,\n} from '../../../../contracts';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { passwordRule, passwordRuleMessages, requiredText } from '../../../account/validation';\nimport { FailureAlert } from '../../feedback/failureAlert';\nimport { ChangePasswordStage } from './ChangePasswordStage';\n\n/**\n * Changes a password under the instance's confirmation setting. Signed in, it starts the change and asks for the\n * current password, plus the sent code under `Code`, or says a link went out under `Link`. With the ticket of a\n * sign-in that requires the change, it starts at once and skips the current password. With the token a change link\n * carried, it asks only for the new password. A new password that breaks `passwordRules` shows under its field.\n */\ndefineOptions({ name: 'ChangePasswordForm' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The one-time token a change link carried. */\n token?: string | null;\n /** The ticket a sign-in answered with when the password breaks the current rules. */\n ticket?: string | null;\n /** How the ticket's change is confirmed, as the sign-in answered; asked of the instance when omitted. */\n confirmation?: PasswordChangeConfirmationType | null;\n /** The rules a new password meets, the declaration's `passwordRules`; with none, the password is only required. */\n passwordRules?: ReadonlyArray<SignInRuleDto>;\n }>(),\n { client: undefined, baseUrl: undefined, token: null, ticket: null, confirmation: null, passwordRules: undefined },\n);\n\nconst emit = defineEmits<{\n /** Fires once the password is changed. */\n changed: [];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\n/** The ticketed change under `None` needs no round trip: the sign-in already said so, and nothing is sent. */\nconst isOpenAtOnce = Boolean(props.ticket) && props.confirmation === PasswordChangeConfirmationType.None;\nconst stage = shallowRef<ChangePasswordStage>(\n props.token || isOpenAtOnce ? ChangePasswordStage.Form : ChangePasswordStage.Idle,\n);\n/** How the change is confirmed, once known, and whether its code or link went out. */\nconst started = shallowRef<PasswordChangeConfirmationDto | null>(\n isOpenAtOnce ? { confirmation: PasswordChangeConfirmationType.None, isSent: false } : null,\n);\nconst isStarting = shallowRef(false);\nconst startFailure = shallowRef<AppError | null>(null);\nconst isCodeRequired = computed(() => started.value?.confirmation === PasswordChangeConfirmationType.Code);\n\n/** Checks the fields the form shows: the current password and the code are required only while their inputs are. */\nconst schema = computed(() =>\n object({\n currentPassword: props.token || props.ticket ? string() : requiredText(),\n newPassword: passwordRule(props.passwordRules),\n code: isCodeRequired.value ? requiredText() : string(),\n }),\n);\n\nconst form = useAccountForm(() => ({\n defaultValues: { currentPassword: '', newPassword: '', code: '' },\n schema: schema.value,\n validateOn: 'blur' as const,\n messages: passwordRuleMessages,\n onSubmit: async (values, { signal }) => {\n const result = props.token\n ? await client.changePasswordWithLink({ token: props.token, newPassword: values.newPassword }, signal)\n : await client.changePassword(\n {\n ...(props.ticket ? { ticket: props.ticket } : { currentPassword: values.currentPassword }),\n newPassword: values.newPassword,\n ...(isCodeRequired.value ? { code: values.code.trim() } : {}),\n },\n signal,\n );\n if (result.ok) {\n stage.value = ChangePasswordStage.Done;\n emit('changed');\n }\n return result;\n },\n}));\n\n/** Asks the instance how the change is confirmed, which sends the code or link that setting calls for. */\nasync function start() {\n isStarting.value = true;\n startFailure.value = null;\n const result = await client.startPasswordChange(props.ticket ? { ticket: props.ticket } : undefined);\n isStarting.value = false;\n if (!result.ok) {\n startFailure.value = result.failure;\n return;\n }\n started.value = result.value;\n stage.value =\n result.value.confirmation === PasswordChangeConfirmationType.Link\n ? ChangePasswordStage.LinkSent\n : ChangePasswordStage.Form;\n}\n\nonMounted(() => {\n if (props.ticket && !isOpenAtOnce) void start();\n});\n</script>\n\n<template>\n <div class=\"flex flex-col gap-4\">\n <p v-if=\"ticket && stage !== ChangePasswordStage.Done\" class=\"text-sm text-muted-foreground\">\n {{\n t(\n 'ChangePasswordForm.required',\n 'Your password no longer meets the rules here. Choose a new one, then sign in with it.',\n )\n }}\n </p>\n\n <template v-if=\"stage === ChangePasswordStage.Idle\">\n <FailureAlert :failure=\"startFailure\" />\n <Button type=\"button\" is-full-width :is-loading=\"isStarting\" @click=\"start\">\n {{ t('ChangePasswordForm.start', 'Change the password') }}\n </Button>\n </template>\n\n <template v-else-if=\"stage === ChangePasswordStage.LinkSent\">\n <AlertSimple v-if=\"started?.isSent\" severity=\"info\">\n {{ t('ChangePasswordForm.linkSent', 'We sent you a link to change the password. Open it to continue.') }}\n </AlertSimple>\n <AlertSimple v-else severity=\"warning\">\n {{ t('ChangePasswordForm.linkNotSent', 'We could not send the link. Try again in a minute.') }}\n </AlertSimple>\n <FailureAlert :failure=\"startFailure\" />\n <Button type=\"button\" variant=\"outline\" tone=\"neutral\" :is-loading=\"isStarting\" @click=\"start\">\n {{ t('ChangePasswordForm.resendLink', 'Send the link again') }}\n </Button>\n </template>\n\n <form\n v-else-if=\"stage === ChangePasswordStage.Form\"\n class=\"flex flex-col gap-4\"\n novalidate\n @submit=\"form.handleSubmit\"\n >\n <template v-if=\"isCodeRequired\">\n <AlertSimple v-if=\"started?.isSent\" severity=\"info\">\n {{ t('ChangePasswordForm.codeSent', 'We sent you a code. Enter it beside the new password.') }}\n </AlertSimple>\n <AlertSimple v-else severity=\"warning\">\n {{ t('ChangePasswordForm.codeNotSent', 'We could not send a code. Try again in a minute.') }}\n </AlertSimple>\n </template>\n <form.Field v-if=\"!token && !ticket\" v-slot=\"field\" name=\"currentPassword\" is-required>\n <Field :label=\"t('ChangePasswordForm.currentPassword', 'Current password')\">\n <PasswordInput\n v-model=\"field.value\"\n name=\"currentPassword\"\n autocomplete=\"current-password\"\n @blur=\"field.onBlur\"\n />\n </Field>\n </form.Field>\n <form.Field v-slot=\"field\" name=\"newPassword\" is-required>\n <Field :label=\"t('ChangePasswordForm.newPassword', 'New password')\">\n <PasswordInput v-model=\"field.value\" name=\"newPassword\" autocomplete=\"new-password\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <form.Field v-if=\"isCodeRequired\" v-slot=\"field\" name=\"code\" is-required>\n <Field :label=\"t('ChangePasswordForm.code', 'Code')\">\n <TextInput\n v-model=\"field.value\"\n name=\"code\"\n inputmode=\"numeric\"\n autocomplete=\"one-time-code\"\n @blur=\"field.onBlur\"\n />\n </Field>\n </form.Field>\n <FailureAlert :failure=\"form.state.submitError\" />\n <FailureAlert :failure=\"startFailure\" />\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('ChangePasswordForm.submit', 'Change the password') }}\n </Button>\n <Button\n v-if=\"isCodeRequired\"\n type=\"button\"\n variant=\"ghost\"\n tone=\"neutral\"\n :is-loading=\"isStarting\"\n @click=\"start\"\n >\n {{ t('ChangePasswordForm.resendCode', 'Send a new code') }}\n </Button>\n </form>\n\n <AlertSimple v-else severity=\"success\">\n {{ t('ChangePasswordForm.done', 'Your password is changed.') }}\n </AlertSimple>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { EmailInput, Field } from '@wow-two-beta/fe/presentation/forms';\nimport { shallowRef } from 'vue';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\n\n/** Sends a password reset link to an email; it says the same whether or not an account uses it. */\ndefineOptions({ name: 'ForgotPasswordForm' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The email the field starts with. */\n initialEmail?: string;\n }>(),\n { client: undefined, baseUrl: undefined, initialEmail: '' },\n);\n\nconst emit = defineEmits<{\n /** Fires once the reset email is requested. */\n sent: [email: string];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\nconst sentTo = shallowRef<string | null>(null);\n\nconst form = useAccountForm({\n defaultValues: { email: props.initialEmail },\n onSubmit: async (values, { signal }) => {\n const result = await client.forgotPassword(values, signal);\n if (result.ok) {\n sentTo.value = values.email;\n emit('sent', values.email);\n }\n return result;\n },\n});\n</script>\n\n<template>\n <AlertSimple v-if=\"sentTo\" severity=\"success\">\n {{\n t('ForgotPasswordForm.sent', 'If an account uses {email}, we sent it a link to reset the password.', {\n email: sentTo,\n })\n }}\n </AlertSimple>\n <form v-else class=\"flex flex-col gap-4\" novalidate @submit=\"form.handleSubmit\">\n <form.Field v-slot=\"field\" name=\"email\" is-required>\n <Field :label=\"t('ForgotPasswordForm.email', 'Email')\">\n <EmailInput v-model=\"field.value\" name=\"email\" autocomplete=\"email\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <FailureAlert :failure=\"form.state.submitError\" />\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('ForgotPasswordForm.submit', 'Send the reset link') }}\n </Button>\n </form>\n</template>\n","<script setup lang=\"ts\">\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { Field, PasswordInput, TextInput } from '@wow-two-beta/fe/presentation/forms';\nimport { shallowRef } from 'vue';\nimport type { PasswordChangeRequiredDto } from '../../../../contracts';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\n\n/** Signs a person in with an identifier and password, by cookie session — on the hosted page or embedded in a product. */\ndefineOptions({ name: 'PasswordSignIn' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The OIDC client the sign-in serves, recorded by the sign-in log. */\n clientId?: string | null;\n /** Where \"Forgot your password?\" leads; no link when omitted. */\n forgotPasswordHref?: string;\n /** The identifier the field starts with. */\n initialIdentifier?: string;\n }>(),\n { client: undefined, baseUrl: undefined, clientId: null, forgotPasswordHref: undefined, initialIdentifier: '' },\n);\n\nconst emit = defineEmits<{\n /** Fires once the session cookie is set. */\n signedIn: [];\n /** Fires when the password matched but breaks the current rules: no session, only the change's ticket. */\n passwordChangeRequired: [required: PasswordChangeRequiredDto];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\n/** The email of an account that must confirm it before signing in, when the identifier was one. */\nconst unconfirmedEmail = shallowRef<string | null>(null);\nconst isResent = shallowRef(false);\nconst isResending = shallowRef(false);\n\nconst form = useAccountForm({\n defaultValues: { identifier: props.initialIdentifier, password: '' },\n onSubmit: async (values, { signal }) => {\n unconfirmedEmail.value = null;\n isResent.value = false;\n const result = await client.signIn(values, { clientId: props.clientId, signal });\n if (result.ok) {\n if (result.value) emit('passwordChangeRequired', result.value);\n else emit('signedIn');\n } else if (result.failure.status === 403 && values.identifier.includes('@')) {\n unconfirmedEmail.value = values.identifier;\n }\n return result;\n },\n});\n\nasync function resendConfirmation() {\n if (!unconfirmedEmail.value) return;\n isResending.value = true;\n const result = await client.resendConfirmationEmail({ email: unconfirmedEmail.value });\n isResending.value = false;\n isResent.value = result.ok;\n}\n</script>\n\n<template>\n <form class=\"flex flex-col gap-4\" novalidate @submit=\"form.handleSubmit\">\n <form.Field v-slot=\"field\" name=\"identifier\" is-required>\n <Field :label=\"t('PasswordSignIn.identifier', 'Email or user name')\">\n <TextInput v-model=\"field.value\" name=\"identifier\" autocomplete=\"username\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <form.Field v-slot=\"field\" name=\"password\" is-required>\n <Field :label=\"t('PasswordSignIn.password', 'Password')\">\n <PasswordInput v-model=\"field.value\" name=\"password\" autocomplete=\"current-password\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <a\n v-if=\"forgotPasswordHref\"\n :href=\"forgotPasswordHref\"\n class=\"-mt-2 self-end text-sm text-primary underline-offset-4 hover:underline\"\n >\n {{ t('PasswordSignIn.forgotPassword', 'Forgot your password?') }}\n </a>\n <FailureAlert :failure=\"form.state.submitError\" />\n <template v-if=\"unconfirmedEmail\">\n <AlertSimple v-if=\"isResent\" severity=\"success\">\n {{\n t('PasswordSignIn.confirmationResent', 'We sent the confirmation link to {email} again.', {\n email: unconfirmedEmail,\n })\n }}\n </AlertSimple>\n <Button\n v-else\n type=\"button\"\n variant=\"outline\"\n tone=\"neutral\"\n :is-loading=\"isResending\"\n @click=\"resendConfirmation\"\n >\n {{ t('PasswordSignIn.resendConfirmation', 'Send the confirmation email again') }}\n </Button>\n </template>\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('PasswordSignIn.submit', 'Sign in') }}\n </Button>\n </form>\n</template>\n","/** Defines where a phone sign-in stands. */\nexport const PhoneSignInStep = {\n /** Refers to entering the phone a code goes to. */\n Phone: 'phone',\n /** Refers to opening the Telegram bot and sharing the contact, after which the bot sends the code. */\n Telegram: 'telegram',\n /** Refers to entering the code. */\n Code: 'code',\n} as const;\nexport type PhoneSignInStep = (typeof PhoneSignInStep)[keyof typeof PhoneSignInStep];\n","<script setup lang=\"ts\">\nimport { AppErrorFactory, ResultExtensions, type AppError } from '@wow-two-beta/fe/foundation/results';\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { object, phone as phoneRule } from '@wow-two-beta/fe/foundation/validators';\nimport { Field, PhoneInput, TextInput } from '@wow-two-beta/fe/presentation/forms';\nimport { shallowRef } from 'vue';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { FailureAlert } from '../../feedback/failureAlert';\nimport { PhoneSignInStep } from './PhoneSignInStep';\n\n/**\n * Signs a person in by a code sent to their phone: the phone first, then the code. A phone with no linked Telegram\n * chat first opens the bot, where sharing the contact links it and brings the code.\n */\ndefineOptions({ name: 'PhoneCodeSignIn' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The OIDC client the sign-in serves, recorded by the sign-in log. */\n clientId?: string | null;\n /** The ISO codes of the countries a phone may come from, in display order; every country when omitted. */\n countries?: ReadonlyArray<string>;\n /** The ISO code selected first; the first allowed country when omitted. */\n defaultCountry?: string;\n }>(),\n { client: undefined, baseUrl: undefined, clientId: null, countries: undefined, defaultCountry: undefined },\n);\n\nconst emit = defineEmits<{\n /** Fires once the session cookie is set. */\n signedIn: [];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\nconst step = shallowRef<PhoneSignInStep>(PhoneSignInStep.Phone);\n/** The phone the current code was sent to. */\nconst phone = shallowRef('');\nconst telegramLinkUrl = shallowRef<string | null>(null);\nconst isResending = shallowRef(false);\nconst isResent = shallowRef(false);\nconst resendFailure = shallowRef<AppError | null>(null);\n\nconst notSent = () =>\n ResultExtensions.fail({\n ...AppErrorFactory.unavailable(),\n message: t('PhoneCodeSignIn.notSent', 'We could not send a code. Try again in a minute.'),\n });\n\nasync function send(value: string, signal?: AbortSignal) {\n const result = await client.sendPhoneSignInCode({ phone: value }, signal);\n if (!result.ok) return result;\n if (!result.value.isCodeSent && !result.value.telegramLinkUrl) return notSent();\n phone.value = value;\n telegramLinkUrl.value = result.value.telegramLinkUrl;\n return result;\n}\n\nconst phoneForm = useAccountForm({\n defaultValues: { phone: '' },\n schema: object({ phone: phoneRule({ countries: props.countries }) }),\n onSubmit: async (values, { signal }) => {\n const result = await send(values.phone, signal);\n if (result.ok) {\n codeForm.reset();\n isResent.value = false;\n resendFailure.value = null;\n step.value = telegramLinkUrl.value ? PhoneSignInStep.Telegram : PhoneSignInStep.Code;\n }\n return result;\n },\n});\n\nconst codeForm = useAccountForm({\n defaultValues: { code: '' },\n onSubmit: async (values, { signal }) => {\n const result = await client.signInWithPhone(\n { phone: phone.value, code: values.code.trim() },\n { clientId: props.clientId, signal },\n );\n if (result.ok) emit('signedIn');\n return result;\n },\n});\n\nasync function resend() {\n isResending.value = true;\n isResent.value = false;\n resendFailure.value = null;\n const result = await send(phone.value);\n isResending.value = false;\n if (result.ok) isResent.value = true;\n else resendFailure.value = result.failure;\n}\n\nfunction useAnotherPhone() {\n step.value = PhoneSignInStep.Phone;\n telegramLinkUrl.value = null;\n}\n</script>\n\n<template>\n <form v-if=\"step === PhoneSignInStep.Phone\" class=\"flex flex-col gap-4\" novalidate @submit=\"phoneForm.handleSubmit\">\n <phoneForm.Field v-slot=\"field\" name=\"phone\" is-required>\n <Field :label=\"t('PhoneCodeSignIn.phone', 'Phone number')\">\n <PhoneInput\n v-model=\"field.value\"\n name=\"phone\"\n class=\"w-full [&>span]:shrink-0 [&>span]:whitespace-nowrap\"\n :countries=\"countries\"\n :default-country=\"defaultCountry\"\n @blur=\"field.onBlur\"\n />\n </Field>\n </phoneForm.Field>\n <FailureAlert :failure=\"phoneForm.state.submitError\" />\n <Button type=\"submit\" is-full-width :is-loading=\"phoneForm.state.isSubmitting\">\n {{ t('PhoneCodeSignIn.send', 'Send a code') }}\n </Button>\n </form>\n\n <div v-else-if=\"step === PhoneSignInStep.Telegram\" class=\"flex flex-col gap-4\">\n <p class=\"text-sm text-muted-foreground\">\n {{\n t(\n 'PhoneCodeSignIn.telegramIntro',\n 'Open our Telegram bot, press Start and share your contact. The bot then sends your code for {phone}.',\n { phone },\n )\n }}\n </p>\n <Button as-child is-full-width>\n <a\n :href=\"telegramLinkUrl ?? undefined\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n @click=\"step = PhoneSignInStep.Code\"\n >\n {{ t('PhoneCodeSignIn.openTelegram', 'Open Telegram') }}\n </a>\n </Button>\n <Button type=\"button\" variant=\"outline\" tone=\"neutral\" is-full-width @click=\"step = PhoneSignInStep.Code\">\n {{ t('PhoneCodeSignIn.haveCode', 'I have the code') }}\n </Button>\n <Button type=\"button\" variant=\"ghost\" tone=\"neutral\" @click=\"useAnotherPhone\">\n {{ t('PhoneCodeSignIn.otherPhone', 'Use another number') }}\n </Button>\n </div>\n\n <form v-else class=\"flex flex-col gap-4\" novalidate @submit=\"codeForm.handleSubmit\">\n <p class=\"text-sm text-muted-foreground\">\n <template v-if=\"telegramLinkUrl\">\n {{ t('PhoneCodeSignIn.codeFromTelegram', 'Enter the code the bot sent you in Telegram.') }}\n <a\n :href=\"telegramLinkUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"text-primary underline-offset-4 hover:underline\"\n >\n {{ t('PhoneCodeSignIn.openTelegramAgain', 'Open Telegram') }}\n </a>\n </template>\n <template v-else>{{ t('PhoneCodeSignIn.codeSent', 'We sent a code to {phone}.', { phone }) }}</template>\n </p>\n <codeForm.Field v-slot=\"field\" name=\"code\" is-required>\n <Field :label=\"t('PhoneCodeSignIn.code', 'Code')\">\n <TextInput\n v-model=\"field.value\"\n name=\"code\"\n inputmode=\"numeric\"\n autocomplete=\"one-time-code\"\n @blur=\"field.onBlur\"\n />\n </Field>\n </codeForm.Field>\n <FailureAlert :failure=\"codeForm.state.submitError\" />\n <FailureAlert :failure=\"resendFailure\" />\n <AlertSimple v-if=\"isResent\" severity=\"success\">\n {{ t('PhoneCodeSignIn.resent', 'We sent a new code.') }}\n </AlertSimple>\n <Button type=\"submit\" is-full-width :is-loading=\"codeForm.state.isSubmitting\">\n {{ t('PhoneCodeSignIn.submit', 'Sign in') }}\n </Button>\n <div class=\"flex flex-wrap justify-between gap-2\">\n <Button type=\"button\" variant=\"ghost\" tone=\"neutral\" :is-loading=\"isResending\" @click=\"resend\">\n {{ t('PhoneCodeSignIn.resend', 'Send a new code') }}\n </Button>\n <Button type=\"button\" variant=\"ghost\" tone=\"neutral\" @click=\"useAnotherPhone\">\n {{ t('PhoneCodeSignIn.otherPhone', 'Use another number') }}\n </Button>\n </div>\n </form>\n</template>\n","<script setup lang=\"ts\">\nimport { object } from '@wow-two-beta/fe/foundation/validators';\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { Field, PasswordInput } from '@wow-two-beta/fe/presentation/forms';\nimport { computed, shallowRef } from 'vue';\nimport type { SignInRuleDto } from '../../../../contracts';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { passwordRule, passwordRuleMessages } from '../../../account/validation';\nimport { FailureAlert } from '../../feedback/failureAlert';\n\n/** Sets a new password with the token a reset email carried; one that breaks `passwordRules` shows under its field. */\ndefineOptions({ name: 'ResetPasswordForm' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** The account email the reset link named. */\n email: string;\n /** The reset token the link carried. */\n token: string;\n /** Where the person signs in once the password is set; no link when omitted. */\n signInHref?: string;\n /** The rules a new password meets, the declaration's `passwordRules`; with none, the password is only required. */\n passwordRules?: ReadonlyArray<SignInRuleDto>;\n }>(),\n { client: undefined, baseUrl: undefined, signInHref: undefined, passwordRules: undefined },\n);\n\nconst emit = defineEmits<{\n /** Fires once the new password is set. */\n reset: [];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\nconst isReset = shallowRef(false);\n\n/** Follows `passwordRules`, which the page may load after the form shows. */\nconst schema = computed(() => object({ newPassword: passwordRule(props.passwordRules, { email: props.email }) }));\n\nconst form = useAccountForm(() => ({\n defaultValues: { newPassword: '' },\n schema: schema.value,\n validateOn: 'blur' as const,\n messages: passwordRuleMessages,\n onSubmit: async (values, { signal }) => {\n const result = await client.resetPassword(\n { email: props.email, resetToken: props.token, newPassword: values.newPassword },\n signal,\n );\n if (result.ok) {\n isReset.value = true;\n emit('reset');\n }\n return result;\n },\n}));\n</script>\n\n<template>\n <div v-if=\"isReset\" class=\"flex flex-col gap-4\">\n <AlertSimple severity=\"success\">{{ t('ResetPasswordForm.done', 'Your password is changed.') }}</AlertSimple>\n <Button v-if=\"signInHref\" as-child is-full-width>\n <a :href=\"signInHref\">{{ t('ResetPasswordForm.signIn', 'Sign in') }}</a>\n </Button>\n </div>\n <form v-else class=\"flex flex-col gap-4\" novalidate @submit=\"form.handleSubmit\">\n <p class=\"text-sm text-muted-foreground\">\n {{ t('ResetPasswordForm.intro', 'Choose a new password for {email}.', { email }) }}\n </p>\n <form.Field v-slot=\"field\" name=\"newPassword\" is-required>\n <Field :label=\"t('ResetPasswordForm.newPassword', 'New password')\">\n <PasswordInput v-model=\"field.value\" name=\"newPassword\" autocomplete=\"new-password\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <FailureAlert :failure=\"form.state.submitError\" />\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('ResetPasswordForm.submit', 'Set the password') }}\n </Button>\n </form>\n</template>\n","import { object, Validator } from '@wow-two-beta/fe/foundation/validators';\nimport type { SignInRuleDto } from '../../../../contracts';\nimport { emailRule, passwordRule } from '../../../account/validation';\n\n/** Holds what the sign-up form collects. */\ninterface SignUpValues {\n readonly email: string;\n readonly password: string;\n}\n\nfunction emailOf(value: unknown): string | null {\n const email = typeof value === 'object' && value !== null ? (value as { email?: unknown }).email : undefined;\n return typeof email === 'string' ? email : null;\n}\n\n/**\n * Builds the sign-up form's validator: a required, email-shaped email and a password that meets `passwordRules`. The\n * user name is the email, since the form sends none, so a `notEqual` rule compares the password with the email typed.\n */\nexport function signUpSchema(passwordRules: ReadonlyArray<SignInRuleDto> | undefined): Validator<SignUpValues> {\n return new Validator<SignUpValues>('sign-up', (value, path) => {\n const email = emailOf(value);\n return object({\n email: emailRule(),\n password: passwordRule(passwordRules, { userName: email, email }),\n }).parseAt(value, path);\n });\n}\n","<script setup lang=\"ts\">\nimport { Button } from '@wow-two-beta/fe/presentation/actions';\nimport { AlertSimple } from '@wow-two-beta/fe/presentation/feedback';\nimport { EmailInput, Field, PasswordInput } from '@wow-two-beta/fe/presentation/forms';\nimport { computed, shallowRef } from 'vue';\nimport type { SignInRuleDto, SignedUpAccountDto } from '../../../../contracts';\nimport type { AccountClient } from '../../../account';\nimport { useAccountClient, useAccountForm, useAccountText } from '../../../account/hooks';\nimport { passwordRuleMessages } from '../../../account/validation';\nimport { FailureAlert } from '../../feedback/failureAlert';\nimport { signUpSchema } from './SignUpSchema';\n\n/**\n * Creates an account with an email and password while the instance keeps sign-up on, then says what comes next. An email\n * that is not one, or a password that breaks `passwordRules`, shows under its field and sends nothing.\n */\ndefineOptions({ name: 'SignUpForm' });\n\nconst props = withDefaults(\n defineProps<{\n /** The account API to call; built from `baseUrl` when omitted. */\n client?: AccountClient;\n /** The service's origin; the consumer's own origin when omitted. */\n baseUrl?: string;\n /** Where the person signs in once the account exists; no link when omitted. */\n signInHref?: string;\n /** The rules a new password meets, the declaration's `passwordRules`; with none, the password is only required. */\n passwordRules?: ReadonlyArray<SignInRuleDto>;\n }>(),\n { client: undefined, baseUrl: undefined, signInHref: undefined, passwordRules: undefined },\n);\n\nconst emit = defineEmits<{\n /** Fires with the account a sign-up created. */\n signedUp: [account: SignedUpAccountDto];\n}>();\n\nconst client = useAccountClient(props);\nconst t = useAccountText();\nconst created = shallowRef<{ account: SignedUpAccountDto; email: string } | null>(null);\n\n/** Follows `passwordRules`, which the page may load after the form shows. */\nconst schema = computed(() => signUpSchema(props.passwordRules));\n\nconst form = useAccountForm(() => ({\n defaultValues: { email: '', password: '' },\n schema: schema.value,\n validateOn: 'blur' as const,\n messages: passwordRuleMessages,\n onSubmit: async (values, { signal }) => {\n const result = await client.signUp(values, signal);\n if (result.ok) {\n created.value = { account: result.value, email: values.email };\n emit('signedUp', result.value);\n }\n return result;\n },\n}));\n</script>\n\n<template>\n <div v-if=\"created\" class=\"flex flex-col gap-4\">\n <AlertSimple severity=\"success\">\n <template v-if=\"created.account.isConfirmationSent\">\n {{\n t('SignUpForm.confirmationSent', 'Check your inbox: we sent a link to {email} to confirm the address.', {\n email: created.email,\n })\n }}\n </template>\n <template v-else>{{ t('SignUpForm.created', 'Your account is ready.') }}</template>\n </AlertSimple>\n <Button v-if=\"signInHref\" as-child is-full-width>\n <a :href=\"signInHref\">{{ t('SignUpForm.signIn', 'Sign in') }}</a>\n </Button>\n </div>\n <form v-else class=\"flex flex-col gap-4\" novalidate @submit=\"form.handleSubmit\">\n <form.Field v-slot=\"field\" name=\"email\" is-required>\n <Field :label=\"t('SignUpForm.email', 'Email')\">\n <EmailInput v-model=\"field.value\" name=\"email\" autocomplete=\"email\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <form.Field v-slot=\"field\" name=\"password\" is-required>\n <Field :label=\"t('SignUpForm.password', 'Password')\">\n <PasswordInput v-model=\"field.value\" name=\"password\" autocomplete=\"new-password\" @blur=\"field.onBlur\" />\n </Field>\n </form.Field>\n <FailureAlert :failure=\"form.state.submitError\" />\n <Button type=\"submit\" is-full-width :is-loading=\"form.state.isSubmitting\">\n {{ t('SignUpForm.submit', 'Create the account') }}\n </Button>\n </form>\n</template>\n"],"names":["text","_createBlock","_unref","useAccountForm","_openBlock","_createElementBlock","_hoisted_1","_hoisted_2","_toDisplayString","_Fragment","_createVNode","FailureAlert","_withCtx","phone","phoneRule","_createElementVNode","_hoisted_3","_createTextVNode","email"],"mappings":";;;;;;;;;;AAgHA,MAAM,kBAAkB,MAAM,iBAAiB,KAAK,kBAAkB,OAAO,UAAU,CAAC;AAExF,SAAS,OAAO,OAA0D;AACxE,SAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IACrE,QAC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AA;AAAA,kBAAhF,YAAA,MAAM;AAAA,kBAAN,uBAAA,CAAA,WAAA,MAAM,QAAK;AAAA,kBAAE,MAAK;AAAA,kBAAW,cAAa;AAAA,kBAAgB,QAAM,MAAM;AAAA,gBAAA;;;;;;;QAGlGQ,YAAkDR,MAAAS,WAAA,GAAA;AAAA,UAAnC,SAAST,MAAA,IAAA,EAAK,MAAM;AAAA,QAAA;QACnCQ,YAESR,MAAA,MAAA,GAAA;AAAA,UAFD,MAAK;AAAA,UAAS,iBAAA;AAAA,UAAe,cAAYA,MAAA,IAAA,EAAK,MAAM;AAAA,QAAA;2BAC1D,MAAkD;AAAA,4CAA/CA,MAAA,CAAA,EAAC,qBAAA,oBAAA,CAAA,GAAA,CAAA;AAAA,UAAA;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { PasswordChangeConfirmationType } from '../../../../contracts';
1
+ import { PasswordChangeConfirmationType, type SignInRuleDto } from '../../../../contracts';
2
2
  import type { AccountClient } from '../../../account';
3
3
  type __VLS_Props = {
4
4
  /** The account API to call; built from `baseUrl` when omitted. */
@@ -11,6 +11,8 @@ type __VLS_Props = {
11
11
  ticket?: string | null;
12
12
  /** How the ticket's change is confirmed, as the sign-in answered; asked of the instance when omitted. */
13
13
  confirmation?: PasswordChangeConfirmationType | null;
14
+ /** The rules a new password meets, the declaration's `passwordRules`; with none, the password is only required. */
15
+ passwordRules?: ReadonlyArray<SignInRuleDto>;
14
16
  };
15
17
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
18
  changed: () => any;
@@ -19,6 +21,7 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
19
21
  }>, {
20
22
  token: string | null;
21
23
  confirmation: PasswordChangeConfirmationType | null;
24
+ passwordRules: ReadonlyArray<SignInRuleDto>;
22
25
  ticket: string | null;
23
26
  baseUrl: string;
24
27
  client: AccountClient;
@@ -1,3 +1,4 @@
1
+ import type { SignInRuleDto } from '../../../../contracts';
1
2
  import type { AccountClient } from '../../../account';
2
3
  type __VLS_Props = {
3
4
  /** The account API to call; built from `baseUrl` when omitted. */
@@ -10,12 +11,15 @@ type __VLS_Props = {
10
11
  token: string;
11
12
  /** Where the person signs in once the password is set; no link when omitted. */
12
13
  signInHref?: string;
14
+ /** The rules a new password meets, the declaration's `passwordRules`; with none, the password is only required. */
15
+ passwordRules?: ReadonlyArray<SignInRuleDto>;
13
16
  };
14
17
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
18
  reset: () => any;
16
19
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
20
  onReset?: (() => any) | undefined;
18
21
  }>, {
22
+ passwordRules: ReadonlyArray<SignInRuleDto>;
19
23
  baseUrl: string;
20
24
  client: AccountClient;
21
25
  signInHref: string;
@@ -1,4 +1,4 @@
1
- import type { SignedUpAccountDto } from '../../../../contracts';
1
+ import type { SignInRuleDto, SignedUpAccountDto } from '../../../../contracts';
2
2
  import type { AccountClient } from '../../../account';
3
3
  type __VLS_Props = {
4
4
  /** The account API to call; built from `baseUrl` when omitted. */
@@ -7,12 +7,15 @@ type __VLS_Props = {
7
7
  baseUrl?: string;
8
8
  /** Where the person signs in once the account exists; no link when omitted. */
9
9
  signInHref?: string;
10
+ /** The rules a new password meets, the declaration's `passwordRules`; with none, the password is only required. */
11
+ passwordRules?: ReadonlyArray<SignInRuleDto>;
10
12
  };
11
13
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
14
  signedUp: (account: SignedUpAccountDto) => any;
13
15
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
16
  onSignedUp?: ((account: SignedUpAccountDto) => any) | undefined;
15
17
  }>, {
18
+ passwordRules: ReadonlyArray<SignInRuleDto>;
16
19
  baseUrl: string;
17
20
  client: AccountClient;
18
21
  signInHref: string;
@@ -0,0 +1,13 @@
1
+ import { Validator } from '@wow-two-beta/fe/foundation/validators';
2
+ import type { SignInRuleDto } from '../../../../contracts';
3
+ /** Holds what the sign-up form collects. */
4
+ interface SignUpValues {
5
+ readonly email: string;
6
+ readonly password: string;
7
+ }
8
+ /**
9
+ * Builds the sign-up form's validator: a required, email-shaped email and a password that meets `passwordRules`. The
10
+ * user name is the email, since the form sends none, so a `notEqual` rule compares the password with the email typed.
11
+ */
12
+ export declare function signUpSchema(passwordRules: ReadonlyArray<SignInRuleDto> | undefined): Validator<SignUpValues>;
13
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wow-two-beta/fe-identity",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Identity domain UI: the account API contract, an account client and one embeddable component per sign-in and password step.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- {"version":3,"file":"PasswordChangeConfirmationType-Gtvfpkl5.js","sources":["../../src/contracts/AccountRouteConstants.ts","../../src/contracts/PasswordChangeConfirmationType.ts"],"sourcesContent":["/** Mirrors the account API's routes: relative to the service or consumer origin, under the contract's HTTP mirror. */\nexport const AccountRouteConstants = {\n /** The account API's mount point. */\n base: '/api/account',\n /** `POST`: signs an account up while sign-up is on. */\n signUp: '/sign-up',\n /** `POST`: signs in with an identifier and password. */\n signIn: '/sign-in',\n /** `GET`: confirms an email with the emailed `userId` and `token`. */\n confirmEmail: '/confirm-email',\n /** `POST`: sends the confirmation email again; always `204`. */\n resendConfirmationEmail: '/resend-confirmation-email',\n /** `POST`: sends a password reset email; always `204`. */\n forgotPassword: '/forgot-password',\n /** `POST`: sets a new password with the emailed reset token. */\n resetPassword: '/reset-password',\n /** `GET`: the signed-in account. */\n manageInfo: '/manage/info',\n /** `POST`: starts a password change, signed in or with a ticket, and answers how it is confirmed. */\n managePasswordConfirmation: '/manage/password/confirmation',\n /** `POST`: changes the password of the signed-in person or of the one a ticket names. */\n managePassword: '/manage/password',\n /** `POST`: changes a password with the one-time token a change link carries; anonymous. */\n passwordChange: '/password/change',\n /** `POST`: sends a phone sign-in code. */\n phoneSignInSend: '/phone-sign-in/send',\n /** `POST`: signs in with a phone and the code sent to it. */\n phoneSignIn: '/phone-sign-in',\n /** `POST`: ends the cookie's session. */\n signOut: '/sign-out',\n /** `GET`, anonymous: the sign-in declaration, the look and the enabled methods with their rules; `?clientId=`, `?locale=`. */\n signInOptions: '/sign-in-options',\n /** The query parameter that asks a sign-in route for a cookie instead of a bearer session. */\n useCookiesParameter: 'useCookies',\n /** The query parameter that names the OIDC client a sign-in serves, for the sign-in log; the look is the instance's. */\n clientIdParameter: 'clientId',\n /** The query parameter that picks the locale of the declaration's messages: `uz`, `ru` or `en`. */\n localeParameter: 'locale',\n} as const;\n","/** Mirrors `PasswordChangeConfirmationType` of the be contract: how a password change is confirmed. */\nexport const PasswordChangeConfirmationType = {\n /** The current password is the only proof; the change form opens at once. */\n None: 'None',\n /** A one-time code, sent to a verified channel, is entered beside the new password. */\n Code: 'Code',\n /** A one-time link, sent to a verified channel, is the only way to the change form. */\n Link: 'Link',\n} as const;\nexport type PasswordChangeConfirmationType =\n (typeof PasswordChangeConfirmationType)[keyof typeof PasswordChangeConfirmationType];\n"],"names":[],"mappings":"AACO,MAAM,wBAAwB;AAAA;AAAA,EAEnC,MAAM;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,QAAQ;AAAA;AAAA,EAER,cAAc;AAAA;AAAA,EAEd,yBAAyB;AAAA;AAAA,EAEzB,gBAAgB;AAAA;AAAA,EAEhB,eAAe;AAAA;AAAA,EAEf,YAAY;AAAA;AAAA,EAEZ,4BAA4B;AAAA;AAAA,EAE5B,gBAAgB;AAAA;AAAA,EAEhB,gBAAgB;AAAA;AAAA,EAEhB,iBAAiB;AAAA;AAAA,EAEjB,aAAa;AAAA;AAAA,EAEb,SAAS;AAAA;AAAA,EAET,eAAe;AAAA;AAAA,EAEf,qBAAqB;AAAA;AAAA,EAErB,mBAAmB;AAAA;AAAA,EAEnB,iBAAiB;AACnB;ACrCO,MAAM,iCAAiC;AAAA;AAAA,EAE5C,MAAM;AAAA;AAAA,EAEN,MAAM;AAAA;AAAA,EAEN,MAAM;AACR;"}