@webiny/app-admin-cognito 0.0.0-mt-2 → 0.0.0-unstable.5e7233243f

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.
@@ -1,15 +1,33 @@
1
- import * as React from "react";
2
- import { Form } from "@webiny/form";
3
- import { validation } from "@webiny/validation";
4
- import { ButtonPrimary } from "@webiny/ui/Button";
5
- import { Input } from "@webiny/ui/Input";
6
- import { Grid, Cell } from "@webiny/ui/Grid";
7
- import { Typography } from "@webiny/ui/Typography";
8
- import { Elevation } from "@webiny/ui/Elevation";
9
- import { useAuthenticator } from "@webiny/app-cognito-authenticator/hooks/useAuthenticator";
10
- import { useRequireNewPassword } from "@webiny/app-cognito-authenticator/hooks/useRequireNewPassword";
11
- import StateContainer from "./StateContainer";
12
- import { alignRight, InnerContent, Title } from "./StyledComponents";
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _form = require("@webiny/form");
13
+
14
+ var _validation = require("@webiny/validation");
15
+
16
+ var _Button = require("@webiny/ui/Button");
17
+
18
+ var _Input = require("@webiny/ui/Input");
19
+
20
+ var _Grid = require("@webiny/ui/Grid");
21
+
22
+ var _Typography = require("@webiny/ui/Typography");
23
+
24
+ var _Elevation = require("@webiny/ui/Elevation");
25
+
26
+ var _useRequireNewPassword = require("@webiny/app-cognito-authenticator/hooks/useRequireNewPassword");
27
+
28
+ var _StateContainer = _interopRequireDefault(require("./StateContainer"));
29
+
30
+ var _StyledComponents = require("./StyledComponents");
13
31
 
14
32
  var sentenceCase = function sentenceCase(str) {
15
33
  var lower = str.toLowerCase();
@@ -17,19 +35,16 @@ var sentenceCase = function sentenceCase(str) {
17
35
  };
18
36
 
19
37
  var RequireNewPassword = function RequireNewPassword() {
20
- var _useAuthenticator = useAuthenticator(),
21
- checkingUser = _useAuthenticator.checkingUser;
22
-
23
- var _useRequireNewPasswor = useRequireNewPassword(),
38
+ var _useRequireNewPasswor = (0, _useRequireNewPassword.useRequireNewPassword)(),
24
39
  shouldRender = _useRequireNewPasswor.shouldRender,
25
40
  requiredAttributes = _useRequireNewPasswor.requiredAttributes,
26
41
  confirm = _useRequireNewPasswor.confirm;
27
42
 
28
- if (!shouldRender || checkingUser) {
43
+ if (!shouldRender) {
29
44
  return null;
30
45
  }
31
46
 
32
- return /*#__PURE__*/React.createElement(StateContainer, null, /*#__PURE__*/React.createElement(Form, {
47
+ return /*#__PURE__*/_react.default.createElement(_StateContainer.default, null, /*#__PURE__*/_react.default.createElement(_form.Form, {
33
48
  onSubmit: function onSubmit(_ref) {
34
49
  var password = _ref.password,
35
50
  requiredAttributes = _ref.requiredAttributes;
@@ -42,39 +57,43 @@ var RequireNewPassword = function RequireNewPassword() {
42
57
  }, function (_ref2) {
43
58
  var Bind = _ref2.Bind,
44
59
  submit = _ref2.submit;
45
- return /*#__PURE__*/React.createElement(Elevation, {
60
+ return /*#__PURE__*/_react.default.createElement(_Elevation.Elevation, {
46
61
  z: 2
47
- }, /*#__PURE__*/React.createElement(InnerContent, null, /*#__PURE__*/React.createElement(Title, null, /*#__PURE__*/React.createElement(Typography, {
62
+ }, /*#__PURE__*/_react.default.createElement(_StyledComponents.InnerContent, null, /*#__PURE__*/_react.default.createElement(_StyledComponents.Title, null, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
48
63
  use: "headline4"
49
- }, "Set New Password")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
64
+ }, "Set New Password")), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
50
65
  span: 12
51
- }, /*#__PURE__*/React.createElement(Bind, {
66
+ }, /*#__PURE__*/_react.default.createElement(Bind, {
52
67
  name: "password",
53
- validators: validation.create("required")
54
- }, /*#__PURE__*/React.createElement(Input, {
68
+ validators: _validation.validation.create("required")
69
+ }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
55
70
  type: "password",
56
71
  label: "New password",
57
72
  outlined: true
58
- })))), requiredAttributes.length > 0 && /*#__PURE__*/React.createElement(Title, null, /*#__PURE__*/React.createElement(Typography, {
73
+ })))), requiredAttributes.length > 0 && /*#__PURE__*/_react.default.createElement(_StyledComponents.Title, null, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
59
74
  use: "headline6"
60
- }, "Please enter additional information")), /*#__PURE__*/React.createElement(Grid, null, requiredAttributes.map(function (name) {
61
- return /*#__PURE__*/React.createElement(Cell, {
75
+ }, "Please enter additional information")), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, requiredAttributes.map(function (name) {
76
+ return /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
62
77
  key: name,
63
78
  span: 12
64
- }, /*#__PURE__*/React.createElement(Bind, {
79
+ }, /*#__PURE__*/_react.default.createElement(Bind, {
65
80
  name: name,
66
- validators: validation.create("required")
67
- }, /*#__PURE__*/React.createElement(Input, {
81
+ validators: _validation.validation.create("required")
82
+ }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
68
83
  label: sentenceCase(name),
69
84
  outlined: true
70
85
  })));
71
- })), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
86
+ })), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
72
87
  span: 12,
73
- className: alignRight
74
- }, /*#__PURE__*/React.createElement(ButtonPrimary, {
75
- onClick: submit
88
+ className: _StyledComponents.alignRight
89
+ }, /*#__PURE__*/_react.default.createElement(_Button.ButtonPrimary, {
90
+ "data-testid": "submit-sign-in-form-button",
91
+ onClick: function onClick(ev) {
92
+ submit(ev);
93
+ }
76
94
  }, "Set password")))));
