@webiny/cognito 6.6.0-alpha.12 → 6.6.0-alpha.13

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 (103) hide show
  1. package/admin/Cognito.js +7 -1
  2. package/admin/Cognito.js.map +1 -1
  3. package/admin/presentation/Cognito/CognitoLoginScreen.js +9 -1
  4. package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -1
  5. package/admin/presentation/Cognito/CognitoPresenter.d.ts +10 -1
  6. package/admin/presentation/Cognito/CognitoPresenter.js +50 -4
  7. package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -1
  8. package/admin/presentation/Cognito/CognitoPresenter.test.d.ts +1 -0
  9. package/admin/presentation/Cognito/CognitoPresenter.test.js +180 -0
  10. package/admin/presentation/Cognito/CognitoPresenter.test.js.map +1 -0
  11. package/admin/presentation/Cognito/abstractions.d.ts +8 -1
  12. package/admin/presentation/Cognito/abstractions.js.map +1 -1
  13. package/admin/presentation/Cognito/components/FederatedProviders.js +1 -1
  14. package/admin/presentation/Cognito/components/FederatedProviders.js.map +1 -1
  15. package/admin/presentation/Cognito/components/NoTenantAccess.d.ts +23 -0
  16. package/admin/presentation/Cognito/components/NoTenantAccess.js +10 -0
  17. package/admin/presentation/Cognito/components/NoTenantAccess.js.map +1 -0
  18. package/admin/presentation/Cognito/components/SelectTenant.d.ts +26 -0
  19. package/admin/presentation/Cognito/components/SelectTenant.js +15 -0
  20. package/admin/presentation/Cognito/components/SelectTenant.js.map +1 -0
  21. package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -1
  22. package/admin/presentation/Cognito/components/SetupTotp.js +6 -5
  23. package/admin/presentation/Cognito/components/SetupTotp.js.map +1 -1
  24. package/admin/presentation/Cognito/components/View.js +5 -5
  25. package/admin/presentation/Cognito/components/View.js.map +1 -1
  26. package/admin/presentation/Cognito/components/index.d.ts +38 -0
  27. package/admin/presentation/Cognito/components/index.js +4 -0
  28. package/admin/presentation/Cognito/components/index.js.map +1 -1
  29. package/api/CognitoApiFeature.js +6 -0
  30. package/api/CognitoApiFeature.js.map +1 -1
  31. package/api/domain/errors.d.ts +68 -0
  32. package/api/domain/errors.js +73 -1
  33. package/api/domain/errors.js.map +1 -1
  34. package/api/features/CheckEmail/CheckEmailUseCase.d.ts +16 -0
  35. package/api/features/CheckEmail/CheckEmailUseCase.js +47 -0
  36. package/api/features/CheckEmail/CheckEmailUseCase.js.map +1 -0
  37. package/api/features/CheckEmail/abstractions.d.ts +29 -0
  38. package/api/features/CheckEmail/abstractions.js +5 -0
  39. package/api/features/CheckEmail/abstractions.js.map +1 -0
  40. package/api/features/CheckEmail/feature.d.ts +4 -0
  41. package/api/features/CheckEmail/feature.js +11 -0
  42. package/api/features/CheckEmail/feature.js.map +1 -0
  43. package/api/features/CheckEmail/index.d.ts +2 -0
  44. package/api/features/CheckEmail/index.js +2 -0
  45. package/api/features/CognitoIdp/CognitoIdentityProvider.d.ts +2 -0
  46. package/api/features/CognitoIdp/CognitoIdentityProvider.js +20 -0
  47. package/api/features/CognitoIdp/CognitoIdentityProvider.js.map +1 -1
  48. package/api/features/CognitoIdp/abstractions.d.ts +6 -0
  49. package/api/features/CognitoIdp/abstractions.js.map +1 -1
  50. package/api/features/CognitoService/CognitoService.d.ts +2 -1
  51. package/api/features/CognitoService/CognitoService.js +20 -5
  52. package/api/features/CognitoService/CognitoService.js.map +1 -1
  53. package/api/features/CognitoService/abstractions.d.ts +13 -2
  54. package/api/features/CognitoService/abstractions.js.map +1 -1
  55. package/api/features/CognitoService/adminDeleteSoftwareToken.d.ts +16 -0
  56. package/api/features/CognitoService/adminDeleteSoftwareToken.js +69 -0
  57. package/api/features/CognitoService/adminDeleteSoftwareToken.js.map +1 -0
  58. package/api/features/CognitoService/adminDeleteSoftwareToken.test.d.ts +1 -0
  59. package/api/features/CognitoService/adminDeleteSoftwareToken.test.js +91 -0
  60. package/api/features/CognitoService/adminDeleteSoftwareToken.test.js.map +1 -0
  61. package/api/features/CreateUser/CreateUserUseCase.d.ts +1 -2
  62. package/api/features/CreateUser/CreateUserUseCase.js +3 -3
  63. package/api/features/CreateUser/CreateUserUseCase.js.map +1 -1
  64. package/api/features/CreateUser/abstractions.d.ts +3 -1
  65. package/api/features/CreateUser/abstractions.js.map +1 -1
  66. package/api/features/DeleteUser/DeleteUserUseCase.d.ts +3 -1
  67. package/api/features/DeleteUser/DeleteUserUseCase.js +11 -2
  68. package/api/features/DeleteUser/DeleteUserUseCase.js.map +1 -1
  69. package/api/features/DeleteUser/abstractions.d.ts +2 -0
  70. package/api/features/DeleteUser/abstractions.js.map +1 -1
  71. package/api/features/LinkUser/LinkUserUseCase.d.ts +22 -0
  72. package/api/features/LinkUser/LinkUserUseCase.js +83 -0
  73. package/api/features/LinkUser/LinkUserUseCase.js.map +1 -0
  74. package/api/features/LinkUser/abstractions.d.ts +36 -0
  75. package/api/features/LinkUser/abstractions.js +5 -0
  76. package/api/features/LinkUser/abstractions.js.map +1 -0
  77. package/api/features/LinkUser/feature.d.ts +4 -0
  78. package/api/features/LinkUser/feature.js +11 -0
  79. package/api/features/LinkUser/feature.js.map +1 -0
  80. package/api/features/LinkUser/index.d.ts +2 -0
  81. package/api/features/LinkUser/index.js +2 -0
  82. package/api/features/ResetUserMfa/ResetUserMfaUseCase.d.ts +18 -0
  83. package/api/features/ResetUserMfa/ResetUserMfaUseCase.js +59 -0
  84. package/api/features/ResetUserMfa/ResetUserMfaUseCase.js.map +1 -0
  85. package/api/features/ResetUserMfa/abstractions.d.ts +24 -0
  86. package/api/features/ResetUserMfa/abstractions.js +5 -0
  87. package/api/features/ResetUserMfa/abstractions.js.map +1 -0
  88. package/api/features/ResetUserMfa/feature.d.ts +4 -0
  89. package/api/features/ResetUserMfa/feature.js +11 -0
  90. package/api/features/ResetUserMfa/feature.js.map +1 -0
  91. package/api/features/ResetUserMfa/index.d.ts +2 -0
  92. package/api/features/ResetUserMfa/index.js +2 -0
  93. package/api/features/UpdateUser/UpdateUserUseCase.d.ts +24 -1
  94. package/api/features/UpdateUser/UpdateUserUseCase.js +97 -4
  95. package/api/features/UpdateUser/UpdateUserUseCase.js.map +1 -1
  96. package/api/features/UpdateUser/abstractions.d.ts +7 -1
  97. package/api/features/UpdateUser/abstractions.js.map +1 -1
  98. package/api/features/UserInstaller/UserInstaller.d.ts +3 -1
  99. package/api/features/UserInstaller/UserInstaller.js +18 -3
  100. package/api/features/UserInstaller/UserInstaller.js.map +1 -1
  101. package/api/graphql/user.gql.js +87 -0
  102. package/api/graphql/user.gql.js.map +1 -1
  103. package/package.json +24 -19
@@ -4,7 +4,7 @@ const Container = makeDecoratable("FederatedProvidersContainer", ({ children })=
4
4
  className: "flex flex-col gap-xs"
5
5
  }, children));
6
6
  const FederatedProviders = {
7
- Container: Container
7
+ Container
8
8
  };
9
9
  export { Container, FederatedProviders };
