@foxford/sdk 5.0.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.mdx +493 -0
- package/index.cjs +1794 -0
- package/index.d.cts +780 -0
- package/index.d.ts +780 -0
- package/index.js +1748 -0
- package/index.js.flow +1005 -0
- package/package.json +65 -0
- package/plugins/autocomplete-email.cjs +305 -0
- package/plugins/autocomplete-email.d.cts +49 -0
- package/plugins/autocomplete-email.d.ts +49 -0
- package/plugins/autocomplete-email.js +270 -0
- package/plugins/autocomplete-email.js.flow +24 -0
- package/plugins/confirm-phone.cjs +503 -0
- package/plugins/confirm-phone.d.cts +95 -0
- package/plugins/confirm-phone.d.ts +95 -0
- package/plugins/confirm-phone.js +469 -0
- package/plugins/confirm-phone.js.flow +69 -0
package/index.d.cts
ADDED
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
import { ApiInstance, ApiConfig, CaptchaConfig, ApiResponse, ApiService, CaptchaService } from '@foxford/services';
|
|
2
|
+
export { ApiAdapter, ApiBasicCredentials, ApiConfig, ApiError, ApiErrorExtended, ApiInstance, ApiInterceptorManager, ApiMethod, ApiPromise, ApiProxyConfig, ApiRequestConfig, ApiRequestConfigExtended, ApiResponse, ApiResponseType, ApiService, ApiServiceInterface, ApiStatic, ApiTransformer, Cancel, CancelStatic, CancelToken, CancelTokenSource, CancelTokenStatic, Canceler, CaptchaError, CaptchaService, RequestPlugin, RequestPluginInterface, ResponseError, ResponseFailPlugin, ResponseSuccessPlugin, ResponseSuccessPluginInterface } from '@foxford/services';
|
|
3
|
+
import { CartItemResourceType, BusinessUnitAbbreviation, Course } from '@foxford/types';
|
|
4
|
+
|
|
5
|
+
type Widget = {
|
|
6
|
+
name: 'menu' | 'reviews' | 'featuredCoaches' | 'coachEnrollment' | 'shortForm' | 'userTypePrompt' | 'teachersSlider' | 'externshipFormats';
|
|
7
|
+
options: Record<string, any>;
|
|
8
|
+
container?: HTMLElement;
|
|
9
|
+
};
|
|
10
|
+
type WidgetsInitConfig = {
|
|
11
|
+
version?: 'latest' | string;
|
|
12
|
+
locale?: 'ru';
|
|
13
|
+
};
|
|
14
|
+
type FoxfordWidgetsConfig = {
|
|
15
|
+
analyticContext?: {
|
|
16
|
+
prefix: string;
|
|
17
|
+
module: string;
|
|
18
|
+
payload?: Record<string, any>;
|
|
19
|
+
};
|
|
20
|
+
rootColors?: boolean;
|
|
21
|
+
loadFonts?: boolean;
|
|
22
|
+
widgets: Array<Widget>;
|
|
23
|
+
};
|
|
24
|
+
interface WidgetsConfig extends WidgetsInitConfig {
|
|
25
|
+
analyticContext?: {
|
|
26
|
+
prefix: string;
|
|
27
|
+
module: string;
|
|
28
|
+
payload?: Record<any, any>;
|
|
29
|
+
};
|
|
30
|
+
rootColors?: boolean;
|
|
31
|
+
loadFonts?: boolean;
|
|
32
|
+
widgets: Array<Widget>;
|
|
33
|
+
}
|
|
34
|
+
declare class Widgets {
|
|
35
|
+
private config;
|
|
36
|
+
private api;
|
|
37
|
+
private manifest;
|
|
38
|
+
static ENTRY: string[];
|
|
39
|
+
static DEFAULT_CONFIG: WidgetsInitConfig;
|
|
40
|
+
constructor(config: WidgetsInitConfig | undefined, apiInstance: ApiInstance);
|
|
41
|
+
create(config: WidgetsConfig): Promise<void>;
|
|
42
|
+
update(name: string, config: Widget): Promise<void>;
|
|
43
|
+
private loadManifest;
|
|
44
|
+
static appendScript(src: string): Promise<unknown>;
|
|
45
|
+
private loadAssets;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Расширение глобального интерфейса Window
|
|
50
|
+
* Содержит дополнительные свойства, используемые в SDK
|
|
51
|
+
*/
|
|
52
|
+
declare global {
|
|
53
|
+
interface Window {
|
|
54
|
+
/**
|
|
55
|
+
* Реферер Foxford для отслеживания источников трафика
|
|
56
|
+
*/
|
|
57
|
+
__fox_referrer__?: string
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Google Tag Manager data layer для отправки событий аналитики
|
|
61
|
+
* @see https://developers.google.com/tag-manager/devguide
|
|
62
|
+
*/
|
|
63
|
+
dataLayer?: Array<Record<string, unknown>>
|
|
64
|
+
antibotInitialized?: boolean
|
|
65
|
+
onCaptureReady?: () => void
|
|
66
|
+
Foxford?: {
|
|
67
|
+
Widgets?: {
|
|
68
|
+
create(config: FoxfordWidgetsConfig): void
|
|
69
|
+
update(name: string, config: Widget): void
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type PupilRole = '11 класс' | '10 класс' | '9 класс' | '8 класс' | '7 класс' | '6 класс' | '5 класс' | '4 класс' | '3 класс' | '2 класс' | '1 класс';
|
|
76
|
+
type UserRole = 'Ученик' | 'Репетитор' | 'Учитель' | 'Родитель' | 'Выпускник' | 'Дошкольник' | PupilRole;
|
|
77
|
+
interface UserDTO {
|
|
78
|
+
id: null | number;
|
|
79
|
+
email: string;
|
|
80
|
+
firstName: string;
|
|
81
|
+
middleName: string;
|
|
82
|
+
lastName: string;
|
|
83
|
+
fullName: string;
|
|
84
|
+
shortName: string;
|
|
85
|
+
createdAt: null | string;
|
|
86
|
+
timezone: null | string;
|
|
87
|
+
locale: null | string;
|
|
88
|
+
grade: {
|
|
89
|
+
id: null | number;
|
|
90
|
+
index: null | number;
|
|
91
|
+
name: null | string;
|
|
92
|
+
translit: null | string;
|
|
93
|
+
};
|
|
94
|
+
phone: null | string;
|
|
95
|
+
avatarUrl: string;
|
|
96
|
+
isParent: boolean;
|
|
97
|
+
isGraduated: boolean;
|
|
98
|
+
gradeChecked: boolean;
|
|
99
|
+
type: null | 'pupil' | 'agent';
|
|
100
|
+
isCoach: boolean;
|
|
101
|
+
isMiniGroupTeacher: boolean;
|
|
102
|
+
isExternshipCoach: boolean;
|
|
103
|
+
isAgent: boolean;
|
|
104
|
+
methodist: boolean;
|
|
105
|
+
address: {
|
|
106
|
+
index: null | string;
|
|
107
|
+
countryId: null | number;
|
|
108
|
+
countryName: null | string;
|
|
109
|
+
regionId: null | number;
|
|
110
|
+
regionName: null | string;
|
|
111
|
+
cityId: null | number;
|
|
112
|
+
cityName: null | string;
|
|
113
|
+
street: null | string;
|
|
114
|
+
house: null | string;
|
|
115
|
+
building: null | string;
|
|
116
|
+
room: null | string;
|
|
117
|
+
} | null;
|
|
118
|
+
socialNets: Array<{
|
|
119
|
+
provider: 'facebook' | 'google_oauth2' | 'mailru_oauth2' | 'odnoklassniki' | 'vkontakte' | 'yandex';
|
|
120
|
+
uid: number;
|
|
121
|
+
}>;
|
|
122
|
+
skype: null | string;
|
|
123
|
+
settings?: {
|
|
124
|
+
calendarUserExperienceFeedback?: boolean;
|
|
125
|
+
elementaryDashboardUserExperienceFeedback?: boolean;
|
|
126
|
+
homeSchoolFamilyEducationGuideHidden?: boolean;
|
|
127
|
+
pageBonusesVisited?: boolean;
|
|
128
|
+
pagePaymentsInfoVisited?: boolean;
|
|
129
|
+
pageSocializationLandingVisited?: boolean;
|
|
130
|
+
pageSocializationVisited?: boolean;
|
|
131
|
+
};
|
|
132
|
+
bonus: {
|
|
133
|
+
giftAmount: number;
|
|
134
|
+
realMoneyAmount: number;
|
|
135
|
+
};
|
|
136
|
+
bonusAmount: number;
|
|
137
|
+
hasActivePurchases: boolean;
|
|
138
|
+
hasAttemptsSolveExamRehearsals: boolean;
|
|
139
|
+
hasBookmarks: boolean;
|
|
140
|
+
tags: null | string[];
|
|
141
|
+
cartTemplateId: null | number;
|
|
142
|
+
cartItemsCount: number;
|
|
143
|
+
onboardingFinished: boolean;
|
|
144
|
+
onboardingFinishedAt: null | string;
|
|
145
|
+
emailConfirmed: boolean;
|
|
146
|
+
phoneConfirmed: boolean;
|
|
147
|
+
fakeEmail: boolean;
|
|
148
|
+
fakeUser: boolean;
|
|
149
|
+
profileEnriched: boolean;
|
|
150
|
+
recapUuid: string | null;
|
|
151
|
+
disciplineIds: number[];
|
|
152
|
+
privacy: {
|
|
153
|
+
publicProfile: boolean;
|
|
154
|
+
};
|
|
155
|
+
parentPhone: null | string;
|
|
156
|
+
parentPhoneConfirmed: boolean;
|
|
157
|
+
isCustomer: null | boolean;
|
|
158
|
+
hasAccessToMultiDaysStreaks: boolean;
|
|
159
|
+
isElementaryPupil: boolean;
|
|
160
|
+
webSocketNotificationsJwt: null | string;
|
|
161
|
+
hasAccessToAttestationSheets: boolean;
|
|
162
|
+
externshipUser: boolean;
|
|
163
|
+
hasPurchasedExternshipContracts: boolean;
|
|
164
|
+
hasExternshipAttestationAccess: boolean;
|
|
165
|
+
appearanceId?: null | number;
|
|
166
|
+
hasUnseenRoomFeatures?: boolean;
|
|
167
|
+
unconfirmedEmail?: null | string;
|
|
168
|
+
socializationProfile: {
|
|
169
|
+
id: number;
|
|
170
|
+
state: 'active' | 'draft' | 'banned';
|
|
171
|
+
} | null;
|
|
172
|
+
freeAccessFinishesAt: null | string;
|
|
173
|
+
purchaseAnyExternshipContracts: boolean;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare class User {
|
|
177
|
+
private readonly props;
|
|
178
|
+
private readonly isDefault;
|
|
179
|
+
private constructor();
|
|
180
|
+
get id(): UserDTO['id'];
|
|
181
|
+
get email(): UserDTO['email'];
|
|
182
|
+
get firstName(): UserDTO['firstName'];
|
|
183
|
+
get middleName(): UserDTO['middleName'];
|
|
184
|
+
get lastName(): UserDTO['lastName'];
|
|
185
|
+
get fullName(): UserDTO['fullName'];
|
|
186
|
+
get shortName(): UserDTO['shortName'];
|
|
187
|
+
get createdAt(): UserDTO['createdAt'];
|
|
188
|
+
get timezone(): UserDTO['timezone'];
|
|
189
|
+
get locale(): UserDTO['locale'];
|
|
190
|
+
get grade(): UserDTO['grade'];
|
|
191
|
+
get phone(): UserDTO['phone'];
|
|
192
|
+
get avatarUrl(): UserDTO['avatarUrl'];
|
|
193
|
+
get isParent(): UserDTO['isParent'];
|
|
194
|
+
get isGraduated(): UserDTO['isGraduated'];
|
|
195
|
+
get gradeChecked(): UserDTO['gradeChecked'];
|
|
196
|
+
get type(): UserDTO['type'];
|
|
197
|
+
get isCoach(): UserDTO['isCoach'];
|
|
198
|
+
get isMiniGroupTeacher(): UserDTO['isMiniGroupTeacher'];
|
|
199
|
+
get isExternshipCoach(): UserDTO['isExternshipCoach'];
|
|
200
|
+
get isAgent(): UserDTO['isAgent'];
|
|
201
|
+
get methodist(): UserDTO['methodist'];
|
|
202
|
+
get address(): UserDTO['address'];
|
|
203
|
+
get socialNets(): UserDTO['socialNets'];
|
|
204
|
+
get skype(): UserDTO['skype'];
|
|
205
|
+
get settings(): UserDTO['settings'];
|
|
206
|
+
get bonus(): UserDTO['bonus'];
|
|
207
|
+
get bonusAmount(): UserDTO['bonusAmount'];
|
|
208
|
+
get hasActivePurchases(): UserDTO['hasActivePurchases'];
|
|
209
|
+
get hasAttemptsSolveExamRehearsals(): UserDTO['hasAttemptsSolveExamRehearsals'];
|
|
210
|
+
get hasBookmarks(): UserDTO['hasBookmarks'];
|
|
211
|
+
get tags(): UserDTO['tags'];
|
|
212
|
+
get cartTemplateId(): UserDTO['cartTemplateId'];
|
|
213
|
+
get cartItemsCount(): UserDTO['cartItemsCount'];
|
|
214
|
+
get onboardingFinished(): UserDTO['onboardingFinished'];
|
|
215
|
+
get onboardingFinishedAt(): UserDTO['onboardingFinishedAt'];
|
|
216
|
+
get emailConfirmed(): UserDTO['emailConfirmed'];
|
|
217
|
+
get phoneConfirmed(): UserDTO['phoneConfirmed'];
|
|
218
|
+
get fakeEmail(): UserDTO['fakeEmail'];
|
|
219
|
+
get fakeUser(): UserDTO['fakeUser'];
|
|
220
|
+
get profileEnriched(): UserDTO['profileEnriched'];
|
|
221
|
+
get recapUuid(): UserDTO['recapUuid'];
|
|
222
|
+
get disciplineIds(): UserDTO['disciplineIds'];
|
|
223
|
+
get privacy(): UserDTO['privacy'];
|
|
224
|
+
get parentPhone(): UserDTO['parentPhone'];
|
|
225
|
+
get parentPhoneConfirmed(): UserDTO['parentPhoneConfirmed'];
|
|
226
|
+
get isCustomer(): UserDTO['isCustomer'];
|
|
227
|
+
get hasAccessToMultiDaysStreaks(): UserDTO['hasAccessToMultiDaysStreaks'];
|
|
228
|
+
get isElementaryPupil(): UserDTO['isElementaryPupil'];
|
|
229
|
+
get webSocketNotificationsJwt(): UserDTO['webSocketNotificationsJwt'];
|
|
230
|
+
get hasAccessToAttestationSheets(): UserDTO['hasAccessToAttestationSheets'];
|
|
231
|
+
get externshipUser(): UserDTO['externshipUser'];
|
|
232
|
+
get hasPurchasedExternshipContracts(): UserDTO['hasPurchasedExternshipContracts'];
|
|
233
|
+
get hasExternshipAttestationAccess(): UserDTO['hasExternshipAttestationAccess'];
|
|
234
|
+
get socializationProfile(): UserDTO['socializationProfile'];
|
|
235
|
+
get freeAccessFinishesAt(): UserDTO['freeAccessFinishesAt'];
|
|
236
|
+
get hasUnseenRoomFeatures(): UserDTO['hasUnseenRoomFeatures'];
|
|
237
|
+
get purchaseAnyExternshipContracts(): UserDTO['purchaseAnyExternshipContracts'];
|
|
238
|
+
/**
|
|
239
|
+
* Глубокое клонирование объекта с защитой от циклических ссылок
|
|
240
|
+
* @private
|
|
241
|
+
* @param obj - объект для клонирования
|
|
242
|
+
* @param hash - WeakMap для отслеживания уже клонированных объектов
|
|
243
|
+
* @returns клонированный объект
|
|
244
|
+
*/
|
|
245
|
+
private static deepClone;
|
|
246
|
+
static createDefault(): User;
|
|
247
|
+
/**
|
|
248
|
+
* Санитизирует строку: удаляет null-байты и обрезает пробелы
|
|
249
|
+
* @private
|
|
250
|
+
* @param str - исходная строка
|
|
251
|
+
* @returns санитизированная строка
|
|
252
|
+
*/
|
|
253
|
+
private static sanitizeString;
|
|
254
|
+
static fromApi(input: unknown): User;
|
|
255
|
+
/**
|
|
256
|
+
* Санитизирует данные пользователя
|
|
257
|
+
* @private
|
|
258
|
+
* @param data - исходные данные
|
|
259
|
+
* @returns санитизированные данные
|
|
260
|
+
*/
|
|
261
|
+
private static sanitizeUserData;
|
|
262
|
+
isDefaultUser(): boolean;
|
|
263
|
+
isLoggedIn(): boolean;
|
|
264
|
+
private static getGradeString;
|
|
265
|
+
/**
|
|
266
|
+
* Возвращает тектовое представление роли / класса пользователя
|
|
267
|
+
*
|
|
268
|
+
* @returns {UserRole}
|
|
269
|
+
*/
|
|
270
|
+
getPupilRole(): UserRole;
|
|
271
|
+
/**
|
|
272
|
+
* Возвращает роль пользователя
|
|
273
|
+
* @returns {UserRole} роль как строка
|
|
274
|
+
*/
|
|
275
|
+
getRole: () => UserRole;
|
|
276
|
+
/**
|
|
277
|
+
* Возвращает фамилию и инициалы юзера
|
|
278
|
+
* @param {User} user
|
|
279
|
+
* @return {string} 'Пупкин В.'
|
|
280
|
+
*/
|
|
281
|
+
getInitials: () => string;
|
|
282
|
+
toJson(): string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
type AppOptions = {
|
|
286
|
+
activePromoBanner?: number;
|
|
287
|
+
captcha?: {
|
|
288
|
+
provider: 'recaptcha';
|
|
289
|
+
siteKey: string;
|
|
290
|
+
};
|
|
291
|
+
contactPhoneNumber: null | string;
|
|
292
|
+
currency: {
|
|
293
|
+
code: 'RUB';
|
|
294
|
+
exchangeRate: number;
|
|
295
|
+
};
|
|
296
|
+
currentSchoolYear: null | {
|
|
297
|
+
current: boolean;
|
|
298
|
+
id: number;
|
|
299
|
+
startsFrom: number;
|
|
300
|
+
translit: string;
|
|
301
|
+
};
|
|
302
|
+
experiments?: Array<{
|
|
303
|
+
name: string;
|
|
304
|
+
value: string;
|
|
305
|
+
}>;
|
|
306
|
+
externalReviews?: {
|
|
307
|
+
pageAvailable: boolean;
|
|
308
|
+
};
|
|
309
|
+
featureFlags?: Array<string>;
|
|
310
|
+
feedbackThemes?: {
|
|
311
|
+
foxford: {
|
|
312
|
+
tasks: number;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
flash: {
|
|
316
|
+
alert?: string;
|
|
317
|
+
notice?: string;
|
|
318
|
+
warning?: string;
|
|
319
|
+
};
|
|
320
|
+
nextSchoolYearProductsExists: boolean;
|
|
321
|
+
paymentMethods?: {
|
|
322
|
+
another?: string;
|
|
323
|
+
cardPayment?: 'Yandex';
|
|
324
|
+
creditExternshipPayment?: 'TinkoffCredit';
|
|
325
|
+
creditPayment?: 'Sberbank' | 'Yandex';
|
|
326
|
+
internationalCardPayment?: 'Payture' | 'Payanyway';
|
|
327
|
+
splitPayment?: 'YandexPay';
|
|
328
|
+
platiChastyamiPayment?: 'PlatiChastyami';
|
|
329
|
+
sberPayPayment?: 'SberbankEcommerce';
|
|
330
|
+
sberSpasiboPayment?: 'SberbankEcommerce';
|
|
331
|
+
sbpPayment?: 'Yandex';
|
|
332
|
+
};
|
|
333
|
+
phoneConfirmationType: 'sms' | 'phone_call' | 'cascade_by_call' | 'telegram_cascade';
|
|
334
|
+
popupAlerts?: number[];
|
|
335
|
+
prerender?: boolean;
|
|
336
|
+
requestMetaTags?: boolean;
|
|
337
|
+
rootMenuItems: Array<{
|
|
338
|
+
contextOfUse?: 'externat' | 'media' | 'portal';
|
|
339
|
+
id: number;
|
|
340
|
+
title: string;
|
|
341
|
+
url: string;
|
|
342
|
+
}>;
|
|
343
|
+
sentry?: {
|
|
344
|
+
dsn: string;
|
|
345
|
+
};
|
|
346
|
+
showPromoBanners: string[];
|
|
347
|
+
user?: UserDTO;
|
|
348
|
+
userIdentity?: string;
|
|
349
|
+
webSocketNotifications?: {
|
|
350
|
+
clientConnection: null | Array<{
|
|
351
|
+
endpoint: string;
|
|
352
|
+
transport: 'websocket' | 'http_stream' | 'sse' | 'sockjs' | 'webtransport';
|
|
353
|
+
}>;
|
|
354
|
+
token: string;
|
|
355
|
+
};
|
|
356
|
+
contacts: {
|
|
357
|
+
email: null | string;
|
|
358
|
+
phone: null | string;
|
|
359
|
+
telegram: null | string;
|
|
360
|
+
vkontakte: null | string;
|
|
361
|
+
whatsapp: null | string;
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
declare class AppOptionsService {
|
|
365
|
+
private api;
|
|
366
|
+
private readonly eventName;
|
|
367
|
+
private appOptions;
|
|
368
|
+
constructor(apiInstance: ApiInstance, eventName: string);
|
|
369
|
+
getCurrentAppOptions(): Promise<AppOptions>;
|
|
370
|
+
/**
|
|
371
|
+
* Get app options data from api
|
|
372
|
+
*/
|
|
373
|
+
getAppOptions(): Promise<AppOptions>;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
interface FoxfordAntibotConfig {
|
|
377
|
+
antibotFrameSrc?: string;
|
|
378
|
+
antibotOnload?: (e: Event) => void;
|
|
379
|
+
antibotOnerror?: () => void;
|
|
380
|
+
debug?: boolean;
|
|
381
|
+
}
|
|
382
|
+
declare class FoxfordAntibot {
|
|
383
|
+
private config;
|
|
384
|
+
static FOXFORD_ANTIBOT_URL: string;
|
|
385
|
+
static DEFAULT_CONFIG: {
|
|
386
|
+
antibotFrameSrc: string;
|
|
387
|
+
};
|
|
388
|
+
static FRAME_CLASSNAME: string;
|
|
389
|
+
constructor(config?: FoxfordAntibotConfig);
|
|
390
|
+
private static antibotIsInitialized;
|
|
391
|
+
private static createFrame;
|
|
392
|
+
createAntibotFrame: (params: {
|
|
393
|
+
src: string;
|
|
394
|
+
onload?: (_e: Event) => void;
|
|
395
|
+
onerror?: () => void;
|
|
396
|
+
}) => void;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
type ProductTypeItem = {
|
|
400
|
+
type: string;
|
|
401
|
+
id: number;
|
|
402
|
+
description: string;
|
|
403
|
+
title: string;
|
|
404
|
+
discipline: {
|
|
405
|
+
id: number;
|
|
406
|
+
name: string;
|
|
407
|
+
};
|
|
408
|
+
teacher: {
|
|
409
|
+
id: number;
|
|
410
|
+
long_name: string;
|
|
411
|
+
description: string;
|
|
412
|
+
experience: number;
|
|
413
|
+
photo_url: string;
|
|
414
|
+
photo_large_url: string;
|
|
415
|
+
};
|
|
416
|
+
levels: Array<{
|
|
417
|
+
id: number;
|
|
418
|
+
name: string;
|
|
419
|
+
}>;
|
|
420
|
+
};
|
|
421
|
+
type ProductPack = {
|
|
422
|
+
name: string;
|
|
423
|
+
description: string;
|
|
424
|
+
meta_title: string;
|
|
425
|
+
meta_description: string;
|
|
426
|
+
published: true;
|
|
427
|
+
content_description: string;
|
|
428
|
+
disciplines_scope: string;
|
|
429
|
+
guaranteed_admission: true;
|
|
430
|
+
grade_names: string;
|
|
431
|
+
is_purchased: false;
|
|
432
|
+
learning_flow: {
|
|
433
|
+
title: string;
|
|
434
|
+
steps: Array<{
|
|
435
|
+
header: string;
|
|
436
|
+
description: string;
|
|
437
|
+
}>;
|
|
438
|
+
};
|
|
439
|
+
offers: {
|
|
440
|
+
intro: string;
|
|
441
|
+
items: Array<{
|
|
442
|
+
title: string;
|
|
443
|
+
description: string;
|
|
444
|
+
}>;
|
|
445
|
+
};
|
|
446
|
+
price_block: {
|
|
447
|
+
price: number;
|
|
448
|
+
initial_price: number;
|
|
449
|
+
title: string;
|
|
450
|
+
description: string;
|
|
451
|
+
points: Array<string>;
|
|
452
|
+
price_per_month: number;
|
|
453
|
+
initial_price_per_month: number;
|
|
454
|
+
};
|
|
455
|
+
product_pack_items: Array<ProductTypeItem>;
|
|
456
|
+
faq_items: Array<{
|
|
457
|
+
question: string;
|
|
458
|
+
answer: string;
|
|
459
|
+
}>;
|
|
460
|
+
landing_image_urls: Array<string>;
|
|
461
|
+
};
|
|
462
|
+
interface CartItemDTO {
|
|
463
|
+
cart_item_type: CartItemResourceType;
|
|
464
|
+
resource_id: number;
|
|
465
|
+
}
|
|
466
|
+
type FoxfordConfig = {
|
|
467
|
+
host?: string;
|
|
468
|
+
/** @deprecated */
|
|
469
|
+
widgetsVersion?: 'latest' | string;
|
|
470
|
+
antibot?: boolean;
|
|
471
|
+
antibotConfig?: FoxfordAntibotConfig;
|
|
472
|
+
api?: ApiConfig;
|
|
473
|
+
captchaConfig?: () => CaptchaConfig;
|
|
474
|
+
/** @deprecated Не используйте инициализацию виджетов через SDK */
|
|
475
|
+
widgetsConfig?: WidgetsInitConfig;
|
|
476
|
+
};
|
|
477
|
+
type Reasons = 'additional_education_free_period_started' | 'announcement_clicked' | 'catalog_filtered' | 'coach_intro_lesson_scheduled' | 'coach_landing_visited' | 'course_conspect_visited' | 'course_landing_visited' | 'event_scheduled' | 'event_visited' | 'exam_rehearsal_page_visited' | 'exam_rehearsal_passed' | 'externship_contract_draft_created' | 'externship_demo_access' | 'externship_iep_selected' | 'externship_intendance_expressed' | 'interactive_training_course_visited' | 'externship_landing_visited' | 'externship_lead_request' | 'mini_group_landing_visited' | 'olympiad_page_visited' | 'onboarding' | 'onboarding_finished' | 'product_pack_landing_visited' | 'promos_coach_recommendation_clicked' | 'promos_course_recommendation_clicked' | 'promos_results_filtered' | 'subscription_landing_visited' | 'teacher_course_visited' | 'training_page_visited' | 'training_passed' | 'wiki_visited' | 'project_landing_cta_clicked';
|
|
478
|
+
type ProductFormats = 'coach_course' | 'course' | 'event' | 'exam_rehearsal' | 'externship' | 'game' | 'interactive_trainings' | 'mini_group' | 'olympiad' | 'product_pack' | 'teacher_course' | 'trainings';
|
|
479
|
+
type UserInterests = {
|
|
480
|
+
businessUnitAbbrs?: BusinessUnitAbbreviation[] | null;
|
|
481
|
+
disciplineId?: number | number[] | null;
|
|
482
|
+
gradeId?: number | number[] | null;
|
|
483
|
+
levelId?: number | number[] | null;
|
|
484
|
+
productId?: number | null;
|
|
485
|
+
productFormat?: ProductFormats | null;
|
|
486
|
+
reason?: Reasons | null;
|
|
487
|
+
};
|
|
488
|
+
interface CommunicationSubscriptions {
|
|
489
|
+
subscriptionNews?: boolean;
|
|
490
|
+
subscriptionMaterials?: boolean;
|
|
491
|
+
subscriptionEvents?: boolean;
|
|
492
|
+
subscriptionPromos?: boolean;
|
|
493
|
+
subscriptionReminders?: boolean;
|
|
494
|
+
subscriptionMedia?: boolean;
|
|
495
|
+
subscriptionExternship?: boolean;
|
|
496
|
+
subscriptionExternal?: boolean;
|
|
497
|
+
}
|
|
498
|
+
interface LoginByPhoneParams {
|
|
499
|
+
onEmailRequest: (phoneCheckResponse: {
|
|
500
|
+
email?: string;
|
|
501
|
+
fakeEmail?: boolean;
|
|
502
|
+
state: 'new' | 'confirmed' | 'not_confirmed';
|
|
503
|
+
}) => Promise<string>;
|
|
504
|
+
onCodeRequest: () => Promise<string>;
|
|
505
|
+
onNameRequest: () => Promise<{
|
|
506
|
+
first_name: string;
|
|
507
|
+
last_name: string;
|
|
508
|
+
}>;
|
|
509
|
+
onConfirmationCodeResponse: (confirmationCodeResponse: {
|
|
510
|
+
nextDeliveryAt: string;
|
|
511
|
+
}) => void;
|
|
512
|
+
onConfirmationCodeError: (error: Error) => void;
|
|
513
|
+
}
|
|
514
|
+
interface LoginOrRegistrationResponse {
|
|
515
|
+
redirectUrl?: string;
|
|
516
|
+
registered?: boolean;
|
|
517
|
+
type?: string;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
declare class CartService {
|
|
521
|
+
private api;
|
|
522
|
+
constructor(apiInstance: ApiInstance);
|
|
523
|
+
createCartItem(id: number, type: CartItemResourceType): CartItemDTO;
|
|
524
|
+
addCartItemToCart(cartItem: CartItemDTO): Promise<unknown>;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare class CourseService {
|
|
528
|
+
private api;
|
|
529
|
+
constructor(apiInstance: ApiInstance);
|
|
530
|
+
getCourse(id: number): Promise<Course>;
|
|
531
|
+
enrollCourse(id: number): Promise<void>;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
type LeadRequestPayload = {
|
|
535
|
+
email?: string | null;
|
|
536
|
+
phone?: string | null;
|
|
537
|
+
school_id?: number | null;
|
|
538
|
+
contract_id?: number | null;
|
|
539
|
+
referrer?: string | null;
|
|
540
|
+
subscription_external?: 'true' | 'false' | null;
|
|
541
|
+
user_type?: 'pupil' | 'agent' | 'parent' | null;
|
|
542
|
+
agent_id?: number | null;
|
|
543
|
+
agreement?: boolean | null;
|
|
544
|
+
code?: string | null;
|
|
545
|
+
communication_method?: 'phone' | 'email' | 'whatsapp' | null;
|
|
546
|
+
course_name?: string | null;
|
|
547
|
+
discipline_id?: number | null;
|
|
548
|
+
free_intro_lesson_group_id?: number | null;
|
|
549
|
+
free_intro_lesson_mini_group_id?: number | null;
|
|
550
|
+
grade_id?: number | null;
|
|
551
|
+
group_template_ids?: Array<number> | null;
|
|
552
|
+
id?: string | null;
|
|
553
|
+
interests?: Array<string> | null;
|
|
554
|
+
level_id?: any | null;
|
|
555
|
+
name?: string | null;
|
|
556
|
+
parent_phone?: string | null;
|
|
557
|
+
phone_number?: string | null;
|
|
558
|
+
placement?: string | null;
|
|
559
|
+
product_id?: number | null;
|
|
560
|
+
product_pack_id?: string | null;
|
|
561
|
+
product_type?: any | null;
|
|
562
|
+
source?: string | null;
|
|
563
|
+
school_entry_year?: number | null;
|
|
564
|
+
total_balance?: number | null;
|
|
565
|
+
user_id?: number | null;
|
|
566
|
+
user_phone_number?: string | null;
|
|
567
|
+
utm_campaign?: string | null;
|
|
568
|
+
utm_medium?: string | null;
|
|
569
|
+
utm_source?: string | null;
|
|
570
|
+
utm_term?: string | null;
|
|
571
|
+
};
|
|
572
|
+
interface LeadRequest extends LeadRequestPayload {
|
|
573
|
+
type: LeadRequestType;
|
|
574
|
+
agreement?: boolean;
|
|
575
|
+
context: 'rep_change_tariff' | 'split_balance' | 'demo_order' | string;
|
|
576
|
+
}
|
|
577
|
+
interface LeadRequestApiResponse {
|
|
578
|
+
id: string;
|
|
579
|
+
newUser: boolean;
|
|
580
|
+
}
|
|
581
|
+
interface LeadRequestResponse {
|
|
582
|
+
leadRequest: LeadRequest;
|
|
583
|
+
response: LeadRequestApiResponse;
|
|
584
|
+
}
|
|
585
|
+
declare enum LeadRequestType {
|
|
586
|
+
Algorithmics = "LeadRequests::Algorithmics",
|
|
587
|
+
External = "LeadRequests::External",
|
|
588
|
+
Callback = "LeadRequests::Callback",
|
|
589
|
+
Basic = "LeadRequests::Basic",
|
|
590
|
+
Main = "LeadRequests::Main",
|
|
591
|
+
Coach = "LeadRequests::Coach",
|
|
592
|
+
Media = "LeadRequests::Media",
|
|
593
|
+
MiniGroup = "LeadRequests::MiniGroup",
|
|
594
|
+
Externship = "LeadRequests::Externship",
|
|
595
|
+
CoachUserCoursePlanUpgradeCallback = "LeadRequests::CoachUserCoursePlanUpgradeCallback",
|
|
596
|
+
ParentCallback = "LeadRequests::ParentCallback",
|
|
597
|
+
TeacherCallback = "LeadRequests::TeacherCallback",
|
|
598
|
+
Email = "LeadRequests::EmailSubscription",
|
|
599
|
+
IThubLead = "LeadRequests::IThubLead"
|
|
600
|
+
}
|
|
601
|
+
declare class LeadRequestService {
|
|
602
|
+
private api;
|
|
603
|
+
types: typeof LeadRequestType;
|
|
604
|
+
constructor(apiInstance: ApiInstance);
|
|
605
|
+
/**
|
|
606
|
+
* Create lead request
|
|
607
|
+
* @param {LeadRequestType} type
|
|
608
|
+
* @param {LeadRequest['context']} context
|
|
609
|
+
* @param {LeadRequestPayload} data
|
|
610
|
+
*/
|
|
611
|
+
createLeadRequest(type: LeadRequestType, context: LeadRequest['context'], data?: LeadRequestPayload): LeadRequest;
|
|
612
|
+
/**
|
|
613
|
+
* Send lead request with specific data
|
|
614
|
+
* @param {LeadRequest} leadRequest
|
|
615
|
+
*/
|
|
616
|
+
send(leadRequest: LeadRequest): Promise<LeadRequestResponse>;
|
|
617
|
+
/**
|
|
618
|
+
* Update lead request with specific data
|
|
619
|
+
* @param {string} id
|
|
620
|
+
* @param {LeadRequestPayload} lrData
|
|
621
|
+
*/
|
|
622
|
+
update(id: string, lrData?: Partial<LeadRequest>): Promise<unknown>;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
declare class ProductPackService {
|
|
626
|
+
private api;
|
|
627
|
+
constructor(apiInstance: ApiInstance);
|
|
628
|
+
getProductPack(id: number): Promise<ProductPack>;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
declare class PromoService {
|
|
632
|
+
private api;
|
|
633
|
+
constructor(apiInstance: ApiInstance);
|
|
634
|
+
checkPromocode(code: string): Promise<unknown>;
|
|
635
|
+
/**
|
|
636
|
+
* Send data if user saw the promo code
|
|
637
|
+
* @param {string} promoCode
|
|
638
|
+
* @returns {Promise}
|
|
639
|
+
*/
|
|
640
|
+
trackCodeCampaign(promoCode: string): Promise<void>;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
declare class TagService {
|
|
644
|
+
private api;
|
|
645
|
+
constructor(apiInstance: ApiInstance);
|
|
646
|
+
addTag(id: number): Promise<unknown>;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
declare class UserService {
|
|
650
|
+
private api;
|
|
651
|
+
private appOptionsService;
|
|
652
|
+
constructor(apiInstance: ApiInstance, appOptionsService: AppOptionsService);
|
|
653
|
+
/**
|
|
654
|
+
* Create user instance
|
|
655
|
+
* @param {UserDTO} data data of user
|
|
656
|
+
*/
|
|
657
|
+
static createUser(data: UserDTO): User;
|
|
658
|
+
/**
|
|
659
|
+
* Create default user
|
|
660
|
+
* @returns {User}
|
|
661
|
+
*/
|
|
662
|
+
static createDefaultUser(): User;
|
|
663
|
+
/**
|
|
664
|
+
* Get current user data
|
|
665
|
+
* @return {Promise} Server response with user data
|
|
666
|
+
*/
|
|
667
|
+
getUser(): Promise<User>;
|
|
668
|
+
/**
|
|
669
|
+
* Логин или регистрация юзера по email
|
|
670
|
+
* @param email email юзера
|
|
671
|
+
* @param password пароль
|
|
672
|
+
* @returns {Promise<{ user: User; result: LoginOrRegistrationResponse }>}
|
|
673
|
+
*/
|
|
674
|
+
loginByEmail(email: string, password: string): Promise<{
|
|
675
|
+
user: User;
|
|
676
|
+
result: LoginOrRegistrationResponse;
|
|
677
|
+
}>;
|
|
678
|
+
/**
|
|
679
|
+
* Запрос кода на подтвеждение телефона
|
|
680
|
+
*/
|
|
681
|
+
getConfirmationCode(phone: string): Promise<ApiResponse<{
|
|
682
|
+
nextDeliveryAt: string;
|
|
683
|
+
}>>;
|
|
684
|
+
/**
|
|
685
|
+
* Логин или регистрация юзера по телефону
|
|
686
|
+
* @param phone номер телефона
|
|
687
|
+
* @param params
|
|
688
|
+
* @returns {Promise<{ user: User; result: LoginOrRegistrationResponse }>}
|
|
689
|
+
*/
|
|
690
|
+
loginByPhone(phone: string, params: LoginByPhoneParams): Promise<any>;
|
|
691
|
+
/**
|
|
692
|
+
* Получение покупок текущего пользователя
|
|
693
|
+
* @param {Number} params.resourceId Resource ID
|
|
694
|
+
* @param {String} params.resourceType Resource type
|
|
695
|
+
* @return {Promise} Server response with user purchases
|
|
696
|
+
*/
|
|
697
|
+
purchases({ resourceId, resourceType }: {
|
|
698
|
+
resourceId: number;
|
|
699
|
+
resourceType: string;
|
|
700
|
+
}): Promise<unknown>;
|
|
701
|
+
/**
|
|
702
|
+
* Навигация на страницу входа и перенаправление на указанный путь после успешного входа.
|
|
703
|
+
* @param {String} options.redirectUrl URL для редиректа.
|
|
704
|
+
*/
|
|
705
|
+
signIn({ redirectUrl }: {
|
|
706
|
+
redirectUrl?: string;
|
|
707
|
+
}): void;
|
|
708
|
+
/**
|
|
709
|
+
* Выход из аккаунта с перезагрузкой страницы
|
|
710
|
+
*/
|
|
711
|
+
signOut(reloadAfter?: boolean): Promise<unknown>;
|
|
712
|
+
pushEvent(event: {
|
|
713
|
+
action: 'experiment' | 'funnel' | 'conversion' | 'click';
|
|
714
|
+
label: string;
|
|
715
|
+
}): Promise<void>;
|
|
716
|
+
/**
|
|
717
|
+
* Установить подписку пользователю
|
|
718
|
+
* @param {CommunicationSubscriptions} subscriptions пользовательские подписки
|
|
719
|
+
*/
|
|
720
|
+
setSubscriptions(subscriptions: CommunicationSubscriptions): Promise<void>;
|
|
721
|
+
/**
|
|
722
|
+
* Получение интересов пользователя
|
|
723
|
+
*/
|
|
724
|
+
getUserInterests(): Promise<UserInterests>;
|
|
725
|
+
/**
|
|
726
|
+
* Обновление интересов пользователя
|
|
727
|
+
* @param {Partial<UserInterests>} data интересы пользователя
|
|
728
|
+
*/
|
|
729
|
+
updateUserInterests(data: Partial<UserInterests>): Promise<void>;
|
|
730
|
+
/**
|
|
731
|
+
* Обновления множества интересов пользователя
|
|
732
|
+
* @param {Partial<UserInterests>} data интересы пользователя
|
|
733
|
+
*/
|
|
734
|
+
updateMultipleUserInterests(data: Partial<UserInterests>[]): Promise<void>;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
interface SdkPlugin {
|
|
738
|
+
apply(sdk: Foxford): void;
|
|
739
|
+
destroy(): void;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
declare class Foxford {
|
|
743
|
+
foxApi: ReturnType<typeof ApiService.createFoxApiInstance>;
|
|
744
|
+
api: ReturnType<typeof ApiService.createApiInstance>;
|
|
745
|
+
staticApi: ReturnType<typeof ApiService.createStaticApiInstance>;
|
|
746
|
+
user: UserService;
|
|
747
|
+
tag: TagService;
|
|
748
|
+
cart: CartService;
|
|
749
|
+
promo: PromoService;
|
|
750
|
+
course: CourseService;
|
|
751
|
+
productPack: ProductPackService;
|
|
752
|
+
leadrequest: LeadRequestService;
|
|
753
|
+
widgets: Widgets;
|
|
754
|
+
appOptions: AppOptionsService;
|
|
755
|
+
captcha: CaptchaService;
|
|
756
|
+
private readonly config;
|
|
757
|
+
static events: {
|
|
758
|
+
readonly FETCH_APP_OPTIONS: "Foxford.app_options.fetch";
|
|
759
|
+
readonly LR_REGISTRATION_SET: "LeadRequest.registration.set";
|
|
760
|
+
};
|
|
761
|
+
static DEFAULT_CONFIG: FoxfordConfig;
|
|
762
|
+
constructor(config?: FoxfordConfig);
|
|
763
|
+
private buildFoxApi;
|
|
764
|
+
/**
|
|
765
|
+
* Get short link
|
|
766
|
+
* @param {string} url link for shortening
|
|
767
|
+
*/
|
|
768
|
+
shortURL(url: string): Promise<ApiResponse<unknown>>;
|
|
769
|
+
/**
|
|
770
|
+
* Applies and throwing itself into plugin for access to Api
|
|
771
|
+
* @param {SdkPlugin} plugin Plugin to apply
|
|
772
|
+
*/
|
|
773
|
+
applyPlugin(plugin: SdkPlugin): void;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
declare const Analytics: {
|
|
777
|
+
initGlobal(): Promise<void>;
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
export { Analytics, AppOptionsService, CartService, CourseService, Foxford, FoxfordAntibot, type FoxfordAntibotConfig, type FoxfordConfig, type LeadRequest, type LeadRequestApiResponse, type LeadRequestPayload, LeadRequestService, LeadRequestType, ProductPackService, PromoService, type SdkPlugin, TagService, User, type UserDTO, type UserInterests, UserService, Widgets };
|