@antscorp/antsomi-ui 1.3.5-beta.648 → 1.3.5-beta.650

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 (21) hide show
  1. package/es/components/organism/Login/Login.d.ts +1 -16
  2. package/es/components/organism/Login/Login.js +8 -5
  3. package/es/components/organism/Login/components/Avatar/Avatar.d.ts +3 -3
  4. package/es/components/organism/Login/components/IconInfo/IconInfo.d.ts +7 -0
  5. package/es/components/organism/Login/components/IconInfo/IconInfo.js +25 -0
  6. package/es/components/organism/Login/components/IconInfo/index.d.ts +0 -0
  7. package/es/components/organism/Login/components/IconInfo/index.js +1 -0
  8. package/es/components/organism/Login/components/LoginSelectPortal/Item/styled.js +10 -2
  9. package/es/components/organism/Login/components/LoginStep2/LoginStep2.d.ts +2 -5
  10. package/es/components/organism/Login/components/LoginStep2/LoginStep2.js +9 -15
  11. package/es/components/organism/Login/components/SetupGGAuthenticator/SetupGGAuthenticator.d.ts +1 -4
  12. package/es/components/organism/Login/components/SetupGGAuthenticator/SetupGGAuthenticator.js +11 -23
  13. package/es/components/organism/Login/components/SignIn/SignIn.d.ts +2 -1
  14. package/es/components/organism/Login/components/SignIn/SignIn.js +3 -1
  15. package/es/components/organism/Login/components/SignIn/styled.d.ts +3 -1
  16. package/es/components/organism/Login/components/SignIn/styled.js +2 -1
  17. package/es/components/organism/Login/styled.d.ts +5 -1
  18. package/es/components/organism/Login/styled.js +11 -1
  19. package/es/components/organism/Login/types/index.d.ts +6 -1
  20. package/es/providers/ConfigProvider/GlobalStyle.js +9 -0
  21. package/package.json +2 -1
@@ -1,18 +1,3 @@
1
1
  import React from 'react';
2
- interface LoginComponentProps {
3
- loginDomain: string;
4
- apiDomain?: string;
5
- networkId?: string | boolean;
6
- onLoginSuccess?: (data: any) => void;
7
- onLoginFail?: (data: any) => void;
8
- reCaptchaKey?: string;
9
- p_id?: string;
10
- onResendPassFail?: () => void;
11
- u_ogs?: string;
12
- width?: number;
13
- callbackUrl?: string;
14
- theme?: string;
15
- usePrivilege?: boolean;
16
- }
2
+ import { LoginComponentProps } from './types';
17
3
  export declare const Login: React.FC<LoginComponentProps>;
18
- export {};
@@ -17,7 +17,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  import React, { useState, useEffect, useRef } from 'react';
18
18
  import { CookiesProvider, useCookies } from 'react-cookie';
19
19
  import { get } from 'lodash';
20
- import { Flex } from 'antd';
21
20
  import axios from 'axios';
22
21
  // Components
23
22
  import ForgotPassword from './components/ForgotPassword';
@@ -26,7 +25,8 @@ import SetupGGAuthenticator from './components/SetupGGAuthenticator';
26
25
  // Utils
27
26
  import { checkURL, navigateTo } from './utils';
28
27
  import { STEPS } from './constants';
29
- import { WrapperLogin } from './styled';
28
+ import { LoginBannerZone, LoginMain, WrapperLogin } from './styled';
29
+ import { isMobile } from 'react-device-detect';
30
30
  export const Login = props => {
31
31
  const { loginDomain = 'http://khanhhv.platform-ants.adxdev.vn', onLoginSuccess, onLoginFail, reCaptchaKey = '6LfqGF0UAAAAAFJri0tlp8eCNbWZdJv1eAyF4oIo', p_id, onResendPassFail, u_ogs, width, callbackUrl, apiDomain = '//permission.antsomi.com', usePrivilege, } = props;
32
32
  let { networkId } = props;
@@ -122,7 +122,9 @@ export const Login = props => {
122
122
  },
123
123
  })
124
124
  .then(res => {
125
- res && res.data && redirectFirstMenu(res.data.data, redirectAccountId);
125
+ if (res && res.data) {
126
+ redirectFirstMenu(res.data.data, redirectAccountId);
127
+ }
126
128
  });
127
129
  });
128
130
  const redirectFirstMenu = (data, redirectAccountId) => {
@@ -669,6 +671,7 @@ export const Login = props => {
669
671
  }
670
672
  };
