@screeb/sdk-browser 0.5.0 → 0.6.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://screeb.app" alt="Screeb">
3
- <img src="https://raw.githubusercontent.com/ScreebApp/sdk-js/master/packages/screeb-sdk-browser/readme/screeb-logo.svg?token=GHSAT0AAAAAAB2OOPMGT2QD5TL3IRJN3CKCZDEYHJA" alt="Logo" height="120px" style="margin-top: 20px;"/>
3
+ <img src="https://raw.githubusercontent.com/ScreebApp/sdk/master/packages/sdk-browser/readme/screeb-logo.svg" alt="Logo" height="120px" style="margin-top: 20px;"/>
4
4
  </a>
5
5
  </p>
6
6
  <h1 align="center">@screeb/sdk-browser</h1>
@@ -13,8 +13,8 @@
13
13
  </p>
14
14
 
15
15
  <p align="center">
16
- <a href="https://github.com/ScreebApp/sdk-js/actions/workflows/node.js.yml" alt="ci">
17
- <img alt="ci" src="https://github.com/ScreebApp/sdk-js/actions/workflows/node.js.yml/badge.svg">
16
+ <a href="https://github.com/ScreebApp/sdk/actions/workflows/ci.yml" alt="ci">
17
+ <img alt="ci" src="https://github.com/ScreebApp/sdk/actions/workflows/ci.yml/badge.svg">
18
18
  </a>
19
19
  <a href="https://www.npmjs.com/package/@screeb/sdk-browser" alt="version">
20
20
  <img alt="version" src="https://img.shields.io/npm/v/@screeb/sdk-browser.svg" />
@@ -50,11 +50,39 @@ 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).
53
+ ### Custom domains (AdBlocker bypass)
54
54
 
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).
55
+ If you route Screeb traffic through your own domain (reverse proxy) to bypass AdBlockers, pass an
56
+ `endpoints` object to `load()`. Only the endpoints you provide are overridden; the rest fall back
57
+ to Screeb's defaults. The tag loader URL itself is set separately via `screebEndpoint`.
56
58
 
