@carlonicora/nextjs-jsonapi 1.3.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +208 -127
- package/dist/AuthComponent-B_Ps2Vb9.d.ts +78 -0
- package/dist/AuthComponent-CxnGgvoh.d.mts +78 -0
- package/dist/{BlockNoteEditor-V625C23O.mjs → BlockNoteEditor-AIEEQM6A.mjs} +4 -6
- package/dist/{BlockNoteEditor-V625C23O.mjs.map → BlockNoteEditor-AIEEQM6A.mjs.map} +1 -1
- package/dist/{BlockNoteEditor-7WYPN34K.js → BlockNoteEditor-G6AK2NWA.js} +8 -10
- package/dist/BlockNoteEditor-G6AK2NWA.js.map +1 -0
- package/dist/chunk-3UELCPIN.js +46 -0
- package/dist/chunk-3UELCPIN.js.map +1 -0
- package/dist/{chunk-5QC7A6BL.mjs → chunk-J7YDGYSW.mjs} +2668 -1319
- package/dist/chunk-J7YDGYSW.mjs.map +1 -0
- package/dist/chunk-SZZYEG3P.mjs +46 -0
- package/dist/chunk-SZZYEG3P.mjs.map +1 -0
- package/dist/{chunk-K2ANOT66.js → chunk-VET55IZO.js} +1869 -520
- package/dist/chunk-VET55IZO.js.map +1 -0
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +3 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +2 -3
- package/dist/components/index.d.mts +6 -69
- package/dist/components/index.d.ts +6 -69
- package/dist/components/index.js +3 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -3
- package/dist/{content.interface-C_PGZMuy.d.ts → content.interface-CR2aBeAW.d.ts} +1 -1
- package/dist/{content.interface-D_WS6CrB.d.mts → content.interface-FpLfsaRm.d.mts} +1 -1
- package/dist/contexts/index.d.mts +3 -3
- package/dist/contexts/index.d.ts +3 -3
- package/dist/contexts/index.js +3 -4
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +2 -3
- package/dist/features/index.d.mts +50 -49
- package/dist/features/index.d.ts +50 -49
- package/dist/features/index.js +24 -3
- package/dist/features/index.js.map +1 -1
- package/dist/features/index.mjs +23 -2
- package/dist/hooks/index.d.mts +3 -3
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +3 -4
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{notification.interface-BBgMUdLR.d.mts → notification.interface-B2BrLoDA.d.mts} +1 -1
- package/dist/{notification.interface-gyvT-Z2F.d.ts → notification.interface-DlZLnAfg.d.ts} +1 -1
- package/dist/roles/index.d.mts +7 -1
- package/dist/roles/index.d.ts +7 -1
- package/dist/roles/index.js +8 -2
- package/dist/roles/index.js.map +1 -1
- package/dist/roles/index.mjs +7 -1
- package/dist/scripts/generate-web-module/generator.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/generator.js +8 -5
- package/dist/scripts/generate-web-module/generator.js.map +1 -1
- package/dist/scripts/generate-web-module/index.js +1 -1
- package/dist/scripts/generate-web-module/index.js.map +1 -1
- package/dist/scripts/generate-web-module/templates/components/editor.template.js +8 -1
- package/dist/scripts/generate-web-module/templates/components/editor.template.js.map +1 -1
- package/dist/scripts/generate-web-module/transformers/parent-detector.d.ts +4 -3
- package/dist/scripts/generate-web-module/transformers/parent-detector.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/transformers/parent-detector.js +9 -3
- package/dist/scripts/generate-web-module/transformers/parent-detector.js.map +1 -1
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts +11 -0
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.js +36 -9
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.js.map +1 -1
- package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts +2 -0
- package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/types/template-data.interface.d.ts +1 -0
- package/dist/scripts/generate-web-module/types/template-data.interface.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts +4 -3
- package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/utils/i18n-updater.js +9 -9
- package/dist/scripts/generate-web-module/utils/i18n-updater.js.map +1 -1
- package/dist/scripts/generate-web-module/validators/json-schema-validator.js +3 -3
- package/dist/scripts/generate-web-module/validators/json-schema-validator.js.map +1 -1
- package/dist/{useSocket-DzMKRKCA.d.ts → useSocket-BV6yMdWS.d.ts} +1 -1
- package/dist/{useSocket-Cn7fB_B1.d.mts → useSocket-L-An7_Mr.d.mts} +1 -1
- package/dist/{user.interface-CAsTIbuQ.d.mts → user.interface-CooB1R79.d.mts} +13 -13
- package/dist/{user.interface-CbWqMaaU.d.ts → user.interface-KnIT9pVY.d.ts} +13 -13
- package/package.json +1 -1
- package/scripts/generate-web-module/generator.ts +8 -5
- package/scripts/generate-web-module/index.ts +1 -1
- package/scripts/generate-web-module/templates/components/editor.template.ts +7 -2
- package/scripts/generate-web-module/transformers/parent-detector.ts +10 -3
- package/scripts/generate-web-module/transformers/relationship-resolver.ts +36 -9
- package/scripts/generate-web-module/types/json-schema.interface.ts +2 -0
- package/scripts/generate-web-module/types/template-data.interface.ts +1 -0
- package/scripts/generate-web-module/utils/i18n-updater.ts +9 -9
- package/scripts/generate-web-module/validators/json-schema-validator.ts +3 -3
- package/src/features/auth/components/details/LandingComponent.tsx +27 -29
- package/src/features/user/index.ts +1 -0
- package/src/roles/config.ts +15 -0
- package/src/roles/index.ts +9 -1
- package/dist/AuthComponent-hxOPs9o8.d.mts +0 -11
- package/dist/AuthComponent-hxOPs9o8.d.ts +0 -11
- package/dist/BlockNoteEditor-7WYPN34K.js.map +0 -1
- package/dist/chunk-4HCRAOS5.js +0 -28
- package/dist/chunk-4HCRAOS5.js.map +0 -1
- package/dist/chunk-5QC7A6BL.mjs.map +0 -1
- package/dist/chunk-BLWVZK6J.mjs +0 -28
- package/dist/chunk-BLWVZK6J.mjs.map +0 -1
- package/dist/chunk-HTLEKZND.mjs +0 -1375
- package/dist/chunk-HTLEKZND.mjs.map +0 -1
- package/dist/chunk-K2ANOT66.js.map +0 -1
- package/dist/chunk-PO5Q3H5I.js +0 -1375
- package/dist/chunk-PO5Q3H5I.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
@@ -105,29 +105,26 @@ var _chunkDEYKTLA3js = require('./chunk-DEYKTLA3.js');
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
+
var _chunkAYHKQWHHjs = require('./chunk-AYHKQWHH.js');
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
|
|
111
112
|
|
|
112
|
-
var _chunkPO5Q3H5Ijs = require('./chunk-PO5Q3H5I.js');
|
|
113
|
-
|
|
114
|
-
|
|
115
113
|
|
|
116
114
|
|
|
117
115
|
|
|
116
|
+
var _chunkPMXG5WBCjs = require('./chunk-PMXG5WBC.js');
|
|
118
117
|
|
|
119
|
-
var _chunkAYHKQWHHjs = require('./chunk-AYHKQWHH.js');
|
|
120
118
|
|
|
121
119
|
|
|
122
120
|
|
|
121
|
+
var _chunk3UELCPINjs = require('./chunk-3UELCPIN.js');
|
|
123
122
|
|
|
124
|
-
var _chunkPMXG5WBCjs = require('./chunk-PMXG5WBC.js');
|
|
125
123
|
|
|
124
|
+
var _chunk3FBCC4G3js = require('./chunk-3FBCC4G3.js');
|
|
126
125
|
|
|
127
|
-
var _chunk4HCRAOS5js = require('./chunk-4HCRAOS5.js');
|
|
128
126
|
|
|
129
127
|
|
|
130
|
-
var _chunk3FBCC4G3js = require('./chunk-3FBCC4G3.js');
|
|
131
128
|
|
|
132
129
|
|
|
133
130
|
|
|
@@ -997,305 +994,1304 @@ _chunk7QVYU63Ejs.__name.call(void 0, usePageTracker, "usePageTracker");
|
|
|
997
994
|
|
|
998
995
|
// src/hooks/usePushNotifications.ts
|
|
999
996
|
|
|
1000
|
-
function urlBase64ToUint8Array(base64String) {
|
|
1001
|
-
const padding = "=".repeat((4 - base64String.length % 4) % 4);
|
|
1002
|
-
const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
|
|
1003
|
-
const rawData = window.atob(base64);
|
|
1004
|
-
const outputArray = new Uint8Array(rawData.length);
|
|
1005
|
-
for (let i = 0; i < rawData.length; i++) {
|
|
1006
|
-
outputArray[i] = rawData.charCodeAt(i);
|
|
1007
|
-
}
|
|
1008
|
-
return outputArray;
|
|
1009
|
-
}
|
|
1010
|
-
_chunk7QVYU63Ejs.__name.call(void 0, urlBase64ToUint8Array, "urlBase64ToUint8Array");
|
|
1011
|
-
function usePushNotifications() {
|
|
1012
|
-
const { currentUser, hasRole } = useCurrentUserContext();
|
|
1013
|
-
_react.useEffect.call(void 0, () => {
|
|
1014
|
-
const register = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1015
|
-
if ("serviceWorker" in navigator && "PushManager" in window) {
|
|
1016
|
-
try {
|
|
1017
|
-
const sessionKey = `push_registered_${_optionalChain([currentUser, 'optionalAccess', _31 => _31.id])}`;
|
|
1018
|
-
const lastRegisteredSubscription = sessionStorage.getItem(sessionKey);
|
|
1019
|
-
const registration = await navigator.serviceWorker.register(`${_chunkPMXG5WBCjs.getAppUrl.call(void 0, )}/sw.js`);
|
|
1020
|
-
let permission = Notification.permission;
|
|
1021
|
-
if (permission === "default") {
|
|
1022
|
-
permission = await Notification.requestPermission();
|
|
1023
|
-
}
|
|
1024
|
-
if (permission !== "granted") {
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
const vapidPublicKey = (process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY || "").trim();
|
|
1028
|
-
const convertedKey = urlBase64ToUint8Array(vapidPublicKey);
|
|
1029
|
-
await navigator.serviceWorker.ready;
|
|
1030
|
-
let subscription = await registration.pushManager.getSubscription();
|
|
1031
|
-
if (!subscription) {
|
|
1032
|
-
const appServerKey = new Uint8Array(Array.from(convertedKey));
|
|
1033
|
-
subscription = await registration.pushManager.subscribe({
|
|
1034
|
-
userVisibleOnly: true,
|
|
1035
|
-
applicationServerKey: appServerKey
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
const plainSubscription = {
|
|
1039
|
-
endpoint: subscription.endpoint,
|
|
1040
|
-
keys: subscription.toJSON().keys
|
|
1041
|
-
};
|
|
1042
|
-
const subscriptionHash = btoa(JSON.stringify(plainSubscription));
|
|
1043
|
-
if (lastRegisteredSubscription !== subscriptionHash) {
|
|
1044
|
-
await _chunkPO5Q3H5Ijs.PushService.register({ data: plainSubscription });
|
|
1045
|
-
sessionStorage.setItem(sessionKey, subscriptionHash);
|
|
1046
|
-
}
|
|
1047
|
-
} catch (error) {
|
|
1048
|
-
console.error("Error during service worker registration or push subscription:", error);
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
}, "register");
|
|
1052
|
-
if (currentUser && !hasRole(_chunk4HCRAOS5js.getRoleId.call(void 0, ).Administrator)) register();
|
|
1053
|
-
}, [currentUser]);
|
|
1054
|
-
}
|
|
1055
|
-
_chunk7QVYU63Ejs.__name.call(void 0, usePushNotifications, "usePushNotifications");
|
|
1056
997
|
|
|
1057
|
-
// src/
|
|
998
|
+
// src/features/auth/auth.module.ts
|
|
999
|
+
var AuthModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1000
|
+
pageUrl: "/auth",
|
|
1001
|
+
name: "auth",
|
|
1002
|
+
model: Auth
|
|
1003
|
+
}), "AuthModule");
|
|
1058
1004
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
if (
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1005
|
+
// src/features/auth/data/auth.ts
|
|
1006
|
+
var Auth = class extends _chunkQ4FXESVTjs.AbstractApiData {
|
|
1007
|
+
static {
|
|
1008
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "Auth");
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
get token() {
|
|
1014
|
+
if (!this._token) throw new Error("Token is not defined");
|
|
1015
|
+
return this._token;
|
|
1016
|
+
}
|
|
1017
|
+
get refreshToken() {
|
|
1018
|
+
if (!this._refreshToken) throw new Error("Refresh token is not defined");
|
|
1019
|
+
return this._refreshToken;
|
|
1020
|
+
}
|
|
1021
|
+
get user() {
|
|
1022
|
+
if (!this._user) throw new Error("User is not defined");
|
|
1023
|
+
return this._user;
|
|
1024
|
+
}
|
|
1025
|
+
rehydrate(data) {
|
|
1026
|
+
super.rehydrate(data);
|
|
1027
|
+
this._token = _nullishCoalesce(data.jsonApi.attributes.token, () => ( void 0));
|
|
1028
|
+
this._refreshToken = _nullishCoalesce(data.jsonApi.attributes.refreshToken, () => ( void 0));
|
|
1029
|
+
this._user = this._readIncluded(data, "user", _chunkQ4FXESVTjs.Modules.User);
|
|
1030
|
+
return this;
|
|
1031
|
+
}
|
|
1032
|
+
createJsonApi(data) {
|
|
1033
|
+
const response = {
|
|
1034
|
+
data: {
|
|
1035
|
+
type: _chunkQ4FXESVTjs.Modules.Auth.name,
|
|
1036
|
+
attributes: {}
|
|
1085
1037
|
}
|
|
1038
|
+
};
|
|
1039
|
+
if (data.id) response.data.id = data.id;
|
|
1040
|
+
if (data.email !== void 0) response.data.attributes.email = data.email;
|
|
1041
|
+
if (data.name !== void 0) response.data.attributes.name = data.name;
|
|
1042
|
+
if (data.companyName !== void 0) response.data.attributes.companyName = data.companyName;
|
|
1043
|
+
if (data.password !== void 0) response.data.attributes.password = data.password;
|
|
1044
|
+
if (data.partitaIva !== void 0) response.data.attributes.partitaIva = data.partitaIva;
|
|
1045
|
+
if (data.codiceFiscale !== void 0) response.data.attributes.codiceFiscale = data.codiceFiscale;
|
|
1046
|
+
return response;
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
// src/features/auth/data/auth.service.ts
|
|
1051
|
+
var AuthService = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
1052
|
+
static {
|
|
1053
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "AuthService");
|
|
1054
|
+
}
|
|
1055
|
+
static async login(params) {
|
|
1056
|
+
const language = params.language || "en-US";
|
|
1057
|
+
const apiResponse = await _chunkPMXG5WBCjs.JsonApiPost.call(void 0, {
|
|
1058
|
+
classKey: _chunkQ4FXESVTjs.Modules.Auth,
|
|
1059
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "login" }).generate(),
|
|
1060
|
+
body: { email: params.email, password: params.password },
|
|
1061
|
+
language
|
|
1062
|
+
});
|
|
1063
|
+
if (!apiResponse.ok) throw new Error(apiResponse.error);
|
|
1064
|
+
const auth = apiResponse.data;
|
|
1065
|
+
const handler = _chunkAYHKQWHHjs.getTokenHandler.call(void 0, );
|
|
1066
|
+
if (handler) {
|
|
1067
|
+
await handler.updateToken({
|
|
1068
|
+
token: auth.token,
|
|
1069
|
+
refreshToken: auth.refreshToken,
|
|
1070
|
+
userId: auth.user.id,
|
|
1071
|
+
companyId: _optionalChain([auth, 'access', _31 => _31.user, 'access', _32 => _32.company, 'optionalAccess', _33 => _33.id]),
|
|
1072
|
+
licenseExpirationDate: _optionalChain([auth, 'access', _34 => _34.user, 'access', _35 => _35.company, 'optionalAccess', _36 => _36.licenseExpirationDate]),
|
|
1073
|
+
roles: auth.user.roles.map((role) => role.id),
|
|
1074
|
+
features: _nullishCoalesce(_optionalChain([auth, 'access', _37 => _37.user, 'access', _38 => _38.company, 'optionalAccess', _39 => _39.features, 'optionalAccess', _40 => _40.map, 'call', _41 => _41((feature) => feature.id)]), () => ( [])),
|
|
1075
|
+
modules: auth.user.modules.map((module) => ({
|
|
1076
|
+
id: module.id,
|
|
1077
|
+
permissions: module.permissions
|
|
1078
|
+
}))
|
|
1079
|
+
});
|
|
1086
1080
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
transports: ["websocket"],
|
|
1100
|
-
timeout: 2e4
|
|
1101
|
-
});
|
|
1102
|
-
if (typeof window !== "undefined") {
|
|
1103
|
-
if (currentSocket.id && currentSocket.id !== "undefined") {
|
|
1104
|
-
window[globalSocketKey] = currentSocket;
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
socketRef.current = currentSocket;
|
|
1108
|
-
setSocket(currentSocket);
|
|
1109
|
-
} catch (e4) {
|
|
1110
|
-
return () => {
|
|
1111
|
-
};
|
|
1112
|
-
}
|
|
1081
|
+
return auth.user;
|
|
1082
|
+
}
|
|
1083
|
+
static async logout(params) {
|
|
1084
|
+
const language = _optionalChain([params, 'optionalAccess', _42 => _42.language]) || "en-US";
|
|
1085
|
+
await _chunkPMXG5WBCjs.JsonApiDelete.call(void 0, {
|
|
1086
|
+
classKey: _chunkQ4FXESVTjs.Modules.Auth,
|
|
1087
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth }).generate(),
|
|
1088
|
+
language
|
|
1089
|
+
});
|
|
1090
|
+
const handler = _chunkAYHKQWHHjs.getTokenHandler.call(void 0, );
|
|
1091
|
+
if (handler) {
|
|
1092
|
+
await handler.removeToken();
|
|
1113
1093
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1094
|
+
}
|
|
1095
|
+
static async initialiseForgotPassword(params) {
|
|
1096
|
+
const language = params.language || "en-US";
|
|
1097
|
+
const response = await _chunkPMXG5WBCjs.JsonApiPost.call(void 0, {
|
|
1098
|
+
classKey: _chunkQ4FXESVTjs.Modules.Auth,
|
|
1099
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "forgot" }).generate(),
|
|
1100
|
+
body: { email: params.email },
|
|
1101
|
+
language
|
|
1102
|
+
});
|
|
1103
|
+
if (!response.ok) {
|
|
1104
|
+
throw new Error(response.error);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
static async register(params) {
|
|
1108
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "register" });
|
|
1109
|
+
await this.callApi({
|
|
1110
|
+
type: _chunkQ4FXESVTjs.Modules.Auth,
|
|
1111
|
+
method: "POST" /* POST */,
|
|
1112
|
+
endpoint: endpoint.generate(),
|
|
1113
|
+
input: params
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
static async activate(params) {
|
|
1117
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
1118
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Auth,
|
|
1119
|
+
id: "activate",
|
|
1120
|
+
childEndpoint: params.activationCode
|
|
1121
|
+
});
|
|
1122
|
+
await this.callApi({ type: _chunkQ4FXESVTjs.Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate() });
|
|
1123
|
+
}
|
|
1124
|
+
static async validateCode(params) {
|
|
1125
|
+
const language = params.language || "en-US";
|
|
1126
|
+
const apiResponse = await _chunkPMXG5WBCjs.JsonApiGet.call(void 0, {
|
|
1127
|
+
classKey: _chunkQ4FXESVTjs.Modules.Auth,
|
|
1128
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "validate", childEndpoint: params.code }).generate(),
|
|
1129
|
+
language
|
|
1130
|
+
});
|
|
1131
|
+
if (!apiResponse.ok) throw new Error(apiResponse.error);
|
|
1132
|
+
}
|
|
1133
|
+
static async resetPassword(params) {
|
|
1134
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "reset", childEndpoint: params.code });
|
|
1135
|
+
const input = { password: params.password };
|
|
1136
|
+
await this.callApi({ type: _chunkQ4FXESVTjs.Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
|
|
1137
|
+
}
|
|
1138
|
+
static async acceptInvitation(params) {
|
|
1139
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "invitation", childEndpoint: params.code });
|
|
1140
|
+
const input = { password: params.password };
|
|
1141
|
+
await this.callApi({ type: _chunkQ4FXESVTjs.Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
|
|
1142
|
+
}
|
|
1143
|
+
static async findToken(params) {
|
|
1144
|
+
return await this.callApi({
|
|
1145
|
+
type: _chunkQ4FXESVTjs.Modules.Auth,
|
|
1146
|
+
method: "POST" /* POST */,
|
|
1147
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth }).addAdditionalParam("code", params.tokenCode).generate()
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
static async saveToken(params) {
|
|
1151
|
+
const auth = _chunkQ4FXESVTjs.rehydrate.call(void 0, _chunkQ4FXESVTjs.Modules.Auth, params.dehydratedAuth);
|
|
1152
|
+
const handler = _chunkAYHKQWHHjs.getTokenHandler.call(void 0, );
|
|
1153
|
+
if (handler) {
|
|
1154
|
+
await handler.updateToken({
|
|
1155
|
+
token: auth.token,
|
|
1156
|
+
refreshToken: auth.refreshToken,
|
|
1157
|
+
userId: auth.user.id,
|
|
1158
|
+
companyId: _optionalChain([auth, 'access', _43 => _43.user, 'access', _44 => _44.company, 'optionalAccess', _45 => _45.id]),
|
|
1159
|
+
licenseExpirationDate: _optionalChain([auth, 'access', _46 => _46.user, 'access', _47 => _47.company, 'optionalAccess', _48 => _48.licenseExpirationDate]),
|
|
1160
|
+
roles: auth.user.roles.map((role) => role.id),
|
|
1161
|
+
features: _nullishCoalesce(_optionalChain([auth, 'access', _49 => _49.user, 'access', _50 => _50.company, 'optionalAccess', _51 => _51.features, 'optionalAccess', _52 => _52.map, 'call', _53 => _53((feature) => feature.id)]), () => ( [])),
|
|
1162
|
+
modules: auth.user.modules.map((module) => ({
|
|
1163
|
+
id: module.id,
|
|
1164
|
+
permissions: module.permissions
|
|
1165
|
+
}))
|
|
1124
1166
|
});
|
|
1125
|
-
}, "handleMessage");
|
|
1126
|
-
const handleNotification = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (data) => {
|
|
1127
|
-
const notification = _chunkQ4FXESVTjs.rehydrate.call(void 0, _chunkQ4FXESVTjs.Modules.Notification, data);
|
|
1128
|
-
if (notification) {
|
|
1129
|
-
setSocketNotifications((prev) => {
|
|
1130
|
-
const newNotifications = [...prev, notification];
|
|
1131
|
-
return newNotifications;
|
|
1132
|
-
});
|
|
1133
|
-
}
|
|
1134
|
-
}, "handleNotification");
|
|
1135
|
-
if (currentSocket) {
|
|
1136
|
-
currentSocket.on("connect", handleConnect);
|
|
1137
|
-
currentSocket.on("disconnect", handleDisconnect);
|
|
1138
|
-
currentSocket.on("message", handleMessage);
|
|
1139
|
-
currentSocket.on("notification", handleNotification);
|
|
1140
1167
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
|
|
1171
|
+
// src/features/auth/enums/AuthComponent.ts
|
|
1172
|
+
var AuthComponent = /* @__PURE__ */ ((AuthComponent2) => {
|
|
1173
|
+
AuthComponent2[AuthComponent2["Login"] = 0] = "Login";
|
|
1174
|
+
AuthComponent2[AuthComponent2["ForgotPassword"] = 1] = "ForgotPassword";
|
|
1175
|
+
AuthComponent2[AuthComponent2["ResetPassword"] = 2] = "ResetPassword";
|
|
1176
|
+
AuthComponent2[AuthComponent2["ActivateAccount"] = 3] = "ActivateAccount";
|
|
1177
|
+
AuthComponent2[AuthComponent2["AcceptInvitation"] = 4] = "AcceptInvitation";
|
|
1178
|
+
AuthComponent2[AuthComponent2["Register"] = 5] = "Register";
|
|
1179
|
+
AuthComponent2[AuthComponent2["Landing"] = 6] = "Landing";
|
|
1180
|
+
return AuthComponent2;
|
|
1181
|
+
})(AuthComponent || {});
|
|
1182
|
+
|
|
1183
|
+
// src/features/company/company.module.ts
|
|
1184
|
+
var CompanyModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1185
|
+
pageUrl: "/companies",
|
|
1186
|
+
name: "companies",
|
|
1187
|
+
model: Company,
|
|
1188
|
+
moduleId: "f9e77c8f-bfd1-4fd4-80b0-e1d891ab7113"
|
|
1189
|
+
}), "CompanyModule");
|
|
1190
|
+
|
|
1191
|
+
// src/features/company/data/company.ts
|
|
1192
|
+
var Company = class extends _chunkQ4FXESVTjs.AbstractApiData {
|
|
1193
|
+
static {
|
|
1194
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "Company");
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
get name() {
|
|
1204
|
+
if (this._name === void 0) throw new Error("Name is not defined");
|
|
1205
|
+
return this._name;
|
|
1206
|
+
}
|
|
1207
|
+
get logo() {
|
|
1208
|
+
return this._logo;
|
|
1209
|
+
}
|
|
1210
|
+
get logoUrl() {
|
|
1211
|
+
return this._logoUrl;
|
|
1212
|
+
}
|
|
1213
|
+
get licenseExpirationDate() {
|
|
1214
|
+
return this._licenseExpirationDate;
|
|
1215
|
+
}
|
|
1216
|
+
get features() {
|
|
1217
|
+
return _nullishCoalesce(this._features, () => ( []));
|
|
1218
|
+
}
|
|
1219
|
+
get modules() {
|
|
1220
|
+
return _nullishCoalesce(this._modules, () => ( []));
|
|
1221
|
+
}
|
|
1222
|
+
get configurations() {
|
|
1223
|
+
return this._configurations;
|
|
1224
|
+
}
|
|
1225
|
+
rehydrate(data) {
|
|
1226
|
+
super.rehydrate(data);
|
|
1227
|
+
this._name = data.jsonApi.attributes.name;
|
|
1228
|
+
this._configurations = data.jsonApi.attributes.configurations ? JSON.parse(data.jsonApi.attributes.configurations) : void 0;
|
|
1229
|
+
this._logo = data.jsonApi.attributes.logo;
|
|
1230
|
+
this._logoUrl = data.jsonApi.attributes.logoUrl;
|
|
1231
|
+
this._licenseExpirationDate = data.jsonApi.attributes.licenseExpirationDate ? new Date(data.jsonApi.attributes.licenseExpirationDate) : void 0;
|
|
1232
|
+
this._features = this._readIncluded(data, "features", _chunkQ4FXESVTjs.Modules.Feature);
|
|
1233
|
+
this._modules = this._readIncluded(data, "modules", _chunkQ4FXESVTjs.Modules.Module);
|
|
1234
|
+
return this;
|
|
1235
|
+
}
|
|
1236
|
+
createJsonApi(data) {
|
|
1237
|
+
const response = {
|
|
1238
|
+
data: {
|
|
1239
|
+
type: _chunkQ4FXESVTjs.Modules.Company.name,
|
|
1240
|
+
id: data.id,
|
|
1241
|
+
attributes: {},
|
|
1242
|
+
meta: {},
|
|
1243
|
+
relationships: {}
|
|
1244
|
+
},
|
|
1245
|
+
included: []
|
|
1160
1246
|
};
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
if (
|
|
1164
|
-
|
|
1247
|
+
if (data.name) response.data.attributes.name = data.name;
|
|
1248
|
+
if (data.configurations) response.data.attributes.configurations = JSON.stringify(data.configurations);
|
|
1249
|
+
if (data.logo) response.data.attributes.logo = data.logo;
|
|
1250
|
+
if (data.license) response.data.attributes.license = data.license;
|
|
1251
|
+
if (data.privateKey) response.data.attributes.privateKey = data.privateKey;
|
|
1252
|
+
if (data.featureIds && data.featureIds.length > 0) {
|
|
1253
|
+
response.data.relationships.features = {
|
|
1254
|
+
data: data.featureIds.map((featureId) => ({
|
|
1255
|
+
type: _chunkQ4FXESVTjs.Modules.Feature.name,
|
|
1256
|
+
id: featureId
|
|
1257
|
+
}))
|
|
1258
|
+
};
|
|
1165
1259
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1260
|
+
if (data.moduleIds && data.moduleIds.length > 0) {
|
|
1261
|
+
response.data.relationships.modules = {
|
|
1262
|
+
data: data.moduleIds.map((moduleId) => ({
|
|
1263
|
+
type: _chunkQ4FXESVTjs.Modules.Module.name,
|
|
1264
|
+
id: moduleId
|
|
1265
|
+
}))
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
return response;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
// src/features/company/data/company.fields.ts
|
|
1273
|
+
var CompanyFields = /* @__PURE__ */ ((CompanyFields2) => {
|
|
1274
|
+
CompanyFields2["companyId"] = "companyId";
|
|
1275
|
+
CompanyFields2["name"] = "name";
|
|
1276
|
+
CompanyFields2["createdAt"] = "createdAt";
|
|
1277
|
+
CompanyFields2["updatedAt"] = "updatedAt";
|
|
1278
|
+
return CompanyFields2;
|
|
1279
|
+
})(CompanyFields || {});
|
|
1280
|
+
|
|
1281
|
+
// src/features/company/data/company.service.ts
|
|
1282
|
+
var CompanyService = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
1283
|
+
static {
|
|
1284
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "CompanyService");
|
|
1285
|
+
}
|
|
1286
|
+
static async findOne(params) {
|
|
1287
|
+
return this.callApi({
|
|
1288
|
+
type: _chunkQ4FXESVTjs.Modules.Company,
|
|
1289
|
+
method: "GET" /* GET */,
|
|
1290
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company, id: params.companyId }).generate()
|
|
1172
1291
|
});
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1292
|
+
}
|
|
1293
|
+
static async findMany(params) {
|
|
1294
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company });
|
|
1295
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
1296
|
+
return this.callApi({
|
|
1297
|
+
type: _chunkQ4FXESVTjs.Modules.Company,
|
|
1298
|
+
method: "GET" /* GET */,
|
|
1299
|
+
endpoint: endpoint.generate(),
|
|
1300
|
+
next: params.next
|
|
1179
1301
|
});
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1302
|
+
}
|
|
1303
|
+
static async delete(params) {
|
|
1304
|
+
await this.callApi({
|
|
1305
|
+
type: _chunkQ4FXESVTjs.Modules.Company,
|
|
1306
|
+
method: "DELETE" /* DELETE */,
|
|
1307
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company, id: params.companyId }).generate()
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
static async create(params) {
|
|
1311
|
+
return this.callApi({
|
|
1312
|
+
type: _chunkQ4FXESVTjs.Modules.Company,
|
|
1313
|
+
method: "POST" /* POST */,
|
|
1314
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company }).generate(),
|
|
1315
|
+
input: params
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
static async update(params) {
|
|
1319
|
+
return this.callApi({
|
|
1320
|
+
type: _chunkQ4FXESVTjs.Modules.Company,
|
|
1321
|
+
method: "PUT" /* PUT */,
|
|
1322
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company, id: params.id }).generate(),
|
|
1323
|
+
input: params
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
static async updateConfigurations(params) {
|
|
1327
|
+
return this.callApi({
|
|
1328
|
+
type: _chunkQ4FXESVTjs.Modules.Company,
|
|
1329
|
+
method: "PUT" /* PUT */,
|
|
1330
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
1331
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Company,
|
|
1332
|
+
id: params.id,
|
|
1333
|
+
childEndpoint: "configurations"
|
|
1334
|
+
}).generate(),
|
|
1335
|
+
input: params
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
static async activateLicense(params) {
|
|
1339
|
+
return this.callApi({
|
|
1340
|
+
type: _chunkQ4FXESVTjs.Modules.Company,
|
|
1341
|
+
method: "PUT" /* PUT */,
|
|
1342
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company, id: params.id, childEndpoint: "license" }).generate(),
|
|
1343
|
+
input: params
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1200
1347
|
|
|
1201
|
-
// src/features/
|
|
1202
|
-
var
|
|
1348
|
+
// src/features/content/content.module.ts
|
|
1349
|
+
var ContentModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1350
|
+
pageUrl: "/contents",
|
|
1351
|
+
name: "contents",
|
|
1352
|
+
model: Content,
|
|
1353
|
+
inclusions: {
|
|
1354
|
+
lists: {
|
|
1355
|
+
fields: [
|
|
1356
|
+
_chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "content", [`name`, `tldr`, `abstract`, `aiStatus`, `relevance`]),
|
|
1357
|
+
_chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "users", [`name`, `avatar`]),
|
|
1358
|
+
_chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "topics", [`name`]),
|
|
1359
|
+
_chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "expertises", [`name`])
|
|
1360
|
+
]
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
}), "ContentModule");
|
|
1203
1364
|
|
|
1204
|
-
|
|
1365
|
+
// src/features/content/data/content.ts
|
|
1366
|
+
var Content = class extends _chunkQ4FXESVTjs.AbstractApiData {
|
|
1367
|
+
static {
|
|
1368
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "Content");
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
get searchResult() {
|
|
1379
|
+
return _nullishCoalesce(this._name, () => ( ""));
|
|
1380
|
+
}
|
|
1381
|
+
get contentType() {
|
|
1382
|
+
return this._contentType;
|
|
1383
|
+
}
|
|
1384
|
+
get name() {
|
|
1385
|
+
if (this._name === void 0) throw new Error("JsonApi error: content name is missing");
|
|
1386
|
+
return this._name;
|
|
1387
|
+
}
|
|
1388
|
+
get abstract() {
|
|
1389
|
+
return this._abstract;
|
|
1390
|
+
}
|
|
1391
|
+
get tldr() {
|
|
1392
|
+
return this._tldr;
|
|
1393
|
+
}
|
|
1394
|
+
get aiStatus() {
|
|
1395
|
+
return _nullishCoalesce(this._aiStatus, () => ( ""));
|
|
1396
|
+
}
|
|
1397
|
+
get relevance() {
|
|
1398
|
+
return this._relevance;
|
|
1399
|
+
}
|
|
1400
|
+
get author() {
|
|
1401
|
+
if (this._author === void 0) throw new Error("JsonApi error: document author is missing");
|
|
1402
|
+
return this._author;
|
|
1403
|
+
}
|
|
1404
|
+
get editors() {
|
|
1405
|
+
return _nullishCoalesce(this._editors, () => ( []));
|
|
1406
|
+
}
|
|
1407
|
+
rehydrate(data) {
|
|
1408
|
+
super.rehydrate(data);
|
|
1409
|
+
this._contentType = data.jsonApi.meta.contentType;
|
|
1410
|
+
this._name = data.jsonApi.attributes.name;
|
|
1411
|
+
this._abstract = data.jsonApi.attributes.abstract;
|
|
1412
|
+
this._tldr = data.jsonApi.attributes.tldr;
|
|
1413
|
+
this._aiStatus = data.jsonApi.meta.aiStatus;
|
|
1414
|
+
this._relevance = data.jsonApi.meta.relevance;
|
|
1415
|
+
this._author = this._readIncluded(data, "author", _chunkQ4FXESVTjs.Modules.User);
|
|
1416
|
+
this._editors = this._readIncluded(data, "editors", _chunkQ4FXESVTjs.Modules.User);
|
|
1417
|
+
return this;
|
|
1418
|
+
}
|
|
1419
|
+
addContentInput(response, data) {
|
|
1420
|
+
if (data.name) response.data.attributes.name = data.name;
|
|
1421
|
+
if (data.authorId) {
|
|
1422
|
+
response.data.relationships.author = {
|
|
1423
|
+
data: {
|
|
1424
|
+
type: _chunkQ4FXESVTjs.Modules.User.name,
|
|
1425
|
+
id: data.authorId
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1205
1431
|
|
|
1432
|
+
// src/features/content/data/content.fields.ts
|
|
1433
|
+
var ContentFields = /* @__PURE__ */ ((ContentFields2) => {
|
|
1434
|
+
ContentFields2["contentId"] = "contentId";
|
|
1435
|
+
ContentFields2["name"] = "name";
|
|
1436
|
+
ContentFields2["relevance"] = "relevance";
|
|
1437
|
+
ContentFields2["authors"] = "authors";
|
|
1438
|
+
ContentFields2["createdAt"] = "createdAt";
|
|
1439
|
+
ContentFields2["updatedAt"] = "updatedAt";
|
|
1440
|
+
return ContentFields2;
|
|
1441
|
+
})(ContentFields || {});
|
|
1442
|
+
|
|
1443
|
+
// src/features/content/data/content.service.ts
|
|
1444
|
+
var ContentService = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
1445
|
+
static {
|
|
1446
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "ContentService");
|
|
1447
|
+
}
|
|
1448
|
+
static async findMany(params) {
|
|
1449
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Content });
|
|
1450
|
+
if (params.contentIds) {
|
|
1451
|
+
endpoint.addAdditionalParam("contentIds", params.contentIds.join(","));
|
|
1452
|
+
endpoint.addAdditionalParam("fetchAll", "true");
|
|
1453
|
+
} else {
|
|
1454
|
+
if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
|
|
1455
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
1456
|
+
}
|
|
1457
|
+
if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _54 => _54.Content, 'access', _55 => _55.inclusions, 'optionalAccess', _56 => _56.lists, 'optionalAccess', _57 => _57.fields])) endpoint.limitToFields(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.fields);
|
|
1458
|
+
if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _58 => _58.Content, 'access', _59 => _59.inclusions, 'optionalAccess', _60 => _60.lists, 'optionalAccess', _61 => _61.types])) endpoint.limitToType(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.types);
|
|
1459
|
+
return this.callApi({
|
|
1460
|
+
type: _chunkQ4FXESVTjs.Modules.Content,
|
|
1461
|
+
method: "GET" /* GET */,
|
|
1462
|
+
endpoint: endpoint.generate(),
|
|
1463
|
+
next: params.next
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
static async findRelevant(params) {
|
|
1467
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
1468
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Content,
|
|
1469
|
+
id: params.id,
|
|
1470
|
+
childEndpoint: "relevance"
|
|
1471
|
+
});
|
|
1472
|
+
if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _62 => _62.Content, 'access', _63 => _63.inclusions, 'optionalAccess', _64 => _64.lists, 'optionalAccess', _65 => _65.fields])) endpoint.limitToFields(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.fields);
|
|
1473
|
+
if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _66 => _66.Content, 'access', _67 => _67.inclusions, 'optionalAccess', _68 => _68.lists, 'optionalAccess', _69 => _69.types])) endpoint.limitToType(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.types);
|
|
1474
|
+
return this.callApi({
|
|
1475
|
+
type: _chunkQ4FXESVTjs.Modules.Content,
|
|
1476
|
+
method: "GET" /* GET */,
|
|
1477
|
+
endpoint: endpoint.generate(),
|
|
1478
|
+
next: params.next
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
static async findManyByAuthor(params) {
|
|
1482
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
1483
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Author,
|
|
1484
|
+
id: params.userId,
|
|
1485
|
+
childEndpoint: _chunkQ4FXESVTjs.Modules.Content
|
|
1486
|
+
});
|
|
1487
|
+
if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
|
|
1488
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
1489
|
+
if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _70 => _70.Content, 'access', _71 => _71.inclusions, 'optionalAccess', _72 => _72.lists, 'optionalAccess', _73 => _73.fields])) endpoint.limitToFields(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.fields);
|
|
1490
|
+
if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _74 => _74.Content, 'access', _75 => _75.inclusions, 'optionalAccess', _76 => _76.lists, 'optionalAccess', _77 => _77.types])) endpoint.limitToType(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.types);
|
|
1491
|
+
return this.callApi({
|
|
1492
|
+
type: _chunkQ4FXESVTjs.Modules.Content,
|
|
1493
|
+
method: "GET" /* GET */,
|
|
1494
|
+
endpoint: endpoint.generate(),
|
|
1495
|
+
next: params.next
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1206
1499
|
|
|
1500
|
+
// src/features/feature/data/feature.ts
|
|
1501
|
+
var Feature = (_class2 = class extends _chunkQ4FXESVTjs.AbstractApiData {constructor(...args2) { super(...args2); _class2.prototype.__init2.call(this); }
|
|
1502
|
+
static {
|
|
1503
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "Feature");
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
__init2() {this._modules = []}
|
|
1508
|
+
get name() {
|
|
1509
|
+
return _nullishCoalesce(this._name, () => ( ""));
|
|
1510
|
+
}
|
|
1511
|
+
get isProduction() {
|
|
1512
|
+
return this._isProduction == true ? true : false;
|
|
1513
|
+
}
|
|
1514
|
+
get modules() {
|
|
1515
|
+
return this._modules;
|
|
1516
|
+
}
|
|
1517
|
+
rehydrate(data) {
|
|
1518
|
+
super.rehydrate(data);
|
|
1519
|
+
this._name = data.jsonApi.attributes.name;
|
|
1520
|
+
this._isProduction = _nullishCoalesce(data.jsonApi.attributes.isProduction, () => ( false));
|
|
1521
|
+
this._modules = this._readIncluded(data, `modules`, _chunkQ4FXESVTjs.Modules.Module);
|
|
1522
|
+
return this;
|
|
1523
|
+
}
|
|
1524
|
+
}, _class2);
|
|
1525
|
+
|
|
1526
|
+
// src/features/feature/feature.module.ts
|
|
1527
|
+
var FeatureModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1528
|
+
pageUrl: "/features",
|
|
1529
|
+
name: "features",
|
|
1530
|
+
model: Feature,
|
|
1531
|
+
moduleId: "025fdd23-2803-4360-9fd9-eaa3612c2e23"
|
|
1532
|
+
}), "FeatureModule");
|
|
1533
|
+
|
|
1534
|
+
// src/features/feature/data/feature.service.ts
|
|
1535
|
+
var FeatureService = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
1536
|
+
static {
|
|
1537
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "FeatureService");
|
|
1538
|
+
}
|
|
1539
|
+
static async findMany(params) {
|
|
1540
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Feature });
|
|
1541
|
+
if (params.companyId) endpoint.endpoint(_chunkQ4FXESVTjs.Modules.Company).id(params.companyId).childEndpoint(_chunkQ4FXESVTjs.Modules.Feature);
|
|
1542
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
1543
|
+
return this.callApi({
|
|
1544
|
+
type: _chunkQ4FXESVTjs.Modules.Feature,
|
|
1545
|
+
method: "GET" /* GET */,
|
|
1546
|
+
endpoint: endpoint.generate(),
|
|
1547
|
+
next: params.next
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1207
1551
|
|
|
1208
|
-
|
|
1209
|
-
var
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1552
|
+
// src/features/module/data/module.ts
|
|
1553
|
+
var Module = class extends _chunkQ4FXESVTjs.AbstractApiData {
|
|
1554
|
+
static {
|
|
1555
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "Module");
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
get name() {
|
|
1561
|
+
if (!this._name) throw new Error("Name is not defined");
|
|
1562
|
+
return _nullishCoalesce(this._name, () => ( ""));
|
|
1563
|
+
}
|
|
1564
|
+
get isCore() {
|
|
1565
|
+
return _nullishCoalesce(this._isCore, () => ( false));
|
|
1566
|
+
}
|
|
1567
|
+
get permissions() {
|
|
1568
|
+
if (!this._permissions) throw new Error("Permissions is not defined");
|
|
1569
|
+
return this._permissions;
|
|
1570
|
+
}
|
|
1571
|
+
rehydrate(data) {
|
|
1572
|
+
super.rehydrate(data);
|
|
1573
|
+
this._name = data.jsonApi.attributes.name;
|
|
1574
|
+
this._isCore = data.jsonApi.attributes.isCore;
|
|
1575
|
+
this._permissions = data.jsonApi.meta.permissions;
|
|
1576
|
+
return this;
|
|
1577
|
+
}
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
// src/features/module/module.module.ts
|
|
1581
|
+
var ModuleModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1582
|
+
pageUrl: "/modules",
|
|
1583
|
+
name: "modules",
|
|
1584
|
+
model: Module,
|
|
1585
|
+
moduleId: "25ffd868-8341-4ca7-963b-6e1c56b03b1d"
|
|
1586
|
+
}), "ModuleModule");
|
|
1587
|
+
|
|
1588
|
+
// src/features/notification/data/notification.ts
|
|
1589
|
+
var Notification2 = class extends _chunkQ4FXESVTjs.AbstractApiData {
|
|
1590
|
+
static {
|
|
1591
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "Notification");
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
get notificationType() {
|
|
1597
|
+
if (this._notificationType === void 0) throw new Error("notificationType is not set");
|
|
1598
|
+
return this._notificationType;
|
|
1599
|
+
}
|
|
1600
|
+
get isRead() {
|
|
1601
|
+
return this._isRead === void 0 ? false : this._isRead;
|
|
1602
|
+
}
|
|
1603
|
+
get actor() {
|
|
1604
|
+
return this._actor;
|
|
1605
|
+
}
|
|
1606
|
+
rehydrate(data) {
|
|
1607
|
+
super.rehydrate(data);
|
|
1608
|
+
this._notificationType = data.jsonApi.attributes.notificationType;
|
|
1609
|
+
this._isRead = data.jsonApi.attributes.isRead;
|
|
1610
|
+
this._actor = this._readIncluded(data, "actor", _chunkQ4FXESVTjs.Modules.User);
|
|
1611
|
+
return this;
|
|
1612
|
+
}
|
|
1613
|
+
createJsonApi(data) {
|
|
1614
|
+
const response = {
|
|
1615
|
+
data: {
|
|
1616
|
+
type: _chunkQ4FXESVTjs.Modules.Notification.name,
|
|
1617
|
+
id: data.id,
|
|
1618
|
+
attributes: {
|
|
1619
|
+
isRead: data.isRead
|
|
1620
|
+
},
|
|
1621
|
+
meta: {},
|
|
1622
|
+
relationships: {}
|
|
1623
|
+
},
|
|
1624
|
+
included: []
|
|
1625
|
+
};
|
|
1626
|
+
return response;
|
|
1627
|
+
}
|
|
1628
|
+
};
|
|
1629
|
+
|
|
1630
|
+
// src/features/notification/notification.module.ts
|
|
1631
|
+
var NotificationModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1632
|
+
pageUrl: "/notifications",
|
|
1633
|
+
name: "notifications",
|
|
1634
|
+
model: Notification2,
|
|
1635
|
+
moduleId: "9259d704-c670-4e77-a3a1-a728ffc5be3d"
|
|
1636
|
+
}), "NotificationModule");
|
|
1637
|
+
|
|
1638
|
+
// src/features/notification/data/notification.fields.ts
|
|
1639
|
+
var NotificationFields = /* @__PURE__ */ ((NotificationFields2) => {
|
|
1640
|
+
NotificationFields2["notificationId"] = "notificationId";
|
|
1641
|
+
NotificationFields2["name"] = "name";
|
|
1642
|
+
NotificationFields2["createdAt"] = "createdAt";
|
|
1643
|
+
NotificationFields2["updatedAt"] = "updatedAt";
|
|
1644
|
+
return NotificationFields2;
|
|
1645
|
+
})(NotificationFields || {});
|
|
1646
|
+
|
|
1647
|
+
// src/features/notification/data/notification.service.ts
|
|
1648
|
+
var NotificationService = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
1649
|
+
static {
|
|
1650
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "NotificationService");
|
|
1651
|
+
}
|
|
1652
|
+
static async findMany(params) {
|
|
1653
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Notification });
|
|
1654
|
+
if (params.isArchived) endpoint.addAdditionalParam("isArchived", "true");
|
|
1655
|
+
return this.callApi({
|
|
1656
|
+
type: _chunkQ4FXESVTjs.Modules.Notification,
|
|
1657
|
+
method: "GET" /* GET */,
|
|
1658
|
+
endpoint: endpoint.generate(),
|
|
1659
|
+
next: params.next
|
|
1226
1660
|
});
|
|
1227
|
-
if (!matchedModuleKey) return void 0;
|
|
1228
|
-
const descriptor = Object.getOwnPropertyDescriptor(_chunkQ4FXESVTjs.Modules, matchedModuleKey);
|
|
1229
|
-
return _optionalChain([descriptor, 'optionalAccess', _40 => _40.get, 'optionalAccess', _41 => _41.call, 'call', _42 => _42(_chunkQ4FXESVTjs.Modules)]);
|
|
1230
|
-
}, "matchUrlToModule");
|
|
1231
|
-
const currentUser = dehydratedUser ? _chunkQ4FXESVTjs.rehydrate.call(void 0, _chunkQ4FXESVTjs.Modules.User, dehydratedUser) : null;
|
|
1232
|
-
const company = _nullishCoalesce(_optionalChain([currentUser, 'optionalAccess', _43 => _43.company]), () => ( null));
|
|
1233
|
-
const setUser = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (user) => {
|
|
1234
|
-
if (user) setDehydratedUser(user.dehydrate());
|
|
1235
|
-
else setDehydratedUser(null);
|
|
1236
|
-
}, "setUser");
|
|
1237
|
-
const hasRole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (roleId) => {
|
|
1238
|
-
if (!currentUser) return false;
|
|
1239
|
-
return !!_optionalChain([currentUser, 'access', _44 => _44.roles, 'optionalAccess', _45 => _45.some, 'call', _46 => _46((userRole) => userRole.id === roleId)]);
|
|
1240
|
-
}, "hasRole");
|
|
1241
|
-
const hasAccesToFeature = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (featureIdentifier) => {
|
|
1242
|
-
if (hasRole(_chunk4HCRAOS5js.getRoleId.call(void 0, ).Administrator)) return true;
|
|
1243
|
-
if (!company) return false;
|
|
1244
|
-
return company.features.some((feature) => feature.id === featureIdentifier);
|
|
1245
|
-
}, "hasAccesToFeature");
|
|
1246
|
-
function hasPermissionToModule(params) {
|
|
1247
|
-
if (!currentUser) return false;
|
|
1248
|
-
if (!!params.module.feature && !hasAccesToFeature(params.module.feature)) return false;
|
|
1249
|
-
return _chunk32HM6MDDjs.checkPermissions.call(void 0, { module: params.module, action: params.action, data: params.data, user: currentUser });
|
|
1250
1661
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1662
|
+
static async markAsRead(params) {
|
|
1663
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Notification });
|
|
1664
|
+
await this.callApi({
|
|
1665
|
+
type: _chunkQ4FXESVTjs.Modules.Notification,
|
|
1666
|
+
method: "PATCH" /* PATCH */,
|
|
1667
|
+
endpoint: endpoint.generate(),
|
|
1668
|
+
input: params.data,
|
|
1669
|
+
overridesJsonApiCreation: true
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
static async archive(params) {
|
|
1673
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Notification, id: params.id, childEndpoint: "archive" });
|
|
1674
|
+
await this.callApi({ type: _chunkQ4FXESVTjs.Modules.Notification, method: "POST" /* POST */, endpoint: endpoint.generate() });
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
|
|
1678
|
+
// src/features/push/data/push.ts
|
|
1679
|
+
var Push = class extends _chunkQ4FXESVTjs.AbstractApiData {
|
|
1680
|
+
static {
|
|
1681
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "Push");
|
|
1682
|
+
}
|
|
1683
|
+
createJsonApi(data) {
|
|
1684
|
+
const response = {
|
|
1685
|
+
data: {
|
|
1686
|
+
type: _chunkQ4FXESVTjs.Modules.Push.name,
|
|
1687
|
+
attributes: {
|
|
1688
|
+
key: data.key
|
|
1689
|
+
}
|
|
1690
|
+
},
|
|
1691
|
+
included: []
|
|
1692
|
+
};
|
|
1693
|
+
return response;
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
// src/features/push/push.module.ts
|
|
1698
|
+
var PushModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1699
|
+
pageUrl: "/push",
|
|
1700
|
+
name: "push",
|
|
1701
|
+
model: Push,
|
|
1702
|
+
moduleId: ""
|
|
1703
|
+
}), "PushModule");
|
|
1704
|
+
|
|
1705
|
+
// src/features/push/data/push.service.ts
|
|
1706
|
+
var PushService = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
1707
|
+
static {
|
|
1708
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "PushService");
|
|
1709
|
+
}
|
|
1710
|
+
static async register(params) {
|
|
1711
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Push });
|
|
1712
|
+
await this.callApi({
|
|
1713
|
+
type: _chunkQ4FXESVTjs.Modules.Push,
|
|
1714
|
+
method: "POST" /* POST */,
|
|
1715
|
+
endpoint: endpoint.generate(),
|
|
1716
|
+
input: params.data,
|
|
1717
|
+
overridesJsonApiCreation: true
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
|
|
1722
|
+
// src/features/role/data/role.ts
|
|
1723
|
+
var Role = class extends _chunkQ4FXESVTjs.AbstractApiData {
|
|
1724
|
+
static {
|
|
1725
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "Role");
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
|
|
1730
|
+
|
|
1731
|
+
get name() {
|
|
1732
|
+
if (!this._name) throw new Error("Name is not defined");
|
|
1733
|
+
return this._name;
|
|
1734
|
+
}
|
|
1735
|
+
get description() {
|
|
1736
|
+
return _nullishCoalesce(this._description, () => ( ""));
|
|
1737
|
+
}
|
|
1738
|
+
get isSelectable() {
|
|
1739
|
+
return _nullishCoalesce(this._isSelectable, () => ( false));
|
|
1740
|
+
}
|
|
1741
|
+
get requiredFeature() {
|
|
1742
|
+
return this._requiredFeature;
|
|
1743
|
+
}
|
|
1744
|
+
rehydrate(data) {
|
|
1745
|
+
super.rehydrate(data);
|
|
1746
|
+
this._name = _nullishCoalesce(data.jsonApi.attributes.name, () => ( void 0));
|
|
1747
|
+
this._description = _nullishCoalesce(data.jsonApi.attributes.description, () => ( void 0));
|
|
1748
|
+
this._isSelectable = _nullishCoalesce(data.jsonApi.attributes.isSelectable, () => ( void 0));
|
|
1749
|
+
this._requiredFeature = this._readIncluded(
|
|
1750
|
+
data,
|
|
1751
|
+
"requiredFeature",
|
|
1752
|
+
_chunkQ4FXESVTjs.Modules.Feature
|
|
1257
1753
|
);
|
|
1754
|
+
return this;
|
|
1755
|
+
}
|
|
1756
|
+
createJsonApi(data) {
|
|
1757
|
+
const response = {
|
|
1758
|
+
data: {
|
|
1759
|
+
type: _chunkQ4FXESVTjs.Modules.Role.name,
|
|
1760
|
+
id: data.id,
|
|
1761
|
+
attributes: {
|
|
1762
|
+
name: data.name
|
|
1763
|
+
},
|
|
1764
|
+
meta: {}
|
|
1765
|
+
},
|
|
1766
|
+
included: []
|
|
1767
|
+
};
|
|
1768
|
+
if (data.description !== void 0) response.data.attributes.description = data.description;
|
|
1769
|
+
return response;
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1773
|
+
// src/features/role/data/role.fields.ts
|
|
1774
|
+
var RoleFields = /* @__PURE__ */ ((RoleFields2) => {
|
|
1775
|
+
RoleFields2["roleId"] = "roleId";
|
|
1776
|
+
RoleFields2["name"] = "name";
|
|
1777
|
+
RoleFields2["description"] = "description";
|
|
1778
|
+
RoleFields2["createdAt"] = "createdAt";
|
|
1779
|
+
RoleFields2["updatedAt"] = "updatedAt";
|
|
1780
|
+
return RoleFields2;
|
|
1781
|
+
})(RoleFields || {});
|
|
1782
|
+
|
|
1783
|
+
// src/features/role/data/role.service.ts
|
|
1784
|
+
var RoleService = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
1785
|
+
static {
|
|
1786
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "RoleService");
|
|
1787
|
+
}
|
|
1788
|
+
static async findById(params) {
|
|
1789
|
+
return this.callApi({
|
|
1790
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1791
|
+
method: "GET" /* GET */,
|
|
1792
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role, id: params.roleId }).generate()
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
static async findAllRoles(params) {
|
|
1796
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role });
|
|
1797
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
1798
|
+
return this.callApi({
|
|
1799
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1800
|
+
method: "GET" /* GET */,
|
|
1801
|
+
endpoint: endpoint.generate(),
|
|
1802
|
+
next: params.next
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
static async findAllRolesByUser(params) {
|
|
1806
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.userId, childEndpoint: _chunkQ4FXESVTjs.Modules.Role });
|
|
1807
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
1808
|
+
return this.callApi({
|
|
1809
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1810
|
+
method: "GET" /* GET */,
|
|
1811
|
+
endpoint: endpoint.generate(),
|
|
1812
|
+
next: params.next
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
static async findAllRolesUserNotIn(params) {
|
|
1816
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
1817
|
+
endpoint: _chunkQ4FXESVTjs.Modules.User,
|
|
1818
|
+
id: params.userId,
|
|
1819
|
+
childEndpoint: _chunkQ4FXESVTjs.Modules.Role
|
|
1820
|
+
}).addAdditionalParam("userNotIn", "true");
|
|
1821
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
1822
|
+
return this.callApi({
|
|
1823
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1824
|
+
method: "GET" /* GET */,
|
|
1825
|
+
endpoint: endpoint.generate(),
|
|
1826
|
+
next: params.next
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1829
|
+
static async addUserToRole(params) {
|
|
1830
|
+
this.callApi({
|
|
1831
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1832
|
+
method: "POST" /* POST */,
|
|
1833
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
1834
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Role,
|
|
1835
|
+
id: params.roleId,
|
|
1836
|
+
childEndpoint: _chunkQ4FXESVTjs.Modules.User,
|
|
1837
|
+
childId: params.userId
|
|
1838
|
+
}).generate()
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
static async removeUserFromRole(params) {
|
|
1842
|
+
this.callApi({
|
|
1843
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1844
|
+
method: "DELETE" /* DELETE */,
|
|
1845
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
1846
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Role,
|
|
1847
|
+
id: params.roleId,
|
|
1848
|
+
childEndpoint: _chunkQ4FXESVTjs.Modules.User,
|
|
1849
|
+
childId: params.userId
|
|
1850
|
+
}).generate()
|
|
1851
|
+
});
|
|
1852
|
+
}
|
|
1853
|
+
static async create(params) {
|
|
1854
|
+
return this.callApi({
|
|
1855
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1856
|
+
method: "POST" /* POST */,
|
|
1857
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role }).generate(),
|
|
1858
|
+
input: { id: params.roleId, name: params.name, description: params.description }
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
static async update(params) {
|
|
1862
|
+
return this.callApi({
|
|
1863
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1864
|
+
method: "PUT" /* PUT */,
|
|
1865
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role, id: params.roleId }).generate(),
|
|
1866
|
+
input: { id: params.roleId, name: params.name, description: params.description }
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
static async delete(params) {
|
|
1870
|
+
return this.callApi({
|
|
1871
|
+
type: _chunkQ4FXESVTjs.Modules.Role,
|
|
1872
|
+
method: "DELETE" /* DELETE */,
|
|
1873
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role, id: params.roleId }).generate()
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
};
|
|
1877
|
+
|
|
1878
|
+
// src/features/role/role.module.ts
|
|
1879
|
+
var RoleModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1880
|
+
pageUrl: "/roles",
|
|
1881
|
+
name: "roles",
|
|
1882
|
+
model: Role,
|
|
1883
|
+
moduleId: "9f6416e6-7b9b-4e1a-a99f-833191eca8a9"
|
|
1884
|
+
}), "RoleModule");
|
|
1885
|
+
|
|
1886
|
+
// src/features/s3/data/s3.ts
|
|
1887
|
+
var S3 = class extends _chunkQ4FXESVTjs.AbstractApiData {
|
|
1888
|
+
static {
|
|
1889
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "S3");
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
|
|
1893
|
+
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
get url() {
|
|
1897
|
+
if (!this._url) throw new Error("Image URL is not set.");
|
|
1898
|
+
return this._url;
|
|
1899
|
+
}
|
|
1900
|
+
get headers() {
|
|
1901
|
+
const headers = {};
|
|
1902
|
+
if (this._contentType) {
|
|
1903
|
+
headers["Content-Type"] = this._contentType;
|
|
1904
|
+
}
|
|
1905
|
+
if (this._blobType) {
|
|
1906
|
+
headers["x-ms-blob-type"] = this._blobType;
|
|
1907
|
+
}
|
|
1908
|
+
if (this._acl) {
|
|
1909
|
+
headers["x-amz-acl"] = this._acl;
|
|
1910
|
+
}
|
|
1911
|
+
return headers;
|
|
1912
|
+
}
|
|
1913
|
+
rehydrate(data) {
|
|
1914
|
+
super.rehydrate(data);
|
|
1915
|
+
this._url = _nullishCoalesce(data.jsonApi.attributes.url, () => ( void 0));
|
|
1916
|
+
this._storageType = _nullishCoalesce(data.jsonApi.attributes.storageType, () => ( void 0));
|
|
1917
|
+
this._contentType = _nullishCoalesce(data.jsonApi.attributes.contentType, () => ( void 0));
|
|
1918
|
+
this._blobType = _nullishCoalesce(data.jsonApi.attributes.blobType, () => ( void 0));
|
|
1919
|
+
this._acl = _nullishCoalesce(data.jsonApi.attributes.acl, () => ( void 0));
|
|
1920
|
+
return this;
|
|
1921
|
+
}
|
|
1922
|
+
createJsonApi(data) {
|
|
1923
|
+
const response = {
|
|
1924
|
+
data: {
|
|
1925
|
+
type: _chunkQ4FXESVTjs.Modules.S3.name,
|
|
1926
|
+
attributes: {
|
|
1927
|
+
key: data.key
|
|
1928
|
+
}
|
|
1929
|
+
},
|
|
1930
|
+
included: []
|
|
1931
|
+
};
|
|
1932
|
+
if (data.contentType) response.data.attributes.contentType = data.contentType;
|
|
1933
|
+
return response;
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
|
|
1937
|
+
// src/features/s3/s3.module.ts
|
|
1938
|
+
var S3Module = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1939
|
+
pageUrl: "/s3",
|
|
1940
|
+
name: "s3",
|
|
1941
|
+
model: S3,
|
|
1942
|
+
moduleId: "db41ba46-e171-4324-8845-99353eba8568"
|
|
1943
|
+
}), "S3Module");
|
|
1944
|
+
|
|
1945
|
+
// src/features/s3/data/s3.service.ts
|
|
1946
|
+
var S3Service = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
1947
|
+
static {
|
|
1948
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "S3Service");
|
|
1949
|
+
}
|
|
1950
|
+
static async getPreSignedUrl(params) {
|
|
1951
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.S3 }).addAdditionalParam("key", params.key).addAdditionalParam("contentType", params.contentType);
|
|
1952
|
+
if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
|
|
1953
|
+
return this.callApi({ type: _chunkQ4FXESVTjs.Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
|
|
1954
|
+
}
|
|
1955
|
+
static async getSignedUrl(params) {
|
|
1956
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.S3, id: "sign" }).addAdditionalParam("key", params.key);
|
|
1957
|
+
if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
|
|
1958
|
+
return this.callApi({ type: _chunkQ4FXESVTjs.Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
|
|
1959
|
+
}
|
|
1960
|
+
static async deleteFile(params) {
|
|
1961
|
+
this.callApi({
|
|
1962
|
+
type: _chunkQ4FXESVTjs.Modules.S3,
|
|
1963
|
+
method: "DELETE" /* DELETE */,
|
|
1964
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.S3 }).addAdditionalParam("key", params.key).generate()
|
|
1965
|
+
});
|
|
1966
|
+
}
|
|
1967
|
+
};
|
|
1968
|
+
|
|
1969
|
+
// src/features/user/data/user.ts
|
|
1970
|
+
var User = (_class3 = class extends _chunkQ4FXESVTjs.AbstractApiData {constructor(...args3) { super(...args3); _class3.prototype.__init3.call(this);_class3.prototype.__init4.call(this); }
|
|
1971
|
+
static {
|
|
1972
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "User");
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
__init3() {this._roles = []}
|
|
1987
|
+
|
|
1988
|
+
__init4() {this._modules = []}
|
|
1989
|
+
get searchResult() {
|
|
1990
|
+
return _nullishCoalesce(this._name, () => ( ""));
|
|
1991
|
+
}
|
|
1992
|
+
get name() {
|
|
1993
|
+
return _nullishCoalesce(this._name, () => ( ""));
|
|
1994
|
+
}
|
|
1995
|
+
get email() {
|
|
1996
|
+
return _nullishCoalesce(this._email, () => ( ""));
|
|
1997
|
+
}
|
|
1998
|
+
get title() {
|
|
1999
|
+
return _nullishCoalesce(this._title, () => ( ""));
|
|
2000
|
+
}
|
|
2001
|
+
get bio() {
|
|
2002
|
+
return _nullishCoalesce(this._bio, () => ( ""));
|
|
2003
|
+
}
|
|
2004
|
+
get avatar() {
|
|
2005
|
+
return this._avatar;
|
|
2006
|
+
}
|
|
2007
|
+
get avatarUrl() {
|
|
2008
|
+
return this._avatarUrl;
|
|
2009
|
+
}
|
|
2010
|
+
get phone() {
|
|
2011
|
+
return this._phone;
|
|
2012
|
+
}
|
|
2013
|
+
get rate() {
|
|
2014
|
+
return this._rate;
|
|
2015
|
+
}
|
|
2016
|
+
get relevance() {
|
|
2017
|
+
return this._relevance;
|
|
2018
|
+
}
|
|
2019
|
+
get isActivated() {
|
|
2020
|
+
return _nullishCoalesce(this._isActivated, () => ( false));
|
|
2021
|
+
}
|
|
2022
|
+
get isDeleted() {
|
|
2023
|
+
return _nullishCoalesce(this._isDeleted, () => ( false));
|
|
2024
|
+
}
|
|
2025
|
+
get lastLogin() {
|
|
2026
|
+
return this._lastLogin;
|
|
2027
|
+
}
|
|
2028
|
+
get roles() {
|
|
2029
|
+
return this._roles;
|
|
2030
|
+
}
|
|
2031
|
+
get company() {
|
|
2032
|
+
return this._company;
|
|
2033
|
+
}
|
|
2034
|
+
get modules() {
|
|
2035
|
+
return this._modules;
|
|
2036
|
+
}
|
|
2037
|
+
rehydrate(data) {
|
|
2038
|
+
super.rehydrate(data);
|
|
2039
|
+
this._name = data.jsonApi.attributes.name;
|
|
2040
|
+
this._email = data.jsonApi.attributes.email;
|
|
2041
|
+
this._title = data.jsonApi.attributes.title;
|
|
2042
|
+
this._bio = data.jsonApi.attributes.bio;
|
|
2043
|
+
this._phone = data.jsonApi.attributes.phone;
|
|
2044
|
+
this._rate = data.jsonApi.attributes.rate;
|
|
2045
|
+
this._avatar = data.jsonApi.attributes.avatar;
|
|
2046
|
+
this._avatarUrl = data.jsonApi.attributes.avatarUrl;
|
|
2047
|
+
this._isActivated = data.jsonApi.meta.isActive;
|
|
2048
|
+
this._isDeleted = data.jsonApi.meta.isDeleted;
|
|
2049
|
+
this._lastLogin = data.jsonApi.meta.lastLogin ? new Date(data.jsonApi.meta.lastLogin) : void 0;
|
|
2050
|
+
this._relevance = data.jsonApi.meta.relevance;
|
|
2051
|
+
this._roles = this._readIncluded(data, "roles", _chunkQ4FXESVTjs.Modules.Role);
|
|
2052
|
+
this._company = this._readIncluded(data, "company", _chunkQ4FXESVTjs.Modules.Company);
|
|
2053
|
+
this._modules = this._readIncluded(data, "modules", _chunkQ4FXESVTjs.Modules.Module);
|
|
2054
|
+
return this;
|
|
2055
|
+
}
|
|
2056
|
+
createJsonApi(data) {
|
|
2057
|
+
const response = {
|
|
2058
|
+
data: {
|
|
2059
|
+
type: _chunkQ4FXESVTjs.Modules.User.name,
|
|
2060
|
+
id: data.id,
|
|
2061
|
+
attributes: {
|
|
2062
|
+
name: data.name
|
|
2063
|
+
},
|
|
2064
|
+
meta: {},
|
|
2065
|
+
relationships: {}
|
|
2066
|
+
},
|
|
2067
|
+
included: []
|
|
2068
|
+
};
|
|
2069
|
+
if (data.email !== void 0) response.data.attributes.email = data.email;
|
|
2070
|
+
if (data.title !== void 0) response.data.attributes.title = data.title;
|
|
2071
|
+
if (data.bio !== void 0) response.data.attributes.bio = data.bio;
|
|
2072
|
+
if (data.phone !== void 0) response.data.attributes.phone = data.phone;
|
|
2073
|
+
if (data.password !== void 0) response.data.attributes.password = data.password;
|
|
2074
|
+
if (data.sendInvitationEmail) response.data.attributes.sendInvitationEmail = true;
|
|
2075
|
+
if (data.adminCreated) response.data.attributes.adminCreated = true;
|
|
2076
|
+
if (data.avatar) response.data.attributes.avatar = data.avatar;
|
|
2077
|
+
if (data.rate !== void 0) response.data.attributes.rate = data.rate;
|
|
2078
|
+
if (data.roleIds) {
|
|
2079
|
+
response.data.relationships.roles = {
|
|
2080
|
+
data: data.roleIds.map((roleId) => ({
|
|
2081
|
+
type: _chunkQ4FXESVTjs.Modules.Role.name,
|
|
2082
|
+
id: roleId
|
|
2083
|
+
}))
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
if (data.companyId) {
|
|
2087
|
+
response.data.relationships.company = {
|
|
2088
|
+
data: {
|
|
2089
|
+
type: _chunkQ4FXESVTjs.Modules.Company.name,
|
|
2090
|
+
id: data.companyId
|
|
2091
|
+
}
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
return response;
|
|
2095
|
+
}
|
|
2096
|
+
}, _class3);
|
|
2097
|
+
|
|
2098
|
+
// src/features/user/data/user.fields.ts
|
|
2099
|
+
var UserFields = /* @__PURE__ */ ((UserFields2) => {
|
|
2100
|
+
UserFields2["userId"] = "userId";
|
|
2101
|
+
UserFields2["name"] = "name";
|
|
2102
|
+
UserFields2["email"] = "email";
|
|
2103
|
+
UserFields2["relevance"] = "relevance";
|
|
2104
|
+
UserFields2["createdAt"] = "createdAt";
|
|
2105
|
+
UserFields2["updatedAt"] = "updatedAt";
|
|
2106
|
+
return UserFields2;
|
|
2107
|
+
})(UserFields || {});
|
|
2108
|
+
|
|
2109
|
+
// src/features/user/data/user.service.ts
|
|
2110
|
+
var UserService = class extends _chunkQ4FXESVTjs.AbstractService {
|
|
2111
|
+
static {
|
|
2112
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "UserService");
|
|
2113
|
+
}
|
|
2114
|
+
static async findFullUser() {
|
|
2115
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: "me", childEndpoint: "full" });
|
|
2116
|
+
return this.callApi({
|
|
2117
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2118
|
+
method: "GET" /* GET */,
|
|
2119
|
+
endpoint: endpoint.generate()
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2122
|
+
static async findById(params) {
|
|
2123
|
+
return this.callApi({
|
|
2124
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2125
|
+
method: "GET" /* GET */,
|
|
2126
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.userId }).generate()
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
static async findByEmail(params) {
|
|
2130
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: "email", childEndpoint: params.email });
|
|
2131
|
+
return this.callApi({ type: _chunkQ4FXESVTjs.Modules.User, method: "GET" /* GET */, endpoint: endpoint.generate() });
|
|
2132
|
+
}
|
|
2133
|
+
static async findMany(params) {
|
|
2134
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User });
|
|
2135
|
+
if (params.roleId) endpoint.addAdditionalParam("roleId", params.roleId);
|
|
2136
|
+
if (params.includeDeleted) endpoint.addAdditionalParam("includeDeleted", "true");
|
|
2137
|
+
if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
|
|
2138
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2139
|
+
return this.callApi({
|
|
2140
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2141
|
+
method: "GET" /* GET */,
|
|
2142
|
+
endpoint: endpoint.generate(),
|
|
2143
|
+
next: params.next
|
|
2144
|
+
});
|
|
2145
|
+
}
|
|
2146
|
+
static async findManyByContentIds(params) {
|
|
2147
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User });
|
|
2148
|
+
endpoint.addAdditionalParam("contentIds", params.contentIds.map((id) => id).join(","));
|
|
2149
|
+
endpoint.addAdditionalParam("includeDeleted", "true");
|
|
2150
|
+
endpoint.addAdditionalParam("fetchAll", "true");
|
|
2151
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2152
|
+
return this.callApi({
|
|
2153
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2154
|
+
method: "GET" /* GET */,
|
|
2155
|
+
endpoint: endpoint.generate(),
|
|
2156
|
+
next: params.next
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
static async findRelevant(params) {
|
|
2160
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
2161
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Content,
|
|
2162
|
+
id: params.id,
|
|
2163
|
+
childEndpoint: "user-relevance"
|
|
2164
|
+
});
|
|
2165
|
+
if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _78 => _78.User, 'access', _79 => _79.inclusions, 'optionalAccess', _80 => _80.lists, 'optionalAccess', _81 => _81.fields])) endpoint.limitToFields(_chunkQ4FXESVTjs.Modules.User.inclusions.lists.fields);
|
|
2166
|
+
if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _82 => _82.User, 'access', _83 => _83.inclusions, 'optionalAccess', _84 => _84.lists, 'optionalAccess', _85 => _85.types])) endpoint.limitToType(_chunkQ4FXESVTjs.Modules.User.inclusions.lists.types);
|
|
2167
|
+
return this.callApi({
|
|
2168
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2169
|
+
method: "GET" /* GET */,
|
|
2170
|
+
endpoint: endpoint.generate(),
|
|
2171
|
+
next: params.next
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
static async findManyForAmin(params) {
|
|
2175
|
+
if (!params.companyId) return [];
|
|
2176
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
2177
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Company,
|
|
2178
|
+
id: params.companyId,
|
|
2179
|
+
childEndpoint: _chunkQ4FXESVTjs.Modules.User
|
|
2180
|
+
});
|
|
2181
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2182
|
+
return this.callApi({
|
|
2183
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2184
|
+
method: "GET" /* GET */,
|
|
2185
|
+
endpoint: endpoint.generate(),
|
|
2186
|
+
next: params.next,
|
|
2187
|
+
previous: params.prev
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
static async findAllUsers(params) {
|
|
2191
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
2192
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Company,
|
|
2193
|
+
id: params.companyId,
|
|
2194
|
+
childEndpoint: _chunkQ4FXESVTjs.Modules.User
|
|
2195
|
+
});
|
|
2196
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2197
|
+
if (params.isDeleted) endpoint.addAdditionalParam("isDeleted", "true");
|
|
2198
|
+
if (params.limitToRoles && params.limitToRoles.length > 0)
|
|
2199
|
+
endpoint.addAdditionalParam("limitToRoles", params.limitToRoles.join(","));
|
|
2200
|
+
return this.callApi({
|
|
2201
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2202
|
+
method: "GET" /* GET */,
|
|
2203
|
+
endpoint: endpoint.generate(),
|
|
2204
|
+
next: params.next
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
static async findAllUsersByRole(params) {
|
|
2208
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role, id: params.roleId, childEndpoint: _chunkQ4FXESVTjs.Modules.User });
|
|
2209
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2210
|
+
return this.callApi({
|
|
2211
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2212
|
+
method: "GET" /* GET */,
|
|
2213
|
+
endpoint: endpoint.generate(),
|
|
2214
|
+
next: params.next
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
static async findAllUsersNotInRole(params) {
|
|
2218
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
2219
|
+
endpoint: _chunkQ4FXESVTjs.Modules.Role,
|
|
2220
|
+
id: params.roleId,
|
|
2221
|
+
childEndpoint: _chunkQ4FXESVTjs.Modules.User
|
|
2222
|
+
}).addAdditionalParam("notInRole", "true");
|
|
2223
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2224
|
+
return this.callApi({
|
|
2225
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2226
|
+
method: "GET" /* GET */,
|
|
2227
|
+
endpoint: endpoint.generate(),
|
|
2228
|
+
next: params.next
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
static async create(params) {
|
|
2232
|
+
return this.callApi({
|
|
2233
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2234
|
+
method: "POST" /* POST */,
|
|
2235
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User }).generate(),
|
|
2236
|
+
companyId: params.companyId,
|
|
2237
|
+
input: params
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
static async reactivate(params) {
|
|
2241
|
+
return this.callApi({
|
|
2242
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2243
|
+
method: "PATCH" /* PATCH */,
|
|
2244
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.userId }).generate()
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
static async sendInvitation(params) {
|
|
2248
|
+
const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
|
|
2249
|
+
endpoint: _chunkQ4FXESVTjs.Modules.User,
|
|
2250
|
+
id: params.userId,
|
|
2251
|
+
childEndpoint: "send-invitation-email"
|
|
2252
|
+
});
|
|
2253
|
+
if (params.companyId) endpoint.addAdditionalParam("companyId", params.companyId);
|
|
2254
|
+
this.callApi({
|
|
2255
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2256
|
+
method: "POST" /* POST */,
|
|
2257
|
+
endpoint: endpoint.generate()
|
|
2258
|
+
});
|
|
1258
2259
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
2260
|
+
static async update(params) {
|
|
2261
|
+
return this.callApi({
|
|
2262
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2263
|
+
method: "PUT" /* PUT */,
|
|
2264
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.id }).generate(),
|
|
2265
|
+
companyId: params.companyId,
|
|
2266
|
+
input: params
|
|
2267
|
+
});
|
|
1267
2268
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
hasPermissionToModule,
|
|
1277
|
-
hasPermissionToModules,
|
|
1278
|
-
hasPermissionToPath,
|
|
1279
|
-
hasAccesToFeature,
|
|
1280
|
-
matchUrlToModule,
|
|
1281
|
-
hasRole
|
|
1282
|
-
},
|
|
1283
|
-
children
|
|
1284
|
-
}
|
|
1285
|
-
);
|
|
1286
|
-
}, "CurrentUserProvider");
|
|
1287
|
-
function useCurrentUserContext() {
|
|
1288
|
-
const context = _react.useContext.call(void 0, CurrentUserContext);
|
|
1289
|
-
if (context === void 0) {
|
|
1290
|
-
throw new Error("useCurrentUserContext must be used within a UserProvider");
|
|
2269
|
+
static async patchRate(params) {
|
|
2270
|
+
return this.callApi({
|
|
2271
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2272
|
+
method: "PATCH" /* PATCH */,
|
|
2273
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.id, childEndpoint: "rates" }).generate(),
|
|
2274
|
+
companyId: params.companyId,
|
|
2275
|
+
input: params
|
|
2276
|
+
});
|
|
1291
2277
|
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
2278
|
+
static async delete(params) {
|
|
2279
|
+
await this.callApi({
|
|
2280
|
+
type: _chunkQ4FXESVTjs.Modules.User,
|
|
2281
|
+
method: "DELETE" /* DELETE */,
|
|
2282
|
+
endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.userId }).generate(),
|
|
2283
|
+
companyId: params.companyId
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
1298
2287
|
|
|
2288
|
+
// src/features/user/author.module.ts
|
|
2289
|
+
var AuthorModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
2290
|
+
pageUrl: "/authors",
|
|
2291
|
+
name: "authors",
|
|
2292
|
+
model: User,
|
|
2293
|
+
moduleId: "04cfc677-0fd2-4f5e-adf4-2483a00c0277"
|
|
2294
|
+
}), "AuthorModule");
|
|
1299
2295
|
|
|
1300
2296
|
// src/features/user/components/forms/RoleUserAdd.tsx
|
|
1301
2297
|
|
|
@@ -1623,6 +2619,170 @@ _chunk7QVYU63Ejs.__name.call(void 0, AttributeElement, "AttributeElement");
|
|
|
1623
2619
|
// src/features/user/components/containers/UserContainer.tsx
|
|
1624
2620
|
|
|
1625
2621
|
|
|
2622
|
+
// src/features/user/contexts/CurrentUserContext.tsx
|
|
2623
|
+
var _cookiesnext = require('cookies-next');
|
|
2624
|
+
|
|
2625
|
+
var _utils = require('jotai/utils');
|
|
2626
|
+
|
|
2627
|
+
|
|
2628
|
+
|
|
2629
|
+
var userAtom = _utils.atomWithStorage.call(void 0, "user", null);
|
|
2630
|
+
var CurrentUserContext = _react.createContext.call(void 0, void 0);
|
|
2631
|
+
var CurrentUserProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => {
|
|
2632
|
+
const path = _navigation.usePathname.call(void 0, );
|
|
2633
|
+
const [dehydratedUser, setDehydratedUser] = _jotai.useAtom.call(void 0, userAtom);
|
|
2634
|
+
_react.useEffect.call(void 0, () => {
|
|
2635
|
+
const token = _cookiesnext.getCookie.call(void 0, "token");
|
|
2636
|
+
if (!token && dehydratedUser) setDehydratedUser(null);
|
|
2637
|
+
}, [dehydratedUser, setDehydratedUser]);
|
|
2638
|
+
const matchUrlToModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
|
|
2639
|
+
const moduleKeys = Object.getOwnPropertyNames(_chunkQ4FXESVTjs.Modules).filter(
|
|
2640
|
+
(key) => key !== "prototype" && key !== "_factory" && key !== "length" && key !== "name"
|
|
2641
|
+
);
|
|
2642
|
+
const matchedModuleKey = moduleKeys.find((key) => {
|
|
2643
|
+
const descriptor2 = Object.getOwnPropertyDescriptor(_chunkQ4FXESVTjs.Modules, key);
|
|
2644
|
+
if (!_optionalChain([descriptor2, 'optionalAccess', _86 => _86.get])) return false;
|
|
2645
|
+
const selectedModule = descriptor2.get.call(_chunkQ4FXESVTjs.Modules);
|
|
2646
|
+
return path.toLowerCase().startsWith(_optionalChain([selectedModule, 'access', _87 => _87.pageUrl, 'optionalAccess', _88 => _88.toLowerCase, 'call', _89 => _89()]));
|
|
2647
|
+
});
|
|
2648
|
+
if (!matchedModuleKey) return void 0;
|
|
2649
|
+
const descriptor = Object.getOwnPropertyDescriptor(_chunkQ4FXESVTjs.Modules, matchedModuleKey);
|
|
2650
|
+
return _optionalChain([descriptor, 'optionalAccess', _90 => _90.get, 'optionalAccess', _91 => _91.call, 'call', _92 => _92(_chunkQ4FXESVTjs.Modules)]);
|
|
2651
|
+
}, "matchUrlToModule");
|
|
2652
|
+
const currentUser = dehydratedUser ? _chunkQ4FXESVTjs.rehydrate.call(void 0, _chunkQ4FXESVTjs.Modules.User, dehydratedUser) : null;
|
|
2653
|
+
const company = _nullishCoalesce(_optionalChain([currentUser, 'optionalAccess', _93 => _93.company]), () => ( null));
|
|
2654
|
+
const setUser = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (user) => {
|
|
2655
|
+
if (user) setDehydratedUser(user.dehydrate());
|
|
2656
|
+
else setDehydratedUser(null);
|
|
2657
|
+
}, "setUser");
|
|
2658
|
+
const hasRole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (roleId) => {
|
|
2659
|
+
if (!currentUser) return false;
|
|
2660
|
+
return !!_optionalChain([currentUser, 'access', _94 => _94.roles, 'optionalAccess', _95 => _95.some, 'call', _96 => _96((userRole) => userRole.id === roleId)]);
|
|
2661
|
+
}, "hasRole");
|
|
2662
|
+
const hasAccesToFeature = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (featureIdentifier) => {
|
|
2663
|
+
if (hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)) return true;
|
|
2664
|
+
if (!company) return false;
|
|
2665
|
+
return company.features.some((feature) => feature.id === featureIdentifier);
|
|
2666
|
+
}, "hasAccesToFeature");
|
|
2667
|
+
function hasPermissionToModule(params) {
|
|
2668
|
+
if (!currentUser) return false;
|
|
2669
|
+
if (!!params.module.feature && !hasAccesToFeature(params.module.feature)) return false;
|
|
2670
|
+
return _chunk32HM6MDDjs.checkPermissions.call(void 0, { module: params.module, action: params.action, data: params.data, user: currentUser });
|
|
2671
|
+
}
|
|
2672
|
+
_chunk7QVYU63Ejs.__name.call(void 0, hasPermissionToModule, "hasPermissionToModule");
|
|
2673
|
+
function hasPermissionToModules(params) {
|
|
2674
|
+
if (!currentUser) return false;
|
|
2675
|
+
if (!params.modules.every((module) => !module.feature || hasAccesToFeature(module.feature))) return false;
|
|
2676
|
+
return params.modules.every(
|
|
2677
|
+
(module) => _chunk32HM6MDDjs.checkPermissions.call(void 0, { module, action: params.action, data: params.data, user: currentUser })
|
|
2678
|
+
);
|
|
2679
|
+
}
|
|
2680
|
+
_chunk7QVYU63Ejs.__name.call(void 0, hasPermissionToModules, "hasPermissionToModules");
|
|
2681
|
+
function hasPermissionToPath(path2) {
|
|
2682
|
+
if (!currentUser) return false;
|
|
2683
|
+
if (path2 === "#" || path2 === "/") return true;
|
|
2684
|
+
const selectedModule = matchUrlToModule({ path: path2 });
|
|
2685
|
+
if (!selectedModule) return true;
|
|
2686
|
+
const response = hasPermissionToModule({ module: selectedModule, action: "read" /* Read */ });
|
|
2687
|
+
return response;
|
|
2688
|
+
}
|
|
2689
|
+
_chunk7QVYU63Ejs.__name.call(void 0, hasPermissionToPath, "hasPermissionToPath");
|
|
2690
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2691
|
+
CurrentUserContext.Provider,
|
|
2692
|
+
{
|
|
2693
|
+
value: {
|
|
2694
|
+
currentUser,
|
|
2695
|
+
company,
|
|
2696
|
+
setUser,
|
|
2697
|
+
hasPermissionToModule,
|
|
2698
|
+
hasPermissionToModules,
|
|
2699
|
+
hasPermissionToPath,
|
|
2700
|
+
hasAccesToFeature,
|
|
2701
|
+
matchUrlToModule,
|
|
2702
|
+
hasRole
|
|
2703
|
+
},
|
|
2704
|
+
children
|
|
2705
|
+
}
|
|
2706
|
+
);
|
|
2707
|
+
}, "CurrentUserProvider");
|
|
2708
|
+
function useCurrentUserContext() {
|
|
2709
|
+
const context = _react.useContext.call(void 0, CurrentUserContext);
|
|
2710
|
+
if (context === void 0) {
|
|
2711
|
+
throw new Error("useCurrentUserContext must be used within a UserProvider");
|
|
2712
|
+
}
|
|
2713
|
+
return context;
|
|
2714
|
+
}
|
|
2715
|
+
_chunk7QVYU63Ejs.__name.call(void 0, useCurrentUserContext, "useCurrentUserContext");
|
|
2716
|
+
|
|
2717
|
+
// src/features/user/contexts/UserContext.tsx
|
|
2718
|
+
|
|
2719
|
+
|
|
2720
|
+
|
|
2721
|
+
var UserContext = _react.createContext.call(void 0, void 0);
|
|
2722
|
+
var UserProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedUser }) => {
|
|
2723
|
+
const generateUrl = usePageUrlGenerator();
|
|
2724
|
+
const { hasPermissionToModule } = useCurrentUserContext();
|
|
2725
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2726
|
+
const [user, setUser] = _react.useState.call(void 0,
|
|
2727
|
+
dehydratedUser ? _chunkQ4FXESVTjs.rehydrate.call(void 0, _chunkQ4FXESVTjs.Modules.User, dehydratedUser) : void 0
|
|
2728
|
+
);
|
|
2729
|
+
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2730
|
+
const response = [];
|
|
2731
|
+
if (hasPermissionToModule({ module: _chunkQ4FXESVTjs.Modules.User, action: "update" /* Update */ })) {
|
|
2732
|
+
response.push({
|
|
2733
|
+
name: t(`generic.settings`),
|
|
2734
|
+
href: generateUrl({ page: `/settings` })
|
|
2735
|
+
});
|
|
2736
|
+
response.push({
|
|
2737
|
+
name: t(`types.users`, { count: 2 }),
|
|
2738
|
+
href: generateUrl({ page: `/settings`, id: _chunkQ4FXESVTjs.Modules.User.pageUrl })
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
if (user)
|
|
2742
|
+
response.push({
|
|
2743
|
+
name: `${user.name}${user.isDeleted ? ` (${t(`foundations.user.deleted`)})` : ""}`,
|
|
2744
|
+
href: generateUrl({ page: _chunkQ4FXESVTjs.Modules.User, id: user.id })
|
|
2745
|
+
});
|
|
2746
|
+
return response;
|
|
2747
|
+
}, "breadcrumb");
|
|
2748
|
+
const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2749
|
+
const response = {
|
|
2750
|
+
type: t(`types.users`, { count: user ? 1 : 2 })
|
|
2751
|
+
};
|
|
2752
|
+
const functions = [];
|
|
2753
|
+
if (user) {
|
|
2754
|
+
response.element = `${user.name}${user.isDeleted ? ` (${t(`foundations.user.deleted`)})` : ""}`;
|
|
2755
|
+
if (user.isDeleted) {
|
|
2756
|
+
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserReactivator, { user, propagateChanges: setUser }, `UserReactivator`));
|
|
2757
|
+
} else {
|
|
2758
|
+
if (!user.isActivated)
|
|
2759
|
+
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserResentInvitationEmail, { user }, `UserResentInvitationEmail`));
|
|
2760
|
+
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserDeleter, { user }, `UserDeleter`));
|
|
2761
|
+
}
|
|
2762
|
+
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserEditor, { user, propagateChanges: setUser }, `UserEditor`));
|
|
2763
|
+
}
|
|
2764
|
+
if (functions.length > 0) response.functions = functions;
|
|
2765
|
+
return response;
|
|
2766
|
+
}, "title");
|
|
2767
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2768
|
+
UserContext.Provider,
|
|
2769
|
+
{
|
|
2770
|
+
value: {
|
|
2771
|
+
user,
|
|
2772
|
+
setUser
|
|
2773
|
+
},
|
|
2774
|
+
children
|
|
2775
|
+
}
|
|
2776
|
+
) });
|
|
2777
|
+
}, "UserProvider");
|
|
2778
|
+
var useUserContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2779
|
+
const context = _react.useContext.call(void 0, UserContext);
|
|
2780
|
+
if (context === void 0) {
|
|
2781
|
+
throw new Error("useUserContext must be used within a UserProvider");
|
|
2782
|
+
}
|
|
2783
|
+
return context;
|
|
2784
|
+
}, "useUserContext");
|
|
2785
|
+
|
|
1626
2786
|
// src/features/user/components/details/UserDetails.tsx
|
|
1627
2787
|
|
|
1628
2788
|
var _image = require('next/image'); var _image2 = _interopRequireDefault(_image);
|
|
@@ -1671,7 +2831,7 @@ function UserAvatar({ user, className, showFull, showLink }) {
|
|
|
1671
2831
|
}, "getInitials");
|
|
1672
2832
|
const getAvatar = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1673
2833
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "*:ring-border *:ring-1", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5IET37O4js.Avatar, { className: `h-6 w-6 ${className}`, children: [
|
|
1674
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.AvatarImage, { className: "object-cover", src: _optionalChain([user, 'optionalAccess',
|
|
2834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.AvatarImage, { className: "object-cover", src: _optionalChain([user, 'optionalAccess', _97 => _97.avatar]) }),
|
|
1675
2835
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.AvatarFallback, { children: getInitials(user.name) })
|
|
1676
2836
|
] }) });
|
|
1677
2837
|
}, "getAvatar");
|
|
@@ -1772,7 +2932,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsersListContainer, "UsersListContainer");
|
|
|
1772
2932
|
function AdminUsersListInternal({ company }) {
|
|
1773
2933
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1774
2934
|
const data = useDataListRetriever({
|
|
1775
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
2935
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => UserService.findManyForAmin(params), "retriever"),
|
|
1776
2936
|
retrieverParams: { companyId: company.id },
|
|
1777
2937
|
module: _chunkQ4FXESVTjs.Modules.User
|
|
1778
2938
|
});
|
|
@@ -1804,8 +2964,8 @@ function CompanyUsersList({ isDeleted }) {
|
|
|
1804
2964
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1805
2965
|
const data = useDataListRetriever({
|
|
1806
2966
|
ready: !!company,
|
|
1807
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
1808
|
-
retrieverParams: { companyId: _optionalChain([company, 'optionalAccess',
|
|
2967
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => UserService.findAllUsers(params), "retriever"),
|
|
2968
|
+
retrieverParams: { companyId: _optionalChain([company, 'optionalAccess', _98 => _98.id]), isDeleted },
|
|
1809
2969
|
module: _chunkQ4FXESVTjs.Modules.User
|
|
1810
2970
|
});
|
|
1811
2971
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1861,7 +3021,7 @@ function RelevantUsersList({ id }) {
|
|
|
1861
3021
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1862
3022
|
const data = useDataListRetriever({
|
|
1863
3023
|
module: _chunkQ4FXESVTjs.Modules.User,
|
|
1864
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
3024
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => UserService.findRelevant(params), "retriever"),
|
|
1865
3025
|
retrieverParams: { id }
|
|
1866
3026
|
});
|
|
1867
3027
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1882,7 +3042,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, RelevantUsersList, "RelevantUsersList");
|
|
|
1882
3042
|
function RoleUsersList({ role }) {
|
|
1883
3043
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1884
3044
|
const data = useDataListRetriever({
|
|
1885
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
3045
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => UserService.findAllUsersByRole(params), "retriever"),
|
|
1886
3046
|
retrieverParams: { roleId: role.id },
|
|
1887
3047
|
module: _chunkQ4FXESVTjs.Modules.User
|
|
1888
3048
|
});
|
|
@@ -1911,11 +3071,11 @@ function UserListInAdd({ data, existingUsers, setSelectedUser, setLevelOpen }) {
|
|
|
1911
3071
|
className: "cursor-pointer",
|
|
1912
3072
|
onClick: (e) => {
|
|
1913
3073
|
setSelectedUser(user);
|
|
1914
|
-
_optionalChain([setLevelOpen, 'optionalCall',
|
|
3074
|
+
_optionalChain([setLevelOpen, 'optionalCall', _99 => _99(true)]);
|
|
1915
3075
|
},
|
|
1916
3076
|
onSelect: (e) => {
|
|
1917
3077
|
setSelectedUser(user);
|
|
1918
|
-
_optionalChain([setLevelOpen, 'optionalCall',
|
|
3078
|
+
_optionalChain([setLevelOpen, 'optionalCall', _100 => _100(true)]);
|
|
1919
3079
|
},
|
|
1920
3080
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-row items-center justify-between px-4 py-1", children: [
|
|
1921
3081
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserAvatar, { user }),
|
|
@@ -1955,7 +3115,7 @@ function UsersListByContentIds({ contentIds }) {
|
|
|
1955
3115
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1956
3116
|
const data = useDataListRetriever({
|
|
1957
3117
|
module: _chunkQ4FXESVTjs.Modules.User,
|
|
1958
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
3118
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => UserService.findManyByContentIds(params), "retriever"),
|
|
1959
3119
|
retrieverParams: { contentIds }
|
|
1960
3120
|
});
|
|
1961
3121
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1985,7 +3145,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, AllowedUsersDetails, "AllowedUsersDetails")
|
|
|
1985
3145
|
var _dynamic = require('next/dynamic'); var _dynamic2 = _interopRequireDefault(_dynamic);
|
|
1986
3146
|
|
|
1987
3147
|
|
|
1988
|
-
var BlockNoteEditor = _dynamic2.default.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./BlockNoteEditor-
|
|
3148
|
+
var BlockNoteEditor = _dynamic2.default.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./BlockNoteEditor-G6AK2NWA.js"))), {
|
|
1989
3149
|
ssr: false
|
|
1990
3150
|
});
|
|
1991
3151
|
var BlockNoteEditorContainer = React4.default.memo(/* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, function EditorContainer(props) {
|
|
@@ -2024,7 +3184,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ErrorDetails, "ErrorDetails");
|
|
|
2024
3184
|
// src/components/errors/errorToast.ts
|
|
2025
3185
|
var _sonner = require('sonner');
|
|
2026
3186
|
function errorToast(params) {
|
|
2027
|
-
_sonner.toast.error(_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
3187
|
+
_sonner.toast.error(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _101 => _101.title]), () => ( "Error")), {
|
|
2028
3188
|
description: params.error instanceof Error ? params.error.message : String(params.error)
|
|
2029
3189
|
});
|
|
2030
3190
|
}
|
|
@@ -2425,7 +3585,7 @@ function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth
|
|
|
2425
3585
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
2426
3586
|
const [prevRange, setPrevRange] = _react.useState.call(void 0, date);
|
|
2427
3587
|
_react.useEffect.call(void 0, () => {
|
|
2428
|
-
if (_optionalChain([date, 'optionalAccess',
|
|
3588
|
+
if (_optionalChain([date, 'optionalAccess', _102 => _102.from]) && _optionalChain([date, 'optionalAccess', _103 => _103.to]) && date.to > date.from && (_optionalChain([prevRange, 'optionalAccess', _104 => _104.from, 'optionalAccess', _105 => _105.getTime, 'call', _106 => _106()]) !== date.from.getTime() || _optionalChain([prevRange, 'optionalAccess', _107 => _107.to, 'optionalAccess', _108 => _108.getTime, 'call', _109 => _109()]) !== date.to.getTime())) {
|
|
2429
3589
|
onDateChange(date);
|
|
2430
3590
|
setPrevRange(date);
|
|
2431
3591
|
setOpen(false);
|
|
@@ -2436,7 +3596,7 @@ function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth
|
|
|
2436
3596
|
setDate(void 0);
|
|
2437
3597
|
return;
|
|
2438
3598
|
}
|
|
2439
|
-
if (range.from && (!_optionalChain([date, 'optionalAccess',
|
|
3599
|
+
if (range.from && (!_optionalChain([date, 'optionalAccess', _110 => _110.from]) || range.from.getTime() !== date.from.getTime())) {
|
|
2440
3600
|
setDate({ from: range.from, to: void 0 });
|
|
2441
3601
|
} else {
|
|
2442
3602
|
setDate(range);
|
|
@@ -2451,7 +3611,7 @@ function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth
|
|
|
2451
3611
|
className: _chunkDEYKTLA3js.cn.call(void 0, "w-[300px] justify-start text-left font-normal", !date && "text-muted-foreground"),
|
|
2452
3612
|
children: [
|
|
2453
3613
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CalendarIcon, {}),
|
|
2454
|
-
_optionalChain([date, 'optionalAccess',
|
|
3614
|
+
_optionalChain([date, 'optionalAccess', _111 => _111.from]) ? date.to ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2455
3615
|
_datefns.format.call(void 0, date.from, "LLL dd, y"),
|
|
2456
3616
|
" - ",
|
|
2457
3617
|
_datefns.format.call(void 0, date.to, "LLL dd, y")
|
|
@@ -2464,7 +3624,7 @@ function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth
|
|
|
2464
3624
|
_chunk5IET37O4js.Calendar,
|
|
2465
3625
|
{
|
|
2466
3626
|
mode: "range",
|
|
2467
|
-
defaultMonth: _nullishCoalesce(_optionalChain([date, 'optionalAccess',
|
|
3627
|
+
defaultMonth: _nullishCoalesce(_optionalChain([date, 'optionalAccess', _112 => _112.from]), () => ( (showPreviousMonth ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1) : void 0))),
|
|
2468
3628
|
selected: date,
|
|
2469
3629
|
onSelect: handleSelect,
|
|
2470
3630
|
numberOfMonths: 2
|
|
@@ -2552,7 +3712,7 @@ var FileUploader = _react.forwardRef.call(void 0,
|
|
|
2552
3712
|
movePrev();
|
|
2553
3713
|
} else if (e.key === "Enter" || e.key === "Space") {
|
|
2554
3714
|
if (activeIndex === -1) {
|
|
2555
|
-
_optionalChain([dropzoneState, 'access',
|
|
3715
|
+
_optionalChain([dropzoneState, 'access', _113 => _113.inputRef, 'access', _114 => _114.current, 'optionalAccess', _115 => _115.click, 'call', _116 => _116()]);
|
|
2556
3716
|
}
|
|
2557
3717
|
} else if (e.key === "Delete" || e.key === "Backspace") {
|
|
2558
3718
|
if (activeIndex !== -1) {
|
|
@@ -2590,13 +3750,13 @@ var FileUploader = _react.forwardRef.call(void 0,
|
|
|
2590
3750
|
onValueChange(newValues);
|
|
2591
3751
|
if (rejectedFiles.length > 0) {
|
|
2592
3752
|
for (let i = 0; i < rejectedFiles.length; i++) {
|
|
2593
|
-
if (_optionalChain([rejectedFiles, 'access',
|
|
3753
|
+
if (_optionalChain([rejectedFiles, 'access', _117 => _117[i], 'access', _118 => _118.errors, 'access', _119 => _119[0], 'optionalAccess', _120 => _120.code]) === "file-too-large") {
|
|
2594
3754
|
_sonner.toast.error(t("generic.errors.file"), {
|
|
2595
3755
|
description: t(`generic.errors.file_max`, { size: maxSize / 1024 / 1024 })
|
|
2596
3756
|
});
|
|
2597
3757
|
break;
|
|
2598
3758
|
}
|
|
2599
|
-
if (_optionalChain([rejectedFiles, 'access',
|
|
3759
|
+
if (_optionalChain([rejectedFiles, 'access', _121 => _121[i], 'access', _122 => _122.errors, 'access', _123 => _123[0], 'optionalAccess', _124 => _124.message])) {
|
|
2600
3760
|
_sonner.toast.error(t(`generic.errors.file`), {
|
|
2601
3761
|
description: rejectedFiles[i].errors[0].message
|
|
2602
3762
|
});
|
|
@@ -3405,11 +4565,11 @@ function FormPlaceAutocomplete({
|
|
|
3405
4565
|
const data = await response.json();
|
|
3406
4566
|
if (data.suggestions) {
|
|
3407
4567
|
const formattedSuggestions = data.suggestions.map((suggestion) => ({
|
|
3408
|
-
place_id: _optionalChain([suggestion, 'access',
|
|
3409
|
-
description: _optionalChain([suggestion, 'access',
|
|
4568
|
+
place_id: _optionalChain([suggestion, 'access', _125 => _125.placePrediction, 'optionalAccess', _126 => _126.placeId]) || "",
|
|
4569
|
+
description: _optionalChain([suggestion, 'access', _127 => _127.placePrediction, 'optionalAccess', _128 => _128.text, 'optionalAccess', _129 => _129.text]) || "",
|
|
3410
4570
|
structured_formatting: {
|
|
3411
|
-
main_text: _optionalChain([suggestion, 'access',
|
|
3412
|
-
secondary_text: _optionalChain([suggestion, 'access',
|
|
4571
|
+
main_text: _optionalChain([suggestion, 'access', _130 => _130.placePrediction, 'optionalAccess', _131 => _131.structuredFormat, 'optionalAccess', _132 => _132.mainText, 'optionalAccess', _133 => _133.text]) || "",
|
|
4572
|
+
secondary_text: _optionalChain([suggestion, 'access', _134 => _134.placePrediction, 'optionalAccess', _135 => _135.structuredFormat, 'optionalAccess', _136 => _136.secondaryText, 'optionalAccess', _137 => _137.text]) || ""
|
|
3413
4573
|
}
|
|
3414
4574
|
}));
|
|
3415
4575
|
setSuggestions(formattedSuggestions);
|
|
@@ -3528,8 +4688,8 @@ function FormPlaceAutocomplete({
|
|
|
3528
4688
|
className: "hover:bg-muted cursor-pointer px-3 py-2 text-sm",
|
|
3529
4689
|
onClick: () => handleSuggestionSelect(suggestion),
|
|
3530
4690
|
children: [
|
|
3531
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "font-medium", children: _optionalChain([suggestion, 'access',
|
|
3532
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground", children: _optionalChain([suggestion, 'access',
|
|
4691
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "font-medium", children: _optionalChain([suggestion, 'access', _138 => _138.structured_formatting, 'optionalAccess', _139 => _139.main_text]) }),
|
|
4692
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground", children: _optionalChain([suggestion, 'access', _140 => _140.structured_formatting, 'optionalAccess', _141 => _141.secondary_text]) })
|
|
3533
4693
|
]
|
|
3534
4694
|
},
|
|
3535
4695
|
suggestion.place_id || index
|
|
@@ -3897,10 +5057,10 @@ var cellId = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
|
|
|
3897
5057
|
cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => params.toggleId ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3898
5058
|
_chunk5IET37O4js.Checkbox,
|
|
3899
5059
|
{
|
|
3900
|
-
checked: _optionalChain([params, 'access',
|
|
5060
|
+
checked: _optionalChain([params, 'access', _142 => _142.checkedIds, 'optionalAccess', _143 => _143.includes, 'call', _144 => _144(row.getValue(params.name))]) || false,
|
|
3901
5061
|
onCheckedChange: (value) => {
|
|
3902
5062
|
row.toggleSelected(!!value);
|
|
3903
|
-
_optionalChain([params, 'access',
|
|
5063
|
+
_optionalChain([params, 'access', _145 => _145.toggleId, 'optionalCall', _146 => _146(row.getValue(params.name))]);
|
|
3904
5064
|
},
|
|
3905
5065
|
"aria-label": "Select row"
|
|
3906
5066
|
}
|
|
@@ -3975,13 +5135,13 @@ function useJsonApiGet(params) {
|
|
|
3975
5135
|
const [response, setResponse] = _react.useState.call(void 0, null);
|
|
3976
5136
|
const isMounted = _react.useRef.call(void 0, true);
|
|
3977
5137
|
const fetchData = _react.useCallback.call(void 0, async () => {
|
|
3978
|
-
if (_optionalChain([params, 'access',
|
|
5138
|
+
if (_optionalChain([params, 'access', _147 => _147.options, 'optionalAccess', _148 => _148.enabled]) === false) return;
|
|
3979
5139
|
setLoading(true);
|
|
3980
5140
|
setError(null);
|
|
3981
5141
|
try {
|
|
3982
|
-
const { JsonApiGet } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-UJ7FGIVI.js")));
|
|
5142
|
+
const { JsonApiGet: JsonApiGet2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-UJ7FGIVI.js")));
|
|
3983
5143
|
const language = navigator.language.split("-")[0] || "en";
|
|
3984
|
-
const apiResponse = await
|
|
5144
|
+
const apiResponse = await JsonApiGet2({
|
|
3985
5145
|
classKey: params.classKey,
|
|
3986
5146
|
endpoint: params.endpoint,
|
|
3987
5147
|
companyId: params.companyId,
|
|
@@ -4002,9 +5162,9 @@ function useJsonApiGet(params) {
|
|
|
4002
5162
|
setLoading(false);
|
|
4003
5163
|
}
|
|
4004
5164
|
}
|
|
4005
|
-
}, [params.classKey, params.endpoint, params.companyId, _optionalChain([params, 'access',
|
|
5165
|
+
}, [params.classKey, params.endpoint, params.companyId, _optionalChain([params, 'access', _149 => _149.options, 'optionalAccess', _150 => _150.enabled])]);
|
|
4006
5166
|
const fetchNextPage = _react.useCallback.call(void 0, async () => {
|
|
4007
|
-
if (!_optionalChain([response, 'optionalAccess',
|
|
5167
|
+
if (!_optionalChain([response, 'optionalAccess', _151 => _151.nextPage])) return;
|
|
4008
5168
|
setLoading(true);
|
|
4009
5169
|
try {
|
|
4010
5170
|
const nextResponse = await response.nextPage();
|
|
@@ -4025,7 +5185,7 @@ function useJsonApiGet(params) {
|
|
|
4025
5185
|
}
|
|
4026
5186
|
}, [response]);
|
|
4027
5187
|
const fetchPreviousPage = _react.useCallback.call(void 0, async () => {
|
|
4028
|
-
if (!_optionalChain([response, 'optionalAccess',
|
|
5188
|
+
if (!_optionalChain([response, 'optionalAccess', _152 => _152.prevPage])) return;
|
|
4029
5189
|
setLoading(true);
|
|
4030
5190
|
try {
|
|
4031
5191
|
const prevResponse = await response.prevPage();
|
|
@@ -4051,15 +5211,15 @@ function useJsonApiGet(params) {
|
|
|
4051
5211
|
return () => {
|
|
4052
5212
|
isMounted.current = false;
|
|
4053
5213
|
};
|
|
4054
|
-
}, [fetchData, ..._optionalChain([params, 'access',
|
|
5214
|
+
}, [fetchData, ..._optionalChain([params, 'access', _153 => _153.options, 'optionalAccess', _154 => _154.deps]) || []]);
|
|
4055
5215
|
return {
|
|
4056
5216
|
data,
|
|
4057
5217
|
loading,
|
|
4058
5218
|
error,
|
|
4059
5219
|
response,
|
|
4060
5220
|
refetch: fetchData,
|
|
4061
|
-
hasNextPage: !!_optionalChain([response, 'optionalAccess',
|
|
4062
|
-
hasPreviousPage: !!_optionalChain([response, 'optionalAccess',
|
|
5221
|
+
hasNextPage: !!_optionalChain([response, 'optionalAccess', _155 => _155.next]),
|
|
5222
|
+
hasPreviousPage: !!_optionalChain([response, 'optionalAccess', _156 => _156.prev]),
|
|
4063
5223
|
fetchNextPage,
|
|
4064
5224
|
fetchPreviousPage
|
|
4065
5225
|
};
|
|
@@ -4084,12 +5244,12 @@ function useJsonApiMutation(config) {
|
|
|
4084
5244
|
setLoading(true);
|
|
4085
5245
|
setError(null);
|
|
4086
5246
|
try {
|
|
4087
|
-
const { JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-UJ7FGIVI.js")));
|
|
5247
|
+
const { JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-UJ7FGIVI.js")));
|
|
4088
5248
|
const language = navigator.language.split("-")[0] || "en";
|
|
4089
5249
|
let apiResponse;
|
|
4090
5250
|
switch (config.method) {
|
|
4091
5251
|
case "POST":
|
|
4092
|
-
apiResponse = await
|
|
5252
|
+
apiResponse = await JsonApiPost2({
|
|
4093
5253
|
classKey: config.classKey,
|
|
4094
5254
|
endpoint: params.endpoint,
|
|
4095
5255
|
companyId: params.companyId,
|
|
@@ -4124,7 +5284,7 @@ function useJsonApiMutation(config) {
|
|
|
4124
5284
|
});
|
|
4125
5285
|
break;
|
|
4126
5286
|
case "DELETE":
|
|
4127
|
-
apiResponse = await
|
|
5287
|
+
apiResponse = await JsonApiDelete2({
|
|
4128
5288
|
classKey: config.classKey,
|
|
4129
5289
|
endpoint: params.endpoint,
|
|
4130
5290
|
companyId: params.companyId,
|
|
@@ -4137,17 +5297,17 @@ function useJsonApiMutation(config) {
|
|
|
4137
5297
|
if (apiResponse.ok) {
|
|
4138
5298
|
const resultData = apiResponse.data;
|
|
4139
5299
|
setData(resultData);
|
|
4140
|
-
_optionalChain([config, 'access',
|
|
5300
|
+
_optionalChain([config, 'access', _157 => _157.onSuccess, 'optionalCall', _158 => _158(resultData)]);
|
|
4141
5301
|
return resultData;
|
|
4142
5302
|
} else {
|
|
4143
5303
|
setError(apiResponse.error);
|
|
4144
|
-
_optionalChain([config, 'access',
|
|
5304
|
+
_optionalChain([config, 'access', _159 => _159.onError, 'optionalCall', _160 => _160(apiResponse.error)]);
|
|
4145
5305
|
return null;
|
|
4146
5306
|
}
|
|
4147
5307
|
} catch (err) {
|
|
4148
5308
|
const errorMessage = err instanceof Error ? err.message : "Unknown error";
|
|
4149
5309
|
setError(errorMessage);
|
|
4150
|
-
_optionalChain([config, 'access',
|
|
5310
|
+
_optionalChain([config, 'access', _161 => _161.onError, 'optionalCall', _162 => _162(errorMessage)]);
|
|
4151
5311
|
return null;
|
|
4152
5312
|
} finally {
|
|
4153
5313
|
setLoading(false);
|
|
@@ -4218,9 +5378,9 @@ var useCompanyTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
4218
5378
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4219
5379
|
_chunk5IET37O4js.Link,
|
|
4220
5380
|
{
|
|
4221
|
-
href: hasRole(
|
|
5381
|
+
href: hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator) ? generateUrl({
|
|
4222
5382
|
page: "/administration",
|
|
4223
|
-
id: _optionalChain([_chunkQ4FXESVTjs.Modules, 'access',
|
|
5383
|
+
id: _optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _163 => _163.Company, 'access', _164 => _164.pageUrl, 'optionalAccess', _165 => _165.substring, 'call', _166 => _166(1)]),
|
|
4224
5384
|
childPage: company.id
|
|
4225
5385
|
}) : generateUrl({ page: _chunkQ4FXESVTjs.Modules.Company, id: company.id }),
|
|
4226
5386
|
children: row.getValue("name")
|
|
@@ -4236,7 +5396,7 @@ var useCompanyTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
4236
5396
|
})
|
|
4237
5397
|
};
|
|
4238
5398
|
const columns = _react.useMemo.call(void 0, () => {
|
|
4239
|
-
return params.fields.map((field) => _optionalChain([fieldColumnMap, 'access',
|
|
5399
|
+
return params.fields.map((field) => _optionalChain([fieldColumnMap, 'access', _167 => _167[field], 'optionalCall', _168 => _168()])).filter((col) => col !== void 0);
|
|
4240
5400
|
}, [params.fields, fieldColumnMap, t, generateUrl, hasRole]);
|
|
4241
5401
|
return _react.useMemo.call(void 0, () => ({ data: tableData, columns }), [tableData, columns]);
|
|
4242
5402
|
}, "useCompanyTableStructure");
|
|
@@ -4291,7 +5451,7 @@ var useRoleTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0,
|
|
|
4291
5451
|
})
|
|
4292
5452
|
};
|
|
4293
5453
|
const columns = _react.useMemo.call(void 0, () => {
|
|
4294
|
-
return params.fields.map((field) => _optionalChain([fieldColumnMap, 'access',
|
|
5454
|
+
return params.fields.map((field) => _optionalChain([fieldColumnMap, 'access', _169 => _169[field], 'optionalCall', _170 => _170()])).filter((col) => col !== void 0);
|
|
4295
5455
|
}, [params.fields, fieldColumnMap, t, generateUrl]);
|
|
4296
5456
|
return _react.useMemo.call(void 0, () => ({ data: tableData, columns }), [tableData, columns]);
|
|
4297
5457
|
}, "useRoleTableStructure");
|
|
@@ -4309,7 +5469,7 @@ var useUserSearch = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
|
4309
5469
|
if (search === searchQueryRef.current && users.length > 0) return;
|
|
4310
5470
|
setIsLoading(true);
|
|
4311
5471
|
searchQueryRef.current = search;
|
|
4312
|
-
const fetchedUsers = await
|
|
5472
|
+
const fetchedUsers = await UserService.findMany({ search, fetchAll: true });
|
|
4313
5473
|
setUsers(fetchedUsers);
|
|
4314
5474
|
} catch (error) {
|
|
4315
5475
|
console.error("Failed to load users:", error);
|
|
@@ -4434,7 +5594,7 @@ var useUserTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0,
|
|
|
4434
5594
|
})
|
|
4435
5595
|
};
|
|
4436
5596
|
const columns = _react.useMemo.call(void 0, () => {
|
|
4437
|
-
return params.fields.map((field) => _optionalChain([fieldColumnMap, 'access',
|
|
5597
|
+
return params.fields.map((field) => _optionalChain([fieldColumnMap, 'access', _171 => _171[field], 'optionalCall', _172 => _172()])).filter((col) => col !== void 0);
|
|
4438
5598
|
}, [params.fields, fieldColumnMap, t, generateUrl]);
|
|
4439
5599
|
return _react.useMemo.call(void 0, () => ({ data: tableData, columns }), [tableData, columns]);
|
|
4440
5600
|
}, "useUserTableStructure");
|
|
@@ -4535,11 +5695,11 @@ var useContentTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
4535
5695
|
return params.fields.map((field) => {
|
|
4536
5696
|
const localHandler = fieldColumnMap[field];
|
|
4537
5697
|
if (localHandler) return localHandler();
|
|
4538
|
-
const customHandler = _optionalChain([params, 'access',
|
|
5698
|
+
const customHandler = _optionalChain([params, 'access', _173 => _173.context, 'optionalAccess', _174 => _174.customCells, 'optionalAccess', _175 => _175[field]]);
|
|
4539
5699
|
if (customHandler) return customHandler({ t });
|
|
4540
5700
|
return void 0;
|
|
4541
5701
|
}).filter((col) => col !== void 0);
|
|
4542
|
-
}, [params.fields, fieldColumnMap, t, generateUrl, _optionalChain([params, 'access',
|
|
5702
|
+
}, [params.fields, fieldColumnMap, t, generateUrl, _optionalChain([params, 'access', _176 => _176.context, 'optionalAccess', _177 => _177.customCells])]);
|
|
4543
5703
|
return _react.useMemo.call(void 0, () => ({ data: tableData, columns }), [tableData, columns]);
|
|
4544
5704
|
}, "useContentTableStructure");
|
|
4545
5705
|
|
|
@@ -4586,7 +5746,7 @@ function ContentTableSearch({ data }) {
|
|
|
4586
5746
|
const handleSearchIconClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
4587
5747
|
if (!isExpanded) {
|
|
4588
5748
|
setIsFocused(true);
|
|
4589
|
-
setTimeout(() => _optionalChain([inputRef, 'access',
|
|
5749
|
+
setTimeout(() => _optionalChain([inputRef, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.focus, 'call', _180 => _180()]), 50);
|
|
4590
5750
|
}
|
|
4591
5751
|
}, "handleSearchIconClick");
|
|
4592
5752
|
const handleBlur = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
@@ -4649,7 +5809,7 @@ var EMPTY_ARRAY = [];
|
|
|
4649
5809
|
var ContentListTable = _react.memo.call(void 0, /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, function ContentListTable2(props) {
|
|
4650
5810
|
const { data, fields, checkedIds, toggleId, allowSearch, filters } = props;
|
|
4651
5811
|
const { data: tableData, columns: tableColumns } = useTableGenerator(props.tableGeneratorType, {
|
|
4652
|
-
data: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
5812
|
+
data: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _181 => _181.data]), () => ( EMPTY_ARRAY)),
|
|
4653
5813
|
fields,
|
|
4654
5814
|
checkedIds,
|
|
4655
5815
|
toggleId,
|
|
@@ -4690,7 +5850,7 @@ var ContentListTable = _react.memo.call(void 0, /* @__PURE__ */ _chunk7QVYU63Ejs
|
|
|
4690
5850
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableHead, { children: header.isPlaceholder ? null : _reacttable.flexRender.call(void 0, header.column.columnDef.header, header.getContext()) }, header.id);
|
|
4691
5851
|
}) }, headerGroup.id))
|
|
4692
5852
|
] }),
|
|
4693
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableBody, { children: rowModel && _optionalChain([rowModel, 'access',
|
|
5853
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableBody, { children: rowModel && _optionalChain([rowModel, 'access', _182 => _182.rows, 'optionalAccess', _183 => _183.length]) ? rowModel.rows.map((row) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableCell, { children: _reacttable.flexRender.call(void 0, cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableRow, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableCell, { colSpan: tableColumns.length, className: "h-24 text-center", children: "No results." }) }) }),
|
|
4694
5854
|
showFooter && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableRow, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.TableCell, { colSpan: tableColumns.length, className: "bg-card py-4 text-right", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-end space-x-2", children: [
|
|
4695
5855
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4696
5856
|
_chunk5IET37O4js.Button,
|
|
@@ -4699,7 +5859,7 @@ var ContentListTable = _react.memo.call(void 0, /* @__PURE__ */ _chunk7QVYU63Ejs
|
|
|
4699
5859
|
size: "sm",
|
|
4700
5860
|
onClick: (e) => {
|
|
4701
5861
|
e.preventDefault();
|
|
4702
|
-
_optionalChain([data, 'access',
|
|
5862
|
+
_optionalChain([data, 'access', _184 => _184.previous, 'optionalCall', _185 => _185(true)]);
|
|
4703
5863
|
},
|
|
4704
5864
|
disabled: !data.previous,
|
|
4705
5865
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.CaretLeftIcon, { className: "h-4 w-4" })
|
|
@@ -4717,7 +5877,7 @@ var ContentListTable = _react.memo.call(void 0, /* @__PURE__ */ _chunk7QVYU63Ejs
|
|
|
4717
5877
|
size: "sm",
|
|
4718
5878
|
onClick: (e) => {
|
|
4719
5879
|
e.preventDefault();
|
|
4720
|
-
_optionalChain([data, 'access',
|
|
5880
|
+
_optionalChain([data, 'access', _186 => _186.next, 'optionalCall', _187 => _187(true)]);
|
|
4721
5881
|
},
|
|
4722
5882
|
disabled: !data.next,
|
|
4723
5883
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.CaretRightIcon, { className: "h-4 w-4" })
|
|
@@ -4778,7 +5938,7 @@ function Register() {
|
|
|
4778
5938
|
email: values.email,
|
|
4779
5939
|
password: values.password
|
|
4780
5940
|
};
|
|
4781
|
-
await
|
|
5941
|
+
await AuthService.register(payload);
|
|
4782
5942
|
setShowConfirmation(true);
|
|
4783
5943
|
} catch (e) {
|
|
4784
5944
|
errorToast({ error: e });
|
|
@@ -4940,20 +6100,20 @@ function LandingComponent() {
|
|
|
4940
6100
|
] }),
|
|
4941
6101
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.CardDescription, { className: "flex w-full justify-center text-center text-sm", children: t(`generic.description`) })
|
|
4942
6102
|
] }),
|
|
4943
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5IET37O4js.CardFooter, { className: "mt-4 flex w-full flex-col justify-between", children: [
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
}
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
)
|
|
6103
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5IET37O4js.CardFooter, { className: "mt-4 flex w-full flex-col justify-between gap-y-4", children: [
|
|
6104
|
+
_chunk3UELCPINjs.isInternalAuthConfigured.call(void 0, ) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
6105
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6106
|
+
_chunk5IET37O4js.Link,
|
|
6107
|
+
{
|
|
6108
|
+
href: "#",
|
|
6109
|
+
className: "flex w-full justify-start",
|
|
6110
|
+
onClick: () => setComponentType(5 /* Register */),
|
|
6111
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Button, { className: "w-full", variant: `default`, children: t(`foundations.auth.buttons.register`) })
|
|
6112
|
+
}
|
|
6113
|
+
),
|
|
6114
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Link, { href: "#", className: "flex w-full justify-end", onClick: () => setComponentType(0 /* Login */), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Button, { className: "w-full", variant: `outline`, "data-testid": "page-login-button-initial-login", children: t(`foundations.auth.buttons.login`) }) })
|
|
6115
|
+
] }),
|
|
6116
|
+
_chunk3UELCPINjs.isDiscordConfigured.call(void 0, ) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Link, { href: `${_chunkPMXG5WBCjs.getApiUrl.call(void 0, )}auth/discord`, className: "flex w-full justify-end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Button, { className: "w-full", variant: `outline`, "data-testid": "page-login-button-initial-login", children: "Login with Discord" }) })
|
|
4957
6117
|
] })
|
|
4958
6118
|
] });
|
|
4959
6119
|
}
|
|
@@ -4979,7 +6139,7 @@ function AcceptInvitation() {
|
|
|
4979
6139
|
const payload = {
|
|
4980
6140
|
code
|
|
4981
6141
|
};
|
|
4982
|
-
await
|
|
6142
|
+
await AuthService.validateCode(payload);
|
|
4983
6143
|
} catch (e) {
|
|
4984
6144
|
setError(e instanceof Error ? e.message : String(e));
|
|
4985
6145
|
errorToast({ title: t(`generic.errors.error`), error: e });
|
|
@@ -5012,12 +6172,12 @@ function AcceptInvitation() {
|
|
|
5012
6172
|
});
|
|
5013
6173
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
5014
6174
|
try {
|
|
5015
|
-
if (!_optionalChain([params, 'optionalAccess',
|
|
6175
|
+
if (!_optionalChain([params, 'optionalAccess', _188 => _188.code])) return;
|
|
5016
6176
|
const payload = {
|
|
5017
|
-
code: _optionalChain([params, 'optionalAccess',
|
|
6177
|
+
code: _optionalChain([params, 'optionalAccess', _189 => _189.code]),
|
|
5018
6178
|
password: values.password
|
|
5019
6179
|
};
|
|
5020
|
-
await
|
|
6180
|
+
await AuthService.acceptInvitation(payload);
|
|
5021
6181
|
setShowConfirmation(true);
|
|
5022
6182
|
_sonner.toast.success(t("foundations.auth.account_activated"), {
|
|
5023
6183
|
description: t("foundations.auth.account_activated_description")
|
|
@@ -5080,7 +6240,7 @@ function ActivateAccount() {
|
|
|
5080
6240
|
const payload = {
|
|
5081
6241
|
activationCode: code
|
|
5082
6242
|
};
|
|
5083
|
-
await
|
|
6243
|
+
await AuthService.activate(payload);
|
|
5084
6244
|
setShowConfirmation(true);
|
|
5085
6245
|
setParams(void 0);
|
|
5086
6246
|
_sonner.toast.success(t("foundations.auth.account_activated"), {
|
|
@@ -5123,7 +6283,7 @@ function Cookies({ dehydratedAuth, page }) {
|
|
|
5123
6283
|
_react.useEffect.call(void 0, () => {
|
|
5124
6284
|
if (hasSaved) return;
|
|
5125
6285
|
async function saveTokenOnServer() {
|
|
5126
|
-
await
|
|
6286
|
+
await AuthService.saveToken({ dehydratedAuth });
|
|
5127
6287
|
const auth = _chunkQ4FXESVTjs.rehydrate.call(void 0, _chunkQ4FXESVTjs.Modules.Auth, dehydratedAuth);
|
|
5128
6288
|
setUser(auth.user);
|
|
5129
6289
|
setHasSaved(true);
|
|
@@ -5167,7 +6327,7 @@ function ForgotPassword() {
|
|
|
5167
6327
|
const payload = {
|
|
5168
6328
|
email: values.email
|
|
5169
6329
|
};
|
|
5170
|
-
await
|
|
6330
|
+
await AuthService.initialiseForgotPassword(payload);
|
|
5171
6331
|
setShowConfirmation(true);
|
|
5172
6332
|
} catch (e) {
|
|
5173
6333
|
errorToast({ error: e });
|
|
@@ -5238,7 +6398,7 @@ function Login() {
|
|
|
5238
6398
|
});
|
|
5239
6399
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
5240
6400
|
try {
|
|
5241
|
-
const user = await
|
|
6401
|
+
const user = await AuthService.login({
|
|
5242
6402
|
email: values.email,
|
|
5243
6403
|
password: values.password
|
|
5244
6404
|
});
|
|
@@ -5317,7 +6477,7 @@ function Logout() {
|
|
|
5317
6477
|
const generateUrl = usePageUrlGenerator();
|
|
5318
6478
|
_react.useEffect.call(void 0, () => {
|
|
5319
6479
|
const logOut = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
5320
|
-
await
|
|
6480
|
+
await AuthService.logout();
|
|
5321
6481
|
window.location.href = generateUrl({ page: `/` });
|
|
5322
6482
|
}, "logOut");
|
|
5323
6483
|
logOut();
|
|
@@ -5332,20 +6492,20 @@ _chunk7QVYU63Ejs.__name.call(void 0, Logout, "Logout");
|
|
|
5332
6492
|
function RefreshUser() {
|
|
5333
6493
|
const { setUser } = useCurrentUserContext();
|
|
5334
6494
|
const loadFullUser = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
5335
|
-
const fullUser = await
|
|
6495
|
+
const fullUser = await UserService.findFullUser();
|
|
5336
6496
|
if (fullUser) {
|
|
5337
6497
|
setUser(fullUser);
|
|
5338
6498
|
const token = {
|
|
5339
6499
|
userId: fullUser.id,
|
|
5340
|
-
companyId: _optionalChain([fullUser, 'access',
|
|
5341
|
-
licenseExpirationDate: _optionalChain([fullUser, 'access',
|
|
6500
|
+
companyId: _optionalChain([fullUser, 'access', _190 => _190.company, 'optionalAccess', _191 => _191.id]),
|
|
6501
|
+
licenseExpirationDate: _optionalChain([fullUser, 'access', _192 => _192.company, 'optionalAccess', _193 => _193.licenseExpirationDate]),
|
|
5342
6502
|
roles: fullUser.roles.map((role) => role.id),
|
|
5343
|
-
features: _nullishCoalesce(_optionalChain([fullUser, 'access',
|
|
6503
|
+
features: _nullishCoalesce(_optionalChain([fullUser, 'access', _194 => _194.company, 'optionalAccess', _195 => _195.features, 'optionalAccess', _196 => _196.map, 'call', _197 => _197((feature) => feature.id)]), () => ( [])),
|
|
5344
6504
|
modules: fullUser.modules.map((module) => {
|
|
5345
6505
|
return { id: module.id, permissions: module.permissions };
|
|
5346
6506
|
})
|
|
5347
6507
|
};
|
|
5348
|
-
await _optionalChain([_chunkAYHKQWHHjs.getTokenHandler.call(void 0, ), 'optionalAccess',
|
|
6508
|
+
await _optionalChain([_chunkAYHKQWHHjs.getTokenHandler.call(void 0, ), 'optionalAccess', _198 => _198.updateToken, 'call', _199 => _199(token)]);
|
|
5349
6509
|
_cookiesnext.deleteCookie.call(void 0, "reloadData");
|
|
5350
6510
|
}
|
|
5351
6511
|
}, "loadFullUser");
|
|
@@ -5377,7 +6537,7 @@ function ResetPassword() {
|
|
|
5377
6537
|
const payload = {
|
|
5378
6538
|
code
|
|
5379
6539
|
};
|
|
5380
|
-
await
|
|
6540
|
+
await AuthService.validateCode(payload);
|
|
5381
6541
|
} catch (e) {
|
|
5382
6542
|
setError(e instanceof Error ? e.message : String(e));
|
|
5383
6543
|
errorToast({ title: t(`generic.errors.error`), error: e });
|
|
@@ -5410,12 +6570,12 @@ function ResetPassword() {
|
|
|
5410
6570
|
});
|
|
5411
6571
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
5412
6572
|
try {
|
|
5413
|
-
if (!_optionalChain([params, 'optionalAccess',
|
|
6573
|
+
if (!_optionalChain([params, 'optionalAccess', _200 => _200.code])) return;
|
|
5414
6574
|
const payload = {
|
|
5415
|
-
code: _optionalChain([params, 'optionalAccess',
|
|
6575
|
+
code: _optionalChain([params, 'optionalAccess', _201 => _201.code]),
|
|
5416
6576
|
password: values.password
|
|
5417
6577
|
};
|
|
5418
|
-
await
|
|
6578
|
+
await AuthService.resetPassword(payload);
|
|
5419
6579
|
setShowConfirmation(true);
|
|
5420
6580
|
_sonner.toast.success(t(`foundations.auth.reset_success`), {
|
|
5421
6581
|
description: t(`foundations.auth.reset_success_description`)
|
|
@@ -5467,7 +6627,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CompanyDetails, "CompanyDetails");
|
|
|
5467
6627
|
function AdminCompanyContainerInternal() {
|
|
5468
6628
|
const { company } = useCompanyContext();
|
|
5469
6629
|
const { hasRole } = useCurrentUserContext();
|
|
5470
|
-
if (!company || !hasRole(
|
|
6630
|
+
if (!company || !hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)) return null;
|
|
5471
6631
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5472
6632
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompanyDetails, {}),
|
|
5473
6633
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AdminUsersList, {})
|
|
@@ -5578,8 +6738,8 @@ function CompanyConfigurationEditorInternal({ company }) {
|
|
|
5578
6738
|
const { setUser } = useCurrentUserContext();
|
|
5579
6739
|
const defaultValues = _react.useMemo.call(void 0, () => {
|
|
5580
6740
|
return {
|
|
5581
|
-
isManagedKnowledge: _nullishCoalesce(_optionalChain([company, 'access',
|
|
5582
|
-
allowPublicBot: _nullishCoalesce(_optionalChain([company, 'access',
|
|
6741
|
+
isManagedKnowledge: _nullishCoalesce(_optionalChain([company, 'access', _202 => _202.configurations, 'optionalAccess', _203 => _203.isManagedKnowledge]), () => ( false)),
|
|
6742
|
+
allowPublicBot: _nullishCoalesce(_optionalChain([company, 'access', _204 => _204.configurations, 'optionalAccess', _205 => _205.allowPublicBot]), () => ( false))
|
|
5583
6743
|
};
|
|
5584
6744
|
}, [company.configurations]);
|
|
5585
6745
|
const close = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
@@ -5598,8 +6758,8 @@ function CompanyConfigurationEditorInternal({ company }) {
|
|
|
5598
6758
|
_react.useEffect.call(void 0, () => {
|
|
5599
6759
|
if (open) {
|
|
5600
6760
|
form.reset({
|
|
5601
|
-
isManagedKnowledge: _nullishCoalesce(_optionalChain([company, 'access',
|
|
5602
|
-
allowPublicBot: _nullishCoalesce(_optionalChain([company, 'access',
|
|
6761
|
+
isManagedKnowledge: _nullishCoalesce(_optionalChain([company, 'access', _206 => _206.configurations, 'optionalAccess', _207 => _207.isManagedKnowledge]), () => ( false)),
|
|
6762
|
+
allowPublicBot: _nullishCoalesce(_optionalChain([company, 'access', _208 => _208.configurations, 'optionalAccess', _209 => _209.allowPublicBot]), () => ( false))
|
|
5603
6763
|
});
|
|
5604
6764
|
}
|
|
5605
6765
|
}, [company, open]);
|
|
@@ -5612,8 +6772,8 @@ function CompanyConfigurationEditorInternal({ company }) {
|
|
|
5612
6772
|
}
|
|
5613
6773
|
};
|
|
5614
6774
|
try {
|
|
5615
|
-
await
|
|
5616
|
-
const fullUser = await
|
|
6775
|
+
await CompanyService.updateConfigurations(payload);
|
|
6776
|
+
const fullUser = await UserService.findFullUser();
|
|
5617
6777
|
if (fullUser) {
|
|
5618
6778
|
setUser(fullUser);
|
|
5619
6779
|
}
|
|
@@ -5649,7 +6809,7 @@ function CompanyConfigurationEditorInternal({ company }) {
|
|
|
5649
6809
|
_chunk7QVYU63Ejs.__name.call(void 0, CompanyConfigurationEditorInternal, "CompanyConfigurationEditorInternal");
|
|
5650
6810
|
function CompanyConfigurationEditor(props) {
|
|
5651
6811
|
const { hasRole } = useCurrentUserContext();
|
|
5652
|
-
if (hasRole(
|
|
6812
|
+
if (hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompanyConfigurationEditorInternal, { ...props });
|
|
5653
6813
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompanyConfigurationEditorInternal, { ...props });
|
|
5654
6814
|
}
|
|
5655
6815
|
_chunk7QVYU63Ejs.__name.call(void 0, CompanyConfigurationEditor, "CompanyConfigurationEditor");
|
|
@@ -5668,7 +6828,7 @@ function CompanyDeleterInternal({ company }) {
|
|
|
5668
6828
|
const handleDelete = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
5669
6829
|
setIsDeleting(true);
|
|
5670
6830
|
try {
|
|
5671
|
-
await
|
|
6831
|
+
await CompanyService.delete({ companyId: company.id });
|
|
5672
6832
|
router.push("/");
|
|
5673
6833
|
} catch (error) {
|
|
5674
6834
|
errorToast({ title: t(`generic.errors.delete`), error });
|
|
@@ -5738,7 +6898,7 @@ function CompanyDeleterInternal({ company }) {
|
|
|
5738
6898
|
_chunk7QVYU63Ejs.__name.call(void 0, CompanyDeleterInternal, "CompanyDeleterInternal");
|
|
5739
6899
|
function CompanyDeleter({ company }) {
|
|
5740
6900
|
const { hasPermissionToModule, hasRole } = useCurrentUserContext();
|
|
5741
|
-
if (!hasRole(
|
|
6901
|
+
if (!hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator) && !hasPermissionToModule({ module: _chunkQ4FXESVTjs.Modules.Company, action: "delete" /* Delete */ }))
|
|
5742
6902
|
return null;
|
|
5743
6903
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompanyDeleterInternal, { company });
|
|
5744
6904
|
}
|
|
@@ -5777,16 +6937,16 @@ function CompanyEditorInternal({ company, propagateChanges, onRevalidate }) {
|
|
|
5777
6937
|
const form = _reacthookform.useForm.call(void 0, {
|
|
5778
6938
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
5779
6939
|
defaultValues: {
|
|
5780
|
-
id: _optionalChain([company, 'optionalAccess',
|
|
5781
|
-
name: _optionalChain([company, 'optionalAccess',
|
|
5782
|
-
featureIds: _optionalChain([company, 'optionalAccess',
|
|
5783
|
-
moduleIds: _optionalChain([company, 'optionalAccess',
|
|
5784
|
-
logo: _optionalChain([company, 'optionalAccess',
|
|
6940
|
+
id: _optionalChain([company, 'optionalAccess', _210 => _210.id]) || _uuid.v4.call(void 0, ),
|
|
6941
|
+
name: _optionalChain([company, 'optionalAccess', _211 => _211.name]) || "",
|
|
6942
|
+
featureIds: _optionalChain([company, 'optionalAccess', _212 => _212.features, 'access', _213 => _213.map, 'call', _214 => _214((feature) => feature.id)]) || [],
|
|
6943
|
+
moduleIds: _optionalChain([company, 'optionalAccess', _215 => _215.modules, 'access', _216 => _216.map, 'call', _217 => _217((module) => module.id)]) || [],
|
|
6944
|
+
logo: _optionalChain([company, 'optionalAccess', _218 => _218.logo]) || ""
|
|
5785
6945
|
}
|
|
5786
6946
|
});
|
|
5787
6947
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
5788
6948
|
if (values.logo && contentType) {
|
|
5789
|
-
const s3 = await
|
|
6949
|
+
const s3 = await S3Service.getPreSignedUrl({
|
|
5790
6950
|
key: values.logo,
|
|
5791
6951
|
contentType,
|
|
5792
6952
|
isPublic: true
|
|
@@ -5798,14 +6958,14 @@ function CompanyEditorInternal({ company, propagateChanges, onRevalidate }) {
|
|
|
5798
6958
|
});
|
|
5799
6959
|
}
|
|
5800
6960
|
const payload = {
|
|
5801
|
-
id: _nullishCoalesce(_optionalChain([company, 'optionalAccess',
|
|
6961
|
+
id: _nullishCoalesce(_optionalChain([company, 'optionalAccess', _219 => _219.id]), () => ( _uuid.v4.call(void 0, ))),
|
|
5802
6962
|
name: values.name,
|
|
5803
6963
|
logo: files && contentType ? values.logo : void 0,
|
|
5804
6964
|
featureIds: values.featureIds,
|
|
5805
6965
|
moduleIds: values.moduleIds
|
|
5806
6966
|
};
|
|
5807
6967
|
try {
|
|
5808
|
-
const updatedCompany = company ? await
|
|
6968
|
+
const updatedCompany = company ? await CompanyService.update(payload) : await CompanyService.create(payload);
|
|
5809
6969
|
if (onRevalidate) {
|
|
5810
6970
|
await onRevalidate(generateUrl({ page: _chunkQ4FXESVTjs.Modules.Company, id: updatedCompany.id, language: `[locale]` }));
|
|
5811
6971
|
}
|
|
@@ -5825,15 +6985,15 @@ function CompanyEditorInternal({ company, propagateChanges, onRevalidate }) {
|
|
|
5825
6985
|
}, "onSubmit");
|
|
5826
6986
|
_react.useEffect.call(void 0, () => {
|
|
5827
6987
|
async function fetchFeatures() {
|
|
5828
|
-
const allfeatures = await
|
|
5829
|
-
if (hasRole(
|
|
6988
|
+
const allfeatures = await FeatureService.findMany({});
|
|
6989
|
+
if (hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)) {
|
|
5830
6990
|
setFeatures(allfeatures);
|
|
5831
6991
|
} else {
|
|
5832
6992
|
setFeatures(allfeatures.filter((feature) => feature.isProduction));
|
|
5833
6993
|
}
|
|
5834
6994
|
}
|
|
5835
6995
|
_chunk7QVYU63Ejs.__name.call(void 0, fetchFeatures, "fetchFeatures");
|
|
5836
|
-
if (open && features.length === 0 && (hasRole(
|
|
6996
|
+
if (open && features.length === 0 && (hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator) || hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).CompanyAdministrator) && _optionalChain([process, 'access', _220 => _220.env, 'access', _221 => _221.NEXT_PUBLIC_PRIVATE_INSTALLATION, 'optionalAccess', _222 => _222.toLowerCase, 'call', _223 => _223()]) === "true"))
|
|
5837
6997
|
fetchFeatures();
|
|
5838
6998
|
}, [open, features]);
|
|
5839
6999
|
_react.useEffect.call(void 0, () => {
|
|
@@ -5867,8 +7027,8 @@ function CompanyEditorInternal({ company, propagateChanges, onRevalidate }) {
|
|
|
5867
7027
|
"application/images": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg"]
|
|
5868
7028
|
}
|
|
5869
7029
|
};
|
|
5870
|
-
const canAccessFeatures = hasRole(
|
|
5871
|
-
const isAdministrator = hasRole(
|
|
7030
|
+
const canAccessFeatures = hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator) || hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).CompanyAdministrator) && _optionalChain([process, 'access', _224 => _224.env, 'access', _225 => _225.NEXT_PUBLIC_PRIVATE_INSTALLATION, 'optionalAccess', _226 => _226.toLowerCase, 'call', _227 => _227()]) === "true";
|
|
7031
|
+
const isAdministrator = hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator);
|
|
5872
7032
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5IET37O4js.Dialog, { open, onOpenChange: setOpen, children: [
|
|
5873
7033
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CommonEditorTrigger, { isEdit: !!company }),
|
|
5874
7034
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -5876,13 +7036,13 @@ function CompanyEditorInternal({ company, propagateChanges, onRevalidate }) {
|
|
|
5876
7036
|
{
|
|
5877
7037
|
className: `flex max-h-[70vh] w-full ${isAdministrator || canAccessFeatures ? `max-w-5xl` : `max-w-4xl`} flex-col overflow-y-auto`,
|
|
5878
7038
|
children: [
|
|
5879
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CommonEditorHeader, { type: t(`types.companies`, { count: 1 }), name: _optionalChain([company, 'optionalAccess',
|
|
7039
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CommonEditorHeader, { type: t(`types.companies`, { count: 1 }), name: _optionalChain([company, 'optionalAccess', _228 => _228.name]) }),
|
|
5880
7040
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: `flex w-full flex-col gap-y-4`, children: [
|
|
5881
7041
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full items-start justify-between gap-x-4", children: [
|
|
5882
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `flex w-96 flex-col justify-start gap-y-4`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileUploader, { value: files, onValueChange: setFiles, dropzoneOptions: dropzone2, className: "w-full p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileInput, { className: "text-neutral-300 outline-dashed", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col items-center justify-center pt-3 pb-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col items-center justify-center pt-3 pb-4", children: file || _optionalChain([company, 'optionalAccess',
|
|
7042
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `flex w-96 flex-col justify-start gap-y-4`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileUploader, { value: files, onValueChange: setFiles, dropzoneOptions: dropzone2, className: "w-full p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileInput, { className: "text-neutral-300 outline-dashed", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col items-center justify-center pt-3 pb-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col items-center justify-center pt-3 pb-4", children: file || _optionalChain([company, 'optionalAccess', _229 => _229.logo]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5883
7043
|
_image2.default,
|
|
5884
7044
|
{
|
|
5885
|
-
src: file ? URL.createObjectURL(file) : _optionalChain([company, 'optionalAccess',
|
|
7045
|
+
src: file ? URL.createObjectURL(file) : _optionalChain([company, 'optionalAccess', _230 => _230.logo]) || "",
|
|
5886
7046
|
alt: "Company Logo",
|
|
5887
7047
|
width: 200,
|
|
5888
7048
|
height: 200
|
|
@@ -5939,7 +7099,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CompanyEditor, "CompanyEditor");
|
|
|
5939
7099
|
function CompaniesList() {
|
|
5940
7100
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
5941
7101
|
const data = useDataListRetriever({
|
|
5942
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
7102
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => CompanyService.findMany(params), "retriever"),
|
|
5943
7103
|
retrieverParams: {},
|
|
5944
7104
|
module: _chunkQ4FXESVTjs.Modules.Company
|
|
5945
7105
|
});
|
|
@@ -5995,7 +7155,7 @@ function ContentsListById({ contentIds }) {
|
|
|
5995
7155
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
5996
7156
|
const data = useDataListRetriever({
|
|
5997
7157
|
module: _chunkQ4FXESVTjs.Modules.Content,
|
|
5998
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
7158
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => ContentService.findMany(params), "retriever"),
|
|
5999
7159
|
retrieverParams: { contentIds }
|
|
6000
7160
|
});
|
|
6001
7161
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6017,7 +7177,7 @@ function RelevantContentsList({ id }) {
|
|
|
6017
7177
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
6018
7178
|
const data = useDataListRetriever({
|
|
6019
7179
|
module: _chunkQ4FXESVTjs.Modules.Content,
|
|
6020
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
7180
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => ContentService.findRelevant(params), "retriever"),
|
|
6021
7181
|
retrieverParams: { id }
|
|
6022
7182
|
});
|
|
6023
7183
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6092,7 +7252,7 @@ function NotificationToast(notification, t, generateUrl, reouter) {
|
|
|
6092
7252
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col", children: [
|
|
6093
7253
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: t.rich(`foundations.notification.${notification.notificationType}.description`, {
|
|
6094
7254
|
strong: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (chunks) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: chunks }), "strong"),
|
|
6095
|
-
actor: _nullishCoalesce(_optionalChain([data, 'access',
|
|
7255
|
+
actor: _nullishCoalesce(_optionalChain([data, 'access', _231 => _231.actor, 'optionalAccess', _232 => _232.name]), () => ( "")),
|
|
6096
7256
|
title: data.title
|
|
6097
7257
|
}) }),
|
|
6098
7258
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mt-1 w-full text-xs", children: new Date(notification.createdAt).toLocaleString() })
|
|
@@ -6120,7 +7280,7 @@ function NotificationMenuItem({ notification, closePopover }) {
|
|
|
6120
7280
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col", children: [
|
|
6121
7281
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: t.rich(`foundations.notification.${notification.notificationType}.description`, {
|
|
6122
7282
|
strong: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (chunks) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: chunks }), "strong"),
|
|
6123
|
-
actor: _nullishCoalesce(_optionalChain([data, 'access',
|
|
7283
|
+
actor: _nullishCoalesce(_optionalChain([data, 'access', _233 => _233.actor, 'optionalAccess', _234 => _234.name]), () => ( "")),
|
|
6124
7284
|
title: data.title
|
|
6125
7285
|
}) }),
|
|
6126
7286
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mt-1 w-full text-xs", children: new Date(notification.createdAt).toLocaleString() })
|
|
@@ -6161,7 +7321,7 @@ var NotificationContextProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(v
|
|
|
6161
7321
|
setIsLoading(true);
|
|
6162
7322
|
setError(null);
|
|
6163
7323
|
try {
|
|
6164
|
-
const fetchedNotifications = await
|
|
7324
|
+
const fetchedNotifications = await NotificationService.findMany({});
|
|
6165
7325
|
setNotifications(fetchedNotifications);
|
|
6166
7326
|
setLastLoaded(Date.now());
|
|
6167
7327
|
} catch (error2) {
|
|
@@ -6186,8 +7346,8 @@ var NotificationContextProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(v
|
|
|
6186
7346
|
relationships: {}
|
|
6187
7347
|
}))
|
|
6188
7348
|
};
|
|
6189
|
-
await
|
|
6190
|
-
const allNotifications = await
|
|
7349
|
+
await NotificationService.markAsRead({ data });
|
|
7350
|
+
const allNotifications = await NotificationService.findMany({});
|
|
6191
7351
|
setNotifications(allNotifications);
|
|
6192
7352
|
setLastLoaded(Date.now());
|
|
6193
7353
|
} catch (error2) {
|
|
@@ -6254,12 +7414,12 @@ function NotificationsList({ archived }) {
|
|
|
6254
7414
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
6255
7415
|
const generateUrl = usePageUrlGenerator();
|
|
6256
7416
|
const data = useDataListRetriever({
|
|
6257
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
7417
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => NotificationService.findMany(params), "retriever"),
|
|
6258
7418
|
retrieverParams: { isArchived: archived },
|
|
6259
7419
|
module: _chunkQ4FXESVTjs.Modules.Notification
|
|
6260
7420
|
});
|
|
6261
7421
|
const archiveNotification = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (notification) => {
|
|
6262
|
-
await
|
|
7422
|
+
await NotificationService.archive({ id: notification.id });
|
|
6263
7423
|
data.removeElement(notification);
|
|
6264
7424
|
}, "archiveNotification");
|
|
6265
7425
|
const LoadingSkeleton = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.CardContent, { className: "p-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-row items-center", children: [
|
|
@@ -6270,14 +7430,14 @@ function NotificationsList({ archived }) {
|
|
|
6270
7430
|
] }),
|
|
6271
7431
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Skeleton, { className: "h-8 w-20" })
|
|
6272
7432
|
] }) }) }, i)) }), "LoadingSkeleton");
|
|
6273
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4", children: data.isLoaded ? _optionalChain([data, 'access',
|
|
7433
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4", children: data.isLoaded ? _optionalChain([data, 'access', _235 => _235.data, 'optionalAccess', _236 => _236.map, 'call', _237 => _237((notification) => {
|
|
6274
7434
|
const notificationData = generateNotificationData({ notification, generateUrl });
|
|
6275
7435
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.CardContent, { className: "p-0", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex w-full flex-row items-center p-2`, children: [
|
|
6276
7436
|
notificationData.actor ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-12 max-w-12 px-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Link, { href: generateUrl({ page: _chunkQ4FXESVTjs.Modules.User, id: notificationData.actor.id }), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserAvatar, { user: notificationData.actor, className: "h-8 w-8" }) }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-14 max-w-14 px-2" }),
|
|
6277
7437
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col", children: [
|
|
6278
7438
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: t.rich(`foundations.notification.${notification.notificationType}.description`, {
|
|
6279
7439
|
strong: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (chunks) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: chunks }), "strong"),
|
|
6280
|
-
actor: _nullishCoalesce(_optionalChain([notificationData, 'access',
|
|
7440
|
+
actor: _nullishCoalesce(_optionalChain([notificationData, 'access', _238 => _238.actor, 'optionalAccess', _239 => _239.name]), () => ( "")),
|
|
6281
7441
|
title: notificationData.title
|
|
6282
7442
|
}) }),
|
|
6283
7443
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mt-1 w-full text-xs", children: new Date(notification.createdAt).toLocaleString() })
|
|
@@ -6636,13 +7796,13 @@ function RemoveUserFromRole({ role, user, refresh }) {
|
|
|
6636
7796
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
6637
7797
|
_react.useEffect.call(void 0, () => {
|
|
6638
7798
|
async function checkCompanyAdminDeletability() {
|
|
6639
|
-
const roleUsers = await
|
|
7799
|
+
const roleUsers = await UserService.findAllUsersByRole({
|
|
6640
7800
|
roleId: role.id
|
|
6641
7801
|
});
|
|
6642
7802
|
if (roleUsers.length > 1) setCanRemove(true);
|
|
6643
7803
|
}
|
|
6644
7804
|
_chunk7QVYU63Ejs.__name.call(void 0, checkCompanyAdminDeletability, "checkCompanyAdminDeletability");
|
|
6645
|
-
if (role.id !==
|
|
7805
|
+
if (role.id !== _chunk3UELCPINjs.getRoleId.call(void 0, ).CompanyAdministrator) {
|
|
6646
7806
|
setCanRemove(true);
|
|
6647
7807
|
return;
|
|
6648
7808
|
}
|
|
@@ -6650,7 +7810,7 @@ function RemoveUserFromRole({ role, user, refresh }) {
|
|
|
6650
7810
|
}, [role]);
|
|
6651
7811
|
const remove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
6652
7812
|
try {
|
|
6653
|
-
await
|
|
7813
|
+
await RoleService.removeUserFromRole({
|
|
6654
7814
|
roleId: role.id,
|
|
6655
7815
|
userId: user.id
|
|
6656
7816
|
});
|
|
@@ -6714,7 +7874,7 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
6714
7874
|
const [roles, setRoles] = _react.useState.call(void 0, []);
|
|
6715
7875
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
6716
7876
|
const addUserToRole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (role) => {
|
|
6717
|
-
await
|
|
7877
|
+
await RoleService.addUserToRole({
|
|
6718
7878
|
roleId: role.id,
|
|
6719
7879
|
userId: user.id
|
|
6720
7880
|
});
|
|
@@ -6738,7 +7898,7 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
6738
7898
|
const searchRoles = _react.useCallback.call(void 0,
|
|
6739
7899
|
async (term) => {
|
|
6740
7900
|
setRoles(
|
|
6741
|
-
await
|
|
7901
|
+
await RoleService.findAllRolesUserNotIn({
|
|
6742
7902
|
search: term,
|
|
6743
7903
|
userId: user.id
|
|
6744
7904
|
})
|
|
@@ -6806,7 +7966,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, UserRoleAdd, "UserRoleAdd");
|
|
|
6806
7966
|
function RolesList() {
|
|
6807
7967
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
6808
7968
|
const data = useDataListRetriever({
|
|
6809
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
7969
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => RoleService.findAllRoles(params), "retriever"),
|
|
6810
7970
|
retrieverParams: {},
|
|
6811
7971
|
module: _chunkQ4FXESVTjs.Modules.Role
|
|
6812
7972
|
});
|
|
@@ -6828,7 +7988,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, RolesList, "RolesList");
|
|
|
6828
7988
|
function UserRolesList({ user }) {
|
|
6829
7989
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
6830
7990
|
const data = useDataListRetriever({
|
|
6831
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
7991
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => RoleService.findAllRolesByUser(params), "retriever"),
|
|
6832
7992
|
retrieverParams: { userId: user.id },
|
|
6833
7993
|
module: _chunkQ4FXESVTjs.Modules.Role
|
|
6834
7994
|
});
|
|
@@ -6854,7 +8014,7 @@ function AddUserToRoleInternal({ role, refresh }) {
|
|
|
6854
8014
|
const [existingUsers, setExistingUsers] = _react.useState.call(void 0, null);
|
|
6855
8015
|
_react.useEffect.call(void 0, () => {
|
|
6856
8016
|
const fetchExistingUsers = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
6857
|
-
setExistingUsers(await
|
|
8017
|
+
setExistingUsers(await UserService.findMany({ roleId: role.id, fetchAll: true }));
|
|
6858
8018
|
}, "fetchExistingUsers");
|
|
6859
8019
|
if (show) {
|
|
6860
8020
|
setExistingUsers(null);
|
|
@@ -6862,7 +8022,7 @@ function AddUserToRoleInternal({ role, refresh }) {
|
|
|
6862
8022
|
}
|
|
6863
8023
|
}, [show]);
|
|
6864
8024
|
const addUserToRole = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (user) => {
|
|
6865
|
-
await
|
|
8025
|
+
await RoleService.addUserToRole({
|
|
6866
8026
|
roleId: role.id,
|
|
6867
8027
|
userId: user.id
|
|
6868
8028
|
});
|
|
@@ -6878,8 +8038,8 @@ function AddUserToRoleInternal({ role, refresh }) {
|
|
|
6878
8038
|
}, "addUserToRole");
|
|
6879
8039
|
const data = useDataListRetriever({
|
|
6880
8040
|
ready: !!company && show,
|
|
6881
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
6882
|
-
retrieverParams: { companyId: _optionalChain([company, 'optionalAccess',
|
|
8041
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => UserService.findAllUsers(params), "retriever"),
|
|
8042
|
+
retrieverParams: { companyId: _optionalChain([company, 'optionalAccess', _240 => _240.id]) },
|
|
6883
8043
|
module: _chunkQ4FXESVTjs.Modules.User
|
|
6884
8044
|
});
|
|
6885
8045
|
_react.useEffect.call(void 0, () => {
|
|
@@ -6947,10 +8107,10 @@ function UserAvatarEditor({ user, file, setFile, resetImage, setResetImage }) {
|
|
|
6947
8107
|
onValueChange: setFiles,
|
|
6948
8108
|
dropzoneOptions: dropzone2,
|
|
6949
8109
|
className: "h-40 w-40 rounded-full p-0",
|
|
6950
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileInput, { className: "bg-muted text-muted-foreground flex h-full w-full flex-col items-center justify-center", children: !resetImage && (file || _optionalChain([user, 'optionalAccess',
|
|
8110
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileInput, { className: "bg-muted text-muted-foreground flex h-full w-full flex-col items-center justify-center", children: !resetImage && (file || _optionalChain([user, 'optionalAccess', _241 => _241.avatar])) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6951
8111
|
_image2.default,
|
|
6952
8112
|
{
|
|
6953
|
-
src: file ? URL.createObjectURL(file) : _optionalChain([user, 'optionalAccess',
|
|
8113
|
+
src: file ? URL.createObjectURL(file) : _optionalChain([user, 'optionalAccess', _242 => _242.avatar]) || "",
|
|
6954
8114
|
alt: t(`generic.avatar`),
|
|
6955
8115
|
width: 200,
|
|
6956
8116
|
height: 200
|
|
@@ -6958,7 +8118,7 @@ function UserAvatarEditor({ user, file, setFile, resetImage, setResetImage }) {
|
|
|
6958
8118
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, { className: "my-4 h-8 w-8" }) })
|
|
6959
8119
|
}
|
|
6960
8120
|
),
|
|
6961
|
-
!resetImage && (file || _optionalChain([user, 'optionalAccess',
|
|
8121
|
+
!resetImage && (file || _optionalChain([user, 'optionalAccess', _243 => _243.avatar])) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6962
8122
|
_chunk5IET37O4js.Button,
|
|
6963
8123
|
{
|
|
6964
8124
|
className: "",
|
|
@@ -6986,7 +8146,7 @@ function UserDeleterInternal({ user, onDeleted, companyId }) {
|
|
|
6986
8146
|
const router = _chunkAYHKQWHHjs.useI18nRouter.call(void 0, );
|
|
6987
8147
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
6988
8148
|
let cId;
|
|
6989
|
-
if (_optionalChain([currentUser, 'optionalAccess',
|
|
8149
|
+
if (_optionalChain([currentUser, 'optionalAccess', _244 => _244.roles, 'access', _245 => _245.find, 'call', _246 => _246((role) => role.id === _chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)]) && companyId) {
|
|
6990
8150
|
cId = companyId;
|
|
6991
8151
|
} else {
|
|
6992
8152
|
if (!company) return;
|
|
@@ -6996,7 +8156,7 @@ function UserDeleterInternal({ user, onDeleted, companyId }) {
|
|
|
6996
8156
|
CommonDeleter,
|
|
6997
8157
|
{
|
|
6998
8158
|
type: `users`,
|
|
6999
|
-
deleteFunction: () =>
|
|
8159
|
+
deleteFunction: () => UserService.delete({ userId: user.id, companyId: cId }).then(
|
|
7000
8160
|
() => onDeleted ? onDeleted() : router.push(generateUrl({ page: _chunkQ4FXESVTjs.Modules.User }))
|
|
7001
8161
|
)
|
|
7002
8162
|
}
|
|
@@ -7054,22 +8214,22 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
7054
8214
|
const form = _reacthookform.useForm.call(void 0, {
|
|
7055
8215
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
7056
8216
|
defaultValues: {
|
|
7057
|
-
id: _optionalChain([user, 'optionalAccess',
|
|
7058
|
-
name: _optionalChain([user, 'optionalAccess',
|
|
7059
|
-
title: _optionalChain([user, 'optionalAccess',
|
|
7060
|
-
bio: _optionalChain([user, 'optionalAccess',
|
|
7061
|
-
email: _optionalChain([user, 'optionalAccess',
|
|
7062
|
-
phone: _optionalChain([user, 'optionalAccess',
|
|
8217
|
+
id: _optionalChain([user, 'optionalAccess', _247 => _247.id]) || _uuid.v4.call(void 0, ),
|
|
8218
|
+
name: _optionalChain([user, 'optionalAccess', _248 => _248.name]) || "",
|
|
8219
|
+
title: _optionalChain([user, 'optionalAccess', _249 => _249.title]) || "",
|
|
8220
|
+
bio: _optionalChain([user, 'optionalAccess', _250 => _250.bio]) || "",
|
|
8221
|
+
email: _optionalChain([user, 'optionalAccess', _251 => _251.email]) || "",
|
|
8222
|
+
phone: _optionalChain([user, 'optionalAccess', _252 => _252.phone]) || "",
|
|
7063
8223
|
password: "",
|
|
7064
|
-
roleIds: _optionalChain([user, 'optionalAccess',
|
|
8224
|
+
roleIds: _optionalChain([user, 'optionalAccess', _253 => _253.roles, 'access', _254 => _254.map, 'call', _255 => _255((role) => role.id)]) || [],
|
|
7065
8225
|
sendInvitationEmail: false,
|
|
7066
|
-
avatar: _optionalChain([user, 'optionalAccess',
|
|
8226
|
+
avatar: _optionalChain([user, 'optionalAccess', _256 => _256.avatarUrl]) || ""
|
|
7067
8227
|
}
|
|
7068
8228
|
});
|
|
7069
8229
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
7070
8230
|
if (!user) {
|
|
7071
8231
|
try {
|
|
7072
|
-
const existingUser = await
|
|
8232
|
+
const existingUser = await UserService.findByEmail({ email: values.email });
|
|
7073
8233
|
if (existingUser) {
|
|
7074
8234
|
form.setError("email", {
|
|
7075
8235
|
type: "manual",
|
|
@@ -7082,7 +8242,7 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
7082
8242
|
}
|
|
7083
8243
|
}
|
|
7084
8244
|
if (values.avatar && contentType) {
|
|
7085
|
-
const s3 = await
|
|
8245
|
+
const s3 = await S3Service.getPreSignedUrl({
|
|
7086
8246
|
key: values.avatar,
|
|
7087
8247
|
contentType,
|
|
7088
8248
|
isPublic: true
|
|
@@ -7108,8 +8268,8 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
7108
8268
|
adminCreated
|
|
7109
8269
|
};
|
|
7110
8270
|
try {
|
|
7111
|
-
const updatedUser = user ? await
|
|
7112
|
-
if (_optionalChain([currentUser, 'optionalAccess',
|
|
8271
|
+
const updatedUser = user ? await UserService.update(payload) : await UserService.create(payload);
|
|
8272
|
+
if (_optionalChain([currentUser, 'optionalAccess', _257 => _257.id]) === updatedUser.id) setUser(updatedUser);
|
|
7113
8273
|
if (onRevalidate) {
|
|
7114
8274
|
await onRevalidate(generateUrl({ page: _chunkQ4FXESVTjs.Modules.User, id: updatedUser.id, language: `[locale]` }));
|
|
7115
8275
|
}
|
|
@@ -7125,14 +8285,14 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
7125
8285
|
}, "onSubmit");
|
|
7126
8286
|
_react.useEffect.call(void 0, () => {
|
|
7127
8287
|
async function fetchRoles() {
|
|
7128
|
-
const roles2 = await
|
|
8288
|
+
const roles2 = await RoleService.findAllRoles({});
|
|
7129
8289
|
const availableRoles = roles2.filter(
|
|
7130
|
-
(role) => role.id !==
|
|
8290
|
+
(role) => role.id !== _chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator && (role.requiredFeature === void 0 || _optionalChain([company, 'optionalAccess', _258 => _258.features, 'access', _259 => _259.some, 'call', _260 => _260((feature) => feature.id === _optionalChain([role, 'access', _261 => _261.requiredFeature, 'optionalAccess', _262 => _262.id]))]))
|
|
7131
8291
|
);
|
|
7132
8292
|
setRoles(availableRoles);
|
|
7133
8293
|
}
|
|
7134
8294
|
_chunk7QVYU63Ejs.__name.call(void 0, fetchRoles, "fetchRoles");
|
|
7135
|
-
if (open && (company || _optionalChain([currentUser, 'optionalAccess',
|
|
8295
|
+
if (open && (company || _optionalChain([currentUser, 'optionalAccess', _263 => _263.roles, 'access', _264 => _264.find, 'call', _265 => _265((role) => role.id === _chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)])) && roles.length === 0)
|
|
7136
8296
|
fetchRoles();
|
|
7137
8297
|
}, [company, open]);
|
|
7138
8298
|
_react.useEffect.call(void 0, () => {
|
|
@@ -7153,7 +8313,7 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
7153
8313
|
setContentType(null);
|
|
7154
8314
|
}
|
|
7155
8315
|
}, [file]);
|
|
7156
|
-
const canChangeRoles = !(_optionalChain([currentUser, 'optionalAccess',
|
|
8316
|
+
const canChangeRoles = !(_optionalChain([currentUser, 'optionalAccess', _266 => _266.id]) === _optionalChain([user, 'optionalAccess', _267 => _267.id]) && hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)) && (hasPermissionToModule({ module: _chunkQ4FXESVTjs.Modules.User, action: "update" /* Update */ }) || hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator));
|
|
7157
8317
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5IET37O4js.Dialog, { open, onOpenChange: setOpen, children: [
|
|
7158
8318
|
trigger ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.DialogTrigger, { asChild: true, children: trigger }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CommonEditorTrigger, { isEdit: !!user }),
|
|
7159
8319
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -7161,7 +8321,7 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
7161
8321
|
{
|
|
7162
8322
|
className: `flex max-h-[70vh] ${canChangeRoles ? `max-w-[90vw]` : `max-w-3xl`} min-h-3xl max-h-[90vh] flex-col overflow-y-auto`,
|
|
7163
8323
|
children: [
|
|
7164
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CommonEditorHeader, { type: t(`types.users`, { count: 1 }), name: _optionalChain([user, 'optionalAccess',
|
|
8324
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CommonEditorHeader, { type: t(`types.users`, { count: 1 }), name: _optionalChain([user, 'optionalAccess', _268 => _268.name]) }),
|
|
7165
8325
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: `flex w-full flex-col gap-y-4`, children: [
|
|
7166
8326
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex flex-row gap-x-4`, children: [
|
|
7167
8327
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `flex w-40 flex-col justify-start gap-y-2`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -7247,10 +8407,10 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
7247
8407
|
] })
|
|
7248
8408
|
] }),
|
|
7249
8409
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-4", children: [
|
|
7250
|
-
user && _optionalChain([currentUser, 'optionalAccess',
|
|
8410
|
+
user && _optionalChain([currentUser, 'optionalAccess', _269 => _269.roles, 'access', _270 => _270.find, 'call', _271 => _271((role) => role.id === _chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7251
8411
|
UserDeleter,
|
|
7252
8412
|
{
|
|
7253
|
-
companyId: _optionalChain([user, 'access',
|
|
8413
|
+
companyId: _optionalChain([user, 'access', _272 => _272.company, 'optionalAccess', _273 => _273.id]),
|
|
7254
8414
|
user,
|
|
7255
8415
|
onDeleted: () => {
|
|
7256
8416
|
setOpen(false);
|
|
@@ -7309,9 +8469,9 @@ function UserMultiSelect({
|
|
|
7309
8469
|
const data = useDataListRetriever({
|
|
7310
8470
|
ready: !!company,
|
|
7311
8471
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
|
|
7312
|
-
return
|
|
8472
|
+
return UserService.findAllUsers(params);
|
|
7313
8473
|
}, "retriever"),
|
|
7314
|
-
retrieverParams: { companyId: _optionalChain([company, 'optionalAccess',
|
|
8474
|
+
retrieverParams: { companyId: _optionalChain([company, 'optionalAccess', _274 => _274.id]) },
|
|
7315
8475
|
module: _chunkQ4FXESVTjs.Modules.User
|
|
7316
8476
|
});
|
|
7317
8477
|
_react.useEffect.call(void 0, () => {
|
|
@@ -7338,7 +8498,7 @@ function UserMultiSelect({
|
|
|
7338
8498
|
_react.useEffect.call(void 0, () => {
|
|
7339
8499
|
if (data.data && data.data.length > 0) {
|
|
7340
8500
|
const users = data.data;
|
|
7341
|
-
const filteredUsers = users.filter((user) => user.id !== _optionalChain([currentUser, 'optionalAccess',
|
|
8501
|
+
const filteredUsers = users.filter((user) => user.id !== _optionalChain([currentUser, 'optionalAccess', _275 => _275.id]));
|
|
7342
8502
|
const options = filteredUsers.map((user) => ({
|
|
7343
8503
|
label: user.name,
|
|
7344
8504
|
value: user.id,
|
|
@@ -7369,7 +8529,7 @@ function UserMultiSelect({
|
|
|
7369
8529
|
return existingUser;
|
|
7370
8530
|
}
|
|
7371
8531
|
const option = userOptions.find((option2) => option2.value === id2);
|
|
7372
|
-
if (_optionalChain([option, 'optionalAccess',
|
|
8532
|
+
if (_optionalChain([option, 'optionalAccess', _276 => _276.userData])) {
|
|
7373
8533
|
return {
|
|
7374
8534
|
id: option.userData.id,
|
|
7375
8535
|
name: option.userData.name,
|
|
@@ -7380,7 +8540,7 @@ function UserMultiSelect({
|
|
|
7380
8540
|
});
|
|
7381
8541
|
form.setValue(id, updatedSelectedUsers);
|
|
7382
8542
|
if (onChange) {
|
|
7383
|
-
const fullSelectedUsers = selectedIds.map((id2) => _optionalChain([userOptions, 'access',
|
|
8543
|
+
const fullSelectedUsers = selectedIds.map((id2) => _optionalChain([userOptions, 'access', _277 => _277.find, 'call', _278 => _278((option) => option.value === id2), 'optionalAccess', _279 => _279.userData])).filter(Boolean);
|
|
7384
8544
|
onChange(fullSelectedUsers);
|
|
7385
8545
|
}
|
|
7386
8546
|
}, "handleValueChange");
|
|
@@ -7423,7 +8583,7 @@ function UserReactivatorInterface({ user, propagateChanges }) {
|
|
|
7423
8583
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
7424
8584
|
const reactivateUser = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
7425
8585
|
try {
|
|
7426
|
-
const updatedUser = await
|
|
8586
|
+
const updatedUser = await UserService.reactivate({ userId: user.id });
|
|
7427
8587
|
setOpen(false);
|
|
7428
8588
|
propagateChanges(updatedUser);
|
|
7429
8589
|
} catch (error) {
|
|
@@ -7477,7 +8637,7 @@ function UserResentInvitationEmailInternal({ user }) {
|
|
|
7477
8637
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
7478
8638
|
const sendInvitationEmail = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
7479
8639
|
try {
|
|
7480
|
-
await
|
|
8640
|
+
await UserService.sendInvitation({ userId: user.id, companyId: user.company.id });
|
|
7481
8641
|
setOpen(false);
|
|
7482
8642
|
_sonner.toast.message(t(`foundations.user.resend_activation.email_sent`), {
|
|
7483
8643
|
description: t(`foundations.user.resend_activation.email_sent_description`, { email: user.email })
|
|
@@ -7535,7 +8695,7 @@ function UserSelector({ id, form, label, placeholder, onChange, isRequired = fal
|
|
|
7535
8695
|
const [isSearching, setIsSearching] = _react.useState.call(void 0, false);
|
|
7536
8696
|
const data = useDataListRetriever({
|
|
7537
8697
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
|
|
7538
|
-
return
|
|
8698
|
+
return UserService.findMany(params);
|
|
7539
8699
|
}, "retriever"),
|
|
7540
8700
|
retrieverParams: {},
|
|
7541
8701
|
module: _chunkQ4FXESVTjs.Modules.User
|
|
@@ -7585,10 +8745,10 @@ function UserSelector({ id, form, label, placeholder, onChange, isRequired = fal
|
|
|
7585
8745
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-row items-center justify-between", children: [
|
|
7586
8746
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.PopoverTrigger, { className: "w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-row items-center justify-start rounded-md", children: field.value ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-row items-center justify-start rounded-md border p-2", children: [
|
|
7587
8747
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "*:ring-border *:ring-1", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5IET37O4js.Avatar, { className: `mr-2 h-6 w-6`, children: [
|
|
7588
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.AvatarImage, { src: _optionalChain([field, 'access',
|
|
7589
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.AvatarFallback, { children: _optionalChain([field, 'access',
|
|
8748
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.AvatarImage, { src: _optionalChain([field, 'access', _280 => _280.value, 'optionalAccess', _281 => _281.avatar]) }),
|
|
8749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5IET37O4js.AvatarFallback, { children: _optionalChain([field, 'access', _282 => _282.value, 'optionalAccess', _283 => _283.name]) ? _optionalChain([field, 'access', _284 => _284.value, 'optionalAccess', _285 => _285.name, 'access', _286 => _286.split, 'call', _287 => _287(" "), 'access', _288 => _288.map, 'call', _289 => _289((name) => name.charAt(0).toUpperCase())]) : "X" })
|
|
7590
8750
|
] }) }),
|
|
7591
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "", children: _nullishCoalesce(_optionalChain([field, 'access',
|
|
8751
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "", children: _nullishCoalesce(_optionalChain([field, 'access', _290 => _290.value, 'optionalAccess', _291 => _291.name]), () => ( "")) })
|
|
7592
8752
|
] }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mr-7 flex h-10 w-full flex-row items-center justify-start rounded-md border p-2 text-sm", children: _nullishCoalesce(placeholder, () => ( t(`generic.search.placeholder`, { type: t(`types.users`, { count: 1 }) }))) }) }) }),
|
|
7593
8753
|
field.value && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7594
8754
|
_lucidereact.CircleX,
|
|
@@ -7633,74 +8793,227 @@ function UserSelector({ id, form, label, placeholder, onChange, isRequired = fal
|
|
|
7633
8793
|
}
|
|
7634
8794
|
) });
|
|
7635
8795
|
}
|
|
7636
|
-
_chunk7QVYU63Ejs.__name.call(void 0, UserSelector, "UserSelector");
|
|
8796
|
+
_chunk7QVYU63Ejs.__name.call(void 0, UserSelector, "UserSelector");
|
|
8797
|
+
|
|
8798
|
+
// src/features/user/user.module.ts
|
|
8799
|
+
var UserModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
8800
|
+
pageUrl: "/users",
|
|
8801
|
+
name: "users",
|
|
8802
|
+
model: User,
|
|
8803
|
+
moduleId: "04cfc677-0fd2-4f5e-adf4-2483a00c0277",
|
|
8804
|
+
inclusions: {
|
|
8805
|
+
lists: {
|
|
8806
|
+
fields: [
|
|
8807
|
+
_chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "users", [`name`, `email`, `avatar`, `title`]),
|
|
8808
|
+
_chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "usertopics", [`level`]),
|
|
8809
|
+
_chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "userexpertises", [`level`]),
|
|
8810
|
+
_chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "topics", [`name`])
|
|
8811
|
+
]
|
|
8812
|
+
}
|
|
8813
|
+
}
|
|
8814
|
+
}), "UserModule");
|
|
8815
|
+
|
|
8816
|
+
// src/hooks/usePushNotifications.ts
|
|
8817
|
+
function urlBase64ToUint8Array(base64String) {
|
|
8818
|
+
const padding = "=".repeat((4 - base64String.length % 4) % 4);
|
|
8819
|
+
const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
|
|
8820
|
+
const rawData = window.atob(base64);
|
|
8821
|
+
const outputArray = new Uint8Array(rawData.length);
|
|
8822
|
+
for (let i = 0; i < rawData.length; i++) {
|
|
8823
|
+
outputArray[i] = rawData.charCodeAt(i);
|
|
8824
|
+
}
|
|
8825
|
+
return outputArray;
|
|
8826
|
+
}
|
|
8827
|
+
_chunk7QVYU63Ejs.__name.call(void 0, urlBase64ToUint8Array, "urlBase64ToUint8Array");
|
|
8828
|
+
function usePushNotifications() {
|
|
8829
|
+
const { currentUser, hasRole } = useCurrentUserContext();
|
|
8830
|
+
_react.useEffect.call(void 0, () => {
|
|
8831
|
+
const register = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
8832
|
+
if ("serviceWorker" in navigator && "PushManager" in window) {
|
|
8833
|
+
try {
|
|
8834
|
+
const sessionKey = `push_registered_${_optionalChain([currentUser, 'optionalAccess', _292 => _292.id])}`;
|
|
8835
|
+
const lastRegisteredSubscription = sessionStorage.getItem(sessionKey);
|
|
8836
|
+
const registration = await navigator.serviceWorker.register(`${_chunkPMXG5WBCjs.getAppUrl.call(void 0, )}/sw.js`);
|
|
8837
|
+
let permission = Notification.permission;
|
|
8838
|
+
if (permission === "default") {
|
|
8839
|
+
permission = await Notification.requestPermission();
|
|
8840
|
+
}
|
|
8841
|
+
if (permission !== "granted") {
|
|
8842
|
+
return;
|
|
8843
|
+
}
|
|
8844
|
+
const vapidPublicKey = (process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY || "").trim();
|
|
8845
|
+
const convertedKey = urlBase64ToUint8Array(vapidPublicKey);
|
|
8846
|
+
await navigator.serviceWorker.ready;
|
|
8847
|
+
let subscription = await registration.pushManager.getSubscription();
|
|
8848
|
+
if (!subscription) {
|
|
8849
|
+
const appServerKey = new Uint8Array(Array.from(convertedKey));
|
|
8850
|
+
subscription = await registration.pushManager.subscribe({
|
|
8851
|
+
userVisibleOnly: true,
|
|
8852
|
+
applicationServerKey: appServerKey
|
|
8853
|
+
});
|
|
8854
|
+
}
|
|
8855
|
+
const plainSubscription = {
|
|
8856
|
+
endpoint: subscription.endpoint,
|
|
8857
|
+
keys: subscription.toJSON().keys
|
|
8858
|
+
};
|
|
8859
|
+
const subscriptionHash = btoa(JSON.stringify(plainSubscription));
|
|
8860
|
+
if (lastRegisteredSubscription !== subscriptionHash) {
|
|
8861
|
+
await PushService.register({ data: plainSubscription });
|
|
8862
|
+
sessionStorage.setItem(sessionKey, subscriptionHash);
|
|
8863
|
+
}
|
|
8864
|
+
} catch (error) {
|
|
8865
|
+
console.error("Error during service worker registration or push subscription:", error);
|
|
8866
|
+
}
|
|
8867
|
+
}
|
|
8868
|
+
}, "register");
|
|
8869
|
+
if (currentUser && !hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator)) register();
|
|
8870
|
+
}, [currentUser]);
|
|
8871
|
+
}
|
|
8872
|
+
_chunk7QVYU63Ejs.__name.call(void 0, usePushNotifications, "usePushNotifications");
|
|
7637
8873
|
|
|
7638
|
-
// src/
|
|
8874
|
+
// src/hooks/useSocket.ts
|
|
7639
8875
|
|
|
7640
|
-
var
|
|
7641
|
-
|
|
7642
|
-
const
|
|
7643
|
-
const
|
|
7644
|
-
const
|
|
7645
|
-
const [
|
|
7646
|
-
|
|
7647
|
-
);
|
|
7648
|
-
const
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
8876
|
+
var _socketioclient = require('socket.io-client'); var _socketioclient2 = _interopRequireDefault(_socketioclient);
|
|
8877
|
+
function useSocket({ token }) {
|
|
8878
|
+
const _errorCount = _react.useRef.call(void 0, 0);
|
|
8879
|
+
const shouldConnect = _react.useRef.call(void 0, true);
|
|
8880
|
+
const _hookInstanceId = _react.useRef.call(void 0, Math.random().toString(36).substring(2, 11));
|
|
8881
|
+
const [socket, setSocket] = _react.useState.call(void 0, null);
|
|
8882
|
+
const [isConnected, setIsConnected] = _react.useState.call(void 0, false);
|
|
8883
|
+
const [messages, setMessages] = _react.useState.call(void 0, []);
|
|
8884
|
+
const [socketNotifications, setSocketNotifications] = _react.useState.call(void 0, []);
|
|
8885
|
+
const socketRef = _react.useRef.call(void 0, null);
|
|
8886
|
+
_react.useEffect.call(void 0, () => {
|
|
8887
|
+
if (!token) return;
|
|
8888
|
+
const globalSocketKey = `__socket_${_optionalChain([process, 'access', _293 => _293.env, 'access', _294 => _294.NEXT_PUBLIC_API_URL, 'optionalAccess', _295 => _295.replace, 'call', _296 => _296(/[^a-zA-Z0-9]/g, "_")])}`;
|
|
8889
|
+
if (typeof window !== "undefined") {
|
|
8890
|
+
const _allSocketKeys = Object.keys(window).filter((key) => key.startsWith("__socket_"));
|
|
8891
|
+
const existingSocket = window[globalSocketKey];
|
|
8892
|
+
if (existingSocket) {
|
|
8893
|
+
if (existingSocket.connected) {
|
|
8894
|
+
existingSocket.removeAllListeners();
|
|
8895
|
+
socketRef.current = existingSocket;
|
|
8896
|
+
setSocket(existingSocket);
|
|
8897
|
+
setIsConnected(existingSocket.connected);
|
|
8898
|
+
} else {
|
|
8899
|
+
existingSocket.disconnect();
|
|
8900
|
+
delete window[globalSocketKey];
|
|
8901
|
+
}
|
|
8902
|
+
}
|
|
7659
8903
|
}
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
8904
|
+
let currentSocket;
|
|
8905
|
+
const isReusing = socketRef.current && socketRef.current.connected;
|
|
8906
|
+
if (isReusing) {
|
|
8907
|
+
currentSocket = socketRef.current;
|
|
8908
|
+
} else {
|
|
8909
|
+
if (!shouldConnect.current) {
|
|
8910
|
+
return;
|
|
8911
|
+
}
|
|
8912
|
+
shouldConnect.current = false;
|
|
8913
|
+
try {
|
|
8914
|
+
currentSocket = _socketioclient2.default.call(void 0, process.env.NEXT_PUBLIC_API_URL, {
|
|
8915
|
+
auth: { token },
|
|
8916
|
+
transports: ["websocket"],
|
|
8917
|
+
timeout: 2e4
|
|
8918
|
+
});
|
|
8919
|
+
if (typeof window !== "undefined") {
|
|
8920
|
+
if (currentSocket.id && currentSocket.id !== "undefined") {
|
|
8921
|
+
window[globalSocketKey] = currentSocket;
|
|
8922
|
+
}
|
|
8923
|
+
}
|
|
8924
|
+
socketRef.current = currentSocket;
|
|
8925
|
+
setSocket(currentSocket);
|
|
8926
|
+
} catch (e4) {
|
|
8927
|
+
return () => {
|
|
8928
|
+
};
|
|
8929
|
+
}
|
|
8930
|
+
}
|
|
8931
|
+
const handleConnect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
8932
|
+
setIsConnected(true);
|
|
8933
|
+
}, "handleConnect");
|
|
8934
|
+
const handleDisconnect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
8935
|
+
setIsConnected(false);
|
|
8936
|
+
}, "handleDisconnect");
|
|
8937
|
+
const handleMessage = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (data) => {
|
|
8938
|
+
setMessages((prevMessages) => {
|
|
8939
|
+
const newMessages = [...prevMessages, data];
|
|
8940
|
+
return newMessages;
|
|
7664
8941
|
});
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
response.element = `${user.name}${user.isDeleted ? ` (${t(`foundations.user.deleted`)})` : ""}`;
|
|
7674
|
-
if (user.isDeleted) {
|
|
7675
|
-
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserReactivator, { user, propagateChanges: setUser }, `UserReactivator`));
|
|
7676
|
-
} else {
|
|
7677
|
-
if (!user.isActivated)
|
|
7678
|
-
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserResentInvitationEmail, { user }, `UserResentInvitationEmail`));
|
|
7679
|
-
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserDeleter, { user }, `UserDeleter`));
|
|
8942
|
+
}, "handleMessage");
|
|
8943
|
+
const handleNotification = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (data) => {
|
|
8944
|
+
const notification = _chunkQ4FXESVTjs.rehydrate.call(void 0, _chunkQ4FXESVTjs.Modules.Notification, data);
|
|
8945
|
+
if (notification) {
|
|
8946
|
+
setSocketNotifications((prev) => {
|
|
8947
|
+
const newNotifications = [...prev, notification];
|
|
8948
|
+
return newNotifications;
|
|
8949
|
+
});
|
|
7680
8950
|
}
|
|
7681
|
-
|
|
8951
|
+
}, "handleNotification");
|
|
8952
|
+
if (currentSocket) {
|
|
8953
|
+
currentSocket.on("connect", handleConnect);
|
|
8954
|
+
currentSocket.on("disconnect", handleDisconnect);
|
|
8955
|
+
currentSocket.on("message", handleMessage);
|
|
8956
|
+
currentSocket.on("notification", handleNotification);
|
|
7682
8957
|
}
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
8958
|
+
return () => {
|
|
8959
|
+
shouldConnect.current = true;
|
|
8960
|
+
if (currentSocket) {
|
|
8961
|
+
if (process.env.NODE_ENV === "development") {
|
|
8962
|
+
currentSocket.off("connect", handleConnect);
|
|
8963
|
+
currentSocket.off("disconnect", handleDisconnect);
|
|
8964
|
+
currentSocket.off("message", handleMessage);
|
|
8965
|
+
currentSocket.off("notification", handleNotification);
|
|
8966
|
+
} else {
|
|
8967
|
+
currentSocket.off("connect", handleConnect);
|
|
8968
|
+
currentSocket.off("disconnect", handleDisconnect);
|
|
8969
|
+
currentSocket.off("message", handleMessage);
|
|
8970
|
+
currentSocket.off("notification", handleNotification);
|
|
8971
|
+
currentSocket.disconnect();
|
|
8972
|
+
if (typeof window !== "undefined") {
|
|
8973
|
+
delete window[globalSocketKey];
|
|
8974
|
+
}
|
|
8975
|
+
}
|
|
8976
|
+
}
|
|
8977
|
+
};
|
|
8978
|
+
}, [token]);
|
|
8979
|
+
const sendMessage = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (event, data) => {
|
|
8980
|
+
if (socketRef.current && isConnected) {
|
|
8981
|
+
socketRef.current.emit(event, data);
|
|
7694
8982
|
}
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
8983
|
+
}, "sendMessage");
|
|
8984
|
+
const removeMessage = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (index) => {
|
|
8985
|
+
setMessages((prevMessages) => {
|
|
8986
|
+
const newMessages = [...prevMessages];
|
|
8987
|
+
newMessages.splice(index, 1);
|
|
8988
|
+
return newMessages;
|
|
8989
|
+
});
|
|
8990
|
+
}, "removeMessage");
|
|
8991
|
+
const removeSocketNotification = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (index) => {
|
|
8992
|
+
setSocketNotifications((prevNotifications) => {
|
|
8993
|
+
const newNotifications = [...prevNotifications];
|
|
8994
|
+
newNotifications.splice(index, 1);
|
|
8995
|
+
return newNotifications;
|
|
8996
|
+
});
|
|
8997
|
+
}, "removeSocketNotification");
|
|
8998
|
+
const clearMessages = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
8999
|
+
setMessages([]);
|
|
9000
|
+
}, "clearMessages");
|
|
9001
|
+
const clearSocketNotifications = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
9002
|
+
setSocketNotifications([]);
|
|
9003
|
+
}, "clearSocketNotifications");
|
|
9004
|
+
return {
|
|
9005
|
+
socket,
|
|
9006
|
+
isConnected,
|
|
9007
|
+
messages,
|
|
9008
|
+
socketNotifications,
|
|
9009
|
+
sendMessage,
|
|
9010
|
+
removeMessage,
|
|
9011
|
+
removeSocketNotification,
|
|
9012
|
+
clearMessages,
|
|
9013
|
+
clearSocketNotifications
|
|
9014
|
+
};
|
|
9015
|
+
}
|
|
9016
|
+
_chunk7QVYU63Ejs.__name.call(void 0, useSocket, "useSocket");
|
|
7704
9017
|
|
|
7705
9018
|
// src/features/company/contexts/CompanyContext.tsx
|
|
7706
9019
|
|
|
@@ -7732,9 +9045,9 @@ var CompanyProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
7732
9045
|
};
|
|
7733
9046
|
if (company) response.element = company.name;
|
|
7734
9047
|
const functions = [];
|
|
7735
|
-
if (company && hasRole(
|
|
9048
|
+
if (company && hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator) && hasPermissionToModule({ module: _chunkQ4FXESVTjs.Modules.Company, action: "delete" /* Delete */ }))
|
|
7736
9049
|
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompanyDeleter, { company }, "companyDeleter"));
|
|
7737
|
-
if (hasRole(
|
|
9050
|
+
if (hasRole(_chunk3UELCPINjs.getRoleId.call(void 0, ).Administrator) || hasPermissionToModule({ module: _chunkQ4FXESVTjs.Modules.Company, action: "update" /* Update */ })) {
|
|
7738
9051
|
if (company) functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompanyConfigurationEditor, { company }, "companyConfigurationEditor"));
|
|
7739
9052
|
functions.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompanyEditor, { company, propagateChanges: setCompany }, "companyEditor"));
|
|
7740
9053
|
}
|
|
@@ -7979,5 +9292,41 @@ var useSocketContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () =
|
|
|
7979
9292
|
|
|
7980
9293
|
|
|
7981
9294
|
|
|
7982
|
-
|
|
7983
|
-
|
|
9295
|
+
|
|
9296
|
+
|
|
9297
|
+
|
|
9298
|
+
|
|
9299
|
+
|
|
9300
|
+
|
|
9301
|
+
|
|
9302
|
+
|
|
9303
|
+
|
|
9304
|
+
|
|
9305
|
+
|
|
9306
|
+
|
|
9307
|
+
|
|
9308
|
+
|
|
9309
|
+
|
|
9310
|
+
|
|
9311
|
+
|
|
9312
|
+
|
|
9313
|
+
|
|
9314
|
+
|
|
9315
|
+
|
|
9316
|
+
|
|
9317
|
+
|
|
9318
|
+
|
|
9319
|
+
|
|
9320
|
+
|
|
9321
|
+
|
|
9322
|
+
|
|
9323
|
+
|
|
9324
|
+
|
|
9325
|
+
|
|
9326
|
+
|
|
9327
|
+
|
|
9328
|
+
|
|
9329
|
+
|
|
9330
|
+
|
|
9331
|
+
exports.TableGeneratorRegistry = TableGeneratorRegistry; exports.tableGeneratorRegistry = tableGeneratorRegistry; exports.usePageUrlGenerator = usePageUrlGenerator; exports.useUrlRewriter = useUrlRewriter; exports.useDataListRetriever = useDataListRetriever; exports.useDebounce = useDebounce; exports.registerTableGenerator = registerTableGenerator; exports.useTableGenerator = useTableGenerator; exports.useCustomD3Graph = useCustomD3Graph; exports.CurrentUserProvider = CurrentUserProvider; exports.useCurrentUserContext = useCurrentUserContext; exports.Role = Role; exports.RoleFields = RoleFields; exports.RoleService = RoleService; exports.RoleModule = RoleModule; exports.User = User; exports.UserFields = UserFields; exports.UserService = UserService; exports.AddUserToRole = AddUserToRole; exports.UserAvatarEditor = UserAvatarEditor; exports.UserDeleter = UserDeleter; exports.S3 = S3; exports.S3Module = S3Module; exports.S3Service = S3Service; exports.UserEditor = UserEditor; exports.UserMultiSelect = UserMultiSelect; exports.UserReactivator = UserReactivator; exports.UserResentInvitationEmail = UserResentInvitationEmail; exports.UserAvatar = UserAvatar; exports.UserSelector = UserSelector; exports.UserProvider = UserProvider; exports.useUserContext = useUserContext; exports.UserDetails = UserDetails; exports.UserIndexDetails = UserIndexDetails; exports.UserContainer = UserContainer; exports.UserIndexContainer = UserIndexContainer; exports.UsersListContainer = UsersListContainer; exports.AdminUsersList = AdminUsersList; exports.CompanyUsersList = CompanyUsersList; exports.ContributorsList = ContributorsList; exports.RelevantUsersList = RelevantUsersList; exports.RoleUsersList = RoleUsersList; exports.UserListInAdd = UserListInAdd; exports.UsersList = UsersList; exports.UsersListByContentIds = UsersListByContentIds; exports.CompanyDetails = CompanyDetails; exports.AdminCompanyContainer = AdminCompanyContainer; exports.CompanyContainer = CompanyContainer; exports.AuthorModule = AuthorModule; exports.UserModule = UserModule; exports.Company = Company; exports.CompanyFields = CompanyFields; exports.CompanyService = CompanyService; exports.CompanyConfigurationSecurityForm = CompanyConfigurationSecurityForm; exports.CompanyConfigurationEditor = CompanyConfigurationEditor; exports.CompanyDeleter = CompanyDeleter; exports.Feature = Feature; exports.FeatureModule = FeatureModule; exports.FeatureService = FeatureService; exports.CompanyEditor = CompanyEditor; exports.CompaniesList = CompaniesList; exports.CompanyProvider = CompanyProvider; exports.useCompanyContext = useCompanyContext; exports.generateNotificationData = generateNotificationData; exports.NotificationToast = NotificationToast; exports.NotificationMenuItem = NotificationMenuItem; exports.Notification = Notification2; exports.NotificationFields = NotificationFields; exports.NotificationService = NotificationService; exports.NotificationContextProvider = NotificationContextProvider; exports.useNotificationContext = useNotificationContext; exports.RoleProvider = RoleProvider; exports.useRoleContext = useRoleContext; exports.SharedProvider = SharedProvider; exports.useSharedContext = useSharedContext; exports.CommonProvider = CommonProvider; exports.useCommonContext = useCommonContext; exports.SocketContext = SocketContext; exports.SocketProvider = SocketProvider; exports.useSocketContext = useSocketContext; exports.useNotificationSync = useNotificationSync; exports.usePageTracker = usePageTracker; exports.AuthModule = AuthModule; exports.Auth = Auth; exports.AuthService = AuthService; exports.AuthComponent = AuthComponent; exports.CompanyModule = CompanyModule; exports.ContentModule = ContentModule; exports.Content = Content; exports.ContentFields = ContentFields; exports.ContentService = ContentService; exports.Module = Module; exports.ModuleModule = ModuleModule; exports.NotificationModule = NotificationModule; exports.Push = Push; exports.PushModule = PushModule; exports.PushService = PushService; exports.useSocket = useSocket; exports.Breadcrumb = Breadcrumb2; exports.ContentTitle = ContentTitle; exports.Header = Header; exports.ModeToggleSwitch = ModeToggleSwitch; exports.PageSection = PageSection; exports.RecentPagesNavigator = RecentPagesNavigator; exports.PageContainer = PageContainer; exports.ReactMarkdownContainer = ReactMarkdownContainer; exports.TabsContainer = TabsContainer; exports.AttributeElement = AttributeElement; exports.AllowedUsersDetails = AllowedUsersDetails; exports.ErrorDetails = ErrorDetails; exports.errorToast = errorToast; exports.BlockNoteEditorContainer = BlockNoteEditorContainer; exports.CommonAssociationTrigger = CommonAssociationTrigger; exports.CommonAssociationCommandDialog = CommonAssociationCommandDialog; exports.triggerAssociationToast = triggerAssociationToast; exports.CommonDeleter = CommonDeleter; exports.CommonEditorButtons = CommonEditorButtons; exports.CommonEditorHeader = CommonEditorHeader; exports.CommonEditorTrigger = CommonEditorTrigger; exports.DatePickerPopover = DatePickerPopover; exports.DateRangeSelector = DateRangeSelector; exports.useFileUpload = useFileUpload; exports.FileUploader = FileUploader; exports.FileUploaderContent = FileUploaderContent; exports.FileUploaderItem = FileUploaderItem; exports.FileInput = FileInput; exports.FormCheckbox = FormCheckbox; exports.FormContainerGeneric = FormContainerGeneric; exports.FormDate = FormDate; exports.FormDateTime = FormDateTime; exports.FormInput = FormInput; exports.PasswordInput = PasswordInput; exports.FormPassword = FormPassword; exports.FormPlaceAutocomplete = FormPlaceAutocomplete; exports.FormSelect = FormSelect; exports.FormSlider = FormSlider; exports.FormSwitch = FormSwitch; exports.FormTextarea = FormTextarea; exports.FormFeatures = FormFeatures; exports.PageContainerContentDetails = PageContainerContentDetails; exports.PageContentContainer = PageContentContainer; exports.cellComponent = cellComponent; exports.cellDate = cellDate; exports.cellId = cellId; exports.cellLink = cellLink; exports.cellUrl = cellUrl; exports.JsonApiContext = JsonApiContext; exports.useJsonApiConfig = useJsonApiConfig; exports.useJsonApiConfigOptional = useJsonApiConfigOptional; exports.JsonApiProvider = JsonApiProvider; exports.useJsonApiGet = useJsonApiGet; exports.useJsonApiMutation = useJsonApiMutation; exports.useRehydration = useRehydration; exports.useRehydrationList = useRehydrationList; exports.useRoleTableStructure = useRoleTableStructure; exports.useUserSearch = useUserSearch; exports.useUserTableStructure = useUserTableStructure; exports.useContentTableStructure = useContentTableStructure; exports.ContentTableSearch = ContentTableSearch; exports.ContentListTable = ContentListTable; exports.AuthContainer = AuthContainer; exports.LandingComponent = LandingComponent; exports.AcceptInvitation = AcceptInvitation; exports.ActivateAccount = ActivateAccount; exports.Cookies = Cookies; exports.ForgotPassword = ForgotPassword; exports.Login = Login; exports.Logout = Logout; exports.RefreshUser = RefreshUser; exports.ResetPassword = ResetPassword; exports.ContentsList = ContentsList; exports.ContentsListById = ContentsListById; exports.RelevantContentsList = RelevantContentsList; exports.NotificationErrorBoundary = NotificationErrorBoundary; exports.NotificationsList = NotificationsList; exports.NotificationsListContainer = NotificationsListContainer; exports.NotificationModal = NotificationModal; exports.PushNotificationProvider = PushNotificationProvider; exports.RoleDetails = RoleDetails; exports.RoleContainer = RoleContainer; exports.FormRoles = FormRoles; exports.RemoveUserFromRole = RemoveUserFromRole; exports.UserRoleAdd = UserRoleAdd; exports.RolesList = RolesList; exports.UserRolesList = UserRolesList;
|
|
9332
|
+
//# sourceMappingURL=chunk-VET55IZO.js.map
|