10
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/Cognito/components/FederatedProviders.js","sources":["../../../../../src/admin/presentation/Cognito/components/FederatedProviders.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\n\nexport interface ContainerProps {\n children: React.ReactNode;\n}\n\nexport const Container = makeDecoratable(\n \"FederatedProvidersContainer\",\n ({ children }: ContainerProps) => {\n return <div className={\"flex flex-col gap-xs\"}>{children}</div>;\n }\n);\n\nexport const FederatedProviders = {\n Container\n};\n"],"names":["Container","makeDecoratable","children","FederatedProviders"],"mappings":";;AAOO,MAAMA,YAAYC,gBACrB,+BACA,CAAC,EAAEC,QAAQ,EAAkB,GAClB,WAAP,GAAO,oBAAC;QAAI,WAAW;OAAyBA;AAIjD,MAAMC,qBAAqB;IAC9BH,WAAAA;AACJ"}
1
+ {"version":3,"file":"admin/presentation/Cognito/components/FederatedProviders.js","sources":["../../../../../src/admin/presentation/Cognito/components/FederatedProviders.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\n\nexport interface ContainerProps {\n children: React.ReactNode;\n}\n\nexport const Container = makeDecoratable(\n \"FederatedProvidersContainer\",\n ({ children }: ContainerProps) => {\n return <div className={\"flex flex-col gap-xs\"}>{children}</div>;\n }\n);\n\nexport const FederatedProviders = {\n Container\n};\n"],"names":["Container","makeDecoratable","children","FederatedProviders"],"mappings":";;AAOO,MAAMA,YAAYC,gBACrB,+BACA,CAAC,EAAEC,QAAQ,EAAkB,GAClB,WAAP,GAAO,oBAAC;QAAI,WAAW;OAAyBA;AAIjD,MAAMC,qBAAqB;IAC9BH;AACJ"}
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ export interface NoTenantAccessProps {
3
+ onSignOut: () => void;
4
+ }
5
+ export declare const NoTenantAccess: ((props: NoTenantAccessProps) => React.JSX.Element) & {
6
+ original: (props: NoTenantAccessProps) => React.JSX.Element;
7
+ originalName: string;
8
+ displayName: string;
9
+ } & {
10
+ original: ((props: NoTenantAccessProps) => React.JSX.Element) & {
11
+ original: (props: NoTenantAccessProps) => React.JSX.Element;
12
+ originalName: string;
13
+ displayName: string;
14
+ };
15
+ originalName: string;
16
+ displayName: string;
17
+ } & {
18
+ createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<((props: NoTenantAccessProps) => React.JSX.Element) & {
19
+ original: (props: NoTenantAccessProps) => React.JSX.Element;
20
+ originalName: string;
21
+ displayName: string;
22
+ }>) => (props: unknown) => React.JSX.Element;
23
+ };
@@ -0,0 +1,10 @@
1
+ import react from "react";
2
+ import { makeDecoratable } from "@webiny/app-admin";
3
+ import { LoginNoTenantAccess } from "@webiny/app-admin/presentation/security/components/LoginNoTenantAccess.js";
4
+ import { View } from "./View.js";
5
+ const NoTenantAccess = makeDecoratable("CognitoNoTenantAccess", (props)=>/*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(View.Content, null, /*#__PURE__*/ react.createElement(LoginNoTenantAccess, {
6
+ onSignOut: props.onSignOut
7
+ }))));
8
+ export { NoTenantAccess };
9
+
10
+ //# sourceMappingURL=NoTenantAccess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/presentation/Cognito/components/NoTenantAccess.js","sources":["../../../../../src/admin/presentation/Cognito/components/NoTenantAccess.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { LoginNoTenantAccess } from \"@webiny/app-admin/presentation/security/components/LoginNoTenantAccess.js\";\nimport { View } from \"./View.js\";\n\nexport interface NoTenantAccessProps {\n onSignOut: () => void;\n}\n\nexport const NoTenantAccess = makeDecoratable(\n \"CognitoNoTenantAccess\",\n (props: NoTenantAccessProps) => {\n return (\n <View.Container>\n <View.Content>\n <LoginNoTenantAccess onSignOut={props.onSignOut} />\n </View.Content>\n </View.Container>\n );\n }\n);\n"],"names":["NoTenantAccess","makeDecoratable","props","View","LoginNoTenantAccess"],"mappings":";;;;AASO,MAAMA,iBAAiBC,gBAC1B,yBACA,CAACC,QACU,WAAP,GACI,oBAACC,KAAK,SAAS,sBACX,oBAACA,KAAK,OAAO,sBACT,oBAACC,qBAAmBA;QAAC,WAAWF,MAAM,SAAS"}
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import type { SelectTenantVM } from "../../../../admin/presentation/Cognito/abstractions.js";
3
+ export interface SelectTenantProps {
4
+ vm: SelectTenantVM;
5
+ onSelect: (tenantId: string) => void;
6
+ onSignOut: () => void;
7
+ }
8
+ export declare const SelectTenant: ((props: SelectTenantProps) => React.JSX.Element) & {
9
+ original: (props: SelectTenantProps) => React.JSX.Element;
10
+ originalName: string;
11
+ displayName: string;
12
+ } & {
13
+ original: ((props: SelectTenantProps) => React.JSX.Element) & {
14
+ original: (props: SelectTenantProps) => React.JSX.Element;
15
+ originalName: string;
16
+ displayName: string;
17
+ };
18
+ originalName: string;
19
+ displayName: string;
20
+ } & {
21
+ createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<((props: SelectTenantProps) => React.JSX.Element) & {
22
+ original: (props: SelectTenantProps) => React.JSX.Element;
23
+ originalName: string;
24
+ displayName: string;
25
+ }>) => (props: unknown) => React.JSX.Element;
26
+ };
@@ -0,0 +1,15 @@
1
+ import react from "react";
2
+ import { makeDecoratable } from "@webiny/app-admin";
3
+ import { LoginTenantPicker } from "@webiny/app-admin/presentation/security/components/LoginTenantPicker.js";
4
+ import { View } from "./View.js";
5
+ const SelectTenant = makeDecoratable("CognitoSelectTenant", (props)=>{
6
+ const { vm, onSelect, onSignOut } = props;
7
+ return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(View.Content, null, /*#__PURE__*/ react.createElement(LoginTenantPicker, {
8
+ tenants: vm.tenants,
9
+ onSelect: onSelect,
10
+ onSignOut: onSignOut
11
+ })));
12
+ });
13
+ export { SelectTenant };
14
+
15
+ //# sourceMappingURL=SelectTenant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/presentation/Cognito/components/SelectTenant.js","sources":["../../../../../src/admin/presentation/Cognito/components/SelectTenant.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { LoginTenantPicker } from \"@webiny/app-admin/presentation/security/components/LoginTenantPicker.js\";\nimport { View } from \"./View.js\";\nimport type { SelectTenantVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nexport interface SelectTenantProps {\n vm: SelectTenantVM;\n onSelect: (tenantId: string) => void;\n onSignOut: () => void;\n}\n\nexport const SelectTenant = makeDecoratable(\"CognitoSelectTenant\", (props: SelectTenantProps) => {\n const { vm, onSelect, onSignOut } = props;\n\n return (\n <View.Container>\n <View.Content>\n <LoginTenantPicker tenants={vm.tenants} onSelect={onSelect} onSignOut={onSignOut} />\n </View.Content>\n </View.Container>\n );\n});\n"],"names":["SelectTenant","makeDecoratable","props","vm","onSelect","onSignOut","View","LoginTenantPicker"],"mappings":";;;;AAYO,MAAMA,eAAeC,gBAAgB,uBAAuB,CAACC;IAChE,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGH;IAEpC,OAAO,WAAP,GACI,oBAACI,KAAK,SAAS,sBACX,oBAACA,KAAK,OAAO,sBACT,oBAACC,mBAAiBA;QAAC,SAASJ,GAAG,OAAO;QAAE,UAAUC;QAAU,WAAWC;;AAIvF"}
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/Cognito/components/SetNewPassword.js","sources":["../../../../../src/admin/presentation/Cognito/components/SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Input, Alert } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { Form, Bind, useForm } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { SetNewPasswordVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\nimport { PasswordPolicyFeature } from \"@webiny/app-admin\";\nimport { useFeature } from \"@webiny/app\";\n\nexport interface SetNewPasswordProps {\n vm: SetNewPasswordVM;\n onSetNewPassword: (code: string, password: string) => void;\n onCancel: () => void;\n}\n\nexport const SetNewPassword = makeDecoratable(\n \"CognitoSetNewPassword\",\n (props: SetNewPasswordProps) => {\n const { vm, onSetNewPassword, onCancel } = props;\n const { passwordPolicy } = useFeature(PasswordPolicyFeature);\n\n return (\n <View.Container>\n <Form\n onSubmit={(data: any) => onSetNewPassword(data.code, data.password)}\n submitOnEnter\n >\n {({ submit }) => (\n <View.Content>\n <View.Title title={\"Set new password\"} />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <Bind name=\"code\" validators={validation.create(\"required\")}>\n <Input\n label={\"Verification Code\"}\n description={\"Enter the code we sent to your email.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"password\"\n validators={[\n validation.create(\"required\"),\n (value: string) => passwordPolicy.validate(value)\n ]}\n >\n <Input\n type={\"password\"}\n label={\"New Password\"}\n description={\"Enter your new password.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <RetypePassword />\n </Grid.Column>\n <Grid.Column span={12}>\n <div className={\"flex items-center justify-between\"}>\n <FooterSignIn onSignIn={onCancel} />\n <Button\n text={\"Reset Password\"}\n onClick={submit}\n containerClassName={\"ml-auto\"}\n disabled={vm.isLoading}\n />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n }\n);\n\nconst RetypePassword = () => {\n const form = useForm();\n const matchOriginalValidator = (value: string) => {\n if (value !== form.getValue(\"password\")) {\n throw Error(`Passwords do not match.`);\n }\n };\n\n return (\n <Bind\n name=\"confirmPassword\"\n validators={[validation.create(\"required\"), matchOriginalValidator]}\n >\n <Input\n type={\"password\"}\n label={\"Retype Password\"}\n description={\"Enter your new password once more.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n );\n};\n"],"names":["SetNewPassword","makeDecoratable","props","vm","onSetNewPassword","onCancel","passwordPolicy","useFeature","PasswordPolicyFeature","View","Form","data","submit","Alert","Grid","Bind","validation","Input","value","RetypePassword","FooterSignIn","Button","form","useForm","matchOriginalValidator","Error"],"mappings":";;;;;;;;AAiBO,MAAMA,iBAAiBC,gBAC1B,yBACA,CAACC;IACG,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGH;IAC3C,MAAM,EAAEI,cAAc,EAAE,GAAGC,WAAWC;IAEtC,OAAO,WAAP,GACI,oBAACC,KAAK,SAAS,sBACX,oBAACC,MAAIA;QACD,UAAU,CAACC,OAAcP,iBAAiBO,KAAK,IAAI,EAAEA,KAAK,QAAQ;QAClE;OAEC,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YAAC,OAAO;YAElBN,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACU,OAAKA;YAAC,OAAOV,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACW,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YAAC,MAAK;YAAO,YAAYC,WAAW,MAAM,CAAC;yBAC5C,oBAACC,OAAKA;YACF,OAAO;YACP,aAAa;YACb,cAAc;4BAI1B,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YACD,MAAK;YACL,YAAY;gBACRC,WAAW,MAAM,CAAC;gBAClB,CAACE,QAAkBZ,eAAe,QAAQ,CAACY;aAC9C;yBAED,oBAACD,OAAKA;YACF,MAAM;YACN,OAAO;YACP,aAAa;YACb,cAAc;4BAI1B,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACK,gBAAcA,QAAAA,WAAAA,GAEnB,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAACM,cAAYA;YAAC,UAAUf;0BACxB,oBAACgB,QAAMA;YACH,MAAM;YACN,SAAST;YACT,oBAAoB;YACpB,UAAUT,GAAG,SAAS;;AAU9D;AAGJ,MAAMgB,iBAAiB;IACnB,MAAMG,OAAOC;IACb,MAAMC,yBAAyB,CAACN;QAC5B,IAAIA,UAAUI,KAAK,QAAQ,CAAC,aACxB,MAAMG,MAAM;IAEpB;IAEA,OAAO,WAAP,GACI,oBAACV,MAAIA;QACD,MAAK;QACL,YAAY;YAACC,WAAW,MAAM,CAAC;YAAaQ;SAAuB;qBAEnE,oBAACP,OAAKA;QACF,MAAM;QACN,OAAO;QACP,aAAa;QACb,cAAc;;AAI9B"}
1
+ {"version":3,"file":"admin/presentation/Cognito/components/SetNewPassword.js","sources":["../../../../../src/admin/presentation/Cognito/components/SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Input, Alert } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { Form, Bind, useForm } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { SetNewPasswordVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\nimport { PasswordPolicyFeature } from \"@webiny/app-admin\";\nimport { useFeature } from \"@webiny/app\";\n\nexport interface SetNewPasswordProps {\n vm: SetNewPasswordVM;\n onSetNewPassword: (code: string, password: string) => void;\n onCancel: () => void;\n}\n\nexport const SetNewPassword = makeDecoratable(\n \"CognitoSetNewPassword\",\n (props: SetNewPasswordProps) => {\n const { vm, onSetNewPassword, onCancel } = props;\n const { passwordPolicy } = useFeature(PasswordPolicyFeature);\n\n return (\n <View.Container>\n <Form\n onSubmit={(data: any) => onSetNewPassword(data.code, data.password)}\n submitOnEnter\n >\n {({ submit }) => (\n <View.Content>\n <View.Title title={\"Set new password\"} />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <Bind name=\"code\" validators={validation.create(\"required\")}>\n <Input\n label={\"Verification Code\"}\n description={\"Enter the code we sent to your email.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"password\"\n validators={[\n validation.create(\"required\"),\n (value: string) => passwordPolicy.validate(value)\n ]}\n >\n <Input\n type={\"password\"}\n label={\"New Password\"}\n description={\"Enter your new password.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <RetypePassword />\n </Grid.Column>\n <Grid.Column span={12}>\n <div className={\"flex items-center justify-between\"}>\n <FooterSignIn onSignIn={onCancel} />\n <Button\n text={\"Reset Password\"}\n onClick={submit}\n containerClassName={\"ml-auto\"}\n disabled={vm.isLoading}\n />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n }\n);\n\nconst RetypePassword = () => {\n const form = useForm();\n const matchOriginalValidator = (value: string) => {\n if (value !== form.getValue(\"password\")) {\n throw Error(`Passwords do not match.`);\n }\n };\n\n return (\n <Bind\n name=\"confirmPassword\"\n validators={[validation.create(\"required\"), matchOriginalValidator]}\n >\n <Input\n type={\"password\"}\n label={\"Retype Password\"}\n description={\"Enter your new password once more.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n );\n};\n"],"names":["SetNewPassword","makeDecoratable","props","vm","onSetNewPassword","onCancel","passwordPolicy","useFeature","PasswordPolicyFeature","View","Form","data","submit","Alert","Grid","Bind","validation","Input","value","RetypePassword","FooterSignIn","Button","form","useForm","matchOriginalValidator","Error"],"mappings":";;;;;;;;AAiBO,MAAMA,iBAAiBC,gBAC1B,yBACA,CAACC;IACG,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGH;IAC3C,MAAM,EAAEI,cAAc,EAAE,GAAGC,WAAWC;IAEtC,OAAO,WAAP,GACI,oBAACC,KAAK,SAAS,sBACX,oBAACC,MAAIA;QACD,UAAU,CAACC,OAAcP,iBAAiBO,KAAK,IAAI,EAAEA,KAAK,QAAQ;QAClE;OAEC,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YAAC,OAAO;YAElBN,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACU,OAAKA;YAAC,OAAOV,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACW,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YAAC,MAAK;YAAO,YAAYC,WAAW,MAAM,CAAC;yBAC5C,oBAACC,OAAKA;YACF,OAAO;YACP,aAAa;YACb,cAAc;4BAI1B,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YACD,MAAK;YACL,YAAY;gBACRC,WAAW,MAAM,CAAC;gBAClB,CAACE,QAAkBZ,eAAe,QAAQ,CAACY;aAC9C;yBAED,oBAACD,OAAKA;YACF,MAAM;YACN,OAAO;YACP,aAAa;YACb,cAAc;4BAI1B,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACK,gBAAAA,QAAAA,WAAAA,GAEL,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAACM,cAAYA;YAAC,UAAUf;0BACxB,oBAACgB,QAAMA;YACH,MAAM;YACN,SAAST;YACT,oBAAoB;YACpB,UAAUT,GAAG,SAAS;;AAU9D;AAGJ,MAAMgB,iBAAiB;IACnB,MAAMG,OAAOC;IACb,MAAMC,yBAAyB,CAACN;QAC5B,IAAIA,UAAUI,KAAK,QAAQ,CAAC,aACxB,MAAMG,MAAM;IAEpB;IAEA,OAAO,WAAP,GACI,oBAACV,MAAIA;QACD,MAAK;QACL,YAAY;YAACC,WAAW,MAAM,CAAC;YAAaQ;SAAuB;qBAEnE,oBAACP,OAAKA;QACF,MAAM;QACN,OAAO;QACP,aAAa;QACb,cAAc;;AAI9B"}
@@ -1,4 +1,5 @@
1
1
  import react from "react";
