@webiny/cognito 6.4.4-beta.3 → 6.4.4-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/Cognito.d.ts +51 -0
  2. package/Cognito.js +78 -4
  3. package/Cognito.js.map +1 -1
  4. package/admin/DefaultCognitoSignInConfig.d.ts +23 -0
  5. package/admin/DefaultCognitoSignInConfig.js +51 -0
  6. package/admin/DefaultCognitoSignInConfig.js.map +1 -0
  7. package/admin/Extension.js.map +1 -1
  8. package/admin/SignInExtension.d.ts +2 -0
  9. package/admin/SignInExtension.js +9 -0
  10. package/admin/SignInExtension.js.map +1 -0
  11. package/admin/index.d.ts +2 -0
  12. package/admin/index.js +2 -0
  13. package/admin/presentation/Cognito/CognitoLoginScreen.js +9 -0
  14. package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -1
  15. package/admin/presentation/Cognito/CognitoPresenter.d.ts +25 -1
  16. package/admin/presentation/Cognito/CognitoPresenter.js +122 -10
  17. package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -1
  18. package/admin/presentation/Cognito/CognitoSignInConfig.d.ts +31 -0
  19. package/admin/presentation/Cognito/CognitoSignInConfig.js +5 -0
  20. package/admin/presentation/Cognito/CognitoSignInConfig.js.map +1 -0
  21. package/admin/presentation/Cognito/abstractions.d.ts +20 -1
  22. package/admin/presentation/Cognito/abstractions.js.map +1 -1
  23. package/admin/presentation/Cognito/components/ConfirmTotpCode.d.ts +26 -0
  24. package/admin/presentation/Cognito/components/ConfirmTotpCode.js +45 -0
  25. package/admin/presentation/Cognito/components/ConfirmTotpCode.js.map +1 -0
  26. package/admin/presentation/Cognito/components/Divider.d.ts +19 -1
  27. package/admin/presentation/Cognito/components/Divider.js +3 -2
  28. package/admin/presentation/Cognito/components/Divider.js.map +1 -1
  29. package/admin/presentation/Cognito/components/FederatedLogin.d.ts +22 -5
  30. package/admin/presentation/Cognito/components/FederatedLogin.js +19 -6
  31. package/admin/presentation/Cognito/components/FederatedLogin.js.map +1 -1
  32. package/admin/presentation/Cognito/components/FooterSignIn.d.ts +20 -3
  33. package/admin/presentation/Cognito/components/FooterSignIn.js +3 -2
  34. package/admin/presentation/Cognito/components/FooterSignIn.js.map +1 -1
  35. package/admin/presentation/Cognito/components/PasswordResetCodeSent.d.ts +19 -1
  36. package/admin/presentation/Cognito/components/PasswordResetCodeSent.js +3 -2
  37. package/admin/presentation/Cognito/components/PasswordResetCodeSent.js.map +1 -1
  38. package/admin/presentation/Cognito/components/RequestPasswordResetCode.d.ts +19 -1
  39. package/admin/presentation/Cognito/components/RequestPasswordResetCode.js +3 -2
  40. package/admin/presentation/Cognito/components/RequestPasswordResetCode.js.map +1 -1
  41. package/admin/presentation/Cognito/components/RequireNewPassword.d.ts +19 -1
  42. package/admin/presentation/Cognito/components/RequireNewPassword.js +3 -2
  43. package/admin/presentation/Cognito/components/RequireNewPassword.js.map +1 -1
  44. package/admin/presentation/Cognito/components/SetNewPassword.d.ts +19 -1
  45. package/admin/presentation/Cognito/components/SetNewPassword.js +3 -2
  46. package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -1
  47. package/admin/presentation/Cognito/components/SetupTotp.d.ts +25 -0
  48. package/admin/presentation/Cognito/components/SetupTotp.js +60 -0
  49. package/admin/presentation/Cognito/components/SetupTotp.js.map +1 -0
  50. package/admin/presentation/Cognito/components/SignIn.d.ts +19 -3
  51. package/admin/presentation/Cognito/components/SignIn.js +14 -7
  52. package/admin/presentation/Cognito/components/SignIn.js.map +1 -1
  53. package/admin/presentation/Cognito/components/index.d.ts +292 -0
  54. package/admin/presentation/Cognito/components/index.js +29 -0
  55. package/admin/presentation/Cognito/components/index.js.map +1 -0
  56. package/admin/presentation/Cognito/signInFeature.d.ts +1 -0
  57. package/admin/presentation/Cognito/signInFeature.js +11 -0
  58. package/admin/presentation/Cognito/signInFeature.js.map +1 -0
  59. package/admin/ui/views/Users/UsersForm.js +21 -15
  60. package/admin/ui/views/Users/UsersForm.js.map +1 -1
  61. package/admin/ui/views/Users/hooks/useUserForm.js +3 -1
  62. package/admin/ui/views/Users/hooks/useUserForm.js.map +1 -1
  63. package/api/features/CognitoIdp/CognitoIdentityProvider.js +15 -11
  64. package/api/features/CognitoIdp/CognitoIdentityProvider.js.map +1 -1
  65. package/api/features/CognitoIdp/abstractions.d.ts +1 -1
  66. package/api/features/CognitoIdp/abstractions.js.map +1 -1
  67. package/api/index.d.ts +1 -0
  68. package/api/index.js +1 -0
  69. package/index.d.ts +0 -1
  70. package/index.js +0 -1
  71. package/infra/CognitoFederationPulumi.d.ts +8 -0
  72. package/infra/CognitoFederationPulumi.js +17 -0
  73. package/infra/CognitoFederationPulumi.js.map +1 -0
  74. package/package.json +19 -17
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/Cognito/components/RequestPasswordResetCode.js","sources":["../../../../../src/admin/presentation/Cognito/components/RequestPasswordResetCode.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Input, Alert } from \"@webiny/admin-ui\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { RequestPasswordResetCodeVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\n\nexport interface ForgotPasswordProps {\n vm: RequestPasswordResetCodeVM;\n onRequestCode: (username: string) => void;\n onCancel: () => void;\n}\n\nexport const RequestPasswordResetCode = (props: ForgotPasswordProps) => {\n const { vm, ...actions } = props;\n\n return (\n <View.Container>\n <Form onSubmit={(data: any) => actions.onRequestCode(data.username)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n <View.Title\n title={\"Password recovery\"}\n description={\"Request a password reset code.\"}\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 <Bind\n name=\"username\"\n validators={validation.create(\"required,email\")}\n >\n <Input label={\"Email\"} />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\"flex flex-row-reverse items-center justify-between\"}\n >\n <Button\n text={\"Send me the code\"}\n onClick={submit}\n disabled={vm.isLoading}\n />\n <FooterSignIn onSignIn={actions.onCancel} />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n};\n"],"names":["RequestPasswordResetCode","props","vm","actions","View","Form","data","submit","Alert","Grid","Bind","validation","Input","Button","FooterSignIn"],"mappings":";;;;;;AAcO,MAAMA,2BAA2B,CAACC;IACrC,MAAM,EAAEC,EAAE,EAAE,GAAGC,SAAS,GAAGF;IAE3B,OAAO,WAAP,GACI,oBAACG,KAAK,SAAS,sBACX,oBAACC,MAAIA;QAAC,UAAU,CAACC,OAAcH,QAAQ,aAAa,CAACG,KAAK,QAAQ;QAAG;OAChE,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YACP,OAAO;YACP,aAAa;YAGhBF,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,oBAACC,MAAIA;YACD,MAAK;YACL,YAAYC,WAAW,MAAM,CAAC;yBAE9B,oBAACC,OAAKA;YAAC,OAAO;4BAGtB,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YACG,WAAW;yBAEX,oBAACI,QAAMA;YACH,MAAM;YACN,SAASN;YACT,UAAUL,GAAG,SAAS;0BAE1B,oBAACY,cAAYA;YAAC,UAAUX,QAAQ,QAAQ;;AAS5E"}
1
+ {"version":3,"file":"admin/presentation/Cognito/components/RequestPasswordResetCode.js","sources":["../../../../../src/admin/presentation/Cognito/components/RequestPasswordResetCode.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Input, Alert } 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 { RequestPasswordResetCodeVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\n\nexport interface ForgotPasswordProps {\n vm: RequestPasswordResetCodeVM;\n onRequestCode: (username: string) => void;\n onCancel: () => void;\n}\n\nexport const RequestPasswordResetCode = makeDecoratable(\n \"CognitoRequestPasswordResetCode\",\n (props: ForgotPasswordProps) => {\n const { vm, ...actions } = props;\n\n return (\n <View.Container>\n <Form onSubmit={(data: any) => actions.onRequestCode(data.username)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n <View.Title\n title={\"Password recovery\"}\n description={\"Request a password reset code.\"}\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 <Bind\n name=\"username\"\n validators={validation.create(\"required,email\")}\n >\n <Input label={\"Email\"} />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\n \"flex flex-row-reverse items-center justify-between\"\n }\n >\n <Button\n text={\"Send me the code\"}\n onClick={submit}\n disabled={vm.isLoading}\n />\n <FooterSignIn onSignIn={actions.onCancel} />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n }\n);\n"],"names":["RequestPasswordResetCode","makeDecoratable","props","vm","actions","View","Form","data","submit","Alert","Grid","Bind","validation","Input","Button","FooterSignIn"],"mappings":";;;;;;;AAeO,MAAMA,2BAA2BC,gBACpC,mCACA,CAACC;IACG,MAAM,EAAEC,EAAE,EAAE,GAAGC,SAAS,GAAGF;IAE3B,OAAO,WAAP,GACI,oBAACG,KAAK,SAAS,sBACX,oBAACC,MAAIA;QAAC,UAAU,CAACC,OAAcH,QAAQ,aAAa,CAACG,KAAK,QAAQ;QAAG;OAChE,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YACP,OAAO;YACP,aAAa;YAGhBF,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,oBAACC,MAAIA;YACD,MAAK;YACL,YAAYC,WAAW,MAAM,CAAC;yBAE9B,oBAACC,OAAKA;YAAC,OAAO;4BAGtB,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YACG,WACI;yBAGJ,oBAACI,QAAMA;YACH,MAAM;YACN,SAASN;YACT,UAAUL,GAAG,SAAS;0BAE1B,oBAACY,cAAYA;YAAC,UAAUX,QAAQ,QAAQ;;AAS5E"}
@@ -5,4 +5,22 @@ export interface RequireNewPasswordProps {
5
5
  onSubmit: (password: string, attributes: any) => void;
6
6
  onCancel: () => void;
7
7
  }
