@foxford/sdk 6.1.2 → 6.2.1

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/entities.js ADDED
@@ -0,0 +1,419 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ // src/entities/user/constants.ts
22
+ var GRADE_MAP = {
23
+ 1: "1 \u043A\u043B\u0430\u0441\u0441",
24
+ 2: "2 \u043A\u043B\u0430\u0441\u0441",
25
+ 3: "3 \u043A\u043B\u0430\u0441\u0441",
26
+ 4: "4 \u043A\u043B\u0430\u0441\u0441",
27
+ 5: "5 \u043A\u043B\u0430\u0441\u0441",
28
+ 6: "6 \u043A\u043B\u0430\u0441\u0441",
29
+ 7: "7 \u043A\u043B\u0430\u0441\u0441",
30
+ 8: "8 \u043A\u043B\u0430\u0441\u0441",
31
+ 9: "9 \u043A\u043B\u0430\u0441\u0441",
32
+ 10: "10 \u043A\u043B\u0430\u0441\u0441",
33
+ 11: "11 \u043A\u043B\u0430\u0441\u0441"
34
+ };
35
+ var DEFAULT_USER = {
36
+ address: {
37
+ building: null,
38
+ cityId: null,
39
+ cityName: null,
40
+ countryId: null,
41
+ countryName: null,
42
+ house: null,
43
+ index: null,
44
+ regionId: null,
45
+ regionName: null,
46
+ room: null,
47
+ street: null
48
+ },
49
+ avatarUrl: "",
50
+ bonus: {
51
+ giftAmount: 0,
52
+ realMoneyAmount: 0
53
+ },
54
+ bonusAmount: 0,
55
+ cartItemsCount: 0,
56
+ cartTemplateId: null,
57
+ createdAt: null,
58
+ disciplineIds: [],
59
+ email: "",
60
+ emailConfirmed: false,
61
+ externshipUser: false,
62
+ fakeEmail: false,
63
+ fakeUser: false,
64
+ firstName: "",
65
+ freeAccessFinishesAt: null,
66
+ fullName: "",
67
+ grade: {
68
+ id: null,
69
+ index: null,
70
+ name: "",
71
+ translit: ""
72
+ },
73
+ gradeChecked: false,
74
+ hasAccessToAttestationSheets: false,
75
+ hasAccessToMultiDaysStreaks: false,
76
+ hasActivePurchases: false,
77
+ hasAttemptsSolveExamRehearsals: false,
78
+ hasBookmarks: false,
79
+ hasExternshipAttestationAccess: false,
80
+ hasPurchasedExternshipContracts: false,
81
+ id: null,
82
+ isAgent: false,
83
+ isCoach: false,
84
+ isCustomer: null,
85
+ isElementaryPupil: false,
86
+ isExternshipCoach: false,
87
+ isGraduated: false,
88
+ isMiniGroupTeacher: false,
89
+ isParent: false,
90
+ lastName: "",
91
+ locale: null,
92
+ methodist: false,
93
+ middleName: "",
94
+ onboardingFinished: false,
95
+ onboardingFinishedAt: null,
96
+ parentPhone: null,
97
+ parentPhoneConfirmed: false,
98
+ phone: null,
99
+ phoneConfirmed: false,
100
+ privacy: {
101
+ publicProfile: false
102
+ },
103
+ profileEnriched: false,
104
+ purchaseAnyExternshipContracts: false,
105
+ recapUuid: null,
106
+ shortName: "",
107
+ skype: null,
108
+ socialNets: [],
109
+ socializationProfile: null,
110
+ tags: null,
111
+ timezone: null,
112
+ type: null,
113
+ webSocketNotificationsJwt: null
114
+ };
115
+
116
+ // src/entities/user/index.ts
117
+ var _User = class _User {
118
+ constructor(props, isDefault = false) {
119
+ this.props = props;
120
+ this.isDefault = isDefault;
121
+ /**
122
+ * Возвращает роль пользователя
123
+ * @returns {UserRole} роль как строка
124
+ */
125
+ this.getRole = () => {
126
+ if (this.isCoach) return "\u0420\u0435\u043F\u0435\u0442\u0438\u0442\u043E\u0440";
127
+ if (this.isAgent) return "\u0423\u0447\u0438\u0442\u0435\u043B\u044C";
128
+ if (this.isParent) return "\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C";
129
+ switch (this.type) {
130
+ case "pupil":
131
+ return this.getPupilRole();
132
+ case "agent":
133
+ return "\u0423\u0447\u0438\u0442\u0435\u043B\u044C";
134
+ default:
135
+ return "\u0423\u0447\u0435\u043D\u0438\u043A";
136
+ }
137
+ };
138
+ /**
139
+ * Возвращает фамилию и инициалы юзера
140
+ * @param {User} user
141
+ * @return {string} 'Пупкин В.'
142
+ */
143
+ this.getInitials = () => {
144
+ var _a, _b;
145
+ return `${this.lastName}${this.firstName ? ` ${(_a = this.firstName[0]) == null ? void 0 : _a.toUpperCase()}.` : ""}${this.middleName !== "" && this.middleName !== null ? ` ${(_b = this.middleName[0]) == null ? void 0 : _b.toUpperCase()}.` : ""}`;
146
+ };
147
+ }
148
+ get id() {
149
+ return this.props.id;
150
+ }
151
+ get email() {
152
+ return this.props.email;
153
+ }
154
+ get firstName() {
155
+ return this.props.firstName;
156
+ }
157
+ get middleName() {
158
+ return this.props.middleName;
159
+ }
160
+ get lastName() {
161
+ return this.props.lastName;
162
+ }
163
+ get fullName() {
164
+ return this.props.fullName;
165
+ }
166
+ get shortName() {
167
+ return this.props.shortName;
168
+ }
169
+ get createdAt() {
170
+ return this.props.createdAt;
171
+ }
172
+ get timezone() {
173
+ return this.props.timezone;
174
+ }
175
+ get locale() {
176
+ return this.props.locale;
177
+ }
178
+ get grade() {
179
+ return this.props.grade;
180
+ }
181
+ get phone() {
182
+ return this.props.phone;
183
+ }
184
+ get avatarUrl() {
185
+ return this.props.avatarUrl;
186
+ }
187
+ get isParent() {
188
+ return this.props.isParent;
189
+ }
190
+ get isGraduated() {
191
+ return this.props.isGraduated;
192
+ }
193
+ get gradeChecked() {
194
+ return this.props.gradeChecked;
195
+ }
196
+ get type() {
197
+ return this.props.type;
198
+ }
199
+ get isCoach() {
200
+ return this.props.isCoach;
201
+ }
202
+ get isMiniGroupTeacher() {
203
+ return this.props.isMiniGroupTeacher;
204
+ }
205
+ get isExternshipCoach() {
206
+ return this.props.isExternshipCoach;
207
+ }
208
+ get isAgent() {
209
+ return this.props.isAgent;
210
+ }
211
+ get methodist() {
212
+ return this.props.methodist;
213
+ }
214
+ get address() {
215
+ return this.props.address;
216
+ }
217
+ get socialNets() {
218
+ return this.props.socialNets;
219
+ }
220
+ get skype() {
221
+ return this.props.skype;
222
+ }
223
+ get settings() {
224
+ return this.props.settings;
225
+ }
226
+ get bonus() {
227
+ return this.props.bonus;
228
+ }
229
+ get bonusAmount() {
230
+ return this.props.bonusAmount;
231
+ }
232
+ get hasActivePurchases() {
233
+ return this.props.hasActivePurchases;
234
+ }
235
+ get hasAttemptsSolveExamRehearsals() {
236
+ return this.props.hasAttemptsSolveExamRehearsals;
237
+ }
238
+ get hasBookmarks() {
239
+ return this.props.hasBookmarks;
240
+ }
241
+ get tags() {
242
+ return this.props.tags;
243
+ }
244
+ get cartTemplateId() {
245
+ return this.props.cartTemplateId;
246
+ }
247
+ get cartItemsCount() {
248
+ return this.props.cartItemsCount;
249
+ }
250
+ get onboardingFinished() {
251
+ return this.props.onboardingFinished;
252
+ }
253
+ get onboardingFinishedAt() {
254
+ return this.props.onboardingFinishedAt;
255
+ }
256
+ get emailConfirmed() {
257
+ return this.props.emailConfirmed;
258
+ }
259
+ get phoneConfirmed() {
260
+ return this.props.phoneConfirmed;
261
+ }
262
+ get fakeEmail() {
263
+ return this.props.fakeEmail;
264
+ }
265
+ get fakeUser() {
266
+ return this.props.fakeUser;
267
+ }
268
+ get profileEnriched() {
269
+ return this.props.profileEnriched;
270
+ }
271
+ get recapUuid() {
272
+ return this.props.recapUuid;
273
+ }
274
+ get disciplineIds() {
275
+ return this.props.disciplineIds;
276
+ }
277
+ get privacy() {
278
+ return this.props.privacy;
279
+ }
280
+ get parentPhone() {
281
+ return this.props.parentPhone;
282
+ }
283
+ get parentPhoneConfirmed() {
284
+ return this.props.parentPhoneConfirmed;
285
+ }
286
+ get isCustomer() {
287
+ return this.props.isCustomer;
288
+ }
289
+ get hasAccessToMultiDaysStreaks() {
290
+ return this.props.hasAccessToMultiDaysStreaks;
291
+ }
292
+ get isElementaryPupil() {
293
+ return this.props.isElementaryPupil;
294
+ }
295
+ get webSocketNotificationsJwt() {
296
+ return this.props.webSocketNotificationsJwt;
297
+ }
298
+ get hasAccessToAttestationSheets() {
299
+ return this.props.hasAccessToAttestationSheets;
300
+ }
301
+ get externshipUser() {
302
+ return this.props.externshipUser;
303
+ }
304
+ get hasPurchasedExternshipContracts() {
305
+ return this.props.hasPurchasedExternshipContracts;
306
+ }
307
+ get hasExternshipAttestationAccess() {
308
+ return this.props.hasExternshipAttestationAccess;
309
+ }
310
+ get socializationProfile() {
311
+ return this.props.socializationProfile;
312
+ }
313
+ get freeAccessFinishesAt() {
314
+ return this.props.freeAccessFinishesAt;
315
+ }
316
+ get hasUnseenRoomFeatures() {
317
+ return this.props.hasUnseenRoomFeatures;
318
+ }
319
+ get purchaseAnyExternshipContracts() {
320
+ return this.props.purchaseAnyExternshipContracts;
321
+ }
322
+ /**
323
+ * Глубокое клонирование объекта с защитой от циклических ссылок
324
+ * @private
325
+ * @param obj - объект для клонирования
326
+ * @param hash - WeakMap для отслеживания уже клонированных объектов
327
+ * @returns клонированный объект
328
+ */
329
+ static deepClone(obj, hash = /* @__PURE__ */ new WeakMap()) {
330
+ if (obj === null || typeof obj !== "object") {
331
+ return obj;
332
+ }
333
+ if (hash.has(obj)) {
334
+ return hash.get(obj);
335
+ }
336
+ if (obj instanceof Date) {
337
+ return new Date(obj.getTime());
338
+ }
339
+ if (obj instanceof RegExp) {
340
+ return new RegExp(obj.source, obj.flags);
341
+ }
342
+ if (Array.isArray(obj)) {
343
+ const clonedArr = [];
344
+ hash.set(obj, clonedArr);
345
+ obj.forEach((item, index) => {
346
+ clonedArr[index] = this.deepClone(item, hash);
347
+ });
348
+ return clonedArr;
349
+ }
350
+ const clonedObj = Object.create(Object.getPrototypeOf(obj));
351
+ hash.set(obj, clonedObj);
352
+ Object.keys(obj).forEach((key) => {
353
+ clonedObj[key] = this.deepClone(obj[key], hash);
354
+ });
355
+ return clonedObj;
356
+ }
357
+ static createDefault() {
358
+ return new _User(this.deepClone(DEFAULT_USER), true);
359
+ }
360
+ /**
361
+ * Санитизирует строку: удаляет null-байты и обрезает пробелы
362
+ * @private
363
+ * @param str - исходная строка
364
+ * @returns санитизированная строка
365
+ */
366
+ static sanitizeString(str) {
367
+ if (typeof str !== "string") {
368
+ console.warn("[User] Invalid string type:", typeof str);
369
+ return String(str);
370
+ }
371
+ return str.replace(/\x00/g, "").trim();
372
+ }
373
+ static fromApi(input) {
374
+ const sanitizedData = this.sanitizeUserData(this.deepClone(input));
375
+ return new _User(sanitizedData);
376
+ }
377
+ /**
378
+ * Санитизирует данные пользователя
379
+ * @private
380
+ * @param data - исходные данные
381
+ * @returns санитизированные данные
382
+ */
383
+ static sanitizeUserData(data) {
384
+ return __spreadProps(__spreadValues({}, data), {
385
+ email: this.sanitizeString(data.email),
386
+ firstName: this.sanitizeString(data.firstName),
387
+ fullName: this.sanitizeString(data.fullName),
388
+ lastName: this.sanitizeString(data.lastName),
389
+ middleName: data.middleName ? this.sanitizeString(data.middleName) : data.middleName,
390
+ shortName: this.sanitizeString(data.shortName)
391
+ });
392
+ }
393
+ isDefaultUser() {
394
+ return this.isDefault;
395
+ }
396
+ isLoggedIn() {
397
+ return this.id && this.id > 0 ? true : false;
398
+ }
399
+ /**
400
+ * Возвращает тектовое представление роли / класса пользователя
401
+ *
402
+ * @returns {UserRole}
403
+ */
404
+ getPupilRole() {
405
+ if (this.grade.index === 0) {
406
+ return "\u0414\u043E\u0448\u043A\u043E\u043B\u044C\u043D\u0438\u043A";
407
+ }
408
+ if (this.grade.index == null) return "\u0412\u044B\u043F\u0443\u0441\u043A\u043D\u0438\u043A";
409
+ return _User.getGradeString(this.grade.index);
410
+ }
411
+ toJson() {
412
+ return JSON.stringify(this.props);
413
+ }
414
+ };
415
+ _User.getGradeString = (index) => GRADE_MAP[index] || GRADE_MAP[1];
416
+ var User = _User;
417
+ export {
418
+ User
419
+ };
@@ -0,0 +1,240 @@
1
+ // @flow
2
+ declare type PupilRole =
3
+ | "11 класс"
4
+ | "10 класс"
5
+ | "9 класс"
6
+ | "8 класс"
7
+ | "7 класс"
8
+ | "6 класс"
9
+ | "5 класс"
10
+ | "4 класс"
11
+ | "3 класс"
12
+ | "2 класс"
13
+ | "1 класс";
14
+ declare type UserRole =
15
+ | "Ученик"
16
+ | "Репетитор"
17
+ | "Учитель"
18
+ | "Родитель"
19
+ | "Выпускник"
20
+ | "Дошкольник"
21
+ | PupilRole;
22
+ declare interface UserDTO {
23
+ id: null | number;
24
+ email: string;
25
+ firstName: string;
26
+ middleName: string;
27
+ lastName: string;
28
+ fullName: string;
29
+ shortName: string;
30
+ createdAt: null | string;
31
+ timezone: null | string;
32
+ locale: null | string;
33
+ grade: {
34
+ id: null | number,
35
+ index: null | number,
36
+ name: null | string,
37
+ translit: null | string,
38
+ ...
39
+ };
40
+ phone: null | string;
41
+ avatarUrl: string;
42
+ isParent: boolean;
43
+ isGraduated: boolean;
44
+ gradeChecked: boolean;
45
+ type: null | "pupil" | "agent";
46
+ isCoach: boolean;
47
+ isMiniGroupTeacher: boolean;
48
+ isExternshipCoach: boolean;
49
+ isAgent: boolean;
50
+ methodist: boolean;
51
+ address: {
52
+ index: null | string,
53
+ countryId: null | number,
54
+ countryName: null | string,
55
+ regionId: null | number,
56
+ regionName: null | string,
57
+ cityId: null | number,
58
+ cityName: null | string,
59
+ street: null | string,
60
+ house: null | string,
61
+ building: null | string,
62
+ room: null | string,
63
+ ...
64
+ } | null;
65
+ socialNets: Array<{
66
+ provider:
67
+ | "facebook"
68
+ | "google_oauth2"
69
+ | "mailru_oauth2"
70
+ | "odnoklassniki"
71
+ | "vkontakte"
72
+ | "yandex",
73
+ uid: number,
74
+ ...
75
+ }>;
76
+ skype: null | string;
77
+ settings?: {
78
+ calendarUserExperienceFeedback?: boolean,
79
+ elementaryDashboardUserExperienceFeedback?: boolean,
80
+ homeSchoolFamilyEducationGuideHidden?: boolean,
81
+ pageBonusesVisited?: boolean,
82
+ pagePaymentsInfoVisited?: boolean,
83
+ pageSocializationLandingVisited?: boolean,
84
+ pageSocializationVisited?: boolean,
85
+ ...
86
+ };
87
+ bonus: {
88
+ giftAmount: number,
89
+ realMoneyAmount: number,
90
+ ...
91
+ };
92
+ bonusAmount: number;
93
+ hasActivePurchases: boolean;
94
+ hasAttemptsSolveExamRehearsals: boolean;
95
+ hasBookmarks: boolean;
96
+ tags: null | string[];
97
+ cartTemplateId: null | number;
98
+ cartItemsCount: number;
99
+ onboardingFinished: boolean;
100
+ onboardingFinishedAt: null | string;
101
+ emailConfirmed: boolean;
102
+ phoneConfirmed: boolean;
103
+ fakeEmail: boolean;
104
+ fakeUser: boolean;
105
+ profileEnriched: boolean;
106
+ recapUuid: string | null;
107
+ disciplineIds: number[];
108
+ privacy: {
109
+ publicProfile: boolean,
110
+ ...
111
+ };
112
+ parentPhone: null | string;
113
+ parentPhoneConfirmed: boolean;
114
+ isCustomer: null | boolean;
115
+ hasAccessToMultiDaysStreaks: boolean;
116
+ isElementaryPupil: boolean;
117
+ webSocketNotificationsJwt: null | string;
118
+ hasAccessToAttestationSheets: boolean;
119
+ externshipUser: boolean;
120
+ hasPurchasedExternshipContracts: boolean;
121
+ hasExternshipAttestationAccess: boolean;
122
+ appearanceId?: null | number;
123
+ hasUnseenRoomFeatures?: boolean;
124
+ unconfirmedEmail?: null | string;
125
+ socializationProfile: {
126
+ id: number,
127
+ state: "active" | "draft" | "banned",
128
+ ...
129
+ } | null;
130
+ freeAccessFinishesAt: null | string;
131
+ purchaseAnyExternshipContracts: boolean;
132
+ }
133
+ declare class User {
134
+ constructor(): this;
135
+ id: $PropertyType<UserDTO, "id">;
136
+ email: $PropertyType<UserDTO, "email">;
137
+ firstName: $PropertyType<UserDTO, "firstName">;
138
+ middleName: $PropertyType<UserDTO, "middleName">;
139
+ lastName: $PropertyType<UserDTO, "lastName">;
140
+ fullName: $PropertyType<UserDTO, "fullName">;
141
+ shortName: $PropertyType<UserDTO, "shortName">;
142
+ createdAt: $PropertyType<UserDTO, "createdAt">;
143
+ timezone: $PropertyType<UserDTO, "timezone">;
144
+ locale: $PropertyType<UserDTO, "locale">;
145
+ grade: $PropertyType<UserDTO, "grade">;
146
+ phone: $PropertyType<UserDTO, "phone">;
147
+ avatarUrl: $PropertyType<UserDTO, "avatarUrl">;
148
+ isParent: $PropertyType<UserDTO, "isParent">;
149
+ isGraduated: $PropertyType<UserDTO, "isGraduated">;
150
+ gradeChecked: $PropertyType<UserDTO, "gradeChecked">;
151
+ type: $PropertyType<UserDTO, "type">;
152
+ isCoach: $PropertyType<UserDTO, "isCoach">;
153
+ isMiniGroupTeacher: $PropertyType<UserDTO, "isMiniGroupTeacher">;
154
+ isExternshipCoach: $PropertyType<UserDTO, "isExternshipCoach">;
155
+ isAgent: $PropertyType<UserDTO, "isAgent">;
156
+ methodist: $PropertyType<UserDTO, "methodist">;
157
+ address: $PropertyType<UserDTO, "address">;
158
+ socialNets: $PropertyType<UserDTO, "socialNets">;
159
+ skype: $PropertyType<UserDTO, "skype">;
160
+ settings: $PropertyType<UserDTO, "settings">;
161
+ bonus: $PropertyType<UserDTO, "bonus">;
162
+ bonusAmount: $PropertyType<UserDTO, "bonusAmount">;
163
+ hasActivePurchases: $PropertyType<UserDTO, "hasActivePurchases">;
164
+ hasAttemptsSolveExamRehearsals: $PropertyType<
165
+ UserDTO,
166
+ "hasAttemptsSolveExamRehearsals"
167
+ >;
168
+ hasBookmarks: $PropertyType<UserDTO, "hasBookmarks">;
169
+ tags: $PropertyType<UserDTO, "tags">;
170
+ cartTemplateId: $PropertyType<UserDTO, "cartTemplateId">;
171
+ cartItemsCount: $PropertyType<UserDTO, "cartItemsCount">;
172
+ onboardingFinished: $PropertyType<UserDTO, "onboardingFinished">;
173
+ onboardingFinishedAt: $PropertyType<UserDTO, "onboardingFinishedAt">;
174
+ emailConfirmed: $PropertyType<UserDTO, "emailConfirmed">;
175
+ phoneConfirmed: $PropertyType<UserDTO, "phoneConfirmed">;
176
+ fakeEmail: $PropertyType<UserDTO, "fakeEmail">;
177
+ fakeUser: $PropertyType<UserDTO, "fakeUser">;
178
+ profileEnriched: $PropertyType<UserDTO, "profileEnriched">;
179
+ recapUuid: $PropertyType<UserDTO, "recapUuid">;
180
+ disciplineIds: $PropertyType<UserDTO, "disciplineIds">;
181
+ privacy: $PropertyType<UserDTO, "privacy">;
182
+ parentPhone: $PropertyType<UserDTO, "parentPhone">;
183
+ parentPhoneConfirmed: $PropertyType<UserDTO, "parentPhoneConfirmed">;
184
+ isCustomer: $PropertyType<UserDTO, "isCustomer">;
185
+ hasAccessToMultiDaysStreaks: $PropertyType<
186
+ UserDTO,
187
+ "hasAccessToMultiDaysStreaks"
188
+ >;
189
+ isElementaryPupil: $PropertyType<UserDTO, "isElementaryPupil">;
190
+ webSocketNotificationsJwt: $PropertyType<
191
+ UserDTO,
192
+ "webSocketNotificationsJwt"
193
+ >;
194
+ hasAccessToAttestationSheets: $PropertyType<
195
+ UserDTO,
196
+ "hasAccessToAttestationSheets"
197
+ >;
198
+ externshipUser: $PropertyType<UserDTO, "externshipUser">;
199
+ hasPurchasedExternshipContracts: $PropertyType<
200
+ UserDTO,
201
+ "hasPurchasedExternshipContracts"
202
+ >;
203
+ hasExternshipAttestationAccess: $PropertyType<
204
+ UserDTO,
205
+ "hasExternshipAttestationAccess"
206
+ >;
207
+ socializationProfile: $PropertyType<UserDTO, "socializationProfile">;
208
+ freeAccessFinishesAt: $PropertyType<UserDTO, "freeAccessFinishesAt">;
209
+ hasUnseenRoomFeatures: $PropertyType<UserDTO, "hasUnseenRoomFeatures">;
210
+ purchaseAnyExternshipContracts: $PropertyType<
211
+ UserDTO,
212
+ "purchaseAnyExternshipContracts"
213
+ >;
214
+ static createDefault(): User;
215
+ static fromApi(input: mixed): User;
216
+ isDefaultUser(): boolean;
217
+ isLoggedIn(): boolean;
218
+
219
+ /**
220
+ * Возвращает тектовое представление роли / класса пользователя
221
+ * @returns {UserRole}
222
+ */
223
+ getPupilRole(): UserRole;
224
+
225
+ /**
226
+ * Возвращает роль пользователя
227
+ * @returns {UserRole} роль как строка
228
+ */
229
+ getRole: () => UserRole;
230
+
231
+ /**
232
+ * Возвращает фамилию и инициалы юзера
233
+ * @param {User} user
234
+ * @return {string} 'Пупкин В.'
235
+ */
236
+ getInitials: () => string;
237
+ toJson(): string;
238
+ }
239
+ export type { UserDTO };
240
+ declare export { User };
package/index.cjs CHANGED
@@ -94,9 +94,6 @@ module.exports = __toCommonJS(index_exports);
94
94
  var import_services2 = require("@foxford/services");
95
95
 
96
96
  // src/antibot/index.ts
97
- if (typeof window !== "undefined" && window.antibotInitialized === void 0) {
98
- window.antibotInitialized = false;
99
- }
100
97
  var _FoxfordAntibot = class _FoxfordAntibot {
101
98
  constructor(config = _FoxfordAntibot.DEFAULT_CONFIG) {
102
99
  this.createAntibotFrame = (params) => {
@@ -107,6 +104,7 @@ var _FoxfordAntibot = class _FoxfordAntibot {
107
104
  }
108
105
  };
109
106
  this.config = __spreadValues(__spreadValues({}, _FoxfordAntibot.DEFAULT_CONFIG), config);
107
+ if (window.antibotInitialized === void 0) window.antibotInitialized = false;
110
108
  if (!document.body) throw new Error("Body element not found");
111
109
  if (window.onCaptureReady !== void 0) {
112
110
  console.debug("Seo4Ajax crawler injects own callback. FoxfordAntibot initialization will be ignored.");