{"version":3,"sources":["components/Wrapper.tsx","store/reducers/common.ts","utilities/Cpf.ts","utilities/constants/errors.ts","store/reducers/userSlice.ts","store/reducers/userDataSlice.ts","components/WPageBookDetail.tsx","utilities/Categories.ts","services/index.ts","services/contents/ContentServiceApi.ts","services/user/UserServiceApi.ts","services/userData/UserDataServiceApi.ts","store/reducers/contentSlice.ts","store/index.ts","components/WModal.tsx","components/WModalMigration.tsx","App.tsx","components/WPageBookFiltered.tsx","components/WPageLogin.tsx","components/WPagePassword.tsx","components/WPageOrganization.tsx","components/WPageForgotMyPassword.tsx","components/WPageRegister.tsx","components/WPageShowcase.tsx","components/WPageHome.tsx","components/WPageLibrarySection.tsx","components/WPageLibraryFavorite.tsx","components/WPageProfile.tsx","components/WPageBookSummary.tsx","components/WPageBookReadingList.tsx","components/WPageLibraryReadingListCard.tsx","components/WPageLibraryReadingList.tsx","components/WPageBookFound.tsx","components/WReader.tsx","components/WPageRecoverPassword.tsx","components/WPageChangeYourPassword.tsx","components/WPageFAQ.tsx","components/WPageContactUs.tsx","components/WPageTermsOfUse.tsx","components/WPageOffline.tsx","components/WPageHelp.tsx","components/WPlayer.Style.ts","services/player/usePlayer.ts","components/WPlayer.tsx","components/WPageAppointments.tsx","components/WPageLibraryAppointments.tsx","components/WPageLibraryDownload.tsx","components/ManagementContentDetail.tsx","components/WPageAbout.tsx","components/WPagePrivacyPolice.tsx","components/Wsso.tsx","index.tsx"],"names":["Wrapper","props","parms","useParams","searchParms","useSearchParams","lastParms","setLastParms","useState","undefined","lastSearchParms","setLastSeaarchParms","useEffect","paramsStr","JSON","stringify","data","length","onChangeParams","parse","onChangeSearchParams","_jsx","element","initialState","state","runningInMobile","withInternet","referrer","alertSelectButton","createAction","filterContent","commonSlice","createSlice","name","reducers","resetState","payload","Sdk","Api","request","Request","onMobile","setLoader","action","loader","showAlert","alert","changeState","changeRoute","route","setRefferer","refs","window","location","hash","recoverPassword","loginOptionsPage","loginPage","loginProjectsPage","loginPasswordPage","registerPage","helpPage","changePage","goToPage","option","console","log","MenuOptions","Home","Library","Profile","goToPageOption","optionSelected","PageOptionHome","PageOptionLibrary","PageOptionProfile","goToMyProfileOption","PageOptionMyProfile","PageOptionTermsOfUse","PageOptionContactUs","PageOptionFAQ","goToLibraryPage","LibrarySections","Downloads","Favorites","Marks","ReadingList","goToLibraryOption","PageLibraryOptionDownloads","PageLibraryOptionFavorites","PageLibraryOptionAppointments","PageLibraryOptionReadingList","goToContent","CordovaExec","status","contentUid","contentReferenceUid","summary","backPage","history","back","extraReducers","builder","addCase","show","middleware","store","next","async","getState","actions","match","userState","user","callback","showContentDetail","content","contentState","allContents","find","p","uid","dispatch","contentSlice","activeReference","goToContentInfo","ContentOptionDetail","activeContentUid","_filter$category","_filter$category2","_filter$category3","filter","category","query","editTagByUid","unathorized","authorization","authenticated","title","description","sanitizeCpf","value","replaceAll","ERRORS","projectsLoading","userAuthenticating","contactLoading","userRegistering","changingPassword","updatingProfile","openModalMigration","projectsAvailable","createAsyncThunk","login","UserService","ProjectsAvailable","userLogout","Logout","authenticateUser","SigninDefault","password","ignoreActive","restoreUser","ActiveUser","errorNoOrganizations","RecoverPassword","contact","SentContactUs","signinAfterAuth","params","SigninSsoAfterAuthentication","remoteRegisterUser","RegisterUser","organizationsFromLogin","ProjectsFromLogin","activeUserFromSso","showAlertSSO","authenticateFromProfileContext","updatingUser","checkPendingCpfOrEmail","checkUniqueLogin","sendCPFEmail","sendNewLogin","signinFromProfile","authenticateSso","forgotPasswordFromLibrary","onCloseMigrationModal","updatedProfile","UpdatedProfile","changePassword","passwordData","ChangePassword","currentPassword","createPassowrd","CreatePassword","token","signinAnonymous","projectUid","AnonymousSignIn","signinSso","AuthenticateSSO","signinSSOFromProvision","AuthenticateSSOFromProvision","signinMigration","SigninMigrationFlow","sendOrganization","SendOrganization","organizationUid","onCreatePreference","preference","CretePreference","onForgotPasswordLibrary","SendForgotPasswordLibrary","userSlice","setLastLogin","lastLoginSetted","setLastCpf","lastCpfSetted","setTokenRecoveryPassword","authorizationTokenRecovery","setSsoLoading","loadingSso","setSsoData","ssoData","setUserWithDetails","result","preferences","projects","setPreferences","setProjects","showAlertRecoveryPassword","recoveryStatus","clearForm","clearContactForm","checkAvailableProjects","isCpf","splited","split","a","b","c","checkSimpleCpf","replace","selectProject","project","activeProject","signin","signinAfterPayload","syncOrganization","step","showMyProjects","_state$projects","organizations","map","item","migrated","closeModal","toggleModalMigration","setMigrated","_state$organizations","newOrganizations","sendUserOrganization","changeStep","setOrganizations","_data$payload","activeUser","ssoParams","activeUserCopy","userCopy","logout","registerUser","contactUs","createPasswordFromRecovery","checkSigninSSO","setImportReadingList","codeReadingList","pending","rejected","fulfilled","_state$projectsAvaila","error","code","userAuthenticationErro","message","updatingUserError","signinSsoError","unwrap","then","lastLogin","catch","err","Boolean","fn","_state$userState$last","_result$email","email","res","path","hashPath","startsWith","_state$userState$sign","_state$userState$sign2","includes","cpf","errorLink","_state$userState$orga","every","param","_action$payload","baseAlert","setTimeout","_state$userState$auth","_action$payload2","newPassword","form","field","propertyForm","errorLogin","_state$userState$user","initialLogin","organization","firstLogin","userDataSlice","_state$userState$user2","_result$email2","e","meta","requestStatus","_error$message","_error","profile","userUpdated","errorUpdated","_state$userState$upda","_state$userState$pref","key","buttons","label","styles","background","color","margin","tags","sharedTags","userDataShared","userData","playerObserver","loadTags","UserDataService","TagsAvailable","loadSharedTags","TagsSharedAvailable","subscribeTag","TagSubscribe","createTag","tag","TagCreate","updateTag","TagUpdate","deleteTag","TagDelete","loadUserData","UserDataAvailable","loadUserDataShared","UserDataAvailableShared","insertContentInTag","InsertContentInTagt","removeContentFromTag","RemoveContentFromTag","postUserEvaluation","PostUserEvaluation","rate","updateEvaluation","UpdateUserEvaluation","note","deleteUserEvaluation","reviewUid","DeleteUserEvaluation","internalDownloadContentReference","ContentDownload","internalDeleteContentReference","ContentDelete","reloadUserData","FavoritesInternalTag","insertInFavorite","removeFromFavorite","createTagPage","loadTag","updateActiveTag","searchAndSubscribeTag","shareCode","removeActiveTag","insertInTagActiveContent","removeFromTagActiveContent","rateActiveContent","unRateActiveContent","historyContents","ContentService","HistoryContents","getReviewContents","ReviewContents","downloadedContents","ContentDownloaded","downloadedContentsWithoutAlert","downloadContentReference","deleteContentReference","loadPlayerObserver","cleanData","activeTagUid","historyReading","worksToReview","runPlayerObserver","requestId","push","contextType","targetType","contextUid","arg","targetUid","r","list","contents","current","listUpdated","commonState","activeReview","contentDetail","updatedTag","userDataState","_updatedTag$contents","forEach","_updatedTag$contents2","userDatas","u","_u$tags","t","newContents","removeContents","_updatedTag$contents3","cp","removeContent","ac","currentTag","isWeb","innerWidth","contentUpdated","_contentUpdated$refer","completed","references","downloadProgress","lastContent","reference","_lastContent$referenc","newReferente","_content","_content$references","_content$title","_content2","_p$references","format","updateAllContents","_item$references","referenceItem","reason","remote","ContentTypeV","WPageBookDetail","connect","mapState","_content$references2","contentSummary","relatedContent","activeContentRelated","activeContent","uniqueTags","_p$tags2","reduce","Map","values","contentsUids","ut","books","readingTime","author","isFavorite","availableEpubFormat","f","mimeType","indexOf","availablePdfFormat","formats","propsAppointments","pdfdata","epubdata","_activeContent$refere","external","externalData","marked","annotation","numerReading","markColor","mark_color","info","chapter_index","externalType","pdfAppointments","epubAppointments","getAppointments","listResult","_state$userDataState$","selected","_p$tags","itemsLists","listState","authenticatedUser","loading","contentsFavorited","contentsDownloaded","PageBookDetail","PageBookDetailWeb","summaries","loadingRelateds","loadingSummary","mapDispatch","onClickOptionFooter","onClickLogin","onSelectedHeaderBack","onSelectedHeaderMenuOption","onRemoveRating","onSelectedNavigationPageOption","onClickReadSample","openContent","ContentType","Epub","Pdf","onClickReadEpub","onClickReadPdf","onClickHelp","onSelectedEditionEpub","loadAndOpenContent","onRate","onDownloadContent","onDeleteContent","onChangeFilter","onSelectedContent","onCreateList","onSelectItemChange","onClickFavorite","onNavigateToContentLink","contentLink","contentType","activeContentAnchor","findCategory","rootCategory","child","_rootCategory$childs","childs","foundInChilds","GetProgressRead","contentGroupId","url","dynamic","bridge","donwloadNow","ContentMimeType","EPUB","PDF","epubReference","ref","ms","Promise","resolve","Schemas","schemas","this","LoadSchemas","schema","entities","LoadEntities","categories","ToCategory","MostWantedContents","credential","Contents","customQuery","RelatedContents","_info$content$entitie","entityTypeCategory","hasCategory","entityUid","categoriesAvailableForUser","SuggestedContents","response","uids","notFound","promises","contentGroup","ToContent","all","interactions","i","ContentDetailResumed","ToContentComplete","ContentDetail","userScore","userScoreResponse","review","fullReview","userEvaluation","pop","contentScore","contentScoreResponse","evaluation","page","current_page","pageSize","page_size","nextQuery","next_page_query","totalResult","total_results","serverData","ignoreImageOptions","_serverData$propertie","_serverData$propertie2","_serverData$propertie3","_serverData$propertie4","_serverData$propertie5","_serverData$propertie6","_serverData$propertie7","_serverData$entities","thumbLink","thumbUrl","bridgeUrl","properties","edition","image","entity_uid","ContentSummary","pdfSummary","epubSummary","Array","isArray","getEpubSummary","type","getPdfSummary","GetPdfSummary","ToPdfSummary","uniqueContentSummary","GetEpubSummary","ToEpubSummary","summaryFormater","prev","some","x","contentTocUrl","fetch","manifest","text","parser","DOMParser","parseFromString","getElementsByTagName","Error","sections","json","GetContentReferenceTarget","summary_type","pageSets","pageSet","navLink","orderIndex","section","sectionIndex","portrait","linkPage","bookmark","from","navPoint","getAttribute","s","id","toString","textContent","trim","join","_serverData$propertie8","_serverData$propertie9","_serverData$propertie10","_serverData$propertie11","ToContentReference","mime_type","products","download_progress","entity","defaultColor","Cor","backgroundColor","_result$childs","childCategory","GetUserEvaluation","contentId","constructor","checkExpiredDate","date","currentDate","Date","signinProvisionSSO","serverUser","userInfo","detail","email_principal","phone","phone_principal","activeProjectUid","currentAnonymous","credentialAnonymous","signinByProjectAnonymous","expiredDate","sendData","support","telefone","assunto","_profile$cpf","_profile$name","formatedCpf","first","last","first_name","last_name","updateUserState","current_password","encodeURIComponent","getConnectorLibraryMigration","possible_accounts","index","_item$organizationId","_ref","_item$organizationNam","organizationId","organization_id","organizationName","organization_name","myHeaders","Headers","append","requestOptions","method","headers","body","errors","GetUserPreferences","GetProjects","arguments","now","GetUserLoginDetails","GetUserAuthFlow","_result$organizations","signinByCredential","Authenticate","ignoreContext","signinByLogin","_ref2","connectorId","_Sdk$Api$authorizatio","_Sdk$Api$authorizatio2","connector","connectors","iternal_name","userResult","acessToken","_res$possible_account","_item$organizationId2","_ref3","_item$organizationNam2","_ref4","_Sdk$Api$authorizatio3","_Sdk$Api$authorizatio4","auth","accessToken","SendUniqueLogin","SendCPFOrEmail","_serverUser$detail","_serverUser$detail2","_serverUser$detail3","_serverUser$detail4","CheckUniqueLogin","_data$name","resto","soma","parseInt","substring","cpfValidator","_connector$features","features","ToTagData","active_share","shareEnabled","TagDataFromContent","ToUserData","RemoveUserData","contens","context_uid","context_type","target_uid","target_type","ContentsFromTagData","code_share","ToContentReferences","rr","rg","content_group","existRg","_serverData$tags","external_data","external_type","externalUid","external_uid","authors","mostWantedContents","suggestedContents","loadContentDetail","contentDetailResumed","contentFilter","contentRelated","schemasAll","loadMoreFromActiveContentFilter","setSummaryItem","summaryItem","setContentOption","contentOption","setLoadingSummary","openOfflineContent","updateData","updateImagePermissions","_content$image","updateDownloadProgress","setActiveContentUid","_state$activeFilter","activeFilter","filterUpdated","_state$categories$map","filterCategory","foundCategory","processing","contentFromFilter","totalContentsFromFilter","options","ContentOptionAppointments","ContentOptionFavorite","ContentOptionFavorited","ContentOptionDownload","ContentOptionReadingList","ContentOptionSummary","updateContentAnchor","activeContentAnchorLink","activeContentReference","startDownload","mostWantedContent","updateContentAuthor","suggestedContent","searchResult","statusUpdated","download","inMemory","_download$references","_inMemory$references","_inMemory$references2","currentReference","_c$references","_data$find","_data$find2","_state$contentState$a","referenceType","fail","_option$contentLink3","_option$contentLink4","_option$contentLink$n","_option$contentLink","mark","_option$contentLink2","anchor","Preference","types","_activeContent$refere2","currentData","newDatas","newData","_current$references","currentReferences","currentGeneric","neweneric","_currentReferences","_current$references2","newReference","names","_content$entities","Store","configureStore","reducer","persistReducer","storage","mm","serializableCheck","concat","contentSliceMiddleware","userSliceMiddleware","commonMiddleware","userDataMiddleware","useAppDispatch","useDispatch","PersitorState","useSelector","initialized","persistStore","WModal","_data$title","_data$description","onClick","button","onClose","Modal","WModalMigration","_state$userState$open","_state$userState$step","_state$userState$proj","open","context","preSettedLogin","pass","orgId","onConfirmSignIn","sendCPFOrEmail","newValue","sendUniqueLogin","setStep","newStep","onConfirm","onClickForgotPassword","sendPasswordToAuthOtherProfile","ModalMigration","App","effectRan","useRef","setInitialized","contentOptions","inMobile","hasSummaryState","navigate","useNavigate","useLocation","searchParams","urlParams","Object","fromEntries","ssoRoute","pathname","loadConfig","pagesNoRedirect","get","addEventListener","receiveMessage","document","changeDocumentVisivity","removeEventListener","finalRoute","String","exceptions","onBack","userInteraction","ev","visibilityState","config","localStorage","getItem","href","search","setupSdk","listenAppEvents","cordovaInstance","domain","projectKey","project_key","pk","apiEnv","api_env","ae","project_uid","pu","cms","dam","setEnviroment","setProjectKey","initializeFromProject","_jsxs","_Fragment","children","Outlet","Loading","WPageBookFiltered","_state$contentState$a2","_state$contentState$a3","_state$contentState$a4","_state$contentState$a5","allContent","activeCategory","PageBookFiltered","PageBookFilteredWeb","allCategories","fetching","haveMoreContent","onSelectedCategory","onClickContentDetail","onClickContent","categoryUid","onLoadMore","onClickNext","onClickCollection","onClickForgotMyPassword","onClickBack","WPageLogin","Mobile","PageLogin","Web","PageLoginWeb","WPagePassword","PagePassword","PagePasswordWeb","WPageSelectOrganization","PageSelectOrganization","PageSelectOrganizationWeb","successMessage","onClickRecover","WPageForgotMyPassword","PageForgotMyPassword","PageForgotMyPasswordWeb","onClickBackPage","onClickForm","WPageRegister","PageRegister","PageRegisterWeb","keepReding","orderedBooks","contentOrderedIds","book","progressRead","progress","interaction_progress","contentsKeepReading","refetchHistory","refetchReviewContents","PageShowcaseWeb","PageShowcase","WPageShowcase","onClickRegister","WPageHome","PageHome","PageHomeWeb","webMapState","favoritedBooks","remoteContents","getFavoriteContets","marked_books","marks","_mark$numberMark","total","Number","numberMark","appointmentsLength","collectionList","contentsMap","_userData$tags","contentData","editable","getCollectionLits","collectionsList","shareds","favorites","appointments","onSelectedSection","webmapDispatch","onClickRemoveFavorite","onEditionGroup","group","WPageLibrarySection","PageLibrarySection","LibraryWeb","WPageLibraryFavorite","_contents$map","downloads","onSelectedContentOption","onOpenContent","PageLibraryFavorite","_name","_state$userState$orga2","_state$userState$user3","_state$userState$user4","_state$userState$user5","_state$userState$user6","directory","privacy","acceptedPrivacyPolice","userOrganizations","onClickOrganizationMigrated","onClickLinkOrganization","onClickLogout","onClickUpdateProfile","onClickChangePassword","WPageProfile","PageMyProfile","PageMyProfileWeb","WPageBookSummary","PageSummary","onClickItemSummary","isFavorited","selectedList","available","WPageBookReadingList","PageList","PageListWeb","WPageLibraryReadingListCard","searchedBooks","onClickCreate","PageLibraryReadingListCard","getContetsFromTag","tagUid","suggestGroup","_state$contentState$s","getCollectionList","suggestContents","activeBook","listName","onSearchListShare","getContentsFromTagUid","importingCode","commomDispatch","onClickDeleteList","onClickShareCode","onChangeList","onClickSearchShare","webDispatch","WPageLibraryReadingList","PageLibraryReadingList","PageLibraryReadingListWeb","WPageBookFound","Component","PageBookFoundWeb","PageBookFound","showButtonMore","totalContents","filterData","onClickShowMore","WReader","onLogout","onClickRecoverPassword","WPageRecoverPassword","PageRecoverPassword","PageRecoveryPasswordWeb","repeatPassword","WPageChangeYourPassword","PageChangeYourPassword","PageChangeYourPasswordWeb","Page","WPageFAQ","PageFAQ","PageFAQWeb","initialParams","onSubmitContactUs","contactUsForm","WPageContactUs","PageContactUsWeb","PageContactUs","WPageTermsOfUse","PageTermsOfUse","PageTermsOfUseWeb","WPageOffline","contentReference","onClickReference","PageOffline","WPageHelp","PageHelp","Container","styled","div","IframeContainer","iframe","LAST_REFERENCE","usePlayer","uidReference","uidContext","utilizationRef","setUserData","lastInteraction","setLastInteraction","lastReference","setLastReference","player","getAnnotations","handleHighlight","connectorUser","userDataParams","handleAnnotation","userDataUid","_hash","keys","userDataFound","user_external","dataExternal","getNoteWithoutUID","handleDeleteAnnotation","userProgress","activity_data","trackProgress","getLastInteraction","createInteraction","WPlayer","navigateTo","contentUrl","uri","setUri","onLoad","target","contentWindow","postMessage","onError","sandbox","allow","src","WPageAppointments","PageAppointments","WPageLibraryAppointments","PageLibraryAppointments","WPageLibraryDownload","PageLibraryDownload","ManagementContentDetail","prop","setContentUid","paramsContentuid","WPageAbout","PageAboutWeb","WPagePrivacyPolice","PagePrivacyPolice","Wsso","query_params","ran","URLSearchParams","HeaderWeb","root","ReactDOM","createRoot","getElementById","router","createHashRouter","createRoutesFromElements","Route","Navigate","to","render","React","StrictMode","Provider","GlobalFonts","RouterProvider"],"mappings":"qTAiBA,MAAMA,EAAmCC,IAErC,MAAMC,EAAYC,cACZC,EAAkBC,eACjBC,EAAWC,GAAgBC,wBAA6BC,IACxDC,EAAiBC,GAAuBH,wBAAsCC,GAkCrF,OAhCAG,qBAAU,KAEN,IAAIC,EAAYC,KAAKC,UAAUb,GAC3BW,IAAcP,GAElBC,EAAaM,EAAU,GACzB,CAACX,IAEHU,qBAAU,KAEN,IAAII,EAEAZ,EAAYa,OAAQ,IAAGD,EAAOZ,EAAY,IAC1CY,IAASN,GAEbC,EAAoBK,EAAK,GAC3B,CAACZ,IAEHQ,qBAAU,KAEDN,GACLL,EAAMiB,gBAAkBjB,EAAMiB,eAAeJ,KAAKK,MAAMb,GAAW,GAErE,CAACA,IAEHM,qBAAU,KAEDF,GACLT,EAAMmB,sBAAwBnB,EAAMmB,qBAAqBV,EAAgB,GAE3E,CAACA,IAEIW,cAACpB,EAAMqB,QAAO,IAAKrB,GAAQ,E,YCwBtC,MAAMsB,EAA4B,CAChCC,MAAO,OACPC,iBAAiB,EACjBC,cAAc,EACdC,SAAU,CAAC,aAGAC,EAAoBC,YAE/B,gBAEWC,EAAgBD,YAA6B,kBAE7CE,EAAcC,YAAY,CACrCC,KAAM,SACNV,eACAW,SA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,CAACX,OAAQA,U","file":"static/js/main.12f1654c.chunk.js","sourcesContent":["import { useEffect, useState } from \"react\";\r\nimport { useParams, useSearchParams } from \"react-router-dom\";\r\n\r\nexport interface WrapperStateProps\r\n{\r\n element:React.FC;\r\n}\r\n\r\nexport interface WrapperDispatchProps\r\n{\r\n onLoad?:()=> void;\r\n onChangeParams?:(params:any)=> void;\r\n onChangeSearchParams?:(params:URLSearchParams | undefined)=> void;\r\n}\r\n\r\ntype WrapperProps = WrapperStateProps & WrapperDispatchProps\r\n\r\nconst Wrapper: React.FC = (props) =>\r\n{\r\n const parms:any = useParams();\r\n const searchParms:any = useSearchParams();\r\n const [lastParms, setLastParms] = useState(undefined);\r\n const [lastSearchParms, setLastSeaarchParms] = useState(undefined);\r\n\r\n useEffect(()=> \r\n {\r\n var paramsStr = JSON.stringify(parms);\r\n if (paramsStr === lastParms) return;\r\n \r\n setLastParms(paramsStr);\r\n },[parms]);\r\n\r\n useEffect(()=> \r\n {\r\n var data:URLSearchParams | undefined;\r\n\r\n if (searchParms.length> 0) data = searchParms[0];\r\n if (data === lastSearchParms) return;\r\n \r\n setLastSeaarchParms(data);\r\n },[searchParms]);\r\n\r\n useEffect(()=> \r\n { \r\n if (!lastParms) return;\r\n props.onChangeParams && props.onChangeParams(JSON.parse(lastParms));\r\n\r\n },[lastParms])\r\n\r\n useEffect(()=> \r\n { \r\n if (!lastSearchParms) return;\r\n props.onChangeSearchParams && props.onChangeSearchParams(lastSearchParms);\r\n\r\n },[lastSearchParms])\r\n\r\n return \r\n};\r\n\r\nexport { Wrapper};\r\n","import {\r\n createAction,\r\n createAsyncThunk,\r\n createSlice,\r\n PayloadAction,\r\n} from \"@reduxjs/toolkit\";\r\nimport { Middleware, MiddlewareAPI, Dispatch } from \"redux\";\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\n\r\nimport { AppDispatch, RootState } from \"..\";\r\nimport { LibrarySections } from \"senac-components/dist/pages/Mobile/PageLibrarySection\";\r\nimport {\r\n Content,\r\n ContentFilters,\r\n ContentOptionAppointments,\r\n ContentOptionDetail,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n PageLibraryHeaderOptionItem,\r\n PageLibraryOptionAppointments,\r\n PageLibraryOptionDownloads,\r\n PageLibraryOptionFavorites,\r\n PageLibraryOptionReadingList,\r\n PageOptionContactUs,\r\n PageOptionFAQ,\r\n PageOptionHome,\r\n PageOptionLibrary,\r\n PageOptionMyProfile,\r\n PageOptionProfile,\r\n PageOptionTermsOfUse,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { ModalButtonOption } from \"senac-components/dist/components/Modal\";\r\nimport { contentSlice, contentSummary, showContentDetail, showContentDetailWithMarks } from \"./contentSlice\";\r\nimport { editTagByUid, FavoritesInternalTag } from \"./userDataSlice\";\r\nimport { UserDataService } from \"../../services\";\r\nimport { TagData } from \"../../services/userData/IUserDataService\";\r\nimport {\r\n PageLibraryAppointments,\r\n PageLibraryDownload,\r\n PageLibraryFavorite,\r\n} from \"senac-components\";\r\n\r\ninterface UserModel {\r\n uid: string;\r\n name: string;\r\n login: string;\r\n}\r\n\r\ninterface Credential {\r\n login: string;\r\n password: string;\r\n}\r\n\r\ninterface CommonState {\r\n state: \"idle\" | \"initializing\" | \"initialized\";\r\n alert?: AlertData;\r\n runningInMobile: boolean;\r\n withInternet: boolean;\r\n route?: string;\r\n referrer?: string[];\r\n loader?: boolean;\r\n}\r\n\r\ninterface ModalButtonOptionContent extends ModalButtonOption {\r\n content?: any;\r\n}\r\n\r\nexport interface PlayerInfo {\r\n contentUid: string;\r\n contentReferenceUid: string;\r\n summary?: any;\r\n}\r\n\r\nexport interface AlertData {\r\n title: string;\r\n description: string;\r\n buttons?: ModalButtonOptionContent[];\r\n show: boolean;\r\n}\r\n\r\nconst initialState: CommonState = {\r\n state: \"idle\",\r\n runningInMobile: false,\r\n withInternet: true,\r\n referrer: ['#/inicio'],\r\n};\r\n\r\nexport const alertSelectButton = createAction<\r\n ModalButtonOptionContent | undefined\r\n>(\"alert/select\");\r\n\r\nexport const filterContent = createAction(\"filter/content\");\r\n\r\nexport const commonSlice = createSlice({\r\n name: \"common\",\r\n initialState,\r\n reducers: {\r\n resetState: () => initialState,\r\n\r\n runningInMobile: (state, data: PayloadAction) => {\r\n state.runningInMobile = data.payload;\r\n Sdk.Api.request.Request.onMobile = state.runningInMobile;\r\n },\r\n withInternet: (state, data: PayloadAction) => {\r\n // console.log(\"alterando status\", data.payload);\r\n state.withInternet = data.payload;\r\n },\r\n setLoader: (state, action) => {\r\n state.loader = action.payload\r\n },\r\n showAlert: (state, data: PayloadAction) => {\r\n state.alert = data.payload;\r\n },\r\n changeState: (\r\n state,\r\n data: PayloadAction<\"idle\" | \"initializing\" | \"initialized\">\r\n ) => {\r\n state.state = data.payload;\r\n },\r\n changeRoute: (state, data: PayloadAction) => {\r\n if (state.route == data.payload) return;\r\n state.route = data.payload;\r\n },\r\n setRefferer: (state, data: PayloadAction) => {\r\n let refs = state.referrer || [];\r\n if(data.payload === 'reset') refs = [];\r\n state.referrer = [...refs, window.location.hash];\r\n },\r\n recoverPassword: (state) => {\r\n state.route = \"/user/forgot\";\r\n },\r\n loginOptionsPage: (state) => {\r\n state.route = \"/user/options\";\r\n },\r\n loginPage: (state) => {\r\n state.route = \"/user/login\";\r\n },\r\n loginProjectsPage: (state) => {\r\n state.route = \"/user/projects\";\r\n },\r\n loginPasswordPage: (state) => {\r\n state.route = \"/user/password\";\r\n },\r\n registerPage: (state) => {\r\n state.route = \"/user/register\";\r\n },\r\n helpPage: (state) => {\r\n state.route = \"/help\";\r\n },\r\n changePage: (state) => {\r\n state.route = \"user/change\";\r\n },\r\n goToPage: (state, option: PayloadAction) => {\r\n console.log(option);\r\n switch (option.payload) {\r\n case MenuOptions.Home: {\r\n state.route = \"/inicio\";\r\n break;\r\n }\r\n case MenuOptions.Library: {\r\n state.route = \"/library/options\";\r\n break;\r\n }\r\n case MenuOptions.Profile: {\r\n state.route = \"/user/profile\";\r\n break;\r\n }\r\n }\r\n },\r\n goToPageOption: (state, option: PayloadAction) => {\r\n const optionSelected = option.payload;\r\n\r\n console.log(optionSelected);\r\n\r\n if (optionSelected == PageOptionHome) {\r\n state.route = \"/inicio\";\r\n } else if (optionSelected == PageOptionLibrary) {\r\n state.route = \"/library/options\";\r\n } else if (optionSelected == PageOptionProfile) {\r\n state.route = \"/user/profile\";\r\n } else if (optionSelected == PageOptionProfile) {\r\n state.route = \"/user/profile\";\r\n } else if (optionSelected == PageOptionProfile) {\r\n state.route = \"/user/profile\";\r\n } else if (optionSelected == PageOptionProfile) {\r\n state.route = \"/user/profile\";\r\n }\r\n },\r\n goToMyProfileOption: (\r\n state,\r\n option: PayloadAction\r\n ) => {\r\n const optionSelected = option.payload;\r\n\r\n if (optionSelected === PageOptionMyProfile) {\r\n state.route = \"/user/profile\";\r\n } else if (optionSelected === PageOptionTermsOfUse) {\r\n state.route = \"/terms\";\r\n } else if (optionSelected === PageOptionContactUs) {\r\n state.route = \"/contact\";\r\n } else if (optionSelected === PageOptionFAQ) {\r\n state.route = \"/faq\";\r\n }\r\n },\r\n goToLibraryPage: (state, option: PayloadAction) => {\r\n switch (option.payload) {\r\n case LibrarySections.Downloads: {\r\n state.route = \"/library/downloads\";\r\n break;\r\n }\r\n case LibrarySections.Favorites: {\r\n state.route = \"/library/favorites\";\r\n break;\r\n }\r\n case LibrarySections.Marks: {\r\n state.route = \"/library/appointments\";\r\n break;\r\n }\r\n case LibrarySections.ReadingList: {\r\n state.route = \"/library/readinglist\";\r\n break;\r\n }\r\n }\r\n },\r\n goToLibraryOption: (\r\n state,\r\n option: PayloadAction\r\n ) => {\r\n switch (option.payload) {\r\n case PageLibraryOptionDownloads: {\r\n state.route = \"/library/downloads\";\r\n break;\r\n }\r\n case PageLibraryOptionFavorites: {\r\n state.route = \"/library/favorites\";\r\n break;\r\n }\r\n case PageLibraryOptionAppointments: {\r\n state.route = \"/library/appointments\";\r\n break;\r\n }\r\n case PageLibraryOptionReadingList: {\r\n state.route = \"/library/readinglist\";\r\n break;\r\n }\r\n }\r\n },\r\n goToContent: (state, option: PayloadAction) => { \r\n if (!state.runningInMobile) {\r\n state.route = `/content/reference/uid/${option.payload.contentReferenceUid}/player`;\r\n return;\r\n }\r\n\r\n var _window: any = window;\r\n _window.CordovaExec(\r\n function (status: string) {\r\n // console.log(status);\r\n },\r\n \"ShelfPlugin\",\r\n \"OpenContentReference\",\r\n [option.payload.contentUid, option.payload.contentReferenceUid, option.payload.summary]\r\n );\r\n },\r\n backPage: () => {\r\n window.history.back();\r\n },\r\n },\r\n extraReducers: (builder) => {\r\n builder.addCase(alertSelectButton, (state, action) => {\r\n if (state.alert) state.alert.show = false;\r\n });\r\n\r\n // builder.addCase(userLogin.pending, (state, action) => {\r\n // state.loading = true;\r\n // });\r\n },\r\n});\r\n\r\nexport const middleware: Middleware =\r\n (store: MiddlewareAPI) =>\r\n (next: Dispatch) =>\r\n async (action: PayloadAction) => {\r\n const state = store.getState();\r\n\r\n if (\r\n commonSlice.actions.goToPage.match(action) &&\r\n state.userState.user == undefined &&\r\n (action.payload == MenuOptions.Profile ||\r\n action.payload == MenuOptions.Library)\r\n ) {\r\n store.dispatch(commonSlice.actions.loginOptionsPage());\r\n return;\r\n }\r\n\r\n if (alertSelectButton.match(action)) {\r\n var option = action.payload;\r\n if (option && option.callback) {\r\n option.callback();\r\n }\r\n }\r\n\r\n if (showContentDetail.match(action)) {\r\n var content = state.contentState.allContents.find(\r\n (p) => p.uid == action.payload\r\n );\r\n if (content)\r\n store.dispatch(contentSlice.actions.activeReference(content));\r\n // if (!state.commonState.runningInMobile && window.innerWidth > 1024) {\r\n // store.dispatch(contentSummary(content as Content));\r\n // }\r\n store.dispatch(contentSlice.actions.goToContentInfo(ContentOptionDetail));\r\n store.dispatch(\r\n commonSlice.actions.changeRoute(`/content/uid/${action.payload}`)\r\n );\r\n }\r\n\r\n if (contentSlice.actions.goToContentInfo.match(action)) {\r\n const contentUid = state.contentState.activeContentUid;\r\n\r\n if (contentUid) {\r\n store.dispatch(\r\n commonSlice.actions.changeRoute(`/content/uid/${contentUid}`)\r\n );\r\n // store.dispatch(contentSlice.actions.goToContentInfo(ContentOptionDetail));\r\n }\r\n }\r\n\r\n if (filterContent.match(action)) {\r\n var filter = action.payload;\r\n if(filter.category?.uid && filter.category?.uid !== \"undefined\") {\r\n store.dispatch(\r\n commonSlice.actions.changeRoute(\r\n `/search/category/uid/${filter.category?.uid}`\r\n )\r\n );\r\n } \r\n else {\r\n store.dispatch(\r\n commonSlice.actions.changeRoute(`/search/metadata?q=${filter.query ? filter.query : \"\"}`)\r\n );\r\n } \r\n }\r\n\r\n if (editTagByUid.match(action)) {\r\n store.dispatch(\r\n commonSlice.actions.changeRoute(\r\n `/library/readinglist/uid/${action.payload}`\r\n )\r\n );\r\n }\r\n\r\n if (commonSlice.actions.withInternet.match(action)) {\r\n var route = action.payload ? \"/inicio\" : \"/offline\";\r\n const unathorized = !state.userState.user && !Sdk.Api.authorization.authenticated;\r\n\r\n store.dispatch(commonSlice.actions.changeRoute(unathorized ? '/inicio' : route));\r\n\r\n if (!action.payload) {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n show: true,\r\n title: \"Você está off-line\",\r\n description:\r\n \"Conecte-se à internet para conhecer o acervo da Biblioteca Digital Senac.\",\r\n })\r\n );\r\n }\r\n }\r\n\r\n return next(action);\r\n };\r\n\r\nexport default commonSlice.reducer;\r\n","export function cpfValidator(cpf: string) {\r\n cpf = cpf.replace(/[^\\d]+/g, \"\"); // Remove caracteres não numéricos\r\n\r\n if (\r\n cpf.length !== 11 ||\r\n cpf === \"00000000000\" ||\r\n cpf === \"11111111111\" ||\r\n cpf === \"22222222222\" ||\r\n cpf === \"33333333333\" ||\r\n cpf === \"44444444444\" ||\r\n cpf === \"55555555555\" ||\r\n cpf === \"66666666666\" ||\r\n cpf === \"77777777777\" ||\r\n cpf === \"88888888888\" ||\r\n cpf === \"99999999999\"\r\n ) {\r\n return false;\r\n }\r\n\r\n var soma = 0;\r\n var resto;\r\n\r\n for (var i = 1; i <= 9; i++) {\r\n soma += parseInt(cpf.substring(i - 1, i)) * (11 - i);\r\n }\r\n\r\n resto = (soma * 10) % 11;\r\n\r\n if (resto === 10 || resto === 11) {\r\n resto = 0;\r\n }\r\n\r\n if (resto !== parseInt(cpf.substring(9, 10))) {\r\n return false;\r\n }\r\n\r\n soma = 0;\r\n\r\n for (var i = 1; i <= 10; i++) {\r\n soma += parseInt(cpf.substring(i - 1, i)) * (12 - i);\r\n }\r\n\r\n resto = (soma * 10) % 11;\r\n\r\n if (resto === 10 || resto === 11) {\r\n resto = 0;\r\n }\r\n\r\n if (resto !== parseInt(cpf.substring(10, 11))) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\nexport function checkSimpleCpf(value: string) {\r\n const splited = value.split(\".\");\r\n\r\n const matchLenght = splited.length === 3;\r\n if (!matchLenght) return false;\r\n\r\n const [a, b, c] = splited;\r\n\r\n const match = a.length === 3 && b.length === 3 && c.length === 6;\r\n\r\n return match;\r\n}\r\n\r\nexport function sanitizeCpf(value: string) {\r\n return value.replaceAll(\"-\", \"\").replaceAll(\".\", \"\");\r\n}\r\n","export const ERRORS = {\r\n USER_UPDATING_ERROR_BECAUSE_CPF_ALREADY_REGISTERED:\r\n \"Identificamos que o CPF informado já está em uso. Para vincular este perfil ao seu CPF, por favor, autentique-se utilizando o seu CPF.\",\r\n GENERIC_ERROR:\r\n \"Não foi possível realizar a solicitação. Tente novamente mais tarde.\",\r\n};\r\n","import { createSlice, PayloadAction, createAsyncThunk, createAction } from \"@reduxjs/toolkit\";\r\nimport { stat } from \"fs\";\r\nimport { Middleware, MiddlewareAPI, Dispatch } from \"redux\";\r\nimport { MenuOptions, ProjectItem } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { AppDispatch, RootState } from \"..\";\r\nimport { UserService } from '../../services';\r\nimport { AuthSSOParams, ParamsSSO, User, UserRegisterData } from \"../../services/user/IUserService\";\r\nimport { commonSlice } from \"./common\";\r\nimport { Profile } from 'senac-components/dist/pages/Mobile/PageMyProfile';\r\nimport { ContactUsForm } from \"senac-components/dist/pages/Mobile/PageContactUs\";\r\nimport { userDataSlice } from \"./userDataSlice\";\r\nimport { string } from \"yargs\";\r\nimport { checkSimpleCpf, cpfValidator, sanitizeCpf } from \"../../utilities/Cpf\";\r\nimport { ERRORS } from \"../../utilities/constants/errors\";\r\nimport { contentSlice } from \"./contentSlice\";\r\n\r\ninterface UserState\r\n{\r\n projectsLoading:boolean;\r\n projectsAvailable?:ProjectItem[];\r\n activeProject?:ProjectItem;\r\n authorizationTokenRecovery?: string;\r\n recoveryStatus?: number;\r\n user?:User;\r\n userCopy?: User;\r\n userAuthenticating:boolean;\r\n userAuthenticationErro?:string;\r\n loadingSso?: boolean;\r\n userRegistering:boolean;\r\n openModalMigration: boolean;\r\n step?: number;\r\n login?:string;\r\n organizations?: { login: string, uid: string; name: string; migrated: boolean}[];\r\n changingPassword: boolean;\r\n updatingProfile: boolean;\r\n\r\n contact?: ContactUsForm;\r\n contactLoading:boolean;\r\n contactForm?: string;\r\n\r\n clearContactForm?: boolean;\r\n ssoParams?: Record\r\n codeReadingList?: string;\r\n preferences?: any[];\r\n projects?: any[];\r\n updatingUserError?: string;\r\n signinSsoError?: { code: string, message: string };\r\n ssoData?: ParamsSSO;\r\n lastCpfSetted?: string;\r\n lastLoginSetted?: string;\r\n}\r\n\r\nconst initialState: UserState =\r\n{\r\n projectsLoading: false,\r\n userAuthenticating: false,\r\n contactLoading: false,\r\n userRegistering: false,\r\n changingPassword: false,\r\n updatingProfile: false,\r\n openModalMigration: false,\r\n};\r\n\r\ninterface LoginProps\r\n{\r\n login:string,\r\n password:string\r\n}\r\n\r\nconst projectsAvailable = createAsyncThunk(\"users/projectsavailable\", (login:string) => UserService.ProjectsAvailable(login));\r\n\r\nconst userLogout = createAsyncThunk(\"users/logout\", () => UserService.Logout());\r\n\r\nconst authenticateUser = createAsyncThunk(\"users/authenticate\", (props:LoginProps & { ignoreActive?: boolean }) => UserService.SigninDefault(props.login, props.password, props.ignoreActive));\r\n\r\nconst restoreUser = createAsyncThunk(\"users/restore\", () => UserService.ActiveUser());\r\n\r\nconst errorNoOrganizations = createAction('/user/organizations/empty');\r\n\r\nconst recoverPassword = createAsyncThunk(\"users/forgot/password\", (login:string) => UserService.RecoverPassword(login));\r\n\r\nconst contact = createAsyncThunk(\"users/contact\", (contact:ContactUsForm) => UserService.SentContactUs(contact));\r\n\r\nconst signinAfterAuth = createAsyncThunk(\"users/signin/after/auth\", (params: any) => UserService.SigninSsoAfterAuthentication(params));\r\n\r\nconst remoteRegisterUser = createAsyncThunk(\"users/forgot/password\", (data:UserRegisterData) => UserService.RegisterUser(data));\r\n\r\nconst organizationsFromLogin = createAsyncThunk(\"users/organizations/from/login\", (login: string) => UserService.ProjectsFromLogin(login))\r\n\r\nconst activeUserFromSso = createAction>(\"user/active/from/sso\");\r\n\r\nconst showAlertSSO = createAction(\"user/alert/sso\");\r\n\r\nexport const authenticateFromProfileContext = createAction(\"user/signin/from/profile-context/\")\r\n\r\nexport const updatingUser = createAction('user/updating/profile')\r\n\r\nexport const checkPendingCpfOrEmail = createAction('user/checking/required/values')\r\n\r\nexport const checkUniqueLogin = createAction('user/checking/login')\r\n\r\nexport const sendCPFEmail = createAction('/user/update/required/values');\r\n\r\nexport const sendNewLogin = createAction('/user/update/login');\r\n\r\nexport const signinFromProfile = createAction('/user/signin/profile');\r\n\r\nexport const authenticateSso = createAction(\"user/sso/auth\");\r\n\r\nexport const forgotPasswordFromLibrary = createAction<{ login: string, organization: string }>(\"user/forgot/password/from/library\");\r\n\r\nexport const onCloseMigrationModal = createAction('/user/migration/modal/close');\r\n\r\nexport const updatedProfile = createAsyncThunk('user/updated/profile', (data: Profile) => UserService.UpdatedProfile(data))\r\n\r\nexport const changePassword = createAsyncThunk(\"users/change/password\", (passwordData: Record) => UserService.ChangePassword(passwordData.password, passwordData.currentPassword));\r\n\r\nexport const createPassowrd = createAsyncThunk(\"user/create/password\", (passwordData: Record) => UserService.CreatePassword(passwordData.token, passwordData.password));\r\n\r\nexport const signinAnonymous = createAsyncThunk(\"user/anonymous/signin\", (projectUid: string) => UserService.AnonymousSignIn(projectUid))\r\n\r\nexport const signinSso = createAsyncThunk(\"user/sso/signin/from/external-context\", (params: ParamsSSO) => UserService.AuthenticateSSO(params))\r\n\r\nexport const signinSSOFromProvision = createAsyncThunk(\"user/sso/signin/from/provision\", (params: AuthSSOParams) => UserService.AuthenticateSSOFromProvision(params))\r\n\r\nexport const signinMigration = createAsyncThunk(\"user/authenticate/migration\", (props:LoginProps) => UserService.SigninMigrationFlow(props.login, props.password))\r\n\r\nexport const sendOrganization = createAsyncThunk(\"user/migration/organization\", (params: {login: string, password: string, organizationUid: string }) => UserService.SendOrganization(params.login, params.password, params.organizationUid))\r\n\r\nexport const onCreatePreference = createAsyncThunk(\"user/preference/new\", (preference: Record) => UserService.CretePreference(preference))\r\n\r\nexport const onForgotPasswordLibrary = createAsyncThunk(\"user/forgot/password/library\", (params: { login: string, organization: string}) => UserService.SendForgotPasswordLibrary(params))\r\n\r\nexport const userSlice = createSlice({\r\n name: \"userSlice\",\r\n initialState,\r\n reducers: {\r\n resetState: () => initialState,\r\n\r\n setLastLogin: (state, action) => {\r\n state.lastLoginSetted = action.payload\r\n },\r\n setLastCpf: (state, action) => {\r\n state.lastCpfSetted = action.payload\r\n },\r\n setTokenRecoveryPassword: (state, action) => {\r\n state.authorizationTokenRecovery = action.payload\r\n },\r\n\r\n setSsoLoading: (state, action) => {\r\n state.loadingSso = action.payload\r\n },\r\n\r\n setSsoData: (state, action) => {\r\n state.ssoData = action.payload\r\n },\r\n\r\n setUserWithDetails: (state, action) => {\r\n const result = action.payload;\r\n\r\n if (!result || !result.user) return;\r\n\r\n state.user = result.user;\r\n\r\n if (result.preferences) {\r\n state.preferences = result.preferences\r\n }\r\n if (result.projects) {\r\n state.projects = result.projects\r\n }\r\n },\r\n\r\n setPreferences: (state, action) => {\r\n state.preferences = action.payload;\r\n },\r\n\r\n setProjects: (state, action) => {\r\n state.projects = action.payload;\r\n },\r\n\r\n showAlertRecoveryPassword: (state, action: PayloadAction) => {\r\n state.recoveryStatus = action.payload;\r\n },\r\n clearForm: (state, data) => {\r\n state.clearContactForm = data.payload\r\n },\r\n\r\n checkAvailableProjects: (state, login:PayloadAction) =>\r\n {\r\n const isCpf = checkSimpleCpf(login.payload);\r\n state.login = isCpf ? login.payload.replaceAll('.', '').replace('-', '') : login.payload;\r\n state.projectsAvailable = undefined;\r\n state.lastCpfSetted = undefined;\r\n },\r\n selectProject: (state, project:PayloadAction) =>\r\n {\r\n state.activeProject = project.payload;\r\n },\r\n signin: (state, password:PayloadAction) =>\r\n {\r\n state.user = undefined;\r\n },\r\n signinAfterPayload: (state, data) => {\r\n state.loadingSso = true;\r\n },\r\n syncOrganization: (state) => {\r\n state.openModalMigration = !state.openModalMigration;\r\n state.step = -1;\r\n },\r\n showMyProjects: (state) => {\r\n state.openModalMigration = true;\r\n state.step = 4;\r\n state.organizations = (state.projects ?? []).map(item => ({\r\n uid: item.uid,\r\n name: item.name,\r\n migrated: true,\r\n login: ''\r\n }))\r\n },\r\n closeModal: (state) => {\r\n state.openModalMigration = false;\r\n },\r\n toggleModalMigration: (state) => {\r\n state.openModalMigration = !state.openModalMigration\r\n state.step = 0;\r\n },\r\n setMigrated: (state, data) => {\r\n const newOrganizations = (state.organizations ?? []).map(item => {\r\n if (item.uid === data.payload.organizationUid && item.login === data.payload.login) return {\r\n ...item,\r\n migrated: true,\r\n }\r\n return item;\r\n });\r\n\r\n state.organizations = newOrganizations\r\n },\r\n\r\n sendUserOrganization: (state, data:PayloadAction) => {\r\n state.login = data.payload.login;\r\n },\r\n\r\n changeStep: (state, data) => {\r\n state.step = data.payload;\r\n },\r\n\r\n setOrganizations: (state, data) => {\r\n const organizations = data.payload ?? [];\r\n state.organizations = organizations;\r\n\r\n if (organizations.length) {\r\n state.openModalMigration = true;\r\n }\r\n else {\r\n state.openModalMigration = false;\r\n }\r\n },\r\n\r\n activeUser: (state, data:PayloadAction) =>\r\n {\r\n state.user = data.payload;\r\n state.ssoParams = undefined;\r\n },\r\n activeUserCopy: (state, data:PayloadAction) =>\r\n {\r\n state.userCopy = data.payload;\r\n state.ssoParams = undefined;\r\n },\r\n logout: (state) =>\r\n {\r\n state.user = undefined;\r\n },\r\n registerUser: (state, data:PayloadAction) =>\r\n {\r\n state.user = undefined;\r\n state.login = data.payload.login;\r\n },\r\n recoverPassword: (state, data:PayloadAction) =>\r\n {\r\n state.login = data.payload;\r\n },\r\n contactUs: (state, data:PayloadAction) =>\r\n {\r\n state.contact = undefined;\r\n },\r\n createPasswordFromRecovery: (state, data) => {\r\n state.changingPassword = true\r\n },\r\n checkSigninSSO: (state, data) => {\r\n state.ssoParams = data.payload\r\n },\r\n setImportReadingList: (state, data) => {\r\n state.codeReadingList = data.payload\r\n }\r\n },\r\n extraReducers: (builder) => {\r\n builder.addCase(onForgotPasswordLibrary.pending, (state) => {\r\n state.updatingProfile = true;\r\n state.userAuthenticating = true;\r\n })\r\n builder.addCase(onForgotPasswordLibrary.rejected, (state) => {\r\n state.updatingProfile = false;\r\n state.userAuthenticating = false;\r\n })\r\n builder.addCase(onForgotPasswordLibrary.fulfilled, (state) => {\r\n state.updatingProfile = false;\r\n state.userAuthenticating = false;\r\n })\r\n builder.addCase(signinSSOFromProvision.pending, (state) => {\r\n state.loadingSso = true\r\n })\r\n builder.addCase(signinSSOFromProvision.rejected, (state) => {\r\n state.loadingSso = false\r\n })\r\n builder.addCase(signinSSOFromProvision.fulfilled, (state) => {\r\n state.loadingSso = false\r\n })\r\n builder.addCase(contact.pending, (state) => {\r\n state.contactLoading = true;\r\n });\r\n\r\n builder.addCase(contact.fulfilled, (state, action) => {\r\n state.contactLoading = false;\r\n state.contact = action.payload;\r\n });\r\n\r\n builder.addCase(projectsAvailable.pending, (state, action) =>\r\n {\r\n state.projectsLoading = true;\r\n });\r\n\r\n builder.addCase(projectsAvailable.fulfilled, (state, action) =>\r\n {\r\n state.projectsLoading = false;\r\n state.projectsAvailable = action.payload;\r\n\r\n if (state.projectsAvailable?.length == 1)\r\n {\r\n state.activeProject = state.projectsAvailable[0];\r\n }\r\n\r\n });\r\n\r\n builder.addCase(signinMigration.pending, (state, action) =>\r\n {\r\n state.userAuthenticating = true;\r\n });\r\n\r\n builder.addCase(signinMigration.fulfilled, (state, action) =>\r\n {\r\n state.userAuthenticating = false;\r\n });\r\n\r\n builder.addCase(signinMigration.rejected, (state, action) =>\r\n {\r\n state.userAuthenticating = false;\r\n\r\n if (action.error.code == \"401\")\r\n {\r\n state.userAuthenticationErro = \"Login ou senha inválido.\"\r\n }\r\n else{\r\n state.userAuthenticationErro = \"Falha ao autenticar usuário.\"\r\n }\r\n });\r\n\r\n builder.addCase(sendOrganization.pending, (state, action) =>\r\n {\r\n state.userAuthenticating = true;\r\n });\r\n\r\n builder.addCase(sendOrganization.fulfilled, (state, action) =>\r\n {\r\n state.userAuthenticating = false;\r\n });\r\n\r\n builder.addCase(sendOrganization.rejected, (state, action) =>\r\n {\r\n state.userAuthenticating = false;\r\n });\r\n\r\n builder.addCase(restoreUser.fulfilled, (state, action) =>\r\n {\r\n state.userAuthenticating = false;\r\n });\r\n\r\n builder.addCase(remoteRegisterUser.pending, (state, action) =>\r\n {\r\n state.userRegistering = true;\r\n });\r\n\r\n builder.addCase(remoteRegisterUser.fulfilled, (state, action) =>\r\n {\r\n state.userRegistering = false;\r\n })\r\n\r\n builder.addCase(remoteRegisterUser.rejected, (state, action) =>\r\n {\r\n state.userRegistering = false;\r\n })\r\n builder.addCase(signinAfterAuth.pending, (state, action) =>\r\n {\r\n state.userRegistering = true;\r\n state.userAuthenticating = true;\r\n });\r\n\r\n builder.addCase(signinAfterAuth.fulfilled, (state, action) =>\r\n {\r\n state.userRegistering = false;\r\n state.userAuthenticating = false;\r\n })\r\n\r\n builder.addCase(signinAfterAuth.rejected, (state, action) =>\r\n {\r\n state.userRegistering = false;\r\n state.userAuthenticating = false;\r\n })\r\n\r\n builder.addCase(changePassword.pending, (state, action) => {\r\n state.changingPassword = true\r\n })\r\n\r\n builder.addCase(changePassword.fulfilled, (state, action) => {\r\n state.changingPassword = false\r\n })\r\n\r\n builder.addCase(updatedProfile.pending, (state, action) => {\r\n state.updatingProfile = true\r\n state.userAuthenticating = true\r\n })\r\n\r\n builder.addCase(updatedProfile.fulfilled, (state, action) => {\r\n state.updatingProfile = false\r\n state.userAuthenticating = false\r\n })\r\n builder.addCase(updatedProfile.rejected, (state, action) => {\r\n state.updatingProfile = false\r\n state.userAuthenticating = false\r\n\r\n if (action.error.message) {\r\n state.updatingUserError = action.error.message;\r\n }\r\n })\r\n builder.addCase(authenticateUser.pending, (state, action) => {\r\n state.updatingProfile = true\r\n state.userAuthenticating = true\r\n })\r\n\r\n builder.addCase(authenticateUser.fulfilled, (state, action) => {\r\n state.updatingProfile = false\r\n state.userAuthenticating = false\r\n })\r\n\r\n builder.addCase(authenticateUser.rejected, (state, action) => {\r\n state.updatingProfile = false\r\n state.userAuthenticating = false\r\n })\r\n\r\n builder.addCase(signinSso.pending, (state, action) => {\r\n state.loadingSso = true;\r\n })\r\n\r\n builder.addCase(signinSso.rejected, (state, action) => {\r\n state.loadingSso = false;\r\n\r\n if (action.error.message) {\r\n if (action.error.message === '400') {\r\n state.signinSsoError = { code: '400', message: \"Ocorreu um erro interno, por favor tente novamente.\" }\r\n state.ssoData = undefined;\r\n }\r\n if (action.error.message === '403') {\r\n state.signinSsoError = { code: '403', message: \"Estamos atualizando a plataforma e para oferecer uma melhor experiência. Por favor, insira suas credenciais de acesso ou realize o cadastro para uma nova conta.\" }\r\n }\r\n if (action.error.message === '401') {\r\n state.signinSsoError = { code: '401', message: 'Falha ao autenticar.'}\r\n state.ssoData = undefined;\r\n }\r\n }\r\n })\r\n builder.addCase(signinSso.fulfilled, (state, action) => {\r\n state.loadingSso = false;\r\n })\r\n },\r\n});\r\n\r\nconst checkContactUsForm = (form: ContactUsForm) => {\r\n const requiredFields = ['name', 'email', 'message', 'assunto'];\r\n const shouldSendForm = requiredFields.every(field => {\r\n const propertyForm = form[field as keyof typeof form];\r\n return propertyForm && propertyForm.length > 0;\r\n })\r\n\r\n if(!shouldSendForm) return false;\r\n\r\n return true;\r\n};\r\n\r\nexport const middleware: Middleware = (store: MiddlewareAPI) =>\r\n (next: Dispatch) =>\r\n async (action: PayloadAction) =>\r\n {\r\n if (commonSlice.actions.changeState.match(action) && action.payload == \"initializing\")\r\n {\r\n store.dispatch(restoreUser())\r\n .unwrap()\r\n .then(user=> {\r\n store.dispatch(userSlice.actions.activeUser(user));\r\n // store.dispatch(commonSlice.actions.goToPage(MenuOptions.Home))\r\n });\r\n }\r\n else if (authenticateFromProfileContext.match(action)) {\r\n const state = store.getState();\r\n const login = state.userState.lastCpfSetted;\r\n const lastLogin = state.userState.lastLoginSetted;\r\n\r\n if (!login) return;\r\n\r\n store.dispatch(authenticateUser({ login: sanitizeCpf(login), password: action.payload, ignoreActive: true }))\r\n .unwrap()\r\n .then(result => {\r\n store.dispatch(signinFromProfile({ password: \"\", login: lastLogin ?? \"\" }))\r\n store.dispatch(userSlice.actions.setUserWithDetails(result))\r\n store.dispatch(userSlice.actions.changeStep(0));\r\n store.dispatch(restoreUser())\r\n })\r\n .catch(err => {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Meus dados\",\r\n description : ERRORS.GENERIC_ERROR,\r\n show:true\r\n }));\r\n })\r\n }\r\n else if (userSlice.actions.setSsoData.match(action)) {\r\n store.dispatch(userSlice.actions.setSsoLoading(Boolean(action.payload)))\r\n }\r\n else if (forgotPasswordFromLibrary.match(action)) {\r\n const state = store.getState();\r\n let fn: any = () => {\r\n return onForgotPasswordLibrary(action.payload);\r\n }\r\n if (state.userState.lastCpfSetted && state.userState.step !== 1) {\r\n fn = () => {\r\n return recoverPassword(sanitizeCpf(state.userState.lastCpfSetted ?? ''));\r\n }\r\n };\r\n\r\n store.dispatch(fn()).unwrap()\r\n .then((result: any) => {\r\n if (result) {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Recuperação de senha\",\r\n description : `Siga as instruções da mensagem enviada para o e-mail ${result?.email ?? 'cadastrado'}`,\r\n show:true\r\n }));\r\n }\r\n else {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Recuperação de senha\",\r\n description : 'Falha ao solicitar alteração de senha, tente novamente mais tarde',\r\n show:true\r\n }));\r\n }\r\n store.dispatch(userSlice.actions.changeStep(0));\r\n store.dispatch(userSlice.actions.closeModal());\r\n })\r\n .catch(() => {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Recuperação de senha\",\r\n description : 'Falha ao solicitar alteração de senha, tente novamente mais tarde',\r\n show:true\r\n }));\r\n store.dispatch(userSlice.actions.changeStep(0));\r\n store.dispatch(userSlice.actions.closeModal());\r\n })\r\n\r\n }\r\n else if (activeUserFromSso.match(action)) {\r\n const result = action.payload;\r\n\r\n store.dispatch(commonSlice.actions.changeState('initialized'));\r\n store.dispatch(userSlice.actions.setUserWithDetails(result));\r\n store.dispatch(userSlice.actions.setSsoData(undefined));\r\n store.dispatch(commonSlice.actions.goToPage(MenuOptions.Home))\r\n }\r\n else if (userSlice.actions.signinAfterPayload.match(action)) {\r\n store.dispatch(signinAfterAuth(action.payload)).unwrap().then(res => {\r\n store.dispatch(activeUserFromSso(res));\r\n store.dispatch(userSlice.actions.setSsoData(undefined));\r\n })\r\n .catch(err => {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title: 'Registro',\r\n description: 'Ocorreu um erro ao tentar fazer login.',\r\n show: true,\r\n }))\r\n })\r\n\r\n }\r\n\r\n else if (authenticateSso.match(action)) {\r\n const state = store.getState();\r\n store.dispatch(userSlice.actions.setSsoData(action.payload));\r\n store.dispatch(signinSso(action.payload)).unwrap()\r\n .then((result) => {\r\n store.dispatch(commonSlice.actions.changeState('initialized'));\r\n store.dispatch(userSlice.actions.activeUser(result.user));\r\n store.dispatch(userSlice.actions.setSsoData(undefined));\r\n if (result.preferences) {\r\n store.dispatch(userSlice.actions.setPreferences(result.preferences))\r\n }\r\n if (result.projects) {\r\n store.dispatch(userSlice.actions.setProjects(result.projects))\r\n }\r\n\r\n if (action.payload.path) {\r\n const hashPath = `#${action.payload.path.startsWith(\"/\") ? action.payload.path : \"/\" + action.payload.path}`;\r\n window.location.hash = hashPath;\r\n } else {\r\n store.dispatch(commonSlice.actions.goToPage(MenuOptions.Home));\r\n }\r\n })\r\n .catch(err => {\r\n const { code, message } = state.userState.signinSsoError ?? {};\r\n\r\n if (code === '401' || code === '403') {\r\n store.dispatch(commonSlice.actions.loginOptionsPage())\r\n };\r\n\r\n store.dispatch(showAlertSSO());\r\n\r\n })\r\n\r\n }\r\n\r\n else if(showAlertSSO.match(action)) {\r\n const state = store.getState();\r\n const { code, message } = state.userState.signinSsoError ?? {};\r\n store.dispatch(commonSlice.actions.showAlert({\r\n description: message ?? \"Ocorreu um erro de autenticação. Tente novamente mais tarde.\",\r\n show: true,\r\n title: 'Autenticação',\r\n }));\r\n }\r\n else if (errorNoOrganizations.match(action)) {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n description: \"Não encontramos nenhuma organização vinculada ao usuário.\",\r\n show: true,\r\n title: 'Nenhuma organização',\r\n }))\r\n\r\n store.dispatch(userSlice.actions.closeModal())\r\n }\r\n else if (userSlice.actions.setOrganizations.match(action)) {\r\n const organizations = action.payload;\r\n\r\n if (!organizations || !organizations.length) {\r\n store.dispatch(errorNoOrganizations())\r\n }\r\n }\r\n else if (onCloseMigrationModal.match(action)) {\r\n store.dispatch(userSlice.actions.toggleModalMigration())\r\n\r\n if (!window.location.hash.includes('profile')) { // TODO: Melhorar verificação\r\n store.dispatch(commonSlice.actions.goToPage(MenuOptions.Home));\r\n }\r\n }\r\n else if (checkUniqueLogin.match(action)) {\r\n const state = store.getState();\r\n const user = state.userState.user;\r\n\r\n if (user) {\r\n store.dispatch(\r\n userSlice.actions.closeModal()\r\n )\r\n\r\n if (!user.cpf || !user.email || user.login !== user.cpf) {\r\n store.dispatch(\r\n commonSlice.actions.goToPage(MenuOptions.Profile)\r\n )\r\n\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title : \"Atualização de dados\",\r\n description : \"Estamos atualizando a plataforma para oferecer uma melhor experiência. A partir de agora, o login será substituído pelo CPF. Por favor, verifique e, se necessário, atualize as informações: CPF e e-mail.\",\r\n show:true\r\n })\r\n )\r\n\r\n return;\r\n };\r\n\r\n if (!window.location.hash.includes('profile')) {\r\n commonSlice.actions.goToPage(MenuOptions.Home)\r\n window.location.hash = '#/inicio'\r\n }\r\n }\r\n }\r\n\r\n else if (checkPendingCpfOrEmail.match(action)) {\r\n const state = store.getState();\r\n const user = state.userState.userCopy;\r\n\r\n if (user){\r\n if (user.cpf || user.email) {\r\n store.dispatch(userSlice.actions.toggleModalMigration());\r\n store.dispatch(userSlice.actions.activeUser(user));\r\n return;\r\n }\r\n store.dispatch(userSlice.actions.changeStep(3));\r\n }\r\n }\r\n else if (userSlice.actions.sendUserOrganization.match(action)) {\r\n const errorLink = () => {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title : \"Login\",\r\n description : \"Falha ao autenticar usuário.\",\r\n show:true\r\n })\r\n )\r\n }\r\n store.dispatch(sendOrganization(action.payload)).unwrap().then((result: any) => {\r\n const state = store.getState();\r\n if (result) {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n description: \"Organização vinculada com sucesso!\",\r\n show: true,\r\n title: \"Organização\"\r\n }))\r\n store.dispatch(userSlice.actions.setMigrated(action.payload))\r\n store.dispatch(userSlice.actions.activeUserCopy(result.user));\r\n store.dispatch(userSlice.actions.activeUser(result.user));\r\n\r\n if (result.preferences) {\r\n store.dispatch(userSlice.actions.setPreferences(result.preferences))\r\n }\r\n if (result.projects) {\r\n store.dispatch(userSlice.actions.setProjects(result.projects))\r\n }\r\n store.dispatch(userSlice.actions.changeStep(0));\r\n\r\n if (state.userState.organizations?.length === 1) {\r\n store.dispatch(userSlice.actions.closeModal())\r\n store.dispatch(userSlice.actions.setLastCpf(undefined))\r\n store.dispatch(userSlice.actions.setLastLogin(undefined))\r\n store.dispatch(restoreUser())\r\n }\r\n\r\n return;\r\n }\r\n\r\n errorLink();\r\n })\r\n .catch(err => {\r\n console.log(err);\r\n errorLink();\r\n })\r\n }\r\n\r\n else if (userSlice.actions.checkSigninSSO.match(action)) {\r\n const params = action.payload;\r\n\r\n if(!params) return;\r\n\r\n const requiredParams = ['state', 'connector'];\r\n const nextSSO = requiredParams.every(param => Boolean(params[param]));\r\n\r\n if(!nextSSO) return;\r\n\r\n store.dispatch(signinSSOFromProvision(action.payload)).unwrap().then((result) => {\r\n store.dispatch(userSlice.actions.activeUser(result))\r\n })\r\n }\r\n else if (userSlice.actions.showAlertRecoveryPassword.match(action)) {\r\n const recoveryMessages: Record = {\r\n 400: \"O link para cadastrar uma nova senha expirou. Tente executar a solicitação novamente.\",\r\n 200: \"Nova senha cadastrada com sucesso. Você será redirecionado para a tela de login.\",\r\n 500: \"Ocorreu um erro interno\",\r\n 404: \"Ocorreu um erro, tente novamente mais tarde\"\r\n };\r\n\r\n const description = recoveryMessages[action.payload ?? 500];\r\n const baseAlert = { title: \"Recuperação de senha\", show: true };\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n ...baseAlert,\r\n description,\r\n })\r\n );\r\n setTimeout(() => {\r\n if(action.payload === 200) {\r\n window.location.hash = '/user/login'\r\n }\r\n }, 2000)\r\n }\r\n else if (userSlice.actions.createPasswordFromRecovery.match(action)) {\r\n const state = store.getState();\r\n store\r\n .dispatch(\r\n createPassowrd({\r\n token: state.userState.authorizationTokenRecovery ?? \"\",\r\n password: action.payload?.newPassword,\r\n })\r\n )\r\n .unwrap()\r\n .then((result) => {\r\n store.dispatch(userSlice.actions.showAlertRecoveryPassword(result))\r\n })\r\n .catch(err => {\r\n store.dispatch(userSlice.actions.showAlertRecoveryPassword(err))\r\n })\r\n }\r\n\r\n else if (userSlice.actions.contactUs.match(action))\r\n {\r\n store.dispatch(userSlice.actions.clearForm(false))\r\n\r\n const correctForm = checkContactUsForm(action.payload);\r\n\r\n if(!correctForm) {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Fale Conosco\",\r\n description : \"Preencha todos os campos obrigatórios para submeter o contato.\",\r\n show:true\r\n }))\r\n return;\r\n };\r\n\r\n store.dispatch(contact(action.payload)).unwrap()\r\n .then(result=>\r\n {\r\n if (result)\r\n {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Fale Conosco\",\r\n description : \"Contato enviado\",\r\n show:true\r\n }))\r\n\r\n store.dispatch(userSlice.actions.clearForm(true))\r\n }\r\n else\r\n {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Fale Conosco\",\r\n description : \"Ocorreu ao tentar enviar os dados. Tente novamente mais tarde\",\r\n show:true\r\n }))\r\n }\r\n\r\n return result;\r\n })\r\n .catch(() => {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Fale Conosco\",\r\n description : \"Ocorreu ao tentar enviar os dados. Tente novamente mais tarde\",\r\n show:true\r\n }))\r\n })\r\n }\r\n else if (userSlice.actions.checkAvailableProjects.match(action))\r\n {\r\n store.dispatch(commonSlice.actions.loginPasswordPage());\r\n }\r\n else if (userSlice.actions.selectProject.match(action))\r\n {\r\n store.dispatch(commonSlice.actions.loginPasswordPage());\r\n }\r\n\r\n else if (userSlice.actions.signin.match(action))\r\n {\r\n var state = store.getState();\r\n var login = state.userState.login;\r\n var password = action.payload;\r\n\r\n if (login && password)\r\n {\r\n const errorLogin = () => {\r\n state = store.getState()\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title : \"Login\",\r\n description : state.userState.userAuthenticationErro ?? \"Erro\",\r\n show:true\r\n })\r\n )\r\n }\r\n if (state.userState.ssoData) {\r\n store.dispatch(userSlice.actions.signinAfterPayload({\r\n ...state.userState.ssoData,\r\n login,\r\n password,\r\n initialLogin: state.userState.ssoData.login,\r\n }))\r\n store.dispatch(userSlice.actions.setSsoData(undefined));\r\n return;\r\n }\r\n\r\n var props:LoginProps = { login, password };\r\n store.dispatch(signinMigration(props))\r\n .unwrap()\r\n .then((res) => {\r\n if (!res?.user) {\r\n errorLogin();\r\n return;\r\n }\r\n\r\n if (res.preferences) {\r\n store.dispatch(userSlice.actions.setPreferences(res.preferences));\r\n }\r\n\r\n if (res.projects) {\r\n store.dispatch(userSlice.actions.setProjects(res.projects));\r\n }\r\n\r\n store.dispatch(userSlice.actions.activeUser(res.user));\r\n\r\n if (res.organization && res.firstLogin) {\r\n store.dispatch(userSlice.actions.setOrganizations(res.organizations))\r\n return;\r\n };\r\n\r\n store.dispatch(checkUniqueLogin());\r\n })\r\n .catch((err) => {\r\n console.log(err)\r\n errorLogin();\r\n });\r\n }\r\n }\r\n else if (signinFromProfile.match(action)) {\r\n const { login } = action.payload\r\n\r\n store.dispatch(organizationsFromLogin(login)).unwrap()\r\n .then(res => {\r\n if (res.organizations) {\r\n store.dispatch(userSlice.actions.setOrganizations(res.organizations))\r\n store.dispatch(userSlice.actions.changeStep(0));\r\n }\r\n })\r\n .catch(err => {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title : \"Login\",\r\n description : \"Erro ao tentar obter as organizações vinculadas.\",\r\n show:true\r\n })\r\n )\r\n })\r\n }\r\n else if (userSlice.actions.logout.match(action))\r\n {\r\n store.dispatch(commonSlice.actions.resetState())\r\n store.dispatch(userSlice.actions.resetState())\r\n store.dispatch(userDataSlice.actions.resetState())\r\n store.dispatch(contentSlice.actions.resetState())\r\n store.dispatch(userLogout());\r\n store.dispatch(commonSlice.actions.loginOptionsPage());\r\n }\r\n else if (userSlice.actions.activeUser.match(action))\r\n {\r\n var state = store.getState();\r\n if (action.payload && state.userState.user?.uid !== action.payload.uid)\r\n {\r\n // store.dispatch(commonSlice.actions.goToPage(MenuOptions.Home));\r\n }\r\n }\r\n else if (userSlice.actions.recoverPassword.match(action))\r\n {\r\n store.dispatch(recoverPassword(action.payload)).unwrap().then((result: any) =>\r\n {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Recuperação de senha\",\r\n description : `Siga as instruções da mensagem enviada para o e-mail ${result?.email ?? 'cadastrado'}`,\r\n show:true\r\n }));\r\n\r\n store.dispatch(commonSlice.actions.loginPage());\r\n })\r\n .catch(() => {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Recuperação de senha\",\r\n description : 'Falha ao solicitar alteração de senha, tente novamente mais tarde',\r\n show:true\r\n }));\r\n })\r\n }\r\n else if (userSlice.actions.registerUser.match(action))\r\n {\r\n const state = store.getState();\r\n store.dispatch(remoteRegisterUser(action.payload))\r\n .then((e)=>{\r\n var message = \"Erro ao cadastrar usuário.\";\r\n switch(e.meta.requestStatus)\r\n {\r\n case \"fulfilled\":\r\n {\r\n if(state.userState.ssoData) {\r\n store.dispatch(userSlice.actions.signinAfterPayload({\r\n ...state.userState.ssoData,\r\n login: action.payload.cpf,\r\n password: action.payload.password,\r\n initialLogin: state.userState.ssoData.login\r\n }))\r\n store.dispatch(userSlice.actions.setSsoData(undefined));\r\n }\r\n else {\r\n message = \"Cadastro feito com sucesso\";\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Cadastro\",\r\n description : \"Cadastro feito com sucesso.\",\r\n show:true\r\n }));\r\n store.dispatch(commonSlice.actions.loginPage());\r\n }\r\n break;\r\n }\r\n case \"rejected\":\r\n {\r\n message = (e as any)?.error?.message ?? message\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Cadastro\",\r\n description : message,\r\n show:true\r\n }));\r\n }\r\n }\r\n });\r\n }\r\n else if (changePassword.fulfilled.match(action)) {\r\n store.dispatch(commonSlice.actions.backPage());\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Login\",\r\n description : \"Senha alterada com sucesso.\",\r\n show:true\r\n }));\r\n }\r\n else if (changePassword.rejected.match(action)) {\r\n store.dispatch(commonSlice.actions.showAlert({\r\n title : \"Login\",\r\n description : \"Não foi possível alterar sua senha\",\r\n show:true\r\n }));\r\n }\r\n else if (sendCPFEmail.match(action)) {\r\n const state = store.getState();\r\n const user = state.userState.userCopy\r\n if (user) {\r\n store.dispatch(updatedProfile({ ...user, cpf: action.payload })).unwrap().then((profile) => {\r\n\r\n var state = store.getState();\r\n var user = state.userState.user;\r\n\r\n if (!user) return;\r\n\r\n var userUpdated = { ...user, ...profile };\r\n store.dispatch(userSlice.actions.activeUser(userUpdated));\r\n store.dispatch(userSlice.actions.toggleModalMigration());\r\n store.dispatch(commonSlice.actions.goToPage(MenuOptions.Home));\r\n })\r\n }\r\n }\r\n else if (sendNewLogin.match(action)) {\r\n const state = store.getState();\r\n const user = state.userState.userCopy\r\n if (user) {\r\n store.dispatch(updatedProfile({ ...user, login: action.payload })).unwrap().then((profile) => {\r\n\r\n var state = store.getState();\r\n var user = state.userState.user;\r\n\r\n if (!user) return;\r\n\r\n var userUpdated = { ...user, ...profile };\r\n store.dispatch(userSlice.actions.activeUser(userUpdated));\r\n store.dispatch(checkPendingCpfOrEmail());\r\n })\r\n }\r\n }\r\n else if (updatingUser.match(action)) {\r\n store.dispatch(userSlice.actions.setLastCpf(action.payload.cpf));\r\n const state = store.getState();\r\n store.dispatch(userSlice.actions.setLastLogin(state.userState.login))\r\n const errorUpdated = () => {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title : \"Erro ao atualizar usuário\",\r\n description : state.userState.updatingUserError ?? \"Não foi possível atualizar os dados.\",\r\n show: true\r\n })\r\n )\r\n };\r\n\r\n store.dispatch(updatedProfile(action.payload)).unwrap().then((profile) => {\r\n if (!profile) {\r\n errorUpdated();\r\n return;\r\n }\r\n\r\n var user = state.userState.user;\r\n\r\n if (!user) return;\r\n\r\n const preferences = state.userState.preferences ?? [];\r\n\r\n const acceptedTerms = preferences.find((item) => item.key === 'accepted_privacy_police');\r\n\r\n if (!acceptedTerms) {\r\n store.dispatch(onCreatePreference({ key: 'accepted_privacy_police', value: true }))\r\n .unwrap()\r\n .then(res => {\r\n if (res) {\r\n store.dispatch(userSlice.actions.setPreferences(\r\n [...preferences, res]\r\n ))\r\n }\r\n })\r\n .catch(err => {\r\n console.log(err);\r\n })\r\n };\r\n\r\n var userUpdated = { ...user, ...profile };\r\n\r\n store.dispatch(commonSlice.actions.showAlert({\r\n show: true,\r\n title: \"Meus dados\",\r\n description: \"Dados atualizados com sucesso!\"\r\n }))\r\n store.dispatch(userSlice.actions.activeUser(userUpdated));\r\n }).catch((err) => {\r\n if (err && err.message === ERRORS.USER_UPDATING_ERROR_BECAUSE_CPF_ALREADY_REGISTERED) {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title : \"Meus dados\",\r\n description : ERRORS.USER_UPDATING_ERROR_BECAUSE_CPF_ALREADY_REGISTERED,\r\n show: true,\r\n buttons: [\r\n {\r\n callback: () => {\r\n store.dispatch(commonSlice.actions.showAlert({ show: false, title: \"\", description: \"\" }))\r\n store.dispatch(userSlice.actions.toggleModalMigration())\r\n store.dispatch(userSlice.actions.changeStep(5))\r\n },\r\n label: \"Login\",\r\n styles: {\r\n background: \"#084c8a\",\r\n color: \"#fff\",\r\n margin: \"auto\",\r\n }\r\n }\r\n ]\r\n })\r\n )\r\n return;\r\n }\r\n errorUpdated();\r\n })\r\n }\r\n\r\n return next(action);\r\n };\r\n\r\nexport default userSlice.reducer;\r\n","import {\r\n createSlice,\r\n PayloadAction,\r\n createAsyncThunk,\r\n createAction,\r\n configureStore,\r\n} from \"@reduxjs/toolkit\";\r\nimport { Middleware, MiddlewareAPI, Dispatch } from \"redux\";\r\nimport {\r\n Content,\r\n ContentGroup,\r\n ContentOptionFavorite,\r\n ContentOptionFavorited,\r\n ReadingListItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { AppDispatch, RootState } from \"..\";\r\nimport { ContentService, UserDataService } from \"../../services\";\r\nimport {\r\n RemoteUserData,\r\n TagData,\r\n} from \"../../services/userData/IUserDataService\";\r\nimport common, { commonSlice } from \"./common\";\r\nimport { contentDetail, contentSlice } from \"./contentSlice\";\r\nimport { userSlice } from \"./userSlice\";\r\nimport {\r\n RemoteContentDetail,\r\n RemoteContentReference,\r\n} from \"../../services/contents/IContentService\";\r\n\r\ninterface UserDataState {\r\n historyReading?: string[];\r\n worksToReview?: string[];\r\n reading?: ContentGroup;\r\n\r\n tags: TagData[];\r\n sharedTags: TagData[];\r\n activeTagUid?: string;\r\n\r\n ///userdata\r\n userData: RemoteUserData[];\r\n userDataShared: RemoteUserData[];\r\n playerObserver?: {\r\n userInteraction?: any;\r\n onBack?: boolean;\r\n };\r\n}\r\n\r\nconst initialState: UserDataState = {\r\n tags: [],\r\n sharedTags: [],\r\n userDataShared: [],\r\n ///userdata\r\n userData: [],\r\n playerObserver: {},\r\n};\r\n\r\ninterface TagContentLink {\r\n content: Content;\r\n tag: TagData;\r\n}\r\n\r\ninterface RateContent {\r\n content: Content;\r\n rate: number;\r\n}\r\n\r\n///Tags\r\n\r\nconst loadTags = createAsyncThunk(\"userdata/readinglist/available\", () =>\r\n UserDataService.TagsAvailable()\r\n);\r\n\r\nconst loadSharedTags = createAsyncThunk(\r\n \"userdata/readinglist/shared/available\",\r\n () => UserDataService.TagsSharedAvailable()\r\n);\r\n\r\nconst subscribeTag = createAsyncThunk(\r\n \"userdata/readinglist/shared/subscribe\",\r\n (code: string) => UserDataService.TagSubscribe(code)\r\n);\r\n\r\nconst createTag = createAsyncThunk(\"readinglist/remote/add\", (tag: TagData) =>\r\n UserDataService.TagCreate(tag)\r\n);\r\n\r\nconst updateTag = createAsyncThunk(\r\n \"readinglist/remote/update\",\r\n (tag: TagData) => UserDataService.TagUpdate(tag)\r\n);\r\n\r\nconst deleteTag = createAsyncThunk(\r\n \"readinglist/remote/delete\",\r\n (tag: TagData) => UserDataService.TagDelete(tag)\r\n);\r\n\r\n/// UserData\r\n\r\nconst loadUserData = createAsyncThunk(\"userdata/available\", () =>\r\n UserDataService.UserDataAvailable()\r\n);\r\n\r\nconst loadUserDataShared = createAsyncThunk(\r\n \"userdata/readinglist/shared/content\",\r\n () => UserDataService.UserDataAvailableShared()\r\n);\r\n\r\n// const readingListFromContent = createAsyncThunk(\"userdata/readinglist/fromcontent\", (content:Content) => UserDataService.ReadingListFromContent(content));\r\n\r\nconst insertContentInTag = createAsyncThunk(\r\n \"userdata/readinglist/insert\",\r\n (data: TagContentLink) =>\r\n UserDataService.InsertContentInTagt(data.content, data.tag)\r\n);\r\n\r\nconst removeContentFromTag = createAsyncThunk(\r\n \"userdata/readinglist/remove\",\r\n (data: TagContentLink) =>\r\n UserDataService.RemoveContentFromTag(data.content, data.tag)\r\n);\r\n\r\n// Evaluate\r\nexport const postUserEvaluation = createAsyncThunk(\r\n \"review/managedContent\",\r\n (data: RateContent) =>\r\n UserDataService.PostUserEvaluation(data.content.uid, data.rate)\r\n);\r\nexport const updateEvaluation = createAsyncThunk(\r\n \"review/managedContent/update\",\r\n (data: { uid: string, note: number }) =>\r\n UserDataService.UpdateUserEvaluation(data.uid, data.note)\r\n);\r\nexport const deleteUserEvaluation = createAsyncThunk(\r\n \"review/managedContent/remove\",\r\n (reviewUid: string) =>\r\n UserDataService.DeleteUserEvaluation(reviewUid)\r\n);\r\n\r\n///contents download\r\n\r\nconst internalDownloadContentReference = createAsyncThunk(\r\n \"content/reference/download\",\r\n (contentReferenceUid: string) =>\r\n UserDataService.ContentDownload(contentReferenceUid)\r\n);\r\n\r\nconst internalDeleteContentReference = createAsyncThunk(\r\n \"content/reference/delete\",\r\n (contentReferenceUid: string) =>\r\n UserDataService.ContentDelete(contentReferenceUid)\r\n);\r\n\r\nexport const reloadUserData = createAction(\"userData/load\");\r\n\r\nexport const FavoritesInternalTag = \"###InternalFavorites###\";\r\n\r\nexport const insertInFavorite = createAction(\"favorite/add\");\r\n\r\nexport const removeFromFavorite = createAction(\"favorite/remove\");\r\n\r\nexport const createTagPage = createAction(\"readinglist/add\");\r\n\r\nexport const loadTag = createAction(\"reading/load\");\r\n\r\nexport const updateActiveTag = createAction(\"reading/update\");\r\n\r\nexport const searchAndSubscribeTag = createAction(\"reading/subscribe\");\r\n\r\nexport const shareCode = createAction(\"reading/share\");\r\n\r\nexport const removeActiveTag = createAction(\"reading/remove\");\r\n\r\nexport const editTagByUid = createAction(\"reading/edit\");\r\n\r\nexport const insertTagShared = createAction(\"userdata/shared\");\r\n\r\nexport const insertInTagActiveContent = createAction(\r\n \"userdata/content/tag/insert\"\r\n);\r\n\r\nexport const removeFromTagActiveContent = createAction(\r\n \"userdata/content/tag/remove\"\r\n);\r\n\r\nexport const rateActiveContent = createAction(\r\n \"userdata/content/rating\"\r\n);\r\nexport const unRateActiveContent = createAction(\r\n \"userdata/content/rating/delete\"\r\n);\r\n\r\nexport const historyContents = createAsyncThunk(\r\n \"contents/historyContents\",\r\n () => ContentService.HistoryContents()\r\n);\r\n\r\nexport const getReviewContents = createAsyncThunk(\r\n \"contents/reviewContents\",\r\n () => ContentService.ReviewContents()\r\n);\r\n\r\nexport const downloadedContents = createAsyncThunk(\"content/downloaded\", () =>\r\n UserDataService.ContentDownloaded()\r\n);\r\n\r\nexport const downloadedContentsWithoutAlert = createAsyncThunk(\"content/downloaded\", () =>\r\n UserDataService.ContentDownloaded()\r\n);\r\n\r\nexport const downloadContentReference =\r\n createAction(\"content/download\");\r\n\r\nexport const deleteContentReference = createAction(\"content/delete\");\r\n\r\nexport const loadPlayerObserver = createAction(\"player/observer\");\r\n\r\nexport const userDataSlice = createSlice({\r\n name: \"userDataSlice\",\r\n initialState,\r\n reducers: {\r\n resetState: () => initialState,\r\n\r\n cleanData: (state) => {\r\n state.activeTagUid = undefined;\r\n state.historyReading = undefined;\r\n state.worksToReview = undefined;\r\n state.userData = [];\r\n state.tags = [];\r\n },\r\n activeTagUid: (state, data: PayloadAction) => {\r\n // const activeList = state.readingListAvailable.find(p=> p.uid == data.payload.uid);\r\n state.activeTagUid = data.payload;\r\n },\r\n runPlayerObserver: (state, data: PayloadAction) => {\r\n state.playerObserver = data.payload\r\n }\r\n },\r\n extraReducers: (builder) => {\r\n ///reading list\r\n builder.addCase(historyContents.fulfilled, (state, action) => {\r\n state.historyReading = action.payload.map((p) => p.uid);\r\n //todo: atualizar lista geral de conteúdos\r\n });\r\n builder.addCase(getReviewContents.fulfilled, (state, action) => {\r\n state.worksToReview = action.payload.map((p) => p.uid);\r\n //todo: atualizar lista geral de conteúdos\r\n });\r\n ///userdata\r\n builder.addCase(loadUserData.fulfilled, (state, action) => {\r\n state.userData = action.payload;\r\n });\r\n\r\n builder.addCase(loadUserDataShared.fulfilled, (state, action) => {\r\n state.userDataShared = action.payload;\r\n });\r\n\r\n builder.addCase(insertContentInTag.fulfilled, (state, action) => {\r\n var data = { ...action.payload };\r\n state.userData = state.userData.filter(\r\n (p) => p.uid != data.uid && p.uid != action.meta.requestId\r\n );\r\n state.userData.push(data);\r\n });\r\n\r\n builder.addCase(insertContentInTag.pending, (state, action) => {\r\n state.userData.push({\r\n uid: action.meta.requestId,\r\n contextType: \"ManagedContent\",\r\n targetType: \"ManagedContent\",\r\n contextUid: action.meta.arg.content.uid,\r\n targetUid: action.meta.arg.content.uid,\r\n tags: [action.meta.arg.tag],\r\n });\r\n });\r\n\r\n builder.addCase(insertContentInTag.rejected, (state, action) => {\r\n state.userData = state.userData.filter(\r\n (p) => p.uid != action.meta.requestId\r\n );\r\n });\r\n\r\n builder.addCase(removeContentFromTag.fulfilled, (state, action) => {\r\n state.userData = [\r\n ...state.userData.filter(\r\n (p) => action.payload?.find((r) => r.uid == p.uid) == undefined\r\n ),\r\n ...action.payload,\r\n ];\r\n });\r\n\r\n //tags\r\n\r\n builder.addCase(loadSharedTags.fulfilled, (state, action) => {\r\n state.sharedTags = action.payload;\r\n });\r\n\r\n builder.addCase(loadTags.fulfilled, (state, action) => {\r\n state.tags = action.payload;\r\n });\r\n\r\n builder.addCase(createTag.fulfilled, (state, action) => {\r\n const list = state.tags;\r\n const tag = action.payload;\r\n\r\n if (!tag.contents) tag.contents = [];\r\n\r\n list?.push(tag);\r\n\r\n state.tags = list;\r\n });\r\n\r\n builder.addCase(updateTag.fulfilled, (state, action) => {\r\n var current = state.tags.find((p) => p.uid === action.payload.uid);\r\n var data = action.payload;\r\n\r\n if (current) {\r\n data = { ...current, ...data };\r\n state.tags = state.tags.filter((p) => p.uid !== current?.uid);\r\n }\r\n\r\n state.tags.push(data);\r\n });\r\n\r\n builder.addCase(deleteTag.pending, (state, action) => {\r\n var listUpdated = state.tags.filter(\r\n (item) => item.uid !== action.meta.arg.uid\r\n );\r\n state.tags = listUpdated;\r\n });\r\n\r\n builder.addCase(deleteTag.rejected, (state, action) => {\r\n const current = state.tags;\r\n current?.push(action.meta.arg);\r\n\r\n state.tags = current;\r\n });\r\n },\r\n});\r\n\r\nexport const middleware: Middleware =\r\n (store: MiddlewareAPI) =>\r\n (next: Dispatch) =>\r\n async (action: PayloadAction) => {\r\n const state = store.getState();\r\n\r\n if (commonSlice.actions.changeState.match(action) && action.payload == \"initializing\")\r\n {\r\n store.dispatch(historyContents());\r\n }\r\n\r\n\r\n if (userSlice.actions.activeUser.match(action)) {\r\n if (action.payload) {\r\n // store.dispatch(historyContents());\r\n // store.dispatch(getReviewContents());\r\n store.dispatch(loadUserData());\r\n store.dispatch(loadUserDataShared());\r\n store.dispatch(loadTags());\r\n store.dispatch(loadSharedTags());\r\n } else {\r\n store.dispatch(userDataSlice.actions.cleanData());\r\n }\r\n\r\n if (state.commonState.runningInMobile) {\r\n store.dispatch(downloadedContentsWithoutAlert());\r\n }\r\n }\r\n\r\n if(loadPlayerObserver.match(action)) {\r\n store.dispatch(userDataSlice.actions.runPlayerObserver(action.payload))\r\n }\r\n if(unRateActiveContent.match(action)) {\r\n if(state.contentState.activeReview) {\r\n store.dispatch(deleteUserEvaluation(state.contentState.activeReview))\r\n .then(() => {\r\n if(state.contentState.activeContentUid) {\r\n store.dispatch(contentDetail(state.contentState.activeContentUid))\r\n }\r\n })\r\n }\r\n };\r\n if (rateActiveContent.match(action)) {\r\n var content = state.contentState.allContents.find(\r\n (p) => p.uid == state.contentState.activeContentUid\r\n );\r\n\r\n if (content) {\r\n if(state.contentState.activeReview) {\r\n store.dispatch(updateEvaluation({ \r\n uid: state.contentState.activeReview,\r\n note: action.payload\r\n })) \r\n .then(() => {\r\n if (content) store.dispatch(contentDetail(content.uid));\r\n });\r\n }\r\n else {\r\n store\r\n .dispatch(\r\n postUserEvaluation({ content: content, rate: action.payload })\r\n )\r\n .then(() => {\r\n if (content) store.dispatch(contentDetail(content.uid));\r\n });\r\n }\r\n }\r\n }\r\n\r\n if (createTagPage.match(action)) {\r\n store.dispatch(userDataSlice.actions.activeTagUid(\"-1\"));\r\n store.dispatch(editTagByUid(\"-1\"));\r\n }\r\n\r\n if (editTagByUid.match(action)) {\r\n store.dispatch(userDataSlice.actions.activeTagUid(action.payload));\r\n } else if (updateActiveTag.match(action) && action.payload.name) {\r\n const currentTag = state.userDataState.tags.find(\r\n (p) => p.uid === state.userDataState.activeTagUid\r\n );\r\n const updatedTag: TagData = { ...currentTag, ...action.payload };\r\n\r\n if (updatedTag?.uid === \"-1\" || updatedTag.uid === undefined) {\r\n store\r\n .dispatch(createTag(updatedTag))\r\n .unwrap()\r\n .then((tag) => {\r\n console.log(updatedTag);\r\n updatedTag.contents?.forEach((content) =>\r\n store.dispatch(insertContentInTag({ content: content, tag: tag }))\r\n );\r\n store.dispatch(editTagByUid(tag.uid));\r\n store.dispatch(commonSlice.actions.showAlert({ \r\n title: \"Lista de leitura\",\r\n show: true, \r\n description: \"Lista criada com sucesso.\"\r\n }))\r\n });\r\n } else if (updatedTag) {\r\n var userDatas = state.userDataState.userData.filter(\r\n (u) => u.tags?.find((t) => t.uid == updatedTag.uid) != undefined\r\n );\r\n var newContents = updatedTag.contents?.filter(\r\n (p) => userDatas?.find((u) => u.contextUid === p.uid) === undefined\r\n );\r\n var removeContents = userDatas?.filter(\r\n (p) =>\r\n updatedTag.contents?.find((cp) => cp.uid === p.contextUid) ===\r\n undefined\r\n );\r\n\r\n if (!newContents?.length && !removeContents?.length) {\r\n store.dispatch(commonSlice.actions.showAlert({ \r\n title: \"Lista de leitura\",\r\n show: true, \r\n description: \"Lista editada com sucesso.\"\r\n }))\r\n };\r\n\r\n console.log(\"newContents\", newContents);\r\n console.log(\"removeContents\", removeContents);\r\n newContents?.forEach((c) =>\r\n store.dispatch(insertContentInTag({ content: c, tag: updatedTag }))\r\n );\r\n removeContents?.forEach((c) => {\r\n var removeContent = state.contentState.allContents.find(\r\n (ac) => ac.uid == c.contextUid\r\n );\r\n if (removeContent)\r\n store.dispatch(\r\n removeContentFromTag({ content: removeContent, tag: updatedTag })\r\n );\r\n });\r\n\r\n store.dispatch(updateTag(updatedTag));\r\n }\r\n } else if (loadTags.fulfilled.match(action)) {\r\n var favoriteTag = action.payload.find(\r\n (p) => p.name == FavoritesInternalTag\r\n );\r\n if (!favoriteTag)\r\n store.dispatch(createTag({ name: FavoritesInternalTag, uid: \"fav\" }));\r\n } else if (removeActiveTag.match(action)) {\r\n const currentTag = state.userDataState.tags.find(\r\n (p) => p.uid === state.userDataState.activeTagUid\r\n );\r\n if (currentTag) {\r\n store.dispatch(deleteTag(currentTag));\r\n store.dispatch(commonSlice.actions.backPage());\r\n store.dispatch(commonSlice.actions.showAlert({ \r\n title: \"Lista de leitura\",\r\n description: \"Lista de leitura removida com sucesso.\",\r\n show: true,\r\n }))\r\n }\r\n } else if (loadTag.match(action)) {\r\n const tag = state.userDataState.tags.find(\r\n (p) => p.uid === action.payload\r\n );\r\n if (tag)\r\n store.dispatch(userDataSlice.actions.activeTagUid(action.payload));\r\n }\r\n\r\n if (insertInTagActiveContent.match(action)) {\r\n var content = state.contentState.allContents.find(\r\n (p) => p.uid == state.contentState.activeContentUid\r\n );\r\n var tag = state.userDataState.tags.find((p) => p.uid == action.payload);\r\n console.log(content, tag);\r\n if (content && tag) store.dispatch(insertContentInTag({ content, tag }));\r\n } else if (removeFromTagActiveContent.match(action)) {\r\n var content = state.contentState.allContents.find(\r\n (p) => p.uid == state.contentState.activeContentUid\r\n );\r\n var tag = state.userDataState.tags.find((p) => p.uid === action.payload);\r\n if (content && tag)\r\n store.dispatch(removeContentFromTag({ content, tag }));\r\n }\r\n\r\n if (createTag.fulfilled.match(action)) {\r\n store.dispatch(loadTags());\r\n }\r\n\r\n if(reloadUserData.match(action)) {\r\n store.dispatch(loadUserData())\r\n }\r\n ///favorites\r\n if (insertInFavorite.match(action)) {\r\n var data = action.payload;\r\n var tag = state.userDataState.tags.find(\r\n (p) => p.name == FavoritesInternalTag\r\n );\r\n if (data && tag)\r\n store.dispatch(insertContentInTag({ content: data, tag })).unwrap()\r\n .catch(() => {\r\n store.dispatch(commonSlice.actions.showAlert({ \r\n description: \"Ocorreu um erro ao tentar inserir nos favoritos.\",\r\n show: true,\r\n title: \"Favoritos\",\r\n }))\r\n })\r\n }\r\n\r\n if (removeFromFavorite.match(action)) {\r\n const isWeb = window.innerWidth > 1024;\r\n const data = action.payload;\r\n const title = data.title && isWeb ? data.title : \"Excluir conteúdo\";\r\n\r\n const tag = store\r\n .getState()\r\n .userDataState.tags.find((p) => p.name === FavoritesInternalTag);\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: title,\r\n description: \"Deseja excluir este e-book de seus favoritos?\",\r\n show: true,\r\n buttons: [\r\n {\r\n label: \"Excluir\",\r\n callback: () =>\r\n tag &&\r\n store.dispatch(\r\n removeContentFromTag({ content: data, tag: tag })\r\n ),\r\n },\r\n ],\r\n })\r\n );\r\n }\r\n\r\n //downloads\r\n\r\n if (\r\n commonSlice.actions.runningInMobile.match(action) &&\r\n action.payload == true\r\n ) {\r\n console.log(\"in mobile\");\r\n store.dispatch(downloadedContentsWithoutAlert());\r\n }\r\n\r\n // if (downloadContent.match(action) || deleteContent.match(action))\r\n // {\r\n // // console.log(\"download content: \",action.payload);\r\n\r\n // var actionTarget = downloadContent;\r\n // if (deleteContent.match(action)) actionTarget = deleteContent;\r\n\r\n // store.dispatch(contentDetail(action.payload.uid))\r\n // .unwrap()\r\n // .then(rcontent=> {\r\n // rcontent.references?.forEach(reference=> store.dispatch(actionTarget(reference.uid)));\r\n // });\r\n // }\r\n\r\n if (downloadContentReference.match(action)) {\r\n store.dispatch(internalDownloadContentReference(action.payload));\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: \"Fazendo download...\",\r\n description: \"\",\r\n show: true,\r\n })\r\n );\r\n }\r\n\r\n if (downloadedContents.fulfilled.match(action)) {\r\n var showAlert =\r\n action.payload?.filter((contentUpdated) => {\r\n var completed = contentUpdated?.references?.filter(\r\n (r) => r.downloadProgress == 100\r\n );\r\n var lastContent = state.contentState.allContents.find(\r\n (c) => c.uid == contentUpdated.uid\r\n );\r\n\r\n if (!lastContent) return false;\r\n\r\n for (var reference of lastContent.references ?? []) {\r\n var newReferente = completed?.find((p) => p.uid == reference.uid);\r\n if (\r\n !newReferente ||\r\n reference.downloadProgress == newReferente.downloadProgress\r\n )\r\n continue;\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n }).length > 0;\r\n\r\n // if (showAlert && state.commonState.withInternet)\r\n // store.dispatch(\r\n // commonSlice.actions.showAlert({\r\n // title: \"Download concluído.\",\r\n // description: \"\",\r\n // show: true,\r\n // })\r\n // );\r\n }\r\n\r\n if (deleteContentReference.match(action)) {\r\n var content = state.contentState.allContents.find((p) =>\r\n p.references?.find((r) => r.uid == action.payload)\r\n );\r\n var reference = content?.references?.find((p) => p.uid == action.payload);\r\n\r\n if (reference) {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: content?.title ?? \"\",\r\n description: `Deseja excluir o download deste ${reference.format} de seu dispositivo?`,\r\n show: true,\r\n buttons: [\r\n {\r\n label: \"Sim\",\r\n callback: () => {\r\n if (!reference) return;\r\n store.dispatch(contentSlice.actions.updateAllContents(\r\n state.contentState.allContents.map(item => ({ \r\n ...item,\r\n references: item.references?.map(referenceItem => {\r\n if (reference && reference.uid === referenceItem.uid) {\r\n return { \r\n ...referenceItem,\r\n downloadProgress: 0,\r\n }\r\n }\r\n return referenceItem\r\n })\r\n }))\r\n ))\r\n store.dispatch(internalDeleteContentReference(reference.uid))\r\n store.dispatch(downloadedContents());\r\n }\r\n },\r\n {\r\n label: \"Não\",\r\n },\r\n ],\r\n })\r\n );\r\n }\r\n }\r\n\r\n if (searchAndSubscribeTag.match(action)) {\r\n store\r\n .dispatch(subscribeTag(action.payload))\r\n .unwrap()\r\n .then((tag) => {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: \"Importação de lista\",\r\n description: \"Lista importada com sucesso.\",\r\n show: true,\r\n })\r\n );\r\n store.dispatch(loadUserData());\r\n store.dispatch(loadUserDataShared());\r\n store.dispatch(loadTags());\r\n store.dispatch(loadSharedTags());\r\n // store.dispatch(editTagByUid(tag.uid));\r\n store.dispatch(commonSlice.actions.changeRoute('/library/options'));\r\n setTimeout(() => {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: \"Importação de lista\",\r\n description: \"Lista importada com sucesso.\",\r\n show: false,\r\n })\r\n );\r\n }, 3000)\r\n })\r\n .catch((reason) => {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: \"Importação de lista\",\r\n description:\r\n \"Falha ao importar lista compartilhada. Verifique o código e tente novamente.\",\r\n show: true,\r\n })\r\n );\r\n });\r\n }\r\n\r\n /// Share Code\r\n if (shareCode.match(action)) {\r\n const data = action.payload;\r\n const tag = store\r\n .getState()\r\n .userDataState.tags.find((p) => p.name === FavoritesInternalTag);\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: \"Compartilhar lista de leitura\",\r\n description:\r\n \"Envie a URL para pessoas de sua instituição com quem deseja compartilhar a lista. https://bibliotecadigital#\",\r\n show: true,\r\n buttons: [\r\n {\r\n label: \"Copiar\",\r\n // value: \"true\",\r\n // content: data\r\n },\r\n ],\r\n })\r\n );\r\n }\r\n\r\n //userdata\r\n\r\n if (\r\n loadUserData.fulfilled.match(action) ||\r\n loadUserDataShared.fulfilled.match(action)\r\n ) {\r\n action.payload\r\n .filter((p) => p.contextType == \"ManagedContent\")\r\n .forEach((remote) => {\r\n var found = state.contentState.allContents.find(\r\n (p) => p.uid == remote.contextUid\r\n );\r\n if (found) return;\r\n\r\n store.dispatch(contentDetail(remote.contextUid));\r\n });\r\n }\r\n\r\n return next(action);\r\n };\r\n\r\nexport default userDataSlice.reducer;\r\n","import { connect } from \"react-redux\";\r\nimport { PageBookDetail, PageBookDetailWeb } from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n OptionsItems,\r\n PageBookDetailPropsDispach,\r\n PageBookDetailState,\r\n} from \"senac-components/dist/pages/Mobile/PageBookDetail\";\r\nimport { Wrapper, WrapperDispatchProps, WrapperStateProps } from \"./Wrapper\";\r\nimport {\r\n Content,\r\n ContentGroup,\r\n ContentHeaderOptionItem,\r\n ContentOptionAddReadingList,\r\n ContentReference,\r\n MenuOptions,\r\n ReadingListItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n ContentType,\r\n activeContentAnchor,\r\n loadAndOpenContent,\r\n openContent,\r\n showContentDetail,\r\n} from \"../store/reducers/contentSlice\";\r\nimport {\r\n FavoritesInternalTag,\r\n createTagPage,\r\n deleteContentReference,\r\n downloadContentReference,\r\n insertInFavorite,\r\n insertInTagActiveContent,\r\n rateActiveContent,\r\n removeFromFavorite,\r\n removeFromTagActiveContent,\r\n unRateActiveContent,\r\n} from \"../store/reducers/userDataSlice\";\r\nimport { RemoteContentDetail } from \"../services/contents/IContentService\";\r\nimport { PageAppointmentsStateProps } from \"senac-components/dist/pages/Mobile/PageAppointments\";\r\nimport { LibrarySections } from \"senac-components/dist/pages/Mobile/PageLibrarySection\";\r\nimport {\r\n PageBookDetailWebDispach,\r\n PageBookDetailWebProps,\r\n} from \"senac-components/dist/pages/Web/PageBookDetail\";\r\nimport { collections } from \"./mocks\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\nimport { useState } from \"react\";\r\nexport enum ContentTypeV {\r\n PDF = \"PDF\",\r\n EPUB = \"EPUB\",\r\n}\r\n\r\nconst getAppointments = (state: RootState) => {\r\n var pdfdata: OptionsItems[] | undefined = undefined;\r\n var epubdata: OptionsItems[] | undefined = undefined;\r\n var activeContent = state.contentState.allContents.find(\r\n (p) => p.uid == state.contentState.activeContentUid\r\n );\r\n var data = state.userDataState.userData.filter(\r\n (p) =>\r\n p.targetType == \"ManagedContentReference\" &&\r\n p.contextType == \"ManagedContent\" &&\r\n p.contextUid == activeContent?.uid\r\n );\r\n\r\n data.forEach((userData) => {\r\n var reference = activeContent?.references?.find(\r\n (r) => r.uid == userData.targetUid\r\n );\r\n if (!reference) return;\r\n\r\n const external = JSON.parse(userData.externalData);\r\n\r\n var option: OptionsItems & { markColor: any, externalType?: string }= {\r\n uid: userData.uid,\r\n title: userData.description,\r\n marked: userData.annotation,\r\n numerReading: \"0\",\r\n markColor: external.mark_color,\r\n };\r\n\r\n try {\r\n var info = JSON.parse(userData.externalData);\r\n // console.log(\"info:\", info);\r\n option.numerReading = info.chapter_index;\r\n option.externalType = userData.externalType\r\n // option.markColor = info.mark_color;\r\n } catch (e) {}\r\n\r\n switch (reference.mimeType) {\r\n case \"application/epub+zip\": {\r\n if (!epubdata) epubdata = [];\r\n epubdata.push(option);\r\n break;\r\n }\r\n case \"digitalpages/richpack\": {\r\n if (!pdfdata) pdfdata = [];\r\n pdfdata.push(option);\r\n break;\r\n }\r\n }\r\n });\r\n\r\n let result = {\r\n pdfAppointments: pdfdata,\r\n epubAppointments: epubdata,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst listState = (state: RootState) => {\r\n const activeContent = state.contentState.allContents.find(\r\n (p) => p.uid == state.contentState.activeContentUid\r\n );\r\n const content = { ...(activeContent ?? { uid: \"-\" }) };\r\n var data = state.userDataState.userData.filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.length > 0 &&\r\n p.targetType == \"ManagedContent\" &&\r\n p.contextType == \"ManagedContent\" &&\r\n p.contextUid == content.uid\r\n );\r\n var uniqueTags = data\r\n .map((p) => p.tags ?? [])\r\n .reduce(\r\n (p, c) => [...new Map([...c, ...p].map((p) => [p.uid, p])).values()],\r\n []\r\n );\r\n\r\n const selectedList = uniqueTags.map((p) => p.uid);\r\n const available = state.userDataState.tags?.filter(\r\n (t) => t.name != FavoritesInternalTag\r\n );\r\n\r\n let result = {\r\n selected: selectedList,\r\n itemsLists: available,\r\n };\r\n return result;\r\n};\r\nconst mapState = (state: RootState, props: any) => {\r\n let contents: ContentGroup[] = [];\r\n const contentSummary = state.contentState.contentSummary;\r\n\r\n var allContents = state.contentState.allContents;\r\n var relatedContent = state.contentState.activeContentRelated;\r\n var activeContent = allContents.find(\r\n (p) => p.uid == state.contentState.activeContentUid\r\n );\r\n\r\n var data = state.userDataState.userData.filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.length > 0 &&\r\n p.targetType == \"ManagedContent\" &&\r\n p.contextType == \"ManagedContent\"\r\n );\r\n var uniqueTags = data\r\n .map((p) => p.tags ?? [])\r\n .reduce(\r\n (p, c) => [...new Map([...c, ...p].map((p) => [p.uid, p])).values()],\r\n []\r\n )\r\n .filter((p) => p.name == FavoritesInternalTag);\r\n var contentsUids = data\r\n .filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.filter((t) => uniqueTags.find((ut) => ut.uid == t.uid)).length >\r\n 0\r\n )\r\n .map((p) => p.contextUid);\r\n\r\n var s = contentsUids;\r\n if (relatedContent) {\r\n contents.push({\r\n uid: \"related\",\r\n title: \"Quem leu também gostou\",\r\n books: allContents.filter((p) => relatedContent?.find((t) => t == p.uid)),\r\n });\r\n }\r\n\r\n const content: RemoteContentDetail = {\r\n ...(activeContent ?? {\r\n uid: \"-\",\r\n readingTime: \"\",\r\n title: \"Carregando...\",\r\n author: \"-\",\r\n }),\r\n };\r\n\r\n const isFavorite = contentsUids.find((p) => p == content.uid) != undefined;\r\n const availableEpubFormat =\r\n content.references?.find((f) => f.mimeType.indexOf(\"epub\") != -1) !=\r\n undefined;\r\n const availablePdfFormat =\r\n content.references?.find((f) => f.mimeType.indexOf(\"richpack\") != -1) !=\r\n undefined;\r\n\r\n let formats = \"\"; //\"ePUB | PDF\";\r\n\r\n if (availableEpubFormat) formats += \"ePUB\";\r\n if (availablePdfFormat) {\r\n if (formats.length > 1) formats += \" | \";\r\n formats += \"PDF\";\r\n }\r\n\r\n if (state.userState.user) {\r\n formats = content?.readingTime\r\n ? `${content.readingTime} de leitura`\r\n : \"Não estimado tempo de leitura\";\r\n }\r\n\r\n const propsAppointments = getAppointments(state);\r\n\r\n const listResult = listState(state);\r\n\r\n let result: PageBookDetailState &\r\n WrapperStateProps &\r\n Partial = {\r\n authenticatedUser: state.userState.user !== undefined,\r\n loading: !content,\r\n contents: contents, //todo: tratar caso é nulo\r\n content: content,\r\n contentsFavorited: isFavorite ? [content.uid] : [],\r\n contentsDownloaded: [],\r\n element: window.innerWidth < 1024 ? PageBookDetail : PageBookDetailWeb, //todo: tratar caso onde é nulo\r\n note: formats,\r\n availableEpubFormat: availableEpubFormat,\r\n availablePdfFormat: availablePdfFormat,\r\n references: state.contentState.preferences,\r\n summaries: contentSummary,\r\n epubAppointments: propsAppointments.epubAppointments,\r\n pdfAppointments: propsAppointments.pdfAppointments,\r\n isFavorite: isFavorite,\r\n loadingRelateds: state.contentState.loadingRelateds,\r\n loadingSummary: state.contentState.loadingSummary,\r\n ...listResult,\r\n };\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch, props: any) => {\r\n\r\n const result: PageBookDetailPropsDispach & WrapperDispatchProps &Partial = {\r\n\r\n onClickOptionFooter(option) {\r\n return dispatch(commonSlice.actions.goToMyProfileOption(option));\r\n },\r\n onClickLogin: () => dispatch(commonSlice.actions.loginOptionsPage()),\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (\r\n option: ContentHeaderOptionItem | LibrarySections\r\n ) => {\r\n const { name } = option as ContentHeaderOptionItem;\r\n\r\n if (name && name === \"Adicionar Lista\") {\r\n return dispatch(\r\n commonSlice.actions.goToLibraryPage(\r\n option as unknown as LibrarySections\r\n )\r\n );\r\n }\r\n return dispatch(\r\n contentSlice.actions.goToContentInfo(\r\n option as unknown as ContentHeaderOptionItem\r\n )\r\n );\r\n },\r\n onRemoveRating: () => {\r\n dispatch(unRateActiveContent(\"\"));\r\n console.log(\"Event dispatch\");\r\n },\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n onClickReadSample: () =>\r\n dispatch(openContent([ContentType.Epub, ContentType.Pdf])),\r\n onClickReadEpub: () => dispatch(openContent([ContentType.Epub])),\r\n onClickReadPdf: () => dispatch(openContent([ContentType.Pdf])),\r\n onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n onSelectedEditionEpub: (content: Content) =>\r\n dispatch(loadAndOpenContent(content.uid)),\r\n onRate: (rate: number) => dispatch(rateActiveContent(rate)),\r\n onDownloadContent: (reference: ContentReference) =>\r\n dispatch(downloadContentReference(reference.uid)),\r\n onDeleteContent: (reference: ContentReference) =>\r\n dispatch(deleteContentReference(reference.uid)),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n onSelectedContent: (content) => {\r\n if (!content.uid) return;\r\n\r\n dispatch(showContentDetail(content.uid));\r\n },\r\n onCreateList: () => dispatch(createTagPage()),\r\n onSelectItemChange: (item: ReadingListItem, status: boolean) => {\r\n if (status) {\r\n dispatch(insertInTagActiveContent(item.uid));\r\n } else {\r\n dispatch(removeFromTagActiveContent(item.uid));\r\n }\r\n },\r\n onClickFavorite(content, isFavorite) {\r\n if (isFavorite) {\r\n return dispatch(removeFromFavorite(content));\r\n }\r\n return dispatch(insertInFavorite(content));\r\n },\r\n onNavigateToContentLink(contentLink, contentType) {\r\n dispatch(activeContentAnchor({ contentLink, contentType}))\r\n }\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageBookDetail = connect(mapState, mapDispatch)(Wrapper);\r\n\r\nexport { WPageBookDetail };\r\n","import { Category } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\n\r\nexport const hasCategory = (uid: string, rootCategories: Category[]): boolean => {\r\n var result =\r\n rootCategories.find((category) => findCategory(uid, category)) != undefined;\r\n return result;\r\n };\r\n \r\nexport const findCategory = (\r\n uid: string,\r\n rootCategory: Category\r\n ): Category | undefined => {\r\n if (rootCategory.uid === uid) return rootCategory;\r\n \r\n for (const child of rootCategory.childs ?? []) {\r\n if (child.uid === uid) return child;\r\n \r\n var foundInChilds = findCategory(uid, child);\r\n if (foundInChilds) return foundInChilds;\r\n }\r\n \r\n return undefined;\r\n };","import { ContentServiceMock } from './contents/ContentServiceMock';\r\nimport { ContentServiceApi } from './contents/ContentServiceApi';\r\nimport { IContentService } from './contents/IContentService';\r\nimport { IUserService } from './user/IUserService';\r\nimport { UserServiceMock } from './user/UserServiceMock';\r\nimport { UserServiceApi } from './user/UserServiceApi';\r\nimport { IUserDataService } from './userData/IUserDataService';\r\nimport { UserDataServiceMock } from './userData/UserDataServiceMock';\r\nimport { UserDataServiceApi } from './userData/UserDataServiceApi';\r\n\r\nlet mockEnabled:boolean = false;\r\n\r\nconst ContentService: IContentService = mockEnabled ? new ContentServiceMock() : new ContentServiceApi();\r\nconst UserService:IUserService = mockEnabled ? new UserServiceMock() : new UserServiceApi();\r\nconst UserDataService:IUserDataService = mockEnabled ? new UserDataServiceMock() : new UserDataServiceApi();\r\n\r\nexport\r\n{\r\n ContentService,\r\n UserService,\r\n UserDataService\r\n}","import {\r\n Category,\r\n ContentGroup,\r\n ContentFilters,\r\n Content,\r\n ContentSummary,\r\n ContentDetail,\r\n ContentType,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n ContentRelatedRequest,\r\n CustomContentFilter,\r\n EntityData,\r\n IContentService,\r\n PostContentDetail,\r\n RemoteContentDetail,\r\n RemoteContentReference,\r\n RemoteSchema,\r\n SearchResult,\r\n} from \"./IContentService\";\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\nimport { ContentTypeV as ContentMimeType } from \"../../components/WPageBookDetail\";\r\nimport { hasCategory } from \"../../utilities/Categories\";\r\n\r\nexport class ContentServiceApi implements IContentService {\r\n async GetProgressRead(contentGroupId: string) {\r\n const url = `cms/v1.1/managed/content/group/uid/${contentGroupId}/interactions`;\r\n return await Sdk.Api.dynamic\r\n .bridge(url, null, \"GET\")\r\n .then(res => res)\r\n .catch((err) => {\r\n console.log(err);\r\n });\r\n }\r\n async donwloadNow(): Promise {\r\n const references = [\r\n {\r\n uid: \"1\",\r\n format: ContentMimeType.EPUB,\r\n downloadProgress: 0,\r\n },\r\n {\r\n uid: \"2\",\r\n format: ContentMimeType.PDF,\r\n downloadProgress: 0,\r\n },\r\n ];\r\n const epubReference = references.find((ref) => ref.format === ContentMimeType.EPUB);\r\n \r\n if (epubReference) {\r\n epubReference.downloadProgress = 0;\r\n\r\n // const interval = setInterval(() => {\r\n // epubReference.downloadProgress += 10;\r\n\r\n // if (epubReference.downloadProgress >= 100) {\r\n // clearInterval(interval);\r\n // }\r\n // const dispatch = useDispatch();\r\n\r\n // dispatch(updateDownloadProgress(references));\r\n // }, 26000);\r\n }\r\n const delay = (ms: any) => new Promise((resolve) => setTimeout(resolve, ms));\r\n\r\n await delay(4000);\r\n return references;\r\n }\r\n\r\n async Schemas(): Promise {\r\n var schemas = await this.LoadSchemas();\r\n\r\n for (const schema of schemas) {\r\n const entities = await this.LoadEntities(schema);\r\n schema.categories = entities.map((p) => this.ToCategory(p));\r\n }\r\n\r\n return schemas;\r\n }\r\n\r\n async MostWantedContents(): Promise {\r\n var query = \"order_consumption=desc&page_size=6\";\r\n\r\n if (Sdk.Api.authorization.credential != null) {\r\n query += \"&only_new_contents=true\";\r\n }\r\n\r\n var contents = await this.Contents({ customQuery: query });\r\n return contents.result;\r\n\r\n // return {\r\n // books: contents.result,\r\n // title: \"Os mais buscados\",\r\n // uid: \"maisbuscados\",\r\n // };\r\n }\r\n\r\n async RelatedContents(info: ContentRelatedRequest): Promise {\r\n var query = `exclude_content=${info.content.uid}&order_consumption=desc&page_size=6`;\r\n\r\n if (Sdk.Api.authorization.credential != null) {\r\n query += \"&only_new_contents=true\";\r\n }\r\n\r\n var entityTypeCategory = info.content.entities?.filter((e)=> hasCategory(e.entityUid, info.categoriesAvailableForUser));\r\n entityTypeCategory?.forEach((e) => (query += `&all_entity=${e.entityUid}`));\r\n\r\n var contents = await this.Contents({ customQuery: query });\r\n\r\n return contents.result;\r\n // return {\r\n // books: contents.result,\r\n // title: \"Quem leu também gostou\",\r\n // uid: \"tbmgostou\",\r\n // };\r\n }\r\n\r\n async SuggestedContents(): Promise {\r\n var query = \"order_consumption=desc&only_new_contents=true&page_size=6\";\r\n\r\n var contents = await this.Contents({ customQuery: query });\r\n return contents.result;\r\n // return {\r\n // books: contents.result,\r\n // title: \"Você pode gostar\",\r\n // uid: \"podegostar\",\r\n // };\r\n }\r\n\r\n async HistoryContents(): Promise {\r\n if(!Sdk.Api.authorization.authenticated) return [];\r\n \r\n var url = `cms/v1.1/managed/content/history?page_size=6&order=desc&include_properties=true&include_entities=true`;\r\n var response: any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var uids: string[] = [];\r\n var contents = response.result\r\n .filter((value: any) => {\r\n var notFound = uids.indexOf(value.uid) == -1;\r\n if (notFound) uids.push(value.uid);\r\n\r\n return notFound;\r\n })\r\n const promises: Promise[] = [];\r\n\r\n contents.forEach((contentGroup: any) => {\r\n promises.push(this.GetProgressRead(contentGroup.uid))\r\n })\r\n\r\n var result = contents.map((data: any) => this.ToContent(data));\r\n\r\n await Promise.all(promises).then((interactions) => {\r\n result = result.map((item: any, i: number) => ({ \r\n ...item,\r\n interactions: interactions[i]\r\n }))\r\n });\r\n\r\n return result;\r\n }\r\n\r\n async ReviewContents(): Promise {\r\n var url = `cms/v1.1/managed/content/history?page_size=6&order=desc&include_properties=true&include_entities=true&page=2`;\r\n var response: any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var uids: string[] = [];\r\n var result = response.result\r\n .filter((value: any) => {\r\n var notFound = uids.indexOf(value.uid) == -1;\r\n if (notFound) uids.push(value.uid);\r\n\r\n return notFound;\r\n })\r\n .map((data: any) => this.ToContent(data));\r\n\r\n return result;\r\n }\r\n\r\n async ContentDetailResumed(contentUid: string): Promise {\r\n var url = `cms/v1.1/managed/content/group/uid/${contentUid}`;\r\n var response: any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var result: RemoteContentDetail = this.ToContentComplete(response);\r\n return result;\r\n }\r\n\r\n async ContentDetail(contentUid: string): Promise \r\n {\r\n var url = `cms/v1.1/managed/content/group/uid/${contentUid}`;\r\n var response: any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n\r\n var result: RemoteContentDetail & { fullReview?: any } = this.ToContentComplete(response);\r\n\r\n const userScore= `cms/v1.1/evaluation/managedContent/uid/${contentUid}/score/user`\r\n await Sdk.Api.dynamic.bridge(userScore, null, 'GET')\r\n .then(userScoreResponse => {\r\n if(userScoreResponse.length > 0) \r\n {\r\n const [review] = userScoreResponse\r\n result.fullReview = review.uid;\r\n result.userEvaluation = userScoreResponse.pop().note\r\n }\r\n else {\r\n result.userEvaluation = undefined;\r\n result.fullReview = undefined;\r\n }\r\n });\r\n\r\n try{\r\n const contentScore= `cms/v1.1/evaluation/managedContent/uid/${contentUid}/score`\r\n const contentScoreResponse = await Sdk.Api.dynamic.bridge(contentScore, null, 'GET');\r\n result.evaluation = contentScoreResponse.result;\r\n }catch(e)\r\n {\r\n result.evaluation = \"0\";\r\n }\r\n\r\n return result;\r\n }\r\n\r\n async Contents(\r\n filter?: CustomContentFilter | undefined\r\n ): Promise {\r\n var url = `cms/v1.1/managed/content/available?include_properties=true&include_entities=true`;\r\n\r\n if (filter?.category) url += `&any_entity=${filter.category.uid}`;\r\n if (filter?.query) url += `&search=${filter.query}`;\r\n if (filter?.customQuery) url += `&${filter.customQuery}`;\r\n\r\n var response: any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var data = response.result.map((data: any) => this.ToContent(data));\r\n\r\n var result: SearchResult = {\r\n page: response.current_page,\r\n pageSize: response.page_size,\r\n nextQuery: response.next_page_query,\r\n totalResult : response.total_results,\r\n result: data,\r\n };\r\n\r\n return result;\r\n }\r\n\r\n ToContent(serverData: any, ignoreImageOptions?: boolean): RemoteContentDetail \r\n {\r\n var thumbLink = `cms/v1.1/managed/content/group/uid/${serverData.uid}/default/thumb`;\r\n \r\n if (!ignoreImageOptions) thumbLink = `${thumbLink}?image_options=width:200`;\r\n\r\n var thumbUrl = Sdk.Api.dynamic.bridgeUrl(thumbLink,null);\r\n \r\n var content: RemoteContentDetail = {\r\n uid: serverData.uid,\r\n title: serverData.name,\r\n author: serverData.properties && serverData.properties.find((p: any) => p.name === \"Autor\")?.value,\r\n description: !serverData.properties ? \"\" : serverData.properties.find(\r\n (p: any) => p.name === \"Descrição\"\r\n )?.value,\r\n readingTime: !serverData.properties ? \"\" : serverData.properties.find((p: any) => p.name === \"Tempo de leitura\") ?.value ?? \"Tempo não estimado\",\r\n edition: !serverData.properties ? \"\" : serverData.properties.find((p: any) => p.name === \"Número da edição\")?.value ?? serverData.properties.find((p: any) => p.name === \"Edição\")?.value,\r\n image: serverData.image,\r\n entities: serverData.entities?.map((p: any) => {\r\n var result: EntityData = {\r\n uid: p.uid,\r\n entityUid: p.entity_uid,\r\n };\r\n\r\n return result;\r\n }),\r\n };\r\n\r\n if (!content.image) content.image = thumbUrl;\r\n\r\n return content;\r\n }\r\n\r\n async ContentSummary(serverData: RemoteContentDetail): Promise {\r\n let pdfSummary: ContentSummary[] = [];\r\n let epubSummary: ContentSummary[] = [];\r\n \r\n if (serverData.references && Array.isArray(serverData.references)) {\r\n for (const reference of serverData.references) {\r\n if (reference.mimeType === \"application/epub+zip\") {\r\n epubSummary = await this.getEpubSummary(reference.uid);\r\n pdfSummary = pdfSummary.map((item) => ({ ...item, type: \"pdf\" })); \r\n } else if (reference.mimeType === \"digitalpages/richpack\") {\r\n pdfSummary = await this.getPdfSummary(reference.uid);\r\n // epubSummary = pdfSummary.map((item) => ({...item, type: \"pub\"}));\r\n }\r\n }\r\n }\r\n \r\n const result: ContentSummary[] = [...pdfSummary, ...epubSummary];\r\n\r\n return result;\r\n }\r\n\r\n async getPdfSummary(uid: string): Promise {\r\n const response = await this.GetPdfSummary(uid);\r\n const pdfSummary: ContentSummary[] = this.ToPdfSummary(response, \"pdf\");\r\n return this.uniqueContentSummary(pdfSummary);\r\n }\r\n\r\n async getEpubSummary(uid: string): Promise {\r\n const response = await this.GetEpubSummary(uid);\r\n const epubSummary: ContentSummary[] = this.ToEpubSummary(response, \"pub\");\r\n const unique = this.uniqueContentSummary(epubSummary);\r\n return unique;\r\n }\r\n \r\n summaryFormater(contentSummary: any[]) {\r\n return contentSummary.filter(item => item && item.title.length);\r\n };\r\n\r\n uniqueContentSummary(contentSummary: any[]): any[] {\r\n return contentSummary.reduce((prev, current) => {\r\n if (\r\n !prev.some(\r\n (x: { title: any; type: any }) =>\r\n x.title === current.title && x.type === current.type\r\n )\r\n ) {\r\n return [...prev, current];\r\n }\r\n return prev;\r\n }, []);\r\n }\r\n\r\n async GetEpubSummary(uid: string): Promise> {\r\n var result: HTMLCollectionOf;\r\n\r\n try {\r\n var url = `cms/v1.1/managed/content/reference/uid/${uid}/default/target`;\r\n var response: any = Sdk.Api.dynamic.bridgeUrl(url, null);\r\n \r\n let contentToc = await fetch(response);\r\n var contentTocUrl = contentToc.url.replace(\"content.opf?\", \"toc.ncx?\");\r\n \r\n var manifest = await fetch(contentTocUrl).then((p) => p.text());\r\n \r\n const parser = new DOMParser();\r\n const xml = parser.parseFromString(manifest, \"text/xml\");\r\n result = xml.getElementsByTagName(\"navPoint\");\r\n return result;\r\n }\r\n catch(err) {\r\n console.log(err);\r\n }\r\n\r\n throw Error('')\r\n }\r\n\r\n async GetPdfSummary(uid: string): Promise {\r\n var url = `cms/v1.1/managed/content/reference/uid/${uid}/default/target`;\r\n var response: any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n\r\n if (response && response.sections) {\r\n return response;\r\n }\r\n if (response && response.json) {\r\n return await response.json();\r\n }\r\n\r\n return null;\r\n }\r\n\r\n async GetContentReferenceTarget(uid: string): Promise {\r\n var url = `cms/v1.1/managed/content/reference/uid/${uid}/default/target`;\r\n var response: any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n\r\n return response;\r\n }\r\n\r\n ToPdfSummary(serverData: any, summary_type: string): any {\r\n var result: any[] = [];\r\n\r\n if(serverData && serverData.sections) {\r\n var pageSets = serverData.sections[0].pageSets;\r\n\r\n for (const pageSet of pageSets) {\r\n const navLink = { \r\n page: pageSet.orderIndex,\r\n section: pageSet.sectionIndex\r\n };\r\n\r\n result.push({\r\n type: summary_type,\r\n uid: pageSet.portrait.linkPage,\r\n title: pageSet.portrait.bookmark,\r\n navLink: JSON.stringify(navLink)\r\n });\r\n }\r\n }\r\n \r\n return result;\r\n }\r\n\r\n ToEpubSummary(\r\n serverData: HTMLCollectionOf,\r\n summary_type: string\r\n ): any {\r\n var result: any[] = [];\r\n\r\n let removeExtraSpace = (s: string | null) =>\r\n s\r\n ?.trim()\r\n .split(/ +/)\r\n .join(\" \")\r\n .replace(/(\\r\\n|\\n|\\r)/gm, \"\");\r\n\r\n const values = Array.from(serverData).map((navPoint) => {\r\n const [content] = navPoint.getElementsByTagName('content');\r\n const navLink = content.getAttribute('src');\r\n result.push({\r\n type: \"pub\",\r\n uid: navPoint.id.toString(),\r\n title: removeExtraSpace(navPoint.textContent),\r\n navLink,\r\n });\r\n });\r\n\r\n return result;\r\n }\r\n\r\n ToContentComplete(serverData: any): RemoteContentDetail {\r\n var content = this.ToContent(serverData, false);\r\n var result: RemoteContentDetail = {\r\n ...content,\r\n author: serverData.properties.find((p: any) => p.name === \"Autor\")?.value ?? \"-\" ,\r\n description: serverData.description,\r\n readingTime:\r\n serverData.properties.find((p: any) => p.name == \"Tempo de leitura\")\r\n ?.value ?? \"Tempo não estimado\",\r\n evaluation: \"0\",\r\n references: serverData.references.map((p: any) => {\r\n return this.ToContentReference(p);\r\n }),\r\n };\r\n return result;\r\n }\r\n\r\n ToContentReference(serverData: any): RemoteContentReference \r\n {\r\n var reference: RemoteContentReference = {\r\n uid: serverData.uid,\r\n mimeType: serverData.mime_type,\r\n products: [],\r\n url: Sdk.Api.dynamic.bridgeUrl(\r\n `cms/v1.1/managed/content/reference/uid/${serverData.uid}/content`,\r\n null\r\n ),\r\n downloadProgress: serverData.download_progress,\r\n };\r\n\r\n if (serverData.mime_type.indexOf(\"epub\") != -1)\r\n {\r\n reference.format = ContentType.EPUB;\r\n }\r\n else{\r\n reference.format = ContentType.PDF;\r\n }\r\n\r\n return reference;\r\n }\r\n\r\n ToCategory(entity: any): Category {\r\n var defaultColor = \"#084c8a\";\r\n\r\n if (entity.data.Cor && entity.data.Cor.length > 0) {\r\n defaultColor = entity.data.Cor;\r\n }\r\n\r\n var result: Category = {\r\n uid: entity.uid,\r\n label: entity.name,\r\n backgroundColor: defaultColor,\r\n childs: [],\r\n };\r\n\r\n if (entity.childs) {\r\n for (const child of entity.childs) {\r\n const childCategory = this.ToCategory(child);\r\n result.childs?.push(childCategory);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n async LoadSchemas(): Promise {\r\n var url = `auth/v1.1/entity/schema/available?type=category`;\r\n var response: RemoteSchema[] = await Sdk.Api.dynamic.bridge(\r\n url,\r\n null,\r\n \"GET\"\r\n );\r\n\r\n return response;\r\n }\r\n\r\n async LoadEntities(schema: any): Promise {\r\n var url = `auth/v1.1/entity/schema/uid/${schema.uid}/items/tree`;\r\n var response: any[] = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n return response;\r\n }\r\n\r\n async GetUserEvaluation(contentId: string): Promise {\r\n const url = `review/managedContent/uid//score/user`\r\n const result = Sdk.Api.dynamic.bridge(url, null, 'GET')\r\n return result\r\n}\r\n\r\n}\r\n","import { ProjectItem } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { AuthSSOParams, IUserService, ParamsSSO, User, UserRegisterData } from \"./IUserService\";\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\nimport { Profile } from \"senac-components/dist/pages/Mobile/PageMyProfile\";\r\nimport { ContactUsForm } from \"senac-components/dist/pages/Mobile/PageContactUs\";\r\nimport { cpfValidator } from \"../../utilities/Cpf\";\r\nimport { ERRORS } from \"../../utilities/constants/errors\";\r\n\r\nexport class UserServiceApi implements IUserService\r\n{\r\n async AuthenticateSSOFromProvision(params: AuthSSOParams): Promise {\r\n try {\r\n await Sdk.Api.authorization.signinProvisionSSO(params);\r\n\r\n const serverUser = await Sdk.Api.authorization.userInfo();\r\n\r\n return {\r\n uid : serverUser.uid,\r\n name : serverUser.detail.name,\r\n email: serverUser.detail.email_principal,\r\n cpf : serverUser.detail.cpf,\r\n phone: serverUser.detail.phone_principal,\r\n login: serverUser.login,\r\n } as User\r\n\r\n } catch (err) {\r\n console.log(err);\r\n return undefined;\r\n }\r\n }\r\n\r\n CreatePassword = async (token: string, password: string): Promise => {\r\n\r\n const result = await Sdk.Api.dynamic.bridge('/auth/v1.0/user/reset/password/token', { token, password }, \"POST\").then(res => res).catch(err => err)\r\n\r\n if(result?.message === 'Senha redefinida com sucesso!') return 200;\r\n\r\n return result.status;\r\n\r\n }\r\n\r\n checkExpiredDate = (date: string) => {\r\n try {\r\n const currentDate = new Date();\r\n const dateCompare = new Date(date);\r\n return dateCompare < currentDate;\r\n }\r\n catch(err) {\r\n return true;\r\n }\r\n }\r\n\r\n async AnonymousSignIn(project?: string): Promise {\r\n const projectUid = project ?? Sdk.Api.authorization.activeProjectUid\r\n const currentAnonymous = (Sdk.Api.authorization as any).credentialAnonymous;\r\n await Sdk.Api.authorization.signinByProjectAnonymous(projectUid);\r\n if(!projectUid) return;\r\n\r\n if(!currentAnonymous || this.checkExpiredDate(currentAnonymous?.expiredDate)) {\r\n await Sdk.Api.authorization.signinByProjectAnonymous(projectUid);\r\n }\r\n }\r\n\r\n async SentContactUs(contact: ContactUsForm): Promise\r\n {\r\n let sendData = {\r\n support : {\r\n user : {\r\n name : contact.name,\r\n email: contact.email,\r\n phone: contact.telefone,\r\n },\r\n title: contact.assunto,\r\n message: contact.message\r\n }\r\n }\r\n\r\n const url = `auth/v1.1/directory/request/customers`;\r\n let serverUser = await Sdk.Api.dynamic.bridge(url, sendData, \"POST\");\r\n\r\n\r\n let data:ContactUsForm = {\r\n name : contact.name,\r\n email: contact.email,\r\n telefone: contact.telefone,\r\n assunto: contact.assunto,\r\n message: contact.message\r\n }\r\n\r\n return data;\r\n }\r\n\r\n\r\n async UpdatedProfile(profile: Profile): Promise {\r\n\r\n const url = `auth/v1.0/user/me`;\r\n const formatedCpf = (profile.cpf ?? '').replaceAll('.', '').replace('-', '');\r\n const [first, last] = (profile.name ?? '').split(' ');\r\n\r\n let data = {\r\n login: formatedCpf,\r\n detail: {\r\n name : profile.name,\r\n email_principal: profile.email,\r\n phone_principal: profile.phone,\r\n cpf: formatedCpf,\r\n first_name: first ?? '',\r\n last_name: last ?? '',\r\n }\r\n }\r\n\r\n let serverUser = await Sdk.Api.dynamic.bridge(url, data, \"PUT\").catch((err) => {\r\n if (err.status === 400) {\r\n throw new Error(ERRORS.USER_UPDATING_ERROR_BECAUSE_CPF_ALREADY_REGISTERED);\r\n }\r\n })\r\n\r\n Sdk.Api.authorization.updateUserState(data)\r\n\r\n var result:User = {\r\n uid : serverUser.uid,\r\n name : serverUser.detail.name,\r\n email: serverUser.detail.email_principal,\r\n cpf : serverUser.detail.cpf,\r\n phone: serverUser.detail.phone_principal,\r\n login: serverUser.login,\r\n }\r\n\r\n return result;\r\n\r\n}\r\n\r\n\r\n\r\n async ChangePassword(newPassword: string, currentPassword?: string): Promise {\r\n\r\n const url = `auth/v1.0/user/reset/password`;\r\n\r\n let data = {\r\n password: newPassword,\r\n current_password: currentPassword\r\n }\r\n\r\n await Sdk.Api.dynamic.bridge(url, data, \"POST\");\r\n }\r\n\r\n\r\n async ProjectsAvailable(login: string): Promise\r\n {\r\n const url = `auth/v1.1/directory/user/login/projects/available?login=${encodeURIComponent(login)}&ignore_user_context=false`;\r\n const projects:any[] = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n const result = projects.map(p=>\r\n {\r\n var data:ProjectItem = {\r\n uid : p.uid,\r\n name : p.name\r\n }\r\n\r\n return data;\r\n })\r\n\r\n return result;\r\n }\r\n\r\n async ProjectsFromLogin(login: string) {\r\n const connector = this.getConnectorLibraryMigration();\r\n const url = `cms/v1.1/bridge/connector/uid/${connector}/available?login=${login}`;\r\n\r\n const result = await Sdk.Api.dynamic.bridge(url, null, 'POST');\r\n\r\n if (!result || !result.possible_accounts) {\r\n throw new Error('Nenhuma organização encontrada');\r\n }\r\n\r\n return {\r\n organizations: result.possible_accounts.map((item: any, index: number) => ({\r\n login: item.login,\r\n uid: item.organizationId ?? item.organization_id,\r\n name: item.organizationName ?? item.organization_name ?? `Organização ${index + 1}`,\r\n migrated: false,\r\n }))\r\n }\r\n }\r\n\r\n async SendForgotPasswordLibrary(params: { login: string; organization: string; }): Promise {\r\n try {\r\n\r\n const myHeaders = new Headers();\r\n myHeaders.append(\"Content-Type\", \"application/x-www-form-urlencoded; charset=UTF-8\");\r\n myHeaders.append(\"Ocp-Apim-Subscription-Key\", \"c748f0afd1834f188e87c33a3d8160c3\");\r\n\r\n const raw = `user%5Bemail%5D=${params.login}&user%5Borganization_id%5D=${params.organization}`;\r\n // const successRawMock = `user%5Bemail%5D=paulo.inoue@digitalpages.com.br&user%5Borganization_id%5D=27`\r\n const requestOptions = {\r\n method: \"POST\",\r\n headers: myHeaders,\r\n body: raw,\r\n };\r\n\r\n return await fetch(\"https://api.digitalpages.com.br/library/users/password.json\", requestOptions)\r\n .then((response) => response.json())\r\n .then((result) => {\r\n if (result.errors) {\r\n throw new Error('Erro ao tentar realizar solicitação.')\r\n }\r\n\r\n return result;\r\n })\r\n .catch((error) => {\r\n throw new Error('Erro ao tentar realizar solicitação.')\r\n });\r\n }\r\n catch(err) {\r\n throw new Error('Erro ao tentar realizar solicitação.')\r\n }\r\n }\r\n async GetUserPreferences() {\r\n try {\r\n const preferences = await Sdk.Api.dynamic.bridge('auth/v1.0/user/me/preferences', null, \"GET\")\r\n return preferences;\r\n }\r\n catch(err) {\r\n console.log(err);\r\n return [];\r\n }\r\n };\r\n\r\n async GetProjects() {\r\n const result = await Sdk.Api.dynamic.bridge(`auth/v1.0/projects`, null, 'GET');\r\n return result || [];\r\n };\r\n\r\n async CretePreference(params = { key: \"first_access\", \"value\": Date.now() as any}) {\r\n const result = await Sdk.Api.dynamic.bridge(`auth/v1.0/user/me/preferences`, { ...params, \"expire_at\": null}, \"POST\")\r\n return result;\r\n }\r\n\r\n async GetUserLoginDetails() {\r\n try {\r\n const preferences = await this.GetUserPreferences();\r\n const firstLogin = (preferences || []).find((item: any) => item.key === 'first_access');\r\n if (!firstLogin) {\r\n this.CretePreference();\r\n }\r\n const projects = await this.GetProjects();\r\n\r\n return {\r\n projects,\r\n firstLogin: Boolean(firstLogin),\r\n preferences,\r\n }\r\n }\r\n catch(err) {\r\n return {} as any;\r\n }\r\n }\r\n\r\n async GetUserAuthFlow(result: any) {\r\n await Sdk.Api.authorization.signinByCredential(result);\r\n const preferences = await this.GetUserPreferences();\r\n const firstLogin = (preferences || []).find((item: any) => item.key === 'first_access');\r\n if (!firstLogin) {\r\n this.CretePreference();\r\n }\r\n const projects = await this.GetProjects();\r\n\r\n const serverUser = await Sdk.Api.authorization.userInfo();\r\n\r\n if (!serverUser) throw Error();\r\n\r\n var user: User = {\r\n uid : serverUser.uid,\r\n name : serverUser.detail.name,\r\n email: serverUser.detail.email_principal,\r\n cpf : serverUser.detail.cpf,\r\n phone: serverUser.detail.phone_principal,\r\n login: serverUser.login,\r\n }\r\n\r\n return {\r\n user,\r\n organizations: result.organizations ?? [],\r\n firstLogin: !Boolean(firstLogin),\r\n preferences,\r\n projects,\r\n };\r\n };\r\n\r\n async Authenticate(login: string, password: string, ignoreContext?: boolean): Promise\r\n {\r\n try {\r\n await Sdk.Api.authorization.signinByLogin(login, password, ignoreContext);\r\n\r\n if (Sdk.Api.authorization.user) {\r\n const serverUser = await Sdk.Api.authorization.userInfo();\r\n var result:User = {\r\n uid : serverUser.uid,\r\n name : serverUser.detail.name,\r\n email: serverUser.detail.email_principal,\r\n cpf : serverUser.detail.cpf,\r\n phone: serverUser.detail.phone_principal,\r\n login: serverUser.login,\r\n }\r\n return result;\r\n }\r\n\r\n return null as any;\r\n }\r\n\r\n catch(err) {\r\n return null as any;\r\n }\r\n }\r\n\r\n async AuthenticateSSO({ login, organization, token }: ParamsSSO): Promise {\r\n const connectorId = this.getConnectorLibraryMigration();\r\n\r\n if (!connectorId) {\r\n throw new Error('Ocorreu um erro de configuração');\r\n }\r\n\r\n const route = `/cms/v1.1/bridge/connector/uid/${connectorId}/sso?login=${login}&organization_id=${organization}&token=${token}`;\r\n\r\n const result = await Sdk.Api.dynamic.bridge(route, null, 'POST').catch(err => {\r\n throw new Error(err.status)\r\n })\r\n\r\n const userData = await this.GetUserAuthFlow(result);\r\n\r\n return userData\r\n }\r\n\r\n getConnectorLibraryMigration() {\r\n const connector = Sdk.Api.authorization.activeProject?.connectors?.find((item: any) =>\r\n (item.iternal_name === \"LibraryMigration\" || item.name === \"SenacMigration\"));\r\n\r\n const uid = connector?.uid;\r\n\r\n return uid;\r\n }\r\n\r\n async SigninDefault(login: string, password: string, ignoreContext?: boolean) {\r\n const userResult = await this.Authenticate(login, password, ignoreContext);\r\n if (userResult) {\r\n const details = await this.GetUserLoginDetails();\r\n return {\r\n user: userResult,\r\n ...(details || {}),\r\n }\r\n }\r\n else {\r\n throw new Error('Erro ao tentar efetuar autenticação');\r\n }\r\n }\r\n\r\n async SigninMigrationFlow(login: string, password: string, acessToken?: string, organization?: string): Promise {\r\n if (!acessToken && !organization) {\r\n const userResult = await this.Authenticate(login, password);\r\n if (userResult) {\r\n const details = await this.GetUserLoginDetails();\r\n return {\r\n user: userResult,\r\n ...(details || {}),\r\n }\r\n }\r\n }\r\n\r\n const uid = this.getConnectorLibraryMigration();\r\n\r\n if (!uid) throw new Error('Senha inválida');\r\n\r\n let url = `cms/v1.1/bridge/connector/uid/${uid}/login?login=${login}&password=${password}`;\r\n\r\n if (acessToken && organization) {\r\n url = `${url}&organization_id=${organization}&access_token=${acessToken}`\r\n };\r\n\r\n const result = await Sdk.Api.dynamic.bridge(url, null, 'POST')\r\n .then((res) => {\r\n return {\r\n ...res,\r\n organizations: (res.possible_accounts ?? []).map((item: any, index: number) => ({\r\n login: item.login,\r\n uid: item.organizationId ?? item.organization_id,\r\n name: item.organizationName ?? item.organization_name ?? `Organização ${index + 1}`,\r\n migrated: false,\r\n }))\r\n }\r\n })\r\n .catch(err => {\r\n console.log(err)\r\n })\r\n if (result) {\r\n const data = await this.GetUserAuthFlow(result);\r\n return data;\r\n }\r\n\r\n if (!Sdk.Api.authorization.user) throw Error();\r\n\r\n };\r\n\r\n async SigninSsoAfterAuthentication({ login, password, organization, token, initialLogin, path }: any) {\r\n await this.SigninMigrationFlow(login, password);\r\n\r\n const user = await this.AuthenticateSSO({ login: initialLogin ?? login, organization, token, path })\r\n\r\n return user;\r\n }\r\n async SendOrganization(login: string, password: string, organization: string): Promise {\r\n const auth = Sdk.Api.authorization?.credential?.accessToken;\r\n\r\n if (!auth) return false;\r\n\r\n const result = await this.SigninMigrationFlow(login, password, auth, organization);\r\n\r\n if (result) return result;\r\n\r\n return false;\r\n }\r\n\r\n async SendUniqueLogin(login: string): Promise {\r\n\r\n };\r\n\r\n async SendCPFOrEmail(value: string): Promise {\r\n\r\n };\r\n\r\n async ActiveUser(): Promise\r\n {\r\n const serverUser = await Sdk.Api.authorization.user;\r\n if (!serverUser) return undefined;\r\n var result:User = {\r\n uid : serverUser.uid,\r\n name : serverUser.detail?.name,\r\n email: serverUser.detail?.email_principal,\r\n cpf : serverUser.detail?.cpf,\r\n phone: serverUser.detail?.phone_principal,\r\n login: serverUser.login,\r\n }\r\n\r\n console.log(result);\r\n return result;\r\n }\r\n\r\n async Logout(): Promise\r\n {\r\n await Sdk.Api.authorization.logout();\r\n }\r\n\r\n async RecoverPassword(login:string): Promise\r\n {\r\n var response = await Sdk.Api.dynamic.bridge(`/auth/v1.1/user/password/forgot?login=${encodeURIComponent(login)}`, {}, \"POST\");\r\n return response;\r\n }\r\n\r\n async CheckUniqueLogin (login: string) {\r\n await Sdk.Api.dynamic.bridge(`/auth/v1.1/user/login/check?login=${login}`, null, 'POST')\r\n .catch(() => {\r\n throw new Error(\"O CPF informado já está sendo utilizado na plataforma.\")\r\n })\r\n };\r\n\r\n async RegisterUser (data: UserRegisterData) : Promise\r\n {\r\n const validCPF = cpfValidator(data.cpf);\r\n\r\n if(!validCPF) throw new Error('O CPF informado é inválido! Não foi possível registrar o usuário.');\r\n\r\n await this.CheckUniqueLogin(data.cpf)\r\n\r\n var connector = Sdk.Api.authorization.activeProject.connectors\r\n .find((connector: any) =>\r\n connector.features?.find((f: string) => f === \"IConnectorUserDirectRegister\") !== undefined\r\n );\r\n\r\n const [first, last] = (data.name ?? '').split(' ');\r\n\r\n var serverUser = await Sdk.Api.dynamic.bridge(`/auth/v1.1/register/connector/uid/${connector.uid}/direct`, {\r\n login : data.cpf,\r\n password: data.password,\r\n detail : {\r\n email_principal : data.email,\r\n cpf: data.cpf,\r\n name: data.name,\r\n phone_principal: (data as any).phone,\r\n first_name: first ?? '',\r\n last_name: last ?? '',\r\n }\r\n }, 'POST');\r\n\r\n var result:User = {\r\n uid : serverUser.uid,\r\n name : serverUser.detail.name,\r\n email: serverUser.detail.email_principal,\r\n cpf : serverUser.detail.cpf,\r\n phone: serverUser.detail.phone_principal,\r\n login: serverUser.login,\r\n }\r\n\r\n return result;\r\n }\r\n}","import { Content, ContentType } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { IUserDataService, RemoteUserData, TagData } from \"./IUserDataService\";\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\nimport { ContentService } from \"..\";\r\nimport { EntityData, RemoteContentDetail, RemoteContentReference } from \"../contents/IContentService\";\r\n\r\nexport class UserDataServiceApi implements IUserDataService\r\n{\r\n async TagsAvailable(): Promise \r\n {\r\n var url = `cms/v1.1/user/data/tags`;\r\n var response:any[] = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var result:TagData[] = response.map(p=> this.ToTagData(p));\r\n\r\n return result;\r\n }\r\n\r\n async TagsSharedAvailable(): Promise \r\n {\r\n var url = `cms/v1.1/user/data/tags/shared`;\r\n var response:any[] = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var result:TagData[] = response.filter(p=> p.tag.active_share).map(p=> this.ToTagData(p.tag));\r\n\r\n return result;\r\n }\r\n\r\n async TagSubscribe(uid:string) : Promise\r\n {\r\n var url = `cms/v1.1/user/data/tag/uid/${uid}/clone`;\r\n return await Sdk.Api.dynamic.bridge(url, null, \"POST\");\r\n // var tagData = this.ToTagData(response.tag);\r\n\r\n // return tagData;\r\n }\r\n\r\n async TagCreate(item:TagData) : Promise\r\n {\r\n var connector = Sdk.Api.authorization.activeProject.connectors\r\n .find((connector:any)=>connector.features\r\n .find((f:string)=> f === \"IConnectorUserData\") !== undefined);\r\n\r\n var url = `cms/v1.1/user/connector/uid/${connector.uid}/tag`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, { name:item.name }, \"POST\");\r\n var tagData = this.ToTagData(response);\r\n\r\n // if (item.contents)\r\n // {\r\n // for (const content of item.contents) \r\n // {\r\n // await this.InsertContentInTagt(content, tagData);\r\n // if (!tagData.contents) tagData.contents=[];\r\n\r\n // tagData.contents.push(content);\r\n // }\r\n // }\r\n\r\n return tagData;\r\n }\r\n\r\n async TagUpdate(item:TagData) : Promise\r\n {\r\n var url = `cms/v1.1/user/tag/uid/${item.uid}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, { \r\n name:item.name,\r\n active_share:item.shareEnabled\r\n }, \"PUT\")\r\n\r\n var tagData = this.ToTagData(response);\r\n return tagData;\r\n }\r\n\r\n async TagDelete(item:TagData) : Promise\r\n {\r\n // console.log(\"ReadingListDelete\", item)\r\n var url = `cms/v1.1/user/tag/uid/${item.uid}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"DELETE\");\r\n\r\n return item;\r\n }\r\n\r\n async TagDataFromContent(content: Content): Promise \r\n {\r\n return [];\r\n }\r\n\r\n async UserDataAvailableShared() : Promise\r\n {\r\n var result:RemoteUserData[] = [];\r\n var page:number = 1;\r\n\r\n while(true)\r\n {\r\n var url = `cms/v1.1/user/data/shared?page=${page}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n\r\n for(var data of response.result)\r\n {\r\n var userData = this.ToUserData(data);\r\n result.push(userData);\r\n }\r\n\r\n if (!response.next_page_query) break;\r\n page++;\r\n }\r\n \r\n return result;\r\n }\r\n\r\n ///UserData\r\n\r\n async UserDataAvailable() : Promise\r\n {\r\n var result:RemoteUserData[] = [];\r\n var page:number = 1;\r\n\r\n while(true)\r\n {\r\n var url = `cms/v1.1/user/data?page=${page}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n\r\n for(var data of response.result)\r\n {\r\n var userData = this.ToUserData(data);\r\n\r\n if (userData.contextType == \"ManagedContent\" && userData.targetType == \"ManagedContent\" && (userData.tags == undefined || userData.tags.length == 0))\r\n {\r\n // try {\r\n // await this.RemoveUserData(userData);\r\n // }\r\n // catch(err) {\r\n // console.log(err)\r\n // }\r\n }else{\r\n result.push(userData);\r\n }\r\n }\r\n\r\n if (!response.next_page_query) break;\r\n page++;\r\n }\r\n \r\n return result;\r\n }\r\n\r\n async RemoveUserData(userData:RemoteUserData)\r\n {\r\n var url = `cms/v1.1/user/data/uid/${userData.uid}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"DELETE\");\r\n }\r\n\r\n async InsertContentInTagt(content:Content, tag:TagData) : Promise\r\n {\r\n var url = `cms/v1.1/user/data?context_type=ManagedContent&target_type=ManagedContent&target_uid=${content.uid}&context_uid=${content.uid}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var contens:any[] = response.result;\r\n\r\n if (contens.length == 0)\r\n {\r\n var connector = Sdk.Api.authorization.activeProject.connectors\r\n .find((connector:any)=>connector.features\r\n .find((f:string)=> f == \"IConnectorUserData\") != undefined);\r\n \r\n var url = `cms/v1.1/user/connector/uid/${connector.uid}/data`;\r\n \r\n response = await Sdk.Api.dynamic.bridge(url, { \r\n context_uid : content.uid, \r\n context_type: 'ManagedContent',\r\n target_uid : content.uid, \r\n target_type: 'ManagedContent',\r\n tags: [ { name: tag.name }]\r\n }, \"POST\")\r\n }else\r\n {\r\n var data = contens[0];\r\n var url = `cms/v1.1/user/data/uid/${data.uid}`;\r\n\r\n if (!data.tags) data.tags = [];\r\n\r\n var found = data.tags.find((p:any)=> p.name === tag.name);\r\n if (found) return this.ToUserData(data);\r\n\r\n data.tags.push({name:tag.name});\r\n response = await Sdk.Api.dynamic.bridge(url, data, \"PUT\");\r\n }\r\n\r\n return this.ToUserData(response);\r\n }\r\n\r\n async RemoveContentFromTag(content:Content, tag:TagData) : Promise\r\n {\r\n var result:RemoteUserData[] = [];\r\n\r\n var url = `cms/v1.1/user/data?context_type=ManagedContent&target_type=ManagedContent&target_uid=${content.uid}&context_uid=${content.uid}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var contens:any[] = response.result;\r\n\r\n for (const content of contens) {\r\n if (!content.tags) content.tags =[];\r\n\r\n content.tags = content.tags.filter((p:any)=> p.uid != tag.uid);\r\n var url = `cms/v1.1/user/data/uid/${content.uid}`;\r\n\r\n response = await Sdk.Api.dynamic.bridge(url, content, \"PUT\");\r\n \r\n var data = this.ToUserData(response);\r\n result.push(data);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n\r\n //////\r\n\r\n async ContentsFromTagData(content:TagData) : Promise\r\n {\r\n // console.log(\"FavoriteContents\")\r\n var result:Content[] = [];\r\n var page:number = 1;\r\n\r\n while(true)\r\n {\r\n var url = `cms/v1.1/user/data?context_type=ManagedContent&target_type=ManagedContent&page=${page}&tag_uid=${content.uid}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var contens:any[] = response.result;\r\n\r\n page++;\r\n if (contens.length == 0) break;\r\n\r\n for (const content of contens) \r\n {\r\n try\r\n {\r\n var contentDetail = await ContentService.ContentDetail(content.context_uid);\r\n result.push(contentDetail);\r\n }catch(e)\r\n {\r\n // console.log(e);\r\n }\r\n\r\n \r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n ToTagData(data:any) : TagData\r\n {\r\n var result: TagData = {\r\n uid : data.uid,\r\n name : data.name,\r\n shareCode : data.code_share,\r\n shareEnabled : data.active_share\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // Evaluate \r\n async PostUserEvaluation(contentUid: string, rate: number): Promise {\r\n const url = `cms/v1.1/evaluation/managedContent/uid/${contentUid}/score`\r\n const response = await Sdk.Api.dynamic.bridge(url, { note: rate }, 'POST')\r\n \r\n return response\r\n }\r\n async UpdateUserEvaluation(reviewUid: string, rate: number): Promise {\r\n const url = `cms/v1.1/evaluation/uid/${reviewUid}`\r\n const response = await Sdk.Api.dynamic.bridge(url, { note: rate }, 'PUT')\r\n \r\n return response\r\n }\r\n\r\n async DeleteUserEvaluation(reviewUid: string): Promise {\r\n const url = `cms/v1.1/evaluation/uid/${reviewUid}`\r\n const response = await Sdk.Api.dynamic.bridge(url, null, 'DELETE')\r\n \r\n return response\r\n }\r\n\r\n ///downloads\r\n\r\n\r\n async ContentDownload(contentReferenceUid:string) : Promise\r\n {\r\n var url = `content/uid/${contentReferenceUid}/download`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"POST\");\r\n\r\n return response.status;\r\n }\r\n\r\n async ContentDelete(contentReferenceUid:string) : Promise\r\n {\r\n var url = `content/uid/${contentReferenceUid}`;\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"DELETE\");\r\n\r\n return response.status;\r\n }\r\n\r\n async ContentDownloaded() : Promise>\r\n {\r\n var url = \"contents/downloaded\";\r\n var response:any = await Sdk.Api.dynamic.bridge(url, null, \"GET\");\r\n var result = this.ToContentReferences(response);\r\n\r\n return result\r\n }\r\n\r\n ToContentReferences(serverData:any) : RemoteContentDetail[]\r\n {\r\n var result: RemoteContentDetail[] = [];\r\n\r\n for (const reference of serverData) \r\n {\r\n var rr = this.ToContentReference(reference);\r\n var rg = this.ToContent(reference.content_group);\r\n\r\n var existRg = result.find(p=> p.uid == rg.uid);\r\n\r\n if (!existRg)\r\n {\r\n result.push(rg);\r\n existRg = rg;\r\n }\r\n \r\n if (!existRg.references) existRg.references = [];\r\n existRg.references.push(rr);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n ToContentReference(serverData:any) : RemoteContentReference\r\n {\r\n var format = ContentType.PDF;\r\n\r\n if (serverData.mime_type.indexOf(\"epub\") != -1)\r\n {\r\n format = ContentType.PDF;\r\n }\r\n \r\n var reference:RemoteContentReference = {\r\n url : Sdk.Api.dynamic.bridgeUrl(`cms/v1.1/managed/content/reference/uid/${serverData.uid}/content`, null),\r\n downloadProgress:serverData.download_progress,\r\n mimeType: serverData.mime_type,\r\n uid : serverData.uid,\r\n format: format,\r\n products : [],\r\n };\r\n\r\n return reference;\r\n }\r\n\r\n ToContent(serverData:any) : RemoteContentDetail\r\n {\r\n var thumbUrl = Sdk.Api.dynamic.bridgeUrl(`cms/v1.1/managed/content/group/uid/${serverData.uid}/thumb`, null);\r\n var content:RemoteContentDetail = \r\n {\r\n uid : serverData.uid,\r\n title : serverData.properties.find((p:any)=> p.name == \"Nome\")?.value,\r\n author : serverData.properties.find((p:any)=> p.name == \"Autor\")?.value,\r\n description : serverData.properties.find((p:any)=> p.name == \"Descrição\")?.value,\r\n readingTime : serverData.properties.find((p:any)=> p.name == \"Tempo de leitura\")?.value ?? \"Tempo não estimado\",\r\n image : serverData.image,\r\n entities : serverData.entities?.map((p:any)=> \r\n {\r\n var result:EntityData = {\r\n uid : p.uid,\r\n entityUid : p.entity_uid\r\n }\r\n\r\n return result;\r\n })\r\n }\r\n\r\n if (!content.image) content.image = thumbUrl;\r\n \r\n return content;\r\n }\r\n\r\n ToUserData(serverData:any) : RemoteUserData\r\n {\r\n var result: RemoteUserData = \r\n {\r\n uid : serverData.uid,\r\n annotation: serverData.annotation,\r\n contextType: serverData.context_type,\r\n contextUid: serverData.context_uid,\r\n description: serverData.description,\r\n externalData: serverData.external_data,\r\n externalType: serverData.external_type,\r\n externalUid: serverData.external_uid,\r\n name: serverData.name,\r\n targetType : serverData.target_type,\r\n targetUid: serverData.target_uid,\r\n tags: serverData.tags?.map((t:any)=> this.ToTagData(t))\r\n }\r\n\r\n return result;\r\n }\r\n}","import {\r\n createSlice,\r\n PayloadAction,\r\n createAsyncThunk,\r\n createAction,\r\n} from \"@reduxjs/toolkit\";\r\nimport { Middleware, MiddlewareAPI, Dispatch } from \"redux\";\r\nimport {\r\n Category,\r\n Content,\r\n ContentDetail,\r\n ContentFilters,\r\n ContentGroup,\r\n ContentHeaderOptionItem,\r\n ContentOptionAppointments,\r\n ContentOptionDetail,\r\n ContentOptionDownload,\r\n ContentOptionFavorite,\r\n ContentOptionFavorited,\r\n ContentOptionReadingList,\r\n ContentOptionSummary,\r\n ContentReference,\r\n ContentSummary,\r\n ContentType as ContentTypeMimeType,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { AppDispatch, RootState, Store } from \"..\";\r\nimport { ContentService } from \"../../services\";\r\nimport {\r\n ContentRelatedRequest,\r\n CustomContentFilter,\r\n EntityData,\r\n RemoteContentDetail,\r\n RemoteContentReference,\r\n} from \"../../services/contents/IContentService\";\r\nimport common, { commonSlice } from \"./common\";\r\nimport userDataSlice, {\r\n downloadedContents,\r\n historyContents,\r\n insertInFavorite,\r\n postUserEvaluation,\r\n removeFromFavorite,\r\n} from \"./userDataSlice\";\r\nimport { userSlice } from \"./userSlice\";\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\nimport { findCategory } from \"../../utilities/Categories\";\r\n\r\nexport enum DownloadActionTypes {\r\n START_DOWNLOAD = \"START_DOWNLOAD\",\r\n UPDATE_PROGRESS = \"UPDATE_PROGRESS\",\r\n DOWNLOAD_SUCCESS = \"DOWNLOAD_SUCCESS\",\r\n DOWNLOAD_FAILURE = \"DOWNLOAD_FAILURE\",\r\n}\r\n\r\ninterface ContentState {\r\n categories: Array;\r\n authors: Array;\r\n startDownload?: string;\r\n contentSummary?: Array;\r\n loadingSummary?: boolean;\r\n mostWantedContent?: string[];\r\n suggestedContent?: string[];\r\n\r\n activeSummary?: RemoteContentDetail;\r\n activeContentUid?: string;\r\n activeContentReference?: any;\r\n activeContentRelated?: string[];\r\n activeContentAnchorLink?: string;\r\n\r\n activeReview?: any;\r\n\r\n activeFilter?: CustomContentFilter;\r\n contentFromFilter?: string[];\r\n totalContentsFromFilter?: number;\r\n\r\n contentOption?: string;\r\n\r\n allContents: Array;\r\n\r\n progressDownload?: DownloadActionTypes;\r\n preferences?: Array;\r\n loadingRelateds?: boolean;\r\n summaryItem?: any;\r\n}\r\n\r\nexport enum ContentType {\r\n Epub = \"application/epub+zip\",\r\n Pdf = \"digitalpages/richpack\",\r\n Preference = \"\",\r\n}\r\n\r\nconst initialState: ContentState = {\r\n categories: [],\r\n authors: [],\r\n allContents: [],\r\n preferences: [],\r\n};\r\n\r\nexport const mostWantedContents = createAsyncThunk(\"contents/mostwanted\", () =>\r\n ContentService.MostWantedContents()\r\n);\r\n\r\nexport const suggestedContents = createAsyncThunk(\r\n \"contents/suggestedContents\",\r\n () => ContentService.SuggestedContents()\r\n);\r\n\r\nexport const loadContentDetail = createAction(\"content/detail/load\");\r\n\r\nexport const contentDetail = createAsyncThunk(\"contents/detail\", (contentUid: string) => ContentService.ContentDetail(contentUid));\r\n\r\nexport const contentDetailResumed = createAsyncThunk(\"contents/detail/resumed\", (contentUid: string) => ContentService.ContentDetailResumed(contentUid));\r\n\r\nexport const contentFilter = createAsyncThunk(\"contents/filter\", (filter: CustomContentFilter) => ContentService.Contents(filter));\r\n\r\nconst contentRelated = createAsyncThunk(\"contents/related\",(info: ContentRelatedRequest) => ContentService.RelatedContents(info));\r\n\r\nexport const schemasAll = createAsyncThunk(\"categories/all\", () => ContentService.Schemas());\r\n\r\nexport const contentSummary = createAsyncThunk(\"contents/summaries\",(content: Content) => ContentService.ContentSummary(content));\r\n\r\nexport const showContentDetail = createAction(\"content/detail/show\");\r\n\r\nexport const showContentDetailWithMarks = createAction(\"content/detail/show\");\r\n\r\nexport const loadAndOpenContent = createAction(\"content/load/open\");\r\n\r\nexport const openContent = createAction(\"content/open\");\r\n\r\nexport const loadMoreFromActiveContentFilter = createAction(\"content/load/more\");\r\n\r\nexport const updateDownloadProgress = createAction(\"content/download/progress\");\r\n\r\nexport const activeContentAnchor = createAction(\"content/active/anchor\");\r\n\r\nexport const contentSlice = createSlice({\r\n name: \"contentSlice\",\r\n initialState,\r\n reducers: {\r\n setSummaryItem: (state, action) => {\r\n state.summaryItem = action.payload\r\n },\r\n setContentOption: (state, action) => {\r\n state.contentOption = action.payload\r\n },\r\n resetState: () => initialState,\r\n setLoadingSummary: (state, action) => {\r\n state.loadingSummary = action.payload;\r\n },\r\n openOfflineContent: (state, action) => {\r\n state.activeContentUid = action.payload.uid\r\n },\r\n updateAllContents: (state, action) => {\r\n updateData(state.allContents, action.payload);\r\n },\r\n updateImagePermissions:(state) =>\r\n {\r\n for(var content of state.allContents)\r\n {\r\n if (content.image?.indexOf(\"http://localhost\") != -1)\r\n {\r\n content.image= Sdk.Api.dynamic.bridgeUrl(`cms/v1.1/managed/content/group/uid/${content.uid}/default/thumb`,null);\r\n }\r\n }\r\n },\r\n updateDownloadProgress: (state, action) => {\r\n state.preferences = action.payload;\r\n },\r\n\r\n setActiveContentUid: (state, action) => {\r\n state.activeContentUid = action.payload;\r\n },\r\n\r\n contentFilter: (state, filter: PayloadAction) => {\r\n const data = filter.payload;\r\n const isEqual = JSON.stringify(data) == JSON.stringify(state.activeFilter ?? {});\r\n\r\n if (isEqual) return;\r\n\r\n let filterUpdated:CustomContentFilter = data;\r\n\r\n if (data.category) {\r\n var filterCategory = data.category;\r\n var foundCategory = state.categories\r\n .map((category) => findCategory(filterCategory.uid, category))\r\n .filter((p) => p !== undefined)?.[0];\r\n\r\n if (!foundCategory) {\r\n foundCategory = {\r\n uid: filterCategory.uid,\r\n label: \"Categoria não encontrada\",\r\n };\r\n }\r\n\r\n filterUpdated.category = foundCategory;\r\n }else\r\n {\r\n filterUpdated.category = undefined;\r\n }\r\n\r\n filterUpdated.processing = true;\r\n\r\n state.activeFilter = filterUpdated\r\n state.contentFromFilter = undefined;\r\n state.totalContentsFromFilter = undefined;\r\n },\r\n goToContentInfo: (\r\n state,\r\n option: PayloadAction\r\n ) => {\r\n const optionSelected = option.payload;\r\n let options = undefined;\r\n\r\n if (optionSelected === ContentOptionDetail) {\r\n options = \"detail\";\r\n } else if (optionSelected === ContentOptionAppointments) {\r\n options = \"appointments\";\r\n } else if (\r\n optionSelected === ContentOptionFavorite ||\r\n optionSelected === ContentOptionFavorited ||\r\n optionSelected === ContentOptionDownload\r\n ) {\r\n options = 'detail';\r\n ///evento tratado por middleware\r\n } else if (optionSelected === ContentOptionReadingList) {\r\n options = \"readinglist\";\r\n } else if (optionSelected === ContentOptionSummary) {\r\n options = \"summary\";\r\n }\r\n\r\n state.contentOption = options;\r\n },\r\n \r\n updateContentAnchor: (state, data) => {\r\n state.activeContentAnchorLink = data.payload\r\n },\r\n \r\n activeReference: (state, data: PayloadAction) => {\r\n state.activeContentReference = data.payload;\r\n },\r\n contentSummary: (state, data: PayloadAction) => {\r\n state.contentSummary = undefined;\r\n },\r\n startDownload: (state, data: PayloadAction) => {\r\n state.startDownload = data.payload;\r\n },\r\n },\r\n extraReducers: (builder) => {\r\n builder.addCase(contentSummary.fulfilled, (state, action) => {\r\n state.contentSummary = action.payload;\r\n state.loadingSummary = false;\r\n });\r\n\r\n builder.addCase(contentSummary.pending, (state, action) => {\r\n state.loadingSummary = true;\r\n });\r\n\r\n builder.addCase(contentSummary.rejected, (state, action) => {\r\n state.contentSummary = [];\r\n state.loadingSummary = false;\r\n });\r\n\r\n builder.addCase(mostWantedContents.fulfilled, (state, action) => {\r\n state.mostWantedContent = action.payload.map((p) => p.uid);\r\n updateData(state.allContents, action.payload);\r\n updateContentAuthor(state.authors, state.allContents);\r\n });\r\n\r\n builder.addCase(suggestedContents.fulfilled, (state, action) => {\r\n state.suggestedContent = action.payload.map((p) => p.uid);\r\n updateData(state.allContents, action.payload);\r\n updateContentAuthor(state.authors, state.allContents);\r\n });\r\n\r\n builder.addCase(contentRelated.pending, (state, action) => {\r\n state.activeContentRelated = undefined;\r\n state.loadingRelateds = true;\r\n });\r\n\r\n builder.addCase(contentRelated.rejected, (state, action) => {\r\n state.activeContentRelated = undefined;\r\n state.loadingRelateds = true;\r\n });\r\n \r\n builder.addCase(contentRelated.fulfilled, (state, action) => {\r\n state.activeContentRelated = action.payload.map((p) => p.uid);\r\n state.loadingRelateds = false;\r\n updateData(state.allContents, action.payload);\r\n updateContentAuthor(state.authors, state.allContents);\r\n });\r\n\r\n builder.addCase(historyContents.fulfilled, (state, action) => {\r\n updateData(state.allContents, action.payload);\r\n updateContentAuthor(state.authors, state.allContents);\r\n });\r\n\r\n builder.addCase(contentFilter.pending, (state, action) => {\r\n if (state.activeFilter){\r\n state.activeFilter.processing = true\r\n }\r\n });\r\n\r\n builder.addCase(contentFilter.rejected, (state, action) => {\r\n if (state.activeFilter){\r\n state.activeFilter.processing = false\r\n }\r\n });\r\n\r\n builder.addCase(contentFilter.fulfilled, (state, action) => {\r\n const searchResult = action.payload;\r\n\r\n if (!state.contentFromFilter) state.contentFromFilter = [];\r\n\r\n state.contentFromFilter = [\r\n ...state.contentFromFilter,\r\n ...searchResult.result.map((p) => p.uid),\r\n ];\r\n\r\n state.totalContentsFromFilter = searchResult.totalResult;\r\n\r\n if (state.activeFilter){\r\n state.activeFilter.customQuery = searchResult.nextQuery;\r\n }\r\n\r\n updateData(state.allContents, action.payload.result);\r\n updateContentAuthor(state.authors, state.allContents);\r\n\r\n if(state.activeFilter) {\r\n state.activeFilter.processing = false\r\n }\r\n\r\n });\r\n\r\n builder.addCase(downloadedContents.fulfilled, (state, action) =>\r\n {\r\n var statusUpdated = action.payload;\r\n\r\n for (var download of statusUpdated)\r\n {\r\n var inMemory = state.allContents.find(p=> p.uid == download.uid);\r\n\r\n if (!inMemory)\r\n {\r\n state.allContents.push(download);\r\n continue;\r\n }\r\n\r\n for(var reference of download.references ?? [])\r\n {\r\n var currentReference = inMemory.references?.find(p=> p.uid == reference.uid);\r\n\r\n if (!currentReference)\r\n {\r\n if (!inMemory.references) inMemory.references = [];\r\n inMemory.references?.push(reference);\r\n }else\r\n {\r\n currentReference.downloadProgress = reference.downloadProgress;\r\n }\r\n }\r\n }\r\n\r\n state.allContents.forEach(c=>{\r\n var receiveStatus = action.payload?.find(r=> r.uid == c.uid);\r\n if (receiveStatus) return;\r\n\r\n c.references?.forEach(r=> r.downloadProgress = undefined);\r\n });\r\n });\r\n\r\n builder.addCase(schemasAll.fulfilled, (state, action) => {\r\n var data = action.payload;\r\n var categories = data.find(\r\n (schema) => schema.name === \"Categories\" || schema.name === \"Categorias\" || schema.name === \"Categoria\"\r\n )?.categories;\r\n var authors = data.find(\r\n (schema) => schema.name === \"Authors\" || schema.name === \"Autores\"\r\n )?.categories;\r\n\r\n state.categories = categories ?? [];\r\n state.authors = authors ?? [];\r\n });\r\n\r\n builder.addCase(contentDetail.pending, (state, action) => {\r\n state.activeContentUid = action.meta.arg;\r\n state.loadingRelateds = true;\r\n });\r\n\r\n builder.addCase(contentDetail.fulfilled, (state, action) => {\r\n var contentUpdated = action.payload;\r\n state.activeReview = action.payload.fullReview\r\n updateContentAuthor(state.authors, [contentUpdated]);\r\n updateData(state.allContents, [contentUpdated]);\r\n });\r\n\r\n builder.addCase(contentDetailResumed.fulfilled, (state, action) => {\r\n var contentUpdated = action.payload;\r\n updateContentAuthor(state.authors, [contentUpdated]);\r\n updateData(state.allContents, [contentUpdated]);\r\n });\r\n },\r\n});\r\n\r\nexport const middleware: Middleware =\r\n (store: MiddlewareAPI) =>\r\n (next: Dispatch) =>\r\n async (action: PayloadAction) => {\r\n const state = store.getState();\r\n if (contentSlice.actions.openOfflineContent.match(action)) {\r\n const { referenceType, uid } = action.payload;\r\n var activeContent = state.contentState.allContents.find(p => p.uid === uid);\r\n var fail = true;\r\n\r\n if (activeContent) {\r\n var reference = activeContent.references?.find(\r\n (p) => p.mimeType === referenceType\r\n );\r\n\r\n if (reference) {\r\n store.dispatch(contentSlice.actions.setActiveContentUid(activeContent.uid));\r\n store.dispatch(contentSlice.actions.activeReference(reference));\r\n store.dispatch(commonSlice.actions.goToContent({contentReferenceUid: reference.uid, contentUid:activeContent.uid}));\r\n fail = false;\r\n }\r\n }\r\n\r\n if (fail) {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: \"Conteúdo\",\r\n description: \"Não foi possível abrir o formato escolhido.\",\r\n show: true,\r\n })\r\n );\r\n }\r\n };\r\n\r\n if (loadContentDetail.match(action)) {\r\n store.dispatch(contentSlice.actions.setLoadingSummary(true))\r\n store.dispatch(contentDetail(action.payload)).unwrap()\r\n .then((result) => {\r\n if (!state.commonState.runningInMobile && window.innerWidth > 1024) {\r\n store.dispatch(contentSummary(result));\r\n }\r\n })\r\n };\r\n\r\n if(activeContentAnchor.match(action)) {\r\n const option = action.payload;\r\n if(!option) return;\r\n\r\n if(!option && state.contentState.activeContentAnchorLink) {\r\n store.dispatch(contentSlice.actions.updateContentAnchor(undefined))\r\n }\r\n\r\n if(option.contentType === 'pdf') {\r\n store.dispatch(contentSlice.actions.updateContentAnchor(option.contentLink?.navLink ?? ''))\r\n store.dispatch(openContent([ContentType.Pdf]));\r\n return;\r\n };\r\n\r\n const mark = state.userDataState.userData.find(item => item.uid === option?.contentLink?.uid);\r\n\r\n const anchor = mark ? JSON.stringify(mark) : option?.contentLink?.navLink ? option?.contentLink?.navLink : '';\r\n\r\n store.dispatch(contentSlice.actions.updateContentAnchor(anchor))\r\n store.dispatch(openContent([ContentType.Epub]))\r\n }\r\n\r\n if (action.payload === ContentOptionDownload) {\r\n }\r\n\r\n if (userSlice.actions.activeUser.match(action)) {\r\n const user = action.payload;\r\n\r\n store.dispatch(schemasAll());\r\n store.dispatch(contentSlice.actions.updateImagePermissions());\r\n\r\n if (user) {\r\n store.dispatch(suggestedContents());\r\n } else {\r\n store.dispatch(mostWantedContents());\r\n }\r\n }\r\n\r\n if (contentDetail.fulfilled.match(action)) {\r\n store.dispatch(contentRelated({\r\n content: action.payload,\r\n categoriesAvailableForUser: state.contentState.categories\r\n }));\r\n }\r\n\r\n if (contentSlice.actions.contentFilter.match(action) && state.contentState.activeFilter?.processing != true)\r\n {\r\n store.dispatch(contentFilter(action.payload));\r\n }\r\n\r\n if (loadMoreFromActiveContentFilter.match(action) && state.contentState.activeFilter) {\r\n store.dispatch(contentFilter(state.contentState.activeFilter));\r\n }\r\n\r\n if (loadAndOpenContent.match(action)) {\r\n if (state.commonState.withInternet == false) {\r\n var contentReferenceDownloaded = state.contentState.allContents.find((p) => p?.uid == action.payload);\r\n\r\n if (!contentReferenceDownloaded ){//|| !contentDownloaded) {\r\n } else {\r\n // var contentUpdated: RemoteContentDetail = {\r\n // ...contentDownloaded,\r\n // references: [contentReferenceDownloaded],\r\n // };\r\n\r\n // store.dispatch(contentSlice.actions.contentDetail(contentDownloaded.uid));\r\n store.dispatch(\r\n openContent([\r\n ContentType.Preference,\r\n ContentType.Epub,\r\n ContentType.Pdf,\r\n ])\r\n );\r\n }\r\n } else {\r\n store\r\n .dispatch(contentDetail(action.payload))\r\n .then(() =>\r\n store.dispatch(\r\n openContent([\r\n ContentType.Preference,\r\n ContentType.Epub,\r\n ContentType.Pdf,\r\n ])\r\n )\r\n );\r\n }\r\n }\r\n\r\n if (\r\n contentSlice.actions.goToContentInfo.match(action) &&\r\n action.payload === ContentOptionSummary &&\r\n state.contentState.activeContentUid\r\n ) {\r\n var activeContentReference = state.contentState.allContents.find(p=> p.uid == state.contentState.activeContentUid);\r\n if (activeContentReference) store.dispatch(contentSummary(activeContentReference));\r\n }\r\n\r\n if (\r\n contentSlice.actions.goToContentInfo.match(action) &&\r\n action.payload === ContentOptionFavorite &&\r\n state.contentState.activeContentUid\r\n ) {\r\n var content = state.contentState.allContents.find(p=> p.uid == state.contentState.activeContentUid);\r\n if (content) store.dispatch(insertInFavorite(content));\r\n }\r\n\r\n if (\r\n contentSlice.actions.goToContentInfo.match(action) &&\r\n action.payload === ContentOptionFavorited &&\r\n state.contentState.activeContentUid\r\n ) {\r\n var content = state.contentState.allContents.find(p=> p.uid == state.contentState.activeContentUid);\r\n if (content) store.dispatch(removeFromFavorite(content));\r\n }\r\n\r\n if (contentSlice.actions.setSummaryItem.match(action)) {\r\n if (action.payload) {\r\n store.dispatch(openContent([action.payload.type === 'pub' ? ContentType.Epub : ContentType.Pdf]))\r\n }\r\n }\r\n if (openContent.match(action)) {\r\n var activeContent = state.contentState.allContents.find(p=> p.uid == state.contentState.activeContentUid);\r\n var fail = true;\r\n\r\n if (activeContent) {\r\n var types = action.payload;\r\n\r\n for (var type of types) {\r\n if (type == ContentType.Preference) {\r\n type = ContentType.Epub;\r\n }\r\n\r\n var reference = activeContent.references?.find(\r\n (p) => p.mimeType == type\r\n );\r\n\r\n if (reference) {\r\n store.dispatch(contentSlice.actions.activeReference(reference));\r\n store.dispatch(commonSlice.actions.goToContent({\r\n contentReferenceUid: reference.uid, \r\n contentUid:activeContent.uid, \r\n ...(state.contentState.summaryItem && {\r\n summary: state.contentState.summaryItem\r\n })\r\n }));\r\n fail = false;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (fail) {\r\n store.dispatch(\r\n commonSlice.actions.showAlert({\r\n title: \"Conteúdo\",\r\n description: \"Não foi possível abrir o formato escolhido.\",\r\n show: true,\r\n })\r\n );\r\n }\r\n }\r\n\r\n return next(action);\r\n };\r\n\r\nexport const updateData = (currentData: RemoteContentDetail[], newDatas: RemoteContentDetail[]) =>\r\n{\r\n for (var newData of newDatas) {\r\n var current = currentData.find((p) => p.uid == newData.uid);\r\n\r\n if (current == null)\r\n {\r\n currentData.push(newData);\r\n continue;\r\n }\r\n\r\n var currentReferences = [ ...current.references ?? [] ];\r\n var currentGeneric = current as Record;\r\n var neweneric = newData as Record;\r\n\r\n for (var key in neweneric)\r\n {\r\n currentGeneric[key] = neweneric[key]\r\n }\r\n\r\n for(var reference of currentReferences ?? [])\r\n {\r\n var newReference = current.references?.find(p=> p.uid == reference.uid);\r\n\r\n if (newReference == null) continue;\r\n if (newReference.downloadProgress == undefined)\r\n {\r\n newReference.downloadProgress = reference.downloadProgress;\r\n }\r\n }\r\n }\r\n};\r\n\r\nconst updateContentAuthor = (\r\n authors: Category[],\r\n contents: RemoteContentDetail[]\r\n) => {\r\n for (const content of contents) {\r\n const names = authors\r\n .filter((p) => content.entities?.find((e) => e.entityUid === p.uid))\r\n .map((p) => p.label)\r\n .join(\" | \");\r\n\r\n content.author = names ?? \"Não definido\";\r\n }\r\n};\r\n\r\n// const localContentInfo = (state: RootState, contentUid: string) => {\r\n// var result: Content | undefined =\r\n// state.contentState.mostWantedContent?.books?.find(\r\n// (p) => p.uid == contentUid\r\n// );\r\n\r\n// if (!result)\r\n// result = state.contentState.suggestedContent?.books?.find(\r\n// (p) => p.uid == contentUid\r\n// );\r\n// if (!result)\r\n// result = state.contentState.contentFromFilter?.find(\r\n// (p) => p.uid == contentUid\r\n// );\r\n// if (!result) result = { uid: contentUid, title: \"Carregando\" };\r\n\r\n// return result;\r\n// };\r\n\r\nconst referenceToDownload = (content: RemoteContentDetail) => {\r\n if (content.references && content.references?.length > 0) {\r\n var reference = content.references.find(\r\n (p) => p.mimeType.indexOf(\"epub\") != -1\r\n );\r\n if (!reference) reference = content.references[0];\r\n\r\n return reference;\r\n }\r\n\r\n return null;\r\n};\r\n\r\nexport default contentSlice.reducer;\r\n","import { configureStore } from \"@reduxjs/toolkit\";\r\nimport { TypedUseSelectorHook, useDispatch, useSelector } from \"react-redux\";\r\n\r\nimport { middleware as contentSliceMiddleware, contentSlice} from \"./reducers/contentSlice\";\r\nimport { middleware as userSliceMiddleware, userSlice} from \"./reducers/userSlice\";\r\nimport { middleware as commonMiddleware, commonSlice } from \"./reducers/common\";\r\nimport { middleware as userDataMiddleware, userDataSlice } from \"./reducers/userDataSlice\";\r\n\r\nimport { persistStore, persistReducer } from \"redux-persist\";\r\nimport storage from \"redux-persist/lib/storage\";\r\n\r\n//Deve ser declarado todos os reduces\r\ntype ContentSlice = ReturnType;\r\ntype Userslice = ReturnType;\r\ntype UserDataSlice = ReturnType;\r\n\r\nexport const Store = configureStore({\r\n reducer: \r\n {\r\n commonState: commonSlice.reducer,\r\n contentState: persistReducer(\r\n { key: \"content\", storage },\r\n contentSlice.reducer\r\n ),\r\n userState: persistReducer(\r\n { key: \"user\", storage },\r\n userSlice.reducer\r\n ),\r\n userDataState: persistReducer(\r\n { key: \"userData\", storage },\r\n userDataSlice.reducer\r\n ),\r\n },\r\n \r\n ///Deve registar todos os middlewares\r\n middleware: (mm) =>\r\n mm({\r\n serializableCheck: false,\r\n })\r\n .concat(contentSliceMiddleware)\r\n .concat(userSliceMiddleware)\r\n .concat(commonMiddleware)\r\n .concat(userDataMiddleware)\r\n});\r\n\r\nexport type RootState = ReturnType;\r\nexport type AppDispatch = typeof Store.dispatch;\r\n\r\nexport const useAppDispatch = () => useDispatch();\r\nexport const useAppSelector: TypedUseSelectorHook = useSelector;\r\nexport const PersitorState = {\r\n initialized:false\r\n}\r\nexport const persistor = persistStore(Store, null, ()=> {\r\n PersitorState.initialized = true;\r\n}\r\n );","import { connect } from \"react-redux\";\r\nimport { PageSummary } from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport { Modal, ModalDispatchProps, ModalStateProps, ModalProps, ModalButtonOption } from \"senac-components/dist/components/Modal\";\r\nimport { alertSelectButton } from \"../store/reducers/common\";\r\n\r\n\r\nconst mapState = (state: RootState, props: any) => \r\n{\r\n const data = state.commonState.alert;\r\n\r\n const result: ModalStateProps = \r\n {\r\n title : data?.title ?? \"\",\r\n description: data?.description ?? \"\",\r\n buttons: data?.buttons,\r\n show: data?.show == true\r\n }\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch, props:any) => \r\n{\r\n const result: ModalDispatchProps = \r\n {\r\n onClick:(button:ModalButtonOption)=> dispatch(alertSelectButton(button)),\r\n onClose: ()=> dispatch(alertSelectButton(undefined))\r\n };\r\n return result;\r\n};\r\n\r\nconst WModal = connect(mapState, mapDispatch)(Modal);\r\n\r\nexport { WModal };\r\n","import { connect } from \"react-redux\";\r\nimport {\r\n ModalMigration,\r\n ModalMigrationStateProps,\r\n ModalMigrationDispatchProps,\r\n} from \"senac-components/dist/components/ModalMigration/ModalMigration\";\r\nimport { userSlice } from \"../store/reducers\";\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport {\r\n authenticateFromProfileContext,\r\n checkUniqueLogin,\r\n forgotPasswordFromLibrary,\r\n onCloseMigrationModal,\r\n sendCPFEmail,\r\n sendNewLogin,\r\n signinFromProfile,\r\n signinMigration,\r\n} from \"../store/reducers/userSlice\";\r\n\r\nconst mapState = (state: RootState) => {\r\n const organizations = (state.userState.organizations ?? []).map((item) => ({\r\n ...item,\r\n migrated: (state.userState.projects ?? []).some(\r\n (project) => project.uid === item.uid\r\n ),\r\n }));\r\n const result: ModalMigrationStateProps = {\r\n open: state.userState.openModalMigration ?? false,\r\n organizations,\r\n step: state.userState.step ?? 0,\r\n loading: state.userState.userAuthenticating,\r\n context: state.userState.user ? \"profile\" : \"login\",\r\n preSettedLogin: state.userState.lastCpfSetted,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: ModalMigrationDispatchProps = {\r\n sendOrganization: (pass, orgId, login) => {\r\n dispatch(\r\n userSlice.actions.sendUserOrganization({\r\n login: login ?? \"\",\r\n password: pass,\r\n organizationUid: orgId,\r\n })\r\n );\r\n },\r\n onConfirmSignIn: (params) => {\r\n dispatch(signinFromProfile(params as any));\r\n },\r\n sendCPFOrEmail: (newValue) => {\r\n dispatch(sendCPFEmail(newValue));\r\n },\r\n sendUniqueLogin: (login) => {\r\n dispatch(sendNewLogin(login));\r\n },\r\n onClose: () => {\r\n dispatch(onCloseMigrationModal());\r\n },\r\n setStep: (newStep) => {\r\n dispatch(userSlice.actions.changeStep(newStep));\r\n },\r\n onConfirm: () => {\r\n dispatch(checkUniqueLogin());\r\n },\r\n onClickForgotPassword: (params) => {\r\n dispatch(forgotPasswordFromLibrary(params));\r\n },\r\n sendPasswordToAuthOtherProfile(password) {\r\n dispatch(authenticateFromProfileContext(password))\r\n },\r\n };\r\n\r\n return result;\r\n};\r\n\r\nexport const WModalMigration = connect(mapState, mapDispatch)(ModalMigration);\r\n","import React, { useEffect, useState, useRef, Children } from \"react\";\r\nimport {\r\n useNavigate,\r\n useLocation,\r\n RouteProps,\r\n Outlet,\r\n useSearchParams,\r\n redirect,\r\n} from \"react-router-dom\";\r\n\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\nimport { userSlice, commonSlice, contentSlice } from \"./store/reducers\";\r\nimport { RootState, useAppDispatch } from \"./store\";\r\nimport { WModal } from \"./components/WModal\";\r\nimport { GlobalFonts, Loading } from \"senac-components\";\r\nimport { useSelector } from \"react-redux\";\r\nimport userDataSlice, {\r\n downloadedContents,\r\n loadPlayerObserver,\r\n} from \"./store/reducers/userDataSlice\";\r\nimport { signinAnonymous } from \"./store/reducers/userSlice\";\r\nimport { WModalMigration } from \"./components/WModalMigration\";\r\n\r\nconst App: React.FC = ({ path }) => {\r\n const isWeb = window.innerWidth > 1024;\r\n const effectRan = useRef(false);\r\n const [initialized, setInitialized] = useState(false);\r\n const route = useSelector((p) => p.commonState.route);\r\n const contentOptions = useSelector(\r\n (state) => state.contentState.contentOption\r\n );\r\n const activeUser = useSelector(\r\n (state) => state.userState.user != undefined\r\n );\r\n const inMobile = useSelector(\r\n (state) => state.commonState.runningInMobile\r\n );\r\n const withInternet = useSelector(\r\n (state) => state.commonState.withInternet\r\n );\r\n const hasSummaryState = useSelector(\r\n (state) => state.contentState.summaryItem\r\n );\r\n\r\n const userState = useSelector(\r\n (state) => state.userState\r\n ) as RootState[\"userState\"];\r\n const loader = useSelector((state) => state.commonState.loader);\r\n\r\n const dispatch = useAppDispatch();\r\n const navigate = useNavigate();\r\n const location = useLocation();\r\n const [searchParams] = useSearchParams();\r\n const authenticated = Sdk.Api.authorization.authenticated;\r\n\r\n const urlParams = Object.fromEntries(searchParams);\r\n const ssoRoute = location.pathname.includes(\"sso/\");\r\n\r\n useEffect(() => {\r\n if (inMobile) return;\r\n dispatch(commonSlice.actions.setRefferer());\r\n const path = window.location.hash;\r\n const shouldHaveContentReference =\r\n path.includes(`player`) ||\r\n path.includes(`content/uid`) ||\r\n path.includes(`library/readinglist/uid`);\r\n\r\n if (!shouldHaveContentReference) {\r\n dispatch(contentSlice.actions.activeReference(null));\r\n }\r\n\r\n if (!path.includes(\"player\")) {\r\n dispatch(contentSlice.actions.updateContentAnchor(undefined));\r\n }\r\n }, [location]);\r\n\r\n const checkLoginSSO = () => {\r\n dispatch(userSlice.actions.checkSigninSSO(urlParams));\r\n };\r\n\r\n useEffect(() => {\r\n ///evita executar aplicação duas vezes\r\n /// https://www.youtube.com/watch?v=81faZzp18NM\r\n if (effectRan.current === false) {\r\n loadConfig();\r\n return () => {\r\n effectRan.current = true;\r\n };\r\n }\r\n }, []);\r\n\r\n const pagesNoRedirect = [\"recover-password\", \"login\", \"register\"];\r\n\r\n const checkRedirect = () => {\r\n return !pagesNoRedirect.some((item) => location.pathname.includes(item));\r\n };\r\n\r\n useEffect(() => {\r\n if (!ssoRoute) {\r\n dispatch(userSlice.actions.setSsoData(undefined));\r\n dispatch(userSlice.actions.setSsoLoading(undefined));\r\n }\r\n const code = searchParams.get(\"importCode\");\r\n\r\n dispatch(userSlice.actions.setImportReadingList(code ?? undefined));\r\n\r\n window.addEventListener(\"message\", receiveMessage);\r\n document.addEventListener(\"visibilitychange\", changeDocumentVisivity);\r\n\r\n return () => {\r\n window.removeEventListener(\"message\", receiveMessage);\r\n window.removeEventListener(\"visibilitychange\", changeDocumentVisivity);\r\n };\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (\r\n !activeUser &&\r\n !Sdk.Api.authorization.authenticated &&\r\n !userState.ssoParams &&\r\n route &&\r\n route !== \"/inicio\"\r\n ) {\r\n navigate(\"/inicio\");\r\n }\r\n }, [route]);\r\n\r\n useEffect(() => {\r\n if (\r\n !activeUser &&\r\n !Sdk.Api.authorization.authenticated && \r\n !withInternet && initialized\r\n ) {\r\n navigate('/user/options');\r\n return;\r\n }\r\n \r\n if (!withInternet && initialized && location.pathname !== \"/offline\") {\r\n navigate(\"/offline\");\r\n return;\r\n }\r\n\r\n if (location.pathname === '/offline' && withInternet && initialized) {\r\n navigate(\"/inicio\");\r\n }\r\n }, [withInternet, initialized, location.pathname]);\r\n\r\n useEffect(() => {\r\n if (!route) return;\r\n\r\n let finalRoute = route as string;\r\n\r\n if (contentOptions === \"noredir\") return;\r\n if (contentOptions && String(route).indexOf(\"/content/uid\") === 0) {\r\n finalRoute = `${route}/${contentOptions}`;\r\n }\r\n\r\n const exceptions = initialized || userState.ssoParams;\r\n\r\n if (\r\n location.pathname !== finalRoute &&\r\n exceptions &&\r\n !userState.loadingSso\r\n ) {\r\n navigate(finalRoute);\r\n dispatch(commonSlice.actions.changeRoute(undefined));\r\n dispatch(userSlice.actions.setTokenRecoveryPassword(undefined));\r\n\r\n if (hasSummaryState) {\r\n dispatch(contentSlice.actions.setSummaryItem(undefined));\r\n }\r\n }\r\n }, [route, contentOptions, userState.ssoParams, userState.loadingSso]);\r\n\r\n const receiveMessage = (e: MessageEvent) => {\r\n if (e.data.onBack || e.data.userInteraction) {\r\n dispatch(loadPlayerObserver(e.data));\r\n }\r\n };\r\n\r\n const changeDocumentVisivity = (ev:Event) =>\r\n {\r\n if (document.visibilityState === \"hidden\") {\r\n console.log(\"Document is hidden\");\r\n dispatch(commonSlice.actions.changeState(\"idle\"));\r\n // Perform actions when the document is hidden\r\n } else {\r\n console.log(\"Document is visible\");\r\n dispatch(commonSlice.actions.changeState(\"initializing\"));\r\n }\r\n }\r\n\r\n const loadConfig = async () => {\r\n const response = await fetch(\"./api_context.json\");\r\n const config = await response.json();\r\n console.log(window.location);\r\n\r\n dispatch(loadPlayerObserver());\r\n dispatch(userSlice.actions.closeModal());\r\n dispatch(userSlice.actions.changeStep(0));\r\n\r\n if (\r\n localStorage.getItem(\"iammobile\") == \"true\" ||\r\n window.location.href.includes('iammobile=true') || \r\n window.location.search.includes('iammobile=true')) {\r\n console.log(\"IAMMOBILE\");\r\n document.addEventListener(\"deviceready\", function () {\r\n setupSdk(config);\r\n listenAppEvents();\r\n dispatch(commonSlice.actions.runningInMobile(true));\r\n });\r\n } else {\r\n dispatch(commonSlice.actions.runningInMobile(false));\r\n // dispatch(commonSlice.actions.runningInMobile(true));\r\n // dispatch(commonSlice.actions.withInternet(true));\r\n setupSdk(config);\r\n }\r\n };\r\n\r\n const listenAppEvents = async () => {\r\n var cordovaInstance = (window as any).CordovaExec;\r\n\r\n ///progresso de download\r\n cordovaInstance(\r\n function (response: any) {\r\n console.log(\"RegisterEditionsChanges\", response);\r\n //todo: melhorar/otimizar\r\n dispatch(downloadedContents());\r\n },\r\n \"UnifiedApiPlugin\",\r\n \"Process\",\r\n [{ name: \"RegisterEditionsChanges\" }]\r\n );\r\n\r\n cordovaInstance(\r\n function (response: any) {\r\n console.log(\"network\", response);\r\n var result = JSON.parse(response);\r\n dispatch(commonSlice.actions.withInternet(result.status));\r\n // dispatch(commonSlice.actions.withInternet(false));\r\n },\r\n \"UnifiedApiPlugin\",\r\n \"Process\",\r\n [{ name: \"HandleNetwork\" }]\r\n );\r\n };\r\n\r\n const setupSdk = async (config: any) => {\r\n dispatch(commonSlice.actions.changeState(\"idle\"));\r\n\r\n const domain: any = `https://${config.domain}`;\r\n const projectKey = config.project_key || config.pk;\r\n const apiEnv = config.api_env || config.ae;\r\n const projectUid = config.project_uid || config.pu;\r\n\r\n Sdk.Api.domain = domain;\r\n //todo:corrigir sdk\r\n Sdk.Api.authorization.domain = domain;\r\n Sdk.Api.storage.domain = domain;\r\n Sdk.Api.store.domain = domain;\r\n Sdk.Api.cms.domain = domain;\r\n Sdk.Api.dam.domain = domain;\r\n\r\n Sdk.Api.setEnviroment(apiEnv);\r\n Sdk.Api.setProjectKey(projectKey);\r\n\r\n await Sdk.Api.initializeFromProject(projectUid, \"Insights_1\", \"Insights_1\");\r\n\r\n // Sdk.Api.authorization.addCredentialListen(async () => {\r\n // if (!Sdk.Api.authorization.authenticated && activeUser && !logoutProcessing)\r\n // {\r\n // setLogoutProcessing(true);\r\n // await dispatch(userSlice.actions.logout());\r\n\r\n // //todo:melhorar\r\n // setTimeout(() => {\r\n // setLogoutProcessing(false);\r\n // }, (3000));\r\n // }\r\n // });\r\n\r\n if (activeUser && !Sdk.Api.authorization.authenticated) {\r\n await dispatch(userSlice.actions.logout());\r\n }\r\n\r\n dispatch(commonSlice.actions.changeState(\"initializing\"));\r\n\r\n if (!withInternet) {\r\n navigate(\"/offline\");\r\n } else if (location.pathname === \"/\") {\r\n navigate(\"/inicio\");\r\n }\r\n\r\n if (\r\n !authenticated &&\r\n !activeUser &&\r\n checkRedirect() &&\r\n !userState.loadingSso &&\r\n !ssoRoute\r\n ) {\r\n navigate(\"/user/options\");\r\n }\r\n\r\n if (location.pathname.includes(\"recover-password\")) {\r\n dispatch(signinAnonymous(projectUid));\r\n const token = searchParams.get(\"token\");\r\n dispatch(userSlice.actions.setTokenRecoveryPassword(token));\r\n }\r\n setInitialized(true);\r\n\r\n await checkLoginSSO();\r\n };\r\n\r\n // return null;\r\n return (\r\n <>\r\n {initialized && }\r\n {\r\n \r\n }\r\n {}\r\n \r\n \r\n );\r\n};\r\n\r\nexport default App;","import { connect } from \"react-redux\";\r\nimport {\r\n PageBookFiltered,\r\n PageBookFilteredWeb,\r\n PageBookFound,\r\n} from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n PageBookFilteredPropsDispach,\r\n PageBookFilteredState,\r\n} from \"senac-components/dist/pages/Mobile/PageBookFiltered\";\r\nimport { Wrapper, WrapperStateProps, WrapperDispatchProps } from \"./Wrapper\";\r\n\r\nimport { loadAndOpenContent, loadMoreFromActiveContentFilter, showContentDetail } from \"../store/reducers/contentSlice\";\r\nimport {\r\n Content,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { PageBookFilteredWebDispach, PageBookFilteredWebState } from \"senac-components/dist/pages/Web/PageBookFiltered\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\n\r\nconst mapState = (state: RootState, props: any) => {\r\n const authenticatedUser = state.userState.user != undefined;\r\n var allContent = state.contentState.allContents;\r\n var contents: Content[] | undefined = undefined;\r\n\r\n if (state.contentState.contentFromFilter) {\r\n contents = state.contentState.contentFromFilter\r\n .map((p) => allContent.find((c) => c.uid == p))\r\n .filter((p) => p != undefined) as Content[];\r\n }\r\n\r\n\r\n let result: PageBookFilteredState & WrapperStateProps & PageBookFilteredWebState = {\r\n activeCategory: state.contentState.activeFilter?.category,\r\n categories: state.contentState.activeFilter?.category?.childs,\r\n contents: contents,\r\n authenticatedUser: authenticatedUser,\r\n element: window.innerWidth < 1024 ? PageBookFiltered : PageBookFilteredWeb,\r\n allCategories: state.contentState.categories,\r\n fetching: state.contentState.activeFilter?.processing,\r\n haveMoreContent: Boolean(state.contentState.activeFilter?.customQuery)\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch, props: any) => {\r\n const result: PageBookFilteredPropsDispach & WrapperDispatchProps & Partial = {\r\n onSelectedCategory: (category) => dispatch(contentSlice.actions.contentFilter({ category: category })),\r\n onSelectedContent: (content) => dispatch(showContentDetail(content.uid)),\r\n onClickContentDetail: (content) => dispatch(showContentDetail(content.uid)),\r\n onClickContent: (content: Content) => dispatch(loadAndOpenContent(content.uid)),\r\n onChangeParams: (params: any) =>{\r\n dispatch(\r\n contentSlice.actions.contentFilter({\r\n category: { uid: params.categoryUid },\r\n })\r\n )},\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageHeaderOptionItem) => dispatch(commonSlice.actions.goToPageOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) => dispatch(commonSlice.actions.goToPage(option)),\r\n onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n onClickLogin: () => dispatch(commonSlice.actions.loginOptionsPage()),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n onLoadMore: () => dispatch(loadMoreFromActiveContentFilter()),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageBookFiltered = connect(mapState, mapDispatch)(Wrapper);\r\n\r\nexport { WPageBookFiltered };\r\n","import { connect } from \"react-redux\";\r\nimport { PageLogin } from \"senac-components\";\r\nimport { userSlice, commonSlice } from \"../store/reducers\";\r\nimport {\r\n PageLoginDispatchProps,\r\n PageLoginStateProps,\r\n} from \"senac-components/dist/pages/Mobile/PageLogin\";\r\nimport { PageLoginWeb } from \"senac-components/dist/pages/Web/PageLogin\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport { MenuOptions } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\n// import { commonSlice } from \"../store/reducers\";\r\n\r\nconst mapState = (state: RootState) => {\r\n let result: PageLoginStateProps = {\r\n loading: state.userState.projectsLoading,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n //Ação inicial:\r\n // dispatch(userSlice.actions.changeState('initializing'));\r\n\r\n const result: PageLoginDispatchProps = {\r\n onClickNext: (login: string) => dispatch(userSlice.actions.checkAvailableProjects(login)),\r\n onClickCollection: () => dispatch(commonSlice.actions.goToPage(MenuOptions.Home)),\r\n onClickForgotMyPassword: () => dispatch(commonSlice.actions.recoverPassword()),\r\n onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n onClickBack: () => dispatch(commonSlice.actions.backPage())\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageLogin = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageLogin);\r\n const Web = connect(mapState, mapDispatch)(PageLoginWeb);\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageLogin };\r\n","import { connect } from \"react-redux\";\r\nimport { PagePassword } from \"senac-components\";\r\nimport { userSlice, commonSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n PagePasswordDispatch,\r\n PagePasswordProps,\r\n PagePasswordStateProps,\r\n} from \"senac-components/dist/pages/Mobile/PagePassword\";\r\n\r\nimport { PagePasswordWeb } from \"senac-components/dist/pages/Web/PagePassword\";\r\n\r\nimport { MenuOptions } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\n\r\nconst mapState = (state: RootState) => {\r\n let result: PagePasswordStateProps = {\r\n loading: state.userState.userAuthenticating,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PagePasswordDispatch = {\r\n onClickNext: (password: string) => {\r\n dispatch(userSlice.actions.signin(password));\r\n },\r\n onClickCollection: () => {\r\n dispatch(commonSlice.actions.goToPage(MenuOptions.Home));\r\n },\r\n onClickForgotMyPassword: () => {\r\n dispatch(commonSlice.actions.recoverPassword());\r\n },\r\n onClickBack: () => {\r\n dispatch(commonSlice.actions.loginPage());\r\n },\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPagePassword = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PagePassword);\r\n const Web = connect(mapState, mapDispatch)(PagePasswordWeb);\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPagePassword };\r\n","import { connect } from \"react-redux\";\r\nimport { PageSelectOrganization } from \"senac-components\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n PageSelectOrganizationPropsDispatch,\r\n PageSelectOrganizationPropsState,\r\n} from \"senac-components/dist/pages/Mobile/PageSelectOrganization\";\r\nimport { PageSelectOrganizationWeb } from \"senac-components/dist/pages/Web/PageSelectOrganization\";\r\nimport {\r\n MenuOptions,\r\n ProjectItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\n\r\nconst mapState = (state: RootState) => {\r\n let result: PageSelectOrganizationPropsState = {\r\n loading: false,\r\n projects: state.userState.projectsAvailable,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageSelectOrganizationPropsDispatch = {\r\n onClickNext: (project: ProjectItem) =>\r\n dispatch(userSlice.actions.selectProject(project)),\r\n onClickCollection: () =>\r\n dispatch(commonSlice.actions.goToPage(MenuOptions.Home)),\r\n onClickForgotMyPassword: () =>\r\n dispatch(commonSlice.actions.recoverPassword()),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageSelectOrganization = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageSelectOrganization);\r\n const Web = connect(mapState, mapDispatch)(PageSelectOrganizationWeb);\r\n\r\n if (window.innerWidth <= 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageSelectOrganization };\r\n","import { connect } from \"react-redux\";\r\nimport { PageForgotMyPassword } from \"senac-components\";\r\nimport { PageForgotMyPasswordDispach, PageForgotMyPasswordStateProps } from \"senac-components/dist/pages/Mobile/PageForgotMyPassword\";\r\nimport { PageForgotMyPasswordWeb } from \"senac-components/dist/pages/Web/PageForgotMyPassword\";\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\n\r\nconst mapState = (state: RootState) => \r\n{\r\n let result: PageForgotMyPasswordStateProps = {\r\n loading : false,\r\n successMessage : false\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => \r\n{\r\n const result: PageForgotMyPasswordDispach = \r\n {\r\n onSelectedHeaderMenuOption: ()=> {},\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onClickBack: () => dispatch(commonSlice.actions.backPage()),\r\n onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n onClickRecover: (login:string) => dispatch(userSlice.actions.recoverPassword(login))\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageForgotMyPassword = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageForgotMyPassword);\r\n const Web = connect(mapState, mapDispatch)(PageForgotMyPasswordWeb);\r\n if(window.innerWidth < 1024) return \r\n return \r\n}\r\n\r\nexport { WPageForgotMyPassword };\r\n\r\n","import { connect } from \"react-redux\";\r\nimport { PageRegister } from \"senac-components\";\r\nimport {\r\n PageRegisteDispach,\r\n PageRegisterUser,\r\n PageRegisteStateProps,\r\n} from \"senac-components/dist/pages/Mobile/PageRegister\";\r\nimport { PageRegisterWeb } from \"senac-components/dist/pages/Web/PageRegister\";\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\n// import { pageRegisterSlice, commonSlice } from \"../store/reducers\";\r\n// import { RootState, AppDispatch } from \"../store\";\r\n// import {\r\n// PageRegisteStateProps,\r\n// PageRegisteDispach,\r\n// PageRegisterUser,\r\n// } from \"../../.yalc/senac-components/dist/pages/Mobile/PageRegister/index\";\r\n\r\nconst mapState = (state: RootState) => {\r\n let result: PageRegisteStateProps = {\r\n loading: state.userState.userRegistering,\r\n successMessage: false,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageRegisteDispach = {\r\n onClickBackPage: () => dispatch(commonSlice.actions.backPage()),\r\n onClickForm: (form: PageRegisterUser) =>\r\n dispatch(\r\n userSlice.actions.registerUser({\r\n name: form.name,\r\n login: form.login,\r\n password: form.password,\r\n cpf: form.cpf,\r\n email: form.email,\r\n })\r\n ),\r\n onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: () => console.log(\"onSelectedHeaderMenuOption\"),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageRegister = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageRegister);\r\n const Web = connect(mapState, mapDispatch)(PageRegisterWeb);\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageRegister };\r\n","import { connect } from \"react-redux\";\r\nimport { PageShowcase, PageShowcaseWeb } from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n PageShowcaseProps,\r\n PageShowcasePropsDispach,\r\n PageShowcaseState,\r\n} from \"senac-components/dist/pages/Mobile/PageShowcase\";\r\nimport {\r\n Content,\r\n ContentGroup,\r\n MenuOptions,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n loadAndOpenContent,\r\n showContentDetail,\r\n} from \"../store/reducers/contentSlice\";\r\nimport { PageShowcaseWebProps } from \"senac-components/dist/pages/Web/PageShowcase\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\nimport { useEffect, useRef, useState } from \"react\";\r\nimport {\r\n getReviewContents,\r\n historyContents,\r\n reloadUserData,\r\n} from \"../store/reducers/userDataSlice\";\r\nimport { useNavigate } from \"react-router\";\r\nimport { RemoteContentDetail } from \"../services/contents/IContentService\";\r\n\r\n\r\nconst mapState = (state: RootState) => {\r\n const authenticatedUser = state.userState.user != undefined;\r\n const allContents = state.contentState.allContents;\r\n\r\n\r\n\r\n let keepReding: ContentGroup[] = [];\r\n let contents: ContentGroup[] = [];\r\n\r\n const orderedBooks = (contentOrderedIds?: string[]) => {\r\n const books: RemoteContentDetail[] = []; // melhora fluxo para não filtrar array e ordernar corretamente.\r\n\r\n contentOrderedIds?.forEach(contentId => {\r\n const book = allContents.find(content => content.uid === contentId)\r\n if (book) books.push(book)\r\n })\r\n\r\n return books;\r\n };\r\n\r\n const progressRead = (book: any) => {\r\n let progress = 1;\r\n try {\r\n const interactions: any[] = book.interactions;\r\n\r\n if (interactions) {\r\n interactions.forEach((item) => {\r\n if (item.interaction_progress > progress)\r\n progress = item.interaction_progress;\r\n });\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n\r\n return progress\r\n };\r\n\r\n if (authenticatedUser) {\r\n if (state.userDataState.worksToReview) {\r\n contents.push({\r\n title: \"Obras para revisitar\",\r\n uid: \"keep\",\r\n books: orderedBooks(state.userDataState.worksToReview)\r\n });\r\n }\r\n if (state.userDataState.historyReading) {\r\n keepReding.push({\r\n title: \"Continue lendo\",\r\n uid: \"keep\",\r\n books: orderedBooks(state.userDataState.historyReading)\r\n .map(book => ({\r\n ...book,\r\n progress: progressRead(book),\r\n }))\r\n });\r\n }\r\n\r\n if (state.contentState.suggestedContent) {\r\n contents.push({\r\n uid: \"suggest\",\r\n title: \"Você pode gostar\",\r\n books: orderedBooks(state.contentState.suggestedContent),\r\n });\r\n }\r\n } else {\r\n if (state.contentState.mostWantedContent) {\r\n contents.push({\r\n uid: \"mostwa\",\r\n title: \"Os mais buscados\",\r\n books: orderedBooks(state.contentState.mostWantedContent),\r\n });\r\n }\r\n }\r\n\r\n let result: PageShowcaseState = {\r\n contents: contents, //todo: tratar undefined para exibição do esqueleto\r\n contentsKeepReading: keepReding,\r\n categories: state.contentState.categories,\r\n authenticatedUser: authenticatedUser,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => \r\n{\r\n const result: PageShowcasePropsDispach & {\r\n refetchHistory?: VoidFunction;\r\n refetchReviewContents?: VoidFunction;\r\n } = {\r\n\r\n\r\n onSelectedContent: (content) => {\r\n if (!content.uid) return;\r\n dispatch(showContentDetail(content.uid));\r\n },\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n onSelectedCategory: (category) => {\r\n if (!category) return;\r\n dispatch(filterContent({ category: category }));\r\n },\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n onClickLogin: () => dispatch(commonSlice.actions.loginOptionsPage()),\r\n onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n onSelectedEditionEpub: (content: Content) =>\r\n dispatch(loadAndOpenContent(content.uid)),\r\n refetchHistory: () => {\r\n dispatch(historyContents());\r\n },\r\n refetchReviewContents: () => {\r\n dispatch(getReviewContents());\r\n },\r\n };\r\n return result;\r\n};\r\n\r\nconst webMapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageShowcaseWebProps & {\r\n onClickLogin: () => void;\r\n refetchHistory?: VoidFunction;\r\n refetchReviewContents?: VoidFunction;\r\n } = {\r\n onSelectedEditionEpub: (content: Content) =>\r\n dispatch(loadAndOpenContent(content.uid)),\r\n onSelectedContent: (content) => {\r\n if (!content.uid) return;\r\n dispatch(showContentDetail(content.uid));\r\n },\r\n onClickOptionFooter(option) {\r\n return dispatch(commonSlice.actions.goToMyProfileOption(option));\r\n },\r\n onSelectedHeaderBack() {},\r\n onClickLogin: () => dispatch(commonSlice.actions.loginOptionsPage()),\r\n onSelectedCategory: (category) => {\r\n if (!category) return;\r\n dispatch(filterContent({ category: category }));\r\n },\r\n onSelectedHeaderMenuOption(option) {},\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n refetchHistory: () => {\r\n dispatch(historyContents());\r\n },\r\n refetchReviewContents: () => {\r\n dispatch(getReviewContents());\r\n },\r\n };\r\n return result;\r\n};\r\n\r\nconst ShowCaseWeb = ({\r\n refetchHistory,\r\n refetchReviewContents,\r\n authenticatedUser,\r\n ...props\r\n}: PageShowcaseWebProps & {\r\n refetchHistory?: VoidFunction;\r\n refetchReviewContents?: VoidFunction;\r\n}) => {\r\n const ref = useRef(0);\r\n\r\n const navigate = useNavigate();\r\n\r\n useEffect(() => {\r\n if (!authenticatedUser) navigate(\"/user/options\");\r\n\r\n if (ref.current === 0 && refetchHistory) {\r\n ref.current = ref.current + 1;\r\n refetchHistory();\r\n if(refetchReviewContents) refetchReviewContents();\r\n }\r\n }, []);\r\n\r\n return ;\r\n};\r\n\r\nconst ShowCaseMobile = ({\r\n refetchHistory,\r\n refetchReviewContents,\r\n authenticatedUser,\r\n ...props\r\n}: PageShowcaseProps & {\r\n refetchHistory?: VoidFunction;\r\n refetchReviewContents?: VoidFunction;\r\n}) => {\r\n const ref = useRef(0);\r\n\r\n const navigate = useNavigate();\r\n\r\n useEffect(() => {\r\n if (!authenticatedUser) navigate(\"/user/options\");\r\n\r\n if (ref.current === 0 && refetchHistory) {\r\n ref.current = ref.current + 1;\r\n refetchHistory();\r\n if(refetchReviewContents) refetchReviewContents();\r\n }\r\n }, []);\r\n\r\n return ;\r\n};\r\n\r\nconst Web = connect(mapState, webMapDispatch)(ShowCaseWeb);\r\nconst Mobile = connect(mapState, mapDispatch)(ShowCaseMobile);\r\n\r\nconst WPageShowcase = () => {\r\n const [initialized, setInitialized] = useState(true);\r\n\r\n\r\n const isMobile = window.innerWidth < 1024;\r\n\r\n if (isMobile) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageShowcase };\r\n","import { connect } from \"react-redux\";\r\nimport { PageHome } from \"senac-components\";\r\nimport {\r\n PageHomePropsDispach,\r\n PageHomeState,\r\n} from \"senac-components/dist/pages/Mobile/PageHome\";\r\nimport { PageHomeWeb } from \"senac-components/dist/pages/Web/PageHome\";\r\nimport { MenuOptions } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice } from \"../store/reducers\";\r\nimport { useEffect, useState } from \"react\";\r\n\r\nconst mapState = (state: RootState) => {\r\n let result: PageHomeState = {};\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageHomePropsDispach = {\r\n onClickCollection: () =>\r\n dispatch(commonSlice.actions.goToPage(MenuOptions.Home)),\r\n onClickForgotMyPassword: () =>\r\n dispatch(commonSlice.actions.recoverPassword()),\r\n onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n onClickLogin: () => dispatch(commonSlice.actions.loginPage()),\r\n onClickRegister: () => dispatch(commonSlice.actions.registerPage()),\r\n };\r\n return result;\r\n};\r\n\r\nconst WPageHome = () => {\r\n const [initialized, setInitialized] = useState(true);\r\n\r\n useEffect(() => {\r\n }, []);\r\n\r\n const Mobile = connect(mapState, mapDispatch)(PageHome);\r\n const Web = connect(mapState, mapDispatch)(PageHomeWeb);\r\n\r\n if (!initialized) return null;\r\n\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageHome };\r\n","import { connect } from \"react-redux\";\r\nimport { PageLibrarySection } from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n LibrarySections,\r\n PageLibrarySectionPropsDispatch,\r\n PageLibrarySectionPropsState,\r\n} from \"senac-components/dist/pages/Mobile/PageLibrarySection\";\r\n\r\nimport {\r\n PageLibrarySection as LibraryWeb,\r\n PageLibrarySectionPropsState as PageLibrarySectionPropsStateWeb,\r\n PageLibrarySectionWebProps,\r\n PageLibrarySectionWebPropsDispatch,\r\n} from \"senac-components/dist/pages/Web/PageLibrarySection\";\r\nimport {\r\n Content,\r\n ContentGroup,\r\n ContentMark,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n PageLibraryHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n FavoritesInternalTag,\r\n createTagPage,\r\n editTagByUid,\r\n removeFromFavorite,\r\n} from \"../store/reducers/userDataSlice\";\r\nimport {\r\n loadAndOpenContent,\r\n showContentDetail,\r\n} from \"../store/reducers/contentSlice\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\n\r\nconst mapState = (state: RootState) => {\r\n var options: LibrarySections[] = [\r\n LibrarySections.Favorites,\r\n LibrarySections.Downloads,\r\n LibrarySections.ReadingList,\r\n LibrarySections.Marks,\r\n ];\r\n\r\n if (!state.commonState.runningInMobile) {\r\n options = options.filter(section => section !== LibrarySections.Downloads);\r\n }\r\n\r\n let result: PageLibrarySectionPropsState = {\r\n options: options,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst getFavoriteContets = (state: RootState) => {\r\n var allContents = state.contentState.allContents;\r\n var data = state.userDataState.userData.filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.length > 0 &&\r\n p.targetType == \"ManagedContent\" &&\r\n p.contextType == \"ManagedContent\" &&\r\n p.tags.find((t) => t.name === FavoritesInternalTag) != null\r\n );\r\n var uniqueTags = data\r\n .map((p) => p.tags ?? [])\r\n .reduce(\r\n (p, c) => [...new Map([...c, ...p].map((p) => [p.uid, p])).values()],\r\n []\r\n )\r\n .filter((p) => p.name == FavoritesInternalTag);\r\n var remoteContents = data.filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.filter((t) => uniqueTags.find((ut) => ut.uid == t.uid)).length > 0\r\n );\r\n var contentsUids = [\r\n ...new Map(\r\n remoteContents.map((p) => [p.contextUid, p.contextUid])\r\n ).values(),\r\n ];\r\n var contents = contentsUids\r\n .map((p) => allContents.find((c) => c.uid == p))\r\n .filter((p) => p) as Content[];\r\n return contents;\r\n};\r\n\r\nconst getAppointments = (state: RootState) => {\r\n var allContent = state.contentState.allContents;\r\n var data = state.userDataState.userData.filter(\r\n (p) =>\r\n p.targetType == \"ManagedContentReference\" &&\r\n p.contextType == \"ManagedContent\"\r\n );\r\n var marks: ContentMark[] = [];\r\n data.forEach((userData) => {\r\n var mark = marks.find((p) => p.uid == userData.contextUid);\r\n var content = allContent.find((p) => p.uid == userData.contextUid);\r\n if (!content) return;\r\n\r\n if (!mark) {\r\n //todo: alterar para tipo number\r\n mark = {\r\n uid: userData.contextUid,\r\n title: content.title,\r\n image: content.image,\r\n };\r\n marks.push(mark);\r\n }\r\n\r\n var total = Number.parseInt(mark.numberMark ?? \"0\");\r\n total++;\r\n\r\n mark.numberMark = total.toString();\r\n });\r\n\r\n return marks.map((item) => ({\r\n ...item,\r\n appointmentsLength: item.numberMark,\r\n })) as Content[];\r\n};\r\n\r\nconst getCollectionLits = (state: RootState) => {\r\n const userState = state.userDataState;\r\n\r\n var data = [...userState.userData, ...userState.userDataShared].filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.length > 0 &&\r\n p.name != FavoritesInternalTag &&\r\n p.targetType == \"ManagedContent\" &&\r\n p.contextType == \"ManagedContent\"\r\n );\r\n var uniqueTags = [...userState.tags, ...userState.sharedTags].filter(\r\n (p) => p.name != FavoritesInternalTag\r\n );\r\n var contentsMap: any = {};\r\n\r\n for (var userData of data) {\r\n for (var tag of userData.tags ?? []) {\r\n var list = contentsMap[tag.uid];\r\n\r\n if (!list) {\r\n list = [];\r\n contentsMap[tag.uid] = list;\r\n }\r\n\r\n var contentData = state.contentState.allContents.find(\r\n (p) => p.uid == userData.contextUid\r\n );\r\n if (contentData) list.push(contentData);\r\n }\r\n }\r\n\r\n var contents: ContentGroup[] = uniqueTags.map((tag) => {\r\n var contentGroup: ContentGroup = {\r\n uid: tag.uid,\r\n title: tag.name,\r\n editable: true,\r\n books: contentsMap[tag.uid],\r\n };\r\n return contentGroup;\r\n });\r\n\r\n return contents;\r\n};\r\nconst webMapState = (state: RootState) => {\r\n var options: LibrarySections[] = [\r\n LibrarySections.ReadingList,\r\n LibrarySections.Favorites,\r\n ];\r\n\r\n const favoritedBooks = getFavoriteContets(state);\r\n const marked_books = getAppointments(state);\r\n const collectionList = getCollectionLits(state);\r\n const result: PageLibrarySectionPropsStateWeb = {\r\n collectionsList: collectionList,\r\n options,\r\n shareds: state.userDataState.sharedTags.map((tag) => tag.uid),\r\n favorites: [\r\n {\r\n uid: \"favorites\",\r\n title: \"Favoritos\",\r\n books: favoritedBooks,\r\n },\r\n ],\r\n appointments: [\r\n {\r\n uid: \"appointments\",\r\n title: \"Marcações\",\r\n books: marked_books,\r\n },\r\n ],\r\n };\r\n return result;\r\n};\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageLibrarySectionPropsDispatch = {\r\n onSelectedSection: (option: LibrarySections) =>\r\n dispatch(commonSlice.actions.goToLibraryPage(option)),\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageLibraryHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToLibraryOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst webmapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageLibrarySectionWebPropsDispatch = {\r\n onClickRemoveFavorite: (content) => {\r\n console.log(\"checgou o click aqui\");\r\n return dispatch(removeFromFavorite(content));\r\n },\r\n onSelectedEditionEpub: (content: Content) =>\r\n dispatch(loadAndOpenContent(content.uid)),\r\n onSelectedSection: (option: LibrarySections) =>\r\n dispatch(commonSlice.actions.goToLibraryPage(option)),\r\n onSelectedContent: (content: ContentGroup) =>\r\n dispatch(showContentDetail(content.uid)),\r\n onEditionGroup: (group: ContentGroup) => dispatch(editTagByUid(group.uid)),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageLibraryHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToLibraryOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n onCreateList: () => dispatch(createTagPage()),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageLibrarySection = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageLibrarySection);\r\n const Web = connect(webMapState, webmapDispatch)(LibraryWeb);\r\n const isMobile = window.innerWidth < 1024;\r\n if (isMobile) return ;\r\n return ;\r\n};\r\nexport { WPageLibrarySection };\r\n","import { connect } from \"react-redux\";\r\nimport { PageLibraryFavorite } from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n Content,\r\n ContentOptionDetail,\r\n ContentOptionDownload,\r\n ContentOptionDownloaded,\r\n ContentOptionFavorite,\r\n ContentOptionFavorited,\r\n ContentOptionReadingList,\r\n ContentReference,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n PageLibraryHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n PageLibraryFavoritePropsDispatch,\r\n PageLibraryFavoritePropsState,\r\n} from \"senac-components/dist/pages/Mobile/PageLibraryFavorite\";\r\nimport {\r\n FavoritesInternalTag,\r\n deleteContentReference,\r\n downloadContentReference,\r\n insertInFavorite,\r\n removeFromFavorite,\r\n} from \"../store/reducers/userDataSlice\";\r\nimport { showContentDetail } from \"../store/reducers/contentSlice\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\n\r\nconst mapState = (state: RootState) => \r\n{\r\n var inMobile = state.commonState.runningInMobile;\r\n var allContents = state.contentState.allContents;\r\n\r\n var data = state.userDataState.userData.filter(p=> p.tags && p.tags.length > 0 && p.targetType == \"ManagedContent\" && p.contextType == \"ManagedContent\" && p.tags.find(t=> t.name === FavoritesInternalTag) != null);\r\n var uniqueTags = data.map(p=> p.tags ?? []).reduce((p, c)=> [...new Map([...c, ...p].map(p=> [p.uid, p])).values()], []).filter(p=> p.name == FavoritesInternalTag);\r\n var remoteContents = data.filter(p=> p.tags && p.tags.filter(t=> uniqueTags.find(ut=> ut.uid == t.uid)).length > 0);\r\n var contentsUids = [... new Map(remoteContents.map(p=> [p.contextUid, p.contextUid])).values()];\r\n var contents = contentsUids.map(p=> allContents.find(c=> c.uid == p)).filter(p=> p) as Content[];\r\n\r\n // var data = state.userDataState.userData.filter(p=> p.tags && p.tags.length > 0 && p.targetType == \"ManagedContent\" && p.contextType == \"ManagedContent\");\r\n // var uniqueTags = data.map(p=> p.tags ?? []).reduce((p, c)=> [...new Map([...c, ...p].map(p=> [p.uid, p])).values()], []).filter(p=> p.name == FavoritesInternalTag);\r\n // var remoteContents = data.filter(p=> p.tags && p.tags.filter(t=> uniqueTags.find(ut=> ut.uid == t.uid)).length > 0);\r\n // var contentsUids = [... new Map(remoteContents.map(p=> [p.contextUid, p.contextUid])).values()];\r\n // var contents = contentsUids.map(p=> allContents.find(c=> c.uid == p)).filter(p=> p) as Content[];\r\n\r\n var favorites = contents?.map((p) => p.uid) ?? [];\r\n var downloads: string[] | undefined = undefined;\r\n\r\n if (inMobile) {\r\n downloads = state.contentState.allContents.filter(p=> p.references?.find(r=> r.downloadProgress && r.downloadProgress > 0) != undefined).map(p=> p.uid);\r\n }\r\n\r\n console.log(\"favoo\", contents);\r\n\r\n let result: PageLibraryFavoritePropsState = {\r\n contentsFavorited: favorites,\r\n contentsDownloaded: downloads,\r\n contents: contents,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n //Ação inicial:\r\n // dispatch(contentSlice.actions.changeState('initializing'));\r\n\r\n const result: PageLibraryFavoritePropsDispatch = {\r\n onSelectedContentOption: (\r\n content: Content,\r\n option: PageLibraryHeaderOptionItem\r\n ) => {\r\n console.log(option);\r\n switch (option) {\r\n case ContentOptionFavorited: {\r\n dispatch(removeFromFavorite(content));\r\n break;\r\n }\r\n case ContentOptionFavorite: {\r\n dispatch(insertInFavorite(content));\r\n break;\r\n }\r\n case ContentOptionDetail: {\r\n dispatch(showContentDetail(content.uid));\r\n break;\r\n }\r\n case ContentOptionReadingList: {\r\n dispatch(contentSlice.actions.goToContentInfo(option));\r\n break;\r\n }\r\n }\r\n },\r\n onOpenContent: (data: Content) => dispatch(showContentDetail(data.uid)),\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageLibraryHeaderOptionItem) =>dispatch(commonSlice.actions.goToLibraryOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) => dispatch(commonSlice.actions.goToPage(option)),\r\n onDeleteContent: (reference: ContentReference) => reference?.uid && dispatch(deleteContentReference(reference.uid)),\r\n onDownloadContent: (reference: ContentReference) => reference?.uid && dispatch(downloadContentReference(reference.uid)),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageLibraryFavorite = connect(\r\n mapState,\r\n mapDispatch\r\n)(PageLibraryFavorite);\r\n\r\nexport { WPageLibraryFavorite };\r\n","import { connect } from \"react-redux\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport { PageMyProfile } from \"senac-components\";\r\nimport { PageMyProfileDispatchProps, Profile } from \"senac-components/dist/pages/Mobile/PageMyProfile\";\r\nimport { PageMyProfileWeb, PageMyProfileDispatchProps as PageMyProfileDispatchWebProps } from \"senac-components/dist/pages/Web/PageMyProfile\";\r\nimport { MenuOptions, PageHeaderOptionItem } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { updatingUser } from \"../store/reducers/userSlice\";\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\n\r\n\r\nconst mapState = (state: RootState) => \r\n{\r\n const organization = (state.userState.organizations?.find(item => item.migrated) ?? {}).name ?? \r\n Sdk.Api.authorization.activeProject?.directory?.name ?? 'Minha organização'\r\n\r\n const privacy = (state.userState.preferences ?? []).find((item: any) => item.key === 'accepted_privacy_police')\r\n const result:Profile & { organization?: any, acceptedPrivacyPolice?: any, userOrganizations?: any[] } = {\r\n uid : state.userState.user?.uid,\r\n email : state.userState.user?.email,\r\n login : state.userState.user?.login,\r\n name : state.userState.user?.name,\r\n cpf: state.userState.user?.cpf,\r\n phone : state.userState.user?.phone,\r\n organization,\r\n acceptedPrivacyPolice: Boolean(privacy),\r\n userOrganizations: state.userState.projects ?? [],\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => \r\n{\r\n const result: PageMyProfileDispatchProps & Partial = \r\n {\r\n onClickOrganizationMigrated: () => dispatch(userSlice.actions.showMyProjects()),\r\n onClickLinkOrganization: () => dispatch(userSlice.actions.syncOrganization()),\r\n onClickLogout : () => dispatch(userSlice.actions.logout()),\r\n onClickBack : () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToMyProfileOption(option)),\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onClickUpdateProfile: (profile: Profile)=> dispatch(updatingUser(profile)),\r\n onSelectedNavigationPageOption: (option:MenuOptions) => dispatch(commonSlice.actions.goToPage(option)),\r\n onClickChangePassword: () => dispatch(commonSlice.actions.changePage()),\r\n };\r\n return result;\r\n};\r\n\r\nconst WPageProfile = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageMyProfile);\r\n const Web = connect(mapState, mapDispatch)(PageMyProfileWeb);\r\n if(window.innerWidth < 1024) return \r\n return \r\n}\r\n\r\nexport { WPageProfile };\r\n","import { connect } from \"react-redux\";\r\nimport { PageSummary } from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport { Wrapper, WrapperDispatchProps, WrapperStateProps } from \"./Wrapper\";\r\nimport { Content, ContentHeaderOptionItem, MenuOptions } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { PageSummaryPropsDispach, PageSummaryStateProps } from \"senac-components/dist/pages/Mobile/PageSummary\";\r\nimport { ContentType, contentSummary, openContent } from \"../store/reducers/contentSlice\";\r\n\r\n\r\nconst mapState = (state: RootState, props: any) => \r\n{\r\n const activeContent = state.contentState.allContents.find(p=> p.uid == state.contentState.activeContentUid);\r\n const content = { ...activeContent ?? {uid:\"-\"} }\r\n const contentSummary = state.contentState.contentSummary;\r\n\r\n let result: PageSummaryStateProps & WrapperStateProps = {\r\n contentsFavorited: [],\r\n contentsDownloaded: [],\r\n authenticatedUser : state.userState.user != undefined,\r\n summaries: contentSummary,\r\n content:content,\r\n element: PageSummary, //todo: tratar caso onde é nulo\r\n availableEpubFormat: true,\r\n availablePdfFormat: true,\r\n loadingSummary: state.contentState.loadingSummary,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch, props:any) => \r\n{\r\n const result: PageSummaryPropsDispach & WrapperDispatchProps = \r\n {\r\n onClickItemSummary(summaryItem) {\r\n dispatch(contentSlice.actions.setSummaryItem(summaryItem))\r\n },\r\n onChangeParams: (content) => {\r\n // dispatch(contentSlice.actions.setLoadingSummary(true));\r\n // dispatch(contentSummary(content));\r\n },\r\n onSelectedHeaderBack: ()=> dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option:ContentHeaderOptionItem)=> dispatch(contentSlice.actions.goToContentInfo(option)),\r\n onSelectedNavigationPageOption: (option:MenuOptions) => dispatch(commonSlice.actions.goToPage(option)),\r\n onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n };\r\n return result;\r\n};\r\n\r\nconst WPageBookSummary = connect(mapState, mapDispatch)(Wrapper);\r\n\r\nexport { WPageBookSummary };\r\n","import { connect } from \"react-redux\";\r\nimport { PageList, PageListWeb } from \"senac-components\";\r\nimport { commonSlice, contentSlice, userDataSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n PageBookDetailPropsDispach,\r\n PageBookDetailState,\r\n} from \"senac-components/dist/pages/Mobile/PageBookDetail\";\r\nimport { Wrapper, WrapperDispatchProps, WrapperStateProps } from \"./Wrapper\";\r\nimport {\r\n Content,\r\n ContentHeaderOptionItem,\r\n MenuOptions,\r\n ReadingListItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n PageLisDispach,\r\n PageListState,\r\n} from \"senac-components/dist/pages/Mobile/PageList\";\r\nimport {\r\n createTagPage,\r\n FavoritesInternalTag,\r\n insertInTagActiveContent,\r\n removeFromTagActiveContent,\r\n} from \"../store/reducers/userDataSlice\";\r\nimport { showContentDetail } from \"../store/reducers/contentSlice\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\n\r\nconst mapState = (state: RootState, props: any) => {\r\n \r\n const activeContent = state.contentState.allContents.find(p=> p.uid == state.contentState.activeContentUid);\r\n const content = { ...(activeContent ?? { uid: \"-\" }) };\r\n var data = state.userDataState.userData.filter(p=> p.tags && p.tags.length > 0 && p.targetType == \"ManagedContent\" && p.contextType == \"ManagedContent\" && p.contextUid == content.uid);\r\n var uniqueTags = data.map(p=> p.tags ?? []).reduce((p, c)=> [...new Map([...c, ...p].map(p=> [p.uid, p])).values()], []);\r\n var isFavorited = uniqueTags.find(p=> p.name == FavoritesInternalTag) != undefined;\r\n\r\n const selectedList = uniqueTags.map(p=> p.uid);\r\n const available = state.userDataState.tags?.filter((t) => t.name != FavoritesInternalTag);\r\n\r\n let result: PageListState = {\r\n contentsFavorited: isFavorited ? [content.uid] : [],\r\n contentsDownloaded: [],\r\n selected: selectedList,\r\n itemsLists: available,\r\n content: content\r\n };\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch, props: any) => {\r\n const result: PageLisDispach = {\r\n onSelectItemChange: (item: ReadingListItem, status: boolean) => {\r\n if (status) {\r\n dispatch(insertInTagActiveContent(item.uid));\r\n } else {\r\n dispatch(removeFromTagActiveContent(item.uid));\r\n }\r\n },\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: ContentHeaderOptionItem) =>\r\n dispatch(contentSlice.actions.goToContentInfo(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n onCreateList: () => dispatch(createTagPage()),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n };\r\n return result;\r\n};\r\n\r\nconst WPageBookReadingList = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageList);\r\n const Web = connect(mapState, mapDispatch)(PageListWeb);\r\n if(window.innerWidth < 1024) return \r\n return \r\n}\r\n\r\nexport { WPageBookReadingList };\r\n","import { connect } from \"react-redux\";\r\nimport { PageAppointments, PageLibraryReadingListCard } from \"senac-components\";\r\nimport { commonSlice, contentSlice, userDataSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport { Wrapper, WrapperDispatchProps, WrapperStateProps } from \"./Wrapper\";\r\nimport {\r\n Content,\r\n ContentGroup,\r\n ContentHeaderOptionItem,\r\n MenuOptions,\r\n PageLibraryHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n PageLibraryReadingListCardDispatchProps,\r\n PageLibraryReadingListCardStateProps,\r\n} from \"senac-components/dist/pages/Mobile/PageLibraryReadingListCard\";\r\nimport {\r\n createTagPage,\r\n editTagByUid,\r\n FavoritesInternalTag,\r\n} from \"../store/reducers/userDataSlice\";\r\nimport { loadAndOpenContent, showContentDetail } from \"../store/reducers/contentSlice\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\n\r\nconst mapState = (state: RootState, props: any) => \r\n{\r\n const userState = state.userDataState;\r\n\r\n var data = [...userState.userData, ...userState.userDataShared ].filter(p=> p.tags && p.tags.length > 0 && p.name != FavoritesInternalTag && p.targetType == \"ManagedContent\" && p.contextType == \"ManagedContent\");\r\n var uniqueTags = [ ...userState.tags, ...userState.sharedTags].filter(p=> p.name != FavoritesInternalTag);\r\n var contentsMap:any = {};\r\n\r\n for (var userData of data)\r\n {\r\n for(var tag of userData.tags ?? [])\r\n {\r\n var list = contentsMap[tag.uid];\r\n\r\n if (!list){\r\n list = [];\r\n contentsMap[tag.uid] = list;\r\n }\r\n\r\n var contentData = state.contentState.allContents.find(p=> p.uid == userData.contextUid);\r\n if (contentData) list.push(contentData);\r\n }\r\n }\r\n\r\n var contents: ContentGroup[] = uniqueTags\r\n .map(tag=> {\r\n var contentGroup: ContentGroup = \r\n {\r\n uid: tag.uid,\r\n title: tag.name,\r\n editable: true,\r\n books: contentsMap[tag.uid]\r\n }\r\n return contentGroup;\r\n });\r\n\r\n let result: PageLibraryReadingListCardStateProps = \r\n {\r\n searchedBooks: contents,\r\n };\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch, props: any) => {\r\n const result: PageLibraryReadingListCardDispatchProps & WrapperDispatchProps = {\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageLibraryHeaderOptionItem) =>dispatch(commonSlice.actions.goToLibraryOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) => dispatch(commonSlice.actions.goToPage(option)),\r\n onClickCreate: () => dispatch(createTagPage()),\r\n onSelectedContent: (content: ContentGroup) => dispatch(showContentDetail(content.uid)),\r\n onEditionGroup: (group: ContentGroup) => dispatch(editTagByUid(group.uid)),\r\n onSelectedEditionEpub: (content: Content) =>\r\n dispatch(loadAndOpenContent(content.uid)),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n }\r\n };\r\n return result;\r\n};\r\n\r\nconst WPageLibraryReadingListCard = connect(mapState, mapDispatch)(PageLibraryReadingListCard);\r\nexport { WPageLibraryReadingListCard };\r\n","import { connect } from \"react-redux\";\r\nimport { PageLibraryReadingList } from \"senac-components\";\r\nimport { commonSlice, contentSlice, userSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch, useAppDispatch } from \"../store\";\r\nimport { Wrapper, WrapperDispatchProps, WrapperStateProps } from \"./Wrapper\";\r\nimport {\r\n ContentFilters,\r\n ContentGroup,\r\n ContentHeaderOptionItem,\r\n MenuOptions,\r\n PageLibraryHeaderOptionItem,\r\n ReadingListItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n PageLibraryReadingListDispach,\r\n PageLibraryReadingListState,\r\n} from \"senac-components/dist/pages/Mobile/PageLibraryReadingList\";\r\nimport {\r\n PageLibraryReadingListProps,\r\n PageLibraryReadingListWeb,\r\n PageLibraryReadingListDispach as PageLibraryReadingListDispachWeb,\r\n} from \"senac-components/dist/pages/Web/PageLibraryReadingList\";\r\nimport {\r\n FavoritesInternalTag,\r\n insertTagShared,\r\n loadTag,\r\n removeActiveTag,\r\n searchAndSubscribeTag,\r\n shareCode,\r\n updateActiveTag,\r\n userDataSlice,\r\n} from \"../store/reducers/userDataSlice\";\r\nimport { Content } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { ReadingListWeb } from \"./RadingListWeb\";\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\nimport { useEffect } from \"react\";\r\nimport { useParams, useSearchParams } from \"react-router-dom\";\r\n\r\nconst getCollectionList = (state: RootState) => {\r\n const userState = state.userDataState;\r\n\r\n var data = [...userState.userData, ...userState.userDataShared].filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.length > 0 &&\r\n p.name != FavoritesInternalTag &&\r\n p.targetType == \"ManagedContent\" &&\r\n p.contextType == \"ManagedContent\"\r\n );\r\n var uniqueTags = [...userState.tags, ...userState.sharedTags].filter(\r\n (p) => p.name != FavoritesInternalTag\r\n );\r\n var contentsMap: any = {};\r\n\r\n for (var userData of data) {\r\n for (var tag of userData.tags ?? []) {\r\n var list = contentsMap[tag.uid];\r\n\r\n if (!list) {\r\n list = [];\r\n contentsMap[tag.uid] = list;\r\n }\r\n\r\n var contentData = state.contentState.allContents.find(\r\n (p) => p.uid == userData.contextUid\r\n );\r\n if (contentData) list.push(contentData);\r\n }\r\n }\r\n\r\n var contents: ContentGroup[] = uniqueTags.map((tag) => {\r\n var contentGroup: ContentGroup = {\r\n uid: tag.uid,\r\n title: tag.name,\r\n editable: true,\r\n books: contentsMap[tag.uid],\r\n };\r\n return contentGroup;\r\n });\r\n\r\n return contents;\r\n};\r\n\r\nconst getContetsFromTag = (state: RootState, tagUid?: string) => {\r\n var allContent = state.contentState.allContents;\r\n \r\n const userDataState = state.userDataState;\r\n var tag = [...userDataState.tags, ...userDataState.sharedTags].find(\r\n (t) => t.uid === userDataState.activeTagUid\r\n );\r\n var data = [\r\n ...userDataState.userData,\r\n ...userDataState.userDataShared,\r\n ].filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.length > 0 &&\r\n p.targetType == \"ManagedContent\" &&\r\n p.contextType == \"ManagedContent\"\r\n );\r\n var uniqueTags = data\r\n .map((p) => p.tags ?? [])\r\n .reduce(\r\n (p, c) => [...new Map([...c, ...p].map((p) => [p.uid, p])).values()],\r\n []\r\n )\r\n .filter((p) => p.uid == tag?.uid || p.uid === tagUid);\r\n var contentsUids = data\r\n .filter(\r\n (p) =>\r\n p.tags &&\r\n p.tags.filter((t) => uniqueTags.find((ut) => ut.uid == t.uid)).length >\r\n 0\r\n )\r\n .map((p) => p.contextUid);\r\n\r\n var contents = contentsUids.map((p) =>\r\n allContent.find((c) => c.uid == p)\r\n ) as Content[];\r\n\r\n return contents;\r\n};\r\n\r\nconst mapState = (state: RootState, props: any) => {\r\n const userDataState = state.userDataState;\r\n var allContent = state.contentState.allContents;\r\n var activeContent = state.contentState.activeContentReference;\r\n var tag = [...userDataState.tags, ...userDataState.sharedTags].find(\r\n (t) => t.uid === userDataState.activeTagUid\r\n );\r\n var contents = getContetsFromTag(state);\r\n var suggestGroup: ContentGroup | undefined = undefined;\r\n\r\n if (state.contentState.suggestedContent) {\r\n suggestGroup = {\r\n uid: \"sugges\",\r\n title: \"Sugestões para sua lista\",\r\n books: allContent.filter((p) =>\r\n state.contentState.suggestedContent?.find((s) => s == p.uid)\r\n ),\r\n };\r\n }\r\n\r\n const list = getCollectionList(state);\r\n const name = `Nova lista ${list.length + 1}`;\r\n\r\n const getContentsFromTagUid = async (code: string) => {\r\n var url = `cms/v1.1/user/data/shared/available?code_share=${code}`;\r\n return await Sdk.Api.dynamic.bridge(url, null, \"GET\")\r\n .then(response => response.result.map((item : { context_uid: string }) => item.context_uid))\r\n .catch(err => err);\r\n }\r\n const onSearch = async (code: string) => {\r\n var url = `cms/v1.1/user/data/tags/shared/available?code_share=${code}`;\r\n const contents = await getContentsFromTagUid(code);\r\n return await Sdk.Api.dynamic\r\n .bridge(url, null, \"GET\")\r\n .then((response) => {\r\n if (response.result.length) {\r\n const [tag] = response.result;\r\n return {\r\n ...tag,\r\n contents: allContent.filter(content => contents.includes(content.uid))\r\n }\r\n }\r\n })\r\n .catch(err => err);\r\n };\r\n let result: PageLibraryReadingListState &\r\n Partial & { importingCode?: string } = {\r\n suggestContents: suggestGroup,\r\n activeBook: activeContent,\r\n listName: name,\r\n onSearchListShare: onSearch,\r\n importingCode: state.userState.codeReadingList\r\n };\r\n\r\n if (tag) {\r\n result.detail = { ...tag, contents: contents };\r\n result.processing = false;\r\n }\r\n\r\n return result;\r\n};\r\n\r\nconst commomDispatch = (dispatch: AppDispatch, props: any) => {\r\n const result: PageLibraryReadingListDispach = {\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageLibraryHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToLibraryOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n onClickDeleteList: () => dispatch(removeActiveTag()),\r\n onClickShareCode: (code: string) => dispatch(shareCode(code)),\r\n onChangeList: (list: ReadingListItem) => dispatch(updateActiveTag(list)),\r\n onClickSearchShare: (uid: string) => dispatch(searchAndSubscribeTag(uid)),\r\n onChangeFilter: (filter) => {\r\n if (filter.query === undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n };\r\n\r\n return result;\r\n};\r\n\r\n// const getList = (code: string) => {\r\n\r\n// }\r\nconst webDispatch = (dispatch: AppDispatch, props: any) => {\r\n const commom = commomDispatch(dispatch, props);\r\n const result: PageLibraryReadingListDispach &\r\n PageLibraryReadingListDispachWeb = {\r\n ...commom,\r\n };\r\n return result;\r\n};\r\n\r\nconst WPageLibraryReadingList = () => {\r\n const [searchParams] = useSearchParams();\r\n const code = searchParams.get('code');\r\n const dispatch = useAppDispatch();\r\n\r\n useEffect(() => {\r\n if (code) {\r\n dispatch(userSlice.actions.setImportReadingList(code));\r\n }\r\n }, []);\r\n \r\n const Mobile = connect(mapState, commomDispatch)(PageLibraryReadingList);\r\n const Web = connect(mapState, webDispatch)(PageLibraryReadingListWeb);\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageLibraryReadingList };\r\n","import { connect } from \"react-redux\";\r\nimport { PageBookFound, PageBookFoundWeb } from \"senac-components\";\r\nimport { commonSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport { Wrapper, WrapperStateProps, WrapperDispatchProps } from \"./Wrapper\";\r\nimport {\r\n Content,\r\n ContentGroup,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n PageBookFoundDispach,\r\n PageBookFoundState,\r\n} from \"senac-components/dist/pages/Mobile/PageBookFound\";\r\nimport {\r\n contentSlice,\r\n loadAndOpenContent,\r\n loadMoreFromActiveContentFilter,\r\n showContentDetail,\r\n} from \"../store/reducers/contentSlice\";\r\nimport { PageBookFoundWebDispach } from \"senac-components/dist/pages/Web/PageBookFound\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\n\r\nconst mapState = (state: RootState, props: any) => {\r\n const Component =\r\n window.innerWidth >= 1024 ? PageBookFoundWeb : PageBookFound;\r\n var allContent = state.contentState.allContents;\r\n var contents: Content[] | undefined = undefined;\r\n\r\n if (state.contentState.contentFromFilter) {\r\n contents = state.contentState.contentFromFilter\r\n .map((p) => allContent.find((c) => c.uid == p))\r\n .filter((p) => p != undefined) as Content[];\r\n }\r\n\r\n let result: PageBookFoundState & WrapperStateProps & { fetching?: boolean } = {\r\n title: state.contentState.activeFilter?.query ?? \"\",\r\n contents: contents,\r\n element: Component,\r\n authenticatedUser: state.userState.user != undefined,\r\n showButtonMore: state.contentState.activeFilter?.customQuery ? true : false,\r\n totalContents: state.contentState.totalContentsFromFilter,\r\n fetching: state.contentState.activeFilter?.processing\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch, props: any) => {\r\n const result: PageBookFoundDispach & WrapperDispatchProps & Partial = {\r\n onClickContent: (content: Content) =>\r\n dispatch(showContentDetail(content.uid)),\r\n onClickContentDetail: (content: Content) =>\r\n dispatch(loadAndOpenContent(content.uid)),\r\n onChangeSearchParams(params) {\r\n if (!params) return;\r\n\r\n console.log(\"......\",params)\r\n var value = params.get(\"q\");\r\n if (value == null) return;\r\n\r\n console.log(\"paras:\" , value)\r\n dispatch(contentSlice.actions.contentFilter({ query : value}))\r\n },\r\n onChangeParams: (params: any) => {\r\n \r\n },\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToPageOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n const filterData = { query: filter.query };\r\n\r\n dispatch(filterContent(filterData));\r\n // dispatch(contentSlice.actions.contentFilter(filterData))\r\n },\r\n onClickShowMore: () => {\r\n dispatch(loadMoreFromActiveContentFilter());\r\n },\r\n };\r\n return result;\r\n};\r\n\r\nconst WPageBookFound = connect(mapState, mapDispatch)(Wrapper);\r\n\r\nexport { WPageBookFound };\r\n","import { connect } from \"react-redux\";\r\nimport { userSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\n\r\n// import \"../css/reader.css\";\r\n\r\nexport interface TempProfilePage\r\n{\r\n onLogout:()=> void;\r\n}\r\n\r\nconst TempPageProfile: React.FC = ({\r\n onLogout\r\n}) =>\r\n{\r\n \r\n return(\r\n
\r\n Pendente\r\n
\r\n )\r\n};\r\n\r\n\r\nconst mapState = (state: RootState) => \r\n{\r\n const result = {};\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => \r\n{\r\n const result:TempProfilePage = \r\n {\r\n onLogout : ()=> dispatch(userSlice.actions.logout())\r\n };\r\n return result;\r\n};\r\n\r\nconst WReader = connect(mapState, mapDispatch)(TempPageProfile);\r\n\r\nexport { WReader };\r\n","import { connect } from \"react-redux\";\r\nimport { PageRecoverPassword } from \"senac-components\";\r\nimport {\r\n PageRecoverPasswordDispatchProps,\r\n PageRecoverPasswordStateProps,\r\n RecoverPassword,\r\n} from \"senac-components/dist/pages/Mobile/PageRecoverPassword\";\r\nimport { PageRecoveryPasswordWeb } from \"senac-components/dist/pages/Web/PageRecoveryPasswordWeb\";\r\n\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\n\r\nconst mapState = (state: RootState) => {\r\n let result: PageRecoverPasswordStateProps = {\r\n loading: state.userState.userAuthenticating,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageRecoverPasswordDispatchProps = {\r\n onClickBack: () => dispatch(commonSlice.actions.backPage()),\r\n onClickRecoverPassword: (recoverPassword: RecoverPassword) =>\r\n dispatch(userSlice.actions.createPasswordFromRecovery(recoverPassword)),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageRecoverPassword = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageRecoverPassword);\r\n const Web = connect(mapState, mapDispatch)(PageRecoveryPasswordWeb);\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageRecoverPassword };\r\n","import { connect } from \"react-redux\";\r\nimport { PageChangeYourPassword } from \"senac-components\";\r\nimport {\r\n ChangePasswordResult,\r\n PageChangeYourPasswordDispatchProps,\r\n PageChangeYourPasswordStateProps,\r\n} from \"senac-components/dist/pages/Mobile/PageChangeYourPassword\";\r\nimport { PageChangeYourPasswordWeb } from \"senac-components/dist/pages/Web/PageChangeYourPasswordWeb\";\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice, contentSlice, userSlice } from \"../store/reducers\";\r\nimport {\r\n ContentHeaderOptionItem,\r\n MenuOptions,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { changePassword } from \"../store/reducers/userSlice\";\r\n\r\nconst mapState = (state: RootState) => {\r\n let result: PageChangeYourPasswordStateProps = {\r\n loading: state.userState.userAuthenticating,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageChangeYourPasswordDispatchProps = {\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: ContentHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToMyProfileOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n // onClickChangePassword: () => {},\r\n\r\n onClickChangePassword: (pass: ChangePasswordResult) => {\r\n if(pass.newPassword !== pass.repeatPassword) {\r\n dispatch(commonSlice.actions.showAlert({\r\n title : \"Login\",\r\n description : \"Não foi possivel alterar a senha. A confirmação está diferente.\",\r\n show:true\r\n }))\r\n\r\n return;\r\n }\r\n dispatch(\r\n changePassword({ password: pass.newPassword, currentPassword: pass.currentPassword, })\r\n )\r\n },\r\n\r\n // onClickHelp: () => dispatch(commonSlice.actions.helpPage()),\r\n // onClickRecoverPassword: (recoverPassword: string) =>\r\n // dispatch(userSlice.actions.recoverPassword(recoverPassword)\r\n // )\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageChangeYourPassword = () => {\r\n const Component =\r\n window.innerWidth < 1024\r\n ? PageChangeYourPassword\r\n : PageChangeYourPasswordWeb;\r\n const Page = connect(mapState, mapDispatch)(Component);\r\n return ;\r\n};\r\n\r\nexport { WPageChangeYourPassword };\r\n","import { connect } from \"react-redux\";\r\nimport { PageFAQ } from \"senac-components\";\r\nimport {\r\n PageFAQDispatchProps,\r\n PageFAQStateProps,\r\n PageFAQProps,\r\n} from \"senac-components/dist/pages/Mobile/PageFAQ\";\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\nimport { PageHeaderOptionItem } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\n\r\nimport { PageFAQWeb } from \"senac-components/dist/pages/Web/PageFAQ\";\r\n\r\nconst mapState = (state: RootState) => {\r\n const authenticatedUser = state.userState.user != undefined;\r\n\r\n let result: PageFAQStateProps = {\r\n authenticatedUser,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageFAQDispatchProps = {\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToMyProfileOption(option)),\r\n onSelectedNavigationPageOption: (option) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageFAQ = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageFAQ);\r\n const Web = connect(mapState, mapDispatch)(PageFAQWeb);\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageFAQ };\r\n","import { connect } from \"react-redux\";\r\nimport { PageContactUs } from \"senac-components\";\r\nimport {\r\n PageContactUsDispatchProps,\r\n PageContactUsStateProps,\r\n ContactUsForm,\r\n} from \"senac-components/dist/pages/Mobile/PageContactUs\";\r\n\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice, contentSlice, userSlice } from \"../store/reducers\";\r\nimport {\r\n ContentHeaderOptionItem,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { PageContactUsWeb } from \"senac-components/dist/pages/Web/PageContactUs\";\r\n\r\ntype StateProps = {\r\n loading: boolean;\r\n authenticatedUser: boolean;\r\n initialParams?: {\r\n email: string;\r\n name: string;\r\n }\r\n clearForm?: boolean;\r\n}\r\n\r\nconst mapState = (state: RootState) => {\r\n const authenticatedUser = state.userState.user != undefined;\r\n\r\n let result: StateProps = {\r\n loading: state.userState.contactLoading,\r\n authenticatedUser,\r\n initialParams: {\r\n email: state.userState.user?.email ?? '',\r\n name: state.userState.user?.name ?? '',\r\n },\r\n clearForm: state.userState.clearContactForm\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageContactUsDispatchProps = {\r\n onSubmitContactUs: (contactUsForm: ContactUsForm) =>\r\n dispatch(userSlice.actions.contactUs(contactUsForm)),\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: ContentHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToMyProfileOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageContactUs = () => {\r\n const Web = connect(mapState, mapDispatch)(PageContactUsWeb);\r\n const Mobile = connect(mapState, mapDispatch)(PageContactUs);\r\n if(window.innerWidth >= 1024) return \r\n return \r\n}\r\n\r\nexport { WPageContactUs };\r\n","import { connect } from \"react-redux\";\r\nimport { PageTermsOfUse } from \"senac-components\";\r\nimport {\r\n PageTermsOfUseDispatchProps,\r\n PageTermsOfUseStateProps,\r\n PageTermsOfUseProps,\r\n} from \"senac-components/dist/pages/Mobile/PageTermsOfUse\";\r\nimport { PageTermsOfUseWeb } from \"senac-components/dist/pages/Web/PageTermsOfUse\";\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\nimport { PageHeaderOptionItem } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\n\r\nconst mapState = (state: RootState) => {\r\n const authenticatedUser = state.userState.user != undefined;\r\n let result: PageTermsOfUseStateProps = {\r\n authenticatedUser: true,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageTermsOfUseDispatchProps = {\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToMyProfileOption(option)),\r\n onSelectedNavigationPageOption: (option) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageTermsOfUse = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PageTermsOfUse);\r\n const Web = connect(mapState)(PageTermsOfUseWeb);\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPageTermsOfUse };\r\n","import { connect } from \"react-redux\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n Content,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { ContentType, openContent } from \"../store/reducers/contentSlice\";\r\nimport {\r\n PageOfflineDispach,\r\n PageOfflineState,\r\n PageOffline,\r\n} from \"senac-components/dist/pages/Mobile/PageOffline\";\r\n\r\nconst mapState = (state: RootState) => {\r\n var contents = state.contentState.allContents\r\n .map((content) => ({\r\n ...content,\r\n references: content.references?.filter((contentReference) =>\r\n Boolean(contentReference.downloadProgress)\r\n ),\r\n }))\r\n .filter(\r\n (p) =>\r\n p.references?.find(\r\n (r) => r.downloadProgress && r.downloadProgress >= 100\r\n ) != undefined\r\n );\r\n\r\n let result: PageOfflineState = {\r\n contents,\r\n title: \"Downloads\",\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageOfflineDispach = {\r\n onClickContent: (data: Content) => {\r\n dispatch(contentSlice.actions.setActiveContentUid(data.uid));\r\n dispatch(\r\n openContent([ContentType.Preference, ContentType.Epub, ContentType.Pdf])\r\n );\r\n },\r\n\r\n onClickReference(referenceType, content) {\r\n const reference =\r\n referenceType === \"PDF\" ? ContentType.Pdf : ContentType.Epub;\r\n dispatch(\r\n contentSlice.actions.openOfflineContent({\r\n uid: content?.uid,\r\n referenceType: reference,\r\n })\r\n );\r\n },\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToPageOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) =>\r\n dispatch(commonSlice.actions.goToPage(option)),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageOffline = connect(mapState, mapDispatch)(PageOffline);\r\n\r\nexport { WPageOffline };\r\n","import { connect } from \"react-redux\";\r\nimport { PageSummary } from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport { PageHelpStateProps, PageHelpDispatchProps, PageHelp } from \"senac-components/dist/pages/Mobile/PageHelp\";\r\n\r\n\r\nconst mapState = (state: RootState, props: any) => \r\n{\r\n return {};\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch, props:any) => \r\n{\r\n const result: PageHelpDispatchProps = \r\n {\r\n onClickBack: ()=> dispatch(commonSlice.actions.backPage()),\r\n };\r\n return result;\r\n};\r\n\r\n\r\nconst WPageHelp = connect(mapState, mapDispatch)(PageHelp);\r\n\r\nexport { WPageHelp };\r\n","import styled from \"styled-components\"\r\n\r\n\r\nexport const Container = styled.div`\r\n width: 100vh;\r\n height: 100vh;\r\n margin: 0px;\r\n padding: 0px;\r\n`;\r\n\r\nexport const IframeContainer = styled.iframe`\r\n position: absolute;\r\n width: 100%;\r\n height: 100%;\r\n margin: 0px;\r\n padding: 0px;\r\n border: 0px;\r\n`;\r\n","import Sdk from \"api.digitalpages.module.sdk.api\";\r\nimport { useEffect, useRef, useState } from \"react\";\r\nimport { useDispatch } from \"react-redux\";\r\nimport {\r\n loadPlayerObserver,\r\n reloadUserData,\r\n} from \"../../store/reducers/userDataSlice\";\r\nimport { useSelector } from \"react-redux\";\r\nimport { RootState } from \"../../store\";\r\nimport { commonSlice } from \"../../store/reducers\";\r\nimport { LastInteraction } from \"./types\";\r\n\r\nvar GO_INTERACTION = 0;\r\nvar LAST_REFERENCE = \"\";\r\n\r\nexport const usePlayer = (uidReference?: string, uidContext?: string) => {\r\n const utilizationRef = useRef(false);\r\n\r\n const [userData, setUserData] = useState([]);\r\n const [lastInteraction, setLastInteraction] =\r\n useState(null);\r\n const [lastReference, setLastReference] = useState(\"\");\r\n const dispatch = useDispatch();\r\n const player = useSelector(\r\n (state) => state.userDataState.playerObserver\r\n );\r\n const referrer = useSelector(\r\n (state) => state.commonState.referrer\r\n );\r\n\r\n const getAnnotations = async (targetUid: string) => {\r\n if (userData.length) return;\r\n const url = `cms/v1.1/user/data?target_uid=${targetUid}`;\r\n\r\n return await Sdk.Api.dynamic.bridge(url, null, \"GET\").then((response) => {\r\n if (response.result) {\r\n setUserData(response.result);\r\n return response.result;\r\n }\r\n });\r\n };\r\n\r\n const createInteraction = async () => {\r\n const url = `cms/v1.1/managed/content/reference/uid/${uidReference}/content`;\r\n\r\n await Sdk.Api.dynamic.bridge(url, null, \"GET\")\r\n };\r\n\r\n const getLastInteraction = async () => {\r\n if (!utilizationRef.current) {\r\n utilizationRef.current = true;\r\n await createInteraction();\r\n \r\n const url = `cms/v1.1/managed/content/reference/uid/${uidReference}/interaction`;\r\n\r\n await Sdk.Api.dynamic\r\n .bridge(url, null, \"GET\")\r\n .then(setLastInteraction)\r\n .catch(async (err) => {\r\n console.log(err)\r\n });\r\n }\r\n };\r\n\r\n const data: any = player;\r\n const history: any = referrer;\r\n\r\n const handleHighlight = async (params: any) => {\r\n const connectors = Sdk.Api.authorization.activeProject.connectors;\r\n if (connectors) {\r\n const connectorUser = connectors.find(\r\n (connector: any) => connector.type === \"UserData_1\"\r\n );\r\n if (!connectorUser) return;\r\n\r\n const userDataParams = {\r\n ...params,\r\n external_type: \"mark-epub\",\r\n target_type: \"ManagedContentReference\",\r\n context_type: \"ManagedContent\",\r\n context_uid: uidContext,\r\n target_uid: uidReference,\r\n name: null,\r\n };\r\n\r\n const url = `cms/v1.1/user/connector/uid/${connectorUser.uid}/data`;\r\n await Sdk.Api.dynamic\r\n .bridge(url, userDataParams, \"POST\")\r\n .then((response) => {\r\n LAST_REFERENCE = response.uid;\r\n getAnnotations(uidReference as string);\r\n dispatch(reloadUserData());\r\n });\r\n }\r\n };\r\n\r\n const handleAnnotation = async (userDataUid: string, params: any) => {\r\n const url = `cms/v1.1/user/data/uid/${userDataUid}`;\r\n await Sdk.Api.dynamic.bridge(url, params, \"PUT\").then(() => {\r\n dispatch(reloadUserData());\r\n });\r\n };\r\n\r\n const handleDeleteAnnotation = async (userDataUid: string) => {\r\n const url = `cms/v1.1/user/data/uid/${userDataUid}`;\r\n await Sdk.Api.dynamic.bridge(url, null, \"DELETE\").then(() => {\r\n setUserData(userData.filter((item) => item.uid != userDataUid));\r\n dispatch(reloadUserData());\r\n });\r\n };\r\n\r\n const getNoteWithoutUID = (annotation: any) => {\r\n const keys = [\"start_position\", \"end_position\", \"chapter_index\"];\r\n const { external_data } = annotation;\r\n const data = JSON.parse(external_data);\r\n const userDataFound = userData.find((user) => {\r\n const { external_data: user_external } = user;\r\n const dataExternal = JSON.parse(user_external);\r\n const deParam = keys.every((item) => data[item] === dataExternal[item]);\r\n if (deParam) return user;\r\n });\r\n if (userDataFound) return userDataFound.uid;\r\n return LAST_REFERENCE;\r\n };\r\n\r\n const trackProgress = async (userProgress: any) => {\r\n if (!lastInteraction) return;\r\n const params: LastInteraction = {\r\n ...lastInteraction,\r\n ...userProgress,\r\n activity_data: JSON.stringify(userProgress.activity_data),\r\n };\r\n\r\n\r\n setLastInteraction(params);\r\n\r\n if(lastInteraction.activity_data === params.activity_data) return\r\n \r\n console.log(params);\r\n\r\n const url = `cms/v1.1/managed/content/interaction/uid/${lastInteraction.uid}`;\r\n await Sdk.Api.dynamic.bridge(url, params, \"PUT\").catch((err) => {\r\n console.log(\"Ocorreu um erro ao registrar o progresso\");\r\n });\r\n };\r\n\r\n useEffect(() => {\r\n if (data) {\r\n if (data.onBack) {\r\n history.map((item: string, id: number) => {\r\n if (item.includes(\"player\")) {\r\n let hash = history[id - 1];\r\n if (hash === undefined || (hash ?? '').includes('player')) {\r\n hash = '#/inicio'\r\n }\r\n window.location.hash = hash;\r\n }\r\n });\r\n dispatch(commonSlice.actions.setRefferer(\"reset\"));\r\n dispatch(loadPlayerObserver());\r\n return;\r\n }\r\n if (data.userInteraction) {\r\n const { type, userData: content } = data.userInteraction;\r\n var uid = \"\";\r\n if (type === \"note\" || type === \"delete\") {\r\n uid = content.uid ? content.uid : getNoteWithoutUID(content);\r\n if (type === \"delete\") {\r\n handleDeleteAnnotation(uid);\r\n return;\r\n } else {\r\n handleAnnotation(uid, {\r\n description: content.description,\r\n external_data: content.external_data,\r\n });\r\n }\r\n }\r\n if (type === \"highligth\") {\r\n handleHighlight(content);\r\n return;\r\n }\r\n\r\n if (type === \"trackProgress\") {\r\n trackProgress(content);\r\n }\r\n }\r\n }\r\n }, [data]);\r\n\r\n return {\r\n getAnnotations,\r\n getLastInteraction,\r\n handleAnnotation,\r\n handleHighlight,\r\n userData,\r\n lastReference,\r\n lastInteraction,\r\n };\r\n};\r\n","import { connect } from \"react-redux\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\n\r\nimport { Container, IframeContainer } from \"./WPlayer.Style\";\r\nimport { useEffect, useMemo, useState } from \"react\";\r\nimport { RemoteContentDetail } from \"../services/contents/IContentService\";\r\nimport { usePlayer } from \"../services/player/usePlayer\";\r\nimport Sdk from \"api.digitalpages.module.sdk.api\";\r\nimport { useDispatch } from \"react-redux\";\r\n\r\nexport interface PlayerStateProps {\r\n loading: boolean;\r\n contentUrl?: string;\r\n uid?: string;\r\n uidContext?: string;\r\n navigateTo?: string;\r\n}\r\n\r\nexport interface PlayerDispatchProps {}\r\n\r\nexport type PlayerProps = PlayerStateProps & PlayerDispatchProps;\r\n\r\n/**\r\n * @function Player: componente responsável por lidar com a renderização do epub.\r\n * @function getUri: essa função é para testes em ambiente de desenvolvimento onde o projeto rodando na porta 3001, é o js_leargning_player_react.\r\n */\r\nconst Player: React.FC = ({\r\n loading,\r\n contentUrl,\r\n uid,\r\n uidContext,\r\n navigateTo,\r\n}) => {\r\n const [uri, setUri] = useState(\"\");\r\n const {\r\n getAnnotations,\r\n getLastInteraction,\r\n lastReference,\r\n userData,\r\n lastInteraction,\r\n } = usePlayer(uid, uidContext);\r\n const dispatch = useDispatch();\r\n\r\n const geUri = async (uid: string) => {\r\n if (!contentUrl) return;\r\n await fetch(contentUrl).then(({ url }) => {\r\n const base = \"http://localhost:3001/\";\r\n const unicode = url.substring(url.indexOf(\"custom_options\"), url.length);\r\n const uURI = `${base}?${unicode}`;\r\n setUri(`${uURI}`);\r\n });\r\n };\r\n\r\n useEffect(() => {\r\n dispatch(commonSlice.actions.setLoader(true));\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (uid && contentUrl) {\r\n getAnnotations(uid).then(async () => {\r\n await getLastInteraction();\r\n setUri(contentUrl);\r\n // geUri(uid)\r\n });\r\n }\r\n }, [uid]);\r\n\r\n return (\r\n \r\n {uri != \"\" && (\r\n {\r\n e.target.contentWindow.postMessage(\r\n {\r\n userData: JSON.stringify(userData),\r\n lastReference,\r\n navigateTo,\r\n lastInteraction,\r\n type: \"RDPEvent:user_interaction\",\r\n },\r\n \"*\"\r\n );\r\n\r\n dispatch(commonSlice.actions.setLoader(false));\r\n }}\r\n onError={() => {\r\n dispatch(commonSlice.actions.setLoader(false));\r\n }}\r\n sandbox=\"allow-scripts allow-forms allow-same-origin allow-pointer-lock allow-presentation allow-modals allow-popups allow-popups-to-escape-sandbox\"\r\n allow=\"camera; microphone; display-capture; autoplay; clipboard-write; encrypted-media\"\r\n src={uri}\r\n >\r\n )}\r\n \r\n );\r\n};\r\n\r\nconst mapState = (state: RootState) => {\r\n var loading = state.contentState.activeContentReference == undefined;\r\n var url: string | undefined = undefined;\r\n\r\n if (!loading) {\r\n url = state.contentState.activeContentReference.url;\r\n }\r\n\r\n const result: PlayerStateProps = {\r\n navigateTo: state.contentState.activeContentAnchorLink,\r\n contentUrl: url,\r\n loading: loading,\r\n uidContext: state.contentState.activeContentUid,\r\n uid: state.contentState.activeContentReference\r\n ? state.contentState.activeContentReference.uid\r\n : \"\",\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PlayerDispatchProps = {\r\n onLogout: () => dispatch(userSlice.actions.logout()),\r\n };\r\n return result;\r\n};\r\n\r\nconst WPlayer = connect(mapState, mapDispatch)(Player);\r\n\r\nexport { WPlayer };\r\n","import { connect } from \"react-redux\";\r\nimport { PageAppointments } from \"senac-components\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n ContentFilters,\r\n ContentHeaderOptionItem,\r\n MenuOptions,\r\n PageHeaderOptionItem\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { OptionsItems, PageAppointmentsDispatchProps, PageAppointmentsStateProps } from \"senac-components/dist/pages/Mobile/PageAppointments\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\n\r\nconst mapState = (state: RootState) => \r\n{\r\n var pdfdata:OptionsItems[] | undefined = undefined;\r\n var epubdata:OptionsItems[] | undefined = undefined;\r\n var activeContent = state.contentState.allContents.find(p=> p.uid == state.contentState.activeContentUid);\r\n var data = state.userDataState.userData.filter(p=> p.targetType == \"ManagedContentReference\" && p.contextType == \"ManagedContent\" && p.contextUid == activeContent?.uid);\r\n\r\n data.forEach(userData=>\r\n {\r\n var reference = activeContent?.references?.find(r=> r.uid == userData.targetUid);\r\n if (!reference) return;\r\n\r\n var option: OptionsItems = \r\n {\r\n uid: userData.uid,\r\n title: userData.description,\r\n marked: userData.annotation,\r\n numerReading : \"0\"\r\n }\r\n\r\n\r\n try{\r\n var info = JSON.parse(userData.externalData);\r\n // console.log(\"info:\", info);\r\n option.numerReading = info.chapter_index;\r\n option.markColor = info.mark_color;\r\n\r\n }catch(e){\r\n\r\n }\r\n\r\n switch(reference.mimeType)\r\n {\r\n case 'application/epub+zip':\r\n {\r\n if (!epubdata) epubdata = [];\r\n epubdata.push(option);\r\n break;\r\n }\r\n case 'digitalpages/richpack':\r\n {\r\n if (!pdfdata) pdfdata = [];\r\n pdfdata.push(option);\r\n break;\r\n }\r\n }\r\n })\r\n\r\n\r\n let result: PageAppointmentsStateProps = \r\n {\r\n content: activeContent,\r\n pdfAppointments: pdfdata,\r\n epubAppointments: epubdata\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => \r\n{\r\n const result: PageAppointmentsDispatchProps = \r\n {\r\n onChangeFilter: (filter:ContentFilters) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: ContentHeaderOptionItem) => dispatch(contentSlice.actions.goToContentInfo(option)),\r\n // onSelectedHeaderMenuOption: (option: PageHeaderOptionItem) => dispatch(commonSlice.actions.goToPageOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) => dispatch(commonSlice.actions.goToPage(option)),\r\n\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageAppointments = connect(\r\n mapState,\r\n mapDispatch\r\n)(PageAppointments);\r\n\r\nexport { WPageAppointments };\r\n","import { connect } from \"react-redux\";\r\nimport { PageLibraryAppointments } from \"senac-components\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n ContentFilters,\r\n ContentOptionAppointments,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n PageLibraryHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { PageLibraryAppointmentsDispach, PageLibraryAppointmentsState } from \"senac-components/dist/pages/Mobile/PageLibraryAppointments\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { ContentMark } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\nimport { showContentDetail, showContentDetailWithMarks } from \"../store/reducers/contentSlice\";\r\n\r\nconst mapState = (state: RootState) => \r\n{\r\n var allContent = state.contentState.allContents;\r\n var data = state.userDataState.userData.filter(p=> p.targetType == \"ManagedContentReference\" && p.contextType == \"ManagedContent\");\r\n var marks:ContentMark[] = [];\r\n\r\n data.forEach(userData=>\r\n {\r\n var mark = marks.find(p=> p.uid == userData.contextUid);\r\n var content = allContent.find(p=> p.uid == userData.contextUid);\r\n if (!content) return;\r\n\r\n if (!mark)\r\n {\r\n //todo: alterar para tipo number\r\n mark = { uid: userData.contextUid, title: content.title, image: content.image};\r\n marks.push(mark);\r\n }\r\n\r\n var total = Number.parseInt(mark.numberMark ?? \"0\");\r\n total ++;\r\n\r\n mark.numberMark = total.toString();\r\n });\r\n\r\n let result: PageLibraryAppointmentsState = { contents:marks };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => \r\n{\r\n const result: PageLibraryAppointmentsDispach = \r\n {\r\n onChangeFilter: (filter:ContentFilters) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageLibraryHeaderOptionItem) =>dispatch(commonSlice.actions.goToLibraryOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) => dispatch(commonSlice.actions.goToPage(option)),\r\n onClickContent: (content, marks) => {\r\n if (!content.uid) return;\r\n dispatch(showContentDetail(content.uid));\r\n }\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageLibraryAppointments = connect(mapState,mapDispatch)(PageLibraryAppointments);\r\nexport { WPageLibraryAppointments };\r\n","import { connect } from \"react-redux\";\r\nimport { PageLibraryDownload } from \"senac-components\";\r\nimport { commonSlice, contentSlice } from \"../store/reducers\";\r\nimport { RootState, AppDispatch } from \"../store\";\r\nimport {\r\n Content,\r\n ContentDetail,\r\n ContentOptionDetail,\r\n ContentOptionFavorite,\r\n ContentOptionFavorited,\r\n ContentOptionReadingList,\r\n ContentReference,\r\n ContentType,\r\n MenuOptions,\r\n PageHeaderOptionItem,\r\n PageLibraryHeaderOptionItem,\r\n} from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\nimport {\r\n FavoritesInternalTag,\r\n deleteContentReference,\r\n downloadContentReference,\r\n insertInFavorite,\r\n removeFromFavorite,\r\n} from \"../store/reducers/userDataSlice\";\r\nimport { showContentDetail } from \"../store/reducers/contentSlice\";\r\nimport {\r\n PageLibraryDownloadPropsState,\r\n PageLibraryDownloadPropsDispatch,\r\n} from \"senac-components/dist/pages/Mobile/PageLibraryDownload\";\r\nimport { filterContent } from \"../store/reducers/common\";\r\n\r\nconst mapState = (state: RootState) => {\r\n var allContents = state.contentState.allContents;\r\n\r\n var data = state.userDataState.userData.filter(p=> p.tags && p.tags.length > 0 && p.targetType == \"ManagedContent\" && p.contextType == \"ManagedContent\" && p.tags.find(t=> t.name === FavoritesInternalTag) != null);\r\n var uniqueTags = data.map(p=> p.tags ?? []).reduce((p, c)=> [...new Map([...c, ...p].map(p=> [p.uid, p])).values()], []).filter(p=> p.name == FavoritesInternalTag);\r\n var remoteContents = data.filter(p=> p.tags && p.tags.filter(t=> uniqueTags.find(ut=> ut.uid == t.uid)).length > 0);\r\n var contentsUids = [... new Map(remoteContents.map(p=> [p.contextUid, p.contextUid])).values()];\r\n var contents = contentsUids.map(p=> allContents.find(c=> c.uid == p)).filter(p=> p) as Content[];\r\n\r\n var favorites = contents?.map((p) => p.uid) ?? [];\r\n var downloads = state.contentState.allContents.filter(p=> p.references?.find(r=> r.downloadProgress && r.downloadProgress > 0) != undefined);\r\n\r\n let result: PageLibraryDownloadPropsState = {\r\n contentsFavorited: favorites,\r\n contentsDownloaded: downloads.map(p=> p.uid),\r\n contents: downloads,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageLibraryDownloadPropsDispatch = {\r\n onSelectedContentOption: (\r\n content: Content,\r\n option: PageLibraryHeaderOptionItem\r\n ) => {\r\n switch (option) {\r\n case ContentOptionFavorited: {\r\n dispatch(removeFromFavorite(content));\r\n break;\r\n }\r\n case ContentOptionFavorite: {\r\n dispatch(insertInFavorite(content));\r\n break;\r\n }\r\n case ContentOptionDetail: {\r\n dispatch(showContentDetail(content.uid));\r\n break;\r\n }\r\n case ContentOptionReadingList: {\r\n dispatch(contentSlice.actions.goToContentInfo(option));\r\n break;\r\n }\r\n }\r\n },\r\n onOpenContent: (data: Content) => {\r\n dispatch(showContentDetail(data.uid))\r\n }, // dispatch(showContentDetail(data.uid)),\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageLibraryHeaderOptionItem) =>dispatch(commonSlice.actions.goToLibraryOption(option)),\r\n onSelectedNavigationPageOption: (option: MenuOptions) => dispatch(commonSlice.actions.goToPage(option)),\r\n onChangeFilter: (filter) => {\r\n if (filter.query == undefined) return;\r\n dispatch(filterContent({ query: filter.query }));\r\n },\r\n onDeleteContent: (reference: ContentReference) => reference?.uid && dispatch(deleteContentReference(reference.uid)),\r\n onDownloadContent: (reference: ContentReference) => reference?.uid && dispatch(downloadContentReference(reference.uid))\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPageLibraryDownload = connect(\r\n mapState,\r\n mapDispatch\r\n)(PageLibraryDownload);\r\n\r\nexport { WPageLibraryDownload };\r\n","import React, { useEffect, useState } from \"react\";\r\nimport { Outlet, RouteProps, useParams } from \"react-router-dom\";\r\nimport { contentSlice } from \"../store/reducers\";\r\nimport { RootState, useAppDispatch } from \"../store\";\r\nimport { contentDetail, contentSummary, loadContentDetail } from \"../store/reducers/contentSlice\";\r\nimport { useSelector } from \"react-redux\";\r\n\r\nconst ManagementContentDetail: React.FC = (prop) => {\r\n const dispatch = useAppDispatch();\r\n const parms: any = useParams();\r\n const [contentUid, setContentUid] = useState();\r\n const mobile = useSelector(state => state.commonState.runningInMobile);\r\n\r\n useEffect(() => {\r\n var paramsContentuid = parms.contentUid;\r\n if (paramsContentuid !== contentUid) setContentUid(paramsContentuid);\r\n }, [parms]);\r\n\r\n useEffect(() => {\r\n if (!contentUid) return;\r\n dispatch(loadContentDetail(contentUid));\r\n }, [contentUid]);\r\n\r\n return ;\r\n};\r\n\r\nexport { ManagementContentDetail };\r\n","import { connect } from \"react-redux\";\r\n\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { PageAboutWeb } from \"senac-components/dist/pages/Web/PageAbout\";\r\n\r\nconst mapState = (state: RootState) => {\r\n const authenticatedUser = state.userState.user != undefined;\r\n\r\n return {\r\n authenticatedUser,\r\n };\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n return {};\r\n};\r\n\r\nconst WPageAbout = connect(mapState, mapDispatch)(PageAboutWeb);\r\nexport { WPageAbout };\r\n","import { connect } from \"react-redux\";\r\nimport { PageTermsOfUse } from \"senac-components\";\r\nimport {\r\n PageTermsOfUseDispatchProps,\r\n PageTermsOfUseStateProps,\r\n PageTermsOfUseProps,\r\n} from \"senac-components/dist/pages/Mobile/PageTermsOfUse\";\r\nimport { PagePrivacyPolice } from \"senac-components/dist/pages/Web/PagePrivacyPolice\";\r\nimport { AppDispatch, RootState } from \"../store\";\r\nimport { commonSlice, userSlice } from \"../store/reducers\";\r\nimport { PageHeaderOptionItem } from \"senac-components/dist/pages/Mobile/PageInterfaces\";\r\n\r\nconst mapState = (state: RootState) => {\r\n const authenticatedUser = state.userState.user != undefined;\r\n let result: PageTermsOfUseStateProps = {\r\n authenticatedUser: true,\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst mapDispatch = (dispatch: AppDispatch) => {\r\n const result: PageTermsOfUseDispatchProps = {\r\n onSelectedHeaderBack: () => dispatch(commonSlice.actions.backPage()),\r\n onSelectedHeaderMenuOption: (option: PageHeaderOptionItem) =>\r\n dispatch(commonSlice.actions.goToMyProfileOption(option)),\r\n };\r\n\r\n return result;\r\n};\r\n\r\nconst WPagePrivacyPolice = () => {\r\n const Mobile = connect(mapState, mapDispatch)(PagePrivacyPolice);\r\n const Web = connect(mapState)(PagePrivacyPolice);\r\n if (window.innerWidth < 1024) return ;\r\n return ;\r\n};\r\n\r\nexport { WPagePrivacyPolice };\r\n","import { useEffect, useRef } from \"react\";\r\nimport { useLocation, useParams } from \"react-router-dom\";\r\nimport { HeaderWeb } from \"senac-components\";\r\nimport { useAppDispatch } from \"../store\";\r\nimport { authenticateSso, signinSso } from \"../store/reducers/userSlice\";\r\n\r\nexport const Wsso = () => {\r\n const { organization, login, token, path } = useParams();\r\n const query_params = useLocation();\r\n const dispatch = useAppDispatch();\r\n const ran = useRef(false);\r\n\r\n useEffect(() => {\r\n const queryParams = new URLSearchParams(query_params.search);\r\n const path = queryParams.get(\"path\") || \"\";\r\n\r\n if (organization && login && token && !ran.current) {\r\n dispatch(authenticateSso({ login, organization, token, path: path || \"\" }));\r\n ran.current = true;\r\n }\r\n }, []);\r\n\r\n return (\r\n <>\r\n \r\n \r\n );\r\n};\r\n","import React from 'react';\r\nimport ReactDOM from 'react-dom/client';\r\nimport App from './App';\r\nimport { Provider } from 'react-redux'\r\nimport { HashRouter, Navigate, Route, Routes, createRoutesFromElements } from \"react-router-dom\";\r\nimport { Store, persistor } from './store';\r\nimport { createHashRouter, RouterProvider} from \"react-router-dom\";\r\n\r\nimport './index.css';\r\nimport { GlobalFonts } from 'senac-components';\r\nimport { WPageBookFiltered } from './components/WPageBookFiltered';\r\nimport { WPageShowcase, WReader, WPageBookDetail, WPageBookSummary, WPageBookFound, WPageHome, WPageLogin, WPageForgotMyPassword, WPageSelectOrganization, WPagePassword, WPageRecoverPassword, WPageChangeYourPassword, WPageProfile, WPageTermsOfUse, WPageContactUs, WPageFAQ, WPageRegister, WPageBookReadingList, WPageLibraryFavorite, WPageLibrarySection, WPageLibraryReadingList, WPageLibraryReadingListCard, WPageOffline } from './components';\r\nimport { WPageHelp } from './components/WPageHelp';\r\nimport { WPlayer } from './components/WPlayer';\r\nimport { WPageAppointments } from './components/WPageAppointments';\r\nimport { WPageLibraryAppointments } from './components/WPageLibraryAppointments';\r\nimport { WPageLibraryDownload } from './components/WPageLibraryDownload';\r\nimport { ManagementContentDetail } from './components/ManagementContentDetail';\r\nimport { WPageAbout } from './components/WPageAbout';\r\nimport { WPagePrivacyPolice } from './components/WPagePrivacyPolice';\r\nimport { Wsso } from './components/Wsso';\r\n\r\nconst root = ReactDOM.createRoot(\r\n document.getElementById('root') as HTMLElement\r\n);\r\n\r\nconst router = createHashRouter\r\n(\r\n createRoutesFromElements\r\n (\r\n }>\r\n } />\r\n } />\r\n }>\r\n }/>\r\n }/>\r\n }/>\r\n }/>\r\n \r\n \r\n }/>\r\n }/>\r\n }/>\r\n }/>\r\n }/>\r\n }/>\r\n \r\n } />\r\n \r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n \r\n \r\n }/>\r\n }/>\r\n \r\n }/>\r\n }/>\r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n } />\r\n \r\n )\r\n);\r\n\r\nroot.render(\r\n \r\n \r\n \r\n \r\n \r\n \r\n);\r\n\r\n// If you want to start measuring performance in your app, pass a function\r\n// to log results (for example: reportWebVitals(console.log))\r\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\r\n// reportWebVitals();\r\n"],"sourceRoot":""}