671
673
  return (React.createElement(CookiesProvider, null,
672
- React.createElement(Flex, { style: { background: '#EAF1FB', margin: ' auto' } },
673
- React.createElement(WrapperLogin, { vertical: true, align: "center", gap: 40 }, renderMain()))));
674
+ React.createElement(LoginMain, { justify: isMobile ? 'center' : 'start' },
675
+ React.createElement(WrapperLogin, { isMobile: isMobile, vertical: true, align: "center", gap: 40 }, renderMain()),
676
+ !isMobile && React.createElement(LoginBannerZone, { className: "login-banner-zone", id: "login_banner_zone" }))));
674
677
  };
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  type TAvatar = {
3
- image: string;
4
- name: string;
5
- email: string;
3
+ image?: string;
4
+ name?: string;
5
+ email?: string;
6
6
  };
7
7
  export declare const Avatar: React.FC<TAvatar>;
8
8
  export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ type TIconInfo = {
3
+ image?: string;
4
+ title: React.ReactNode | string;
5
+ };
6
+ export declare const IconInfo: React.FC<TIconInfo>;
7
+ export {};
@@ -0,0 +1,25 @@
1
+ import { ModalV2 } from '@antscorp/antsomi-ui/es/components/molecules';
2
+ import Icon from '@antscorp/icons';
3
+ import { Flex, Tooltip, Typography } from 'antd';
4
+ import React, { useState } from 'react';
5
+ import { isMobile } from 'react-device-detect';
6
+ const { Text } = Typography;
7
+ export const IconInfo = props => {
8
+ const { image, title } = props;
9
+ const [open, setOpen] = useState(false);
10
+ if (isMobile) {
11
+ return (React.createElement(React.Fragment, null,
12
+ React.createElement(ModalV2, { open: open, onCancel: () => setOpen(false), centered: true, footer: null },
13
+ React.createElement(Flex, { vertical: true, align: "center", gap: 10 },
14
+ React.createElement("img", { src: image, alt: "", width: 200 }),
15
+ title)),
16
+ React.createElement(Icon, { type: "icon-ants-info-outline", onClick: () => setOpen(true) })));
17
+ }
18
+ return (React.createElement(Tooltip, { overlayInnerStyle: {
19
+ width: 350,
20
+ padding: 20,
21
+ }, title: React.createElement(Flex, { vertical: true, align: "center", gap: 10 },
22
+ React.createElement("img", { src: image, alt: "", width: 200 }),
23
+ title), color: "#fff", placement: "top" },
24
+ React.createElement(Icon, { type: "icon-ants-info-outline" })));
25
+ };
@@ -1,11 +1,18 @@
1
1
  import styled from 'styled-components';
2
2
  export const WrapperItem = styled.div `
3
+ display: flex;
4
+
5
+ justify-content: center;
6
+ align-items: center;
7
+ flex-direction: column;
8
+
3
9
  width: 100%;
4
10
  height: 119px;
5
- border: 1px solid #b8cfe6;
6
11
  border-radius: 10px;
12
+ padding: 10px 10px 0 10px;
13
+
14
+ border: 1px solid #b8cfe6;
7
15
  cursor: pointer;
8
- padding: 26px 10px 0 10px;
9
16
 
10
17
  img {
11
18
  margin-bottom: 10px;
@@ -22,4 +29,5 @@ export const WrapperItem = styled.div `
22
29
  export const BlockEnd = styled.div `
23
30
  border-top: 1px solid #b8cfe6;
24
31
  overflow: hidden;
32
+ width: 100%;
25
33
  `;
@@ -5,13 +5,10 @@ interface TLoginStep2 {
5
5
  codeKey?: string;
6
6
  token?: string;
7
7
  username?: string;
8
- onLoginSuccess?: (data: any) => void;
8
+ onLoginSuccess?: (data: Partial<LoginData>) => void;
9
9
  onLoginFail?: () => void;
10
10
  backLogin?: () => void;
11
- loginData: {
12
- personal?: Partial<LoginData>;
13
- token?: string;
14
- };
11
+ loginData?: Partial<LoginData>;
15
12
  }
16
13
  export declare const LoginStep2: React.FC<TLoginStep2>;
17
14
  export {};
@@ -1,17 +1,17 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
2
  // Libraries
3
- import { Button, Checkbox, Flex, Input, Tooltip, Typography } from 'antd';
3
+ import { Button, Checkbox, Flex, Input, Typography } from 'antd';
4
4
  import { get } from 'lodash';