77
95
  }));
78
96
  };
79
97
 
80
- export default RequireNewPassword;
98
+ var _default = RequireNewPassword;
99
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sentenceCase","str","lower","toLowerCase","toUpperCase","substring","RequireNewPassword","useRequireNewPassword","shouldRender","requiredAttributes","confirm","password","Bind","submit","validation","create","length","map","name","alignRight","ev"],"sources":["RequireNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { useRequireNewPassword } from \"@webiny/app-cognito-authenticator/hooks/useRequireNewPassword\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title } from \"./StyledComponents\";\n\nconst sentenceCase = (str: string) => {\n const lower = str.toLowerCase();\n return lower[0].toUpperCase() + lower.substring(1);\n};\n\nconst RequireNewPassword: React.FC = () => {\n const { shouldRender, requiredAttributes, confirm } = useRequireNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={({ password, requiredAttributes }) =>\n confirm({ password, requiredAttributes })\n }\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n <Title>\n <Typography use=\"headline4\">Set New Password</Typography>\n </Title>\n\n <Grid>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n type={\"password\"}\n label={\"New password\"}\n outlined={true}\n />\n </Bind>\n </Cell>\n </Grid>\n {requiredAttributes.length > 0 && (\n <Title>\n <Typography use=\"headline6\">\n Please enter additional information\n </Typography>\n </Title>\n )}\n <Grid>\n {requiredAttributes.map(name => (\n <Cell key={name} span={12}>\n <Bind\n name={name}\n validators={validation.create(\"required\")}\n >\n <Input label={sentenceCase(name)} outlined={true} />\n </Bind>\n </Cell>\n ))}\n </Grid>\n\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-sign-in-form-button\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Set password\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default RequireNewPassword;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,GAAD,EAAiB;EAClC,IAAMC,KAAK,GAAGD,GAAG,CAACE,WAAJ,EAAd;EACA,OAAOD,KAAK,CAAC,CAAD,CAAL,CAASE,WAAT,KAAyBF,KAAK,CAACG,SAAN,CAAgB,CAAhB,CAAhC;AACH,CAHD;;AAKA,IAAMC,kBAA4B,GAAG,SAA/BA,kBAA+B,GAAM;EACvC,4BAAsD,IAAAC,4CAAA,GAAtD;EAAA,IAAQC,YAAR,yBAAQA,YAAR;EAAA,IAAsBC,kBAAtB,yBAAsBA,kBAAtB;EAAA,IAA0CC,OAA1C,yBAA0CA,OAA1C;;EAEA,IAAI,CAACF,YAAL,EAAmB;IACf,OAAO,IAAP;EACH;;EAED,oBACI,6BAAC,uBAAD,qBACI,6BAAC,UAAD;IACI,QAAQ,EAAE;MAAA,IAAGG,QAAH,QAAGA,QAAH;MAAA,IAAaF,kBAAb,QAAaA,kBAAb;MAAA,OACNC,OAAO,CAAC;QAAEC,QAAQ,EAARA,QAAF;QAAYF,kBAAkB,EAAlBA;MAAZ,CAAD,CADD;IAAA,CADd;IAII,aAAa;EAJjB,GAMK;IAAA,IAAGG,IAAH,SAAGA,IAAH;IAAA,IAASC,MAAT,SAASA,MAAT;IAAA,oBACG,6BAAC,oBAAD;MAAW,CAAC,EAAE;IAAd,gBACI,6BAAC,8BAAD,qBACI,6BAAC,uBAAD,qBACI,6BAAC,sBAAD;MAAY,GAAG,EAAC;IAAhB,sBADJ,CADJ,eAKI,6BAAC,UAAD,qBACI,6BAAC,UAAD;MAAM,IAAI,EAAE;IAAZ,gBACI,6BAAC,IAAD;MACI,IAAI,EAAC,UADT;MAEI,UAAU,EAAEC,sBAAA,CAAWC,MAAX,CAAkB,UAAlB;IAFhB,gBAII,6BAAC,YAAD;MACI,IAAI,EAAE,UADV;MAEI,KAAK,EAAE,cAFX;MAGI,QAAQ,EAAE;IAHd,EAJJ,CADJ,CADJ,CALJ,EAmBKN,kBAAkB,CAACO,MAAnB,GAA4B,CAA5B,iBACG,6BAAC,uBAAD,qBACI,6BAAC,sBAAD;MAAY,GAAG,EAAC;IAAhB,yCADJ,CApBR,eA0BI,6BAAC,UAAD,QACKP,kBAAkB,CAACQ,GAAnB,CAAuB,UAAAC,IAAI;MAAA,oBACxB,6BAAC,UAAD;QAAM,GAAG,EAAEA,IAAX;QAAiB,IAAI,EAAE;MAAvB,gBACI,6BAAC,IAAD;QACI,IAAI,EAAEA,IADV;QAEI,UAAU,EAAEJ,sBAAA,CAAWC,MAAX,CAAkB,UAAlB;MAFhB,gBAII,6BAAC,YAAD;QAAO,KAAK,EAAEf,YAAY,CAACkB,IAAD,CAA1B;QAAkC,QAAQ,EAAE;MAA5C,EAJJ,CADJ,CADwB;IAAA,CAA3B,CADL,CA1BJ,eAuCI,6BAAC,UAAD,qBACI,6BAAC,UAAD;MAAM,IAAI,EAAE,EAAZ;MAAgB,SAAS,EAAEC;IAA3B,gBACI,6BAAC,qBAAD;MACI,eAAY,4BADhB;MAEI,OAAO,EAAE,iBAAAC,EAAE,EAAI;QACXP,MAAM,CAACO,EAAD,CAAN;MACH;IAJL,GAMK,cANL,CADJ,CADJ,CAvCJ,CADJ,CADH;EAAA,CANL,CADJ,CADJ;AAmEH,CA1ED;;eA4Eed,kB"}
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- declare const SetNewPassword: () => JSX.Element;
1
+ import React from "react";
2
+ declare const SetNewPassword: React.FC;
3
3
  export default SetNewPassword;
