chayns-api 3.6.0-beta.1 → 3.6.0-beta.2

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.
@@ -72,17 +72,19 @@ const createAppleSafeAreaFunctions = functions => {
72
72
  };
73
73
  };
74
74
  const normalizeFunctions = functions => {
75
- var _runtimeFunctions$add2, _runtimeFunctions$rem2, _runtimeFunctions$get;
75
+ var _runtimeFunctions$isT;
76
76
  const runtimeFunctions = functions;
77
- if (runtimeFunctions.addAppleSafeAreaListener && runtimeFunctions.removeAppleSafeAreaListener && runtimeFunctions.getAppleSafeArea) {
77
+ const hasSafeAreaFunctions = runtimeFunctions.addAppleSafeAreaListener && runtimeFunctions.removeAppleSafeAreaListener && runtimeFunctions.getAppleSafeArea;
78
+ if (hasSafeAreaFunctions && runtimeFunctions.isTrustedUrl) {
78
79
  return functions;
79
80
  }
80
- const safeAreaFunctions = createAppleSafeAreaFunctions(functions);
81
- return {
82
- ...functions,
83
- addAppleSafeAreaListener: (_runtimeFunctions$add2 = runtimeFunctions.addAppleSafeAreaListener) !== null && _runtimeFunctions$add2 !== void 0 ? _runtimeFunctions$add2 : safeAreaFunctions.addAppleSafeAreaListener,
84
- removeAppleSafeAreaListener: (_runtimeFunctions$rem2 = runtimeFunctions.removeAppleSafeAreaListener) !== null && _runtimeFunctions$rem2 !== void 0 ? _runtimeFunctions$rem2 : safeAreaFunctions.removeAppleSafeAreaListener,
85
- getAppleSafeArea: (_runtimeFunctions$get = runtimeFunctions.getAppleSafeArea) !== null && _runtimeFunctions$get !== void 0 ? _runtimeFunctions$get : safeAreaFunctions.getAppleSafeArea
81
+ const normalizedFunctions = {
82
+ ...functions
86
83
  };
84
+ if (!hasSafeAreaFunctions) {
85
+ Object.assign(normalizedFunctions, createAppleSafeAreaFunctions(functions));
86
+ }
87
+ normalizedFunctions.isTrustedUrl = (_runtimeFunctions$isT = runtimeFunctions.isTrustedUrl) !== null && _runtimeFunctions$isT !== void 0 ? _runtimeFunctions$isT : () => Promise.resolve(true);
88
+ return normalizedFunctions;
87
89
  };
88
90
  exports.normalizeFunctions = normalizeFunctions;
@@ -66,16 +66,18 @@ const createAppleSafeAreaFunctions = functions => {
66
66
  };
67
67
  };
68
68
  export const normalizeFunctions = functions => {
69
- var _runtimeFunctions$add2, _runtimeFunctions$rem2, _runtimeFunctions$get;
69
+ var _runtimeFunctions$isT;
70
70
  const runtimeFunctions = functions;
71
- if (runtimeFunctions.addAppleSafeAreaListener && runtimeFunctions.removeAppleSafeAreaListener && runtimeFunctions.getAppleSafeArea) {
71
+ const hasSafeAreaFunctions = runtimeFunctions.addAppleSafeAreaListener && runtimeFunctions.removeAppleSafeAreaListener && runtimeFunctions.getAppleSafeArea;
72
+ if (hasSafeAreaFunctions && runtimeFunctions.isTrustedUrl) {
72
73
  return functions;
73
74
  }
74
- const safeAreaFunctions = createAppleSafeAreaFunctions(functions);
75
- return {
76
- ...functions,
77
- addAppleSafeAreaListener: (_runtimeFunctions$add2 = runtimeFunctions.addAppleSafeAreaListener) !== null && _runtimeFunctions$add2 !== void 0 ? _runtimeFunctions$add2 : safeAreaFunctions.addAppleSafeAreaListener,
78
- removeAppleSafeAreaListener: (_runtimeFunctions$rem2 = runtimeFunctions.removeAppleSafeAreaListener) !== null && _runtimeFunctions$rem2 !== void 0 ? _runtimeFunctions$rem2 : safeAreaFunctions.removeAppleSafeAreaListener,
79
- getAppleSafeArea: (_runtimeFunctions$get = runtimeFunctions.getAppleSafeArea) !== null && _runtimeFunctions$get !== void 0 ? _runtimeFunctions$get : safeAreaFunctions.getAppleSafeArea
75
+ const normalizedFunctions = {
76
+ ...functions
80
77
  };
78
+ if (!hasSafeAreaFunctions) {
79
+ Object.assign(normalizedFunctions, createAppleSafeAreaFunctions(functions));
80
+ }
81
+ normalizedFunctions.isTrustedUrl = (_runtimeFunctions$isT = runtimeFunctions.isTrustedUrl) !== null && _runtimeFunctions$isT !== void 0 ? _runtimeFunctions$isT : () => Promise.resolve(true);
82
+ return normalizedFunctions;
81
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "3.6.0-beta.1",
3
+ "version": "3.6.0-beta.2",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",