8
- export declare const RequireNewPassword: (props: RequireNewPasswordProps) => React.JSX.Element;
8
+ export declare const RequireNewPassword: ((props: RequireNewPasswordProps) => React.JSX.Element) & {
9
+ original: (props: RequireNewPasswordProps) => React.JSX.Element;
10
+ originalName: string;
11
+ displayName: string;
12
+ } & {
13
+ original: ((props: RequireNewPasswordProps) => React.JSX.Element) & {
14
+ original: (props: RequireNewPasswordProps) => 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: RequireNewPasswordProps) => React.JSX.Element) & {
22
+ original: (props: RequireNewPasswordProps) => React.JSX.Element;
23
+ originalName: string;
24
+ displayName: string;
25
+ }>) => (props: unknown) => React.JSX.Element;
26
+ };
@@ -1,5 +1,6 @@
1
1
  import react from "react";
2
2
  import { Button, Grid, Heading, Input } from "@webiny/admin-ui";
3
+ import { makeDecoratable } from "@webiny/app-admin";
3
4
  import { Bind, Form } from "@webiny/form";
4
5
  import { validation } from "@webiny/validation";
5
6
  import { View } from "./View.js";
@@ -7,7 +8,7 @@ const sentenceCase = (str)=>{
7
8
  const lower = str.toLowerCase();
8
9
  return lower[0].toUpperCase() + lower.substring(1);
9
10
  };