@@ -1,34 +1,59 @@
1
- import React from "react";
2
- import { Form } from "@webiny/form";
3
- import { validation } from "@webiny/validation";
4
- import { ButtonPrimary } from "@webiny/ui/Button";
5
- import { Input } from "@webiny/ui/Input";
6
- import { Grid, Cell } from "@webiny/ui/Grid";
7
- import { Typography } from "@webiny/ui/Typography";
8
- import { Elevation } from "@webiny/ui/Elevation";
9
- import { CircularProgress } from "@webiny/ui/Progress";
10
- import StateContainer from "./StateContainer";
11
- import { alignRight, InnerContent, Title, errorMessage } from "./StyledComponents";
12
- import { useAuthenticator } from "@webiny/app-cognito-authenticator/hooks/useAuthenticator";
13
- import { useSetNewPassword } from "@webiny/app-cognito-authenticator/hooks/useSetNewPassword";
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _form = require("@webiny/form");
13
+
14
+ var _validation = require("@webiny/validation");
15
+
16
+ var _Button = require("@webiny/ui/Button");
17
+
18
+ var _Input = require("@webiny/ui/Input");
19
+
20
+ var _Grid = require("@webiny/ui/Grid");
21
+
22
+ var _Typography = require("@webiny/ui/Typography");
23
+
24
+ var _Elevation = require("@webiny/ui/Elevation");
25
+
26
+ var _Progress = require("@webiny/ui/Progress");
27
+
28
+ var _StateContainer = _interopRequireDefault(require("./StateContainer"));
29
+
30
+ var _StyledComponents = require("./StyledComponents");
31
+
32
+ var _useAuthenticator2 = require("@webiny/app-cognito-authenticator/hooks/useAuthenticator");
33
+
34
+ var _useSetNewPassword2 = require("@webiny/app-cognito-authenticator/hooks/useSetNewPassword");
14
35
 
