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

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.
@@ -90,6 +90,10 @@ const HostIframe = ({
90
90
  ...functions,
91
91
  setHeight
92
92
  },
93
+ _functionNames: Object.keys({
94
+ ...functions,
95
+ setHeight
96
+ }),
93
97
  customFunctions: new Proxy(customFunctionsRef, {
94
98
  get: (target, p) => {
95
99
  var _target$current;
@@ -19,6 +19,7 @@ class FrameWrapper {
19
19
  exposedFunctions = null;
20
20
  exposedCustomFunctions = {};
21
21
  exposedCustomFunctionNames = [];
22
+ exposedFunctionNames = [];
22
23
  ready = new Promise(res => {
23
24
  this.resolve = res;
24
25
  });
@@ -109,6 +110,7 @@ class FrameWrapper {
109
110
  },
110
111
  isTrustedUrl: async url => {
111
112
  if (!this.initialized) await this.ready;
113
+ if (!this.exposedFunctionNames.includes('isTrustedUrl')) return true;
112
114
  return this.exposedFunctions.isTrustedUrl(url);
113
115
  },
114
116
  login: async (value, callback, closeCallback) => {
@@ -359,7 +361,7 @@ class FrameWrapper {
359
361
  }
360
362
  }
361
363
  async init() {
362
- var _await$exposed$_custo;
364
+ var _await$exposed$_funct, _await$exposed$_custo;
363
365
  if (this.initialized) return;
364
366
  const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
365
367
  const dataListener = () => exposed.addDataListener(comlink.proxy(({
@@ -390,6 +392,7 @@ class FrameWrapper {
390
392
  if (hostReadyCallback) window.removeEventListener('message', hostReadyCallback);
391
393
  this.values = await exposed.getInitialData();
392
394
  this.exposedFunctions = exposed.functions;
395
+ this.exposedFunctionNames = (_await$exposed$_funct = await exposed._functionNames) !== null && _await$exposed$_funct !== void 0 ? _await$exposed$_funct : [];
393
396
  this.exposedCustomFunctions = exposed.customFunctions;
394
397
  this.exposedCustomFunctionNames = (_await$exposed$_custo = await exposed._customFunctionNames) !== null && _await$exposed$_custo !== void 0 ? _await$exposed$_custo : [];
395
398
  this.customFunctions = this.exposedCustomFunctionNames.reduce((p, e) => {
@@ -82,6 +82,10 @@ const HostIframe = ({
82
82
  ...functions,
83
83
  setHeight
84
84
  },
85
+ _functionNames: Object.keys({
86
+ ...functions,
87
+ setHeight
88
+ }),
85
89
  customFunctions: new Proxy(customFunctionsRef, {
86
90
  get: (target, p) => {
87
91
  var _target$current;
@@ -15,6 +15,7 @@ export class FrameWrapper {
15
15
  _defineProperty(this, "exposedFunctions", null);
16
16
  _defineProperty(this, "exposedCustomFunctions", {});
17
17
  _defineProperty(this, "exposedCustomFunctionNames", []);
18
+ _defineProperty(this, "exposedFunctionNames", []);
18
19
  _defineProperty(this, "ready", new Promise(res => {
19
20
  this.resolve = res;
20
21
  }));
@@ -105,6 +106,7 @@ export class FrameWrapper {
105
106
  },
106
107
  isTrustedUrl: async url => {
107
108
  if (!this.initialized) await this.ready;
109
+ if (!this.exposedFunctionNames.includes('isTrustedUrl')) return true;
108
110
  return this.exposedFunctions.isTrustedUrl(url);
109
111
  },
110
112
  login: async (value, callback, closeCallback) => {
@@ -363,7 +365,7 @@ export class FrameWrapper {
363
365
  }
364
366
  }
365
367
  async init() {
366
- var _await$exposed$_custo;
368
+ var _await$exposed$_funct, _await$exposed$_custo;
367
369
  if (this.initialized) return;
368
370
  const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
369
371
  const dataListener = () => exposed.addDataListener(comlink.proxy(({
@@ -394,6 +396,7 @@ export class FrameWrapper {
394
396
  if (hostReadyCallback) window.removeEventListener('message', hostReadyCallback);
395
397
  this.values = await exposed.getInitialData();
396
398
  this.exposedFunctions = exposed.functions;
399
+ this.exposedFunctionNames = (_await$exposed$_funct = await exposed._functionNames) !== null && _await$exposed$_funct !== void 0 ? _await$exposed$_funct : [];
397
400
  this.exposedCustomFunctions = exposed.customFunctions;
398
401
  this.exposedCustomFunctionNames = (_await$exposed$_custo = await exposed._customFunctionNames) !== null && _await$exposed$_custo !== void 0 ? _await$exposed$_custo : [];
399
402
  this.customFunctions = this.exposedCustomFunctionNames.reduce((p, e) => {
@@ -5,6 +5,7 @@ export declare class FrameWrapper implements IChaynsReact {
5
5
  private exposedFunctions;
6
6
  private exposedCustomFunctions;
7
7
  private exposedCustomFunctionNames;
8
+ private exposedFunctionNames;
8
9
  ready: Promise<unknown>;
9
10
  values: ChaynsReactValues;
10
11
  history: FrameHistoryLayer | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "3.6.0-beta.0",
3
+ "version": "3.6.0-beta.1",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",