10
- const RequireNewPassword = (props)=>{
11
+ const RequireNewPassword = makeDecoratable("CognitoRequireNewPassword", (props)=>{
11
12
  const { vm, onSubmit } = props;
12
13
  return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(Form, {
13
14
  onSubmit: (data)=>onSubmit(data.password, data.requiredAttributes),
@@ -45,7 +46,7 @@ const RequireNewPassword = (props)=>{
45
46
  size: "lg",
46
47
  disabled: vm.isLoading
47
48
  })))))));
48
- };
49
+ });
49
50
  export { RequireNewPassword };
50
51
 
51
52
  //# sourceMappingURL=RequireNewPassword.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/Cognito/components/RequireNewPassword.js","sources":["../../../../../src/admin/presentation/Cognito/components/RequireNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Heading, Input } from \"@webiny/admin-ui\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { RequireNewPasswordVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nconst sentenceCase = (str: string) => {\n const lower = str.toLowerCase();\n return lower[0].toUpperCase() + lower.substring(1);\n};\n\nexport interface RequireNewPasswordProps {\n vm: RequireNewPasswordVM;\n onSubmit: (password: string, attributes: any) => void;\n onCancel: () => void;\n}\n\ntype FormData = {\n password: string;\n requiredAttributes: Record<string, string>;\n};\n\nexport const RequireNewPassword = (props: RequireNewPasswordProps) => {\n const { vm, onSubmit } = props;\n\n return (\n <View.Container>\n <Form<FormData>\n onSubmit={data => onSubmit(data.password, data.requiredAttributes)}\n submitOnEnter\n >\n {({ submit }) => (\n <View.Content>\n <View.Title title={\"Set new password\"} />\n <Grid>\n <Grid.Column span={12}>\n <Bind name=\"password\" validators={validation.create(\"required\")}>\n <Input\n type={\"password\"}\n label={\"New password\"}\n autoComplete={\"off\"}\n />\n </Bind>\n </Grid.Column>\n\n {vm.requiredAttributes.length > 0 ? (\n <>\n <Grid.Column span={12}>\n <Heading level={6} className={\"text-center\"}>\n Please enter additional information\n </Heading>\n </Grid.Column>\n {vm.requiredAttributes.map(attr => (\n <Grid.Column key={attr} span={12}>\n <Bind name={`requiredAttributes.${attr}`}>\n <Input label={sentenceCase(attr)} />\n </Bind>\n </Grid.Column>\n ))}\n </>\n ) : (\n <></>\n )}\n\n <Grid.Column span={12}>\n <div\n className={\"flex flex-row-reverse items-center justify-between\"}\n >\n <Button\n text={\"Confirm\"}\n onClick={submit}\n size=\"lg\"\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":["sentenceCase","str","lower","RequireNewPassword","props","vm","onSubmit","View","Form","data","submit","Grid","Bind","validation","Input","Heading","attr","Button"],"mappings":";;;;;AAOA,MAAMA,eAAe,CAACC;IAClB,MAAMC,QAAQD,IAAI,WAAW;IAC7B,OAAOC,KAAK,CAAC,EAAE,CAAC,WAAW,KAAKA,MAAM,SAAS,CAAC;AACpD;AAaO,MAAMC,qBAAqB,CAACC;IAC/B,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAE,GAAGF;IAEzB,OAAO,WAAP,GACI,oBAACG,KAAK,SAAS,sBACX,oBAACC,MAAIA;QACD,UAAUC,CAAAA,OAAQH,SAASG,KAAK,QAAQ,EAAEA,KAAK,kBAAkB;QACjE;OAEC,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YAAC,OAAO;0BACnB,oBAACI,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YAAC,MAAK;YAAW,YAAYC,WAAW,MAAM,CAAC;yBAChD,oBAACC,OAAKA;YACF,MAAM;YACN,OAAO;YACP,cAAc;cAKzBT,GAAG,kBAAkB,CAAC,MAAM,GAAG,IAAI,WAAJ,GAC5B,wDACI,oBAACM,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACI,SAAOA;YAAC,OAAO;YAAG,WAAW;WAAe,yCAIhDV,GAAG,kBAAkB,CAAC,GAAG,CAACW,CAAAA,OAAAA,WAAAA,GACvB,oBAACL,KAAK,MAAM;gBAAC,KAAKK;gBAAM,MAAM;6BAC1B,oBAACJ,MAAIA;gBAAC,MAAM,CAAC,mBAAmB,EAAEI,MAAM;6BACpC,oBAACF,OAAKA;gBAAC,OAAOd,aAAagB;mCAM3C,yDAGJ,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YACG,WAAW;yBAEX,oBAACM,QAAMA;YACH,MAAM;YACN,SAASP;YACT,MAAK;YACL,UAAUL,GAAG,SAAS;;AAU9D"}