15
36
  var SetNewPassword = function SetNewPassword() {
16
- var _useAuthenticator = useAuthenticator(),
17
- checkingUser = _useAuthenticator.checkingUser,
37
+ var _useAuthenticator = (0, _useAuthenticator2.useAuthenticator)(),
18
38
  changeState = _useAuthenticator.changeState;
19
39
 
20
- var _useSetNewPassword = useSetNewPassword(),
40
+ var _useSetNewPassword = (0, _useSetNewPassword2.useSetNewPassword)(),
21
41
  shouldRender = _useSetNewPassword.shouldRender,
22
42
  setPassword = _useSetNewPassword.setPassword,
23
43
  error = _useSetNewPassword.error,
24
44
  loading = _useSetNewPassword.loading;
25
45
 
26
- if (!shouldRender || checkingUser) {
46
+ if (!shouldRender) {
27
47
  return null;
28
48
  }
29
49
 
30
- return /*#__PURE__*/React.createElement(StateContainer, null, /*#__PURE__*/React.createElement(Form, {
31
- onSubmit: setPassword,
50
+ return /*#__PURE__*/_react.default.createElement(_StateContainer.default, null, /*#__PURE__*/_react.default.createElement(_form.Form, {
51
+ onSubmit: function onSubmit(data) {
52
+ /**
53
+ * We are positive that data is UseSetNewPasswordCallableParams
54
+ */
55
+ return setPassword(data);
56
+ },
32
57
  submitOnEnter: true
33
58
  }, function (_ref) {
34
59
  var Bind = _ref.Bind,
@@ -41,55 +66,61 @@ var SetNewPassword = function SetNewPassword() {
41
66
  }
42
67
  };
43
68
 
44
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Elevation, {
69
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Elevation.Elevation, {
45
70
  z: 2
46
- }, /*#__PURE__*/React.createElement(InnerContent, null, loading && /*#__PURE__*/React.createElement(CircularProgress, null), /*#__PURE__*/React.createElement(Title, null, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement(Typography, {
71
+ }, /*#__PURE__*/_react.default.createElement(_StyledComponents.InnerContent, null, loading && /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, null), /*#__PURE__*/_react.default.createElement(_StyledComponents.Title, null, /*#__PURE__*/_react.default.createElement("h1", null, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
47
72
  use: "headline4"
48
- }, "Set New Password"))), error && /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
73
+ }, "Set New Password"))), error && /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
49
74
  span: 12,
50
- className: errorMessage
51
- }, error)), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
52
- span: 12
53
- }, /*#__PURE__*/React.createElement(Bind, {
75
+ className: _StyledComponents.errorMessage
76
+ }, error)), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
77
+ span: 12,
78
+ "data-testid": "password-reset-code"
79
+ }, /*#__PURE__*/_react.default.createElement(Bind, {
54
80
  name: "code",
55
- validators: validation.create("required")
56
- }, /*#__PURE__*/React.createElement(Input, {
81
+ validators: _validation.validation.create("required")
82
+ }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
57
83
  autoComplete: "off",
58
84
  label: "Password reset code",
59
85
  outlined: true,
60
86
  description: "Enter the code we sent to your email."
61
- }))), /*#__PURE__*/React.createElement(Cell, {
62
- span: 12
63
- }, /*#__PURE__*/React.createElement(Bind, {
87
+ }))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
88
+ span: 12,
89
+ "data-testid": "new-password-input"
90
+ }, /*#__PURE__*/_react.default.createElement(Bind, {
64
91
  name: "password",
65
- validators: validation.create("required")
66
- }, /*#__PURE__*/React.createElement(Input, {
92
+ validators: _validation.validation.create("required")
93
+ }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
67
94
  autoComplete: "off",
68
95
  type: "password",
69
96
  label: "New password",
70
97
  outlined: true,
71
98
  description: "Enter your new password."
72
- }))), /*#__PURE__*/React.createElement(Cell, {
73
- span: 12
74
- }, /*#__PURE__*/React.createElement(Bind, {
99
+ }))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
100
+ span: 12,
101
+ "data-testid": "retype-password-input"
102
+ }, /*#__PURE__*/_react.default.createElement(Bind, {
75
103
  name: "retypePassword",
76
- validators: [validation.create("required"), retypePasswordValidator]
77
- }, /*#__PURE__*/React.createElement(Input, {
104
+ validators: [_validation.validation.create("required"), retypePasswordValidator]
105
+ }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
78
106
  type: "password",
79
107
  label: "Retype password",
80
108
  outlined: true,
81
109
  description: "Enter your new password once more."
82
- }))), /*#__PURE__*/React.createElement(Cell, {
110
+ }))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
83
111
  span: 12,