2
+ import { QRCodeSVG } from "qrcode.react";
2
3
  import { Alert, Button, Grid, Input, Text } from "@webiny/admin-ui";
3
4
  import { makeDecoratable } from "@webiny/app-admin";
4
5
  import { Bind, Form } from "@webiny/form";
@@ -21,11 +22,11 @@ const SetupTotp = makeDecoratable("CognitoSetupTotp", (props)=>{
21
22
  span: 12
22
23
  }, /*#__PURE__*/ react.createElement("div", {
23
24
  className: "flex justify-center my-md"
24
- }, /*#__PURE__*/ react.createElement("img", {
25
- src: `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(vm.qrCodeUri)}`,
26
- alt: "TOTP QR Code",
27
- width: 200,
28
- height: 200
25
+ }, /*#__PURE__*/ react.createElement(QRCodeSVG, {
26
+ value: vm.qrCodeUri,
27
+ size: 200,
28
+ role: "img",
29
+ "aria-label": "TOTP QR Code"
29
30
  }))), /*#__PURE__*/ react.createElement(Grid.Column, {
30
31
  span: 12
31
32
  }, /*#__PURE__*/ react.createElement(Text, {
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/Cognito/components/SetupTotp.js","sources":["../../../../../src/admin/presentation/Cognito/components/SetupTotp.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Input, Alert, Text } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { SetupTotpVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nexport interface SetupTotpProps {\n vm: SetupTotpVM;\n onSubmit: (code: string) => void;\n}\n\nexport const SetupTotp = makeDecoratable(\"CognitoSetupTotp\", (props: SetupTotpProps) => {\n const { vm, onSubmit } = props;\n\n return (\n <View.Container>\n <Form<{ code: string }> onSubmit={data => onSubmit(data.code)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n <View.Title\n title={\"Set up two-factor authentication\"}\n description={\n \"Scan the QR code with your authenticator app (Google Authenticator, Authy, etc.), then enter the 6-digit code to verify.\"\n }\n />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <div className={\"flex justify-center my-md\"}>\n <img\n src={`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(vm.qrCodeUri)}`}\n alt={\"TOTP QR Code\"}\n width={200}\n height={200}\n />\n </div>\n </Grid.Column>\n <Grid.Column span={12}>\n <Text size={\"sm\"} className={\"text-neutral-strong\"}>\n {\"Can't scan the code? Enter this key manually:\"}\n </Text>\n <Text\n as={\"div\"}\n size={\"sm\"}\n className={\"font-mono mt-xs select-all break-all\"}\n >\n {vm.sharedSecret}\n </Text>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name=\"code\" validators={validation.create(\"required\")}>\n <Input\n label={\"Verification Code\"}\n description={\n \"Enter the 6-digit code from your authenticator app.\"\n }\n autoComplete={\"one-time-code\"}\n inputMode={\"numeric\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div className={\"flex justify-end\"}>\n <Button\n text={\"Verify & Enable\"}\n onClick={submit}\n disabled={vm.isLoading}\n />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n});\n"],"names":["SetupTotp","makeDecoratable","props","vm","onSubmit","View","Form","data","submit","Alert","Grid","encodeURIComponent","Text","Bind","validation","Input","Button"],"mappings":";;;;;;AAaO,MAAMA,YAAYC,gBAAgB,oBAAoB,CAACC;IAC1D,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAE,GAAGF;IAEzB,OAAO,WAAP,GACI,oBAACG,KAAK,SAAS,sBACX,oBAACC,MAAIA;QAAmB,UAAUC,CAAAA,OAAQH,SAASG,KAAK,IAAI;QAAG;OAC1D,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YACP,OAAO;YACP,aACI;YAIPF,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACM,OAAKA;YAAC,OAAON,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACO,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAAC;YACG,KAAK,CAAC,8DAA8D,EAAEC,mBAAmBR,GAAG,SAAS,GAAG;YACxG,KAAK;YACL,OAAO;YACP,QAAQ;4BAIpB,oBAACO,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACE,MAAIA;YAAC,MAAM;YAAM,WAAW;WACxB,gEAEL,oBAACA,MAAIA;YACD,IAAI;YACJ,MAAM;YACN,WAAW;WAEVT,GAAG,YAAY,kBAGxB,oBAACO,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACG,MAAIA;YAAC,MAAK;YAAO,YAAYC,WAAW,MAAM,CAAC;yBAC5C,oBAACC,OAAKA;YACF,OAAO;YACP,aACI;YAEJ,cAAc;YACd,WAAW;4BAIvB,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAACM,QAAMA;YACH,MAAM;YACN,SAASR;YACT,UAAUL,GAAG,SAAS;;AAU9D"}
1
+ {"version":3,"file":"admin/presentation/Cognito/components/SetupTotp.js","sources":["../../../../../src/admin/presentation/Cognito/components/SetupTotp.tsx"],"sourcesContent":["import React from \"react\";\nimport { QRCodeSVG } from \"qrcode.react\";\nimport { Button, Grid, Input, Alert, Text } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { SetupTotpVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nexport interface SetupTotpProps {\n vm: SetupTotpVM;\n onSubmit: (code: string) => void;\n}\n\nexport const SetupTotp = makeDecoratable(\"CognitoSetupTotp\", (props: SetupTotpProps) => {\n const { vm, onSubmit } = props;\n\n return (\n <View.Container>\n <Form<{ code: string }> onSubmit={data => onSubmit(data.code)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n <View.Title\n title={\"Set up two-factor authentication\"}\n description={\n \"Scan the QR code with your authenticator app (Google Authenticator, Authy, etc.), then enter the 6-digit code to verify.\"\n }\n />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <div className={\"flex justify-center my-md\"}>\n {/* Drawn in the browser, so the TOTP secret never leaves the page. */}\n <QRCodeSVG\n value={vm.qrCodeUri}\n size={200}\n role={\"img\"}\n aria-label={\"TOTP QR Code\"}\n />\n </div>\n </Grid.Column>\n <Grid.Column span={12}>\n <Text size={\"sm\"} className={\"text-neutral-strong\"}>\n {\"Can't scan the code? Enter this key manually:\"}\n </Text>\n <Text\n as={\"div\"}\n size={\"sm\"}\n className={\"font-mono mt-xs select-all break-all\"}\n >\n {vm.sharedSecret}\n </Text>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name=\"code\" validators={validation.create(\"required\")}>\n <Input\n label={\"Verification Code\"}\n description={\n \"Enter the 6-digit code from your authenticator app.\"\n }\n autoComplete={\"one-time-code\"}\n inputMode={\"numeric\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div className={\"flex justify-end\"}>\n <Button\n text={\"Verify & Enable\"}\n onClick={submit}\n disabled={vm.isLoading}\n />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n});\n"],"names":["SetupTotp","makeDecoratable","props","vm","onSubmit","View","Form","data","submit","Alert","Grid","QRCodeSVG","Text","Bind","validation","Input","Button"],"mappings":";;;;;;;AAcO,MAAMA,YAAYC,gBAAgB,oBAAoB,CAACC;IAC1D,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAE,GAAGF;IAEzB,OAAO,WAAP,GACI,oBAACG,KAAK,SAAS,sBACX,oBAACC,MAAIA;QAAmB,UAAUC,CAAAA,OAAQH,SAASG,KAAK,IAAI;QAAG;OAC1D,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YACP,OAAO;YACP,aACI;YAIPF,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACM,OAAKA;YAAC,OAAON,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACO,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBAEZ,oBAACC,WAASA;YACN,OAAOR,GAAG,SAAS;YACnB,MAAM;YACN,MAAM;YACN,cAAY;4BAIxB,oBAACO,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACE,MAAIA;YAAC,MAAM;YAAM,WAAW;WACxB,gEAEL,oBAACA,MAAIA;YACD,IAAI;YACJ,MAAM;YACN,WAAW;WAEVT,GAAG,YAAY,kBAGxB,oBAACO,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACG,MAAIA;YAAC,MAAK;YAAO,YAAYC,WAAW,MAAM,CAAC;yBAC5C,oBAACC,OAAKA;YACF,OAAO;YACP,aACI;YAEJ,cAAc;YACd,WAAW;4BAIvB,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAACM,QAAMA;YACH,MAAM;YACN,SAASR;YACT,UAAUL,GAAG,SAAS;;AAU9D"}
@@ -37,11 +37,11 @@ const Error = ({ title = "Something went wrong", description })=>{
37
37
  }, description));
38
38
  };
