@webiny/app-admin-cognito 5.43.2 → 6.0.0-alpha.0
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.
- package/components/Divider.d.ts +2 -5
- package/components/Divider.js +14 -23
- package/components/Divider.js.map +1 -1
- package/components/FederatedProviders.js +10 -30
- package/components/FederatedProviders.js.map +1 -1
- package/components/View.d.ts +6 -19
- package/components/View.js +58 -42
- package/components/View.js.map +1 -1
- package/federatedIdentityProviders.js +1 -7
- package/federatedIdentityProviders.js.map +1 -1
- package/index.d.ts +1 -19
- package/index.js +92 -101
- package/index.js.map +1 -1
- package/package.json +12 -14
- package/types.js +1 -1
- package/views/FederatedLogin.js +17 -22
- package/views/FederatedLogin.js.map +1 -1
- package/views/ForgotPassword.js +94 -98
- package/views/ForgotPassword.js.map +1 -1
- package/views/LoggingIn.js +5 -12
- package/views/LoggingIn.js.map +1 -1
- package/views/RequireNewPassword.js +62 -71
- package/views/RequireNewPassword.js.map +1 -1
- package/views/SetNewPassword.js +61 -68
- package/views/SetNewPassword.js.map +1 -1
- package/views/SignIn.js +78 -96
- package/views/SignIn.js.map +1 -1
- package/views/SignedIn.js +7 -11
- package/views/SignedIn.js.map +1 -1
- package/components/StyledComponents.d.ts +0 -28
- package/components/StyledComponents.js +0 -105
- package/components/StyledComponents.js.map +0 -1
package/components/Divider.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Divider:
|
|
3
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
-
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const Divider: () => React.JSX.Element;
|
package/components/Divider.js
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
16
|
-
name: "sdtygy",
|
|
17
|
-
styles: "border-top:1px solid #ececec"
|
|
18
|
-
} : {
|
|
19
|
-
name: "sdtygy",
|
|
20
|
-
styles: "border-top:1px solid #ececec",
|
|
21
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkRpdmlkZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVpQyIsImZpbGUiOiJEaXZpZGVyLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuXG5leHBvcnQgY29uc3QgRGl2aWRlciA9IHN0eWxlZC5kaXZgXG4gICAgYm9yZGVyLXRvcDogMXB4IHNvbGlkICNlY2VjZWM7XG5gO1xuIl19 */",
|
|
22
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
23
|
-
});
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Separator, Text } from "@webiny/admin-ui";
|
|
3
|
+
export const Divider = () => {
|
|
4
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5
|
+
className: "wby-relative wby-my-lg"
|
|
6
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
className: "wby-absolute wby-inset-0 wby-flex wby-items-center"
|
|
8
|
+
}, /*#__PURE__*/React.createElement(Separator, null)), /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: "wby-relative wby-flex wby-justify-center"
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
11
|
+
size: "sm",
|
|
12
|
+
className: "wby-text-neutral-strong wby-px-sm wby-bg-neutral-base wby-uppercase"
|
|
13
|
+
}, "Or continue with")));
|
|
14
|
+
};
|
|
24
15
|
|
|
25
16
|
//# sourceMappingURL=Divider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","Separator","Text","Divider","createElement","className","size"],"sources":["Divider.tsx"],"sourcesContent":["import React from \"react\";\nimport { Separator, Text } from \"@webiny/admin-ui\";\n\nexport const Divider = () => {\n return (\n <div className={\"wby-relative wby-my-lg\"}>\n <div className={\"wby-absolute wby-inset-0 wby-flex wby-items-center\"}>\n <Separator />\n </div>\n <div className={\"wby-relative wby-flex wby-justify-center\"}>\n <Text\n size={\"sm\"}\n className={\n \"wby-text-neutral-strong wby-px-sm wby-bg-neutral-base wby-uppercase\"\n }\n >\n {\"Or continue with\"}\n </Text>\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,IAAI,QAAQ,kBAAkB;AAElD,OAAO,MAAMC,OAAO,GAAGA,CAAA,KAAM;EACzB,oBACIH,KAAA,CAAAI,aAAA;IAAKC,SAAS,EAAE;EAAyB,gBACrCL,KAAA,CAAAI,aAAA;IAAKC,SAAS,EAAE;EAAqD,gBACjEL,KAAA,CAAAI,aAAA,CAACH,SAAS,MAAE,CACX,CAAC,eACND,KAAA,CAAAI,aAAA;IAAKC,SAAS,EAAE;EAA2C,gBACvDL,KAAA,CAAAI,aAAA,CAACF,IAAI;IACDI,IAAI,EAAE,IAAK;IACXD,SAAS,EACL;EACH,GAEA,kBACC,CACL,CACJ,CAAC;AAEd,CAAC","ignoreList":[]}
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _appAdmin = require("@webiny/app-admin");
|
|
11
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
12
|
-
var FlexContainer = /*#__PURE__*/(0, _base.default)("div", process.env.NODE_ENV === "production" ? {
|
|
13
|
-
target: "e14conl60"
|
|
14
|
-
} : {
|
|
15
|
-
target: "e14conl60",
|
|
16
|
-
label: "FlexContainer"
|
|
17
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
18
|
-
name: "1fqucy2",
|
|
19
|
-
styles: "display:flex;column-gap:10px;padding-top:20px;justify-content:center"
|
|
20
|
-
} : {
|
|
21
|
-
name: "1fqucy2",
|
|
22
|
-
styles: "display:flex;column-gap:10px;padding-top:20px;justify-content:center",
|
|
23
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkZlZGVyYXRlZFByb3ZpZGVycy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSWdDIiwiZmlsZSI6IkZlZGVyYXRlZFByb3ZpZGVycy50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSBcInJlYWN0XCI7XG5pbXBvcnQgc3R5bGVkIGZyb20gXCJAZW1vdGlvbi9zdHlsZWRcIjtcbmltcG9ydCB7IG1ha2VEZWNvcmF0YWJsZSB9IGZyb20gXCJAd2ViaW55L2FwcC1hZG1pblwiO1xuXG5jb25zdCBGbGV4Q29udGFpbmVyID0gc3R5bGVkLmRpdmBcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGNvbHVtbi1nYXA6IDEwcHg7XG4gICAgcGFkZGluZy10b3A6IDIwcHg7XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG5gO1xuXG5leHBvcnQgaW50ZXJmYWNlIENvbnRhaW5lclByb3BzIHtcbiAgICBjaGlsZHJlbjogUmVhY3QuUmVhY3ROb2RlO1xufVxuXG5leHBvcnQgY29uc3QgQ29udGFpbmVyID0gbWFrZURlY29yYXRhYmxlKFxuICAgIFwiRmVkZXJhdGVkUHJvdmlkZXJzQ29udGFpbmVyXCIsXG4gICAgKHsgY2hpbGRyZW4gfTogQ29udGFpbmVyUHJvcHMpID0+IHtcbiAgICAgICAgcmV0dXJuIDxGbGV4Q29udGFpbmVyPntjaGlsZHJlbn08L0ZsZXhDb250YWluZXI+O1xuICAgIH1cbik7XG5cbmV4cG9ydCBjb25zdCBGZWRlcmF0ZWRQcm92aWRlcnMgPSB7XG4gICAgQ29udGFpbmVyXG59O1xuIl19 */",
|
|
24
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
25
|
-
});
|
|
26
|
-
var Container = exports.Container = (0, _appAdmin.makeDecoratable)("FederatedProvidersContainer", function (_ref) {
|
|
27
|
-
var children = _ref.children;
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement(FlexContainer, null, children);
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { makeDecoratable } from "@webiny/app-admin";
|
|
3
|
+
export const Container = makeDecoratable("FederatedProvidersContainer", ({
|
|
4
|
+
children
|
|
5
|
+
}) => {
|
|
6
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
className: "wby-flex wby-flex-col wby-gap-xs"
|
|
8
|
+
}, children);
|
|
29
9
|
});
|
|
30
|
-
|
|
31
|
-
Container
|
|
10
|
+
export const FederatedProviders = {
|
|
11
|
+
Container
|
|
32
12
|
};
|
|
33
13
|
|
|
34
14
|
//# sourceMappingURL=FederatedProviders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","makeDecoratable","Container","children","createElement","className","FederatedProviders"],"sources":["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={\"wby-flex wby-flex-col wby-gap-xs\"}>{children}</div>;\n }\n);\n\nexport const FederatedProviders = {\n Container\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,mBAAmB;AAMnD,OAAO,MAAMC,SAAS,GAAGD,eAAe,CACpC,6BAA6B,EAC7B,CAAC;EAAEE;AAAyB,CAAC,KAAK;EAC9B,oBAAOH,KAAA,CAAAI,aAAA;IAAKC,SAAS,EAAE;EAAmC,GAAEF,QAAc,CAAC;AAC/E,CACJ,CAAC;AAED,OAAO,MAAMG,kBAAkB,GAAG;EAC9BJ;AACJ,CAAC","ignoreList":[]}
|
package/components/View.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export interface TitleProps {
|
|
|
12
12
|
title: string;
|
|
13
13
|
description?: React.ReactNode;
|
|
14
14
|
}
|
|
15
|
+
export interface ErrorProps {
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare const Error: ({ title, description }: ErrorProps) => React.JSX.Element | null;
|
|
15
20
|
export declare const View: {
|
|
16
21
|
Container: (({ children }: ContainerProps) => React.JSX.Element) & {
|
|
17
22
|
original: ({ children }: ContainerProps) => React.JSX.Element;
|
|
@@ -32,25 +37,6 @@ export declare const View: {
|
|
|
32
37
|
displayName: string;
|
|
33
38
|
}>) => (props: unknown) => React.JSX.Element;
|
|
34
39
|
};
|
|
35
|
-
Logo: (() => React.JSX.Element) & {
|
|
36
|
-
original: () => React.JSX.Element;
|
|
37
|
-
originalName: string;
|
|
38
|
-
displayName: string;
|
|
39
|
-
} & {
|
|
40
|
-
original: (() => React.JSX.Element) & {
|
|
41
|
-
original: () => React.JSX.Element;
|
|
42
|
-
originalName: string;
|
|
43
|
-
displayName: string;
|
|
44
|
-
};
|
|
45
|
-
originalName: string;
|
|
46
|
-
displayName: string;
|
|
47
|
-
} & {
|
|
48
|
-
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(() => React.JSX.Element) & {
|
|
49
|
-
original: () => React.JSX.Element;
|
|
50
|
-
originalName: string;
|
|
51
|
-
displayName: string;
|
|
52
|
-
}>) => (props: unknown) => React.JSX.Element;
|
|
53
|
-
};
|
|
54
40
|
Content: (({ children }: ContentProps) => React.JSX.Element) & {
|
|
55
41
|
original: ({ children }: ContentProps) => React.JSX.Element;
|
|
56
42
|
originalName: string;
|
|
@@ -108,4 +94,5 @@ export declare const View: {
|
|
|
108
94
|
displayName: string;
|
|
109
95
|
}>) => (props: unknown) => React.JSX.Element;
|
|
110
96
|
};
|
|
97
|
+
Error: ({ title, description }: ErrorProps) => React.JSX.Element | null;
|
|
111
98
|
};
|
package/components/View.js
CHANGED
|
@@ -1,50 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return /*#__PURE__*/React.createElement(Styled.Wrapper, null, /*#__PURE__*/React.createElement(Styled.LogoWrapper, null, /*#__PURE__*/React.createElement(_appAdmin.Logo, null)), /*#__PURE__*/React.createElement(Styled.LoginContent, null, children));
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Logo, makeDecoratable } from "@webiny/app-admin";
|
|
3
|
+
import { Alert, Grid, Heading, Text } from "@webiny/admin-ui";
|
|
4
|
+
const Container = makeDecoratable("ViewContainer", ({
|
|
5
|
+
children
|
|
6
|
+
}) => {
|
|
7
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
8
|
+
className: "wby-w-screen wby-h-screen wby-bg-neutral-light wby-flex-1"
|
|
9
|
+
}, /*#__PURE__*/React.createElement("section", {
|
|
10
|
+
className: "wby-m-auto wby-flex wby-flex-col wby-justify-center wby-min-h-screen"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: "wby-mx-auto"
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Logo, null)), /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: "wby-w-full wby-max-w-[480px] wby-mx-auto wby-my-lg"
|
|
15
|
+
}, children)));
|
|
17
16
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return /*#__PURE__*/React.createElement(
|
|
17
|
+
const Content = makeDecoratable("ViewContent", ({
|
|
18
|
+
children
|
|
19
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: "wby-relative wby-p-lg wby-pt-md wby-bg-neutral-base wby-rounded-xl"
|
|
21
|
+
}, children));
|
|
22
|
+
const Footer = makeDecoratable("ViewFooter", ({
|
|
23
|
+
children
|
|
24
|
+
}) => {
|
|
25
|
+
return /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
27
26
|
span: 12,
|
|
28
|
-
|
|
29
|
-
textAlign: "center"
|
|
30
|
-
}
|
|
27
|
+
className: "wby-text-center wby-mt-lg"
|
|
31
28
|
}, children));
|
|
32
29
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
const Title = makeDecoratable("ViewTitle", ({
|
|
31
|
+
title,
|
|
32
|
+
description
|
|
33
|
+
}) => {
|
|
34
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "wby-mb-md"
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
37
|
+
level: 4
|
|
38
|
+
}, title), description && /*#__PURE__*/React.createElement(Text, {
|
|
39
|
+
as: "div",
|
|
40
|
+
size: "sm",
|
|
41
|
+
className: "wby-text-neutral-strong"
|
|
42
|
+
}, description));
|
|
41
43
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
export const Error = ({
|
|
45
|
+
title = "Something went wrong",
|
|
46
|
+
description
|
|
47
|
+
}) => {
|
|
48
|
+
if (!description) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "wby-mb-lg"
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Alert, {
|
|
54
|
+
title: title,
|
|
55
|
+
type: "danger"
|
|
56
|
+
}, description));
|
|
57
|
+
};
|
|
58
|
+
export const View = {
|
|
59
|
+
Container,
|
|
60
|
+
Content,
|
|
61
|
+
Title,
|
|
62
|
+
Footer,
|
|
63
|
+
Error
|
|
48
64
|
};
|
|
49
65
|
|
|
50
66
|
//# sourceMappingURL=View.js.map
|
package/components/View.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","Logo","makeDecoratable","Alert","Grid","Heading","Text","Container","children","createElement","className","Content","Footer","Column","span","Title","title","description","level","as","size","Error","type","View"],"sources":["View.tsx"],"sourcesContent":["import * as React from \"react\";\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={\"wby-w-screen wby-h-screen wby-bg-neutral-light wby-flex-1\"}>\n <section\n className={\"wby-m-auto wby-flex wby-flex-col wby-justify-center wby-min-h-screen\"}\n >\n <div className={\"wby-mx-auto\"}>\n <Logo />\n </div>\n <div className={\"wby-w-full wby-max-w-[480px] wby-mx-auto wby-my-lg\"}>\n {children}\n </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={\"wby-relative wby-p-lg wby-pt-md wby-bg-neutral-base wby-rounded-xl\"}>\n {children}\n </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={\"wby-text-center wby-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={\"wby-mb-md\"}>\n <Heading level={4}>{title}</Heading>\n {description && (\n <Text as={\"div\"} size={\"sm\"} className={\"wby-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={\"wby-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"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,IAAI,EAAEC,eAAe,QAAQ,mBAAmB;AACzD,SAASC,KAAK,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI,QAAQ,kBAAkB;AAM7D,MAAMC,SAAS,GAAGL,eAAe,CAAC,eAAe,EAAE,CAAC;EAAEM;AAAyB,CAAC,KAAK;EACjF,oBACIR,KAAA,CAAAS,aAAA;IAAKC,SAAS,EAAE;EAA4D,gBACxEV,KAAA,CAAAS,aAAA;IACIC,SAAS,EAAE;EAAuE,gBAElFV,KAAA,CAAAS,aAAA;IAAKC,SAAS,EAAE;EAAc,gBAC1BV,KAAA,CAAAS,aAAA,CAACR,IAAI,MAAE,CACN,CAAC,eACND,KAAA,CAAAS,aAAA;IAAKC,SAAS,EAAE;EAAqD,GAChEF,QACA,CACA,CACR,CAAC;AAEd,CAAC,CAAC;AAMF,MAAMG,OAAO,GAAGT,eAAe,CAAC,aAAa,EAAE,CAAC;EAAEM;AAAuB,CAAC,kBACtER,KAAA,CAAAS,aAAA;EAAKC,SAAS,EAAE;AAAqE,GAChFF,QACA,CACR,CAAC;AAMF,MAAMI,MAAM,GAAGV,eAAe,CAAC,YAAY,EAAE,CAAC;EAAEM;AAAsB,CAAC,KAAK;EACxE,oBACIR,KAAA,CAAAS,aAAA,CAACL,IAAI,qBACDJ,KAAA,CAAAS,aAAA,CAACL,IAAI,CAACS,MAAM;IAACC,IAAI,EAAE,EAAG;IAACJ,SAAS,EAAE;EAA4B,GACzDF,QACQ,CACX,CAAC;AAEf,CAAC,CAAC;AAOF,MAAMO,KAAK,GAAGb,eAAe,CAAC,WAAW,EAAE,CAAC;EAAEc,KAAK;EAAEC;AAAwB,CAAC,KAAK;EAC/E,oBACIjB,KAAA,CAAAS,aAAA;IAAKC,SAAS,EAAE;EAAY,gBACxBV,KAAA,CAAAS,aAAA,CAACJ,OAAO;IAACa,KAAK,EAAE;EAAE,GAAEF,KAAe,CAAC,EACnCC,WAAW,iBACRjB,KAAA,CAAAS,aAAA,CAACH,IAAI;IAACa,EAAE,EAAE,KAAM;IAACC,IAAI,EAAE,IAAK;IAACV,SAAS,EAAE;EAA0B,GAC7DO,WACC,CAET,CAAC;AAEd,CAAC,CAAC;AAOF,OAAO,MAAMI,KAAK,GAAGA,CAAC;EAAEL,KAAK,GAAG,sBAAsB;EAAEC;AAAwB,CAAC,KAAK;EAClF,IAAI,CAACA,WAAW,EAAE;IACd,OAAO,IAAI;EACf;EAEA,oBACIjB,KAAA,CAAAS,aAAA;IAAKC,SAAS,EAAE;EAAY,gBACxBV,KAAA,CAAAS,aAAA,CAACN,KAAK;IAACa,KAAK,EAAEA,KAAM;IAACM,IAAI,EAAE;EAAS,GAC/BL,WACE,CACN,CAAC;AAEd,CAAC;AAED,OAAO,MAAMM,IAAI,GAAG;EAChBhB,SAAS;EACTI,OAAO;EACPI,KAAK;EACLH,MAAM;EACNS;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.federatedIdentityProviders = void 0;
|
|
7
|
-
var federatedIdentityProviders = exports.federatedIdentityProviders = {
|
|
1
|
+
export const federatedIdentityProviders = {
|
|
8
2
|
cognito: "COGNITO",
|
|
9
3
|
google: "Google",
|
|
10
4
|
facebook: "Facebook",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["federatedIdentityProviders","
|
|
1
|
+
{"version":3,"names":["federatedIdentityProviders","cognito","google","facebook","amazon","apple"],"sources":["federatedIdentityProviders.ts"],"sourcesContent":["import React from \"react\";\n\nexport const federatedIdentityProviders: Record<string, string> = {\n cognito: \"COGNITO\",\n google: \"Google\",\n facebook: \"Facebook\",\n amazon: \"LoginWithAmazon\",\n apple: \"SignInWithApple\"\n};\n\nexport interface SignInProps {\n signIn: () => void;\n}\n\nexport type FederatedIdentityProvider = {\n name: string;\n component: React.FunctionComponent<SignInProps>;\n};\n"],"mappings":"AAEA,OAAO,MAAMA,0BAAkD,GAAG;EAC9DC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,iBAAiB;EACzBC,KAAK,EAAE;AACX,CAAC","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -23,25 +23,6 @@ export declare const Components: {
|
|
|
23
23
|
displayName: string;
|
|
24
24
|
}>) => (props: unknown) => React.JSX.Element;
|
|
25
25
|
};
|
|
26
|
-
Logo: (() => React.JSX.Element) & {
|
|
27
|
-
original: () => React.JSX.Element;
|
|
28
|
-
originalName: string;
|
|
29
|
-
displayName: string;
|
|
30
|
-
} & {
|
|
31
|
-
original: (() => React.JSX.Element) & {
|
|
32
|
-
original: () => React.JSX.Element;
|
|
33
|
-
originalName: string;
|
|
34
|
-
displayName: string;
|
|
35
|
-
};
|
|
36
|
-
originalName: string;
|
|
37
|
-
displayName: string;
|
|
38
|
-
} & {
|
|
39
|
-
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(() => React.JSX.Element) & {
|
|
40
|
-
original: () => React.JSX.Element;
|
|
41
|
-
originalName: string;
|
|
42
|
-
displayName: string;
|
|
43
|
-
}>) => (props: unknown) => React.JSX.Element;
|
|
44
|
-
};
|
|
45
26
|
Content: (({ children }: import("./components/View").ContentProps) => React.JSX.Element) & {
|
|
46
27
|
original: ({ children }: import("./components/View").ContentProps) => React.JSX.Element;
|
|
47
28
|
originalName: string;
|
|
@@ -99,6 +80,7 @@ export declare const Components: {
|
|
|
99
80
|
displayName: string;
|
|
100
81
|
}>) => (props: unknown) => React.JSX.Element;
|
|
101
82
|
};
|
|
83
|
+
Error: ({ title, description }: import("./components/View").ErrorProps) => React.JSX.Element | null;
|
|
102
84
|
};
|
|
103
85
|
FederatedProviders: {
|
|
104
86
|
Container: (({ children }: import("./components/FederatedProviders").ContainerProps) => React.JSX.Element) & {
|
package/index.js
CHANGED
|
@@ -1,125 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _RequireNewPassword = require("./views/RequireNewPassword");
|
|
23
|
-
var _ForgotPassword = require("./views/ForgotPassword");
|
|
24
|
-
var _SetNewPassword = require("./views/SetNewPassword");
|
|
25
|
-
var _SignedIn = require("./views/SignedIn");
|
|
26
|
-
var _LoggingIn = require("./views/LoggingIn");
|
|
27
|
-
var _FederatedProviders = require("./components/FederatedProviders");
|
|
28
|
-
var _View = require("./components/View");
|
|
29
|
-
var _excluded = ["allowSignInWithCredentials", "getIdentityData", "onError"],
|
|
30
|
-
_excluded2 = ["id", "displayName", "type", "permissions"];
|
|
31
|
-
var Components = exports.Components = {
|
|
32
|
-
View: _View.View,
|
|
33
|
-
FederatedProviders: _FederatedProviders.FederatedProviders,
|
|
34
|
-
SignIn: _SignIn.SignIn
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { Auth } from "@aws-amplify/auth";
|
|
3
|
+
import { useApolloClient } from "@apollo/react-hooks";
|
|
4
|
+
import { setContext } from "apollo-link-context";
|
|
5
|
+
import { plugins } from "@webiny/plugins";
|
|
6
|
+
import { ApolloLinkPlugin } from "@webiny/app/plugins/ApolloLinkPlugin";
|
|
7
|
+
import { Authenticator } from "@webiny/app-cognito-authenticator/Authenticator";
|
|
8
|
+
import { useSecurity } from "@webiny/app-security";
|
|
9
|
+
import { config as appConfig } from "@webiny/app/config";
|
|
10
|
+
import { SignIn } from "./views/SignIn";
|
|
11
|
+
import { RequireNewPassword } from "./views/RequireNewPassword";
|
|
12
|
+
import { ForgotPassword } from "./views/ForgotPassword";
|
|
13
|
+
import { SetNewPassword } from "./views/SetNewPassword";
|
|
14
|
+
import { SignedIn } from "./views/SignedIn";
|
|
15
|
+
import { LoggingIn } from "./views/LoggingIn";
|
|
16
|
+
import { FederatedProviders } from "./components/FederatedProviders";
|
|
17
|
+
import { View } from "./components/View";
|
|
18
|
+
export const Components = {
|
|
19
|
+
View,
|
|
20
|
+
FederatedProviders,
|
|
21
|
+
SignIn
|
|
35
22
|
};
|
|
36
|
-
|
|
37
|
-
return new
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
const createApolloLinkPlugin = () => {
|
|
24
|
+
return new ApolloLinkPlugin(() => {
|
|
25
|
+
return setContext(async (_, {
|
|
26
|
+
headers
|
|
27
|
+
}) => {
|
|
28
|
+
const user = await Auth.currentSession();
|
|
29
|
+
const idToken = user.getIdToken();
|
|
42
30
|
if (!idToken) {
|
|
43
31
|
return {
|
|
44
|
-
headers
|
|
32
|
+
headers
|
|
45
33
|
};
|
|
46
34
|
}
|
|
47
35
|
|
|
48
36
|
// If "Authorization" header is already set, don't overwrite it.
|
|
49
37
|
if (headers && headers.Authorization) {
|
|
50
38
|
return {
|
|
51
|
-
headers
|
|
39
|
+
headers
|
|
52
40
|
};
|
|
53
41
|
}
|
|
54
42
|
return {
|
|
55
|
-
headers:
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
headers: {
|
|
44
|
+
...headers,
|
|
45
|
+
Authorization: `Bearer ${idToken.getJwtToken()}`
|
|
46
|
+
}
|
|
58
47
|
};
|
|
59
48
|
});
|
|
60
49
|
});
|
|
61
50
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return p.name !== "aacl";
|
|
65
|
-
});
|
|
51
|
+
const validatePermissions = permissions => {
|
|
52
|
+
const appPermissions = permissions.filter(p => p.name !== "aacl");
|
|
66
53
|
if (appPermissions.length === 0) {
|
|
67
54
|
throw new Error("You have no permissions on this tenant!");
|
|
68
55
|
}
|
|
69
56
|
};
|
|
70
|
-
|
|
71
|
-
region:
|
|
72
|
-
userPoolId:
|
|
73
|
-
userPoolWebClientId:
|
|
57
|
+
const defaultOptions = {
|
|
58
|
+
region: appConfig.getKey("USER_POOL_REGION", process.env.REACT_APP_USER_POOL_REGION),
|
|
59
|
+
userPoolId: appConfig.getKey("USER_POOL_ID", process.env.REACT_APP_USER_POOL_ID),
|
|
60
|
+
userPoolWebClientId: appConfig.getKey("USER_POOL_WEB_CLIENT_ID", process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID)
|
|
74
61
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
export const createAuthentication = ({
|
|
63
|
+
allowSignInWithCredentials = true,
|
|
64
|
+
getIdentityData,
|
|
65
|
+
onError,
|
|
66
|
+
...config
|
|
67
|
+
}) => {
|
|
81
68
|
/**
|
|
82
69
|
* TODO @ts-refactor
|
|
83
70
|
*/
|
|
84
71
|
// @ts-expect-error
|
|
85
|
-
Object.keys(config).forEach(
|
|
86
|
-
|
|
72
|
+
Object.keys(config).forEach(key => config[key] === undefined && delete config[key]);
|
|
73
|
+
Auth.configure({
|
|
74
|
+
...defaultOptions,
|
|
75
|
+
...config
|
|
87
76
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
logout
|
|
77
|
+
const Authentication = props => {
|
|
78
|
+
const {
|
|
79
|
+
children
|
|
80
|
+
} = props;
|
|
81
|
+
const [loadingIdentity, setLoadingIdentity] = useState(false);
|
|
82
|
+
const {
|
|
83
|
+
setIdentity,
|
|
84
|
+
setIdTokenProvider
|
|
85
|
+
} = useSecurity();
|
|
86
|
+
const client = useApolloClient();
|
|
87
|
+
const onToken = useCallback(async token => {
|
|
88
|
+
const {
|
|
89
|
+
payload,
|
|
90
|
+
logout
|
|
91
|
+
} = token;
|
|
102
92
|
setLoadingIdentity(true);
|
|
103
93
|
try {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
94
|
+
const {
|
|
95
|
+
id,
|
|
96
|
+
displayName,
|
|
97
|
+
type,
|
|
98
|
+
permissions,
|
|
99
|
+
...data
|
|
100
|
+
} = await getIdentityData({
|
|
101
|
+
client,
|
|
102
|
+
payload
|
|
103
|
+
});
|
|
104
|
+
setIdentity({
|
|
105
|
+
id,
|
|
106
|
+
displayName,
|
|
107
|
+
type,
|
|
108
|
+
permissions,
|
|
109
|
+
...data,
|
|
110
|
+
logout: logout || (() => {
|
|
120
111
|
return void 0;
|
|
121
|
-
}
|
|
122
|
-
})
|
|
112
|
+
})
|
|
113
|
+
});
|
|
123
114
|
validatePermissions(permissions);
|
|
124
115
|
} catch (err) {
|
|
125
116
|
console.log("ERROR", err);
|
|
@@ -132,24 +123,24 @@ var createAuthentication = exports.createAuthentication = function createAuthent
|
|
|
132
123
|
setLoadingIdentity(false);
|
|
133
124
|
}
|
|
134
125
|
}, []);
|
|
135
|
-
|
|
126
|
+
useEffect(() => {
|
|
136
127
|
/**
|
|
137
128
|
* We need to give the security layer a way to fetch the `idToken`, so other network clients can use
|
|
138
129
|
* it when sending requests to external services (APIs, websockets,...).
|
|
139
130
|
*/
|
|
140
|
-
setIdTokenProvider(async
|
|
141
|
-
|
|
142
|
-
|
|
131
|
+
setIdTokenProvider(async () => {
|
|
132
|
+
const user = await Auth.currentSession();
|
|
133
|
+
const idToken = user.getIdToken();
|
|
143
134
|
return idToken ? idToken.getJwtToken() : undefined;
|
|
144
135
|
});
|
|
145
|
-
|
|
136
|
+
plugins.register(createApolloLinkPlugin());
|
|
146
137
|
}, []);
|
|
147
|
-
return /*#__PURE__*/
|
|
138
|
+
return /*#__PURE__*/React.createElement(Authenticator, {
|
|
148
139
|
onToken: onToken
|
|
149
|
-
}, loadingIdentity ? /*#__PURE__*/
|
|
140
|
+
}, loadingIdentity ? /*#__PURE__*/React.createElement(LoggingIn, null) : /*#__PURE__*/React.createElement(SignIn, {
|
|
150
141
|
federatedProviders: config.federatedProviders,
|
|
151
142
|
allowSignInWithCredentials: allowSignInWithCredentials
|
|
152
|
-
}), /*#__PURE__*/
|
|
143
|
+
}), /*#__PURE__*/React.createElement(RequireNewPassword, null), /*#__PURE__*/React.createElement(ForgotPassword, null), /*#__PURE__*/React.createElement(SetNewPassword, null), /*#__PURE__*/React.createElement(SignedIn, null, children));
|
|
153
144
|
};
|
|
154
145
|
return Authentication;
|
|
155
146
|
};
|