@skroz/frontend 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/LICENCE.md +21 -0
  2. package/dist/auth/Auth.d.ts +8 -0
  3. package/dist/auth/Auth.js +52 -0
  4. package/dist/auth/AuthFooterLinks.d.ts +4 -0
  5. package/dist/auth/AuthFooterLinks.js +26 -0
  6. package/dist/auth/Forgot.d.ts +7 -0
  7. package/dist/auth/Forgot.js +68 -0
  8. package/dist/auth/Login.d.ts +8 -0
  9. package/dist/auth/Login.js +65 -0
  10. package/dist/auth/LoginForm.d.ts +6 -0
  11. package/dist/auth/LoginForm.js +48 -0
  12. package/dist/auth/RecoverPassword.d.ts +2 -0
  13. package/dist/auth/RecoverPassword.js +96 -0
  14. package/dist/auth/Register.d.ts +8 -0
  15. package/dist/auth/Register.js +68 -0
  16. package/dist/auth/ResendLinkButton.d.ts +11 -0
  17. package/dist/auth/ResendLinkButton.js +50 -0
  18. package/dist/auth/index.d.ts +8 -0
  19. package/dist/auth/index.js +22 -0
  20. package/dist/graphql/ForgotPasswordMutation.graphql.d.ts +24 -0
  21. package/dist/graphql/ForgotPasswordMutation.graphql.js +76 -0
  22. package/dist/graphql/LoginMutation.graphql.d.ts +26 -0
  23. package/dist/graphql/LoginMutation.graphql.js +69 -0
  24. package/dist/graphql/RegisterMutation.graphql.d.ts +26 -0
  25. package/dist/graphql/RegisterMutation.graphql.js +69 -0
  26. package/dist/graphql/ResendLinkButtonMutation.graphql.d.ts +25 -0
  27. package/dist/graphql/ResendLinkButtonMutation.graphql.js +76 -0
  28. package/dist/graphql/index.d.ts +5 -0
  29. package/dist/graphql/index.js +16 -0
  30. package/dist/graphql/recoveryMutation.graphql.d.ts +19 -0
  31. package/dist/graphql/recoveryMutation.graphql.js +67 -0
  32. package/dist/index.d.ts +4 -0
  33. package/dist/index.js +20 -0
  34. package/dist/ui/AreYouSure.d.ts +10 -0
  35. package/dist/ui/AreYouSure.js +43 -0
  36. package/dist/ui/FormError.d.ts +3 -0
  37. package/dist/ui/FormError.js +15 -0
  38. package/dist/ui/FormItem.d.ts +12 -0
  39. package/dist/ui/FormItem.js +27 -0
  40. package/dist/ui/H.d.ts +16 -0
  41. package/dist/ui/H.js +39 -0
  42. package/dist/ui/Panel.d.ts +16 -0
  43. package/dist/ui/Panel.js +24 -0
  44. package/dist/ui/SeoHead.d.ts +13 -0
  45. package/dist/ui/SeoHead.js +14 -0
  46. package/dist/ui/index.d.ts +6 -0
  47. package/dist/ui/index.js +18 -0
  48. package/dist/utils/FrontendContext.d.ts +14 -0
  49. package/dist/utils/FrontendContext.js +30 -0
  50. package/dist/utils/getError.d.ts +11 -0
  51. package/dist/utils/getError.js +73 -0
  52. package/dist/utils/handleFormErrors.d.ts +15 -0
  53. package/dist/utils/handleFormErrors.js +62 -0
  54. package/dist/utils/index.d.ts +5 -0
  55. package/dist/utils/index.js +28 -0
  56. package/dist/utils/isObject.d.ts +2 -0
  57. package/dist/utils/isObject.js +6 -0
  58. package/dist/utils/limitExpiresAt.d.ts +3 -0
  59. package/dist/utils/limitExpiresAt.js +19 -0
  60. package/package.json +48 -0
  61. package/src/auth/Auth.tsx +76 -0
  62. package/src/auth/AuthFooterLinks.tsx +27 -0
  63. package/src/auth/Forgot.tsx +122 -0
  64. package/src/auth/Login.tsx +115 -0
  65. package/src/auth/LoginForm.tsx +74 -0
  66. package/src/auth/RecoverPassword.tsx +185 -0
  67. package/src/auth/Register.tsx +174 -0
  68. package/src/auth/ResendLinkButton.tsx +71 -0
  69. package/src/auth/index.ts +8 -0
  70. package/src/graphql/ForgotPasswordMutation.graphql.ts +100 -0
  71. package/src/graphql/LoginMutation.graphql.ts +95 -0
  72. package/src/graphql/RegisterMutation.graphql.ts +95 -0
  73. package/src/graphql/ResendLinkButtonMutation.graphql.ts +101 -0
  74. package/src/graphql/index.ts +5 -0
  75. package/src/graphql/recoveryMutation.graphql.ts +91 -0
  76. package/src/index.ts +4 -0
  77. package/src/locales/ru/common.json +271 -0
  78. package/src/styles/auth.less +142 -0
  79. package/src/styles/colors.less +55 -0
  80. package/src/styles/components.less +2 -0
  81. package/src/styles/panels.less +61 -0
  82. package/src/styles/sizes.less +92 -0
  83. package/src/ui/AreYouSure.tsx +55 -0
  84. package/src/ui/FormError.tsx +21 -0
  85. package/src/ui/FormItem.tsx +60 -0
  86. package/src/ui/H.tsx +76 -0
  87. package/src/ui/Panel.tsx +44 -0
  88. package/src/ui/SeoHead.tsx +69 -0
  89. package/src/ui/index.ts +6 -0
  90. package/src/utils/FrontendContext.tsx +30 -0
  91. package/src/utils/getError.ts +101 -0
  92. package/src/utils/handleFormErrors.ts +77 -0
  93. package/src/utils/index.ts +5 -0
  94. package/src/utils/isObject.ts +4 -0
  95. package/src/utils/limitExpiresAt.ts +14 -0
