@alfalab/bridge-to-native 1.5.2-beta.feed590 → 1.6.0-beta.9fedfeb

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.
@@ -13,13 +13,10 @@ export declare class BridgeToNative {
13
13
  * будут использованы стандартные `History: pushState()` и `History: go()`.
14
14
  * @param options.logError Функция с помощью которой B2N может залогировать ошибку,
15
15
  * если не передать, B2N не будет логировать ошибки.
16
- * @param options.isSheetWebview Признак открытия WV в шторе. Отвечает за доступность
17
- * новых методов взаимодействия с нативом. По умолчанию true.
18
16
  */
19
17
  constructor(options?: {
20
18
  browserHistoryApiWrappers?: BrowserHistoryApiWrappers;
21
19
  logError?: LogError;
22
- isSheetWebview?: boolean;
23
20
  } | undefined);
24
21
  private nativeParamsService;
25
22
  private externalLinksService;
@@ -261,13 +258,12 @@ export declare class BridgeToNative {
261
258
  * Воспроизводит тактильный отклик.
262
259
  * Работает только на iOS в версиях `17.0.0` и выше.
263
260
  *
264
- * @param isFTEnabled Значение фича-тогла webViewHapticsIOS;
265
- * при false команда не отправляется.
261
+ * Требует включённых нативных фича-тоглов mainSuperAppIOS и webViewHapticsIOS.
266
262
  * @param options.type Тип тактильного отклика.
267
263
  * @param options.intensity Интенсивность от 0 до 1, применяется только
268
264
  * к impact-типам. Если не передана, NA использует значение по умолчанию.
269
265
  */
270
- vibrate(options: HapticsOptions, isFTEnabled: boolean): void;
266
+ vibrate(options: HapticsOptions): void;
271
267
  /**
272
268
  * Задаёт область нативной шторы, за которую можно её перетаскивать.
273
269
  * Работает только на iOS в версиях `17.0.0` и выше.
@@ -18,16 +18,14 @@ class BridgeToNative {
18
18
  * будут использованы стандартные `History: pushState()` и `History: go()`.
19
19
  * @param options.logError Функция с помощью которой B2N может залогировать ошибку,
20
20
  * если не передать, B2N не будет логировать ошибки.
21
- * @param options.isSheetWebview Признак открытия WV в шторе. Отвечает за доступность
22
- * новых методов взаимодействия с нативом. По умолчанию true.
23
21
  */
24
22
  constructor(options) {
25
- var _a, _b, _c, _d, _e, _f, _g;
23
+ var _a, _b, _c, _d, _e;
26
24
  this.options = options;
27
25
  this.nativeParamsService = new native_params_service_1.NativeParamsService((_a = this.options) === null || _a === void 0 ? void 0 : _a.logError);
28
26
  this.externalLinksService = new external_links_service_1.ExternalLinksService(this.nativeParamsService, (_b = this.options) === null || _b === void 0 ? void 0 : _b.logError);
29
27
  this.nativeNavigationAndTitleService = new native_navigation_and_title_service_1.NativeNavigationAndTitleService(this.nativeParamsService, (_c = this.options) === null || _c === void 0 ? void 0 : _c.browserHistoryApiWrappers, (_d = this.options) === null || _d === void 0 ? void 0 : _d.logError);
30
- this.nativeCommandsService = new native_commands_service_1.NativeCommandsService(this.nativeParamsService, (_e = this.options) === null || _e === void 0 ? void 0 : _e.logError, (_g = (_f = this.options) === null || _f === void 0 ? void 0 : _f.isSheetWebview) !== null && _g !== void 0 ? _g : true);
28
+ this.nativeCommandsService = new native_commands_service_1.NativeCommandsService(this.nativeParamsService, (_e = this.options) === null || _e === void 0 ? void 0 : _e.logError);
31
29
  }
32
30
  /**
33
31
  * Схема NA.
@@ -318,14 +316,13 @@ class BridgeToNative {
318
316
  * Воспроизводит тактильный отклик.
319
317
  * Работает только на iOS в версиях `17.0.0` и выше.
320
318
  *
321
- * @param isFTEnabled Значение фича-тогла webViewHapticsIOS;
322
- * при false команда не отправляется.
319
+ * Требует включённых нативных фича-тоглов mainSuperAppIOS и webViewHapticsIOS.
323
320
  * @param options.type Тип тактильного отклика.
324
321
  * @param options.intensity Интенсивность от 0 до 1, применяется только
325
322
  * к impact-типам. Если не передана, NA использует значение по умолчанию.
326
323
  */
327
- vibrate(options, isFTEnabled) {
328
- this.nativeCommandsService.vibrate(options, isFTEnabled);
324
+ vibrate(options) {
325
+ this.nativeCommandsService.vibrate(options);
329
326
  }
330
327
  /**
331
328
  * Задаёт область нативной шторы, за которую можно её перетаскивать.
@@ -9,11 +9,10 @@ import { type NativeParamsService } from './native-params-service';
9
9
  */
10
10
  export declare class NativeCommandsService {
11
11
  private nativeParamsService;
12
- private isSheetWebview;
13
- constructor(nativeParamsService: NativeParamsService, logError?: LogError, isSheetWebview?: boolean);
12
+ constructor(nativeParamsService: NativeParamsService, logError?: LogError);
14
13
  private modernBridgeService;
15
14
  getGeoConfiguration(): Promise<GeoConfiguration>;
16
- vibrate({ type, intensity }: HapticsOptions, isFTEnabled: boolean): void;
15
+ vibrate({ type, intensity }: HapticsOptions): void;
17
16
  setSheetDragArea(area: SheetDragArea): void;
18
17
  hideTabbar(): void;
19
18
  showTabbar(): void;
@@ -11,9 +11,8 @@ const native_features_1 = require("./native-features");
11
11
  * данные для вызовов через {@link ModernBridgeService}.
12
12
  */
13
13
  class NativeCommandsService {
14
- constructor(nativeParamsService, logError, isSheetWebview = true) {
14
+ constructor(nativeParamsService, logError) {
15
15
  this.nativeParamsService = nativeParamsService;
16
- this.isSheetWebview = isSheetWebview;
17
16
  this.modernBridgeService = new modern_bridge_service_1.ModernBridgeService(logError);
18
17
  }
19
18
  getGeoConfiguration() {
@@ -22,8 +21,8 @@ class NativeCommandsService {
22
21
  }
23
22
  return this.modernBridgeService.call('geo.configuration', {});
24
23
  }
25
- vibrate({ type, intensity }, isFTEnabled) {
26
- if (!isFTEnabled || !this.isAvailable('haptics.vibrate')) {
24
+ vibrate({ type, intensity }) {
25
+ if (!this.isAvailable('haptics.vibrate')) {
27
26
  return;
28
27
  }
29
28
  this.modernBridgeService.send('haptics.vibrate', Object.assign({ type }, (intensity === undefined ? {} : { intensity })));
@@ -47,8 +46,13 @@ class NativeCommandsService {
47
46
  this.modernBridgeService.send('tabbar.show', {});
48
47
  }
49
48
  isAvailable(action) {
50
- return (this.isSheetWebview &&
51
- (0, native_features_1.canUseNativeCommand)(this.nativeParamsService.environment, this.nativeParamsService.appVersion, action));
49
+ const { environment, appVersion } = this.nativeParamsService;
50
+ const available = (0, native_features_1.canUseNativeCommand)(environment, appVersion, action);
51
+ if (!available) {
52
+ // eslint-disable-next-line no-console -- предупреждаем о неподдерживаемом окружении.
53
+ console.warn(`NativeCommandsService: "${action}" requires iOS and NA version 17.0.0 or later; current platform: ${environment}, version: ${appVersion}`);
54
+ }
55
+ return available;
52
56
  }
53
57
  }
54
58
  exports.NativeCommandsService = NativeCommandsService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/bridge-to-native",
3
- "version": "1.5.2-beta.feed590",
3
+ "version": "1.6.0-beta.9fedfeb",
4
4
  "license": "MIT",
5
5
  "description": "Утилита для удобной работы веб приложения внутри нативного приложения и коммуникации с ним.",
6
6
  "engines": {