@screeb/sdk-browser 0.1.7 → 0.1.9

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/README.md CHANGED
@@ -50,6 +50,8 @@ Screeb.load();
50
50
  Screeb.init('<your-website-id>');
51
51
  ```
52
52
 
53
+ For a working example, see our [Screeb Angular SDK example app](https://github.com/ScreebApp/sdk-js/tree/master/packages/screeb-sdk-browser-example).
54
+
53
55
  For a more advanced usage and a complete API documentation, see [documentation generated from source files](https://github.com/ScreebApp/sdk-js/tree/master/packages/screeb-sdk-browser/docs).
54
56
 
55
57
  For further information, see [our developper documentation](https://github.com/ScreebApp/developers).
@@ -14,7 +14,12 @@ export type ScreebOptions = {
14
14
  type ScreebFunction = (..._: unknown[]) => void | Promise<unknown>;
15
15
  /** This is the Screeb object publicly exposed in browser `window`. */
16
16
  export type ScreebObject = ScreebFunction & {
17
- q?: unknown[][];
17
+ q?: {
18
+ args: unknown[];
19
+ ko: (reason?: unknown) => void;
20
+ ok: (value?: unknown) => void;
21
+ v: number;
22
+ }[];
18
23
  };
19
24
  /** This is the object returned by the function `identityGet()`. */
20
25
  export type ScreebIdentityGetReturn = {
package/dist/es/index.js CHANGED
@@ -36,14 +36,22 @@ var load = function (options) {
36
36
  scriptElement.addEventListener("error", reject);
37
37
  _window.$screeb =
38
38
  (_c = _window.$screeb) !== null && _c !== void 0 ? _c : function () {
39
- var _a;
40
39
  var args = [];
41
40
  for (var _i = 0; _i < arguments.length; _i++) {
42
41
  args[_i] = arguments[_i];
43
42
  }
44
- if (_window.$screeb) {
45
- (_window.$screeb.q = (_a = _window.$screeb.q) !== null && _a !== void 0 ? _a : []).push(args);
46
- }
43
+ return new Promise(function (a, b) {
44
+ var _a;
45
+ if (_window.$screeb) {
46
+ return (_window.$screeb.q = (_a = _window.$screeb.q) !== null && _a !== void 0 ? _a : []).push({
47
+ args: args,
48
+ ko: b,
49
+ ok: a,
50
+ v: 1,
51
+ });
52
+ }
53
+ return 0;
54
+ });
47
55
  };
48
56
  _window.document.head.appendChild(scriptElement);
49
57
  });
package/docs/README.md CHANGED
@@ -75,7 +75,7 @@ ___
75
75
 
76
76
  ### ScreebObject
77
77
 
78
- Ƭ **ScreebObject**: `ScreebFunction` & { `q?`: `unknown`[][] }
78
+ Ƭ **ScreebObject**: `ScreebFunction` & { `q?`: { `args`: `unknown`[] ; `ko`: (`reason?`: `unknown`) => `void` ; `ok`: (`value?`: `unknown`) => `void` ; `v`: `number` }[] }
79
79
 
80
80
  This is the Screeb object publicly exposed in browser `window`.
81
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-browser",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Screeb's browser sdk.",
5
5
  "keywords": [
6
6
  "product discovery",
@@ -14,7 +14,7 @@
14
14
  "homepage": "https://screeb.app",
15
15
  "bugs": {
16
16
  "url": "https://github.com/ScreebApp/sdk-js/issues",
17
- "email": "suuport@screeb.app"
17
+ "email": "support@screeb.app"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -46,8 +46,8 @@
46
46
  "test": "jest"
47
47
  },
48
48
  "devDependencies": {
49
- "@screeb/eslint-config": "^0.1.4",
50
- "@screeb/typescript-config": "^0.1.4",
49
+ "@screeb/eslint-config": "^0.1.5",
50
+ "@screeb/typescript-config": "^0.1.5",
51
51
  "@types/jest": "^29.5.1",
52
52
  "@types/node": "^18.16.3",
53
53
  "@typescript-eslint/eslint-plugin": "^5.59.6",