84
- className: alignRight
85
- }, /*#__PURE__*/React.createElement(ButtonPrimary, {
86
- onClick: submit
87
- }, "Set new password"))))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
112
+ className: _StyledComponents.alignRight
113
+ }, /*#__PURE__*/_react.default.createElement(_Button.ButtonPrimary, {
114
+ "data-testid": "submit-btn-new-psw",
115
+ onClick: function onClick(ev) {
116
+ submit(ev);
117
+ }
118
+ }, "Set new password"))))), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
88
119
  span: 12,
89
120
  style: {
90
121
  textAlign: "center"
91
122
  }
92
- }, "Want to sign in? ", /*#__PURE__*/React.createElement("a", {
123
+ }, "Want to sign in? ", /*#__PURE__*/_react.default.createElement("a", {
93
124
  href: "#",
94
125
  onClick: function onClick() {
95
126
  return changeState("signIn");
@@ -98,4 +129,5 @@ var SetNewPassword = function SetNewPassword() {
98
129
  }));
99
130
  };
100
131
 
101
- export default SetNewPassword;
132
+ var _default = SetNewPassword;
133
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SetNewPassword","useAuthenticator","changeState","useSetNewPassword","shouldRender","setPassword","error","loading","data","Bind","submit","retypePasswordValidator","value","password","Error","errorMessage","validation","create","alignRight","ev","textAlign"],"sources":["SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title, errorMessage } from \"./StyledComponents\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSetNewPassword,\n UseSetNewPasswordCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSetNewPassword\";\n\nconst SetNewPassword: React.FC = () => {\n const { changeState } = useAuthenticator();\n const { shouldRender, setPassword, error, loading } = useSetNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={data => {\n /**\n * We are positive that data is UseSetNewPasswordCallableParams\n */\n return setPassword(data as unknown as UseSetNewPasswordCallableParams);\n }}\n submitOnEnter\n >\n {({ Bind, submit, data }) => {\n const retypePasswordValidator = (value: string) => {\n if (value !== data.password) {\n throw Error(\"Passwords do not match!\");\n }\n };\n\n return (\n <>\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress />}\n <Title>\n <h1>\n <Typography use=\"headline4\">\n Set New Password\n </Typography>\n </h1>\n </Title>\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n {error}\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell span={12} data-testid=\"password-reset-code\">\n <Bind\n name=\"code\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete=\"off\"\n label={\"Password reset code\"}\n outlined={true}\n description={\n \"Enter the code we sent to your email.\"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12} data-testid=\"new-password-input\">\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete={\"off\"}\n type={\"password\"}\n label={\"New password\"}\n outlined={true}\n description={\"Enter your new password.\"}\n />\n </Bind>\n </Cell>\n <Cell span={12} data-testid=\"retype-password-input\">\n <Bind\n name=\"retypePassword\"\n validators={[\n validation.create(\"required\"),\n retypePasswordValidator\n ]}\n >\n <Input\n type={\"password\"}\n label={\"Retype password\"}\n outlined={true}\n description={\n \"Enter your new password once more.\"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-btn-new-psw\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Set new password\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n <Grid>\n <Cell span={12} style={{ textAlign: \"center\" }}>\n Want to sign in? {/* eslint-disable-next-line */}\n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </Cell>\n </Grid>\n </>\n );\n }}\n </Form>\n </StateContainer>\n );\n};\n\nexport default SetNewPassword;\n"],"mappings":"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"}
package/views/SignIn.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- declare const SignIn: () => JSX.Element;
1
+ import React from "react";
2
+ declare const SignIn: React.FC;
3
3
  export default SignIn;