1
+ {"version":3,"file":"admin/presentation/Cognito/components/RequireNewPassword.js","sources":["../../../../../src/admin/presentation/Cognito/components/RequireNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Heading, Input } 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 { RequireNewPasswordVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nconst sentenceCase = (str: string) => {\n const lower = str.toLowerCase();\n return lower[0].toUpperCase() + lower.substring(1);\n};\n\nexport interface RequireNewPasswordProps {\n vm: RequireNewPasswordVM;\n onSubmit: (password: string, attributes: any) => void;\n onCancel: () => void;\n}\n\ntype FormData = {\n password: string;\n requiredAttributes: Record<string, string>;\n};\n\nexport const RequireNewPassword = makeDecoratable(\n \"CognitoRequireNewPassword\",\n (props: RequireNewPasswordProps) => {\n const { vm, onSubmit } = props;\n\n return (\n <View.Container>\n <Form<FormData>\n onSubmit={data => onSubmit(data.password, data.requiredAttributes)}\n submitOnEnter\n >\n {({ submit }) => (\n <View.Content>\n <View.Title title={\"Set new password\"} />\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n type={\"password\"}\n label={\"New password\"}\n autoComplete={\"off\"}\n />\n </Bind>\n </Grid.Column>\n\n {vm.requiredAttributes.length > 0 ? (\n <>\n <Grid.Column span={12}>\n <Heading level={6} className={\"text-center\"}>\n Please enter additional information\n </Heading>\n </Grid.Column>\n {vm.requiredAttributes.map(attr => (\n <Grid.Column key={attr} span={12}>\n <Bind name={`requiredAttributes.${attr}`}>\n <Input label={sentenceCase(attr)} />\n </Bind>\n </Grid.Column>\n ))}\n </>\n ) : (\n <></>\n )}\n\n <Grid.Column span={12}>\n <div\n className={\n \"flex flex-row-reverse items-center justify-between\"\n }\n >\n <Button\n text={\"Confirm\"}\n onClick={submit}\n size=\"lg\"\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"],"names":["sentenceCase","str","lower","RequireNewPassword","makeDecoratable","props","vm","onSubmit","View","Form","data","submit","Grid","Bind","validation","Input","Heading","attr","Button"],"mappings":";;;;;;AAQA,MAAMA,eAAe,CAACC;IAClB,MAAMC,QAAQD,IAAI,WAAW;IAC7B,OAAOC,KAAK,CAAC,EAAE,CAAC,WAAW,KAAKA,MAAM,SAAS,CAAC;AACpD;AAaO,MAAMC,qBAAqBC,gBAC9B,6BACA,CAACC;IACG,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAE,GAAGF;IAEzB,OAAO,WAAP,GACI,oBAACG,KAAK,SAAS,sBACX,oBAACC,MAAIA;QACD,UAAUC,CAAAA,OAAQH,SAASG,KAAK,QAAQ,EAAEA,KAAK,kBAAkB;QACjE;OAEC,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YAAC,OAAO;0BACnB,oBAACI,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YACD,MAAK;YACL,YAAYC,WAAW,MAAM,CAAC;yBAE9B,oBAACC,OAAKA;YACF,MAAM;YACN,OAAO;YACP,cAAc;cAKzBT,GAAG,kBAAkB,CAAC,MAAM,GAAG,IAAI,WAAJ,GAC5B,wDACI,oBAACM,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACI,SAAOA;YAAC,OAAO;YAAG,WAAW;WAAe,yCAIhDV,GAAG,kBAAkB,CAAC,GAAG,CAACW,CAAAA,OAAAA,WAAAA,GACvB,oBAACL,KAAK,MAAM;gBAAC,KAAKK;gBAAM,MAAM;6BAC1B,oBAACJ,MAAIA;gBAAC,MAAM,CAAC,mBAAmB,EAAEI,MAAM;6BACpC,oBAACF,OAAKA;gBAAC,OAAOf,aAAaiB;mCAM3C,yDAGJ,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YACG,WACI;yBAGJ,oBAACM,QAAMA;YACH,MAAM;YACN,SAASP;YACT,MAAK;YACL,UAAUL,GAAG,SAAS;;AAU9D"}
@@ -5,4 +5,22 @@ export interface SetNewPasswordProps {
5
5
  onSetNewPassword: (code: string, password: string) => void;
6
6
  onCancel: () => void;
7
7
  }
8
- export declare const SetNewPassword: (props: SetNewPasswordProps) => React.JSX.Element;
8
+ export declare const SetNewPassword: ((props: SetNewPasswordProps) => React.JSX.Element) & {
9
+ original: (props: SetNewPasswordProps) => React.JSX.Element;
10
+ originalName: string;
11
+ displayName: string;
12
+ } & {
13
+ original: ((props: SetNewPasswordProps) => React.JSX.Element) & {
14
+ original: (props: SetNewPasswordProps) => 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: SetNewPasswordProps) => React.JSX.Element) & {
22
+ original: (props: SetNewPasswordProps) => React.JSX.Element;
23
+ originalName: string;
24
+ displayName: string;
25
+ }>) => (props: unknown) => React.JSX.Element;
26
+ };
@@ -1,11 +1,12 @@
1
1
  import react from "react";
