@antscorp/antsomi-ui 1.3.7-beta.7 → 1.3.7-beta.71
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/README.md +70 -0
- package/es/components/atoms/Input/Input.js +3 -1
- package/es/components/atoms/InputDynamic/InputDynamic.js +3 -3
- package/es/components/atoms/Tag/Tag.js +1 -1
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +2 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +2 -0
- package/es/components/icons/QRCodeManagementIcon.d.ts +3 -0
- package/es/components/icons/QRCodeManagementIcon.js +7 -0
- package/es/components/icons/QRSetDashboardIcon.d.ts +3 -0
- package/es/components/icons/QRSetDashboardIcon.js +7 -0
- package/es/components/icons/index.d.ts +2 -0
- package/es/components/icons/index.js +2 -0
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +28 -2
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +1 -0
- package/es/components/molecules/AddDynamicContent/constants.d.ts +2 -0
- package/es/components/molecules/AddDynamicContent/constants.js +2 -0
- package/es/components/molecules/ColorPicker/index.d.ts +2 -0
- package/es/components/molecules/ColorPicker/index.js +8 -3
- package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +1 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +2 -2
- package/es/components/molecules/EmojiPopover/styled.d.ts +2 -2
- package/es/components/molecules/EmojiPopover/styled.js +1 -1
- package/es/components/molecules/EmptyData/EmptyData.d.ts +1 -1
- package/es/components/molecules/EmptyData/EmptyData.js +4 -2
- package/es/components/molecules/HeaderV2/HeaderV2.d.ts +1 -1
- package/es/components/molecules/InputSearch/index.d.ts +1 -1
- package/es/components/molecules/InputSearch/index.js +2 -1
- package/es/components/molecules/Modal/Modal.js +7 -1
- package/es/components/molecules/ModalV2/ModalV2.js +2 -1
- package/es/components/molecules/SearchPopover/SearchPopover.js +2 -2
- package/es/components/molecules/SearchPopover/styled.d.ts +12 -1
- package/es/components/molecules/SearchPopover/styled.js +1 -2
- package/es/components/molecules/SearchPopover/types.d.ts +4 -3
- package/es/components/molecules/Select/Select.js +3 -3
- package/es/components/molecules/Select/styled.d.ts +3 -1
- package/es/components/molecules/Select/styled.js +50 -6
- package/es/components/molecules/ShareAccess/ShareAccess.d.ts +2 -1
- package/es/components/molecules/ShareAccess/ShareAccess.js +12 -9
- package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +5 -5
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +2 -2
- package/es/components/molecules/ShareAccess/hooks/useShareAccess.d.ts +2 -1
- package/es/components/molecules/ShareAccess/index.d.ts +1 -0
- package/es/components/molecules/ShareAccess/reducer.d.ts +1 -1
- package/es/components/molecules/ShareAccess/reducer.js +7 -4
- package/es/components/molecules/ShareAccess/types.d.ts +22 -0
- package/es/components/molecules/ShareAccess/utils.d.ts +3 -1
- package/es/components/molecules/ShareAccess/utils.js +35 -2
- package/es/components/molecules/TagifyInput/TagifyInput.js +48 -27
- package/es/components/molecules/TagifyInput/types.d.ts +14 -8
- package/es/components/molecules/TagifyInput/utils.d.ts +6 -1
- package/es/components/molecules/TagifyInput/utils.js +19 -0
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +3 -7
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +10 -10
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +46 -327
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.d.ts +9 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.js +5 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.d.ts +23 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.js +81 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.d.ts +24 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.js +32 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.d.ts +26 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.js +93 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.d.ts +24 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.js +94 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.d.ts +7 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.js +132 -0
- package/es/components/molecules/VirtualizedMenu/styled.js +14 -3
- package/es/components/molecules/VirtualizedMenu/types.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/utils.js +1 -0
- package/es/components/molecules/index.d.ts +1 -0
- package/es/components/organism/AccountSharing/AccountSharing.d.ts +1 -0
- package/es/components/organism/AccountSharing/AccountSharing.js +17 -33
- package/es/components/organism/AccountSharing/styled.js +1 -1
- package/es/components/organism/ActivityTimeline/ActivityTimeline.js +3 -3
- package/es/components/organism/ActivityTimeline/constants.d.ts +9 -9
- package/es/components/organism/ActivityTimeline/constants.js +3 -3
- package/es/components/organism/ActivityTimeline/index.d.ts +530 -1
- package/es/components/organism/ActivityTimeline/index.js +9 -1
- package/es/components/organism/ActivityTimeline/utils.js +186 -15
- package/es/components/organism/LeftMenu/LeftMenu.js +6 -6
- package/es/components/organism/LeftMenu/hooks/usePermission.js +1 -1
- package/es/components/organism/LeftMenu/styled.js +2 -0
- package/es/components/organism/LeftMenu/types/index.d.ts +7 -0
- package/es/components/organism/LeftMenu/utils/index.js +1 -1
- package/es/components/organism/Login/Login.js +19 -36
- package/es/components/organism/Login/components/IconInfo/IconInfo.js +1 -1
- package/es/components/organism/Login/components/LoginSelectPortal/LoginSelectPortal.js +1 -1
- package/es/components/organism/Login/components/SignIn/SignIn.js +2 -2
- package/es/components/organism/Login/types/index.d.ts +2 -0
- package/es/components/organism/LoginV2/LoginV2.d.ts +3 -0
- package/es/components/organism/LoginV2/LoginV2.js +957 -0
- package/es/components/organism/LoginV2/components/Avatar/Avatar.d.ts +8 -0
- package/es/components/organism/LoginV2/components/Avatar/Avatar.js +11 -0
- package/es/components/organism/LoginV2/components/Avatar/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/Avatar/index.js +1 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/ChooseMethod.d.ts +9 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/ChooseMethod.js +54 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/Method.d.ts +10 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/Method.js +13 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/index.js +1 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/styled.d.ts +10 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/styled.js +24 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/utils.d.ts +1 -0
- package/es/components/organism/LoginV2/components/ChooseMethod/utils.js +1 -0
- package/es/components/organism/LoginV2/components/ForgotPassword/ForgotPassword.d.ts +14 -0
- package/es/components/organism/LoginV2/components/ForgotPassword/ForgotPassword.js +195 -0
- package/es/components/organism/LoginV2/components/ForgotPassword/index.d.ts +2 -0
- package/es/components/organism/LoginV2/components/ForgotPassword/index.js +2 -0
- package/es/components/organism/LoginV2/components/ForgotPassword/styled.d.ts +1 -0
- package/es/components/organism/LoginV2/components/ForgotPassword/styled.js +10 -0
- package/es/components/organism/LoginV2/components/IconInfo/IconInfo.d.ts +7 -0
- package/es/components/organism/LoginV2/components/IconInfo/IconInfo.js +18 -0
- package/es/components/organism/LoginV2/components/IconInfo/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/IconInfo/index.js +1 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/Item.d.ts +10 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/Item.js +12 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/index.js +1 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/styled.d.ts +2 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/styled.js +34 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/LoginSelectPortal.d.ts +19 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/LoginSelectPortal.js +194 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/index.js +1 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/styled.d.ts +1 -0
- package/es/components/organism/LoginV2/components/LoginSelectPortal/styled.js +5 -0
- package/es/components/organism/LoginV2/components/LoginWithEmail/LoginWithEmail.d.ts +15 -0
- package/es/components/organism/LoginV2/components/LoginWithEmail/LoginWithEmail.js +211 -0
- package/es/components/organism/LoginV2/components/LoginWithEmail/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/LoginWithEmail/index.js +1 -0
- package/es/components/organism/LoginV2/components/LoginWithEmail/styled.d.ts +3 -0
- package/es/components/organism/LoginV2/components/LoginWithEmail/styled.js +5 -0
- package/es/components/organism/LoginV2/components/LoginWithGG/LoginWithGG.d.ts +14 -0
- package/es/components/organism/LoginV2/components/LoginWithGG/LoginWithGG.js +116 -0
- package/es/components/organism/LoginV2/components/LoginWithGG/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/LoginWithGG/index.js +1 -0
- package/es/components/organism/LoginV2/components/LoginWithGG/styled.d.ts +3 -0
- package/es/components/organism/LoginV2/components/LoginWithGG/styled.js +5 -0
- package/es/components/organism/LoginV2/components/Logo/Logo.d.ts +6 -0
- package/es/components/organism/LoginV2/components/Logo/Logo.js +9 -0
- package/es/components/organism/LoginV2/components/Logo/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/Logo/index.js +1 -0
- package/es/components/organism/LoginV2/components/OryConsent/OryAuthLayout.d.ts +9 -0
- package/es/components/organism/LoginV2/components/OryConsent/OryAuthLayout.js +4 -0
- package/es/components/organism/LoginV2/components/OryConsent/OryConsent.d.ts +17 -0
- package/es/components/organism/LoginV2/components/OryConsent/OryConsent.js +204 -0
- package/es/components/organism/LoginV2/components/OryConsent/OryThemeProvider.d.ts +8 -0
- package/es/components/organism/LoginV2/components/OryConsent/OryThemeProvider.js +10 -0
- package/es/components/organism/LoginV2/components/OryConsent/PortalSelect.d.ts +15 -0
- package/es/components/organism/LoginV2/components/OryConsent/PortalSelect.js +30 -0
- package/es/components/organism/LoginV2/components/OryConsent/ScopeConsent.d.ts +20 -0
- package/es/components/organism/LoginV2/components/OryConsent/ScopeConsent.js +29 -0
- package/es/components/organism/LoginV2/components/OryConsent/index.d.ts +2 -0
- package/es/components/organism/LoginV2/components/OryConsent/index.js +2 -0
- package/es/components/organism/LoginV2/components/OryConsent/styled.d.ts +31 -0
- package/es/components/organism/LoginV2/components/OryConsent/styled.js +292 -0
- package/es/components/organism/LoginV2/components/OrySignIn/OryFormShell.d.ts +9 -0
- package/es/components/organism/LoginV2/components/OrySignIn/OryFormShell.js +36 -0
- package/es/components/organism/LoginV2/components/OrySignIn/OryMfa.d.ts +11 -0
- package/es/components/organism/LoginV2/components/OrySignIn/OryMfa.js +144 -0
- package/es/components/organism/LoginV2/components/OrySignIn/OryRecovery.d.ts +9 -0
- package/es/components/organism/LoginV2/components/OrySignIn/OryRecovery.js +128 -0
- package/es/components/organism/LoginV2/components/OrySignIn/OryStatus.d.ts +17 -0
- package/es/components/organism/LoginV2/components/OrySignIn/OryStatus.js +33 -0
- package/es/components/organism/LoginV2/components/OrySignIn/index.d.ts +3 -0
- package/es/components/organism/LoginV2/components/OrySignIn/index.js +3 -0
- package/es/components/organism/LoginV2/components/SetupGGAuthenticator/SetupGGAuthenticator.d.ts +14 -0
- package/es/components/organism/LoginV2/components/SetupGGAuthenticator/SetupGGAuthenticator.js +100 -0
- package/es/components/organism/LoginV2/components/SetupGGAuthenticator/index.d.ts +2 -0
- package/es/components/organism/LoginV2/components/SetupGGAuthenticator/index.js +2 -0
- package/es/components/organism/LoginV2/components/SetupGGAuthenticator/styled.d.ts +4 -0
- package/es/components/organism/LoginV2/components/SetupGGAuthenticator/styled.js +10 -0
- package/es/components/organism/LoginV2/components/SignIn/SignIn.d.ts +22 -0
- package/es/components/organism/LoginV2/components/SignIn/SignIn.js +107 -0
- package/es/components/organism/LoginV2/components/SignIn/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/SignIn/index.js +1 -0
- package/es/components/organism/LoginV2/components/SignIn/styled.d.ts +3 -0
- package/es/components/organism/LoginV2/components/SignIn/styled.js +10 -0
- package/es/components/organism/LoginV2/components/VerifyAccount/VerifyAccount.d.ts +25 -0
- package/es/components/organism/LoginV2/components/VerifyAccount/VerifyAccount.js +42 -0
- package/es/components/organism/LoginV2/components/VerifyAccount/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/VerifyAccount/index.js +1 -0
- package/es/components/organism/LoginV2/components/VerifyAccount/styled.d.ts +22 -0
- package/es/components/organism/LoginV2/components/VerifyAccount/styled.js +17 -0
- package/es/components/organism/LoginV2/components/WidgetLayout/WidgetLayout.d.ts +13 -0
- package/es/components/organism/LoginV2/components/WidgetLayout/WidgetLayout.js +18 -0
- package/es/components/organism/LoginV2/components/WidgetLayout/index.d.ts +1 -0
- package/es/components/organism/LoginV2/components/WidgetLayout/index.js +1 -0
- package/es/components/organism/LoginV2/components/WidgetLayout/styled.d.ts +5 -0
- package/es/components/organism/LoginV2/components/WidgetLayout/styled.js +22 -0
- package/es/components/organism/LoginV2/components/index.d.ts +11 -0
- package/es/components/organism/LoginV2/components/index.js +11 -0
- package/es/components/organism/LoginV2/constants/index.d.ts +48 -0
- package/es/components/organism/LoginV2/constants/index.js +48 -0
- package/es/components/organism/LoginV2/hooks/index.d.ts +1 -0
- package/es/components/organism/LoginV2/hooks/index.js +1 -0
- package/es/components/organism/LoginV2/hooks/useResize.d.ts +7 -0
- package/es/components/organism/LoginV2/hooks/useResize.js +21 -0
- package/es/components/organism/LoginV2/index.d.ts +6 -0
- package/es/components/organism/LoginV2/index.js +4 -0
- package/es/components/organism/LoginV2/styled.d.ts +51 -0
- package/es/components/organism/LoginV2/styled.js +129 -0
- package/es/components/organism/LoginV2/types/index.d.ts +79 -0
- package/es/components/organism/LoginV2/types/index.js +1 -0
- package/es/components/organism/LoginV2/types/ory.d.ts +52 -0
- package/es/components/organism/LoginV2/types/ory.js +1 -0
- package/es/components/organism/LoginV2/utils/index.d.ts +14 -0
- package/es/components/organism/LoginV2/utils/index.js +49 -0
- package/es/components/organism/LoginV2/utils/ory.d.ts +138 -0
- package/es/components/organism/LoginV2/utils/ory.js +408 -0
- package/es/components/organism/LoginV2/utils/oryConsent.d.ts +52 -0
- package/es/components/organism/LoginV2/utils/oryConsent.js +174 -0
- package/es/components/organism/LoginV2/utils/oryFlows.d.ts +100 -0
- package/es/components/organism/LoginV2/utils/oryFlows.js +319 -0
- package/es/components/organism/TextEditor/TextEditor.d.ts +9 -2
- package/es/components/organism/TextEditor/TextEditor.js +203 -42
- package/es/components/organism/TextEditor/constants.d.ts +9 -0
- package/es/components/organism/TextEditor/constants.js +66 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +6 -128
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +7 -292
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +1 -1
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +4 -0
- package/es/components/organism/TextEditor/extensions/Link.js +33 -14
- package/es/components/organism/TextEditor/extensions/ListItem.d.ts +10 -0
- package/es/components/organism/TextEditor/extensions/ListItem.js +93 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +5 -6
- package/es/components/organism/TextEditor/extensions/SmartTag.js +96 -4
- package/es/components/organism/TextEditor/hooks/useColorSet.js +7 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +2 -1
- package/es/components/organism/TextEditor/index.d.ts +7 -5
- package/es/components/organism/TextEditor/index.scss +4 -7
- package/es/components/organism/TextEditor/provider.d.ts +1 -0
- package/es/components/organism/TextEditor/provider.js +6 -3
- package/es/components/organism/TextEditor/store.d.ts +11 -4
- package/es/components/organism/TextEditor/store.js +22 -2
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/froala-legacy-format.settings.json +95 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.d.ts +111 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.js +82 -0
- package/es/components/organism/TextEditor/stories/shared.d.ts +64 -0
- package/es/components/organism/TextEditor/stories/shared.js +57 -0
- package/es/components/organism/TextEditor/styled.d.ts +1 -1
- package/es/components/organism/TextEditor/styled.js +1 -0
- package/es/components/organism/TextEditor/types.d.ts +161 -11
- package/es/components/organism/TextEditor/types.js +1 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +2 -1
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +80 -51
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +1 -1
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +1 -1
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +2 -2
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +12 -2
- package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.d.ts +16 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.js +61 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/index.js +1 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.d.ts +9 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.js +126 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +1 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +1 -3
- package/es/components/organism/TextEditor/ui/Toolbar/{Toolbar.d.ts → FormattingToolbar.d.ts} +3 -4
- package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.js +90 -0
- package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.js +39 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +4 -3
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +2 -2
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +6 -1
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +2 -1
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +2 -1
- package/es/components/organism/TextEditor/utils/documentState.d.ts +14 -0
- package/es/components/organism/TextEditor/utils/documentState.js +25 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +60 -0
- package/es/components/organism/TextEditor/utils/link.d.ts +10 -1
- package/es/components/organism/TextEditor/utils/link.js +161 -7
- package/es/components/organism/TextEditor/utils/menu.js +2 -1
- package/es/components/organism/TextEditor/utils/selection.js +3 -2
- package/es/components/organism/TextEditor/utils/smartTag.js +2 -1
- package/es/components/organism/index.d.ts +3 -1
- package/es/components/organism/index.js +1 -0
- package/es/components/template/TemplateListing/Loadable.d.ts +1 -0
- package/es/hooks/index.d.ts +1 -1
- package/es/hooks/index.js +1 -1
- package/es/providers/ConfigProvider/ConfigProvider.d.ts +4 -0
- package/es/providers/ConfigProvider/ConfigProvider.js +2 -3
- package/es/providers/ConfigProvider/GlobalStyle.d.ts +2 -2
- package/es/providers/ConfigProvider/GlobalStyle.js +67 -64
- package/es/services/MediaTemplateDesign/UploadFile/index.js +4 -4
- package/es/utils/common.d.ts +1 -1
- package/es/utils/common.js +3 -3
- package/es/utils/cookie.js +2 -1
- package/es/utils/crossSubdomainCookieOptions.d.ts +14 -0
- package/es/utils/crossSubdomainCookieOptions.js +12 -0
- package/package.json +26 -30
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.js +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.d.ts +0 -0
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +0 -39
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Libraries
|
|
3
|
+
import { useMemo, useRef } from 'react';
|
|
4
|
+
import { Button, Col, Flex, Row, Typography } from 'antd';
|
|
5
|
+
import { useImmer } from 'use-immer';
|
|
6
|
+
import Icon from '@antscorp/icons';
|
|
7
|
+
import { useCookies } from 'react-cookie';
|
|
8
|
+
import { get, isEmpty } from 'lodash';
|
|
9
|
+
// Components
|
|
10
|
+
import { WidgetLayout } from '../WidgetLayout';
|
|
11
|
+
import { Item } from './Item';
|
|
12
|
+
import { Avatar } from '../Avatar';
|
|
13
|
+
import { Scrollbars } from '@antscorp/antsomi-ui/es/components/atoms/Scrollbars';
|
|
14
|
+
import NoData from '../../../../../assets/images/components/Login/NoData.png';
|
|
15
|
+
// Styled
|
|
16
|
+
import { WrapperList } from './styled';
|
|
17
|
+
import { Image, StyleInput } from '../../styled';
|
|
18
|
+
import { isMobile } from 'react-device-detect';
|
|
19
|
+
const { Text } = Typography;
|
|
20
|
+
export const LoginSelectPortal = props => {
|
|
21
|
+
const { loginData, listNetworks, domainLogin, userNameKey = 'user_name', passwordKey = 'password', networkId, onLoginSuccess, onLoginFail, backLogin, callbackSelectNetwork, } = props;
|
|
22
|
+
const [state, setState] = useImmer({
|
|
23
|
+
portalSearch: '',
|
|
24
|
+
password: '',
|
|
25
|
+
email: '',
|
|
26
|
+
isLoading: false,
|
|
27
|
+
errors: {
|
|
28
|
+
email: '',
|
|
29
|
+
password: '',
|
|
30
|
+
},
|
|
31
|
+
loginError: false,
|
|
32
|
+
});
|
|
33
|
+
const [cookies, setCookie] = useCookies();
|
|
34
|
+
const errorRef = useRef({
|
|
35
|
+
email: false,
|
|
36
|
+
password: false,
|
|
37
|
+
});
|
|
38
|
+
const loginUrl = `${domainLogin}api/account/authenticate`;
|
|
39
|
+
const selectNetwork = network => {
|
|
40
|
+
if (callbackSelectNetwork && typeof callbackSelectNetwork === 'function') {
|
|
41
|
+
callbackSelectNetwork(network);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const navigateLogin = () => {
|
|
45
|
+
if (backLogin && typeof backLogin === 'function') {
|
|
46
|
+
backLogin();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const validate = (field = null) => {
|
|
50
|
+
let isValid = true;
|
|
51
|
+
if (!field || field === 'email') {
|
|
52
|
+
if (state.email && state.email.trim()) {
|
|
53
|
+
if (!/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,8})$/i.test(state.email)) {
|
|
54
|
+
setState(draft => {
|
|
55
|
+
draft.errors = {
|
|
56
|
+
...draft.errors,
|
|
57
|
+
email: 'Please enter valid email',
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
isValid = false;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
setState(draft => {
|
|
64
|
+
draft.errors = {
|
|
65
|
+
...draft.errors,
|
|
66
|
+
email: '',
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
setState(draft => {
|
|
73
|
+
draft.errors = {
|
|
74
|
+
...draft.errors,
|
|
75
|
+
email: 'Please enter valid email',
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
isValid = false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (!field || field === 'password') {
|
|
82
|
+
if (state.password && state.password.trim()) {
|
|
83
|
+
if (state.password.trim().length < 6) {
|
|
84
|
+
setState(draft => {
|
|
85
|
+
draft.errors = {
|
|
86
|
+
...draft.errors,
|
|
87
|
+
password: 'Your password too short',
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
isValid = false;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
setState(draft => {
|
|
94
|
+
draft.errors = {
|
|
95
|
+
...draft.errors,
|
|
96
|
+
password: '',
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
setState(draft => {
|
|
103
|
+
draft.errors = {
|
|
104
|
+
...draft.errors,
|
|
105
|
+
password: 'Your password too short',
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
isValid = false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return isValid;
|
|
112
|
+
};
|
|
113
|
+
const onChangeLoading = (value) => {
|
|
114
|
+
setState(draft => {
|
|
115
|
+
draft.isLoading = value;
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
const signIn = async () => {
|
|
119
|
+
errorRef.current = {
|
|
120
|
+
email: true,
|
|
121
|
+
password: true,
|
|
122
|
+
};
|
|
123
|
+
if (!validate()) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const keyName = `ogs-${btoa(state.email)}`;
|
|
127
|
+
const trustKey = cookies[keyName] || localStorage.getItem(keyName);
|
|
128
|
+
const params = {
|
|
129
|
+
[userNameKey]: state.email,
|
|
130
|
+
[passwordKey]: state.password,
|
|
131
|
+
app_id: networkId,
|
|
132
|
+
};
|
|
133
|
+
if (trustKey) {
|
|
134
|
+
params.trust_key = trustKey;
|
|
135
|
+
}
|
|
136
|
+
const dataPost = {
|
|
137
|
+
method: 'POST',
|
|
138
|
+
credentials: 'same-origin',
|
|
139
|
+
headers: {
|
|
140
|
+
'Content-Type': 'application/json',
|
|
141
|
+
},
|
|
142
|
+
body: JSON.stringify(params),
|
|
143
|
+
};
|
|
144
|
+
onChangeLoading(true);
|
|
145
|
+
const xhr = new XMLHttpRequest();
|
|
146
|
+
xhr.open('POST', loginUrl, true);
|
|
147
|
+
// Send the proper header information along with the request
|
|
148
|
+
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
149
|
+
xhr.withCredentials = false;
|
|
150
|
+
xhr.onreadystatechange = () => {
|
|
151
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
152
|
+
onChangeLoading(false);
|
|
153
|
+
}
|
|
154
|
+
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
|
|
155
|
+
const response = JSON.parse(xhr.responseText);
|
|
156
|
+
const { token } = response?.data || {};
|
|
157
|
+
if (token) {
|
|
158
|
+
onLoginSuccess(response.data);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
setState(draft => {
|
|
162
|
+
draft.loginError = true;
|
|
163
|
+
});
|
|
164
|
+
onLoginFail();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
xhr.send(JSON.stringify(params));
|
|
169
|
+
};
|
|
170
|
+
const setPortalSearch = (value) => {
|
|
171
|
+
setState(draft => {
|
|
172
|
+
draft.portalSearch = value;
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
const filterListNetworks = useMemo(() => {
|
|
176
|
+
const draftListNetwork = [...listNetworks];
|
|
177
|
+
return draftListNetwork.filter(netWork => netWork.networkName.toLocaleLowerCase().indexOf(state.portalSearch.toLocaleLowerCase()) !==
|
|
178
|
+
-1);
|
|
179
|
+
}, [listNetworks, state.portalSearch]);
|
|
180
|
+
return (_jsx(WidgetLayout, { header: _jsx(Avatar, { image: get(loginData, 'personal.avatar'), name: get(loginData, 'personal.full_name'), email: get(loginData, 'personal.email') }), gapContent: 30, isShowLogo: false, title: "Select Portal", content: _jsxs(Flex, { vertical: true, gap: 30, children: [_jsxs(Flex, { vertical: true, gap: 20, children: [_jsx(StyleInput, { isMobile: isMobile, placeholder: "Search", suffix: _jsx(Icon, { type: "icon-ants-search-2", style: {
|
|
181
|
+
fontSize: 24,
|
|
182
|
+
}, color: "#595959" }), onChange: e => setPortalSearch(e.target.value) }), isEmpty(filterListNetworks) ? (_jsxs(Flex, { vertical: true, align: "center", justify: "center", style: { height: 514 }, gap: 15, children: [!isMobile && _jsx(Image, { src: NoData, alt: "", width: 80, height: 80 }), _jsx(Text, { style: {
|
|
183
|
+
color: '#595959',
|
|
184
|
+
fontSize: 11,
|
|
185
|
+
}, children: "No portal matches your keyword" })] })) : (_jsx(Scrollbars, { style: {
|
|
186
|
+
height: `calc(100vh - 410px)`,
|
|
187
|
+
width: '100%',
|
|
188
|
+
minHeight: `145px`,
|
|
189
|
+
}, children: _jsx(WrapperList, { children: _jsx(Row, { gutter: [20, 20], children: filterListNetworks.map((network) => (_jsx(Col, { span: 12, children: _jsx(Item, { networkId: network.networkId, networkName: network.networkName, homePage: network.homePage, logo: network.logo, onSelect: selectNetwork }) }))) }) }) }))] }), _jsx(Flex, { justify: "center", style: {
|
|
190
|
+
paddingBottom: 40,
|
|
191
|
+
}, children: _jsx(Button, { type: "text", onClick: navigateLogin, style: {
|
|
192
|
+
fontSize: isMobile ? '16px' : '14px',
|
|
193
|
+
}, children: "Sign in with a different account" }) })] }) }));
|
|
194
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoginSelectPortal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoginSelectPortal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WrapperList: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LoginData } from '../../types';
|
|
3
|
+
interface LoginWithEmailProps {
|
|
4
|
+
domainLogin: string;
|
|
5
|
+
codeKey?: string;
|
|
6
|
+
token?: string;
|
|
7
|
+
username?: string;
|
|
8
|
+
onLoginSuccess?: (data: Partial<LoginData>) => void;
|
|
9
|
+
onLoginFail?: () => void;
|
|
10
|
+
backLogin?: () => void;
|
|
11
|
+
loginData?: Partial<LoginData>;
|
|
12
|
+
sendCodeVerifyToEmail: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const LoginWithEmail: React.FC<LoginWithEmailProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useRef, useCallback } from 'react';
|
|
3
|
+
import { Button, Checkbox, Flex, Typography } from 'antd';
|
|
4
|
+
import { get, isEmpty } from 'lodash';
|
|
5
|
+
import { useImmer } from 'use-immer';
|
|
6
|
+
import { useCookies } from 'react-cookie';
|
|
7
|
+
import { isMobile } from 'react-device-detect';
|
|
8
|
+
import { useCountdown } from '@antscorp/antsomi-ui/es/hooks';
|
|
9
|
+
// Components
|
|
10
|
+
import { WidgetLayout } from '../WidgetLayout';
|
|
11
|
+
import { Avatar } from '../Avatar';
|
|
12
|
+
// Images
|
|
13
|
+
import loginStep2Image from '../../../../../assets/images/components/Login/loginStep2.png';
|
|
14
|
+
import { StyleButton, StyleInput, Text } from '../../styled';
|
|
15
|
+
import { TextInfo } from './styled';
|
|
16
|
+
import { Title } from '../WidgetLayout/styled';
|
|
17
|
+
import { maskEmail } from '../ChooseMethod/utils';
|
|
18
|
+
import { generateGuid } from '../../utils';
|
|
19
|
+
import { LOGIN_ERROR_TYPES } from '../../constants';
|
|
20
|
+
// Constants
|
|
21
|
+
const COUNTDOWN_SECONDS = 59;
|
|
22
|
+
const CODE_LENGTH = 6;
|
|
23
|
+
const { Text: TextAntsomiUI } = Typography;
|
|
24
|
+
const initialState = {
|
|
25
|
+
code: '',
|
|
26
|
+
isTrust: false,
|
|
27
|
+
codeError: false,
|
|
28
|
+
isLoading: false,
|
|
29
|
+
countResend: 0,
|
|
30
|
+
isShowResend: false,
|
|
31
|
+
isDisableResend: false,
|
|
32
|
+
isTooManyMistakes: false,
|
|
33
|
+
};
|
|
34
|
+
export const LoginWithEmail = ({ loginData, domainLogin, codeKey = 'code', token = '', username = '', onLoginSuccess, onLoginFail, backLogin, sendCodeVerifyToEmail, }) => {
|
|
35
|
+
const [state, setState] = useImmer(initialState);
|
|
36
|
+
const [cookies, setCookie] = useCookies();
|
|
37
|
+
const errorRef = useRef(false);
|
|
38
|
+
const [errorMessageCode, setErrorMessageCode] = React.useState(null);
|
|
39
|
+
const errorCodeSend = get(loginData, 'errorCode', '');
|
|
40
|
+
const retryAfter = get(loginData, 'retryAfter');
|
|
41
|
+
const userEmail = get(loginData, 'personal.email', '');
|
|
42
|
+
const userAvatar = get(loginData, 'personal.avatar');
|
|
43
|
+
const userFullName = get(loginData, 'personal.full_name');
|
|
44
|
+
const countdownOptions = {
|
|
45
|
+
autoStart: true,
|
|
46
|
+
onComplete: () => {
|
|
47
|
+
setState(draft => {
|
|
48
|
+
draft.isShowResend = true;
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const countdownIncorrectAttempts = {
|
|
53
|
+
autoStart: false,
|
|
54
|
+
onComplete: () => {
|
|
55
|
+
setState(draft => {
|
|
56
|
+
draft.isDisableResend = false;
|
|
57
|
+
draft.isShowResend = true;
|
|
58
|
+
draft.isTooManyMistakes = false;
|
|
59
|
+
});
|
|
60
|
+
setErrorMessageCode('');
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const { resetAndStartWithTime, seconds } = useCountdown(COUNTDOWN_SECONDS, countdownOptions);
|
|
64
|
+
const { resetAndStartWithTime: resetCountDownIncorrectAttempts } = useCountdown(0, countdownIncorrectAttempts);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (errorCodeSend) {
|
|
67
|
+
if (errorCodeSend === LOGIN_ERROR_TYPES.SEND_LIMIT_REACHED.type) {
|
|
68
|
+
setState(draft => {
|
|
69
|
+
draft.isDisableResend = true;
|
|
70
|
+
draft.isShowResend = true;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (errorCodeSend === LOGIN_ERROR_TYPES.TOO_MANY_ATTEMPTS.type && retryAfter > 0) {
|
|
74
|
+
setState(draft => {
|
|
75
|
+
draft.isDisableResend = true;
|
|
76
|
+
draft.isShowResend = true;
|
|
77
|
+
draft.isTooManyMistakes = true;
|
|
78
|
+
});
|
|
79
|
+
resetCountDownIncorrectAttempts(+retryAfter);
|
|
80
|
+
}
|
|
81
|
+
setErrorMessageCode(errorCodeSend);
|
|
82
|
+
}
|
|
83
|
+
if (+retryAfter > 0 && errorCodeSend === LOGIN_ERROR_TYPES.SEND_LIMIT_REACHED.type) {
|
|
84
|
+
resetAndStartWithTime(+retryAfter);
|
|
85
|
+
setState(draft => {
|
|
86
|
+
draft.isShowResend = false;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (errorCodeSend === 'RESEND_TOO_SOON' && +retryAfter > 0) {
|
|
90
|
+
resetAndStartWithTime(+retryAfter);
|
|
91
|
+
}
|
|
92
|
+
}, [errorCodeSend, retryAfter, resetAndStartWithTime, resetCountDownIncorrectAttempts, setState]);
|
|
93
|
+
const handleTrustDevice = useCallback((trustKey) => {
|
|
94
|
+
const trustKeyCookieName = `ogs-${btoa(username)}`;
|
|
95
|
+
localStorage.setItem(trustKeyCookieName, trustKey);
|
|
96
|
+
setCookie(trustKeyCookieName, trustKey, { path: '/' });
|
|
97
|
+
}, [username, setCookie]);
|
|
98
|
+
const handleAuthenticationSuccess = useCallback((response, trustKey) => {
|
|
99
|
+
if (response.code === 200) {
|
|
100
|
+
if (trustKey) {
|
|
101
|
+
handleTrustDevice(trustKey);
|
|
102
|
+
}
|
|
103
|
+
onLoginSuccess?.(response.data);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
if (LOGIN_ERROR_TYPES[response.data.error]) {
|
|
107
|
+
setErrorMessageCode(response.data.error);
|
|
108
|
+
if (response.data.error === LOGIN_ERROR_TYPES.SEND_LIMIT_REACHED.type) {
|
|
109
|
+
setState(draft => {
|
|
110
|
+
draft.isDisableResend = true;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (response.data.error === LOGIN_ERROR_TYPES.TOO_MANY_ATTEMPTS.type &&
|
|
114
|
+
+response.data.retryAfter > 0) {
|
|
115
|
+
setState(draft => {
|
|
116
|
+
draft.isDisableResend = true;
|
|
117
|
+
draft.isShowResend = true;
|
|
118
|
+
draft.isTooManyMistakes = true;
|
|
119
|
+
});
|
|
120
|
+
resetCountDownIncorrectAttempts(+response.data.retryAfter);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
onLoginFail?.();
|
|
124
|
+
}
|
|
125
|
+
}, [onLoginSuccess, onLoginFail, handleTrustDevice, setState, resetCountDownIncorrectAttempts]);
|
|
126
|
+
const makeAuthenticationRequest = useCallback((verificationParams, trustKey) => {
|
|
127
|
+
const url = `${domainLogin}api/account/authenticate`;
|
|
128
|
+
const request = new XMLHttpRequest();
|
|
129
|
+
request.open('POST', url, true);
|
|
130
|
+
request.setRequestHeader('Content-Type', 'application/json');
|
|
131
|
+
request.withCredentials = false;
|
|
132
|
+
request.onreadystatechange = () => {
|
|
133
|
+
if (request.readyState === XMLHttpRequest.DONE) {
|
|
134
|
+
setState(draft => {
|
|
135
|
+
draft.isLoading = false;
|
|
136
|
+
});
|
|
137
|
+
if (request.status === 200) {
|
|
138
|
+
const response = JSON.parse(request.responseText);
|
|
139
|
+
handleAuthenticationSuccess(response, trustKey);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
request.send(JSON.stringify(verificationParams));
|
|
144
|
+
}, [domainLogin, setState, handleAuthenticationSuccess]);
|
|
145
|
+
const signIn = useCallback(() => {
|
|
146
|
+
errorRef.current = true;
|
|
147
|
+
if (!token) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (isEmpty(state.code)) {
|
|
151
|
+
setState(draft => {
|
|
152
|
+
draft.codeError = true;
|
|
153
|
+
});
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const trustKey = state.isTrust ? generateGuid() : null;
|
|
157
|
+
const verificationParams = {
|
|
158
|
+
[codeKey]: state.code,
|
|
159
|
+
token,
|
|
160
|
+
auth_type: 'email',
|
|
161
|
+
trust_key: trustKey,
|
|
162
|
+
};
|
|
163
|
+
setState(draft => {
|
|
164
|
+
draft.isLoading = true;
|
|
165
|
+
});
|
|
166
|
+
makeAuthenticationRequest(verificationParams, trustKey);
|
|
167
|
+
}, [token, state.code, state.isTrust, codeKey, setState, makeAuthenticationRequest]);
|
|
168
|
+
const handleBack = useCallback(() => {
|
|
169
|
+
backLogin?.();
|
|
170
|
+
}, [backLogin]);
|
|
171
|
+
const onResendCode = useCallback(() => {
|
|
172
|
+
setState(draft => {
|
|
173
|
+
draft.isShowResend = false;
|
|
174
|
+
draft.code = '';
|
|
175
|
+
draft.codeError = false;
|
|
176
|
+
draft.countResend += 1;
|
|
177
|
+
});
|
|
178
|
+
resetAndStartWithTime(COUNTDOWN_SECONDS);
|
|
179
|
+
sendCodeVerifyToEmail();
|
|
180
|
+
}, [setState, resetAndStartWithTime, sendCodeVerifyToEmail]);
|
|
181
|
+
const handleCodeChange = useCallback((e) => {
|
|
182
|
+
const newCode = e.target.value;
|
|
183
|
+
setState(draft => {
|
|
184
|
+
draft.code = newCode;
|
|
185
|
+
});
|
|
186
|
+
errorRef.current = true;
|
|
187
|
+
}, [setState]);
|
|
188
|
+
const handleTrustChange = useCallback((e) => {
|
|
189
|
+
setState(draft => {
|
|
190
|
+
draft.isTrust = e.target.checked;
|
|
191
|
+
});
|
|
192
|
+
}, [setState]);
|
|
193
|
+
const renderErrorMessages = () => {
|
|
194
|
+
let errMsg = null;
|
|
195
|
+
if (state.codeError && isEmpty(state.code)) {
|
|
196
|
+
errMsg = _jsx(TextAntsomiUI, { type: "danger", children: "Invalid code, please try again." });
|
|
197
|
+
}
|
|
198
|
+
if (errorMessageCode && LOGIN_ERROR_TYPES[errorMessageCode]) {
|
|
199
|
+
errMsg = (_jsx(TextAntsomiUI, { type: "danger", children: LOGIN_ERROR_TYPES[errorMessageCode].message }));
|
|
200
|
+
}
|
|
201
|
+
return errMsg;
|
|
202
|
+
};
|
|
203
|
+
const renderResendSection = () => {
|
|
204
|
+
const maskedEmail = maskEmail(userEmail);
|
|
205
|
+
const baseText = `Please enter the 6-digit code send to ${maskedEmail} Haven't received it? `;
|
|
206
|
+
return (_jsx(Flex, { gap: 5, align: "center", children: _jsxs(Text, { isMobile: isMobile, color: "#595959", children: [baseText, state.isShowResend ? (_jsx(Text, { color: state.isDisableResend ? '#a2a2a2' : '#005eb8', onClick: state.isDisableResend ? undefined : onResendCode, isMobile: isMobile, style: { cursor: state.isDisableResend ? 'not-allowed' : 'pointer' }, children: "Resend." })) : (`Resend code in ${seconds}s.`)] }) }));
|
|
207
|
+
};
|
|
208
|
+
return (_jsx(WidgetLayout, { header: _jsx(Avatar, { image: userAvatar, name: userFullName, email: userEmail }), isShowLogo: false, title: _jsx(Title, { isMobile: isMobile, style: { marginTop: 20 }, children: "Identity Verification" }), gapContent: 30, content: _jsxs(Flex, { vertical: true, gap: 50, style: { marginTop: 20 }, children: [_jsxs(Flex, { vertical: true, gap: 20, align: "center", children: [_jsx("img", { src: loginStep2Image, alt: "Identity Verification" }), _jsx(Text, { isMobile: isMobile, color: "#595959", children: "For added security, we need to verify your identity." })] }), _jsxs(Flex, { vertical: true, gap: isMobile ? 10 : 15, children: [renderResendSection(), _jsxs(Flex, { vertical: true, gap: isMobile ? 20 : 11, children: [_jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(StyleInput, { isMobile: isMobile, maxLength: CODE_LENGTH, placeholder: "Input your code", value: state.code, onChange: handleCodeChange, status: errorRef.current && state.codeError ? 'error' : undefined, disabled: state.isTooManyMistakes }), renderErrorMessages()] }), _jsx(Checkbox, { checked: state.isTrust, onChange: handleTrustChange, disabled: state.isTooManyMistakes, children: _jsx(TextInfo, { isMobile: isMobile, children: "Remember this browser for future logins" }) })] }), _jsxs(Flex, { vertical: true, gap: isMobile ? 30 : 15, style: { marginTop: isMobile ? 20 : 15 }, children: [_jsx(StyleButton, { isMobile: isMobile, type: "primary", onClick: signIn, loading: state.isLoading, disabled: state.isTooManyMistakes, children: "Verify" }), _jsx(StyleButton, { isMobile: isMobile, onClick: handleBack, type: "text", children: "Back to login" })] })] })] }), footer: _jsx(Flex, { vertical: true, gap: 115, children: _jsx(Flex, { justify: "center", children: _jsx(Button, { type: "text", onClick: handleBack, style: {
|
|
209
|
+
fontSize: isMobile ? '16px' : '14px',
|
|
210
|
+
}, children: "Sign in with a different account" }) }) }) }));
|
|
211
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoginWithEmail';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoginWithEmail';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LoginData } from '../../types';
|
|
3
|
+
interface TLoginStep2 {
|
|
4
|
+
domainLogin: string;
|
|
5
|
+
codeKey?: string;
|
|
6
|
+
token?: string;
|
|
7
|
+
username?: string;
|
|
8
|
+
onLoginSuccess?: (data: Partial<LoginData>) => void;
|
|
9
|
+
onLoginFail?: () => void;
|
|
10
|
+
backLogin?: () => void;
|
|
11
|
+
loginData?: Partial<LoginData>;
|
|
12
|
+
}
|
|
13
|
+
export declare const LoginWithGG: React.FC<TLoginStep2>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3
|
+
// Libraries
|
|
4
|
+
import { Button, Checkbox, Flex, Typography } from 'antd';
|
|
5
|
+
import { get } from 'lodash';
|
|
6
|
+
import { useEffect, useRef } from 'react';
|
|
7
|
+
import { useImmer } from 'use-immer';
|
|
8
|
+
import { useCookies } from 'react-cookie';
|
|
9
|
+
import { isMobile } from 'react-device-detect';
|
|
10
|
+
// Components
|
|
11
|
+
import { WidgetLayout } from '../WidgetLayout';
|
|
12
|
+
import { Avatar } from '../Avatar';
|
|
13
|
+
import { IconInfo } from '../IconInfo';
|
|
14
|
+
// Images
|
|
15
|
+
import loginStep2Image from '../../../../../assets/images/components/Login/loginStep2.png';
|
|
16
|
+
import step2 from '../../../../../assets/images/components/Login/step2.png';
|
|
17
|
+
import { StyleButton, StyleInput, Text } from '../../styled';
|
|
18
|
+
import { TextInfo } from './styled';
|
|
19
|
+
import { Title } from '../WidgetLayout/styled';
|
|
20
|
+
import { generateGuid } from '../../utils';
|
|
21
|
+
const { Text: TextAntsomiUI } = Typography;
|
|
22
|
+
export const LoginWithGG = props => {
|
|
23
|
+
const { loginData, domainLogin, codeKey = 'code', token = '', username = '', onLoginSuccess, onLoginFail, backLogin, } = props;
|
|
24
|
+
const [state, setState] = useImmer({
|
|
25
|
+
code: '',
|
|
26
|
+
isTrust: false,
|
|
27
|
+
codeError: true,
|
|
28
|
+
isLoading: false,
|
|
29
|
+
count: 0,
|
|
30
|
+
});
|
|
31
|
+
const errorRef = useRef(false);
|
|
32
|
+
const [cookies, setCookie] = useCookies();
|
|
33
|
+
const signIn = () => {
|
|
34
|
+
errorRef.current = true;
|
|
35
|
+
setState(draft => {
|
|
36
|
+
draft.count += 1;
|
|
37
|
+
});
|
|
38
|
+
if (!token || state.codeError) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const verificationParams = {
|
|
42
|
+
[codeKey]: state.code,
|
|
43
|
+
token,
|
|
44
|
+
trust_key: state.isTrust ? generateGuid() : null,
|
|
45
|
+
};
|
|
46
|
+
const url = `${domainLogin}api/account/authenticate`;
|
|
47
|
+
setState(draft => {
|
|
48
|
+
draft.isLoading = true;
|
|
49
|
+
});
|
|
50
|
+
const request = new XMLHttpRequest();
|
|
51
|
+
request.open('POST', url, true);
|
|
52
|
+
request.setRequestHeader('Content-Type', 'application/json');
|
|
53
|
+
request.withCredentials = false;
|
|
54
|
+
request.onreadystatechange = () => {
|
|
55
|
+
if (request.readyState === XMLHttpRequest.DONE) {
|
|
56
|
+
setState(draft => {
|
|
57
|
+
draft.isLoading = false;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (request.readyState === XMLHttpRequest.DONE && request.status === 200) {
|
|
61
|
+
const response = JSON.parse(request.responseText);
|
|
62
|
+
if (response.code === 200) {
|
|
63
|
+
if (verificationParams.trust_key) {
|
|
64
|
+
const trustKeyCookieName = `ogs-${btoa(username)}`;
|
|
65
|
+
localStorage.setItem(trustKeyCookieName, verificationParams.trust_key);
|
|
66
|
+
setCookie(trustKeyCookieName, verificationParams.trust_key, { path: '/' });
|
|
67
|
+
}
|
|
68
|
+
if (onLoginSuccess && typeof onLoginSuccess === 'function') {
|
|
69
|
+
onLoginSuccess(response.data);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
setState(draft => {
|
|
74
|
+
draft.codeError = true;
|
|
75
|
+
});
|
|
76
|
+
if (onLoginFail && typeof onLoginFail === 'function') {
|
|
77
|
+
onLoginFail();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
request.send(JSON.stringify(verificationParams));
|
|
83
|
+
};
|
|
84
|
+
const handleBack = () => {
|
|
85
|
+
if (backLogin && typeof backLogin === 'function') {
|
|
86
|
+
backLogin();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (state.code && state.code.trim()) {
|
|
91
|
+
setState(draft => {
|
|
92
|
+
draft.codeError = false;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
setState(draft => {
|
|
97
|
+
draft.codeError = true;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, [state.code]);
|
|
101
|
+
return (_jsx(WidgetLayout, { header: _jsx(Avatar, { image: get(loginData, 'personal.avatar'), name: get(loginData, 'personal.full_name'), email: get(loginData, 'personal.email') }), isShowLogo: false, title: _jsx(Title, { isMobile: isMobile, style: { marginTop: 20 }, children: "Identity Verification" }), gapContent: 30, content: _jsxs(Flex, { vertical: true, gap: 50, style: { marginTop: 20 }, children: [_jsxs(Flex, { vertical: true, gap: 20, align: "center", children: [_jsx("img", { src: loginStep2Image, alt: "" }), _jsx(Text, { isMobile: isMobile, color: "#595959", children: "For added security, we need to verify your identity." })] }), _jsxs(Flex, { vertical: true, gap: isMobile ? 10 : 15, children: [_jsxs(Flex, { gap: 5, align: "center", children: [_jsx(Text, { isMobile: isMobile, color: "#595959", children: "Please enter the 6-digit code registered to your device." }), _jsx(IconInfo, { image: step2, title: _jsx(TextAntsomiUI, { style: {
|
|
102
|
+
marginTop: 20,
|
|
103
|
+
textAlign: 'center',
|
|
104
|
+
}, children: _jsxs(Text, { isMobile: isMobile, children: ["Open Google Authenticator and enter the code from ", _jsx("b", { children: "antsomi.com" })] }) }) })] }), _jsxs(Flex, { vertical: true, gap: isMobile ? 20 : 11, children: [_jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(StyleInput, { isMobile: isMobile, maxLength: 6, placeholder: "Input your code", value: state.code, onChange: e => {
|
|
105
|
+
setState(draft => {
|
|
106
|
+
draft.code = e.target.value;
|
|
107
|
+
});
|
|
108
|
+
errorRef.current = true;
|
|
109
|
+
}, status: errorRef.current && state.codeError ? 'error' : undefined }), errorRef.current && state.codeError ? (_jsx(TextAntsomiUI, { type: "danger", children: "Invalid code, please try again" })) : null] }), _jsx(Checkbox, { checked: state.isTrust, onChange: e => {
|
|
110
|
+
setState(draft => {
|
|
111
|
+
draft.isTrust = e.target.checked;
|
|
112
|
+
});
|
|
113
|
+
}, children: _jsx(TextInfo, { isMobile: isMobile, children: "Remember this browser for future logins" }) })] }), _jsxs(Flex, { vertical: true, gap: isMobile ? 30 : 15, style: { marginTop: isMobile ? 20 : 15 }, children: [_jsx(StyleButton, { isMobile: isMobile, type: "primary", onClick: signIn, children: "Verify" }), _jsx(StyleButton, { isMobile: isMobile, onClick: handleBack, type: "text", children: "Back to login" })] })] })] }), footer: _jsx(Flex, { justify: "center", children: _jsx(Button, { type: "text", onClick: handleBack, style: {
|
|
114
|
+
fontSize: isMobile ? '16px' : '14px',
|
|
115
|
+
}, children: "Sign in with a different account" }) }) }));
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoginWithGG';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoginWithGG';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from 'antd';
|
|
3
|
+
import { isEmpty } from 'lodash';
|
|
4
|
+
import { WrapperImage } from '../../styled';
|
|
5
|
+
import logoAntsomi from '../../../../../assets/images/logo/antsomi_logo.png';
|
|
6
|
+
export const Logo = props => {
|
|
7
|
+
const { urlLogo } = props;
|
|
8
|
+
return (_jsx(Flex, { align: "center", justify: "center", children: !isEmpty(urlLogo) ? (_jsx(WrapperImage, { src: urlLogo, alt: "" })) : typeof LOGO_NETWORK_DOMAIN !== 'undefined' && LOGO_NETWORK_DOMAIN !== '' ? (_jsx(WrapperImage, { src: LOGO_NETWORK_DOMAIN, alt: "" })) : (_jsx(WrapperImage, { src: logoAntsomi, alt: "logosaS" })) }));
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Logo';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Logo';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import logoAntsomi from '../../../../../assets/images/logo/antsomi_logo.png';
|
|
3
|
+
import { AuthHeader, Banner, Body, Footer, HeaderLogo, Page, Panel } from './styled';
|
|
4
|
+
export const OryAuthLayout = ({ title, description, footer, children, }) => (_jsxs(Page, { children: [_jsxs(Panel, { "aria-label": title, children: [_jsxs(Body, { children: [_jsxs(AuthHeader, { children: [_jsx(HeaderLogo, { src: logoAntsomi, alt: "Antsomi" }), _jsxs("div", { children: [_jsx("h1", { children: title }), description ? _jsx("p", { children: description }) : null] })] }), children] }), footer ? _jsx(Footer, { children: footer }) : null] }), _jsx(Banner, { className: "login-banner-zone", id: "login_banner_zone", "aria-hidden": "true" })] }));
|