@alfalab/bridge-to-native 0.0.10 → 0.0.11

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.
@@ -41,14 +41,13 @@ class NativeFallbacks {
41
41
  */
42
42
  getExternalLinkProps(link, options = {}) {
43
43
  const { onClick, forceOpenInWebview } = options;
44
- const { iosAppId, environment, appVersion, checkAndroidAllowOpenInNewWebview } = this.b2n;
45
44
  const url = (0, utils_1.getUrlInstance)(link);
46
- const appId = (0, utils_1.getAppId)(environment, iosAppId);
45
+ const appId = (0, utils_1.getAppId)(this.b2n.environment, this.b2n.iosAppId);
47
46
  if (!forceOpenInWebview && this.b2n.canUseNativeFeature('linksInBrowser')) {
48
47
  url.searchParams.append('openInBrowser', 'true');
49
48
  return { href: url.href, onClick };
50
49
  }
51
- if (iosAppId || checkAndroidAllowOpenInNewWebview()) {
50
+ if (this.b2n.iosAppId || this.b2n.checkAndroidAllowOpenInNewWebview()) {
52
51
  return {
53
52
  href: `${appId}://webFeature?type=recommendation&url=${encodeURIComponent(url.href)}`,
54
53
  onClick: options === null || options === void 0 ? void 0 : options.onClick,
@@ -82,14 +81,13 @@ class NativeFallbacks {
82
81
  }
83
82
  let replaceUrl = url;
84
83
  const paramsStr = params.toString();
85
- const { environment, iosAppId } = this.b2n;
86
- if (environment === 'ios') {
87
- replaceUrl = `${iosAppId}:///dashboard/pdf_viewer?${paramsStr}`;
84
+ if (this.b2n.environment === 'ios') {
85
+ replaceUrl = `${this.b2n.iosAppId}:///dashboard/pdf_viewer?${paramsStr}`;
88
86
  }
89
87
  // У андройда через диплинк открывается, но предыдущий экран затирается.
90
88
  // Поэтому мы открываем base64 через конвертирование в бинарный pdf (через ручки сервиса)
91
89
  // Это позволяет перейти назад к вебвью
92
- if (environment === 'android' && type === 'base64') {
90
+ if (this.b2n.environment === 'android' && type === 'base64') {
93
91
  replaceUrl = `/services/base64-to-pdf?${paramsStr}`;
94
92
  }
95
93
  window.open(replaceUrl);
@@ -105,14 +103,13 @@ class NativeFallbacks {
105
103
  */
106
104
  visitExternalResource(link, forceOpenInWebview = false) {
107
105
  var _a;
108
- const { iosAppId, appVersion, environment, checkAndroidAllowOpenInNewWebview } = this.b2n;
109
106
  const url = (0, utils_1.getUrlInstance)(link);
110
- const appId = (0, utils_1.getAppId)(environment, iosAppId);
107
+ const appId = (0, utils_1.getAppId)(this.b2n.environment, this.b2n.iosAppId);
111
108
  if (!forceOpenInWebview && this.b2n.canUseNativeFeature('linksInBrowser')) {
112
109
  url.searchParams.append('openInBrowser', 'true');
113
110
  window.location.replace(url.href);
114
111
  }
115
- else if (iosAppId || checkAndroidAllowOpenInNewWebview()) {
112
+ else if (this.b2n.iosAppId || this.b2n.checkAndroidAllowOpenInNewWebview()) {
116
113
  window.location.replace(`${appId}://webFeature?type=recommendation&url=${encodeURIComponent(url.href)}`);
117
114
  }
118
115
  else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "UNLICENSED",
3
3
  "name": "@alfalab/bridge-to-native",
4
- "version": "0.0.10",
4
+ "version": "0.0.11",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/core-ds/bridge-to-native.git"