"use strict"; exports.id = 37883; exports.ids = [37883]; exports.modules = { /***/ 37883: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "AL": () => (/* binding */ addNote), /* harmony export */ "BB": () => (/* binding */ updateUserConsent), /* harmony export */ "DG": () => (/* binding */ getStreakWithUserMetadata), /* harmony export */ "Ec": () => (/* binding */ addReadingGoal), /* harmony export */ "F4": () => (/* binding */ getUserCoursesCount), /* harmony export */ "JM": () => (/* binding */ getUserPreferences), /* harmony export */ "MQ": () => (/* binding */ addOrUpdateBulkUserPreferences), /* harmony export */ "P4": () => (/* binding */ deleteCollection), /* harmony export */ "QC": () => (/* binding */ deleteReadingGoal), /* harmony export */ "Qd": () => (/* binding */ deleteCollectionBookmarkById), /* harmony export */ "Qk": () => (/* binding */ updateNote), /* harmony export */ "Rm": () => (/* binding */ updateCollection), /* harmony export */ "TX": () => (/* binding */ logoutUser), /* harmony export */ "UK": () => (/* binding */ privateFetcher), /* harmony export */ "W7": () => (/* binding */ getPageBookmarks), /* harmony export */ "XM": () => (/* binding */ estimateRangesReadingTime), /* harmony export */ "XR": () => (/* binding */ getCourse), /* harmony export */ "b5": () => (/* binding */ completeAnnouncement), /* harmony export */ "b9": () => (/* binding */ addOrUpdateUserPreference), /* harmony export */ "c7": () => (/* binding */ addReadingSession), /* harmony export */ "ct": () => (/* binding */ updateReadingGoal), /* harmony export */ "et": () => (/* binding */ getUserProfile), /* harmony export */ "ez": () => (/* binding */ deleteBookmarkById), /* harmony export */ "fG": () => (/* binding */ getCollectionsList), /* harmony export */ "f_": () => (/* binding */ deleteNote), /* harmony export */ "i1": () => (/* binding */ updateActivityDay), /* harmony export */ "j0": () => (/* binding */ postRequest), /* harmony export */ "jm": () => (/* binding */ countNotesWithinRange), /* harmony export */ "kK": () => (/* binding */ completeSignup), /* harmony export */ "ku": () => (/* binding */ postCourseFeedback), /* harmony export */ "rs": () => (/* binding */ syncUserLocalData), /* harmony export */ "tm": () => (/* binding */ deleteAccount), /* harmony export */ "x8": () => (/* binding */ requestVerificationCode), /* harmony export */ "xh": () => (/* binding */ enrollUser), /* harmony export */ "yJ": () => (/* binding */ publishNoteToQR) /* harmony export */ }); /* unused harmony exports getUserFeatureFlags, refreshToken, addBookmark, getBookmark, getBookmarkCollections, filterReadingDays, getActivityDay, addCollectionBookmark, deleteCollectionBookmarkByKey, getBookmarksByCollectionId, getCourses, addCollection, getAllNotes, withCredentialsFetcher */ /* harmony import */ var refresh_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52648); /* harmony import */ var refresh_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(refresh_fetch__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _datetime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76410); /* harmony import */ var _types_auth_ActivityDay__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(97043); /* harmony import */ var _utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13830); /* harmony import */ var src_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(92684); /* eslint-disable max-lines */ const handleErrors = async (res)=>{ const body = await res.json(); throw new Error(body?.message); }; /** * Execute a POST request * * @param {string} url * @param {RequestData} requestData * @returns {Promise} */ const postRequest = (url, requestData)=>privateFetcher(url, { method: "POST", // eslint-disable-next-line @typescript-eslint/naming-convention headers: { "Content-Type": "application/json" }, body: JSON.stringify(requestData) }); /** * Execute a DELETE request. * * @param {string} url * @param {RequestData} requestData * @returns {Promise} */ const deleteRequest = (url, requestData)=>privateFetcher(url, { method: "DELETE", ...requestData && { // eslint-disable-next-line @typescript-eslint/naming-convention headers: { "Content-Type": "application/json" }, body: JSON.stringify(requestData) } }); /** * Execute a PATCH request. * * @param {string} url * @param {RequestData} requestData * @returns {Promise} */ const patchRequest = (url, requestData)=>privateFetcher(url, { method: "PATCH", ...requestData && { // eslint-disable-next-line @typescript-eslint/naming-convention headers: { "Content-Type": "application/json" }, body: JSON.stringify(requestData) } }); const getUserProfile = async ()=>privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeUserProfileUrl */ .bo)()); const getUserFeatureFlags = async ()=>privateFetcher(makeUserFeatureFlagsUrl()); const refreshToken = async ()=>privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeRefreshTokenUrl */ .Qd)()); const completeSignup = async (data)=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeCompleteSignupUrl */ .iX)(), data); const completeAnnouncement = async (data)=>{ return postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeCompleteAnnouncementUrl */ .R8)(), data); }; const updateUserConsent = async (data)=>{ return postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeUserConsentsUrl */ .an)(), data); }; const deleteAccount = async ()=>deleteRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeDeleteAccountUrl */ .Xk)()); const addBookmark = async ({ key , mushafId , type , verseNumber })=>postRequest(makeBookmarksUrl(mushafId), { key, mushaf: mushafId, type, verseNumber }); const getPageBookmarks = async (mushafId, chapterNumber, verseNumber, perPage)=>privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeBookmarksRangeUrl */ .SH)(mushafId, chapterNumber, verseNumber, perPage)); const getBookmark = async (mushafId, key, type, verseNumber)=>privateFetcher(makeBookmarkUrl(mushafId, key, type, verseNumber)); const getBookmarkCollections = async (mushafId, key, type, verseNumber)=>privateFetcher(makeBookmarkCollectionsUrl(mushafId, key, type, verseNumber)); const addReadingGoal = async ({ mushafId , category , ...data })=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeGoalUrl */ .ky)({ mushafId, type: category }), data); const updateReadingGoal = async ({ mushafId , category , ...data })=>patchRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeGoalUrl */ .ky)({ mushafId, type: category }), data); const deleteReadingGoal = async (params)=>deleteRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeGoalUrl */ .ky)({ type: params.category })); const filterReadingDays = async (params)=>privateFetcher(makeFilterActivityDaysUrl(params)); const getActivityDay = async (type)=>privateFetcher(makeActivityDaysUrl({ type })); const addReadingSession = async (chapterNumber, verseNumber)=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeReadingSessionsUrl */ .Tj)(), { chapterNumber, verseNumber }); const updateActivityDay = async (params)=>{ if (params.type === _types_auth_ActivityDay__WEBPACK_IMPORTED_MODULE_2__/* .ActivityDayType.QURAN */ .t.QURAN) { const { mushafId , type , ...body } = params; return postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeActivityDaysUrl */ .D4)({ mushafId, type }), body); } const { type: type1 , ...body1 } = params; return postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeActivityDaysUrl */ .D4)({ type: type1 }), body1); }; const estimateRangesReadingTime = async (body)=>{ return privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeEstimateRangesReadingTimeUrl */ .j$)(body)); }; const getStreakWithUserMetadata = async (params)=>privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeStreakUrl */ .G_)(params)); const syncUserLocalData = async (payload)=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeSyncLocalDataUrl */ .wR)(), payload); const getUserPreferences = async ()=>{ const userPreferences = await privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeUserPreferencesUrl */ .mL)()); return userPreferences; }; const addOrUpdateUserPreference = async (key, value, group, mushafId)=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeUserPreferencesUrl */ .mL)(mushafId), { key, value, group }); const getCollectionsList = async (queryParams)=>{ return privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeCollectionsUrl */ .Tb)(queryParams)); }; const updateCollection = async (collectionId, { name })=>{ return postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeUpdateCollectionUrl */ .vK)(collectionId), { name }); }; const deleteCollection = async (collectionId)=>{ return deleteRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeDeleteCollectionUrl */ .Ip)(collectionId)); }; const addCollectionBookmark = async ({ collectionId , key , mushaf , type , verseNumber })=>{ return postRequest(makeAddCollectionBookmarkUrl(collectionId), { collectionId, key, mushaf, type, verseNumber }); }; const deleteCollectionBookmarkById = async (collectionId, bookmarkId)=>{ return deleteRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeDeleteCollectionBookmarkByIdUrl */ .Pd)(collectionId, bookmarkId)); }; const deleteCollectionBookmarkByKey = async ({ collectionId , key , mushaf , type , verseNumber , })=>{ return deleteRequest(makeDeleteCollectionBookmarkByKeyUrl(collectionId), { collectionId, key, mushaf, type, verseNumber }); }; const deleteBookmarkById = async (bookmarkId)=>{ return deleteRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeDeleteBookmarkUrl */ .DZ)(bookmarkId)); }; const getBookmarksByCollectionId = async (collectionId, queryParams)=>{ return privateFetcher(makeGetBookmarkByCollectionId(collectionId, queryParams)); }; const enrollUser = async (courseId)=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeEnrollUserUrl */ .Qf)(), { courseId }); const postCourseFeedback = async ({ courseId , rating , body })=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeCourseFeedbackUrl */ .TX)(courseId), { rating, body }); const getCourses = async ()=>privateFetcher(makeGetCoursesUrl()); const getCourse = async (courseSlugOrId)=>privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeGetCourseUrl */ .vp)(courseSlugOrId)); const getUserCoursesCount = async ()=>privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeGetUserCoursesCountUrl */ .V9)()); const addCollection = async (collectionName)=>{ return postRequest(makeAddCollectionUrl(), { name: collectionName }); }; const getAllNotes = async (params)=>{ return privateFetcher(makeNotesUrl(params)); }; const countNotesWithinRange = async (from, to)=>{ return privateFetcher((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeCountNotesWithinRangeUrl */ .h6)(from, to)); }; const addNote = async (payload)=>{ return postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeNotesUrl */ .C)(), payload); }; const publishNoteToQR = async (noteId, payload)=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makePublishNoteUrl */ .E4)(noteId), payload); const updateNote = async (id, body, saveToQR)=>patchRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeDeleteOrUpdateNoteUrl */ .bi)(id), { body, saveToQR }); const deleteNote = async (id)=>deleteRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeDeleteOrUpdateNoteUrl */ .bi)(id)); const requestVerificationCode = async (emailToVerify)=>{ return postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeVerificationCodeUrl */ .qc)(), { email: emailToVerify }); }; const addOrUpdateBulkUserPreferences = async (preferences, mushafId)=>postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeUserBulkPreferencesUrl */ .pI)(mushafId), preferences); const logoutUser = async ()=>{ return postRequest((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_3__/* .makeLogoutUrl */ .Q_)(), {}); }; const shouldRefreshToken = (error)=>{ return error?.message === "must refresh token"; }; const withCredentialsFetcher = async (input, init)=>{ try { const data = await (0,src_api__WEBPACK_IMPORTED_MODULE_4__/* .fetcher */ ._i)(input, { ...init, credentials: "include", headers: { ...init?.headers, // eslint-disable-next-line @typescript-eslint/naming-convention "x-timezone": (0,_datetime__WEBPACK_IMPORTED_MODULE_1__/* .getTimezone */ .EP)() } }); return data; } catch (error) { await handleErrors(error); return null; } }; const privateFetcher = (0,refresh_fetch__WEBPACK_IMPORTED_MODULE_0__.configureRefreshFetch)({ shouldRefreshToken, // @ts-ignore refreshToken, fetch: withCredentialsFetcher }); /***/ }), /***/ 97043: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "t": () => (/* binding */ ActivityDayType) /* harmony export */ }); var ActivityDayType; (function(ActivityDayType) { ActivityDayType["QURAN"] = "QURAN"; ActivityDayType["LESSON"] = "LESSON"; })(ActivityDayType || (ActivityDayType = {})); /***/ }) }; ; //# sourceMappingURL=37883.js.map