39
39
  const View = {
40
- Container: Container,
41
- Content: Content,
42
- Title: Title,
43
- Footer: Footer,
44
- Error: Error
40
+ Container,
41
+ Content,
42
+ Title,
43
+ Footer,
44
+ Error
45
45
  };
46
46
  export { Error, View };
47
47
 
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/Cognito/components/View.js","sources":["../../../../../src/admin/presentation/Cognito/components/View.tsx"],"sourcesContent":["import * as React from \"react\";\nimport capitalize from \"lodash/capitalize\";\nimport { Logo, makeDecoratable } from \"@webiny/app-admin\";\nimport { Alert, Grid, Heading, Text } from \"@webiny/admin-ui\";\n\nexport interface ContainerProps {\n children: React.ReactNode;\n}\n\nconst Container = makeDecoratable(\"ViewContainer\", ({ children }: ContainerProps) => {\n return (\n <div className={\"w-full h-screen bg-neutral-light flex-1\"}>\n <section className={\"m-auto flex flex-col justify-center min-h-screen\"}>\n <div className={\"mx-auto\"}>\n <Logo />\n </div>\n <div className={\"w-full max-w-[480px] mx-auto my-lg\"}>{children}</div>\n </section>\n </div>\n );\n});\n\nexport interface ContentProps {\n children: React.ReactNode;\n}\n\nconst Content = makeDecoratable(\"ViewContent\", ({ children }: ContentProps) => (\n <div className={\"relative p-lg pt-md bg-neutral-base rounded-xl\"}>{children}</div>\n));\n\nexport interface FooterProps {\n children: React.ReactNode;\n}\n\nconst Footer = makeDecoratable(\"ViewFooter\", ({ children }: FooterProps) => {\n return (\n <Grid>\n <Grid.Column span={12} className={\"text-center mt-lg\"}>\n {children}\n </Grid.Column>\n </Grid>\n );\n});\n\nexport interface TitleProps {\n title: string;\n description?: React.ReactNode;\n}\n\nconst Title = makeDecoratable(\"ViewTitle\", ({ title, description }: TitleProps) => {\n return (\n <div className={\"mb-md\"}>\n <Heading level={4}>{capitalize(title)}</Heading>\n {description && (\n <Text as={\"div\"} size={\"sm\"} className={\"text-neutral-strong\"}>\n {description}\n </Text>\n )}\n </div>\n );\n});\n\nexport interface ErrorProps {\n title?: string;\n description?: string | null;\n}\n\nexport const Error = ({ title = \"Something went wrong\", description }: ErrorProps) => {\n if (!description) {\n return null;\n }\n\n return (\n <div className={\"mb-lg\"}>\n <Alert title={title} type={\"danger\"}>\n {description}\n </Alert>\n </div>\n );\n};\n\nexport const View = {\n Container,\n Content,\n Title,\n Footer,\n Error\n};\n"],"names":["Container","makeDecoratable","children","Logo","Content","Footer","Grid","Title","title","description","Heading","capitalize","Text","Error","Alert","View"],"mappings":";;;;AASA,MAAMA,YAAYC,gBAAgB,iBAAiB,CAAC,EAAEC,QAAQ,EAAkB,GACrE,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAAC;QAAQ,WAAW;qBAChB,sCAAC;QAAI,WAAW;qBACZ,sCAACC,MAAIA,QAAAA,WAAAA,GAET,sCAAC;QAAI,WAAW;OAAuCD;AAUvE,MAAME,UAAUH,gBAAgB,eAAe,CAAC,EAAEC,QAAQ,EAAgB,iBACtE,sCAAC;QAAI,WAAW;OAAmDA;AAOvE,MAAMG,SAASJ,gBAAgB,cAAc,CAAC,EAAEC,QAAQ,EAAe,GAC5D,WAAP,GACI,sCAACI,MAAIA,MAAAA,WAAAA,GACD,sCAACA,KAAK,MAAM;QAAC,MAAM;QAAI,WAAW;OAC7BJ;AAWjB,MAAMK,QAAQN,gBAAgB,aAAa,CAAC,EAAEO,KAAK,EAAEC,WAAW,EAAc,GACnE,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,SAAOA;QAAC,OAAO;OAAIC,WAAWH,SAC9BC,eAAe,WAAfA,GACG,sCAACG,MAAIA;QAAC,IAAI;QAAO,MAAM;QAAM,WAAW;OACnCH;AAYd,MAAMI,QAAQ,CAAC,EAAEL,QAAQ,sBAAsB,EAAEC,WAAW,EAAc;IAC7E,IAAI,CAACA,aACD,OAAO;IAGX,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACK,OAAKA;QAAC,OAAON;QAAO,MAAM;OACtBC;AAIjB;AAEO,MAAMM,OAAO;IAChBf,WAAAA;IACAI,SAAAA;IACAG,OAAAA;IACAF,QAAAA;IACAQ,OAAAA;AACJ"}
1
+ {"version":3,"file":"admin/presentation/Cognito/components/View.js","sources":["../../../../../src/admin/presentation/Cognito/components/View.tsx"],"sourcesContent":["import * as React from \"react\";\nimport capitalize from \"lodash/capitalize\";\nimport { Logo, makeDecoratable } from \"@webiny/app-admin\";\nimport { Alert, Grid, Heading, Text } from \"@webiny/admin-ui\";\n\nexport interface ContainerProps {\n children: React.ReactNode;\n}\n\nconst Container = makeDecoratable(\"ViewContainer\", ({ children }: ContainerProps) => {\n return (\n <div className={\"w-full h-screen bg-neutral-light flex-1\"}>\n <section className={\"m-auto flex flex-col justify-center min-h-screen\"}>\n <div className={\"mx-auto\"}>\n <Logo />\n </div>\n <div className={\"w-full max-w-[480px] mx-auto my-lg\"}>{children}</div>\n </section>\n </div>\n );\n});\n\nexport interface ContentProps {\n children: React.ReactNode;\n}\n\nconst Content = makeDecoratable(\"ViewContent\", ({ children }: ContentProps) => (\n <div className={\"relative p-lg pt-md bg-neutral-base rounded-xl\"}>{children}</div>\n));\n\nexport interface FooterProps {\n children: React.ReactNode;\n}\n\nconst Footer = makeDecoratable(\"ViewFooter\", ({ children }: FooterProps) => {\n return (\n <Grid>\n <Grid.Column span={12} className={\"text-center mt-lg\"}>\n {children}\n </Grid.Column>\n </Grid>\n );\n});\n\nexport interface TitleProps {\n title: string;\n description?: React.ReactNode;\n}\n\nconst Title = makeDecoratable(\"ViewTitle\", ({ title, description }: TitleProps) => {\n return (\n <div className={\"mb-md\"}>\n <Heading level={4}>{capitalize(title)}</Heading>\n {description && (\n <Text as={\"div\"} size={\"sm\"} className={\"text-neutral-strong\"}>\n {description}\n </Text>\n )}\n </div>\n );\n});\n\nexport interface ErrorProps {\n title?: string;\n description?: string | null;\n}\n\nexport const Error = ({ title = \"Something went wrong\", description }: ErrorProps) => {\n if (!description) {\n return null;\n }\n\n return (\n <div className={\"mb-lg\"}>\n <Alert title={title} type={\"danger\"}>\n {description}\n </Alert>\n </div>\n );\n};\n\nexport const View = {\n Container,\n Content,\n Title,\n Footer,\n Error\n};\n"],"names":["Container","makeDecoratable","children","Logo","Content","Footer","Grid","Title","title","description","Heading","capitalize","Text","Error","Alert","View"],"mappings":";;;;AASA,MAAMA,YAAYC,gBAAgB,iBAAiB,CAAC,EAAEC,QAAQ,EAAkB,GACrE,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAAC;QAAQ,WAAW;qBAChB,sCAAC;QAAI,WAAW;qBACZ,sCAACC,MAAIA,QAAAA,WAAAA,GAET,sCAAC;QAAI,WAAW;OAAuCD;AAUvE,MAAME,UAAUH,gBAAgB,eAAe,CAAC,EAAEC,QAAQ,EAAgB,iBACtE,sCAAC;QAAI,WAAW;OAAmDA;AAOvE,MAAMG,SAASJ,gBAAgB,cAAc,CAAC,EAAEC,QAAQ,EAAe,GAC5D,WAAP,GACI,sCAACI,MAAIA,MAAAA,WAAAA,GACD,sCAACA,KAAK,MAAM;QAAC,MAAM;QAAI,WAAW;OAC7BJ;AAWjB,MAAMK,QAAQN,gBAAgB,aAAa,CAAC,EAAEO,KAAK,EAAEC,WAAW,EAAc,GACnE,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,SAAOA;QAAC,OAAO;OAAIC,WAAWH,SAC9BC,eAAe,WAAfA,GACG,sCAACG,MAAIA;QAAC,IAAI;QAAO,MAAM;QAAM,WAAW;OACnCH;AAYd,MAAMI,QAAQ,CAAC,EAAEL,QAAQ,sBAAsB,EAAEC,WAAW,EAAc;IAC7E,IAAI,CAACA,aACD,OAAO;IAGX,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACK,OAAKA;QAAC,OAAON;QAAO,MAAM;OACtBC;AAIjB;AAEO,MAAMM,OAAO;IAChBf;IACAI;IACAG;IACAF;IACAQ;AACJ"}
@@ -132,6 +132,44 @@ export declare const Components: {
132
132
  displayName: string;
133
133
  }>) => (props: unknown) => React.JSX.Element;
