sprof 0.1.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/README.md +29 -0
- package/package.json +101 -0
- package/src/Hooks/Hooks.ts +75 -0
- package/src/assets/img/avatar.webp +0 -0
- package/src/assets/styles/borders.scss +11 -0
- package/src/assets/styles/brandbook.css +227 -0
- package/src/assets/styles/colors.scss +42 -0
- package/src/assets/styles/fonts.scss +15 -0
- package/src/assets/styles/index.css +15 -0
- package/src/assets/styles/index.scss +45 -0
- package/src/assets/styles/platform/android.css +53 -0
- package/src/assets/styles/platform/ios.css +53 -0
- package/src/assets/styles/platform/webdesktop.css +72 -0
- package/src/assets/styles/platform/webdesktop_old.css +65 -0
- package/src/assets/styles/platform/webmobile.css +53 -0
- package/src/assets/styles/platform/webtablet.css +53 -0
- package/src/assets/styles/reset.scss +28 -0
- package/src/assets/styles/shadow.scss +6 -0
- package/src/assets/styles/theme/aquaBlueLight.css +162 -0
- package/src/assets/styles/theme/blueLight.css +187 -0
- package/src/assets/styles/theme/blueLight_test.css +162 -0
- package/src/assets/styles/theme/dark.css +286 -0
- package/src/assets/styles/theme/light.css +151 -0
- package/src/assets/svg/ArrowLeft.svg +5 -0
- package/src/assets/svg/ArrowRight.svg +5 -0
- package/src/assets/svg/Close.svg +7 -0
- package/src/assets/svg/DoubleArrowLeft.svg +5 -0
- package/src/assets/svg/DoubleArrowRight.svg +5 -0
- package/src/assets/svg/Ellipsis.svg +7 -0
- package/src/assets/svg/Filter.svg +10 -0
- package/src/assets/svg/Menu.svg +5 -0
- package/src/assets/svg/Move.svg +5 -0
- package/src/assets/svg/Password.svg +5 -0
- package/src/assets/svg/RightMenu.svg +5 -0
- package/src/assets/svg/Settings.svg +6 -0
- package/src/assets/svg/User.svg +6 -0
- package/src/buildLibrary.ts +59 -0
- package/src/classes/Auth.ts +63 -0
- package/src/classes/AuthButton.ts +64 -0
- package/src/classes/AuthForm.ts +114 -0
- package/src/classes/AuthModal.ts +32 -0
- package/src/classes/AuthStatusesObjects.ts +37 -0
- package/src/classes/AuthTokens.ts +43 -0
- package/src/classes/AuthUser.ts +53 -0
- package/src/classes/CallbackRequest.ts +12 -0
- package/src/classes/Chat.ts +18 -0
- package/src/classes/ChatMessage.ts +48 -0
- package/src/classes/Contact.ts +96 -0
- package/src/classes/Cropper.ts +22 -0
- package/src/classes/DateHelper.ts +29 -0
- package/src/classes/Email.ts +18 -0
- package/src/classes/EmailField.ts +42 -0
- package/src/classes/EmailRules.ts +4 -0
- package/src/classes/FTSPPreset.ts +16 -0
- package/src/classes/FileInfo.ts +86 -0
- package/src/classes/HttpResponse.ts +22 -0
- package/src/classes/Human.ts +106 -0
- package/src/classes/LabelValue.ts +11 -0
- package/src/classes/LocalStore.ts +22 -0
- package/src/classes/M2M.ts +25 -0
- package/src/classes/Menu.ts +102 -0
- package/src/classes/PageSectionImage.ts +19 -0
- package/src/classes/PasswordField.ts +39 -0
- package/src/classes/PasswordRepeatField.ts +37 -0
- package/src/classes/Phone.ts +17 -0
- package/src/classes/PostAddress.ts +11 -0
- package/src/classes/PostAddressRules.ts +1 -0
- package/src/classes/Role.ts +13 -0
- package/src/classes/Schema.ts +13 -0
- package/src/classes/SchemaField.ts +10 -0
- package/src/classes/SearchElement.ts +18 -0
- package/src/classes/SearchElementMeta.ts +10 -0
- package/src/classes/SearchGroup.ts +25 -0
- package/src/classes/SearchGroupMetaColumn.ts +11 -0
- package/src/classes/SearchModel.ts +61 -0
- package/src/classes/SortModel.ts +57 -0
- package/src/classes/SubMenu.ts +56 -0
- package/src/classes/TelephoneNumberRules.ts +9 -0
- package/src/classes/User.ts +17 -0
- package/src/classes/UserAccount.ts +17 -0
- package/src/classes/UserService.ts +20 -0
- package/src/classes/ValidationRules.ts +15 -0
- package/src/classes/ValueType.ts +69 -0
- package/src/classes/Website.ts +11 -0
- package/src/classes/WebsiteRules.ts +4 -0
- package/src/classes/admin/AdminButtonParams.ts +27 -0
- package/src/classes/admin/AdminHeaderParams.ts +34 -0
- package/src/classes/calendar/Calendar.ts +168 -0
- package/src/classes/calendar/Day.ts +15 -0
- package/src/classes/calendar/Month.ts +144 -0
- package/src/classes/calendar/Week.ts +44 -0
- package/src/classes/calendar/Year.ts +130 -0
- package/src/classes/filters/Cursor.ts +43 -0
- package/src/classes/filters/FTSP.ts +99 -0
- package/src/classes/filters/FilterModel.ts +263 -0
- package/src/classes/filters/FilterQuery.ts +187 -0
- package/src/classes/filters/OperatorsOptions.ts +8 -0
- package/src/classes/filters/OperatorsTextOptions.ts +3 -0
- package/src/classes/filters/Pagination.ts +78 -0
- package/src/classes/filters/SelectFilter.ts +15 -0
- package/src/classes/filters/TreeModel.ts +14 -0
- package/src/classes/page/CustomSection.ts +24 -0
- package/src/classes/page/Page.ts +160 -0
- package/src/classes/page/PageDocument.ts +27 -0
- package/src/classes/page/PageImage.ts +15 -0
- package/src/classes/page/PageSection.ts +82 -0
- package/src/classes/page/PageSectionDocument.ts +56 -0
- package/src/classes/page/PageSideMenu.ts +74 -0
- package/src/components/AdaptiveContainer.vue +154 -0
- package/src/components/AdaptiveContainerHorizontal.vue +173 -0
- package/src/components/AdminGallery.vue +238 -0
- package/src/components/AuthModal.vue +16 -0
- package/src/components/CarouselImages.vue +434 -0
- package/src/components/ContactForm.vue +219 -0
- package/src/components/ContextWindow.vue +48 -0
- package/src/components/DateInputRange.vue +66 -0
- package/src/components/DateInputRange_v2.vue +25 -0
- package/src/components/DropList.vue +55 -0
- package/src/components/Edit.svg +10 -0
- package/src/components/EmailForm.vue +180 -0
- package/src/components/FTSPPanel.vue +379 -0
- package/src/components/FilterCheckbox.vue +73 -0
- package/src/components/FilterSelect.vue +104 -0
- package/src/components/FiltersButtonsSelect.vue +126 -0
- package/src/components/GeneralItem.vue +172 -0
- package/src/components/GridContainer.vue +66 -0
- package/src/components/Icons/Filter/IconDownload.vue +55 -0
- package/src/components/Icons/Filter/IconFilter.vue +55 -0
- package/src/components/Icons/IconArrowLeft.vue +36 -0
- package/src/components/Icons/IconCheckDefault.vue +41 -0
- package/src/components/Icons/IconClose.vue +37 -0
- package/src/components/Icons/IconEdit.vue +40 -0
- package/src/components/Icons/IconEmail.vue +36 -0
- package/src/components/Icons/IconMove.vue +53 -0
- package/src/components/Icons/IconPhone.vue +36 -0
- package/src/components/Icons/IconSearch.vue +47 -0
- package/src/components/Icons/IconSelectArrow.vue +41 -0
- package/src/components/Icons/Pagination/ArrowLeft.vue +52 -0
- package/src/components/Icons/Pagination/ArrowRight.vue +52 -0
- package/src/components/Icons/Pagination/DoubleArrowLeft.vue +52 -0
- package/src/components/Icons/Pagination/DoubleArrowRight.vue +52 -0
- package/src/components/Icons/Pagination/EllipsisSvg.vue +58 -0
- package/src/components/ImageCropper.vue +203 -0
- package/src/components/InfoItem.vue +294 -0
- package/src/components/InfoItemSelectButtons.vue +43 -0
- package/src/components/LeftRightContainer.vue +93 -0
- package/src/components/MessageBody.vue +45 -0
- package/src/components/PAutocomplete.vue +93 -0
- package/src/components/PDialog.vue +77 -0
- package/src/components/PLoader.vue +68 -0
- package/src/components/PNotification.vue +79 -0
- package/src/components/PPagination.vue +174 -0
- package/src/components/PhoneForm.vue +180 -0
- package/src/components/RSContainer.vue +262 -0
- package/src/components/RemoteSearch.vue +156 -0
- package/src/components/ResearcheContainer.vue +71 -0
- package/src/components/RightSliderContainer.vue +181 -0
- package/src/components/RightTabsContainer.vue +210 -0
- package/src/components/SelectValueType.vue +39 -0
- package/src/components/SingleNameToggleForm.vue +399 -0
- package/src/components/SortList.vue +101 -0
- package/src/components/SortSelect.vue +93 -0
- package/src/components/SvgIcon.vue +25 -0
- package/src/components/Switch3Pos.vue +173 -0
- package/src/components/ThemeWrapper.vue +19 -0
- package/src/components/ToggleInfoItem.vue +296 -0
- package/src/components/TopSliderContainer.vue +166 -0
- package/src/components/UploaderImage.vue +268 -0
- package/src/components/atoms/PButton/PButton.stories.ts +44 -0
- package/src/components/atoms/PButton/PButton.test.ts +66 -0
- package/src/components/atoms/PButton/PButton.vue +54 -0
- package/src/components/atoms/PButton/skins/p-button_base.css +131 -0
- package/src/components/atoms/PButton/skins/p-button_filter.scss +83 -0
- package/src/components/atoms/PButton/skins/p-button_icon.scss +78 -0
- package/src/components/atoms/PButton/skins/p-button_pag.css +44 -0
- package/src/components/atoms/PButton/skins/p-button_text.css +88 -0
- package/src/components/atoms/PButton/skins/p-button_text_ano.css +88 -0
- package/src/components/atoms/PCheckbox/PCheckBox.test.ts +107 -0
- package/src/components/atoms/PCheckbox/PCheckBox.vue +92 -0
- package/src/components/atoms/PDatePicker/PDatePicker.test.ts +63 -0
- package/src/components/atoms/PDatePicker/PDatePicker.vue +141 -0
- package/src/components/atoms/PFlex/PFlex.test.ts +41 -0
- package/src/components/atoms/PFlex/PFlex.vue +46 -0
- package/src/components/atoms/PInput/PInput.stories.ts +40 -0
- package/src/components/atoms/PInput/PInput.test.ts +92 -0
- package/src/components/atoms/PInput/PInput.vue +133 -0
- package/src/components/atoms/PInputDate/PInputDate.test.ts +55 -0
- package/src/components/atoms/PInputDate/PInputDate.vue +79 -0
- package/src/components/atoms/PInputNumber/PInputNumber.vue +175 -0
- package/src/components/atoms/PLeftSlider/PLeftSlider.test.ts +121 -0
- package/src/components/atoms/PLeftSlider/PLeftSlider.vue +139 -0
- package/src/components/atoms/PList/PList.test.ts +32 -0
- package/src/components/atoms/PList/PList.vue +27 -0
- package/src/components/atoms/PListItem/PListItem.test.ts +61 -0
- package/src/components/atoms/PListItem/PListItem.vue +51 -0
- package/src/components/atoms/PRadio/PRadio.test.ts +110 -0
- package/src/components/atoms/PRadio/PRadio.vue +97 -0
- package/src/components/atoms/PRightSlider/PRightSlider.test.ts +123 -0
- package/src/components/atoms/PRightSlider/PRightSlider.vue +149 -0
- package/src/components/atoms/PSelect/PSelect.test.ts +74 -0
- package/src/components/atoms/PSelect/PSelect.vue +192 -0
- package/src/components/atoms/PSelect/select-arrow-down.svg +4 -0
- package/src/components/atoms/PSticky/PSticky.test.ts +70 -0
- package/src/components/atoms/PSticky/PSticky.vue +37 -0
- package/src/components/atoms/PString/PString.test.ts +58 -0
- package/src/components/atoms/PString/PString.vue +58 -0
- package/src/components/atoms/PTextarea/PTextarea.stories.ts +40 -0
- package/src/components/atoms/PTextarea/PTextarea.test.ts +22 -0
- package/src/components/atoms/PTextarea/PTextarea.vue +123 -0
- package/src/components/atoms/PTopSlider/PTopSlider.test.ts +95 -0
- package/src/components/atoms/PTopSlider/PTopSlider.vue +164 -0
- package/src/components/molecules/Collapse/CollapseContainer.vue +36 -0
- package/src/components/molecules/Collapse/CollapseItem.vue +295 -0
- package/src/components/molecules/Collapse/VerticalCollapseContainer.vue +102 -0
- package/src/components/molecules/PAdd/PAdd.vue +65 -0
- package/src/components/molecules/PAdd/PContainer.vue +65 -0
- package/src/components/molecules/PAdd/PContainerStickyHead.vue +51 -0
- package/src/components/molecules/PDel/PDel.vue +74 -0
- package/src/components/organisms/AuthForm.vue +219 -0
- package/src/components/organisms/PModal.vue +113 -0
- package/src/components/organisms/PTabs/ITab.ts +5 -0
- package/src/components/organisms/PTabs/PTabs.vue +190 -0
- package/src/components/organisms/UploaderFile/UploaderFile.test.ts +23 -0
- package/src/components/organisms/UploaderFile/UploaderFile.vue +202 -0
- package/src/components/pages/AuthPage.vue +22 -0
- package/src/components/pages/PageNotFound.vue +7 -0
- package/src/index.ts +206 -0
- package/src/interfaces/AdminLayout.ts +4 -0
- package/src/interfaces/Animations.ts +5 -0
- package/src/interfaces/AuthStatuses.ts +8 -0
- package/src/interfaces/CalendarScale.ts +6 -0
- package/src/interfaces/Callback.ts +2 -0
- package/src/interfaces/Class.ts +3 -0
- package/src/interfaces/DataTypes.ts +8 -0
- package/src/interfaces/Filter.ts +3 -0
- package/src/interfaces/IAdminMenu.ts +9 -0
- package/src/interfaces/IAuthInfo.ts +0 -0
- package/src/interfaces/ICursor.ts +14 -0
- package/src/interfaces/IEmailPassword.ts +4 -0
- package/src/interfaces/IFIlesList.ts +4 -0
- package/src/interfaces/IFile.ts +7 -0
- package/src/interfaces/IFileAnchor.ts +4 -0
- package/src/interfaces/IFileInfo.ts +22 -0
- package/src/interfaces/IFileInfosGetter.ts +5 -0
- package/src/interfaces/IFiler.ts +7 -0
- package/src/interfaces/IFilter.ts +4 -0
- package/src/interfaces/IFilterQuery.ts +24 -0
- package/src/interfaces/IForm.ts +5 -0
- package/src/interfaces/IHTTPTypes.ts +19 -0
- package/src/interfaces/IMessage.ts +5 -0
- package/src/interfaces/IOption.ts +4 -0
- package/src/interfaces/IOrdered.ts +4 -0
- package/src/interfaces/IPagination.ts +15 -0
- package/src/interfaces/ISearchElement.ts +6 -0
- package/src/interfaces/ISearchObject.ts +6 -0
- package/src/interfaces/ISearchQuery.ts +4 -0
- package/src/interfaces/ISelectFilter.ts +6 -0
- package/src/interfaces/ISortModel.ts +18 -0
- package/src/interfaces/IStorePaginator.ts +4 -0
- package/src/interfaces/ISupposedTimePeriod.ts +4 -0
- package/src/interfaces/ITimePeriod.ts +4 -0
- package/src/interfaces/ITokens.ts +4 -0
- package/src/interfaces/IWithId.ts +3 -0
- package/src/interfaces/IWithImage.ts +9 -0
- package/src/interfaces/IWithName.ts +4 -0
- package/src/interfaces/IWithSupposedTimePeriod.ts +4 -0
- package/src/interfaces/ItemsWithCount.ts +4 -0
- package/src/interfaces/LocalStoreKeys.ts +7 -0
- package/src/interfaces/Operators.ts +11 -0
- package/src/interfaces/Orders.ts +4 -0
- package/src/interfaces/RoleName.ts +4 -0
- package/src/interfaces/SocialTypes.ts +6 -0
- package/src/interfaces/Sort.ts +9 -0
- package/src/interfaces/ValueRelation.ts +7 -0
- package/src/interfaces/canvas/ICanvas.ts +3 -0
- package/src/interfaces/canvas/ICanvasResult.ts +7 -0
- package/src/interfaces/canvas/ICoordinates.ts +6 -0
- package/src/interfaces/types.ts +3 -0
- package/src/services/AdminHead.ts +32 -0
- package/src/services/AdminSideMenu.ts +52 -0
- package/src/services/AdminUI.ts +9 -0
- package/src/services/Arrays.ts +65 -0
- package/src/services/Axios.ts +64 -0
- package/src/services/BaseRoutes.ts +21 -0
- package/src/services/BaseStore.ts +220 -0
- package/src/services/Button.ts +42 -0
- package/src/services/Cache.ts +44 -0
- package/src/services/CacheS.ts +44 -0
- package/src/services/CarouselSwipe.ts +14 -0
- package/src/services/ClassHelper.ts +101 -0
- package/src/services/Color.ts +8 -0
- package/src/services/CreateSortModels.ts +26 -0
- package/src/services/Cursor.ts +51 -0
- package/src/services/DateFormat.ts +102 -0
- package/src/services/DateMask.ts +69 -0
- package/src/services/Dates.ts +41 -0
- package/src/services/DatesFormatter.ts +45 -0
- package/src/services/Dialog.ts +70 -0
- package/src/services/Dragger.ts +22 -0
- package/src/services/Extension.ts +6 -0
- package/src/services/Favourite.ts +62 -0
- package/src/services/HttpClient.ts +199 -0
- package/src/services/HttpClientS.ts +188 -0
- package/src/services/HttpError.ts +58 -0
- package/src/services/Loading.ts +14 -0
- package/src/services/MakeCarousel.ts +10 -0
- package/src/services/Menu.ts +102 -0
- package/src/services/Message.ts +66 -0
- package/src/services/Notification.ts +37 -0
- package/src/services/PHelp.ts +20 -0
- package/src/services/Paginator.ts +22 -0
- package/src/services/Period.ts +29 -0
- package/src/services/PhoneService.ts +46 -0
- package/src/services/Router.ts +85 -0
- package/src/services/RouterGuard.ts +15 -0
- package/src/services/Scheduler.ts +66 -0
- package/src/services/Scroll.ts +19 -0
- package/src/services/SortList.ts +44 -0
- package/src/services/Sorter.ts +6 -0
- package/src/services/Strings.test.ts +30 -0
- package/src/services/Strings.ts +138 -0
- package/src/services/Time.ts +124 -0
- package/src/services/Timer.ts +13 -0
- package/src/services/Token.ts +71 -0
- package/src/services/Visible.ts +16 -0
- package/src/services/WaitElement.ts +19 -0
- package/src/services/WebSocketClient.ts +62 -0
- package/src/services/brandColors.ts +5 -0
- package/src/services/buildNameNumbers.ts +8 -0
- package/src/services/countRating.ts +12 -0
- package/src/services/index.ts +105 -0
- package/src/services/indexNames.ts +55 -0
- package/src/services/moves.ts +17 -0
- package/src/services/useConfirmLeavePage.ts +52 -0
- package/src/services/validate.ts +22 -0
- package/src/store/AuthStore.ts +58 -0
- package/src/store/ContactsStore.ts +11 -0
- package/src/store/CropperStore.ts +20 -0
- package/src/store/EmailsStore.ts +11 -0
- package/src/store/FTSPPresetsStore.ts +11 -0
- package/src/store/FileInfosStore.ts +11 -0
- package/src/store/HumansStore.ts +11 -0
- package/src/store/MenusStore.ts +11 -0
- package/src/store/PhonesStore.ts +11 -0
- package/src/store/SchemasStore.ts +11 -0
- package/src/store/SearchStore.ts +65 -0
- package/src/store/ServicesStores.ts +29 -0
- package/src/store/ServicesStoresNames.ts +17 -0
- package/src/store/UserAccountsStore.ts +11 -0
- package/src/store/ValueTypesStore.ts +11 -0
- package/src/tsconfig.build-lib.json +30 -0
- package/src/types/AuthInfo.ts +6 -0
- package/src/types/HttpHeaders.ts +12 -0
- package/src/types/HttpMethods.ts +6 -0
- package/src/types/Sizes.ts +7 -0
- package/src/types/Statuses.ts +9 -0
- package/src/types/ValueTypes.ts +16 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="0" height="0" class="hidden">
|
|
2
|
+
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="move">
|
|
3
|
+
<path d="M13 6V11H18V7.75L22.25 12L18 16.25V13H13V18H16.25L12 22.25L7.75 18H11V13H6V16.25L1.75 12L6 7.75V11H11V6H7.75L12 1.75L16.25 6H13Z" ></path>
|
|
4
|
+
</symbol>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="0" height="0" class="hidden">
|
|
2
|
+
<symbol fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="password">
|
|
3
|
+
<path d="M8 10V8C8 5.239 9.239 3 12 3C14.094 3 15.313 4.288 15.78 6.114M12 15.75V15.25M16 15.75V15.25M8 15.75V15.25M3.5 17.8V13.2C3.5 12.08 3.5 11.52 3.718 11.093C3.90957 10.7163 4.21554 10.41 4.592 10.218C5.02 10.001 5.58 10.001 6.7 10.001H17.3C18.42 10.001 18.98 10.001 19.408 10.218C19.7843 10.4097 20.0903 10.7157 20.282 11.092C20.5 11.52 20.5 12.08 20.5 13.2V17.8C20.5 18.92 20.5 19.48 20.282 19.908C20.0903 20.2843 19.7843 20.5903 19.408 20.782C18.98 21 18.42 21 17.3 21H6.7C5.58 21 5.02 21 4.592 20.782C4.21569 20.5903 3.90974 20.2843 3.718 19.908C3.5 19.481 3.5 18.921 3.5 17.8Z" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
4
|
+
</symbol>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="0" height="0" class="hidden">
|
|
2
|
+
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="right-menu">
|
|
3
|
+
<path d="M3.75 10.5005C3.55109 10.5005 3.36032 10.4214 3.21967 10.2808C3.07902 10.1401 3 9.94937 3 9.75045V3.75195C3 3.55304 3.07902 3.36228 3.21967 3.22162C3.36032 3.08097 3.55109 3.00195 3.75 3.00195H9.75C9.94891 3.00195 10.1397 3.08097 10.2803 3.22162C10.421 3.36228 10.5 3.55304 10.5 3.75195V9.75045C10.5 9.94937 10.421 10.1401 10.2803 10.2808C10.1397 10.4214 9.94891 10.5005 9.75 10.5005H3.75ZM14.25 10.5005C14.0511 10.5005 13.8603 10.4214 13.7197 10.2808C13.579 10.1401 13.5 9.94937 13.5 9.75045V3.75195C13.5 3.55304 13.579 3.36228 13.7197 3.22162C13.8603 3.08097 14.0511 3.00195 14.25 3.00195H20.2485C20.4474 3.00195 20.6382 3.08097 20.7788 3.22162C20.9195 3.36228 20.9985 3.55304 20.9985 3.75195V9.75045C20.9985 9.94937 20.9195 10.1401 20.7788 10.2808C20.6382 10.4214 20.4474 10.5005 20.2485 10.5005H14.25ZM3.75 21.0005C3.55109 21.0005 3.36032 20.9214 3.21967 20.7808C3.07902 20.6401 3 20.4494 3 20.2505V14.2505C3 14.0515 3.07902 13.8608 3.21967 13.7201C3.36032 13.5795 3.55109 13.5005 3.75 13.5005H9.75C9.94891 13.5005 10.1397 13.5795 10.2803 13.7201C10.421 13.8608 10.5 14.0515 10.5 14.2505V20.2505C10.5 20.4494 10.421 20.6401 10.2803 20.7808C10.1397 20.9214 9.94891 21.0005 9.75 21.0005H3.75ZM14.25 21.0005C14.0511 21.0005 13.8603 20.9214 13.7197 20.7808C13.579 20.6401 13.5 20.4494 13.5 20.2505V14.2505C13.5 14.0515 13.579 13.8608 13.7197 13.7201C13.8603 13.5795 14.0511 13.5005 14.25 13.5005H20.2485C20.4474 13.5005 20.6382 13.5795 20.7788 13.7201C20.9195 13.8608 20.9985 14.0515 20.9985 14.2505V20.2505C20.9985 20.4494 20.9195 20.6401 20.7788 20.7808C20.6382 20.9214 20.4474 21.0005 20.2485 21.0005H14.25Z"></path>
|
|
4
|
+
</symbol>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="0" height="0" class="hidden">
|
|
2
|
+
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" id="session_edit">
|
|
3
|
+
<path d="M31.707 19.293L28.707 16.293C28.5195 16.1055 28.2652 16.0002 28 16.0002C27.7348 16.0002 27.4805 16.1055 27.293 16.293L18 25.586V30H22.414L31.707 20.707C31.8945 20.5195 31.9998 20.2652 31.9998 20C31.9998 19.7348 31.8945 19.4805 31.707 19.293ZM21.586 28H20V26.414L25 21.414L26.586 23L21.586 28ZM28 21.586L26.414 20L28 18.414L29.586 20L28 21.586ZM16 22C12.636 22 10 19.364 10 16C10 12.636 12.636 10 16 10C19.364 10 22 12.636 22 16C22 19.364 19.364 22 16 22ZM16 12C13.72 12 12 13.72 12 16C12 18.28 13.72 20 16 20C18.28 20 20 18.28 20 16C20 13.72 18.28 12 16 12Z" ></path>
|
|
4
|
+
<path d="M27.547 12L29.28 11L26.944 6.956C26.7128 6.55568 26.3499 6.24783 25.9173 6.08484C25.4847 5.92185 25.0089 5.91378 24.571 6.062L22.137 6.885C21.7175 6.60263 21.2792 6.34937 20.825 6.127L20.322 3.607C20.2312 3.15363 19.986 2.74574 19.6283 2.45275C19.2706 2.15976 18.8224 1.99977 18.36 2H13.64C13.1775 1.99982 12.7292 2.15995 12.3715 2.45314C12.0137 2.74633 11.7687 3.15444 11.678 3.608L11.175 6.127C10.715 6.351 10.269 6.596 9.84801 6.88L7.42801 6.062C6.9901 5.91378 6.51435 5.92185 6.08172 6.08484C5.64908 6.24783 5.28627 6.55568 5.05501 6.956L2.69501 11.044C2.46394 11.4444 2.37871 11.9125 2.45383 12.3686C2.52894 12.8248 2.75976 13.2408 3.10701 13.546L5.03801 15.243C5.02101 15.495 5.00001 15.745 5.00001 16C5.00001 16.258 5.01001 16.513 5.02801 16.766L3.10801 18.454C2.76059 18.759 2.52959 19.175 2.45429 19.6312C2.37899 20.0873 2.46406 20.5555 2.69501 20.956L5.05501 25.044C5.28631 25.4445 5.64929 25.7525 6.08214 25.9155C6.51499 26.0785 6.99096 26.0865 7.42901 25.938L9.86301 25.115C10.281 25.397 10.719 25.65 11.175 25.873L11.678 28.392C11.7687 28.8456 12.0137 29.2537 12.3715 29.5469C12.7292 29.84 13.1775 30.0002 13.64 30H16V28H13.64L12.93 24.45C11.9478 24.0851 11.0361 23.5533 10.235 22.878L6.78801 24.044L4.42801 19.956L7.15301 17.561C6.96664 16.5269 6.96427 15.468 7.14601 14.433L4.42701 12.043L6.78801 7.956L10.215 9.116C11.0218 8.43968 11.9406 7.90969 12.93 7.55L13.64 4H18.361L19.071 7.55C20.0531 7.91495 20.9649 8.44676 21.766 9.122L25.213 7.956L27.547 12Z" ></path>
|
|
5
|
+
</symbol>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="0" height="0" class="hidden">
|
|
2
|
+
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="user">
|
|
3
|
+
<path d="M19.6524 19.405C20.2044 19.29 20.5344 18.712 20.2594 18.218C19.6534 17.131 18.6994 16.175 17.4794 15.447C15.9074 14.509 13.9804 14 12.0004 14C10.0194 14 8.09339 14.508 6.52139 15.447C5.30139 16.175 4.34739 17.131 3.74139 18.218C3.46639 18.712 3.79639 19.29 4.34839 19.405C9.39518 20.4568 14.6046 20.4568 19.6514 19.405" ></path>
|
|
4
|
+
<path d="M12 13C14.7614 13 17 10.7614 17 8C17 5.23858 14.7614 3 12 3C9.23858 3 7 5.23858 7 8C7 10.7614 9.23858 13 12 13Z" ></path>
|
|
5
|
+
</symbol>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { build } from "vite";
|
|
2
|
+
import { exec } from "child_process";
|
|
3
|
+
|
|
4
|
+
import { defineConfig } from "vite";
|
|
5
|
+
import vue from '@vitejs/plugin-vue';
|
|
6
|
+
import { resolve } from 'path';
|
|
7
|
+
|
|
8
|
+
const envDir: string = "./env";
|
|
9
|
+
const envPrefix: string = "APP";
|
|
10
|
+
|
|
11
|
+
function clearDistFolder() {
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
fs.rmdirSync("./dist",{recursive: true});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function buildLibrary(): Promise<void> {
|
|
17
|
+
await build({
|
|
18
|
+
root: Path2D.resolve(__dirname, "./src"),
|
|
19
|
+
build:{
|
|
20
|
+
outDir: "../dist",
|
|
21
|
+
lib: {
|
|
22
|
+
entry: Path2D.resolve(__dirname, "src/index.ts"),
|
|
23
|
+
name: "ServicesComponentLib",
|
|
24
|
+
fileName: (format) => `services-library.${format}.js`,
|
|
25
|
+
},
|
|
26
|
+
reportCompressedSize: true,
|
|
27
|
+
rollupOptions: {
|
|
28
|
+
external: ['vue'],
|
|
29
|
+
output: {
|
|
30
|
+
globals: {
|
|
31
|
+
vue: 'Vue'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
// plugins: [vue(rawOptions: {reactivityTransform: true})]
|
|
37
|
+
plugins: [vue()],
|
|
38
|
+
resolve: {
|
|
39
|
+
alias: {
|
|
40
|
+
"@": fileUrlToPath(new URL("./src", "file://" + __dirname)),
|
|
41
|
+
"@": fileUrlToPath(new URL(".", "file://" + __dirname)),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
envDir,
|
|
45
|
+
envPrefix,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function buildTypesDeclaration() {
|
|
50
|
+
exec("vue-tsc -p tsconfig.build-lib.json --declaration --emitDeclarationOnly")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function main(): Promise<void> {
|
|
54
|
+
clearDistFolder();
|
|
55
|
+
buildTypesDeclaration();
|
|
56
|
+
await buildLibrary();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
main();
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import AuthTokens from '@/services/classes/AuthTokens';
|
|
2
|
+
import AuthUser from '@/services/classes/AuthUser';
|
|
3
|
+
import IWithId from '@/services/interfaces/IWithId';
|
|
4
|
+
import { AuthInfo } from '@/services/types/AuthInfo';
|
|
5
|
+
|
|
6
|
+
import { Constructable } from '../ClassHelper';
|
|
7
|
+
|
|
8
|
+
class Auth {
|
|
9
|
+
private isAuth = false;
|
|
10
|
+
private user = new AuthUser();
|
|
11
|
+
private tokens = new AuthTokens();
|
|
12
|
+
private preventLogout = false;
|
|
13
|
+
|
|
14
|
+
DeprecateLogout() {
|
|
15
|
+
this.preventLogout = true;
|
|
16
|
+
}
|
|
17
|
+
AllowLogout() {
|
|
18
|
+
this.preventLogout = false;
|
|
19
|
+
}
|
|
20
|
+
IsAuth(): boolean {
|
|
21
|
+
return this.isAuth;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
User(): AuthUser<IWithId> {
|
|
25
|
+
return this.user;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
GetUser<UserT extends Constructable<IWithId>>(): UserT | undefined {
|
|
29
|
+
return this.user.get() as UserT;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
SetUserConstructor(c: Constructable<IWithId>) {
|
|
33
|
+
this.user.setUserConstructor(c);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
SetState<UserT extends IWithId>(authInfo: AuthInfo<UserT>) {
|
|
37
|
+
this.user.set(authInfo.user);
|
|
38
|
+
this.tokens.set(authInfo.tokens);
|
|
39
|
+
this.isAuth = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Logout() {
|
|
43
|
+
if (this.preventLogout) {
|
|
44
|
+
PHelp.Notification.Warning('В текущий момент Вы не можете выйти из системы');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.user.reset();
|
|
48
|
+
this.tokens.reset();
|
|
49
|
+
this.isAuth = false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Actualize() {
|
|
53
|
+
this.user.actualize();
|
|
54
|
+
this.tokens.actualize();
|
|
55
|
+
if (this.user.get() && this.tokens.getAccessToken() && this.tokens.getRefreshToken()) {
|
|
56
|
+
this.isAuth = true;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.Logout();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default new Auth();
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import AuthStatuses from '@/services/interfaces/AuthStatuses';
|
|
2
|
+
|
|
3
|
+
export default class AuthButton {
|
|
4
|
+
label = '';
|
|
5
|
+
isSubmit = false;
|
|
6
|
+
disabled = false;
|
|
7
|
+
private readonly toStatus: AuthStatuses = AuthStatuses.Login;
|
|
8
|
+
|
|
9
|
+
constructor(label: string, toStatus: AuthStatuses, isSubmit = false) {
|
|
10
|
+
this.label = label;
|
|
11
|
+
this.toStatus = toStatus;
|
|
12
|
+
this.isSubmit = isSubmit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static Login(isSubmit?: boolean): AuthButton {
|
|
16
|
+
return new AuthButton('Войти', AuthStatuses.Login, isSubmit);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static Register(isSubmit?: boolean): AuthButton {
|
|
20
|
+
return new AuthButton('Зарегистрироваться', AuthStatuses.Register, isSubmit);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static Restore(isSubmit?: boolean): AuthButton {
|
|
24
|
+
return new AuthButton('Восстановить пароль', AuthStatuses.Restore, isSubmit);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static Refresh(isSubmit?: boolean): AuthButton {
|
|
28
|
+
return new AuthButton('Обновить пароль', AuthStatuses.Refresh, isSubmit);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static LoginButtons(): AuthButton[] {
|
|
32
|
+
return [
|
|
33
|
+
AuthButton.Login(true),
|
|
34
|
+
// AuthButton.Register(),
|
|
35
|
+
AuthButton.Restore(),
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static RegisterButtons(): AuthButton[] {
|
|
40
|
+
return [AuthButton.Register(true), AuthButton.Login(), AuthButton.Restore()];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static RestoreButtons(): AuthButton[] {
|
|
44
|
+
return [
|
|
45
|
+
AuthButton.Restore(true),
|
|
46
|
+
AuthButton.Login(),
|
|
47
|
+
// AuthButton.Register()
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static RefreshButtons(): AuthButton[] {
|
|
52
|
+
return [AuthButton.Refresh(true)];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getStatus(): AuthStatuses {
|
|
56
|
+
return this.toStatus;
|
|
57
|
+
}
|
|
58
|
+
off(): void {
|
|
59
|
+
this.disabled = false;
|
|
60
|
+
}
|
|
61
|
+
on(): void {
|
|
62
|
+
this.disabled = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import AuthButton from '@/services/classes/AuthButton';
|
|
2
|
+
import { AuthStatusesObjects } from '@/services/classes/AuthStatusesObjects';
|
|
3
|
+
import EmailField from '@/services/classes/EmailField';
|
|
4
|
+
import PasswordField from '@/services/classes/PasswordField';
|
|
5
|
+
import PasswordRepeatField from '@/services/classes/PasswordRepeatField';
|
|
6
|
+
import AuthStatuses from '@/services/interfaces/AuthStatuses';
|
|
7
|
+
import IEmailPassword from '@/services/interfaces/IEmailPassword';
|
|
8
|
+
|
|
9
|
+
class AuthForm {
|
|
10
|
+
private status: AuthStatuses = AuthStatuses.Login;
|
|
11
|
+
private email = new EmailField();
|
|
12
|
+
private password = new PasswordField();
|
|
13
|
+
private passwordRepeat = new PasswordRepeatField();
|
|
14
|
+
|
|
15
|
+
Status(): AuthStatuses {
|
|
16
|
+
return this.status;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Email(): EmailField {
|
|
20
|
+
return this.email;
|
|
21
|
+
}
|
|
22
|
+
Password(): PasswordField {
|
|
23
|
+
return this.password;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
PasswordRepeat(): PasswordRepeatField {
|
|
27
|
+
return this.passwordRepeat;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
GetErrors(): string[] {
|
|
31
|
+
if (this.IsRefresh()) {
|
|
32
|
+
if (!this.ComparePasswords()) {
|
|
33
|
+
return ['Пароли не совпадают, проверьте ввод!'];
|
|
34
|
+
}
|
|
35
|
+
return this.password.getErrors();
|
|
36
|
+
}
|
|
37
|
+
if (this.IsRestore()) {
|
|
38
|
+
return this.email.getErrors();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (this.IsRegister()) {
|
|
42
|
+
if (!this.ComparePasswords()) {
|
|
43
|
+
return ['Пароли не совпадают, проверьте ввод!'];
|
|
44
|
+
}
|
|
45
|
+
return this.email.getErrors();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return [...this.email.getErrors(), ...this.password.getErrors()];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ComparePasswords(): boolean {
|
|
52
|
+
return this.password.password === this.passwordRepeat.text ? true : false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ToEmailPassword(): IEmailPassword {
|
|
56
|
+
return { email: this.email.email, password: this.password.password };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
IsLogin(): boolean {
|
|
60
|
+
return this.status === AuthStatuses.Login;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
IsRegister(): boolean {
|
|
64
|
+
return this.status === AuthStatuses.Register;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
IsRestore(): boolean {
|
|
68
|
+
return this.status === AuthStatuses.Restore;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
IsRefresh(): boolean {
|
|
72
|
+
return this.status === AuthStatuses.Refresh;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
SetStatus(status: AuthStatuses): void {
|
|
76
|
+
this.status = status;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
GetTitle(): string {
|
|
80
|
+
return AuthStatusesObjects[this.status].title as string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
GetComponent(): string {
|
|
84
|
+
return AuthStatusesObjects[this.status].component as string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
GetAuthButtons(): AuthButton[] {
|
|
88
|
+
return AuthStatusesObjects[this.status].buttons as AuthButton[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
GetSuccessMessage(): string {
|
|
92
|
+
return AuthStatusesObjects[this.status].successMessage as string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
GetErrorMessage(): string {
|
|
96
|
+
return AuthStatusesObjects[this.status].errorMessage as string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
GetAction(): string {
|
|
100
|
+
return AuthStatusesObjects[this.status].action as string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
Reset(): void {
|
|
104
|
+
this.email.reset();
|
|
105
|
+
this.password.reset();
|
|
106
|
+
this.status = AuthStatuses.Login;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Focus(): void {
|
|
110
|
+
this.email.focus();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export default new AuthForm();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import AuthStatuses from '@/services/interfaces/AuthStatuses';
|
|
2
|
+
|
|
3
|
+
class AuthModal {
|
|
4
|
+
private visible = false;
|
|
5
|
+
private closable = false;
|
|
6
|
+
private status: AuthStatuses = AuthStatuses.Login;
|
|
7
|
+
|
|
8
|
+
Status(): AuthStatuses {
|
|
9
|
+
return this.status;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
IsClosable(): boolean {
|
|
13
|
+
return this.closable;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
IsVisible(): boolean {
|
|
17
|
+
return this.visible;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Close(): void {
|
|
21
|
+
this.visible = false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Open(closable?: boolean): void {
|
|
25
|
+
if (closable) {
|
|
26
|
+
this.closable = true;
|
|
27
|
+
}
|
|
28
|
+
this.visible = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default new AuthModal();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import AuthButton from '@/services/classes/AuthButton';
|
|
2
|
+
import AuthStatuses from '@/services/interfaces/AuthStatuses';
|
|
3
|
+
|
|
4
|
+
export const AuthStatusesObjects: Record<AuthStatuses, Record<string, string | AuthButton[]>> = {
|
|
5
|
+
[AuthStatuses.Login]: {
|
|
6
|
+
title: 'Авторизация',
|
|
7
|
+
action: 'login',
|
|
8
|
+
component: 'LoginChunk',
|
|
9
|
+
buttons: AuthButton.LoginButtons(),
|
|
10
|
+
errorMessage: 'Неверно указан email или пароль',
|
|
11
|
+
successMessage: 'Вы успешно вошли в систему',
|
|
12
|
+
},
|
|
13
|
+
[AuthStatuses.Register]: {
|
|
14
|
+
title: 'Регистрация',
|
|
15
|
+
action: 'register',
|
|
16
|
+
component: 'RegisterChunk',
|
|
17
|
+
buttons: AuthButton.RegisterButtons(),
|
|
18
|
+
errorMessage: 'Неверно указан email или пароль',
|
|
19
|
+
successMessage: 'Вы успешно зарегистрировались в системе, войдите под своим паролем',
|
|
20
|
+
},
|
|
21
|
+
[AuthStatuses.Restore]: {
|
|
22
|
+
title: 'Восстановление пароля',
|
|
23
|
+
component: 'ForgotPasswordChunk',
|
|
24
|
+
action: 'restorePassword',
|
|
25
|
+
successMessage: 'Ссылка для восстановления пароля отправлена на Вашу почту',
|
|
26
|
+
errorMessage: 'Неверно указан email',
|
|
27
|
+
buttons: AuthButton.RestoreButtons(),
|
|
28
|
+
},
|
|
29
|
+
[AuthStatuses.Refresh]: {
|
|
30
|
+
title: 'Создание нового пароля',
|
|
31
|
+
action: 'passwordChange',
|
|
32
|
+
component: 'PasswordChangeChunk',
|
|
33
|
+
successMessage: 'Воспользуйтесь новым паролем для входа',
|
|
34
|
+
errorMessage: 'Неверно указан email',
|
|
35
|
+
buttons: AuthButton.RefreshButtons(),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import ITokens from '@/services/interfaces/ITokens';
|
|
2
|
+
|
|
3
|
+
import LocalStoreKeys from '../interfaces/LocalStoreKeys';
|
|
4
|
+
import LocalStore from './LocalStore';
|
|
5
|
+
|
|
6
|
+
export default class AuthTokens {
|
|
7
|
+
// private accessToken?: string;
|
|
8
|
+
// private refreshToken?: string;
|
|
9
|
+
|
|
10
|
+
set(tokenObj: ITokens) {
|
|
11
|
+
this.setAccessToken(tokenObj.accessToken);
|
|
12
|
+
this.setRefreshToken(tokenObj.refreshToken);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getAccessToken(): string | undefined {
|
|
16
|
+
return LocalStore.Get(LocalStoreKeys.AccessToken);
|
|
17
|
+
}
|
|
18
|
+
getRefreshToken(): string | undefined {
|
|
19
|
+
return LocalStore.Get(LocalStoreKeys.RefreshToken);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
setAccessToken(token?: string) {
|
|
23
|
+
// this.accessToken = token;
|
|
24
|
+
LocalStore.Set(LocalStoreKeys.AccessToken, token);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setRefreshToken(token?: string) {
|
|
28
|
+
// this.refreshToken = token;
|
|
29
|
+
LocalStore.Set(LocalStoreKeys.RefreshToken, token);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
reset() {
|
|
33
|
+
// this.accessToken = undefined;
|
|
34
|
+
// this.refreshToken = undefined;
|
|
35
|
+
LocalStore.Remove(LocalStoreKeys.AccessToken);
|
|
36
|
+
LocalStore.Remove(LocalStoreKeys.RefreshToken);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
actualize() {
|
|
40
|
+
this.setAccessToken(this.getAccessToken());
|
|
41
|
+
this.setRefreshToken(this.getAccessToken());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Constructable } from '@/services/ClassHelper';
|
|
2
|
+
import IWithId from '@/services/interfaces/IWithId';
|
|
3
|
+
|
|
4
|
+
import LocalStoreKeys from '../interfaces/LocalStoreKeys';
|
|
5
|
+
import LocalStore from './LocalStore';
|
|
6
|
+
|
|
7
|
+
interface IWithUser<UserT> {
|
|
8
|
+
user?: UserT;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default class AuthUser<UserT extends IWithId> {
|
|
12
|
+
private user: UserT | undefined;
|
|
13
|
+
userConstructor?: Constructable<UserT>;
|
|
14
|
+
|
|
15
|
+
AssignTo(item: IWithUser<UserT>) {
|
|
16
|
+
item.user = this.get();
|
|
17
|
+
}
|
|
18
|
+
setUserConstructor(userConstructor: Constructable<UserT>) {
|
|
19
|
+
this.userConstructor = userConstructor;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get(): UserT | undefined {
|
|
23
|
+
if (!this.userConstructor) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.user = new this.userConstructor(LocalStore.Get(LocalStoreKeys.User));
|
|
27
|
+
return this.user;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getId(): string | undefined {
|
|
31
|
+
return this.get()?.id;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
set(user: UserT): void {
|
|
35
|
+
if (!this.userConstructor) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.user = new this.userConstructor(user);
|
|
39
|
+
LocalStore.Set(LocalStoreKeys.User, this.user);
|
|
40
|
+
}
|
|
41
|
+
reset(): void {
|
|
42
|
+
this.user = undefined;
|
|
43
|
+
LocalStore.Remove(LocalStoreKeys.User);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
actualize() {
|
|
47
|
+
const user = LocalStore.Get<UserT>(LocalStoreKeys.User);
|
|
48
|
+
if (!user) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.set(user);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import ChatMessage from '@/services/classes/ChatMessage';
|
|
2
|
+
import ClassHelper from '@/services/ClassHelper';
|
|
3
|
+
|
|
4
|
+
export default class Chat {
|
|
5
|
+
id?: string;
|
|
6
|
+
@ClassHelper.GetClassConstructor(ChatMessage)
|
|
7
|
+
chatMessages: ChatMessage[] = [];
|
|
8
|
+
constructor(i?: Chat) {
|
|
9
|
+
ClassHelper.BuildClass(this, i);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
addChatMessages(message: ChatMessage): void {
|
|
13
|
+
if (this.chatMessages.find((m: ChatMessage) => m.id === message.id)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
this.chatMessages.push(message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
|
|
3
|
+
// import User from '@/classes/User';
|
|
4
|
+
import ClassHelper from '@/services/ClassHelper';
|
|
5
|
+
export enum ChateMessageTypes {
|
|
6
|
+
Ping = 'ping',
|
|
7
|
+
Enter = 'enter',
|
|
8
|
+
Exit = 'exit',
|
|
9
|
+
Message = 'message',
|
|
10
|
+
Write = 'write',
|
|
11
|
+
Empty = '',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default class ChatMessage {
|
|
15
|
+
id?: string;
|
|
16
|
+
message = '';
|
|
17
|
+
// user: User = new User();
|
|
18
|
+
// userId?: string;
|
|
19
|
+
userName?: string;
|
|
20
|
+
createdOn = new Date();
|
|
21
|
+
chatId?: string;
|
|
22
|
+
type: ChateMessageTypes = ChateMessageTypes.Message;
|
|
23
|
+
|
|
24
|
+
constructor(i?: ChatMessage) {
|
|
25
|
+
ClassHelper.BuildClass(this, i);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static Create(chatId: string, userId: string | undefined, messageText: string, userName: string | undefined): ChatMessage {
|
|
29
|
+
const item = new ChatMessage();
|
|
30
|
+
item.id = uuidv4();
|
|
31
|
+
item.chatId = chatId;
|
|
32
|
+
// item.userId = userId;
|
|
33
|
+
item.message = messageText;
|
|
34
|
+
item.userName = userName;
|
|
35
|
+
return item;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static CreatePingMessage(): ChatMessage {
|
|
39
|
+
const item = new ChatMessage();
|
|
40
|
+
item.type = ChateMessageTypes.Ping;
|
|
41
|
+
item.id = uuidv4();
|
|
42
|
+
return item;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
isMessage(): boolean {
|
|
46
|
+
return this.type === ChateMessageTypes.Message || this.type === ChateMessageTypes.Empty;
|
|
47
|
+
}
|
|
48
|
+
}
|