2
2
  import { Alert, Button, Grid, Input } from "@webiny/admin-ui";
3
+ import { makeDecoratable } from "@webiny/app-admin";
3
4
  import { Bind, Form, useForm } from "@webiny/form";
4
5
  import { validation } from "@webiny/validation";
5
6
  import { View } from "./View.js";
6
7
  import { FooterSignIn } from "./FooterSignIn.js";
7
8
  import { usePasswordValidator } from "../../shared/usePasswordValidator.js";
8
- const SetNewPassword = (props)=>{
9
+ const SetNewPassword = makeDecoratable("CognitoSetNewPassword", (props)=>{
9
10
  const { vm, onSetNewPassword, onCancel } = props;
10
11
  const passwordValidator = usePasswordValidator();
11
12
  return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(Form, {
@@ -54,7 +55,7 @@ const SetNewPassword = (props)=>{
54
55
  containerClassName: "ml-auto",
55
56
  disabled: vm.isLoading
56
57
  })))))));
57
- };
58
+ });
58
59
  const RetypePassword = ()=>{
59
60
  const form = useForm();
60
61
  const matchOriginalValidator = (value)=>{
@@ -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 { 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 { usePasswordValidator } from \"~/admin/presentation/shared/usePasswordValidator.js\";\n\nexport interface SetNewPasswordProps {\n vm: SetNewPasswordVM;\n onSetNewPassword: (code: string, password: string) => void;\n onCancel: () => void;\n}\n\nexport const SetNewPassword = (props: SetNewPasswordProps) => {\n const { vm, onSetNewPassword, onCancel } = props;\n const passwordValidator = usePasswordValidator();\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={[validation.create(\"required\"), passwordValidator]}\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\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","props","vm","onSetNewPassword","onCancel","passwordValidator","usePasswordValidator","View","Form","data","submit","Alert","Grid","Bind","validation","Input","RetypePassword","FooterSignIn","Button","form","useForm","matchOriginalValidator","value","Error"],"mappings":";;;;;;;AAeO,MAAMA,iBAAiB,CAACC;IAC3B,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGH;IAC3C,MAAMI,oBAAoBC;IAE1B,OAAO,WAAP,GACI,oBAACC,KAAK,SAAS,sBACX,oBAACC,MAAIA;QACD,UAAU,CAACC,OAAcN,iBAAiBM,KAAK,IAAI,EAAEA,KAAK,QAAQ;QAClE;OAEC,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YAAC,OAAO;YAElBL,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACS,OAAKA;YAAC,OAAOT,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACU,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;gBAACC,WAAW,MAAM,CAAC;gBAAaT;aAAkB;yBAE9D,oBAACU,OAAKA;YACF,MAAM;YACN,OAAO;YACP,aAAa;YACb,cAAc;4BAI1B,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACI,gBAAcA,QAAAA,WAAAA,GAEnB,oBAACJ,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAACK,cAAYA;YAAC,UAAUb;0BACxB,oBAACc,QAAMA;YACH,MAAM;YACN,SAASR;YACT,oBAAoB;YACpB,UAAUR,GAAG,SAAS;;AAU9D;AAEA,MAAMc,iBAAiB;IACnB,MAAMG,OAAOC;IACb,MAAMC,yBAAyB,CAACC;QAC5B,IAAIA,UAAUH,KAAK,QAAQ,CAAC,aACxB,MAAMI,MAAM;IAEpB;IAEA,OAAO,WAAP,GACI,oBAACV,MAAIA;QACD,MAAK;QACL,YAAY;YAACC,WAAW,MAAM,CAAC;YAAaO;SAAuB;qBAEnE,oBAACN,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 { usePasswordValidator } from \"~/admin/presentation/shared/usePasswordValidator.js\";\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 passwordValidator = usePasswordValidator();\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 passwordValidator\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","passwordValidator","usePasswordValidator","View","Form","data","submit","Alert","Grid","Bind","validation","Input","RetypePassword","FooterSignIn","Button","form","useForm","matchOriginalValidator","value","Error"],"mappings":";;;;;;;;AAgBO,MAAMA,iBAAiBC,gBAC1B,yBACA,CAACC;IACG,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGH;IAC3C,MAAMI,oBAAoBC;IAE1B,OAAO,WAAP,GACI,oBAACC,KAAK,SAAS,sBACX,oBAACC,MAAIA;QACD,UAAU,CAACC,OAAcN,iBAAiBM,KAAK,IAAI,EAAEA,KAAK,QAAQ;QAClE;OAEC,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YAAC,OAAO;YAElBL,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACS,OAAKA;YAAC,OAAOT,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACU,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;gBAClBT;aACH;yBAED,oBAACU,OAAKA;YACF,MAAM;YACN,OAAO;YACP,aAAa;YACb,cAAc;4BAI1B,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACI,gBAAcA,QAAAA,WAAAA,GAEnB,oBAACJ,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAACK,cAAYA;YAAC,UAAUb;0BACxB,oBAACc,QAAMA;YACH,MAAM;YACN,SAASR;YACT,oBAAoB;YACpB,UAAUR,GAAG,SAAS;;AAU9D;AAGJ,MAAMc,iBAAiB;IACnB,MAAMG,OAAOC;IACb,MAAMC,yBAAyB,CAACC;QAC5B,IAAIA,UAAUH,KAAK,QAAQ,CAAC,aACxB,MAAMI,MAAM;IAEpB;IAEA,OAAO,WAAP,GACI,oBAACV,MAAIA;QACD,MAAK;QACL,YAAY;YAACC,WAAW,MAAM,CAAC;YAAaO;SAAuB;qBAEnE,oBAACN,OAAKA;QACF,MAAM;QACN,OAAO;QACP,aAAa;QACb,cAAc;;AAI9B"}
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import type { SetupTotpVM } from "../../../../admin/presentation/Cognito/abstractions.js";
3
+ export interface SetupTotpProps {
4
+ vm: SetupTotpVM;
5
+ onSubmit: (code: string) => void;
6
+ }
7
+ export declare const SetupTotp: ((props: SetupTotpProps) => React.JSX.Element) & {
8
+ original: (props: SetupTotpProps) => React.JSX.Element;
9
+ originalName: string;
10
+ displayName: string;
11
+ } & {
12
+ original: ((props: SetupTotpProps) => React.JSX.Element) & {
13
+ original: (props: SetupTotpProps) => React.JSX.Element;
14
+ originalName: string;
15
+ displayName: string;
16
+ };
17
+ originalName: string;
18
+ displayName: string;
19
+ } & {
20
+ createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<((props: SetupTotpProps) => React.JSX.Element) & {
21
+ original: (props: SetupTotpProps) => React.JSX.Element;
22
+ originalName: string;
23
+ displayName: string;
24
+ }>) => (props: unknown) => React.JSX.Element;
25
+ };
@@ -0,0 +1,60 @@
1
+ import react from "react";
2
+ import { Alert, Button, Grid, Input, Text } from "@webiny/admin-ui";
3
+ import { makeDecoratable } from "@webiny/app-admin";
4
+ import { Bind, Form } from "@webiny/form";
5
+ import { validation } from "@webiny/validation";
6
+ import { View } from "./View.js";
7
+ const SetupTotp = makeDecoratable("CognitoSetupTotp", (props)=>{
8
+ const { vm, onSubmit } = props;
9
+ return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(Form, {
10
+ onSubmit: (data)=>onSubmit(data.code),
11
+ submitOnEnter: true
12
+ }, ({ submit })=>/*#__PURE__*/ react.createElement(View.Content, null, /*#__PURE__*/ react.createElement(View.Title, {
13
+ title: "Set up two-factor authentication",
14
+ description: "Scan the QR code with your authenticator app (Google Authenticator, Authy, etc.), then enter the 6-digit code to verify."
15
+ }), vm.message && /*#__PURE__*/ react.createElement("div", {
16
+ className: "mb-lg"
17
+ }, /*#__PURE__*/ react.createElement(Alert, {
18
+ title: vm.message.title,
19
+ type: vm.message.type
20
+ }, vm.message.text)), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
21
+ span: 12
22
+ }, /*#__PURE__*/ react.createElement("div", {
23
+ 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
29
+ }))), /*#__PURE__*/ react.createElement(Grid.Column, {
30
+ span: 12
31
+ }, /*#__PURE__*/ react.createElement(Text, {
32
+ size: "sm",
33
+ className: "text-neutral-strong"
34
+ }, "Can't scan the code? Enter this key manually:"), /*#__PURE__*/ react.createElement(Text, {
35
+ as: "div",
36
+ size: "sm",
37
+ className: "font-mono mt-xs select-all break-all"
38
+ }, vm.sharedSecret)), /*#__PURE__*/ react.createElement(Grid.Column, {
39
+ span: 12
40
+ }, /*#__PURE__*/ react.createElement(Bind, {
41
+ name: "code",
42
+ validators: validation.create("required")
43
+ }, /*#__PURE__*/ react.createElement(Input, {
44
+ label: "Verification Code",
45
+ description: "Enter the 6-digit code from your authenticator app.",
46
+ autoComplete: "one-time-code",
47
+ inputMode: "numeric"
48
+ }))), /*#__PURE__*/ react.createElement(Grid.Column, {
49
+ span: 12
50
+ }, /*#__PURE__*/ react.createElement("div", {
51
+ className: "flex justify-end"
52
+ }, /*#__PURE__*/ react.createElement(Button, {
53
+ text: "Verify & Enable",
54
+ onClick: submit,
55
+ disabled: vm.isLoading
56
+ })))))));
57
+ });
58
+ export { SetupTotp };
59
+
60
+ //# sourceMappingURL=SetupTotp.js.map
@@ -0,0 +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"}
@@ -4,7 +4,23 @@ export interface SignInProps {
4
4
  vm: SignInVM;
5
5
  onSubmit: (username: string, password: string) => void;
6
6
  onForgotPassword: () => void;
7
- title?: string;
8
- description?: React.ReactNode;
9
7
  }