package/views/SignIn.js CHANGED
@@ -1,83 +1,113 @@
1
- import * as React from "react";
2
- import { Form } from "@webiny/form";
3
- import { validation } from "@webiny/validation";
4
- import { ButtonPrimary } from "@webiny/ui/Button";
5
- import { Input } from "@webiny/ui/Input";
6
- import { Grid, Cell } from "@webiny/ui/Grid";
7
- import { Typography } from "@webiny/ui/Typography";
8
- import { Elevation } from "@webiny/ui/Elevation";
9
- import { Alert } from "@webiny/ui/Alert";
10
- import { CircularProgress } from "@webiny/ui/Progress";
11
- import { useAuthenticator } from "@webiny/app-cognito-authenticator/hooks/useAuthenticator";
12
- import { useSignIn } from "@webiny/app-cognito-authenticator/hooks/useSignIn";
13
- import StateContainer from "./StateContainer";
14
- import { alignRight, alignCenter, InnerContent, Title, errorMessage } from "./StyledComponents";
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _form = require("@webiny/form");
13
+
14
+ var _validation = require("@webiny/validation");
15
+
16
+ var _Button = require("@webiny/ui/Button");
17
+
18
+ var _Input = require("@webiny/ui/Input");
19
+
20
+ var _Grid = require("@webiny/ui/Grid");
21
+
22
+ var _Typography = require("@webiny/ui/Typography");
23
+
24
+ var _Elevation = require("@webiny/ui/Elevation");
25
+
26
+ var _Alert = require("@webiny/ui/Alert");
27
+
28
+ var _Progress = require("@webiny/ui/Progress");
29
+
30
+ var _useAuthenticator2 = require("@webiny/app-cognito-authenticator/hooks/useAuthenticator");
31
+
32
+ var _useSignIn2 = require("@webiny/app-cognito-authenticator/hooks/useSignIn");
33
+
34
+ var _StateContainer = _interopRequireDefault(require("./StateContainer"));
35
+
36
+ var _StyledComponents = require("./StyledComponents");
15
37
 