134
134
  };
135
+ SelectTenant: ((props: import("./SelectTenant.js").SelectTenantProps) => import("react").JSX.Element) & {
136
+ original: (props: import("./SelectTenant.js").SelectTenantProps) => import("react").JSX.Element;
137
+ originalName: string;
138
+ displayName: string;
139
+ } & {
140
+ original: ((props: import("./SelectTenant.js").SelectTenantProps) => import("react").JSX.Element) & {
141
+ original: (props: import("./SelectTenant.js").SelectTenantProps) => import("react").JSX.Element;
142
+ originalName: string;
143
+ displayName: string;
144
+ };
145
+ originalName: string;
146
+ displayName: string;
147
+ } & {
148
+ createDecorator: (decorator: import("@webiny/app/index.js").ComponentDecorator<((props: import("./SelectTenant.js").SelectTenantProps) => import("react").JSX.Element) & {
149
+ original: (props: import("./SelectTenant.js").SelectTenantProps) => import("react").JSX.Element;
150
+ originalName: string;
151
+ displayName: string;
152
+ }>) => (props: unknown) => React.JSX.Element;
153
+ };
154
+ NoTenantAccess: ((props: import("./NoTenantAccess.js").NoTenantAccessProps) => import("react").JSX.Element) & {
155
+ original: (props: import("./NoTenantAccess.js").NoTenantAccessProps) => import("react").JSX.Element;
156
+ originalName: string;
157
+ displayName: string;
158
+ } & {
159
+ original: ((props: import("./NoTenantAccess.js").NoTenantAccessProps) => import("react").JSX.Element) & {
160
+ original: (props: import("./NoTenantAccess.js").NoTenantAccessProps) => import("react").JSX.Element;
161
+ originalName: string;
162
+ displayName: string;
163
+ };
164
+ originalName: string;
165
+ displayName: string;
166
+ } & {
167
+ createDecorator: (decorator: import("@webiny/app/index.js").ComponentDecorator<((props: import("./NoTenantAccess.js").NoTenantAccessProps) => import("react").JSX.Element) & {
168
+ original: (props: import("./NoTenantAccess.js").NoTenantAccessProps) => import("react").JSX.Element;
169
+ originalName: string;
170
+ displayName: string;
171
+ }>) => (props: unknown) => React.JSX.Element;
172
+ };
135
173
  FederatedLogin: (({ providers }: import("./FederatedLogin.js").FederatedLoginProps) => import("react").JSX.Element) & {
136
174
  original: ({ providers }: import("./FederatedLogin.js").FederatedLoginProps) => import("react").JSX.Element;
137
175
  originalName: string;
@@ -5,6 +5,8 @@ import { RequireNewPassword } from "./RequireNewPassword.js";
5
5
  import { RequestPasswordResetCode } from "./RequestPasswordResetCode.js";
6
6
  import { PasswordResetCodeSent } from "./PasswordResetCodeSent.js";
7
7
  import { SetNewPassword } from "./SetNewPassword.js";
8
+ import { SelectTenant } from "./SelectTenant.js";
9
+ import { NoTenantAccess } from "./NoTenantAccess.js";
8
10
  import { FederatedLogin } from "./FederatedLogin.js";
9
11
  import { FederatedProviders } from "./FederatedProviders.js";
10
12
  import { Divider } from "./Divider.js";
@@ -18,6 +20,8 @@ const Components = {
18
20
  RequestPasswordResetCode: RequestPasswordResetCode,
19
21
  PasswordResetCodeSent: PasswordResetCodeSent,
20
22
  SetNewPassword: SetNewPassword,
23
+ SelectTenant: SelectTenant,
24
+ NoTenantAccess: NoTenantAccess,
21
25
  FederatedLogin: FederatedLogin,
22
26
  FederatedProviders: FederatedProviders,
23
27
  Divider: Divider,
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/Cognito/components/index.js","sources":["../../../../../src/admin/presentation/Cognito/components/index.ts"],"sourcesContent":["import { SignIn } from \"./SignIn.js\";\nimport { ConfirmTotpCode } from \"./ConfirmTotpCode.js\";\nimport { SetupTotp } from \"./SetupTotp.js\";\nimport { RequireNewPassword } from \"./RequireNewPassword.js\";\nimport { RequestPasswordResetCode } from \"./RequestPasswordResetCode.js\";\nimport { PasswordResetCodeSent } from \"./PasswordResetCodeSent.js\";\nimport { SetNewPassword } from \"./SetNewPassword.js\";\nimport { FederatedLogin } from \"./FederatedLogin.js\";\nimport { FederatedProviders } from \"./FederatedProviders.js\";\nimport { Divider } from \"./Divider.js\";\nimport { FooterSignIn } from \"./FooterSignIn.js\";\nimport { View } from \"./View.js\";\n\nexport const Components = {\n SignIn,\n ConfirmTotpCode,\n SetupTotp,\n RequireNewPassword,\n RequestPasswordResetCode,\n PasswordResetCodeSent,\n SetNewPassword,\n FederatedLogin,\n FederatedProviders,\n Divider,\n FooterSignIn,\n View\n};\n"],"names":["Components","SignIn","ConfirmTotpCode","SetupTotp","RequireNewPassword","RequestPasswordResetCode","PasswordResetCodeSent","SetNewPassword","FederatedLogin","FederatedProviders","Divider","FooterSignIn","View"],"mappings":";;;;;;;;;;;;AAaO,MAAMA,aAAa;IACtBC,QAAMA;IACNC,iBAAeA;IACfC,WAASA;IACTC,oBAAkBA;IAClBC,0BAAwBA;IACxBC,uBAAqBA;IACrBC,gBAAcA;IACdC,gBAAcA;IACdC,oBAAkBA;IAClBC,SAAOA;IACPC,cAAYA;IACZC,MAAIA;AACR"}
1
+ {"version":3,"file":"admin/presentation/Cognito/components/index.js","sources":["../../../../../src/admin/presentation/Cognito/components/index.ts"],"sourcesContent":["import { SignIn } from \"./SignIn.js\";\nimport { ConfirmTotpCode } from \"./ConfirmTotpCode.js\";\nimport { SetupTotp } from \"./SetupTotp.js\";\nimport { RequireNewPassword } from \"./RequireNewPassword.js\";\nimport { RequestPasswordResetCode } from \"./RequestPasswordResetCode.js\";\nimport { PasswordResetCodeSent } from \"./PasswordResetCodeSent.js\";\nimport { SetNewPassword } from \"./SetNewPassword.js\";\nimport { SelectTenant } from \"./SelectTenant.js\";\nimport { NoTenantAccess } from \"./NoTenantAccess.js\";\nimport { FederatedLogin } from \"./FederatedLogin.js\";\nimport { FederatedProviders } from \"./FederatedProviders.js\";\nimport { Divider } from \"./Divider.js\";\nimport { FooterSignIn } from \"./FooterSignIn.js\";\nimport { View } from \"./View.js\";\n\nexport const Components = {\n SignIn,\n ConfirmTotpCode,\n SetupTotp,\n RequireNewPassword,\n RequestPasswordResetCode,\n PasswordResetCodeSent,\n SetNewPassword,\n SelectTenant,\n NoTenantAccess,\n FederatedLogin,\n FederatedProviders,\n Divider,\n FooterSignIn,\n View\n};\n"],"names":["Components","SignIn","ConfirmTotpCode","SetupTotp","RequireNewPassword","RequestPasswordResetCode","PasswordResetCodeSent","SetNewPassword","SelectTenant","NoTenantAccess","FederatedLogin","FederatedProviders","Divider","FooterSignIn","View"],"mappings":";;;;;;;;;;;;;;AAeO,MAAMA,aAAa;IACtBC,QAAMA;IACNC,iBAAeA;IACfC,WAASA;IACTC,oBAAkBA;IAClBC,0BAAwBA;IACxBC,uBAAqBA;IACrBC,gBAAcA;IACdC,cAAYA;IACZC,gBAAcA;IACdC,gBAAcA;IACdC,oBAAkBA;IAClBC,SAAOA;IACPC,cAAYA;IACZC,MAAIA;AACR"}
@@ -5,6 +5,9 @@ import { CognitoIdpFeature } from "./features/CognitoIdp/index.js";
5
5
  import { CreateUserFeature } from "./features/CreateUser/index.js";