57
- For further information, see [our developper documentation](https://github.com/ScreebApp/developers).
59
+ ```ts
60
+ import * as Screeb from "@screeb/sdk-browser";
61
+
62
+ Screeb.load({
63
+ // Load the SDK bundle from your domain
64
+ screebEndpoint: "https://analytics.acme.com/sdk/tag.js",
65
+ // Route collector traffic through your domain
66
+ endpoints: {
67
+ rpc: "https://analytics.acme.com/rpc",
68
+ static: "https://analytics.acme.com/static",
69
+ report: "https://analytics.acme.com/report",
70
+ hostedPage: "https://analytics.acme.com/hosted-page",
71
+ centipede: "wss://analytics.acme.com/centipede",
72
+ },
73
+ });
74
+ Screeb.init('<your-website-id>');
75
+ ```
76
+
77
+ All endpoints must use `https://` (or `wss://` for `centipede`) and the domains must be allow-listed
78
+ in **Screeb Admin → Settings → Custom Domains**. See the
79
+ [Custom Collector URL guide](https://developers.screeb.app/sdk-js/custom-collector-url).
80
+
81
+ For a working example, see our [Screeb Browser SDK example app](https://github.com/ScreebApp/sdk/tree/master/examples/example-browser).
82
+
83
+ For a more advanced usage and a complete API documentation, see [documentation generated from source files](https://github.com/ScreebApp/sdk/tree/master/packages/sdk-browser/docs).
84
+
85
+ For further information, see [our developer documentation](https://developers.screeb.app/sdk-js/install).
58
86
 
59
87
  ## Support
60
88
  For any issues, please contact our support team at support@screeb.com.
@@ -64,4 +92,4 @@ All third party contributors acknowledge that any contributions they provide wil
64
92
 
65
93
  ## License
66
94
 
67
- Released under [MIT License](https://github.com/ScreebApp/sdk-js/blob/master/LICENSE).
95
+ Released under [MIT License](https://github.com/ScreebApp/sdk/blob/master/LICENSE).
@@ -14,7 +14,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
14
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
15
  PERFORMANCE OF THIS SOFTWARE.
16
16
  ***************************************************************************** */
17
- /* global Reflect, Promise, SuppressedError, Symbol */
17
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
18
18
 
19
19
 
20
20
  var __assign = function() {
@@ -52,6 +52,8 @@ var callScreebCommand = function () {
52
52
  * @param options Screeb module options.
53
53
  * @param options.window If you're running Screeb tag in an iframe, please set the inner window here.
54
54
  * @param options.screebEndpoint Please don't do this.
55
+ * @param options.endpoints Override Screeb's collector URLs to route traffic through your own
56
+ * domain (custom domains / AdBlocker bypass). Only the endpoints you provide are overridden.
55
57
  *
56
58
  * @example
57
59
  * ```ts
@@ -70,8 +72,8 @@ var load = function (options) {
70
72
  scriptElement.src = (_b = options.screebEndpoint) !== null && _b !== void 0 ? _b : SCREEB_TAG_ENDPOINT;
71
73
  scriptElement.addEventListener("load", function () { return resolve(undefined); });
72
74
  scriptElement.addEventListener("error", reject);
73
- if (options.platform) {
74
- _window["ScreebConfig"] = { platform: options.platform };
75
+ if (options.platform || options.endpoints) {
76
+ _window["ScreebConfig"] = __assign(__assign({}, (options.platform ? { platform: options.platform } : {})), (options.endpoints ? { endpoints: options.endpoints } : {}));
75
77
  }
76
78
  _window.$screeb =
77
79
  (_c = _window.$screeb) !== null && _c !== void 0 ? _c : function () {
@@ -563,4 +565,4 @@ exports.surveyClose = surveyClose;
563
565
  exports.surveyStart = surveyStart;
564
566
  exports.targetingCheck = targetingCheck;
565
567
  exports.targetingDebug = targetingDebug;
566
- CONSTANTS.version = '0.5.0'
568
+ CONSTANTS.version = '0.6.1'
@@ -8,6 +8,8 @@ export * from "./hooks.types";
8
8
  * @param options Screeb module options.
9
9
  * @param options.window If you're running Screeb tag in an iframe, please set the inner window here.
10
10
  * @param options.screebEndpoint Please don't do this.
11
+ * @param options.endpoints Override Screeb's collector URLs to route traffic through your own
12
+ * domain (custom domains / AdBlocker bypass). Only the endpoints you provide are overridden.
11
13
  *
12
14
  * @example
13
15
  * ```ts
@@ -4,6 +4,28 @@ export type PropertyType = number | boolean | string | Date | PropertyRecord;
4
4
  export type PropertyRecord = {
5
5
  [key: string]: PropertyType | PropertyType[];
6
6
  };
7
+ /**
8
+ * Custom collector URLs used to bypass AdBlockers by routing Screeb traffic
9
+ * through your own domain (reverse proxy).
10
+ *
11
+ * Every key is optional: any omitted endpoint falls back to Screeb's default
12
+ * URL. All endpoints must use `https://` (or `wss://` for the WebSocket one),
13
+ * and the domains must be allow-listed in Screeb Admin → Settings → Custom Domains.
14
+ *
15
+ * @see https://developers.screeb.app/sdk-js/custom-collector-url
16
+ */
17
+ export type ScreebEndpoints = {
18
+ /** REST API (surveys, tracking). Default: `https://rpc.screeb.app/rpc`. */
19
+ rpc?: string;
20
+ /** Static assets (images, fonts). Default: `https://static.screeb.app`. */
21
+ static?: string;
22
+ /** Response reporting. Default: `https://r.screeb.app/rpc`. */
23
+ report?: string;
24
+ /** Hosted survey page. Default: `https://survey.screeb.app`. */
25
+ hostedPage?: string;
26
+ /** WebSocket (real-time targeting). Default: `wss://centipede.screeb.app`. */
27
+ centipede?: string;
28
+ };
7
29
  /** This is the Screeb tag options object. */
8
30
  export type ScreebOptions = {
9
31
  /** If you're running Screeb tag in an iframe, please set the inner window here. */
@@ -14,6 +36,14 @@ export type ScreebOptions = {
14
36
  sdkVersion?: string;
15
37
  /** Please don't do this. */
16
38
  screebEndpoint?: string;
39
+ /**
40
+ * Override Screeb's collector URLs to route traffic through your own domain
41
+ * (custom domains / AdBlocker bypass). Only the endpoints you provide are
42
+ * overridden; the rest fall back to Screeb's defaults.
43
+ *
44
+ * @see https://developers.screeb.app/sdk-js/custom-collector-url
45
+ */
46
+ endpoints?: ScreebEndpoints;
17
47
  /** @hidden Use a specific platform */
18
48
  platform?: string;
19
49
  };
@@ -8,6 +8,8 @@ export * from "./hooks.types";
8
8
  * @param options Screeb module options.
9
9
  * @param options.window If you're running Screeb tag in an iframe, please set the inner window here.
10
10
  * @param options.screebEndpoint Please don't do this.
11
+ * @param options.endpoints Override Screeb's collector URLs to route traffic through your own
12
+ * domain (custom domains / AdBlocker bypass). Only the endpoints you provide are overridden.
11
13
  *
12
14
  * @example
13
15
  * ```ts
package/dist/es/index.mjs CHANGED
@@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
14
  ***************************************************************************** */
15
- /* global Reflect, Promise, SuppressedError, Symbol */
15
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
16
16
 
17
17
 
18
18
  var __assign = function() {
@@ -50,6 +50,8 @@ var callScreebCommand = function () {
50
50
  * @param options Screeb module options.
51
51
  * @param options.window If you're running Screeb tag in an iframe, please set the inner window here.
52
52
  * @param options.screebEndpoint Please don't do this.
53
+ * @param options.endpoints Override Screeb's collector URLs to route traffic through your own
54
+ * domain (custom domains / AdBlocker bypass). Only the endpoints you provide are overridden.
53
55
  *
54
56
  * @example
55
57
  * ```ts
@@ -68,8 +70,8 @@ var load = function (options) {
68
70
  scriptElement.src = (_b = options.screebEndpoint) !== null && _b !== void 0 ? _b : SCREEB_TAG_ENDPOINT;
69
71
  scriptElement.addEventListener("load", function () { return resolve(undefined); });
70
72
  scriptElement.addEventListener("error", reject);
71
- if (options.platform) {
72
- _window["ScreebConfig"] = { platform: options.platform };
73
+ if (options.platform || options.endpoints) {
74
+ _window["ScreebConfig"] = __assign(__assign({}, (options.platform ? { platform: options.platform } : {})), (options.endpoints ? { endpoints: options.endpoints } : {}));
73
75
  }
74
76
  _window.$screeb =
75
77
  (_c = _window.$screeb) !== null && _c !== void 0 ? _c : function () {
@@ -542,4 +544,4 @@ var targetingCheck = function () { return callScreebCommand("targeting.check");
542
544
  var targetingDebug = function () { return callScreebCommand("targeting.debug"); };
543
545
 
544
546
  export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, messageClose, messageStart, sessionReplayStart, sessionReplayStop, surveyClose, surveyStart, targetingCheck, targetingDebug };
545
- CONSTANTS.version = '0.5.0'
547
+ CONSTANTS.version = '0.6.1'
@@ -4,6 +4,28 @@ export type PropertyType = number | boolean | string | Date | PropertyRecord;
4
4
  export type PropertyRecord = {
5
5
  [key: string]: PropertyType | PropertyType[];
6
6
  };
7
+ /**
8
+ * Custom collector URLs used to bypass AdBlockers by routing Screeb traffic
9
+ * through your own domain (reverse proxy).
10
+ *
11
+ * Every key is optional: any omitted endpoint falls back to Screeb's default
12
+ * URL. All endpoints must use `https://` (or `wss://` for the WebSocket one),
13
+ * and the domains must be allow-listed in Screeb Admin → Settings → Custom Domains.
14
+ *
15
+ * @see https://developers.screeb.app/sdk-js/custom-collector-url
16
+ */
17
+ export type ScreebEndpoints = {
18
+ /** REST API (surveys, tracking). Default: `https://rpc.screeb.app/rpc`. */
19
+ rpc?: string;
20
+ /** Static assets (images, fonts). Default: `https://static.screeb.app`. */
21
+ static?: string;
22
+ /** Response reporting. Default: `https://r.screeb.app/rpc`. */
23
+ report?: string;
24
+ /** Hosted survey page. Default: `https://survey.screeb.app`. */
25
+ hostedPage?: string;
26
+ /** WebSocket (real-time targeting). Default: `wss://centipede.screeb.app`. */
27
+ centipede?: string;
28
+ };
7
29
  /** This is the Screeb tag options object. */
8
30
  export type ScreebOptions = {
9
31
  /** If you're running Screeb tag in an iframe, please set the inner window here. */
@@ -14,6 +36,14 @@ export type ScreebOptions = {
14
36
  sdkVersion?: string;
15
37
  /** Please don't do this. */
16
38
  screebEndpoint?: string;
39
+ /**
40
+ * Override Screeb's collector URLs to route traffic through your own domain
41
+ * (custom domains / AdBlocker bypass). Only the endpoints you provide are
42
+ * overridden; the rest fall back to Screeb's defaults.
43
+ *
44
+ * @see https://developers.screeb.app/sdk-js/custom-collector-url
45
+ */
46
+ endpoints?: ScreebEndpoints;
17
47
  /** @hidden Use a specific platform */
18
48
  platform?: string;
19
49
  };
package/docs/README.md CHANGED
@@ -33,6 +33,7 @@
33
33
  - [ResponseItemAnswer](README.md#responseitemanswer)
34
34
  - [ResponseItemQuestion](README.md#responseitemquestion)
35
35
  - [ResponseStatus](README.md#responsestatus)
36
+ - [ScreebEndpoints](README.md#screebendpoints)
36
37
  - [ScreebFunction](README.md#screebfunction)
37
38
  - [ScreebIdentityGetReturn](README.md#screebidentitygetreturn)
38
39
  - [ScreebObject](README.md#screebobject)
@@ -478,6 +479,33 @@ ___
478
479
 
479
480
  ___
480
481
 
482
+ ### ScreebEndpoints
483
+
484
+ Ƭ **ScreebEndpoints**: `Object`
485
+
486
+ Custom collector URLs used to bypass AdBlockers by routing Screeb traffic
487
+ through your own domain (reverse proxy).
488
+
489
+ Every key is optional: any omitted endpoint falls back to Screeb's default
490
+ URL. All endpoints must use `https://` (or `wss://` for the WebSocket one),
491
+ and the domains must be allow-listed in Screeb Admin → Settings → Custom Domains.
492
+
493
+ **`See`**
494
+
495
+ https://developers.screeb.app/sdk-js/custom-collector-url
496
+
497
+ #### Type declaration
498
+
499
+ | Name | Type | Description |
500
+ | :------ | :------ | :------ |
501
+ | `centipede?` | `string` | WebSocket (real-time targeting). Default: `wss://centipede.screeb.app`. |
502
+ | `hostedPage?` | `string` | Hosted survey page. Default: `https://survey.screeb.app`. |
503
+ | `report?` | `string` | Response reporting. Default: `https://r.screeb.app/rpc`. |
504
+ | `rpc?` | `string` | REST API (surveys, tracking). Default: `https://rpc.screeb.app/rpc`. |
505
+ | `static?` | `string` | Static assets (images, fonts). Default: `https://static.screeb.app`. |
506
+
507
+ ___
508
+
481
509
  ### ScreebFunction
482
510
 
483
511
  Ƭ **ScreebFunction**: (...`_`: `unknown`[]) => `void` \| `Promise`\<`unknown`\>
@@ -536,6 +564,7 @@ This is the Screeb tag options object.
536
564
 
537
565
  | Name | Type | Description |
538
566
  | :------ | :------ | :------ |
567
+ | `endpoints?` | [`ScreebEndpoints`](README.md#screebendpoints) | Override Screeb's collector URLs to route traffic through your own domain (custom domains / AdBlocker bypass). Only the endpoints you provide are overridden; the rest fall back to Screeb's defaults. **`See`** https://developers.screeb.app/sdk-js/custom-collector-url |
539
568
  | `screebEndpoint?` | `string` | Please don't do this. |
540
569
  | `sdkName?` | `string` | SDK name (eg: sdk-browser, sdk-react, sdk-angular, etc...) |
541
570
  | `sdkVersion?` | `string` | SDK version (eg: 1.2.3) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-browser",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Screeb's browser sdk.",
5
5
  "keywords": [
6
6
  "product discovery",
@@ -13,13 +13,13 @@
13
13
  ],
14
14
  "homepage": "https://screeb.app",
15
15
  "bugs": {
16
- "url": "https://github.com/ScreebApp/sdk-js/issues",
16
+ "url": "https://github.com/ScreebApp/sdk/issues",
17
17
  "email": "support@screeb.app"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "https://github.com/ScreebApp/sdk-js.git",
22
- "directory": "packages/screeb-sdk-browser"
21
+ "url": "https://github.com/ScreebApp/sdk.git",
22
+ "directory": "packages/sdk-browser"
23
23
  },
24
24
  "license": "MIT",
25
25
  "author": "Screeb's frontend team",
@@ -41,21 +41,21 @@
41
41
  "test": "echo 'test disabled'"
42
42
  },
43
43
  "devDependencies": {
44
- "@screeb/eslint-config": "^0.1.6",
45
- "@screeb/typescript-config": "^0.1.10",
46
- "@types/jest": "^29.5.5",
47
- "@types/node": "^20.8.4",
44
+ "@screeb/eslint-config": "^0.1.7",
45
+ "@screeb/typescript-config": "^0.1.12",
46
+ "@types/jest": "^29.5.14",
47
+ "@types/node": "^20.8.10",
48
48
  "@typescript-eslint/eslint-plugin": "^6.7.5",
49
49
  "eslint": "^8.51.0",
50
50
  "eslint-plugin-import": "^2.28.1",
51
- "eslint-plugin-jest": "^27.4.2",
51
+ "eslint-plugin-jest": "^27.4.3",
52
52
  "eslint-plugin-jsx-a11y": "^6.7.1",
53
53
  "eslint-plugin-prettier": "^5.0.1",
54
54
  "jest": "^29.7.0",
55
55
  "jest-environment-jsdom": "^29.7.0",
56
56
  "prettier": "^3.0.3",
57
57
  "rollup": "^4.0.2",
58
- "ts-jest": "^29.1.1",
58
+ "ts-jest": "^29.1.5",
59
59
  "typedoc": "^0.25.2",
60
60
  "typedoc-plugin-markdown": "^3.16.0"
61
61
  },