10
- export declare const SignIn: (props: SignInProps) => React.JSX.Element;
8
+ export declare const SignIn: ((props: SignInProps) => React.JSX.Element) & {
9
+ original: (props: SignInProps) => React.JSX.Element;
10
+ originalName: string;
11
+ displayName: string;
12
+ } & {
13
+ original: ((props: SignInProps) => React.JSX.Element) & {
14
+ original: (props: SignInProps) => 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: SignInProps) => React.JSX.Element) & {
22
+ original: (props: SignInProps) => React.JSX.Element;
23
+ originalName: string;
24
+ displayName: string;
25
+ }>) => (props: unknown) => React.JSX.Element;
26
+ };
@@ -2,23 +2,28 @@ import react from "react";
2
2
  import { Alert, Button, Grid, Input, Link, OverlayLoader, Text } from "@webiny/admin-ui";
3
3
  import { Bind, Form } from "@webiny/form";
4
4
  import { validation } from "@webiny/validation";
5
+ import { makeDecoratable } from "@webiny/app-admin";
5
6
  import { View } from "./View.js";
6
- const SignIn = (props)=>{
7
- const { vm, onSubmit, onForgotPassword, title = "Sign in", description } = props;
7
+ import { FederatedLogin } from "./FederatedLogin.js";
8
+ import { Divider } from "./Divider.js";
9
+ const SignIn = makeDecoratable("CognitoSignIn", (props)=>{
10
+ const { vm, onSubmit, onForgotPassword } = props;
11
+ const showCredentials = vm.allowCredentialsLogin;
12
+ const showFederated = vm.federatedProviders.length > 0;
8
13
  return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(Form, {
9
14
  onSubmit: (data)=>onSubmit(data.username, data.password),
10
15
  submitOnEnter: true
11
16
  }, ({ submit })=>/*#__PURE__*/ react.createElement(View.Content, null, vm.isLoading ? /*#__PURE__*/ react.createElement(OverlayLoader, {
12
17
  text: "Authenticating..."
13
18
  }) : null, /*#__PURE__*/ react.createElement(View.Title, {
14
- title: title,
15
- description: description
19
+ title: vm.title,
20
+ description: vm.description
16
21
  }), vm.message && /*#__PURE__*/ react.createElement("div", {
17
22
  className: "mb-lg"
18
23
  }, /*#__PURE__*/ react.createElement(Alert, {
19
24
  title: vm.message.title,
20
25
  type: vm.message.type
21
- }, vm.message.text)), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
26
+ }, vm.message.text)), showCredentials && /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
22
27
  span: 12
23
28
  }, /*#__PURE__*/ react.createElement(Bind, {
24
29
  name: "username",
@@ -50,8 +55,10 @@ const SignIn = (props)=>{
50
55
  }, /*#__PURE__*/ react.createElement(Link, {
51
56
  to: "#",
52
57
  onClick: onForgotPassword
53
- }, "Forgot password?"))))))));
54
- };
58
+ }, "Forgot password?"))))), showCredentials && showFederated && /*#__PURE__*/ react.createElement(Divider, null), showFederated && /*#__PURE__*/ react.createElement(FederatedLogin, {
59
+ providers: vm.federatedProviders
60
+ }))));
61
+ });
55
62
  export { SignIn };
