@wow-two-beta/fe-identity 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +43 -2
  3. package/dist/chunks/PasswordChangeConfirmationType-xUIFj0b9.js +51 -0
  4. package/dist/chunks/PasswordChangeConfirmationType-xUIFj0b9.js.map +1 -0
  5. package/dist/contracts/AccountInfoDto.d.ts +13 -0
  6. package/dist/contracts/AccountRouteConstants.d.ts +39 -0
  7. package/dist/contracts/ConfirmEmailApiRequest.d.ts +7 -0
  8. package/dist/contracts/EmailAddressApiRequest.d.ts +5 -0
  9. package/dist/contracts/HostedPageRouteConstants.d.ts +27 -0
  10. package/dist/contracts/PasswordChangeApiRequest.d.ts +11 -0
  11. package/dist/contracts/PasswordChangeConfirmationApiRequest.d.ts +5 -0
  12. package/dist/contracts/PasswordChangeConfirmationDto.d.ts +8 -0
  13. package/dist/contracts/PasswordChangeConfirmationType.d.ts +10 -0
  14. package/dist/contracts/PasswordChangeLinkApiRequest.d.ts +7 -0
  15. package/dist/contracts/PasswordChangeRequiredDto.d.ts +13 -0
  16. package/dist/contracts/PhoneSignInApiRequest.d.ts +7 -0
  17. package/dist/contracts/PhoneSignInSendApiRequest.d.ts +5 -0
  18. package/dist/contracts/PhoneSignInSentDto.d.ts +7 -0
  19. package/dist/contracts/RegisterAccountApiRequest.d.ts +9 -0
  20. package/dist/contracts/RegisteredAccountDto.d.ts +7 -0
  21. package/dist/contracts/ResetPasswordApiRequest.d.ts +9 -0
  22. package/dist/contracts/SignInApiRequest.d.ts +7 -0
  23. package/dist/contracts/SignInFieldDto.d.ts +12 -0
  24. package/dist/contracts/SignInMethodDto.d.ts +16 -0
  25. package/dist/contracts/SignInMethodIdConstants.d.ts +7 -0
  26. package/dist/contracts/SignInOptionsDto.d.ts +24 -0
  27. package/dist/contracts/SignInRequirementsDto.d.ts +9 -0
  28. package/dist/contracts/SignInRuleDto.d.ts +12 -0
  29. package/dist/contracts/index.d.ts +24 -0
  30. package/dist/contracts/index.js +40 -0
  31. package/dist/contracts/index.js.map +1 -0
  32. package/dist/kit/account/CreateAccountClient.d.ts +73 -0
  33. package/dist/kit/account/hooks/UseAccountClient.d.ts +10 -0
  34. package/dist/kit/account/hooks/UseAccountForm.d.ts +2 -0
  35. package/dist/kit/account/hooks/UseAccountText.d.ts +7 -0
  36. package/dist/kit/account/hooks/index.d.ts +3 -0
  37. package/dist/kit/account/index.d.ts +2 -0
  38. package/dist/kit/index.d.ts +2 -0
  39. package/dist/kit/index.js +1197 -0
  40. package/dist/kit/index.js.map +1 -0
  41. package/dist/kit/presentation/feedback/failureAlert/FailureAlert.vue.d.ts +7 -0
  42. package/dist/kit/presentation/feedback/failureAlert/index.d.ts +1 -0
  43. package/dist/kit/presentation/forms/changePasswordForm/ChangePasswordForm.vue.d.ts +26 -0
  44. package/dist/kit/presentation/forms/changePasswordForm/ChangePasswordStage.d.ts +12 -0
  45. package/dist/kit/presentation/forms/changePasswordForm/index.d.ts +2 -0
  46. package/dist/kit/presentation/forms/forgotPasswordForm/ForgotPasswordForm.vue.d.ts +19 -0
  47. package/dist/kit/presentation/forms/forgotPasswordForm/index.d.ts +1 -0
  48. package/dist/kit/presentation/forms/index.d.ts +6 -0
  49. package/dist/kit/presentation/forms/passwordSignIn/PasswordSignIn.vue.d.ts +28 -0
  50. package/dist/kit/presentation/forms/passwordSignIn/index.d.ts +1 -0
  51. package/dist/kit/presentation/forms/phoneCodeSignIn/PhoneCodeSignIn.vue.d.ts +25 -0
  52. package/dist/kit/presentation/forms/phoneCodeSignIn/PhoneSignInStep.d.ts +10 -0
  53. package/dist/kit/presentation/forms/phoneCodeSignIn/index.d.ts +2 -0
  54. package/dist/kit/presentation/forms/resetPasswordForm/ResetPasswordForm.vue.d.ts +23 -0
  55. package/dist/kit/presentation/forms/resetPasswordForm/index.d.ts +1 -0
  56. package/dist/kit/presentation/forms/signUpForm/SignUpForm.vue.d.ts +20 -0
  57. package/dist/kit/presentation/forms/signUpForm/index.d.ts +1 -0
  58. package/package.json +59 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sultonbek Rakhimov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # @wow-two-beta/fe-identity
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Identity domain's UI: one component per sign-in method and password step, the same ones the service's hosted
4
+ pages render. Each calls the consumer's own backend (Form 1, the default same-origin client) or the running Identity
5
+ service (Forms 2 and 3, `baseUrl`), and signs in by cookie session.
6
+
7
+ ```bash
8
+ pnpm add @wow-two-beta/fe-identity @wow-two-beta/fe vue
9
+ ```
10
+
11
+ ```vue
12
+ <script setup lang="ts">
13
+ import { PasswordSignIn, PhoneCodeSignIn } from '@wow-two-beta/fe-identity/kit';
14
+ </script>
15
+
16
+ <template>
17
+ <PasswordSignIn base-url="https://id.example.com" @signed-in="onSignedIn" />
18
+ <PhoneCodeSignIn base-url="https://id.example.com" :countries="['UZ']" @signed-in="onSignedIn" />
19
+ </template>
20
+ ```
21
+
22
+ The components are styled with Tailwind utilities on the fe sdk theme; add the package to the consumer's Tailwind
23
+ sources. Messages resolve through the fe sdk `LocaleProvider` under `IdentityKit.*`, with English fallbacks.
24
+
25
+ ```css
26
+ @source '../../node_modules/@wow-two-beta/fe-identity/dist';
27
+ ```
28
+
29
+ | Export | Holds |
30
+ |---|---|
31
+ | `./contracts` | the account API's request and answer shapes, the sign-in declaration (`SignInOptionsDto`, `SignInMethodIdConstants`), `AccountRouteConstants`, `HostedPageRouteConstants`, `PasswordChangeConfirmationType` |
32
+ | `./kit` | `createAccountClient` (with `getSignInOptions`); `PasswordSignIn`, `PhoneCodeSignIn`, `SignUpForm`, `ForgotPasswordForm`, `ResetPasswordForm`, `ChangePasswordForm` |
33
+
34
+ - `getSignInOptions({ clientId, locale })` reads `GET /api/account/sign-in-options`: the hosted pages' look, whether
35
+ sign-up is open, and each enabled method in layout order with its fields and fe sdk rules, the messages in the
36
+ request's locale; an unknown `clientId` answers the instance's own look.
37
+ - a cross-origin `baseUrl` sends the session cookie (`credentials: 'include'`); the service's CORS policy must allow
38
+ the consumer's origin.
39
+ - `PhoneCodeSignIn` shows an "Open Telegram" step when the phone has no linked chat; the bot sends the code once the
40
+ person shares the contact.
41
+ - `ChangePasswordForm` follows the instance's confirmation: the form at once (`None`), the form with a sent code
42
+ (`Code`), or a sent link (`Link`) whose page passes the link's `token`. A sign-in whose password breaks the current
43
+ rules emits `passwordChangeRequired` with a `ticket` and sets no session: pass `ticket` and `confirmation` to the
44
+ form, then sign in again with the new password.
@@ -0,0 +1,51 @@
1
+ const AccountRouteConstants = {
2
+ /** The account API's mount point. */
3
+ base: "/api/account",
4
+ /** `POST`: creates an account while sign-up is on. */
5
+ register: "/register",
6
+ /** `POST`: signs in with a login and password. */
7
+ login: "/login",
8
+ /** `GET`: confirms an email with the emailed `userId` and `token`. */
9
+ confirmEmail: "/confirm-email",
10
+ /** `POST`: sends the confirmation email again; always `204`. */
11
+ resendConfirmationEmail: "/resend-confirmation-email",
12
+ /** `POST`: sends a password reset email; always `204`. */
13
+ forgotPassword: "/forgot-password",
14
+ /** `POST`: sets a new password with the emailed reset token. */
15
+ resetPassword: "/reset-password",
16
+ /** `GET`: the signed-in account. */
17
+ manageInfo: "/manage/info",
18
+ /** `POST`: starts a password change, signed in or with a ticket, and answers how it is confirmed. */
19
+ managePasswordConfirmation: "/manage/password/confirmation",
20
+ /** `POST`: changes the password of the signed-in person or of the one a ticket names. */
21
+ managePassword: "/manage/password",
22
+ /** `POST`: changes a password with the one-time token a change link carries; anonymous. */
23
+ passwordChange: "/password/change",
24
+ /** `POST`: sends a phone sign-in code. */
25
+ phoneSignInSend: "/phone-sign-in/send",
26
+ /** `POST`: signs in with a phone and the code sent to it. */
27
+ phoneSignIn: "/phone-sign-in",
28
+ /** `POST`: ends the cookie's session. */
29
+ logout: "/logout",
30
+ /** `GET`, anonymous: the sign-in declaration, the look and the enabled methods with their rules; `?clientId=`, `?locale=`. */
31
+ signInOptions: "/sign-in-options",
32
+ /** The query parameter that asks a sign-in route for a cookie instead of a bearer session. */
33
+ useCookiesParameter: "useCookies",
34
+ /** The query parameter that names the OIDC client a sign-in serves, for the sign-in log and the app's look. */
35
+ clientIdParameter: "clientId",
36
+ /** The query parameter that picks the locale of the declaration's messages: `uz`, `ru` or `en`. */
37
+ localeParameter: "locale"
38
+ };
39
+ const PasswordChangeConfirmationType = {
40
+ /** The current password is the only proof; the change form opens at once. */
41
+ None: "None",
42
+ /** A one-time code, sent to a verified channel, is entered beside the new password. */
43
+ Code: "Code",
44
+ /** A one-time link, sent to a verified channel, is the only way to the change form. */
45
+ Link: "Link"
46
+ };
47
+ export {
48
+ AccountRouteConstants as A,
49
+ PasswordChangeConfirmationType as P
50
+ };
51
+ //# sourceMappingURL=PasswordChangeConfirmationType-xUIFj0b9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasswordChangeConfirmationType-xUIFj0b9.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`: creates an account while sign-up is on. */\n register: '/register',\n /** `POST`: signs in with a login and password. */\n login: '/login',\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 logout: '/logout',\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 and the app's look. */\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,UAAU;AAAA;AAAA,EAEV,OAAO;AAAA;AAAA,EAEP,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,QAAQ;AAAA;AAAA,EAER,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;"}
@@ -0,0 +1,13 @@
1
+ /** Mirrors `AccountInfoDto` of the be contract: the signed-in account. */
2
+ export interface AccountInfoDto {
3
+ /** The user id. */
4
+ readonly userId: string;
5
+ /** The login name. */
6
+ readonly userName: string | null;
7
+ /** The email address. */
8
+ readonly email: string | null;
9
+ /** Whether the email is confirmed. */
10
+ readonly isEmailConfirmed: boolean;
11
+ /** Whether two-factor authentication is enabled. */
12
+ readonly isTwoFactorEnabled: boolean;
13
+ }
@@ -0,0 +1,39 @@
1
+ /** Mirrors the account API's routes: relative to the service or consumer origin, under the contract's HTTP mirror. */
2
+ export declare const AccountRouteConstants: {
3
+ /** The account API's mount point. */
4
+ readonly base: "/api/account";
5
+ /** `POST`: creates an account while sign-up is on. */
6
+ readonly register: "/register";
7
+ /** `POST`: signs in with a login and password. */
8
+ readonly login: "/login";
9
+ /** `GET`: confirms an email with the emailed `userId` and `token`. */
10
+ readonly confirmEmail: "/confirm-email";
11
+ /** `POST`: sends the confirmation email again; always `204`. */
12
+ readonly resendConfirmationEmail: "/resend-confirmation-email";
13
+ /** `POST`: sends a password reset email; always `204`. */
14
+ readonly forgotPassword: "/forgot-password";
15
+ /** `POST`: sets a new password with the emailed reset token. */
16
+ readonly resetPassword: "/reset-password";
17
+ /** `GET`: the signed-in account. */
18
+ readonly manageInfo: "/manage/info";
19
+ /** `POST`: starts a password change, signed in or with a ticket, and answers how it is confirmed. */
20
+ readonly managePasswordConfirmation: "/manage/password/confirmation";
21
+ /** `POST`: changes the password of the signed-in person or of the one a ticket names. */
22
+ readonly managePassword: "/manage/password";
23
+ /** `POST`: changes a password with the one-time token a change link carries; anonymous. */
24
+ readonly passwordChange: "/password/change";
25
+ /** `POST`: sends a phone sign-in code. */
26
+ readonly phoneSignInSend: "/phone-sign-in/send";
27
+ /** `POST`: signs in with a phone and the code sent to it. */
28
+ readonly phoneSignIn: "/phone-sign-in";
29
+ /** `POST`: ends the cookie's session. */
30
+ readonly logout: "/logout";
31
+ /** `GET`, anonymous: the sign-in declaration, the look and the enabled methods with their rules; `?clientId=`, `?locale=`. */
32
+ readonly signInOptions: "/sign-in-options";
33
+ /** The query parameter that asks a sign-in route for a cookie instead of a bearer session. */
34
+ readonly useCookiesParameter: "useCookies";
35
+ /** The query parameter that names the OIDC client a sign-in serves, for the sign-in log and the app's look. */
36
+ readonly clientIdParameter: "clientId";
37
+ /** The query parameter that picks the locale of the declaration's messages: `uz`, `ru` or `en`. */
38
+ readonly localeParameter: "locale";
39
+ };
@@ -0,0 +1,7 @@
1
+ /** Mirrors the `confirm-email` route's query: the account and the token its confirmation link carries. */
2
+ export interface ConfirmEmailApiRequest {
3
+ /** The account id. */
4
+ readonly userId: string;
5
+ /** The emailed confirmation token. */
6
+ readonly token: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ /** Mirrors `EmailAddressApiRequest` of the be contract: names the account an email is sent to. */
2
+ export interface EmailAddressApiRequest {
3
+ /** The account email. */
4
+ readonly email: string;
5
+ }
@@ -0,0 +1,27 @@
1
+ /** Holds the hosted pages the service serves and the parameters each one reads. */
2
+ export declare const HostedPageRouteConstants: {
3
+ /** Signs a person in by every enabled method, then continues to `returnUrl`. */
4
+ readonly signIn: "/sign-in";
5
+ /** Creates an account while sign-up is on. */
6
+ readonly signUp: "/sign-up";
7
+ /** Confirms an email from the emailed link (`userId`, `token`). */
8
+ readonly confirmEmail: "/confirm-email";
9
+ /** Sends a password reset email. */
10
+ readonly forgotPassword: "/forgot-password";
11
+ /** Sets a new password from the emailed reset link (`email`, `token`). */
12
+ readonly resetPassword: "/reset-password";
13
+ /** Spends a password change link; the token travels in the URL fragment (`#token=`). */
14
+ readonly changePassword: "/change-password";
15
+ /** The signed-in person's security settings: the password change. */
16
+ readonly accountSecurity: "/account/security";
17
+ /** The query parameter that carries the local path a page continues to. */
18
+ readonly returnUrlParameter: "returnUrl";
19
+ /** The query parameter of an OIDC authorization request that names its client. */
20
+ readonly clientIdParameter: "client_id";
21
+ /** The query parameter that carries an account id. */
22
+ readonly userIdParameter: "userId";
23
+ /** The query parameter that carries an email address. */
24
+ readonly emailParameter: "email";
25
+ /** The query or fragment parameter that carries a one-time token. */
26
+ readonly tokenParameter: "token";
27
+ };
@@ -0,0 +1,11 @@
1
+ /** Mirrors `PasswordChangeApiRequest` of the be contract: changes the password of a signed-in or ticketed person. */
2
+ export interface PasswordChangeApiRequest {
3
+ /** The current password; not asked of a person holding the ticket, whose sign-in just verified it. */
4
+ readonly currentPassword?: string;
5
+ /** The replacement password. */
6
+ readonly newPassword: string;
7
+ /** The one-time code sent under the `Code` confirmation. */
8
+ readonly code?: string;
9
+ /** The ticket a sign-in answered with when the password breaks the current rules; omitted when signed in. */
10
+ readonly ticket?: string;
11
+ }
@@ -0,0 +1,5 @@
1
+ /** Mirrors `PasswordChangeConfirmationApiRequest` of the be contract: asks for a change's code or link. */
2
+ export interface PasswordChangeConfirmationApiRequest {
3
+ /** The ticket a sign-in answered with when the password breaks the current rules; omitted when signed in. */
4
+ readonly ticket?: string;
5
+ }
@@ -0,0 +1,8 @@
1
+ import type { PasswordChangeConfirmationType } from './PasswordChangeConfirmationType';
2
+ /** Mirrors `PasswordChangeConfirmationDto` of the be contract: how a change is confirmed, and whether a code or link went out. */
3
+ export interface PasswordChangeConfirmationDto {
4
+ /** How the change is confirmed. */
5
+ readonly confirmation: PasswordChangeConfirmationType;
6
+ /** Whether a code or link was sent; always `false` under `None`. */
7
+ readonly isSent: boolean;
8
+ }
@@ -0,0 +1,10 @@
1
+ /** Mirrors `PasswordChangeConfirmationType` of the be contract: how a password change is confirmed. */
2
+ export declare const PasswordChangeConfirmationType: {
3
+ /** The current password is the only proof; the change form opens at once. */
4
+ readonly None: "None";
5
+ /** A one-time code, sent to a verified channel, is entered beside the new password. */
6
+ readonly Code: "Code";
7
+ /** A one-time link, sent to a verified channel, is the only way to the change form. */
8
+ readonly Link: "Link";
9
+ };
10
+ export type PasswordChangeConfirmationType = (typeof PasswordChangeConfirmationType)[keyof typeof PasswordChangeConfirmationType];
@@ -0,0 +1,7 @@
1
+ /** Mirrors `PasswordChangeLinkApiRequest` of the be contract: a change link's one-time token and the new password. */
2
+ export interface PasswordChangeLinkApiRequest {
3
+ /** The one-time token from the link's fragment. */
4
+ readonly token: string;
5
+ /** The replacement password. */
6
+ readonly newPassword: string;
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { PasswordChangeConfirmationType } from './PasswordChangeConfirmationType';
2
+ /**
3
+ * Mirrors `PasswordChangeRequiredDto` of the be contract: a sign-in whose password matched but breaks the current
4
+ * rules. It carries no session, only the ticket that opens the change routes.
5
+ */
6
+ export interface PasswordChangeRequiredDto {
7
+ /** Always `true`; tells this answer from a signed-in one. */
8
+ readonly isPasswordChangeRequired: true;
9
+ /** How the change is confirmed. */
10
+ readonly confirmation: PasswordChangeConfirmationType;
11
+ /** The ticket the change routes take; a change spends it. */
12
+ readonly ticket: string;
13
+ }
@@ -0,0 +1,7 @@
1
+ /** Mirrors `PhoneSignInApiRequest` of the be contract: the phone and the code sent to it. */
2
+ export interface PhoneSignInApiRequest {
3
+ /** The phone in E.164 form. */
4
+ readonly phone: string;
5
+ /** The one-time code. */
6
+ readonly code: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ /** Mirrors `PhoneSignInSendApiRequest` of the be contract: the phone a code goes to. */
2
+ export interface PhoneSignInSendApiRequest {
3
+ /** The phone in E.164 form. */
4
+ readonly phone: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ /** Mirrors `PhoneSignInSentDto` of the be contract: what a phone sign-in send answers. */
2
+ export interface PhoneSignInSentDto {
3
+ /** Whether a code went out. */
4
+ readonly isCodeSent: boolean;
5
+ /** The bot's start link when the phone has no linked chat yet: the code follows once the person shares the contact. */
6
+ readonly telegramLinkUrl: string | null;
7
+ }
@@ -0,0 +1,9 @@
1
+ /** Mirrors `RegisterAccountApiRequest` of the be contract: registers an account with an email and password. */
2
+ export interface RegisterAccountApiRequest {
3
+ /** The account email. */
4
+ readonly email: string;
5
+ /** The initial password. */
6
+ readonly password: string;
7
+ /** The login name; the email when omitted. */
8
+ readonly userName?: string;
9
+ }
@@ -0,0 +1,7 @@
1
+ /** Mirrors `RegisteredAccountDto` of the be contract: the account a registration created. */
2
+ export interface RegisteredAccountDto {
3
+ /** The new user id. */
4
+ readonly userId: string;
5
+ /** Whether a confirmation email was sent. */
6
+ readonly isConfirmationSent: boolean;
7
+ }
@@ -0,0 +1,9 @@
1
+ /** Mirrors `ResetPasswordApiRequest` of the be contract: resets a forgotten password with the emailed token. */
2
+ export interface ResetPasswordApiRequest {
3
+ /** The account email. */
4
+ readonly email: string;
5
+ /** The token from the reset email. */
6
+ readonly resetToken: string;
7
+ /** The replacement password. */
8
+ readonly newPassword: string;
9
+ }
@@ -0,0 +1,7 @@
1
+ /** Mirrors `SignInApiRequest` of the be contract: signs in with a login and password. */
2
+ export interface SignInApiRequest {
3
+ /** The user name or email. */
4
+ readonly login: string;
5
+ /** The password. */
6
+ readonly password: string;
7
+ }
@@ -0,0 +1,12 @@
1
+ import type { SignInRuleDto } from './SignInRuleDto';
2
+ /** Mirrors `SignInFieldDto` of the be contract: one field of a method's form, named as its request names it. */
3
+ export interface SignInFieldDto {
4
+ /** The request property the field fills, such as `login`, `password`, `phone` or `code`. */
5
+ readonly name: string;
6
+ /** The input the field takes: `text`, `password`, `phone` or `pin`. */
7
+ readonly kind: string;
8
+ /** A phone field's allowed ISO country codes, every country when empty; `null` for other kinds. */
9
+ readonly countries: ReadonlyArray<string> | null;
10
+ /** The rules in the order a form checks them. */
11
+ readonly rules: ReadonlyArray<SignInRuleDto>;
12
+ }
@@ -0,0 +1,16 @@
1
+ import type { SignInFieldDto } from './SignInFieldDto';
2
+ import type { SignInRuleDto } from './SignInRuleDto';
3
+ /** Mirrors `SignInMethodDto` of the be contract: one enabled sign-in method and the fields its form renders. */
4
+ export interface SignInMethodDto {
5
+ /** The method, a `SignInMethodIdConstants` value; a client skips ids it does not know. */
6
+ readonly id: string;
7
+ /** The channels a code goes out over, such as `telegram`; empty for a method without codes. */
8
+ readonly channels: ReadonlyArray<string>;
9
+ /** The sign-in form's fields, in order. */
10
+ readonly fields: ReadonlyArray<SignInFieldDto>;
11
+ /**
12
+ * The rules a new password meets on sign-up, reset and change; the password method only, `null` for any other. The
13
+ * sign-in form's own password field only requires a value.
14
+ */
15
+ readonly passwordRules: ReadonlyArray<SignInRuleDto> | null;
16
+ }
@@ -0,0 +1,7 @@
1
+ /** Mirrors `SignInMethodIdConstants` of the be contract: the method ids the declaration lists, one kit component each. */
2
+ export declare const SignInMethodIdConstants: {
3
+ /** A login and password (`PasswordSignIn`). */
4
+ readonly password: "password";
5
+ /** A code sent to a phone's linked channel, the instance's Telegram bot (`PhoneCodeSignIn`). */
6
+ readonly phoneCode: "phone-code";
7
+ };
@@ -0,0 +1,24 @@
1
+ import type { SignInMethodDto } from './SignInMethodDto';
2
+ import type { SignInRequirementsDto } from './SignInRequirementsDto';
3
+ /**
4
+ * Mirrors `SignInOptionsDto` of the be contract, the sign-in declaration `GET sign-in-options` answers: the hosted pages'
5
+ * look, whether anyone may sign up, and each enabled method in layout order with its fields and rules.
6
+ */
7
+ export interface SignInOptionsDto {
8
+ /** The name the pages show, the instance owner's brand. */
9
+ readonly brandName: string;
10
+ /** The fe sdk theme by its registry id: the app's own, else the instance's. */
11
+ readonly theme: string;
12
+ /** The image behind the card, a same-origin path or an HTTPS URL; `null` for the theme's own backdrop. */
13
+ readonly backgroundUrl: string | null;
14
+ /** Whether anyone may create an account. */
15
+ readonly isSignUpEnabled: boolean;
16
+ /** The locale the rule messages are in: `uz`, `ru` or `en`. */
17
+ readonly locale: string;
18
+ /** The locales the pages offer, in display order. */
19
+ readonly locales: ReadonlyArray<string>;
20
+ /** The enabled methods, in the order the pages lay them out. */
21
+ readonly methods: ReadonlyArray<SignInMethodDto>;
22
+ /** The verifications a sign-in needs. */
23
+ readonly requirements: SignInRequirementsDto;
24
+ }
@@ -0,0 +1,9 @@
1
+ /** Mirrors `SignInRequirementsDto` of the be contract: the verifications a sign-in needs before any token. */
2
+ export interface SignInRequirementsDto {
3
+ /** Whether the email must be confirmed. */
4
+ readonly isConfirmedEmailRequired: boolean;
5
+ /** Whether the phone number must be confirmed. */
6
+ readonly isConfirmedPhoneNumberRequired: boolean;
7
+ /** Whether everyone needs a second factor. */
8
+ readonly isSecondFactorRequired: boolean;
9
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Mirrors `SignInRuleDto` of the be contract: one rule a declared field meets, a fe sdk `ValidationCodes` code with its
3
+ * operands and its message in the request's locale; the server's answer for the same rule says the same.
4
+ */
5
+ export interface SignInRuleDto {
6
+ /** The rule code, such as `required`, `min`, `length`, `pattern`, `notEqual` or `custom`. */
7
+ readonly code: string;
8
+ /** The rule's operands under the vocabulary's names, such as `{ min: 15, unit: 'characters' }`; `null` when none. */
9
+ readonly params: Readonly<Record<string, unknown>> | null;
10
+ /** The text a person reads when the value breaks the rule. */
11
+ readonly message: string;
12
+ }
@@ -0,0 +1,24 @@
1
+ export type { AccountInfoDto } from './AccountInfoDto';
2
+ export { AccountRouteConstants } from './AccountRouteConstants';
3
+ export type { ConfirmEmailApiRequest } from './ConfirmEmailApiRequest';
4
+ export type { EmailAddressApiRequest } from './EmailAddressApiRequest';
5
+ export { HostedPageRouteConstants } from './HostedPageRouteConstants';
6
+ export type { PasswordChangeApiRequest } from './PasswordChangeApiRequest';
7
+ export type { PasswordChangeConfirmationApiRequest } from './PasswordChangeConfirmationApiRequest';
8
+ export type { PasswordChangeConfirmationDto } from './PasswordChangeConfirmationDto';
9
+ export { PasswordChangeConfirmationType } from './PasswordChangeConfirmationType';
10
+ export type { PasswordChangeLinkApiRequest } from './PasswordChangeLinkApiRequest';
11
+ export type { PasswordChangeRequiredDto } from './PasswordChangeRequiredDto';
12
+ export type { PhoneSignInApiRequest } from './PhoneSignInApiRequest';
13
+ export type { PhoneSignInSendApiRequest } from './PhoneSignInSendApiRequest';
14
+ export type { PhoneSignInSentDto } from './PhoneSignInSentDto';
15
+ export type { RegisterAccountApiRequest } from './RegisterAccountApiRequest';
16
+ export type { RegisteredAccountDto } from './RegisteredAccountDto';
17
+ export type { ResetPasswordApiRequest } from './ResetPasswordApiRequest';
18
+ export type { SignInApiRequest } from './SignInApiRequest';
19
+ export type { SignInFieldDto } from './SignInFieldDto';
20
+ export type { SignInMethodDto } from './SignInMethodDto';
21
+ export { SignInMethodIdConstants } from './SignInMethodIdConstants';
22
+ export type { SignInOptionsDto } from './SignInOptionsDto';
23
+ export type { SignInRequirementsDto } from './SignInRequirementsDto';
24
+ export type { SignInRuleDto } from './SignInRuleDto';
@@ -0,0 +1,40 @@
1
+ import { A, P } from "../chunks/PasswordChangeConfirmationType-xUIFj0b9.js";
2
+ const HostedPageRouteConstants = {
3
+ /** Signs a person in by every enabled method, then continues to `returnUrl`. */
4
+ signIn: "/sign-in",
5
+ /** Creates an account while sign-up is on. */
6
+ signUp: "/sign-up",
7
+ /** Confirms an email from the emailed link (`userId`, `token`). */
8
+ confirmEmail: "/confirm-email",
9
+ /** Sends a password reset email. */
10
+ forgotPassword: "/forgot-password",
11
+ /** Sets a new password from the emailed reset link (`email`, `token`). */
12
+ resetPassword: "/reset-password",
13
+ /** Spends a password change link; the token travels in the URL fragment (`#token=`). */
14
+ changePassword: "/change-password",
15
+ /** The signed-in person's security settings: the password change. */
16
+ accountSecurity: "/account/security",
17
+ /** The query parameter that carries the local path a page continues to. */
18
+ returnUrlParameter: "returnUrl",
19
+ /** The query parameter of an OIDC authorization request that names its client. */
20
+ clientIdParameter: "client_id",
21
+ /** The query parameter that carries an account id. */
22
+ userIdParameter: "userId",
23
+ /** The query parameter that carries an email address. */
24
+ emailParameter: "email",
25
+ /** The query or fragment parameter that carries a one-time token. */
26
+ tokenParameter: "token"
27
+ };
28
+ const SignInMethodIdConstants = {
29
+ /** A login and password (`PasswordSignIn`). */
30
+ password: "password",
31
+ /** A code sent to a phone's linked channel, the instance's Telegram bot (`PhoneCodeSignIn`). */
32
+ phoneCode: "phone-code"
33
+ };
34
+ export {
35
+ A as AccountRouteConstants,
36
+ HostedPageRouteConstants,
37
+ P as PasswordChangeConfirmationType,
38
+ SignInMethodIdConstants
39
+ };
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/contracts/HostedPageRouteConstants.ts","../../src/contracts/SignInMethodIdConstants.ts"],"sourcesContent":["/** Holds the hosted pages the service serves and the parameters each one reads. */\nexport const HostedPageRouteConstants = {\n /** Signs a person in by every enabled method, then continues to `returnUrl`. */\n signIn: '/sign-in',\n /** Creates an account while sign-up is on. */\n signUp: '/sign-up',\n /** Confirms an email from the emailed link (`userId`, `token`). */\n confirmEmail: '/confirm-email',\n /** Sends a password reset email. */\n forgotPassword: '/forgot-password',\n /** Sets a new password from the emailed reset link (`email`, `token`). */\n resetPassword: '/reset-password',\n /** Spends a password change link; the token travels in the URL fragment (`#token=`). */\n changePassword: '/change-password',\n /** The signed-in person's security settings: the password change. */\n accountSecurity: '/account/security',\n /** The query parameter that carries the local path a page continues to. */\n returnUrlParameter: 'returnUrl',\n /** The query parameter of an OIDC authorization request that names its client. */\n clientIdParameter: 'client_id',\n /** The query parameter that carries an account id. */\n userIdParameter: 'userId',\n /** The query parameter that carries an email address. */\n emailParameter: 'email',\n /** The query or fragment parameter that carries a one-time token. */\n tokenParameter: 'token',\n} as const;\n","/** Mirrors `SignInMethodIdConstants` of the be contract: the method ids the declaration lists, one kit component each. */\nexport const SignInMethodIdConstants = {\n /** A login and password (`PasswordSignIn`). */\n password: 'password',\n /** A code sent to a phone's linked channel, the instance's Telegram bot (`PhoneCodeSignIn`). */\n phoneCode: 'phone-code',\n} as const;\n"],"names":[],"mappings":";AACO,MAAM,2BAA2B;AAAA;AAAA,EAEtC,QAAQ;AAAA;AAAA,EAER,QAAQ;AAAA;AAAA,EAER,cAAc;AAAA;AAAA,EAEd,gBAAgB;AAAA;AAAA,EAEhB,eAAe;AAAA;AAAA,EAEf,gBAAgB;AAAA;AAAA,EAEhB,iBAAiB;AAAA;AAAA,EAEjB,oBAAoB;AAAA;AAAA,EAEpB,mBAAmB;AAAA;AAAA,EAEnB,iBAAiB;AAAA;AAAA,EAEjB,gBAAgB;AAAA;AAAA,EAEhB,gBAAgB;AAClB;ACzBO,MAAM,0BAA0B;AAAA;AAAA,EAErC,UAAU;AAAA;AAAA,EAEV,WAAW;AACb;"}
@@ -0,0 +1,73 @@
1
+ import { type ApiFailure } from '@wow-two-beta/fe/foundation/http';
2
+ import { type Result } from '@wow-two-beta/fe/foundation/results';
3
+ import { type AccountInfoDto, type ConfirmEmailApiRequest, type EmailAddressApiRequest, type PasswordChangeApiRequest, type PasswordChangeConfirmationApiRequest, type PasswordChangeConfirmationDto, type PasswordChangeLinkApiRequest, type PasswordChangeRequiredDto, type PhoneSignInApiRequest, type PhoneSignInSendApiRequest, type PhoneSignInSentDto, type RegisterAccountApiRequest, type RegisteredAccountDto, type ResetPasswordApiRequest, type SignInApiRequest, type SignInOptionsDto } from '../../contracts';
4
+ /** Configures where the account API is reached. */
5
+ export interface AccountClientOptions {
6
+ /** The origin serving the API: empty for the consumer's own backend (Form 1), the service's URL otherwise. */
7
+ readonly baseUrl?: string;
8
+ /**
9
+ * Whether the browser sends the session cookie. Default `same-origin`, or `include` when `baseUrl` is set, which
10
+ * the service's CORS policy must allow.
11
+ */
12
+ readonly credentials?: RequestCredentials;
13
+ /** Replaces the global fetch, for tests. */
14
+ readonly fetch?: typeof globalThis.fetch;
15
+ }
16
+ /** Describes a sign-in call beyond its body. */
17
+ export interface AccountSignInOptions {
18
+ /** The OIDC client the sign-in serves, recorded by the sign-in log. */
19
+ readonly clientId?: string | null;
20
+ /** Cancels the request. */
21
+ readonly signal?: AbortSignal;
22
+ }
23
+ /** Describes a sign-in declaration request. */
24
+ export interface SignInOptionsQuery {
25
+ /** The OIDC client the sign-in serves: its own theme and background replace the instance's. */
26
+ readonly clientId?: string | null;
27
+ /** The locale of the rule messages (`uz`, `ru`, `en`); the browser's `Accept-Language` when omitted. */
28
+ readonly locale?: string | null;
29
+ /** Cancels the request. */
30
+ readonly signal?: AbortSignal;
31
+ }
32
+ /** Calls the account API over HTTP, signing in with cookie sessions. */
33
+ export interface AccountClient {
34
+ /**
35
+ * Reads the sign-in declaration: the hosted pages' look, whether sign-up is open, and each enabled method in layout
36
+ * order with its fields and rules. An unknown `clientId` answers the instance's own look.
37
+ */
38
+ getSignInOptions(query?: SignInOptionsQuery): Promise<Result<SignInOptionsDto, ApiFailure>>;
39
+ /** Creates an account while sign-up is on; `403` while it is closed. */
40
+ register(request: RegisterAccountApiRequest, signal?: AbortSignal): Promise<Result<RegisteredAccountDto, ApiFailure>>;
41
+ /**
42
+ * Signs in with a login and password: `null` once the session cookie is set, or the ticket of a required password
43
+ * change, which sets no session.
44
+ */
45
+ signIn(request: SignInApiRequest, options?: AccountSignInOptions): Promise<Result<PasswordChangeRequiredDto | null, ApiFailure>>;
46
+ /** Confirms an email with the emailed token. */
47
+ confirmEmail(request: ConfirmEmailApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;
48
+ /** Sends the confirmation email again; succeeds whether or not the account exists. */
49
+ resendConfirmationEmail(request: EmailAddressApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;
50
+ /** Sends a password reset email; succeeds whether or not the account exists. */
51
+ forgotPassword(request: EmailAddressApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;
52
+ /** Sets a new password with the emailed reset token. */
53
+ resetPassword(request: ResetPasswordApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;
54
+ /** Reads the signed-in account; `401` when nobody is signed in. */
55
+ getAccountInfo(signal?: AbortSignal): Promise<Result<AccountInfoDto, ApiFailure>>;
56
+ /**
57
+ * Starts a password change, signed in or with a required change's ticket: answers how it is confirmed, and sends the
58
+ * code or link the setting asks for.
59
+ */
60
+ startPasswordChange(request?: PasswordChangeConfirmationApiRequest, signal?: AbortSignal): Promise<Result<PasswordChangeConfirmationDto, ApiFailure>>;
61
+ /** Changes the password of the signed-in person, or of the one a required change's ticket names. */
62
+ changePassword(request: PasswordChangeApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;
63
+ /** Changes a password with the one-time token a change link carries. */
64
+ changePasswordWithLink(request: PasswordChangeLinkApiRequest, signal?: AbortSignal): Promise<Result<void, ApiFailure>>;
65
+ /** Sends a phone sign-in code, or answers the Telegram link that sends one once the contact is shared. */
66
+ sendPhoneSignInCode(request: PhoneSignInSendApiRequest, signal?: AbortSignal): Promise<Result<PhoneSignInSentDto, ApiFailure>>;
67
+ /** Signs in with a phone and its code and sets the session cookie. */
68
+ signInWithPhone(request: PhoneSignInApiRequest, options?: AccountSignInOptions): Promise<Result<void, ApiFailure>>;
69
+ /** Ends the cookie's session. */
70
+ signOut(signal?: AbortSignal): Promise<Result<void, ApiFailure>>;
71
+ }
72
+ /** Creates a client for the account API at `baseUrl` (same origin by default). */
73
+ export declare function createAccountClient(options?: AccountClientOptions): AccountClient;
@@ -0,0 +1,10 @@
1
+ import { type AccountClient } from '../CreateAccountClient';
2
+ /** Names where a kit component reaches the account API. */
3
+ export interface AccountClientSource {
4
+ /** The client to call; built from `baseUrl` when omitted. */
5
+ readonly client?: AccountClient;
6
+ /** The service's origin; the consumer's own origin (Form 1) when omitted. */
7
+ readonly baseUrl?: string;
8
+ }
9
+ /** Returns the component's account client, read once at setup: the given one, or one for `baseUrl`. */
10
+ export declare function useAccountClient(source: AccountClientSource): AccountClient;
@@ -0,0 +1,2 @@
1
+ /** Pins the fe sdk house form engine for the kit's scalar forms; components import the engine from here only. */
2
+ export { useAppForm as useAccountForm } from '@wow-two-beta/fe/forms-engine/house';