16
38
  var SignIn = function SignIn() {
17
- var _useAuthenticator = useAuthenticator(),
39
+ var _useAuthenticator = (0, _useAuthenticator2.useAuthenticator)(),
18
40
  message = _useAuthenticator.message,
19
- changeState = _useAuthenticator.changeState,
20
- checkingUser = _useAuthenticator.checkingUser;
41
+ changeState = _useAuthenticator.changeState;
21
42
 
22
- var _useSignIn = useSignIn(),
43
+ var _useSignIn = (0, _useSignIn2.useSignIn)(),
23
44
  signIn = _useSignIn.signIn,
24
45
  loading = _useSignIn.loading,
25
46
  error = _useSignIn.error,
26
47
  shouldRender = _useSignIn.shouldRender;
27
48
 
28
- if (!shouldRender || checkingUser) {
49
+ if (!shouldRender) {
29
50
  return null;
30
51
  }
31
52
 
32
- return /*#__PURE__*/React.createElement(StateContainer, null, /*#__PURE__*/React.createElement(Form, {
33
- onSubmit: signIn,
53
+ return /*#__PURE__*/_react.default.createElement(_StateContainer.default, null, /*#__PURE__*/_react.default.createElement(_form.Form, {
54
+ onSubmit: function onSubmit(data) {
55
+ /**
56
+ * We are positive that data is UseSignInCallableParams
57
+ */
58
+ return signIn(data);
59
+ },
34
60
  submitOnEnter: true
35
61
  }, function (_ref) {
36
62
  var Bind = _ref.Bind,
37
63
  submit = _ref.submit;
38
- return /*#__PURE__*/React.createElement(Elevation, {
64
+ return /*#__PURE__*/_react.default.createElement(_Elevation.Elevation, {
39
65
  z: 2
40
- }, /*#__PURE__*/React.createElement(InnerContent, null, loading && /*#__PURE__*/React.createElement(CircularProgress, null), /*#__PURE__*/React.createElement(Title, null, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement(Typography, {
66
+ }, /*#__PURE__*/_react.default.createElement(_StyledComponents.InnerContent, null, loading && /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, {
67
+ label: "Signing in..."
68
+ }), /*#__PURE__*/_react.default.createElement(_StyledComponents.Title, null, /*#__PURE__*/_react.default.createElement("h1", null, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
41
69
  use: "headline4"
42
- }, "Sign In"))), message && !error && /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
70
+ }, "Sign In"))), message && !error && /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
43
71
  span: 12
44
- }, /*#__PURE__*/React.createElement(Alert, {
72
+ }, /*#__PURE__*/_react.default.createElement(_Alert.Alert, {
45
73
  title: message.title,
46
74
  type: message.type
47
- }, message.text))), error && /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
75
+ }, message.text))), error && /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
48
76
  span: 12,
49
- className: errorMessage
50
- }, /*#__PURE__*/React.createElement(Alert, {
77
+ className: _StyledComponents.errorMessage
78
+ }, /*#__PURE__*/_react.default.createElement(_Alert.Alert, {
51
79
  title: "Authentication error",
52
80
  type: "danger"
53
- }, error.message))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
81
+ }, error.message))), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
54
82
  span: 12
55
- }, /*#__PURE__*/React.createElement(Bind, {
83
+ }, /*#__PURE__*/_react.default.createElement(Bind, {
56
84
  name: "username",
57
- validators: validation.create("required,email"),
85
+ validators: _validation.validation.create("required,email"),
58
86
  beforeChange: function beforeChange(val, cb) {
59
87
  return cb(val.toLowerCase());
60
88
  }
61
- }, /*#__PURE__*/React.createElement(Input, {
89
+ }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
62
90
  label: "Your e-mail"
63
- }))), /*#__PURE__*/React.createElement(Cell, {
91
+ }))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
64
92
  span: 12
65
- }, /*#__PURE__*/React.createElement(Bind, {
93
+ }, /*#__PURE__*/_react.default.createElement(Bind, {
66
94
  name: "password",
67
- validators: validation.create("required")
68
- }, /*#__PURE__*/React.createElement(Input, {
95
+ validators: _validation.validation.create("required")
96
+ }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
69
97
  type: "password",
70
98
  label: "Your password"
71
- }))), /*#__PURE__*/React.createElement(Cell, {
99
+ }))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
72
100
  span: 12,
73
- className: alignRight
74
- }, /*#__PURE__*/React.createElement(ButtonPrimary, {
101
+ className: _StyledComponents.alignRight
102
+ }, /*#__PURE__*/_react.default.createElement(_Button.ButtonPrimary, {
75
103
  "data-testid": "submit-sign-in-form-button",
76
- onClick: submit
77
- }, "Submit")), /*#__PURE__*/React.createElement(Cell, {
104
+ onClick: function onClick(ev) {
105
+ submit(ev);
106
+ }
107
+ }, "Submit")), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
78
108
  span: 12,