@@ -0,0 +1,71 @@
1
+ import React, { useCallback } from 'react';
2
+ import { graphql, useMutation } from 'react-relay';
3
+ import { Button, message } from 'antd';
4
+ import { useTranslation } from 'next-i18next';
5
+ import { ResendLinkButtonMutation } from '../graphql/ResendLinkButtonMutation.graphql';
6
+
7
+ interface ResendLinkButtonProps {
8
+ type: string;
9
+ email: string;
10
+ children: React.ReactNode;
11
+ disabled?: boolean;
12
+ onCompleted: (res: any) => void;
13
+ onError: (res: any) => void;
14
+ }
15
+
16
+ const ResendLinkButton: React.FC<ResendLinkButtonProps> = ({
17
+ type,
18
+ email,
19
+ children,
20
+ disabled,
21
+ onCompleted,
22
+ onError,
23
+ }) => {
24
+ const { t } = useTranslation();
25
+
26
+ const [commit, loading] = useMutation<ResendLinkButtonMutation>(
27
+ graphql`
28
+ mutation ResendLinkButtonMutation($input: ResendLinkInput!) {
29
+ resendLink(input: $input) {
30
+ ok
31
+ limitExpiresAt
32
+ }
33
+ }
34
+ `
35
+ );
36
+
37
+ const resendLinkHandler = useCallback(() => {
38
+ if (!email) {
39
+ message.error(t('error.emailNotProvided'));
40
+ return;
41
+ }
42
+ if (!type) {
43
+ message.error(t('error.typeNotProvided'));
44
+ return;
45
+ }
46
+ commit({
47
+ variables: {
48
+ input: {
49
+ email,
50
+ type,
51
+ },
52
+ },
53
+ onError,
54
+ onCompleted,
55
+ });
56
+ }, [commit, email, onCompleted, onError, t, type]);
57
+
58
+ return (
59
+ <Button
60
+ type='link'
61
+ disabled={disabled}
62
+ onClick={resendLinkHandler}
63
+ loading={loading}
64
+ size='large'
65
+ >
66
+ {children}
67
+ </Button>
68
+ );
69
+ };
70
+
71
+ export default ResendLinkButton;
@@ -0,0 +1,8 @@
1
+ export { default as Auth } from './Auth';
2
+ export { default as Login } from './Login';
3
+ export { default as Register } from './Register';
4
+ export { default as Forgot } from './Forgot';
5
+ export { default as RecoverPassword } from './RecoverPassword';
6
+ export { default as AuthFooterLinks } from './AuthFooterLinks';
7
+ export { default as LoginForm } from './LoginForm';
8
+ export { default as ResendLinkButton } from './ResendLinkButton';
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @generated SignedSource<<fa5d43293d27c101facae2d958971c83>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ import { ConcreteRequest, Mutation } from 'relay-runtime';
12
+ export type ForgotPasswordInput = {
13
+ email: string;
14
+ };
15
+ export type ForgotPasswordMutation$variables = {
16
+ input: ForgotPasswordInput;
17
+ };
18
+ export type ForgotPasswordMutation$data = {
19
+ readonly forgotPassword: {
20
+ readonly limitExpiresAt: number;
21
+ readonly recoveryLinkIsSent: boolean;
22
+ };
23
+ };
24
+ export type ForgotPasswordMutation = {
25
+ response: ForgotPasswordMutation$data;
26
+ variables: ForgotPasswordMutation$variables;
27
+ };
28
+
29
+ const node: ConcreteRequest = (function () {
30
+ var v0 = [
31
+ {
32
+ "defaultValue": null,
33
+ "kind": "LocalArgument",
34
+ "name": "input"
35
+ }
36
+ ],
37
+ v1 = [
38
+ {
39
+ "alias": null,
40
+ "args": [
41
+ {
42
+ "kind": "Variable",
43
+ "name": "input",
44
+ "variableName": "input"
45
+ }
46
+ ],
47
+ "concreteType": "ForgotPasswordPayload",
48
+ "kind": "LinkedField",
49
+ "name": "forgotPassword",
50
+ "plural": false,
51
+ "selections": [
52
+ {
53
+ "alias": null,
54
+ "args": null,
55
+ "kind": "ScalarField",
56
+ "name": "recoveryLinkIsSent",
57
+ "storageKey": null
58
+ },
59
+ {
60
+ "alias": null,
61
+ "args": null,
62
+ "kind": "ScalarField",
63
+ "name": "limitExpiresAt",
64
+ "storageKey": null
65
+ }
66
+ ],
67
+ "storageKey": null
68
+ }
69
+ ];
70
+ return {
71
+ "fragment": {
72
+ "argumentDefinitions": (v0/*: any*/),
73
+ "kind": "Fragment",
74
+ "metadata": null,
75
+ "name": "ForgotPasswordMutation",
76
+ "selections": (v1/*: any*/),
77
+ "type": "Mutation",
78
+ "abstractKey": null
79
+ },
80
+ "kind": "Request",
81
+ "operation": {
82
+ "argumentDefinitions": (v0/*: any*/),
83
+ "kind": "Operation",
84
+ "name": "ForgotPasswordMutation",
85
+ "selections": (v1/*: any*/)
86
+ },
87
+ "params": {
88
+ "cacheID": "5e5512b2a837741f90fc5a83dacf437f",
89
+ "id": null,
90
+ "metadata": {},
91
+ "name": "ForgotPasswordMutation",
92
+ "operationKind": "mutation",
93
+ "text": "mutation ForgotPasswordMutation(\n $input: ForgotPasswordInput!\n) {\n forgotPassword(input: $input) {\n recoveryLinkIsSent\n limitExpiresAt\n }\n}\n"
94
+ }
95
+ };
96
+ })();
97
+
98
+ (node as any).hash = "13b4d04002f461d3c131f16f81e940a0";
99
+
100
+ export default node;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @generated SignedSource<<e749189577dbf72aa098e36b518ad0c2>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ import { ConcreteRequest, Mutation } from 'relay-runtime';
12
+ export type RegisterInput = {
13
+ email: string;
14
+ isPrivacyPolicyAgree?: boolean | null;
15
+ isUserAgreementAgree?: boolean | null;
16
+ password: string;
17
+ };
18
+ export type LoginMutation$variables = {
19
+ input: RegisterInput;
20
+ };
21
+ export type LoginMutation$data = {
22
+ readonly login: {
23
+ readonly ok: boolean;
24
+ };
25
+ };
26
+ export type LoginMutation = {
27
+ response: LoginMutation$data;
28
+ variables: LoginMutation$variables;
29
+ };
30
+
31
+ const node: ConcreteRequest = (function () {
32
+ var v0 = [
33
+ {
34
+ "defaultValue": null,
35
+ "kind": "LocalArgument",
36
+ "name": "input"
37
+ }
38
+ ],
39
+ v1 = [
40
+ {
41
+ "alias": null,
42
+ "args": [
43
+ {
44
+ "kind": "Variable",
45
+ "name": "input",
46
+ "variableName": "input"
47
+ }
48
+ ],
49
+ "concreteType": "StatusPayload",
50
+ "kind": "LinkedField",
51
+ "name": "login",
52
+ "plural": false,
53
+ "selections": [
54
+ {
55
+ "alias": null,
56
+ "args": null,
57
+ "kind": "ScalarField",
58
+ "name": "ok",
59
+ "storageKey": null
60
+ }
61
+ ],
62
+ "storageKey": null
63
+ }
64
+ ];
65
+ return {
66
+ "fragment": {
67
+ "argumentDefinitions": (v0/*: any*/),
68
+ "kind": "Fragment",
69
+ "metadata": null,
70
+ "name": "LoginMutation",
71
+ "selections": (v1/*: any*/),
72
+ "type": "Mutation",
73
+ "abstractKey": null
74
+ },
75
+ "kind": "Request",
76
+ "operation": {
77
+ "argumentDefinitions": (v0/*: any*/),
78
+ "kind": "Operation",
79
+ "name": "LoginMutation",
80
+ "selections": (v1/*: any*/)
81
+ },
82
+ "params": {
83
+ "cacheID": "5ef263953ba0aafb287d05aacf35c065",
84
+ "id": null,
85
+ "metadata": {},
86
+ "name": "LoginMutation",
87
+ "operationKind": "mutation",
88
+ "text": "mutation LoginMutation(\n $input: RegisterInput!\n) {\n login(input: $input) {\n ok\n }\n}\n"
89
+ }
90
+ };
91
+ })();
92
+
93
+ (node as any).hash = "8aa42da7b9249db347cbcedf54b7eb58";
94
+
95
+ export default node;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @generated SignedSource<<b6e62c629f517274528baab804aebf79>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ import { ConcreteRequest, Mutation } from 'relay-runtime';
12
+ export type RegisterInput = {
13
+ email: string;
14
+ isPrivacyPolicyAgree?: boolean | null;
15
+ isUserAgreementAgree?: boolean | null;
16
+ password: string;
17
+ };
18
+ export type RegisterMutation$variables = {
19
+ input: RegisterInput;
20
+ };
21
+ export type RegisterMutation$data = {
22
+ readonly register: {
23
+ readonly ok: boolean;
24
+ };
25
+ };
26
+ export type RegisterMutation = {
27
+ response: RegisterMutation$data;
28
+ variables: RegisterMutation$variables;
29
+ };
30
+
31
+ const node: ConcreteRequest = (function () {
32
+ var v0 = [
33
+ {
34
+ "defaultValue": null,
35
+ "kind": "LocalArgument",
36
+ "name": "input"
37
+ }
38
+ ],
39
+ v1 = [
40
+ {
41
+ "alias": null,
42
+ "args": [
43
+ {
44
+ "kind": "Variable",
45
+ "name": "input",
46
+ "variableName": "input"
47
+ }
48
+ ],
49
+ "concreteType": "StatusPayload",
50
+ "kind": "LinkedField",
51
+ "name": "register",
52
+ "plural": false,
53
+ "selections": [
54
+ {
55
+ "alias": null,
56
+ "args": null,
57
+ "kind": "ScalarField",
58
+ "name": "ok",
59
+ "storageKey": null
60
+ }
61
+ ],
62
+ "storageKey": null
63
+ }
64
+ ];
65
+ return {
66
+ "fragment": {
67
+ "argumentDefinitions": (v0/*: any*/),
68
+ "kind": "Fragment",
69
+ "metadata": null,
70
+ "name": "RegisterMutation",
71
+ "selections": (v1/*: any*/),
72
+ "type": "Mutation",
73
+ "abstractKey": null
74
+ },
75
+ "kind": "Request",
76
+ "operation": {
77
+ "argumentDefinitions": (v0/*: any*/),
78
+ "kind": "Operation",
79
+ "name": "RegisterMutation",
80
+ "selections": (v1/*: any*/)
81
+ },
82
+ "params": {
83
+ "cacheID": "b634d0db622dc1c41a4c41ba173483ed",
84
+ "id": null,
85
+ "metadata": {},
86
+ "name": "RegisterMutation",
87
+ "operationKind": "mutation",
88
+ "text": "mutation RegisterMutation(\n $input: RegisterInput!\n) {\n register(input: $input) {\n ok\n }\n}\n"
89
+ }
90
+ };
91
+ })();
92
+
93
+ (node as any).hash = "95ef334f9a12340ab240e613480b0a51";
94
+
95
+ export default node;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @generated SignedSource<<0b4534d6e64b9e483cc3dceaa7d594ac>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ import { ConcreteRequest, Mutation } from 'relay-runtime';
12
+ export type ResendLinkInput = {
13
+ email: string;
14
+ type: string;
15
+ };
16
+ export type ResendLinkButtonMutation$variables = {
17
+ input: ResendLinkInput;
18
+ };
19
+ export type ResendLinkButtonMutation$data = {
20
+ readonly resendLink: {
21
+ readonly limitExpiresAt: number;
22
+ readonly ok: boolean;
23
+ };
24
+ };
25
+ export type ResendLinkButtonMutation = {
26
+ response: ResendLinkButtonMutation$data;
27
+ variables: ResendLinkButtonMutation$variables;
28
+ };
29
+
30
+ const node: ConcreteRequest = (function () {
31
+ var v0 = [
32
+ {
33
+ "defaultValue": null,
34
+ "kind": "LocalArgument",
35
+ "name": "input"
36
+ }
37
+ ],
38
+ v1 = [
39
+ {
40
+ "alias": null,
41
+ "args": [
42
+ {
43
+ "kind": "Variable",
44
+ "name": "input",
45
+ "variableName": "input"
46
+ }
47
+ ],
48
+ "concreteType": "ResendLinkPayload",
49
+ "kind": "LinkedField",
50
+ "name": "resendLink",
51
+ "plural": false,
52
+ "selections": [
53
+ {
54
+ "alias": null,
55
+ "args": null,
56
+ "kind": "ScalarField",
57
+ "name": "ok",
58
+ "storageKey": null
59
+ },
60
+ {
61
+ "alias": null,
62
+ "args": null,
63
+ "kind": "ScalarField",
64
+ "name": "limitExpiresAt",
65
+ "storageKey": null
66
+ }
67
+ ],
68
+ "storageKey": null
69
+ }
70
+ ];
71
+ return {
72
+ "fragment": {
73
+ "argumentDefinitions": (v0/*: any*/),
74
+ "kind": "Fragment",
75
+ "metadata": null,
76
+ "name": "ResendLinkButtonMutation",
77
+ "selections": (v1/*: any*/),
78
+ "type": "Mutation",
79
+ "abstractKey": null
80
+ },
81
+ "kind": "Request",
82
+ "operation": {
83
+ "argumentDefinitions": (v0/*: any*/),
84
+ "kind": "Operation",
85
+ "name": "ResendLinkButtonMutation",
86
+ "selections": (v1/*: any*/)
87
+ },
88
+ "params": {
89
+ "cacheID": "cddddaa297ce04eecaf79a4bfa5eb769",
90
+ "id": null,
91
+ "metadata": {},
92
+ "name": "ResendLinkButtonMutation",
93
+ "operationKind": "mutation",
94
+ "text": "mutation ResendLinkButtonMutation(\n $input: ResendLinkInput!\n) {\n resendLink(input: $input) {\n ok\n limitExpiresAt\n }\n}\n"
95
+ }
96
+ };
97
+ })();
98
+
99
+ (node as any).hash = "4610277a9b30028acecc73fe6465f17d";
100
+
101
+ export default node;
@@ -0,0 +1,5 @@
1
+ export { default as LoginMutation } from './LoginMutation.graphql';
2
+ export { default as RegisterMutation } from './RegisterMutation.graphql';
3
+ export { default as ForgotPasswordMutation } from './ForgotPasswordMutation.graphql';
4
+ export { default as ResendLinkButtonMutation } from './ResendLinkButtonMutation.graphql';
5
+ export { default as recoveryMutation } from './recoveryMutation.graphql';
@@ -0,0 +1,91 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ // @ts-nocheck
4
+
5
+ import { ConcreteRequest, Mutation } from 'relay-runtime';
6
+
7
+ export type RecoverPasswordInput = {
8
+ token: string;
9
+ password: string;
10
+ };
11
+
12
+ export type recoveryMutation$variables = {
13
+ input: RecoverPasswordInput;
14
+ };
15
+
16
+ export type recoveryMutation$data = {
17
+ readonly recoverPassword: {
18
+ readonly ok: boolean;
19
+ };
20
+ };
21
+
22
+ export type recoveryMutation = {
23
+ response: recoveryMutation$data;
24
+ variables: recoveryMutation$variables;
25
+ };
26
+
27
+ const node: ConcreteRequest = (function () {
28
+ var v0 = [
29
+ {
30
+ "defaultValue": null,
31
+ "kind": "LocalArgument",
32
+ "name": "input"
33
+ }
34
+ ],
35
+ v1 = [
36
+ {
37
+ "alias": null,
38
+ "args": [
39
+ {
40
+ "kind": "Variable",
41
+ "name": "input",
42
+ "variableName": "input"
43
+ }
44
+ ],
45
+ "concreteType": "StatusPayload",
46
+ "kind": "LinkedField",
47
+ "name": "recoverPassword",
48
+ "plural": false,
49
+ "selections": [
50
+ {
51
+ "alias": null,
52
+ "args": null,
53
+ "kind": "ScalarField",
54
+ "name": "ok",
55
+ "storageKey": null
56
+ }
57
+ ],
58
+ "storageKey": null
59
+ }
60
+ ];
61
+ return {
62
+ "fragment": {
63
+ "argumentDefinitions": (v0/*: any*/),
64
+ "kind": "Fragment",
65
+ "metadata": null,
66
+ "name": "recoveryMutation",
67
+ "selections": (v1/*: any*/),
68
+ "type": "Mutation",
69
+ "abstractKey": null
70
+ },
71
+ "kind": "Request",
72
+ "operation": {
73
+ "argumentDefinitions": (v0/*: any*/),
74
+ "kind": "Operation",
75
+ "name": "recoveryMutation",
76
+ "selections": (v1/*: any*/)
77
+ },
78
+ "params": {
79
+ "cacheID": "recoveryMutationManualReconstruction",
80
+ "id": null,
81
+ "metadata": {},
82
+ "name": "recoveryMutation",
83
+ "operationKind": "mutation",
84
+ "text": "mutation recoveryMutation(\n $input: RecoverPasswordInput!\n) {\n recoverPassword(input: $input) {\n ok\n }\n}\n"
85
+ }
86
+ };
87
+ })();
88
+
89
+ (node as any).hash = "recoveryMutationHash";
90
+
91
+ export default node;
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './auth';
2
+ export * from './ui';
3
+ export * from './utils';
4
+ export * from './graphql';