@foxford/sdk 6.1.2 → 6.2.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/index.d.cts CHANGED
@@ -2,76 +2,6 @@ import { ApiInstance, ApiConfig, CaptchaConfig, ApiResponse, ApiService, Captcha
2
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
3
  import { CartItemResourceType, BusinessUnitAbbreviation, Course } from '@foxford/types';
4
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
5
  type PupilRole = '11 класс' | '10 класс' | '9 класс' | '8 класс' | '7 класс' | '6 класс' | '5 класс' | '4 класс' | '3 класс' | '2 класс' | '1 класс';
76
6
  type UserRole = 'Ученик' | 'Репетитор' | 'Учитель' | 'Родитель' | 'Выпускник' | 'Дошкольник' | PupilRole;
77
7
  interface UserDTO {
@@ -396,6 +326,39 @@ declare class FoxfordAntibot {
396
326
  }) => void;
397
327
  }
398
328
 
329
+ type Widget = {
330
+ name: 'menu' | 'reviews' | 'featuredCoaches' | 'coachEnrollment' | 'shortForm' | 'userTypePrompt' | 'teachersSlider' | 'externshipFormats';
331
+ options: Record<string, any>;
332
+ container?: HTMLElement;
333
+ };
334
+ type WidgetsInitConfig = {
335
+ version?: 'latest' | string;
336
+ locale?: 'ru';
337
+ };
338
+ interface WidgetsConfig extends WidgetsInitConfig {
339
+ analyticContext?: {
340
+ prefix: string;
341
+ module: string;
342
+ payload?: Record<any, any>;
343
+ };
344
+ rootColors?: boolean;
345
+ loadFonts?: boolean;
346
+ widgets: Array<Widget>;
347
+ }
348
+ declare class Widgets {
349
+ private config;
350
+ private api;
351
+ private manifest;
352
+ static ENTRY: string[];
353
+ static DEFAULT_CONFIG: WidgetsInitConfig;
354
+ constructor(config: WidgetsInitConfig | undefined, apiInstance: ApiInstance);
355
+ create(config: WidgetsConfig): Promise<void>;
356
+ update(name: string, config: Widget): Promise<void>;
357
+ private loadManifest;
358
+ static appendScript(src: string): Promise<unknown>;
359
+ private loadAssets;
360
+ }
361
+
399
362
  type ProductTypeItem = {
400
363
  type: string;
401
364
  id: number;
package/index.d.ts CHANGED
@@ -2,76 +2,6 @@ import { ApiInstance, ApiConfig, CaptchaConfig, ApiResponse, ApiService, Captcha
2
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
3
  import { CartItemResourceType, BusinessUnitAbbreviation, Course } from '@foxford/types';
4
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
5
  type PupilRole = '11 класс' | '10 класс' | '9 класс' | '8 класс' | '7 класс' | '6 класс' | '5 класс' | '4 класс' | '3 класс' | '2 класс' | '1 класс';
76
6
  type UserRole = 'Ученик' | 'Репетитор' | 'Учитель' | 'Родитель' | 'Выпускник' | 'Дошкольник' | PupilRole;
77
7
  interface UserDTO {
@@ -396,6 +326,39 @@ declare class FoxfordAntibot {
396
326
  }) => void;
397
327
  }
398
328
 
329
+ type Widget = {
330
+ name: 'menu' | 'reviews' | 'featuredCoaches' | 'coachEnrollment' | 'shortForm' | 'userTypePrompt' | 'teachersSlider' | 'externshipFormats';
331
+ options: Record<string, any>;
332
+ container?: HTMLElement;
333
+ };
334
+ type WidgetsInitConfig = {
335
+ version?: 'latest' | string;
336
+ locale?: 'ru';
337
+ };
338
+ interface WidgetsConfig extends WidgetsInitConfig {
339
+ analyticContext?: {
340
+ prefix: string;
341
+ module: string;
342
+ payload?: Record<any, any>;
343
+ };
344
+ rootColors?: boolean;
345
+ loadFonts?: boolean;
346
+ widgets: Array<Widget>;
347
+ }
348
+ declare class Widgets {
349
+ private config;
350
+ private api;
351
+ private manifest;
352
+ static ENTRY: string[];
353
+ static DEFAULT_CONFIG: WidgetsInitConfig;
354
+ constructor(config: WidgetsInitConfig | undefined, apiInstance: ApiInstance);
355
+ create(config: WidgetsConfig): Promise<void>;
356
+ update(name: string, config: Widget): Promise<void>;
357
+ private loadManifest;
358
+ static appendScript(src: string): Promise<unknown>;
359
+ private loadAssets;
360
+ }
361
+
399
362
  type ProductTypeItem = {
400
363
  type: string;
401
364
  id: number;
package/index.js CHANGED
@@ -42,9 +42,6 @@ var __async = (__this, __arguments, generator) => {
42
42
  import { ApiService, CaptchaService as CaptchaService2 } from "@foxford/services";
43
43
 
44
44
  // src/antibot/index.ts
45
- if (typeof window !== "undefined" && window.antibotInitialized === void 0) {
46
- window.antibotInitialized = false;
47
- }
48
45
  var _FoxfordAntibot = class _FoxfordAntibot {
49
46
  constructor(config = _FoxfordAntibot.DEFAULT_CONFIG) {
50
47
  this.createAntibotFrame = (params) => {
@@ -55,6 +52,7 @@ var _FoxfordAntibot = class _FoxfordAntibot {
55
52
  }
56
53
  };
57
54
  this.config = __spreadValues(__spreadValues({}, _FoxfordAntibot.DEFAULT_CONFIG), config);
55
+ if (window.antibotInitialized === void 0) window.antibotInitialized = false;
58
56
  if (!document.body) throw new Error("Body element not found");
59
57
  if (window.onCaptureReady !== void 0) {
60
58
  console.debug("Seo4Ajax crawler injects own callback. FoxfordAntibot initialization will be ignored.");
package/index.js.flow CHANGED
@@ -46,82 +46,6 @@ import {
46
46
  type BusinessUnitAbbreviation,
47
47
  type Course,
48
48
  } from "@foxford/types";
49
- declare type Widget = {
50
- name:
51
- | "menu"
52
- | "reviews"
53
- | "featuredCoaches"
54
- | "coachEnrollment"
55
- | "shortForm"
56
- | "userTypePrompt"
57
- | "teachersSlider"
58
- | "externshipFormats",
59
- options: { [key: string]: any, ... },
60
- container?: HTMLElement,
61
- ...
62
- };
63
- declare type WidgetsInitConfig = {
64
- version?: "latest" | string,
65
- locale?: "ru",
66
- ...
67
- };
68
- declare type FoxfordWidgetsConfig = {
69
- analyticContext?: {
70
- prefix: string,
71
- module: string,
72
- payload?: { [key: string]: any, ... },
73
- ...
74
- },
75
- rootColors?: boolean,
76
- loadFonts?: boolean,
77
- widgets: Array<Widget>,
78
- ...
79
- };
80
- declare type WidgetsConfig = {
81
- analyticContext?: {
82
- prefix: string,
83
- module: string,
84
- payload?: { [key: any]: any, ... },
85
- ...
86
- },
87
- rootColors?: boolean,
88
- loadFonts?: boolean,
89
- widgets: Array<Widget>,
90
- ...
91
- } & WidgetsInitConfig;
92
- declare class Widgets {
93
- static ENTRY: string[];
94
- static DEFAULT_CONFIG: WidgetsInitConfig;
95
- constructor(config: WidgetsInitConfig | void, apiInstance: ApiInstance): this;
96
- create(config: WidgetsConfig): Promise<void>;
97
- update(name: string, config: Widget): Promise<void>;
98
- static appendScript(src: string): Promise<mixed>;
99
- }
100
- declare module "global" {
101
- declare interface Window {
102
- /**
103
- * Реферер Foxford для отслеживания источников трафика
104
- */
105
- __fox_referrer__?: string;
106
-
107
- /**
108
- * Google Tag Manager data layer для отправки событий аналитики
109
- * @see https ://developers.google.com/tag-manager/devguide
110
- */
111
- dataLayer?: Array<{ [key: string]: mixed, ... }>;
112
- antibotInitialized?: boolean;
113
- onCaptureReady?: () => void;
114
- Foxford?: {
115
- Widgets?: {
116
- create(config: FoxfordWidgetsConfig): void,
117
- update(name: string, config: Widget): void,
118
- ...
119
- },
120
- ...
121
- };
122
- }
123
- }
124
-
125
49
  declare type PupilRole =
126
50
  | "11 класс"
127
51
  | "10 класс"
@@ -492,6 +416,45 @@ declare class FoxfordAntibot {
492
416
  ...
493
417
  }) => void;
494
418
  }
419
+ declare type Widget = {
420
+ name:
421
+ | "menu"
422
+ | "reviews"
423
+ | "featuredCoaches"
424
+ | "coachEnrollment"
425
+ | "shortForm"
426
+ | "userTypePrompt"
427
+ | "teachersSlider"
428
+ | "externshipFormats",
429
+ options: { [key: string]: any, ... },
430
+ container?: HTMLElement,
431
+ ...
432
+ };
433
+ declare type WidgetsInitConfig = {
434
+ version?: "latest" | string,
435
+ locale?: "ru",
436
+ ...
437
+ };
438
+ declare type WidgetsConfig = {
439
+ analyticContext?: {
440
+ prefix: string,
441
+ module: string,
442
+ payload?: { [key: any]: any, ... },
443
+ ...
444
+ },
445
+ rootColors?: boolean,
446
+ loadFonts?: boolean,
447
+ widgets: Array<Widget>,
448
+ ...
449
+ } & WidgetsInitConfig;
450
+ declare class Widgets {
451
+ static ENTRY: string[];
452
+ static DEFAULT_CONFIG: WidgetsInitConfig;
453
+ constructor(config: WidgetsInitConfig | void, apiInstance: ApiInstance): this;
454
+ create(config: WidgetsConfig): Promise<void>;
455
+ update(name: string, config: Widget): Promise<void>;
456
+ static appendScript(src: string): Promise<mixed>;
457
+ }
495
458
  declare type ProductTypeItem = {
496
459
  type: string,
497
460
  id: number,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxford/sdk",
3
- "version": "6.1.2",
3
+ "version": "6.2.0",
4
4
  "description": "Foxford sdk for external projects",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  }
20
20
  ],
21
21
  "type": "module",
22
+ "sideEffects": false,
22
23
  "flowTypes": "./index.js.flow",
23
24
  "peerDependencies": {
24
25
  "camelcase-keys-deep": "^0.1.0",
@@ -37,6 +38,18 @@
37
38
  "require": "./index.cjs",
38
39
  "types": "./index.d.ts"
39
40
  },
41
+ "./antibot": {
42
+ "flowTypes": "./antibot.js.flow",
43
+ "import": "./antibot.js",
44
+ "require": "./antibot.cjs",
45
+ "types": "./antibot.d.ts"
46
+ },
47
+ "./entities": {
48
+ "flowTypes": "./entities.js.flow",
49
+ "import": "./entities.js",
50
+ "require": "./entities.cjs",
51
+ "types": "./entities.d.ts"
52
+ },
40
53
  "./plugins/autocomplete-email": {
41
54
  "flowTypes": "./plugins/autocomplete-email.js.flow",
42
55
  "import": "./plugins/autocomplete-email.js",
@@ -52,6 +65,16 @@
52
65
  },
53
66
  "files": [
54
67
  "README.mdx",
68
+ "antibot.cjs",
69
+ "antibot.d.cts",
70
+ "antibot.d.ts",
71
+ "antibot.js",
72
+ "antibot.js.flow",
73
+ "entities.cjs",
74
+ "entities.d.cts",
75
+ "entities.d.ts",
76
+ "entities.js",
77
+ "entities.js.flow",
55
78
  "index.cjs",
56
79
  "index.d.cts",
57
80
  "index.d.ts",
@@ -60,6 +83,6 @@
60
83
  "package.json",
61
84
  "plugins"
62
85
  ],
63
- "sha": "b1d432f",
86
+ "sha": "234f85e",
64
87
  "scripts": {}
65
88
  }