5
5
  import React, { useEffect, useRef } from 'react';
6
6
  import { useImmer } from 'use-immer';
7
7
  import { useCookies } from 'react-cookie';
8
- import Icon from '@antscorp/icons';
9
8
  // Components
10
9
  import { WidgetLayout } from '../WidgetLayout';
11
10
  import { Avatar } from '../Avatar';
12
11
  import loginStep2Image from '../../../../../assets/images/components/Login/loginStep2.png';
13
12
  import step2 from '../../../../../assets/images/components/Login/step2.png';
14
13
  import { TextButton } from '../ForgotPassword/styled';
14
+ import { IconInfo } from '../IconInfo/IconInfo';
15
15
  const { Text } = Typography;
16
16
  export const LoginStep2 = props => {
17
17
  const { loginData, domainLogin, codeKey = 'code', token = '', username = '', onLoginSuccess, onLoginFail, backLogin, } = props;
@@ -114,18 +114,12 @@ export const LoginStep2 = props => {
114
114
  React.createElement(Flex, { vertical: true, gap: 10 },
115
115
  React.createElement(Flex, { gap: 10, align: "center" },
116
116
  React.createElement(Text, null, "Please enter the 6-digit code registered to your device."),
117
- React.createElement(Tooltip, { overlayInnerStyle: {
118
- width: 350,
119
- padding: 20,
120
- }, title: React.createElement(Flex, { vertical: true, align: "center", gap: 10 },
121
- React.createElement("img", { src: step2, alt: "", width: 200 }),
122
- React.createElement(Text, { style: {
123
- marginTop: 20,
124
- textAlign: 'center',
125
- } },
126
- "Open Google Authenticator and enter the code from ",
127
- React.createElement("b", null, "antsomi.com"))), color: "#fff", placement: "top" },
128
- React.createElement(Icon, { type: "icon-ants-info-outline" }))),
117
+ React.createElement(IconInfo, { image: step2, title: React.createElement(Text, { style: {
118
+ marginTop: 20,
119
+ textAlign: 'center',
120
+ } },
121
+ "Open Google Authenticator and enter the code from ",
122
+ React.createElement("b", null, "antsomi.com")) })),
129
123
  React.createElement(Input, { maxLength: 6, placeholder: "Enter Code Here", value: state.code, onChange: e => {
130
124
  setState(draft => {
131
125
  draft.code = e.target.value;
@@ -138,7 +132,7 @@ export const LoginStep2 = props => {
138
132
  draft.isTrust = e.target.checked;
139
133
  });
140
134
  } },
141
- React.createElement(Text, null, "Don't ask again on this browser")))), footer: React.createElement(Flex, { vertical: true, gap: 50 },
135
+ React.createElement(Text, null, `Don't ask again on this browser`)))), footer: React.createElement(Flex, { vertical: true, gap: 50 },
142
136
  React.createElement(Flex, { vertical: true, gap: 15 },
143
137
  React.createElement(Button, { type: "primary", onClick: signIn }, "Verify"),
144
138
  React.createElement(Button, { onClick: handleBack }, "Back to login")),
@@ -4,10 +4,7 @@ interface SetupGGAuthenticatorProps {
4
4
  domainLogin: string;
5
5
  token?: string;
6
6
  userId: string;
7
- loginData: {
8
- personal?: Partial<LoginData>;
9
- token?: string;
10
- };
7
+ loginData: Partial<LoginData>;
11
8
  onSkipSetupGGAuthenticator?: () => void;
12
9
  onSetupGGAuthenticatorDone?: (data: any) => void;
13
10
  }
@@ -1,9 +1,8 @@
1
1
  // Libraries
2
2
  import React, { useState, useEffect, useRef } from 'react';
3
3
  import axios from 'axios';
4
- import { Button, Flex, Input, Tooltip, Typography } from 'antd';
4
+ import { Button, Flex, Input, Typography } from 'antd';
5
5
  import { get } from 'lodash';
6
- import Icon from '@antscorp/icons';
7
6
  // Components
8
7
  import { WidgetLayout } from '../WidgetLayout';
9
8
  import { Avatar } from '../Avatar';
@@ -11,6 +10,7 @@ import imageStep1 from '../../../../../assets/images/components/Login/step1.png'
11
10
  import imageStep2 from '../../../../../assets/images/components/Login/step2.png';
12
11
  // Styled
13
12
  import { LabelStep } from './styled';
13
+ import { IconInfo } from '../IconInfo/IconInfo';
14
14
  const { Text } = Typography;
15
15
  const SetupGGAuthenticator = props => {
16
16
  const { domainLogin, token = '', userId, loginData, onSkipSetupGGAuthenticator, onSetupGGAuthenticatorDone, } = props;
@@ -73,18 +73,12 @@ const SetupGGAuthenticator = props => {
73
73
  React.createElement(LabelStep, null, "STEP 1"),
74
74
  React.createElement(Flex, { align: "center", gap: 5 },
75
75
  "Install Google Authenticator on your phone scan the code",
76
- React.createElement(Tooltip, { overlayInnerStyle: {
77
- width: 350,
78
- padding: 20,
79
- }, title: React.createElement(Flex, { vertical: true, align: "center" },
80
- React.createElement("img", { src: imageStep1, alt: "", width: 200 }),
81
- React.createElement(Text, { style: {
82
- marginTop: 20,
83
- } },
84
- "Open ",
85
- React.createElement("b", null, "Google Authenticator"),
86
- " app on your phone and scan QR code.")), color: "#fff", placement: "top" },
87
- React.createElement(Icon, { type: "icon-ants-info-outline", color: "#595959" }))),
76
+ React.createElement(IconInfo, { image: imageStep1, title: React.createElement(Text, { style: {
77
+ marginTop: 20,
78
+ } },
79
+ "Open ",
80
+ React.createElement("b", null, "Google Authenticator"),
81
+ " app on your phone and scan QR code.") })),
88
82
  qrCode ? (React.createElement(Flex, { vertical: true, align: "center", style: {
89
83
  background: '#EEF5FC',
90
84
  padding: 10,
@@ -98,15 +92,9 @@ const SetupGGAuthenticator = props => {
98
92
  React.createElement(Flex, { align: "center", gap: 4 },
99
93
  "Enter the 6-digit code from ",
100
94
  React.createElement("span", { style: { fontWeight: 'bold' } }, "antsomi.com"),
101
- React.createElement(Tooltip, { overlayInnerStyle: {
102
- width: 350,
103
- padding: 20,
104
- }, title: React.createElement(Flex, { vertical: true, align: "center" },
105
- React.createElement("img", { src: imageStep2, alt: "", width: 200 }),
106
- React.createElement(Text, { style: {
107
- marginTop: 20,
108
- } }, "Enter the code to confirm the connection to this account")), color: "#fff", placement: "top" },
109
- React.createElement(Icon, { type: "icon-ants-info-outline", color: "#595959" }))),
95
+ React.createElement(IconInfo, { image: imageStep2, title: React.createElement(Text, { style: {
96
+ marginTop: 20,
97
+ } }, "Enter the code to confirm the connection to this account") })),
110
98
  React.createElement(Input, { placeholder: "Input your code", onChange: e => {
111
99
  setG2faCode(e.target.value.trim());
112
100
  if (e.target.value.trim().length) {
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
+ import { LoginData } from '../../types';
2
3
  type TSignIn = {
3
4
  domainLogin: string;
4
5
  networkId?: string;
5
6
  urlLogo?: string;
6
7
  onForgotPassword?: () => void;
7
- onLoginSuccess?: (data: any) => void;
8
+ onLoginSuccess?: (data: Partial<LoginData>) => void;
8
9
  onLoginFail?: (data: any) => void;
9
10
  userNameKey?: string;
10
11
  passwordKey?: string;
@@ -8,6 +8,7 @@ import { Label, WrapperImage } from '../../styled';
8
8
  // Images
9
9
  import logoAntsomi from '../../../../../assets/images/logo/antsomi_logo.png';
10
10
  import { Wrapper } from './styled';
11
+ import { isMobile } from 'react-device-detect';
11
12
  export const SignIn = props => {
12
13
  const { domainLogin, networkId, urlLogo, onForgotPassword, onLoginSuccess, onLoginFail, userNameKey = 'user_name', passwordKey = 'password', } = props;
13
14
  const [form] = Form.useForm();
@@ -61,7 +62,8 @@ export const SignIn = props => {
61
62
  };
62
63
  xhr.send(JSON.stringify(params));
63
64
  };
64
- return (React.createElement(Wrapper, null,
65
+ console.log({ isMobile });
66
+ return (React.createElement(Wrapper, { isMobile: isMobile },
65
67
  React.createElement(Flex, { align: "center", justify: "center" }, !isEmpty(urlLogo) ? (React.createElement("img", { src: urlLogo, style: { maxHeight: 39 }, alt: "" })) : typeof LOGO_NETWORK_DOMAIN !== 'undefined' && LOGO_NETWORK_DOMAIN !== '' ? (React.createElement("img", { src: LOGO_NETWORK_DOMAIN, style: { maxHeight: 39 }, alt: "" })) : (React.createElement(WrapperImage, { src: logoAntsomi, alt: "logosaS" }))),
66
68
  React.createElement(Form, { form: form, name: "login_form", onFinish: onFinish, scrollToFirstError: true, style: { width: '100%' } },
67
69
  React.createElement(Form.Item, { name: "email", rules: [
@@ -1 +1,3 @@
1
- export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {
2
+ isMobile: boolean;
3
+ }, never>;
@@ -4,6 +4,7 @@ export const Wrapper = styled.div `
4
4
  flex-direction: column;
5
5
  gap: 40px;
6
6
 
7
- padding: 60px 20px;
8
7
  width: 100%;
8
+
9
+ ${(props) => !props.isMobile ? 'padding: 60px 20px' : ' padding: 60px 0px'}
9
10
  `;
@@ -1,5 +1,9 @@
1
1
  /// <reference types="react" />
2
- export declare const WrapperLogin: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
2
+ export declare const LoginMain: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
3
+ export declare const LoginBannerZone: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const WrapperLogin: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {
5
+ isMobile: boolean;
6
+ }, never>;
3
7
  export declare const WrapperImage: import("styled-components").StyledComponent<"img", any, {}, never>;
4
8
  export declare const Label: import("styled-components").StyledComponent<"span", any, {}, never>;
5
9
  export declare const Image: import("styled-components").StyledComponent<"img", any, {}, never>;
@@ -1,12 +1,22 @@
1
1
  import { Flex } from 'antd';
2
2
  import styled from 'styled-components';
3
+ export const LoginMain = styled(Flex) `
4
+ background: #eaf1fb;
5
+ height: 100vh;
6
+ width: 100%;
7
+ `;
8
+ export const LoginBannerZone = styled.div `
9
+ display: flex;
10
+ flex: 1;
11
+ `;
3
12
  export const WrapperLogin = styled(Flex) `
4
13
  width: 400px;
5
14
  height: 100%;
6
15
  overflow-y: auto;
7
16
  background-color: white;
8
17
  padding: 40px 30px;
9
- box-shadow: 3px 0px 9px 0px #002e5926;
18
+
19
+ ${(props) => !props.isMobile ? 'box-shadow: 3px 0px 9px 0px #002e5926' : ''}
10
20
  `;
11
21
  export const WrapperImage = styled.img `
12
22
  width: 180px;
@@ -11,8 +11,13 @@ export interface LoginData {
11
11
  email: string;
12
12
  avatar: string;
13
13
  user_id: string;
14
+ role: string;
15
+ language: string;
14
16
  [key: string]: any;
15
17
  };
18
+ G2FA_user: number;
19
+ G2FA: number;
20
+ status: boolean;
16
21
  [key: string]: any;
17
22
  }
18
23
  export interface Account {
@@ -23,7 +28,7 @@ export interface LoginComponentProps {
23
28
  loginDomain: string;
24
29
  apiDomain?: string;
25
30
  networkId?: string | boolean;
26
- onLoginSuccess?: (data: any) => void;
31
+ onLoginSuccess?: (data: Partial<LoginData>) => void;
27
32
  onLoginFail?: (data: any) => void;
28
33
  reCaptchaKey?: string;
29
34
  p_id?: string;
@@ -391,6 +391,15 @@ export const GlobalStyle = () => {
391
391
  .antsomi-picker {
392
392
  border-width: 0 0 1px 0 !important;
393
393
  box-shadow: none !important;
394
+
395
+ > .antsomi-picker-input {
396
+ input {
397
+ &::placeholder {
398
+ font-style: normal !important;
399
+ font-size: ${fontSize}px !important;
400
+ }
401
+ }
402
+ }
394
403
  }
395
404
 
396
405
  .antsomi-picker:hover,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.648",
3
+ "version": "1.3.5-beta.650",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -113,6 +113,7 @@
113
113
  "react-color": "2.19.3",
114
114
  "react-cookie": "^7.1.4",
115
115
  "react-custom-scrollbars": "^4.2.1",
116
+ "react-device-detect": "^2.2.3",
116
117
  "react-draggable": "^4.4.5",
117
118
  "react-frame-component": "^5.2.6",
118
119
  "react-google-recaptcha": "^3.1.0",