56
63
 
57
64
  //# sourceMappingURL=SignIn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/Cognito/components/SignIn.js","sources":["../../../../../src/admin/presentation/Cognito/components/SignIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { Grid, Input, Alert, Link, Button, Text, OverlayLoader } from \"@webiny/admin-ui\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { SignInVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nexport interface SignInProps {\n vm: SignInVM;\n onSubmit: (username: string, password: string) => void;\n onForgotPassword: () => void;\n title?: string;\n description?: React.ReactNode;\n}\n\nexport const SignIn = (props: SignInProps) => {\n const { vm, onSubmit, onForgotPassword, title = \"Sign in\", description } = props;\n\n return (\n <View.Container>\n <Form onSubmit={(data: any) => onSubmit(data.username, data.password)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n {vm.isLoading ? <OverlayLoader text={\"Authenticating...\"} /> : null}\n <View.Title title={title} description={description} />\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\n name=\"username\"\n validators={validation.create(\"required,email\")}\n beforeChange={(val: string, cb: (value: string) => void) =>\n cb(val.toLowerCase())\n }\n >\n <Input label={\"Email\"} />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name=\"password\" validators={validation.create(\"required\")}>\n <Input\n type={\"password\"}\n label={\"Password\"}\n autoComplete={\"off\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\"flex flex-row-reverse items-center justify-between\"}\n >\n <Button\n text={\"Submit\"}\n data-testid=\"submit-sign-in-form-button\"\n onClick={submit}\n disabled={vm.isLoading}\n />\n <Text as={\"div\"} size={\"sm\"}>\n <Link to=\"#\" onClick={onForgotPassword}>\n Forgot password?\n </Link>\n </Text>\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n};\n"],"names":["SignIn","props","vm","onSubmit","onForgotPassword","title","description","View","Form","data","submit","OverlayLoader","Alert","Grid","Bind","validation","val","cb","Input","Button","Text","Link"],"mappings":";;;;;AAeO,MAAMA,SAAS,CAACC;IACnB,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,gBAAgB,EAAEC,QAAQ,SAAS,EAAEC,WAAW,EAAE,GAAGL;IAE3E,OAAO,WAAP,GACI,oBAACM,KAAK,SAAS,sBACX,oBAACC,MAAIA;QAAC,UAAU,CAACC,OAAcN,SAASM,KAAK,QAAQ,EAAEA,KAAK,QAAQ;QAAG;OAClE,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,QACRL,GAAG,SAAS,GAAG,WAAH,GAAG,oBAACS,eAAaA;YAAC,MAAM;aAA0B,oBAC/D,oBAACJ,KAAK,KAAK;YAAC,OAAOF;YAAO,aAAaC;YAEtCJ,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;YACD,MAAK;YACL,YAAYC,WAAW,MAAM,CAAC;YAC9B,cAAc,CAACC,KAAaC,KACxBA,GAAGD,IAAI,WAAW;yBAGtB,oBAACE,OAAKA;YAAC,OAAO;4BAGtB,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YAAC,MAAK;YAAW,YAAYC,WAAW,MAAM,CAAC;yBAChD,oBAACG,OAAKA;YACF,MAAM;YACN,OAAO;YACP,cAAc;4BAI1B,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YACG,WAAW;yBAEX,oBAACM,QAAMA;YACH,MAAM;YACN,eAAY;YACZ,SAAST;YACT,UAAUR,GAAG,SAAS;0BAE1B,oBAACkB,MAAIA;YAAC,IAAI;YAAO,MAAM;yBACnB,oBAACC,MAAIA;YAAC,IAAG;YAAI,SAASjB;WAAkB;AAYhF"}
