@arkeytyp/valu-api 1.0.2 → 1.0.3

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/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@arkeytyp/valu-api",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A package for developing iframe applications for Valu Social. Allows invoking functions of registered Valu applications and subscribing to events, as well as other features that enable developers creating own ifram apps for the value social",
5
5
  "main": "src/ValuApi.js",
6
6
  "scripts": {
7
7
  "test": "echo \"No test specified\" && exit 1"
8
8
  },
9
+ "types": "./types/valu-api.d.ts",
9
10
  "keywords": ["valu", "api", "iframe", "valu social", "multiverse"],
10
11
  "author": "Stanislav Osipov",
11
12
  "license": "MIT",
package/src/APIPointer.js CHANGED
@@ -37,7 +37,7 @@ export class APIPointer {
37
37
  /**
38
38
  * @private
39
39
  * @description Stores the version of the API.
40
- * @type {string}
40
+ * @type {number}
41
41
  */
42
42
  get version () {
43
43
  return this.#version;
package/src/ValuApi.js CHANGED
@@ -34,7 +34,7 @@ export class ValuApi {
34
34
  /**
35
35
  * Retrieves an APIPointer object for a specific API module.
36
36
  * @param {string} apiName The name of the API module to retrieve.
37
- * @param {string} [version] The optional version of the API module. If not provided, the APIPointer will be bound to the latest available version.
37
+ * @param {number} [version] The optional version of the API module. If not provided, the APIPointer will be bound to the latest available version.
38
38
  * @returns {APIPointer} An APIPointer object bound to the specified API version (or the latest version if no version is specified).
39
39
  *
40
40
  * The APIPointer object provides the ability to:
@@ -75,7 +75,7 @@ export class ValuApi {
75
75
  #postToValuApp(name, message) {
76
76
  const data = { name: name, message: message};
77
77
 
78
- console.log('Posting to Valu: ', name, ' ', message, ' source: ', this.#valuApplication.source);
78
+ // console.log('Posting to Valu: ', name, ' ', message, ' source: ', this.#valuApplication.source);
79
79
  this.#valuApplication.source.postMessage(data, this.#valuApplication.origin);
80
80
  }
81
81
 
@@ -133,7 +133,7 @@ export class ValuApi {
133
133
  }
134
134
 
135
135
  const message = event.data.message;
136
- console.log('Message From Valu: ', event.data.name, ' ', message);
136
+ // console.log('Message From Valu: ', event.data.name, ' ', message);
137
137
 
138
138
  switch (event.data.name) {
139
139
  case 'api:ready': {
@@ -0,0 +1,22 @@
1
+ declare module '@arkeytyp/valu-api' {
2
+ export class ValuApi {
3
+ static API_READY: string;
4
+
5
+ get connected(): boolean;
6
+
7
+ addEventListener(event: string, callback: (data: any) => void): void;
8
+ removeEventListener(event: string, callback: (data: any) => void): void;
9
+ getApi(apiName: string, version?: number): Promise<APIPointer>;
10
+ runConsoleCommand(command: string): Promise<any | string>;
11
+ }
12
+
13
+ export class APIPointer {
14
+ get guid(): string;
15
+ get apiName(): string;
16
+ get version(): number;
17
+
18
+ addEventListener(event: string, callback: (data: any) => void): void;
19
+ removeEventListener(event: string, callback: (data: any) => void): void;
20
+ run(functionName: string, params?: any): Promise<any>;
21
+ }
22
+ }