academe-kit 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +64 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1281 -68
- package/dist/index.esm.js +64 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8724 -0
- package/dist/index.js.map +1 -0
- package/dist/types/services/CourseLogService.d.ts +12258 -0
- package/dist/types/services/CourseService.d.ts +40 -4
- package/dist/types/services/InstitutionService.d.ts +198 -0
- package/dist/types/services/{UserService.d.ts → userService.d.ts} +60 -11
- package/dist/types/types/academe-api.d.ts +939 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4755,6 +4755,33 @@ function createInstitutionService(apiClient) {
|
|
|
4755
4755
|
params: { path: { id } },
|
|
4756
4756
|
});
|
|
4757
4757
|
},
|
|
4758
|
+
// Curriculum Periods
|
|
4759
|
+
getCurriculumPeriods(options) {
|
|
4760
|
+
return apiClient.GET("/institutions/curriculum-periods", {
|
|
4761
|
+
params: { query: options },
|
|
4762
|
+
});
|
|
4763
|
+
},
|
|
4764
|
+
getCurriculumPeriodById(id) {
|
|
4765
|
+
return apiClient.GET("/institutions/curriculum-periods/{id}", {
|
|
4766
|
+
params: { path: { id } },
|
|
4767
|
+
});
|
|
4768
|
+
},
|
|
4769
|
+
createCurriculumPeriod(data) {
|
|
4770
|
+
return apiClient.POST("/institutions/curriculum-periods", {
|
|
4771
|
+
body: data,
|
|
4772
|
+
});
|
|
4773
|
+
},
|
|
4774
|
+
updateCurriculumPeriod(id, data) {
|
|
4775
|
+
return apiClient.PATCH("/institutions/curriculum-periods/{id}", {
|
|
4776
|
+
params: { path: { id } },
|
|
4777
|
+
body: data,
|
|
4778
|
+
});
|
|
4779
|
+
},
|
|
4780
|
+
deleteCurriculumPeriod(id) {
|
|
4781
|
+
return apiClient.DELETE("/institutions/curriculum-periods/{id}", {
|
|
4782
|
+
params: { path: { id } },
|
|
4783
|
+
});
|
|
4784
|
+
},
|
|
4758
4785
|
// Educational Models
|
|
4759
4786
|
getAllEducationalModels() {
|
|
4760
4787
|
return apiClient.GET("/institutions/educational-models");
|
|
@@ -5998,6 +6025,20 @@ const getAccessTokenFromCookies = () => {
|
|
|
5998
6025
|
const token = getCookie("KC_FORCE_AUTH_TOKEN");
|
|
5999
6026
|
return token || undefined;
|
|
6000
6027
|
};
|
|
6028
|
+
const setCookie = (name, value, domain) => {
|
|
6029
|
+
if (typeof window === "undefined")
|
|
6030
|
+
return;
|
|
6031
|
+
const cookieParts = [
|
|
6032
|
+
`${name}=${value}`,
|
|
6033
|
+
"path=/",
|
|
6034
|
+
"secure",
|
|
6035
|
+
"SameSite=None",
|
|
6036
|
+
];
|
|
6037
|
+
{
|
|
6038
|
+
cookieParts.push(`domain=${domain}`);
|
|
6039
|
+
}
|
|
6040
|
+
document.cookie = cookieParts.join("; ");
|
|
6041
|
+
};
|
|
6001
6042
|
const AcademeAuthProvider = ({ realm, hubUrl, children, clientId, keycloakUrl, apiBaseUrl, skipApiUserFetch, }) => {
|
|
6002
6043
|
const oidcConfig = {
|
|
6003
6044
|
authority: `${keycloakUrl}/realms/${realm}`,
|
|
@@ -6086,6 +6127,29 @@ const SecurityProvider = ({ apiBaseUrl = "https://stg-api.academe.com.br", skipA
|
|
|
6086
6127
|
const interval = setInterval(checkCookieToken, 5000);
|
|
6087
6128
|
return () => clearInterval(interval);
|
|
6088
6129
|
}, [accessToken]);
|
|
6130
|
+
React2.useEffect(() => {
|
|
6131
|
+
if (typeof window === "undefined")
|
|
6132
|
+
return;
|
|
6133
|
+
const handlePostMessage = (event) => {
|
|
6134
|
+
try {
|
|
6135
|
+
const data = typeof event.data === "string"
|
|
6136
|
+
? JSON.parse(event.data)
|
|
6137
|
+
: event.data;
|
|
6138
|
+
if (data?.type === "KC_TOKEN_UPDATE" && data?.payload?.accessToken) {
|
|
6139
|
+
const newToken = data.payload.accessToken;
|
|
6140
|
+
console.log("[SecurityProvider] Received KC_TOKEN_UPDATE via postMessage");
|
|
6141
|
+
setCookie("KC_FORCE_AUTH_TOKEN", newToken, ".academe.com.br");
|
|
6142
|
+
setAccessToken(newToken);
|
|
6143
|
+
}
|
|
6144
|
+
}
|
|
6145
|
+
catch {
|
|
6146
|
+
}
|
|
6147
|
+
};
|
|
6148
|
+
window.addEventListener("message", handlePostMessage);
|
|
6149
|
+
return () => {
|
|
6150
|
+
window.removeEventListener("message", handlePostMessage);
|
|
6151
|
+
};
|
|
6152
|
+
}, []);
|
|
6089
6153
|
// --- 1. Silent Check Inicial (Check SSO) ---
|
|
6090
6154
|
React2.useEffect(() => {
|
|
6091
6155
|
// Se já temos um token do cookie, não precisamos fazer silent check
|