79
- className: alignCenter
80
- }, /*#__PURE__*/React.createElement("a", {
109
+ className: _StyledComponents.alignCenter
110
+ }, /*#__PURE__*/_react.default.createElement("a", {
81
111
  href: "#",
82
112
  onClick: function onClick() {
83
113
  return changeState("forgotPassword");
@@ -86,4 +116,5 @@ var SignIn = function SignIn() {
86
116
  }));
87
117
  };
88
118
 
89
- export default SignIn;
119
+ var _default = SignIn;
120
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SignIn","useAuthenticator","message","changeState","useSignIn","signIn","loading","error","shouldRender","data","Bind","submit","title","type","text","errorMessage","validation","create","val","cb","toLowerCase","alignRight","ev","alignCenter"],"sources":["SignIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSignIn,\n UseSignInCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSignIn\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, alignCenter, InnerContent, Title, errorMessage } from \"./StyledComponents\";\n\nconst SignIn: React.FC = () => {\n const { message, changeState } = useAuthenticator();\n const { signIn, loading, error, shouldRender } = useSignIn();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={data => {\n /**\n * We are positive that data is UseSignInCallableParams\n */\n return signIn(data as unknown as UseSignInCallableParams);\n }}\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress label={\"Signing in...\"} />}\n <Title>\n <h1>\n <Typography use=\"headline4\">Sign In</Typography>\n </h1>\n </Title>\n\n {message && !error && (\n <Grid>\n <Cell span={12}>\n <Alert title={message.title} type={message.type}>\n {message.text}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n <Alert title=\"Authentication error\" type={\"danger\"}>\n {error.message}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell 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={\"Your e-mail\"} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input type={\"password\"} label={\"Your password\"} />\n </Bind>\n </Cell>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-sign-in-form-button\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Submit\"}\n </ButtonPrimary>\n </Cell>\n <Cell span={12} className={alignCenter}>\n <a href=\"#\" onClick={() => changeState(\"forgotPassword\")}>\n Forgot password?\n </a>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default SignIn;\n"],"mappings":"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"}
@@ -1,4 +1,3 @@
1
- declare const SignedIn: ({ children }: {
2
- children: any;
3
- }) => any;
1
+ import React from "react";
2
+ declare const SignedIn: React.FC;
4
3
  export default SignedIn;
package/views/SignedIn.js CHANGED
@@ -1,12 +1,20 @@
1
- import { useSignedIn } from "@webiny/app-cognito-authenticator/hooks/useSignedIn";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _useSignedIn2 = require("@webiny/app-cognito-authenticator/hooks/useSignedIn");
2
9
 
3
10
  var SignedIn = function SignedIn(_ref) {
4
11
  var children = _ref.children;
5
12
 
6
- var _useSignedIn = useSignedIn(),
13
+ var _useSignedIn = (0, _useSignedIn2.useSignedIn)(),
7
14
  shouldRender = _useSignedIn.shouldRender;
8
15
 
9
16
  return shouldRender ? children : null;
10
17
  };
11
18
 
12
- export default SignedIn;
19
+ var _default = SignedIn;
20
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SignedIn","children","useSignedIn","shouldRender"],"sources":["SignedIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { useSignedIn } from \"@webiny/app-cognito-authenticator/hooks/useSignedIn\";\n\nconst SignedIn: React.FC = ({ children }) => {\n const { shouldRender } = useSignedIn();\n\n return shouldRender ? (children as unknown as React.ReactElement) : null;\n};\n\nexport default SignedIn;\n"],"mappings":";;;;;;;AACA;;AAEA,IAAMA,QAAkB,GAAG,SAArBA,QAAqB,OAAkB;EAAA,IAAfC,QAAe,QAAfA,QAAe;;EACzC,mBAAyB,IAAAC,yBAAA,GAAzB;EAAA,IAAQC,YAAR,gBAAQA,YAAR;;EAEA,OAAOA,YAAY,GAAIF,QAAJ,GAAiD,IAApE;AACH,CAJD;;eAMeD,Q"}
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- declare const StateContainer: ({ children }: {
3
- children: any;
4
- }) => JSX.Element;
1
+ import * as React from "react";
2
+ declare const StateContainer: React.FC;
5
3
  export default StateContainer;
@@ -1,12 +1,22 @@
1
- import * as React from "react";
2
- import { LoginContent, Logo, Wrapper } from "./StyledComponents";
3
- import logoOrange from "./webiny-orange-logo.svg";
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _appAdmin = require("@webiny/app-admin");
13
+
14
+ var _StyledComponents = require("./StyledComponents");
4
15
 
5
16
  var StateContainer = function StateContainer(_ref) {
6
17
  var children = _ref.children;
7
- return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(Logo, {
8
- src: logoOrange
9
- }), /*#__PURE__*/React.createElement(LoginContent, null, children));
18
+ return /*#__PURE__*/React.createElement(_StyledComponents.Wrapper, null, /*#__PURE__*/React.createElement(_StyledComponents.LogoWrapper, null, /*#__PURE__*/React.createElement(_appAdmin.Logo, null)), /*#__PURE__*/React.createElement(_StyledComponents.LoginContent, null, children));
10
19
  };
11
20
 
12
- export default StateContainer;
21
+ var _default = StateContainer;
22
+ exports.default = _default;