@screeb/sdk-react 0.6.0 → 0.7.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 +36 -7
- package/dist/cjs/index.cjs +24 -10
- package/dist/es/index.mjs +24 -10
- package/package.json +14 -14
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
|
|
3
|
+
<img src="https://raw.githubusercontent.com/ScreebApp/sdk/master/packages/sdk-react/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-react</h1>
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
-
<a href="https://github.com/ScreebApp/sdk
|
|
17
|
-
<img alt="ci" src="https://github.com/ScreebApp/sdk
|
|
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-react" alt="version">
|
|
20
20
|
<img alt="version" src="https://img.shields.io/npm/v/@screeb/sdk-react.svg" />
|
|
@@ -86,11 +86,40 @@ const HomePage = () => {
|
|
|
86
86
|
};
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
### Custom domains (AdBlocker bypass)
|
|
90
|
+
|
|
91
|
+
If you route Screeb traffic through your own domain (reverse proxy) to bypass AdBlockers, pass the
|
|
92
|
+
`endpoints` (and optionally `screebEndpoint` for the loader URL) through the provider's `options`
|
|
93
|
+
prop. Only the endpoints you provide are overridden; the rest fall back to Screeb's defaults.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<ScreebProvider
|
|
97
|
+
autoInit
|
|
98
|
+
websiteId={SCREEB_APP_ID}
|
|
99
|
+
options={{
|
|
100
|
+
screebEndpoint: "https://analytics.acme.com/sdk/tag.js",
|
|
101
|
+
endpoints: {
|
|
102
|
+
rpc: "https://analytics.acme.com/rpc",
|
|
103
|
+
static: "https://analytics.acme.com/static",
|
|
104
|
+
report: "https://analytics.acme.com/report",
|
|
105
|
+
hostedPage: "https://analytics.acme.com/hosted-page",
|
|
106
|
+
centipede: "wss://analytics.acme.com/centipede",
|
|
107
|
+
},
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
<HomePage />
|
|
111
|
+
</ScreebProvider>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
All endpoints must use `https://` (or `wss://` for `centipede`) and the domains must be allow-listed
|
|
115
|
+
in **Screeb Admin → Settings → Custom Domains**. See the
|
|
116
|
+
[Custom Collector URL guide](https://developers.screeb.app/sdk-js/custom-collector-url).
|
|
117
|
+
|
|
118
|
+
For a working example, see our [Screeb React SDK example app](https://github.com/ScreebApp/sdk/tree/master/examples/example-react).
|
|
90
119
|
|
|
91
|
-
For a more advanced usage and a complete API documentation, see [documentation generated from source files](https://github.com/ScreebApp/sdk
|
|
120
|
+
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-react/docs).
|
|
92
121
|
|
|
93
|
-
For further information, see [our
|
|
122
|
+
For further information, see [our developer documentation](https://developers.screeb.app/sdk-js/install).
|
|
94
123
|
|
|
95
124
|
## Support
|
|
96
125
|
For any issues, please contact our support team at support@screeb.com.
|
|
@@ -100,4 +129,4 @@ All third party contributors acknowledge that any contributions they provide wil
|
|
|
100
129
|
|
|
101
130
|
## License
|
|
102
131
|
|
|
103
|
-
Released under [MIT License](https://github.com/ScreebApp/sdk
|
|
132
|
+
Released under [MIT License](https://github.com/ScreebApp/sdk/blob/master/LICENSE).
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
38
38
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
39
|
PERFORMANCE OF THIS SOFTWARE.
|
|
40
40
|
***************************************************************************** */
|
|
41
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
41
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
var __assign = function() {
|
|
@@ -75,8 +75,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
function __generator(thisArg, body) {
|
|
78
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
79
|
-
return g =
|
|
78
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
79
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
80
80
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
81
81
|
function step(op) {
|
|
82
82
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -102,6 +102,16 @@ function __generator(thisArg, body) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
function __spreadArray(to, from, pack) {
|
|
106
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
107
|
+
if (ar || !(i in from)) {
|
|
108
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
109
|
+
ar[i] = from[i];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
113
|
+
}
|
|
114
|
+
|
|
105
115
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
106
116
|
var e = new Error(message);
|
|
107
117
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -154,10 +164,10 @@ var ScreebProvider = function (_a) {
|
|
|
154
164
|
}
|
|
155
165
|
var ensureScreeb = React__namespace.useCallback(
|
|
156
166
|
// eslint-disable-next-line no-unused-vars
|
|
157
|
-
function (
|
|
158
|
-
|
|
159
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
+
function (functionName_1, callback_1) {
|
|
168
|
+
return __awaiter(this, arguments, void 0, function (functionName, callback, onlyLoaded) {
|
|
160
169
|
var message, message;
|
|
170
|
+
if (onlyLoaded === void 0) { onlyLoaded = false; }
|
|
161
171
|
return __generator(this, function (_a) {
|
|
162
172
|
if (!Screeb__namespace.isLoaded() && !shouldLoad) {
|
|
163
173
|
message = "Screeb instance is not loaded because `shouldLoad` is set to `false` in `ScreebProvider`";
|
|
@@ -318,9 +328,13 @@ var ScreebProvider = function (_a) {
|
|
|
318
328
|
case 1: return [2 /*return*/, _a.sent()];
|
|
319
329
|
}
|
|
320
330
|
}); }); }, []);
|
|
321
|
-
var messageStart = React__namespace.useCallback(function (
|
|
322
|
-
|
|
323
|
-
|
|
331
|
+
var messageStart = React__namespace.useCallback(function (messageId_1) {
|
|
332
|
+
var args_1 = [];
|
|
333
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
334
|
+
args_1[_i - 1] = arguments[_i];
|
|
335
|
+
}
|
|
336
|
+
return __awaiter(void 0, __spreadArray([messageId_1], args_1, true), void 0, function (messageId, allowMultipleResponses, hiddenFields, hooks, language) {
|
|
337
|
+
if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
|
|
324
338
|
return __generator(this, function (_a) {
|
|
325
339
|
switch (_a.label) {
|
|
326
340
|
case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
|
|
@@ -435,4 +449,4 @@ var useScreeb = function () {
|
|
|
435
449
|
|
|
436
450
|
exports.ScreebProvider = ScreebProvider;
|
|
437
451
|
exports.useScreeb = useScreeb;
|
|
438
|
-
CONSTANTS.version = '0.
|
|
452
|
+
CONSTANTS.version = '0.7.1'
|
package/dist/es/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
16
16
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
17
|
PERFORMANCE OF THIS SOFTWARE.
|
|
18
18
|
***************************************************************************** */
|
|
19
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
19
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
var __assign = function() {
|
|
@@ -53,8 +53,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function __generator(thisArg, body) {
|
|
56
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
57
|
-
return g =
|
|
56
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
58
58
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
59
59
|
function step(op) {
|
|
60
60
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -80,6 +80,16 @@ function __generator(thisArg, body) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
function __spreadArray(to, from, pack) {
|
|
84
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
85
|
+
if (ar || !(i in from)) {
|
|
86
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
87
|
+
ar[i] = from[i];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
84
94
|
var e = new Error(message);
|
|
85
95
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -132,10 +142,10 @@ var ScreebProvider = function (_a) {
|
|
|
132
142
|
}
|
|
133
143
|
var ensureScreeb = React.useCallback(
|
|
134
144
|
// eslint-disable-next-line no-unused-vars
|
|
135
|
-
function (
|
|
136
|
-
|
|
137
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
+
function (functionName_1, callback_1) {
|
|
146
|
+
return __awaiter(this, arguments, void 0, function (functionName, callback, onlyLoaded) {
|
|
138
147
|
var message, message;
|
|
148
|
+
if (onlyLoaded === void 0) { onlyLoaded = false; }
|
|
139
149
|
return __generator(this, function (_a) {
|
|
140
150
|
if (!Screeb.isLoaded() && !shouldLoad) {
|
|
141
151
|
message = "Screeb instance is not loaded because `shouldLoad` is set to `false` in `ScreebProvider`";
|
|
@@ -296,9 +306,13 @@ var ScreebProvider = function (_a) {
|
|
|
296
306
|
case 1: return [2 /*return*/, _a.sent()];
|
|
297
307
|
}
|
|
298
308
|
}); }); }, []);
|
|
299
|
-
var messageStart = React.useCallback(function (
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
var messageStart = React.useCallback(function (messageId_1) {
|
|
310
|
+
var args_1 = [];
|
|
311
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
312
|
+
args_1[_i - 1] = arguments[_i];
|
|
313
|
+
}
|
|
314
|
+
return __awaiter(void 0, __spreadArray([messageId_1], args_1, true), void 0, function (messageId, allowMultipleResponses, hiddenFields, hooks, language) {
|
|
315
|
+
if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
|
|
302
316
|
return __generator(this, function (_a) {
|
|
303
317
|
switch (_a.label) {
|
|
304
318
|
case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
|
|
@@ -412,4 +426,4 @@ var useScreeb = function () {
|
|
|
412
426
|
};
|
|
413
427
|
|
|
414
428
|
export { ScreebProvider, useScreeb };
|
|
415
|
-
CONSTANTS.version = '0.
|
|
429
|
+
CONSTANTS.version = '0.7.1'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screeb/sdk-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Screeb's browser sdk, optimized for React.",
|
|
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
|
|
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
|
|
22
|
-
"directory": "packages/
|
|
21
|
+
"url": "https://github.com/ScreebApp/sdk.git",
|
|
22
|
+
"directory": "packages/sdk-react"
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"author": "Screeb's frontend team",
|
|
@@ -41,25 +41,25 @@
|
|
|
41
41
|
"test": "echo '@TODO'"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@screeb/sdk-browser": "^0.
|
|
44
|
+
"@screeb/sdk-browser": "^0.6.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@screeb/eslint-config": "^0.1.
|
|
48
|
-
"@screeb/typescript-config": "^0.1.
|
|
49
|
-
"@types/jest": "^29.5.
|
|
50
|
-
"@types/node": "^20.8.
|
|
51
|
-
"@types/react": "^18.2.
|
|
52
|
-
"@types/react-dom": "^18.2.
|
|
47
|
+
"@screeb/eslint-config": "^0.1.7",
|
|
48
|
+
"@screeb/typescript-config": "^0.1.12",
|
|
49
|
+
"@types/jest": "^29.5.14",
|
|
50
|
+
"@types/node": "^20.8.10",
|
|
51
|
+
"@types/react": "^18.2.79",
|
|
52
|
+
"@types/react-dom": "^18.2.25",
|
|
53
53
|
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
|
54
54
|
"eslint": "^8.51.0",
|
|
55
55
|
"eslint-plugin-import": "^2.28.1",
|
|
56
|
-
"eslint-plugin-jest": "^27.4.
|
|
56
|
+
"eslint-plugin-jest": "^27.4.3",
|
|
57
57
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
58
58
|
"eslint-plugin-prettier": "^5.0.1",
|
|
59
59
|
"jest": "^29.7.0",
|
|
60
60
|
"prettier": "^3.0.3",
|
|
61
|
-
"react": ">=
|
|
62
|
-
"react-dom": ">=
|
|
61
|
+
"react": ">=16.8.6",
|
|
62
|
+
"react-dom": ">=16.8.6",
|
|
63
63
|
"rollup": "^4.0.2",
|
|
64
64
|
"typedoc": "^0.25.2",
|
|
65
65
|
"typedoc-plugin-markdown": "^3.16.0"
|