@screeb/sdk-browser 0.1.14 → 0.1.16
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/dist/cjs/index.cjs +11 -1
- package/dist/cjs/types.d.ts +6 -0
- package/dist/es/index.mjs +11 -1
- package/dist/es/types.d.ts +6 -0
- package/docs/README.md +2 -0
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var SCREEB_TAG_ENDPOINT = "https://t.screeb.app/tag.js";
|
|
4
|
+
var CONSTANTS = { version: "0.0.0-dev" };
|
|
4
5
|
var _window = typeof window === "undefined" ? undefined : window;
|
|
5
6
|
var callScreebCommand = function () {
|
|
6
7
|
var args = [];
|
|
@@ -29,13 +30,16 @@ var callScreebCommand = function () {
|
|
|
29
30
|
var load = function (options) {
|
|
30
31
|
if (options === void 0) { options = {}; }
|
|
31
32
|
return new Promise(function (resolve, reject) {
|
|
32
|
-
var _a, _b, _c;
|
|
33
|
+
var _a, _b, _c, _d, _e;
|
|
33
34
|
_window = (_a = options.window) !== null && _a !== void 0 ? _a : window;
|
|
34
35
|
var scriptElement = document.createElement("script");
|
|
35
36
|
scriptElement.async = true;
|
|
36
37
|
scriptElement.src = (_b = options.screebEndpoint) !== null && _b !== void 0 ? _b : SCREEB_TAG_ENDPOINT;
|
|
37
38
|
scriptElement.addEventListener("load", function () { return resolve(undefined); });
|
|
38
39
|
scriptElement.addEventListener("error", reject);
|
|
40
|
+
if (options.platform) {
|
|
41
|
+
_window["ScreebConfig"] = { platform: options.platform };
|
|
42
|
+
}
|
|
39
43
|
_window.$screeb =
|
|
40
44
|
(_c = _window.$screeb) !== null && _c !== void 0 ? _c : function () {
|
|
41
45
|
var args = [];
|
|
@@ -56,6 +60,11 @@ var load = function (options) {
|
|
|
56
60
|
});
|
|
57
61
|
};
|
|
58
62
|
_window.document.head.appendChild(scriptElement);
|
|
63
|
+
var context = {
|
|
64
|
+
secondary_sdk_name: (_d = options.sdkName) !== null && _d !== void 0 ? _d : "sdk-browser",
|
|
65
|
+
secondary_sdk_version: (_e = options.sdkVersion) !== null && _e !== void 0 ? _e : CONSTANTS.version,
|
|
66
|
+
};
|
|
67
|
+
callScreebCommand("client.internal.web", context);
|
|
59
68
|
});
|
|
60
69
|
};
|
|
61
70
|
/**
|
|
@@ -438,3 +447,4 @@ exports.surveyClose = surveyClose;
|
|
|
438
447
|
exports.surveyStart = surveyStart;
|
|
439
448
|
exports.targetingCheck = targetingCheck;
|
|
440
449
|
exports.targetingDebug = targetingDebug;
|
|
450
|
+
CONSTANTS.version = '0.1.16'
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -9,8 +9,14 @@ export type PropertyRecord = {
|
|
|
9
9
|
export type ScreebOptions = {
|
|
10
10
|
/** If you're running Screeb tag in an iframe, please set the inner window here. */
|
|
11
11
|
window?: Window;
|
|
12
|
+
/** SDK name (eg: sdk-browser, sdk-react, sdk-angular, etc...) */
|
|
13
|
+
sdkName?: string;
|
|
14
|
+
/** SDK version (eg: 1.2.3) */
|
|
15
|
+
sdkVersion?: string;
|
|
12
16
|
/** Please don't do this. */
|
|
13
17
|
screebEndpoint?: string;
|
|
18
|
+
/** @hidden Use a specific platform */
|
|
19
|
+
platform?: string;
|
|
14
20
|
};
|
|
15
21
|
export type ScreebFunction = (..._: unknown[]) => void | Promise<unknown>;
|
|
16
22
|
/** This is the Screeb object publicly exposed in browser `window`. */
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var SCREEB_TAG_ENDPOINT = "https://t.screeb.app/tag.js";
|
|
2
|
+
var CONSTANTS = { version: "0.0.0-dev" };
|
|
2
3
|
var _window = typeof window === "undefined" ? undefined : window;
|
|
3
4
|
var callScreebCommand = function () {
|
|
4
5
|
var args = [];
|
|
@@ -27,13 +28,16 @@ var callScreebCommand = function () {
|
|
|
27
28
|
var load = function (options) {
|
|
28
29
|
if (options === void 0) { options = {}; }
|
|
29
30
|
return new Promise(function (resolve, reject) {
|
|
30
|
-
var _a, _b, _c;
|
|
31
|
+
var _a, _b, _c, _d, _e;
|
|
31
32
|
_window = (_a = options.window) !== null && _a !== void 0 ? _a : window;
|
|
32
33
|
var scriptElement = document.createElement("script");
|
|
33
34
|
scriptElement.async = true;
|
|
34
35
|
scriptElement.src = (_b = options.screebEndpoint) !== null && _b !== void 0 ? _b : SCREEB_TAG_ENDPOINT;
|
|
35
36
|
scriptElement.addEventListener("load", function () { return resolve(undefined); });
|
|
36
37
|
scriptElement.addEventListener("error", reject);
|
|
38
|
+
if (options.platform) {
|
|
39
|
+
_window["ScreebConfig"] = { platform: options.platform };
|
|
40
|
+
}
|
|
37
41
|
_window.$screeb =
|
|
38
42
|
(_c = _window.$screeb) !== null && _c !== void 0 ? _c : function () {
|
|
39
43
|
var args = [];
|
|
@@ -54,6 +58,11 @@ var load = function (options) {
|
|
|
54
58
|
});
|
|
55
59
|
};
|
|
56
60
|
_window.document.head.appendChild(scriptElement);
|
|
61
|
+
var context = {
|
|
62
|
+
secondary_sdk_name: (_d = options.sdkName) !== null && _d !== void 0 ? _d : "sdk-browser",
|
|
63
|
+
secondary_sdk_version: (_e = options.sdkVersion) !== null && _e !== void 0 ? _e : CONSTANTS.version,
|
|
64
|
+
};
|
|
65
|
+
callScreebCommand("client.internal.web", context);
|
|
57
66
|
});
|
|
58
67
|
};
|
|
59
68
|
/**
|
|
@@ -421,3 +430,4 @@ var targetingCheck = function () { return callScreebCommand("targeting.check");
|
|
|
421
430
|
var targetingDebug = function () { return callScreebCommand("targeting.debug"); };
|
|
422
431
|
|
|
423
432
|
export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, surveyClose, surveyStart, targetingCheck, targetingDebug };
|
|
433
|
+
CONSTANTS.version = '0.1.16'
|
package/dist/es/types.d.ts
CHANGED
|
@@ -9,8 +9,14 @@ export type PropertyRecord = {
|
|
|
9
9
|
export type ScreebOptions = {
|
|
10
10
|
/** If you're running Screeb tag in an iframe, please set the inner window here. */
|
|
11
11
|
window?: Window;
|
|
12
|
+
/** SDK name (eg: sdk-browser, sdk-react, sdk-angular, etc...) */
|
|
13
|
+
sdkName?: string;
|
|
14
|
+
/** SDK version (eg: 1.2.3) */
|
|
15
|
+
sdkVersion?: string;
|
|
12
16
|
/** Please don't do this. */
|
|
13
17
|
screebEndpoint?: string;
|
|
18
|
+
/** @hidden Use a specific platform */
|
|
19
|
+
platform?: string;
|
|
14
20
|
};
|
|
15
21
|
export type ScreebFunction = (..._: unknown[]) => void | Promise<unknown>;
|
|
16
22
|
/** This is the Screeb object publicly exposed in browser `window`. */
|
package/docs/README.md
CHANGED
|
@@ -354,6 +354,8 @@ This is the Screeb tag options object.
|
|
|
354
354
|
| Name | Type | Description |
|
|
355
355
|
| :------ | :------ | :------ |
|
|
356
356
|
| `screebEndpoint?` | `string` | Please don't do this. |
|
|
357
|
+
| `sdkName?` | `string` | SDK name (eg: sdk-browser, sdk-react, sdk-angular, etc...) |
|
|
358
|
+
| `sdkVersion?` | `string` | SDK version (eg: 1.2.3) |
|
|
357
359
|
| `window?` | `Window` | If you're running Screeb tag in an iframe, please set the inner window here. |
|
|
358
360
|
|
|
359
361
|
___
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screeb/sdk-browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Screeb's browser sdk.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"product discovery",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@screeb/eslint-config": "^0.1.6",
|
|
45
|
-
"@screeb/typescript-config": "^0.1.
|
|
45
|
+
"@screeb/typescript-config": "^0.1.10",
|
|
46
46
|
"@types/jest": "^29.5.5",
|
|
47
47
|
"@types/node": "^20.8.4",
|
|
48
48
|
"@typescript-eslint/eslint-plugin": "^6.7.5",
|