1
+ {"version":3,"file":"admin/presentation/Cognito/components/SignIn.js","sources":["../../../../../src/admin/presentation/Cognito/components/SignIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { Grid, Input, Alert, Link, Button, Text, OverlayLoader } from \"@webiny/admin-ui\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { View } from \"./View.js\";\nimport { FederatedLogin } from \"./FederatedLogin.js\";\nimport { Divider } from \"./Divider.js\";\nimport type { SignInVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nexport interface SignInProps {\n vm: SignInVM;\n onSubmit: (username: string, password: string) => void;\n onForgotPassword: () => void;\n}\n\nexport const SignIn = makeDecoratable(\"CognitoSignIn\", (props: SignInProps) => {\n const { vm, onSubmit, onForgotPassword } = props;\n const showCredentials = vm.allowCredentialsLogin;\n const showFederated = vm.federatedProviders.length > 0;\n\n return (\n <View.Container>\n <Form onSubmit={(data: any) => onSubmit(data.username, data.password)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n {vm.isLoading ? <OverlayLoader text={\"Authenticating...\"} /> : null}\n <View.Title title={vm.title} description={vm.description} />\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 {showCredentials && (\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name=\"username\"\n validators={validation.create(\"required,email\")}\n beforeChange={(val: string, cb: (value: string) => void) =>\n cb(val.toLowerCase())\n }\n >\n <Input label={\"Email\"} />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n type={\"password\"}\n label={\"Password\"}\n autoComplete={\"off\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\n \"flex flex-row-reverse items-center justify-between\"\n }\n >\n <Button\n text={\"Submit\"}\n data-testid=\"submit-sign-in-form-button\"\n onClick={submit}\n disabled={vm.isLoading}\n />\n <Text as={\"div\"} size={\"sm\"}>\n <Link to=\"#\" onClick={onForgotPassword}>\n Forgot password?\n </Link>\n </Text>\n </div>\n </Grid.Column>\n </Grid>\n )}\n\n {showCredentials && showFederated && <Divider />}\n\n {showFederated && <FederatedLogin providers={vm.federatedProviders} />}\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n});\n"],"names":["SignIn","makeDecoratable","props","vm","onSubmit","onForgotPassword","showCredentials","showFederated","View","Form","data","submit","OverlayLoader","Alert","Grid","Bind","validation","val","cb","Input","Button","Text","Link","Divider","FederatedLogin"],"mappings":";;;;;;;;AAgBO,MAAMA,SAASC,gBAAgB,iBAAiB,CAACC;IACpD,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGH;IAC3C,MAAMI,kBAAkBH,GAAG,qBAAqB;IAChD,MAAMI,gBAAgBJ,GAAG,kBAAkB,CAAC,MAAM,GAAG;IAErD,OAAO,WAAP,GACI,oBAACK,KAAK,SAAS,sBACX,oBAACC,MAAIA;QAAC,UAAU,CAACC,OAAcN,SAASM,KAAK,QAAQ,EAAEA,KAAK,QAAQ;QAAG;OAClE,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,QACRL,GAAG,SAAS,GAAG,WAAH,GAAG,oBAACS,eAAaA;YAAC,MAAM;aAA0B,oBAC/D,oBAACJ,KAAK,KAAK;YAAC,OAAOL,GAAG,KAAK;YAAE,aAAaA,GAAG,WAAW;YAEvDA,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,IAK3BG,mBAAmB,WAAnBA,GACG,oBAACQ,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YACD,MAAK;YACL,YAAYC,WAAW,MAAM,CAAC;YAC9B,cAAc,CAACC,KAAaC,KACxBA,GAAGD,IAAI,WAAW;yBAGtB,oBAACE,OAAKA;YAAC,OAAO;4BAGtB,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YACD,MAAK;YACL,YAAYC,WAAW,MAAM,CAAC;yBAE9B,oBAACG,OAAKA;YACF,MAAM;YACN,OAAO;YACP,cAAc;4BAI1B,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YACG,WACI;yBAGJ,oBAACM,QAAMA;YACH,MAAM;YACN,eAAY;YACZ,SAAST;YACT,UAAUR,GAAG,SAAS;0BAE1B,oBAACkB,MAAIA;YAAC,IAAI;YAAO,MAAM;yBACnB,oBAACC,MAAIA;YAAC,IAAG;YAAI,SAASjB;WAAkB,yBAS3DC,mBAAmBC,iBAAiB,WAAjBA,GAAiB,oBAACgB,SAAOA,OAE5ChB,iBAAiB,WAAjBA,GAAiB,oBAACiB,gBAAcA;YAAC,WAAWrB,GAAG,kBAAkB;;AAM1F"}