6
6
  import { UpdateUserFeature } from "./features/UpdateUser/index.js";
7
7
  import { DeleteUserFeature } from "./features/DeleteUser/index.js";
8
+ import { ResetUserMfaFeature } from "./features/ResetUserMfa/index.js";
9
+ import { LinkUserFeature } from "./features/LinkUser/index.js";
10
+ import { CheckEmailFeature } from "./features/CheckEmail/index.js";
8
11
  import { CognitoServiceFeature } from "./features/CognitoService/feature.js";
9
12
  const CognitoApiFeature = createFeature({
10
13
  name: "CognitoApiFeature",
@@ -12,6 +15,9 @@ const CognitoApiFeature = createFeature({
12
15
  CreateUserFeature.register(container);
13
16
  UpdateUserFeature.register(container);
14
17
  DeleteUserFeature.register(container);
18
+ ResetUserMfaFeature.register(container);
19
+ LinkUserFeature.register(container);
20
+ CheckEmailFeature.register(container);
15
21
  UserInstallerFeature.register(container);
16
22
  CognitoIdpFeature.register(container);
17
23
  CognitoServiceFeature.register(container, {
@@ -1 +1 @@
1
- {"version":3,"file":"api/CognitoApiFeature.js","sources":["../../src/api/CognitoApiFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { AdminUsersSchema } from \"~/api/graphql/user.gql.js\";\nimport { UserInstallerFeature } from \"./features/UserInstaller/feature.js\";\nimport { CognitoIdpFeature } from \"./features/CognitoIdp/index.js\";\nimport { CreateUserFeature } from \"./features/CreateUser/index.js\";\nimport { UpdateUserFeature } from \"./features/UpdateUser/index.js\";\nimport { DeleteUserFeature } from \"./features/DeleteUser/index.js\";\nimport { CognitoServiceFeature } from \"~/api/features/CognitoService/feature.js\";\n\nexport const CognitoApiFeature = createFeature({\n name: \"CognitoApiFeature\",\n register(container) {\n // Register features\n CreateUserFeature.register(container);\n UpdateUserFeature.register(container);\n DeleteUserFeature.register(container);\n UserInstallerFeature.register(container);\n CognitoIdpFeature.register(container);\n CognitoServiceFeature.register(container, {\n region: String(process.env.COGNITO_REGION),\n userPoolId: String(process.env.COGNITO_USER_POOL_ID)\n });\n\n // Register GraphQL schema\n container.register(AdminUsersSchema);\n }\n});\n"],"names":["CognitoApiFeature","createFeature","container","CreateUserFeature","UpdateUserFeature","DeleteUserFeature","UserInstallerFeature","CognitoIdpFeature","CognitoServiceFeature","String","process","AdminUsersSchema"],"mappings":";;;;;;;;AASO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QAEdC,kBAAkB,QAAQ,CAACD;QAC3BE,kBAAkB,QAAQ,CAACF;QAC3BG,kBAAkB,QAAQ,CAACH;QAC3BI,qBAAqB,QAAQ,CAACJ;QAC9BK,kBAAkB,QAAQ,CAACL;QAC3BM,sBAAsB,QAAQ,CAACN,WAAW;YACtC,QAAQO,OAAOC,QAAQ,GAAG,CAAC,cAAc;YACzC,YAAYD,OAAOC,QAAQ,GAAG,CAAC,oBAAoB;QACvD;QAGAR,UAAU,QAAQ,CAACS;IACvB;AACJ"}
1
+ {"version":3,"file":"api/CognitoApiFeature.js","sources":["../../src/api/CognitoApiFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { AdminUsersSchema } from \"~/api/graphql/user.gql.js\";\nimport { UserInstallerFeature } from \"./features/UserInstaller/feature.js\";\nimport { CognitoIdpFeature } from \"./features/CognitoIdp/index.js\";\nimport { CreateUserFeature } from \"./features/CreateUser/index.js\";\nimport { UpdateUserFeature } from \"./features/UpdateUser/index.js\";\nimport { DeleteUserFeature } from \"./features/DeleteUser/index.js\";\nimport { ResetUserMfaFeature } from \"./features/ResetUserMfa/index.js\";\nimport { LinkUserFeature } from \"./features/LinkUser/index.js\";\nimport { CheckEmailFeature } from \"./features/CheckEmail/index.js\";\nimport { CognitoServiceFeature } from \"~/api/features/CognitoService/feature.js\";\n\nexport const CognitoApiFeature = createFeature({\n name: \"CognitoApiFeature\",\n register(container) {\n // Register features\n CreateUserFeature.register(container);\n UpdateUserFeature.register(container);\n DeleteUserFeature.register(container);\n ResetUserMfaFeature.register(container);\n LinkUserFeature.register(container);\n CheckEmailFeature.register(container);\n UserInstallerFeature.register(container);\n CognitoIdpFeature.register(container);\n CognitoServiceFeature.register(container, {\n region: String(process.env.COGNITO_REGION),\n userPoolId: String(process.env.COGNITO_USER_POOL_ID)\n });\n\n // Register GraphQL schema\n container.register(AdminUsersSchema);\n }\n});\n"],"names":["CognitoApiFeature","createFeature","container","CreateUserFeature","UpdateUserFeature","DeleteUserFeature","ResetUserMfaFeature","LinkUserFeature","CheckEmailFeature","UserInstallerFeature","CognitoIdpFeature","CognitoServiceFeature","String","process","AdminUsersSchema"],"mappings":";;;;;;;;;;;AAYO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QAEdC,kBAAkB,QAAQ,CAACD;QAC3BE,kBAAkB,QAAQ,CAACF;QAC3BG,kBAAkB,QAAQ,CAACH;QAC3BI,oBAAoB,QAAQ,CAACJ;QAC7BK,gBAAgB,QAAQ,CAACL;QACzBM,kBAAkB,QAAQ,CAACN;QAC3BO,qBAAqB,QAAQ,CAACP;QAC9BQ,kBAAkB,QAAQ,CAACR;QAC3BS,sBAAsB,QAAQ,CAACT,WAAW;YACtC,QAAQU,OAAOC,QAAQ,GAAG,CAAC,cAAc;YACzC,YAAYD,OAAOC,QAAQ,GAAG,CAAC,oBAAoB;QACvD;QAGAX,UAAU,QAAQ,CAACY;IACvB;AACJ"}
@@ -8,6 +8,34 @@ export declare class CognitoAccountExistsError extends BaseError<{
8
8
  readonly code: "Cognito/Account/Exists";
9
9
  constructor(email: string);
10
10
  }
11
+ /**
12
+ * Error when creating a user whose email already has an account in another tenant:
13
+ * that account has to be linked to this tenant instead
14
+ */
15
+ export declare class CognitoAccountInOtherTenantError extends BaseError<{
16
+ email: string;
17
+ }> {
18
+ readonly code: "Cognito/Account/ExistsInOtherTenant";
19
+ constructor(email: string);
20
+ }
21
+ /**
22
+ * Error when linking an email that has no account in the Cognito User Pool
23
+ */
24
+ export declare class CognitoAccountNotFoundError extends BaseError<{
25
+ email: string;
26
+ }> {
27
+ readonly code: "Cognito/Account/NotFound";
28
+ constructor(email: string);
29
+ }
30
+ /**
31
+ * Error when loading an account from the Cognito User Pool fails
32
+ */
33
+ export declare class CognitoGetUserError extends BaseError<{
34
+ error: Error;
35
+ }> {
36
+ readonly code: "Cognito/User/Get";
37
+ constructor(error: Error);
38
+ }
11
39
  /**
12
40
  * Error when creating a user in Cognito fails
13
41
  */
@@ -26,6 +54,18 @@ export declare class CognitoUpdateUserError extends BaseError<{
26
54
  readonly code: "Cognito/User/Update";
27
55
  constructor(error: Error);
28
56
  }
57
+ /**
58
+ * Error when updating a user fails and some tenants' records can't be put back,
59
+ * so those records no longer match the Cognito account
60
+ */
61
+ export declare class CognitoUpdateRollbackError extends BaseError<{
62
+ error: Error;
63
+ tenants: string[];
64
+ rollbackErrors: Error[];
65
+ }> {
66
+ readonly code: "Cognito/User/UpdateRollback";
67
+ constructor(error: Error, tenants: string[], rollbackErrors: Error[]);
68
+ }
29
69
  /**
30
70
  * Error when deleting a user from Cognito fails
31
71
  */
@@ -35,3 +75,31 @@ export declare class CognitoDeleteUserError extends BaseError<{
35
75
  readonly code: "Cognito/User/Delete";
36
76
  constructor(error: Error);
37
77
  }
78
+ /**
79
+ * Error when resetting a user's MFA in Cognito fails
80
+ */
81
+ export declare class CognitoResetMfaError extends BaseError<{
82
+ error: Error;
83
+ }> {
84
+ readonly code: "Cognito/User/ResetMfa";
85
+ constructor(error: Error);
86
+ }
87
+ /**
88
+ * Error when resetting the MFA of a user who signs in through an external identity provider,
89
+ * which manages their MFA
90
+ */
91
+ export declare class CognitoExternalUserError extends BaseError<{
92
+ id: string;
93
+ }> {
94
+ readonly code: "Cognito/User/External";
95
+ constructor(id: string);
96
+ }
97
+ /**
98
+ * Error when an administrator changes the sign-in details of an account that other tenants share
99
+ */
100
+ export declare class CognitoSharedAccountError extends BaseError<{
101
+ id: string;
102
+ }> {
103
+ readonly code: "Cognito/Account/Shared";
104
+ constructor(id: string);
105
+ }
@@ -9,6 +9,36 @@ class CognitoAccountExistsError extends BaseError {
9
9
  }), this.code = "Cognito/Account/Exists";
10
10
  }
11
11
  }
12
+ class CognitoAccountInOtherTenantError extends BaseError {
13
+ constructor(email){
14
+ super({
15
+ message: "This email already has an account in another tenant. Link it instead.",
16
+ data: {
17
+ email
18
+ }
19
+ }), this.code = "Cognito/Account/ExistsInOtherTenant";
20
+ }
21
+ }
22
+ class CognitoAccountNotFoundError extends BaseError {
23
+ constructor(email){
24
+ super({
25
+ message: "There's no account with this email.",
26
+ data: {
27
+ email
28
+ }
29
+ }), this.code = "Cognito/Account/NotFound";
30
+ }
31
+ }
32
+ class CognitoGetUserError extends BaseError {
33
+ constructor(error){
34
+ super({
35
+ message: `Failed to load the account from Cognito: ${error.message}`,
36
+ data: {
37
+ error
38
+ }
39
+ }), this.code = "Cognito/User/Get";
40
+ }
41
+ }
12
42
  class CognitoCreateUserError extends BaseError {
13
43
  constructor(error){
14
44
  super({
@@ -29,6 +59,18 @@ class CognitoUpdateUserError extends BaseError {
29
59
  }), this.code = "Cognito/User/Update";
30
60
  }
31
61
  }
62
+ class CognitoUpdateRollbackError extends BaseError {
63
+ constructor(error, tenants, rollbackErrors){
64
+ super({
65
+ message: `Failed to update user: ${error.message}. The user's records in tenants ${tenants.join(", ")} could not be restored and no longer match the Cognito account.`,
66
+ data: {
67
+ error,
68
+ tenants,
69
+ rollbackErrors
70
+ }
71
+ }), this.code = "Cognito/User/UpdateRollback";
72
+ }
73
+ }
32
74
  class CognitoDeleteUserError extends BaseError {
33
75
  constructor(error){
34
76
  super({
@@ -39,6 +81,36 @@ class CognitoDeleteUserError extends BaseError {
39
81
  }), this.code = "Cognito/User/Delete";
40
82
  }
41
83
  }
42
- export { CognitoAccountExistsError, CognitoCreateUserError, CognitoDeleteUserError, CognitoUpdateUserError };
84
+ class CognitoResetMfaError extends BaseError {
85
+ constructor(error){
86
+ super({
87
+ message: `Failed to reset the user's MFA in Cognito: ${error.message}`,
88
+ data: {
89
+ error
90
+ }
91
+ }), this.code = "Cognito/User/ResetMfa";
92
+ }
93
+ }
94
+ class CognitoExternalUserError extends BaseError {
95
+ constructor(id){
96
+ super({
97
+ message: "This user signs in through an external identity provider, which manages their MFA.",
98
+ data: {
99
+ id
100
+ }
101
+ }), this.code = "Cognito/User/External";
102
+ }
103
+ }
104
+ class CognitoSharedAccountError extends BaseError {
105
+ constructor(id){
106
+ super({
107
+ message: "This person's account is also used in other tenants, so only they can change its name, email and password.",
108
+ data: {
109
+ id
110
+ }
111
+ }), this.code = "Cognito/Account/Shared";
112
+ }
113
+ }
114
+ export { CognitoAccountExistsError, CognitoAccountInOtherTenantError, CognitoAccountNotFoundError, CognitoCreateUserError, CognitoDeleteUserError, CognitoExternalUserError, CognitoGetUserError, CognitoResetMfaError, CognitoSharedAccountError, CognitoUpdateRollbackError, CognitoUpdateUserError };
43
115
 
44
116
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api/domain/errors.js","sources":["../../../src/api/domain/errors.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\n\n/**\n * Error when a user already exists in Cognito User Pool\n */\nexport class CognitoAccountExistsError extends BaseError<{ email: string }> {\n override readonly code = \"Cognito/Account/Exists\" as const;\n\n constructor(email: string) {\n super({\n message: `An account with this email already exists in your Cognito User Pool.`,\n data: { email }\n });\n }\n}\n\n/**\n * Error when creating a user in Cognito fails\n */\nexport class CognitoCreateUserError extends BaseError<{ error: Error }> {\n override readonly code = \"Cognito/User/Create\" as const;\n\n constructor(error: Error) {\n super({\n message: `Failed to create user in Cognito: ${error.message}`,\n data: { error }\n });\n }\n}\n\n/**\n * Error when updating a user in Cognito fails\n */\nexport class CognitoUpdateUserError extends BaseError<{ error: Error }> {\n override readonly code = \"Cognito/User/Update\" as const;\n\n constructor(error: Error) {\n super({\n message: `Failed to update user in Cognito: ${error.message}`,\n data: { error }\n });\n }\n}\n\n/**\n * Error when deleting a user from Cognito fails\n */\nexport class CognitoDeleteUserError extends BaseError<{ error: Error }> {\n override readonly code = \"Cognito/User/Delete\" as const;\n\n constructor(error: Error) {\n super({\n message: `Failed to delete user from Cognito: ${error.message}`,\n data: { error }\n });\n }\n}\n"],"names":["CognitoAccountExistsError","BaseError","email","CognitoCreateUserError","error","CognitoUpdateUserError","CognitoDeleteUserError"],"mappings":";AAKO,MAAMA,kCAAkCC;IAG3C,YAAYC,KAAa,CAAE;QACvB,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAMC,+BAA+BF;IAGxC,YAAYG,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,kCAAkC,EAAEA,MAAM,OAAO,EAAE;YAC7D,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAMC,+BAA+BJ;IAGxC,YAAYG,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,kCAAkC,EAAEA,MAAM,OAAO,EAAE;YAC7D,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAME,+BAA+BL;IAGxC,YAAYG,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,oCAAoC,EAAEA,MAAM,OAAO,EAAE;YAC/D,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ"}
1
+ {"version":3,"file":"api/domain/errors.js","sources":["../../../src/api/domain/errors.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\n\n/**\n * Error when a user already exists in Cognito User Pool\n */\nexport class CognitoAccountExistsError extends BaseError<{ email: string }> {\n override readonly code = \"Cognito/Account/Exists\" as const;\n\n constructor(email: string) {\n super({\n message: `An account with this email already exists in your Cognito User Pool.`,\n data: { email }\n });\n }\n}\n\n/**\n * Error when creating a user whose email already has an account in another tenant:\n * that account has to be linked to this tenant instead\n */\nexport class CognitoAccountInOtherTenantError extends BaseError<{ email: string }> {\n override readonly code = \"Cognito/Account/ExistsInOtherTenant\" as const;\n\n constructor(email: string) {\n super({\n message: `This email already has an account in another tenant. Link it instead.`,\n data: { email }\n });\n }\n}\n\n/**\n * Error when linking an email that has no account in the Cognito User Pool\n */\nexport class CognitoAccountNotFoundError extends BaseError<{ email: string }> {\n override readonly code = \"Cognito/Account/NotFound\" as const;\n\n constructor(email: string) {\n super({\n message: `There's no account with this email.`,\n data: { email }\n });\n }\n}\n\n/**\n * Error when loading an account from the Cognito User Pool fails\n */\nexport class CognitoGetUserError extends BaseError<{ error: Error }> {\n override readonly code = \"Cognito/User/Get\" as const;\n\n constructor(error: Error) {\n super({\n message: `Failed to load the account from Cognito: ${error.message}`,\n data: { error }\n });\n }\n}\n\n/**\n * Error when creating a user in Cognito fails\n */\nexport class CognitoCreateUserError extends BaseError<{ error: Error }> {\n override readonly code = \"Cognito/User/Create\" as const;\n\n constructor(error: Error) {\n super({\n message: `Failed to create user in Cognito: ${error.message}`,\n data: { error }\n });\n }\n}\n\n/**\n * Error when updating a user in Cognito fails\n */\nexport class CognitoUpdateUserError extends BaseError<{ error: Error }> {\n override readonly code = \"Cognito/User/Update\" as const;\n\n constructor(error: Error) {\n super({\n message: `Failed to update user in Cognito: ${error.message}`,\n data: { error }\n });\n }\n}\n\n/**\n * Error when updating a user fails and some tenants' records can't be put back,\n * so those records no longer match the Cognito account\n */\nexport class CognitoUpdateRollbackError extends BaseError<{\n error: Error;\n tenants: string[];\n rollbackErrors: Error[];\n}> {\n override readonly code = \"Cognito/User/UpdateRollback\" as const;\n\n constructor(error: Error, tenants: string[], rollbackErrors: Error[]) {\n super({\n message: `Failed to update user: ${error.message}. The user's records in tenants ${tenants.join(\", \")} could not be restored and no longer match the Cognito account.`,\n data: { error, tenants, rollbackErrors }\n });\n }\n}\n\n/**\n * Error when deleting a user from Cognito fails\n */\nexport class CognitoDeleteUserError extends BaseError<{ error: Error }> {\n override readonly code = \"Cognito/User/Delete\" as const;\n\n constructor(error: Error) {\n super({\n message: `Failed to delete user from Cognito: ${error.message}`,\n data: { error }\n });\n }\n}\n\n/**\n * Error when resetting a user's MFA in Cognito fails\n */\nexport class CognitoResetMfaError extends BaseError<{ error: Error }> {\n override readonly code = \"Cognito/User/ResetMfa\" as const;\n\n constructor(error: Error) {\n super({\n message: `Failed to reset the user's MFA in Cognito: ${error.message}`,\n data: { error }\n });\n }\n}\n\n/**\n * Error when resetting the MFA of a user who signs in through an external identity provider,\n * which manages their MFA\n */\nexport class CognitoExternalUserError extends BaseError<{ id: string }> {\n override readonly code = \"Cognito/User/External\" as const;\n\n constructor(id: string) {\n super({\n message: `This user signs in through an external identity provider, which manages their MFA.`,\n data: { id }\n });\n }\n}\n\n/**\n * Error when an administrator changes the sign-in details of an account that other tenants share\n */\nexport class CognitoSharedAccountError extends BaseError<{ id: string }> {\n override readonly code = \"Cognito/Account/Shared\" as const;\n\n constructor(id: string) {\n super({\n message: `This person's account is also used in other tenants, so only they can change its name, email and password.`,\n data: { id }\n });\n }\n}\n"],"names":["CognitoAccountExistsError","BaseError","email","CognitoAccountInOtherTenantError","CognitoAccountNotFoundError","CognitoGetUserError","error","CognitoCreateUserError","CognitoUpdateUserError","CognitoUpdateRollbackError","tenants","rollbackErrors","CognitoDeleteUserError","CognitoResetMfaError","CognitoExternalUserError","id","CognitoSharedAccountError"],"mappings":";AAKO,MAAMA,kCAAkCC;IAG3C,YAAYC,KAAa,CAAE;QACvB,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAMO,MAAMC,yCAAyCF;IAGlD,YAAYC,KAAa,CAAE;QACvB,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAME,oCAAoCH;IAG7C,YAAYC,KAAa,CAAE;QACvB,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAMG,4BAA4BJ;IAGrC,YAAYK,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,yCAAyC,EAAEA,MAAM,OAAO,EAAE;YACpE,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAMC,+BAA+BN;IAGxC,YAAYK,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,kCAAkC,EAAEA,MAAM,OAAO,EAAE;YAC7D,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAME,+BAA+BP;IAGxC,YAAYK,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,kCAAkC,EAAEA,MAAM,OAAO,EAAE;YAC7D,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAMO,MAAMG,mCAAmCR;IAO5C,YAAYK,KAAY,EAAEI,OAAiB,EAAEC,cAAuB,CAAE;QAClE,KAAK,CAAC;YACF,SAAS,CAAC,uBAAuB,EAAEL,MAAM,OAAO,CAAC,gCAAgC,EAAEI,QAAQ,IAAI,CAAC,MAAM,+DAA+D,CAAC;YACtK,MAAM;gBAAEJ;gBAAOI;gBAASC;YAAe;QAC3C,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAMC,+BAA+BX;IAGxC,YAAYK,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,oCAAoC,EAAEA,MAAM,OAAO,EAAE;YAC/D,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAMO,6BAA6BZ;IAGtC,YAAYK,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,2CAA2C,EAAEA,MAAM,OAAO,EAAE;YACtE,MAAM;gBAAEA;YAAM;QAClB,SANc,IAAI,GAAG;IAOzB;AACJ;AAMO,MAAMQ,iCAAiCb;IAG1C,YAAYc,EAAU,CAAE;QACpB,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBAAEA;YAAG;QACf,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAMC,kCAAkCf;IAG3C,YAAYc,EAAU,CAAE;QACpB,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBAAEA;YAAG;QACf,SANc,IAAI,GAAG;IAOzB;AACJ"}
@@ -0,0 +1,16 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { AdminUsersRepository } from "@webiny/api-core/features/users/shared/abstractions.js";
3
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
4
+ import { CheckEmailUseCase as UseCaseAbstraction } from "./abstractions.js";
5
+ import { CognitoService } from "../../../api/features/CognitoService/index.js";
6
+ declare class CheckEmailUseCaseImpl implements UseCaseAbstraction.Interface {
7
+ private identityContext;
8
+ private cognitoService;
9
+ private repository;
10
+ constructor(identityContext: IdentityContext.Interface, cognitoService: CognitoService.Interface, repository: AdminUsersRepository.Interface);
11
+ execute(email: string): Promise<Result<UseCaseAbstraction.Status, UseCaseAbstraction.Error>>;
12
+ }
13
+ export declare const CheckEmailUseCase: typeof CheckEmailUseCaseImpl & {
14
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICheckEmailUseCase>;
15
+ };
16
+ export {};