@screeb/sdk-browser
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -15,5 +15,23 @@ /** This is property types that are supported by Screeb. */ | ||
type ScreebFunction = (..._: unknown[]) => void | Promise<unknown>; | ||
/** This is the Screeb object publicly exposed in browser `window`. */ | ||
export type ScreebObject = ScreebFunction & { | ||
q?: unknown[][]; | ||
}; | ||
/** This is the object returned by the function `identityGet()`. */ | ||
export type ScreebIdentityGetReturn = { | ||
/** Anonymous id given to each user */ | ||
anonymous_id: string; | ||
/** The authenticated id assigned to the user. */ | ||
user_id: string; | ||
/** The current user session id */ | ||
session_id: string; | ||
/** The current user session start time */ | ||
session_start: string; | ||
/** The current user session end time */ | ||
session_end: string; | ||
/** The current channel id with which the tag was initialized */ | ||
channel_id: string; | ||
/** `true` if the tag us loaded, initialized and ready to rock */ | ||
is_ready: boolean; | ||
}; | ||
/** | ||
@@ -177,11 +195,2 @@ * Appends Screeb tag into your dom. | ||
export declare const identity: (userId: string, userProperties?: PropertyRecord) => void | Promise<unknown>; | ||
type ScreebIdentityGetReturn = { | ||
anonymous_id: string; | ||
user_id: string; | ||
session_id: string; | ||
session_start: string; | ||
session_end: string; | ||
channel_id: string; | ||
is_ready: boolean; | ||
}; | ||
/** | ||
@@ -188,0 +197,0 @@ * Retrieves the current user identity. |
var SCREEB_TAG_ENDPOINT = "https://t.screeb.app/tag.js"; | ||
var _window = window; | ||
var callScreebCommand = function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
if (_window.$screeb) { | ||
return _window.$screeb.apply(_window.$screeb, args); | ||
} | ||
return Promise.reject("[Screeb] Screeb.load() must be called before any other function."); | ||
}; | ||
/** | ||
@@ -80,3 +90,3 @@ * Appends Screeb tag into your dom. | ||
} | ||
return $screeb("init", websiteId, identityObject); | ||
return callScreebCommand("init", websiteId, identityObject); | ||
}; | ||
@@ -95,3 +105,5 @@ /** | ||
*/ | ||
var isLoaded = function () { return $screeb && typeof $screeb === "function"; }; | ||
var isLoaded = function () { | ||
return Boolean(_window.$screeb) && typeof _window.$screeb === "function"; | ||
}; | ||
/** | ||
@@ -107,3 +119,3 @@ * Shutdowns current Screeb session. | ||
*/ | ||
var close = function () { return $screeb("close"); }; | ||
var close = function () { return callScreebCommand("close"); }; | ||
/** | ||
@@ -136,3 +148,3 @@ * Prints the actual state information of Screeb tag. | ||
*/ | ||
var debug = function () { return $screeb("debug"); }; | ||
var debug = function () { return callScreebCommand("debug"); }; | ||
/** | ||
@@ -169,3 +181,3 @@ * Tracks a user event. | ||
*/ | ||
var eventTrack = function (eventName, eventProperties) { return $screeb("event.track", eventName, eventProperties); }; | ||
var eventTrack = function (eventName, eventProperties) { return callScreebCommand("event.track", eventName, eventProperties); }; | ||
/** | ||
@@ -200,3 +212,3 @@ * Change the current user identity. | ||
var identity = function (userId, userProperties) { | ||
return $screeb("identity", userId, userProperties); | ||
return callScreebCommand("identity", userId, userProperties); | ||
}; | ||
@@ -223,3 +235,3 @@ /** | ||
var identityGet = function () { | ||
return $screeb("identity.get"); | ||
return callScreebCommand("identity.get"); | ||
}; | ||
@@ -256,3 +268,5 @@ /** | ||
*/ | ||
var identityGroupAssign = function (groupName, groupType, groupProperties) { return $screeb("identity.group.assign", groupType, groupName, groupProperties); }; | ||
var identityGroupAssign = function (groupName, groupType, groupProperties) { | ||
return callScreebCommand("identity.group.assign", groupType, groupName, groupProperties); | ||
}; | ||
/** | ||
@@ -272,3 +286,3 @@ * Unassigns the current user to a group. | ||
var identityGroupUnassign = function (groupName, groupType) { | ||
return $screeb("identity.group.unassign", groupType, groupName); | ||
return callScreebCommand("identity.group.unassign", groupType, groupName); | ||
}; | ||
@@ -311,3 +325,3 @@ /** | ||
var identityProperties = function (userProperties) { | ||
return $screeb("identity.properties", userProperties); | ||
return callScreebCommand("identity.properties", userProperties); | ||
}; | ||
@@ -325,3 +339,3 @@ /** | ||
*/ | ||
var identityReset = function () { return $screeb("identity.reset"); }; | ||
var identityReset = function () { return callScreebCommand("identity.reset"); }; | ||
/** | ||
@@ -337,3 +351,3 @@ * Interrupts a running survey. | ||
*/ | ||
var surveyClose = function () { return $screeb("survey.close"); }; | ||
var surveyClose = function () { return callScreebCommand("survey.close"); }; | ||
/** | ||
@@ -359,3 +373,3 @@ * Starts a survey by its ID. | ||
if (hiddenFields === void 0) { hiddenFields = {}; } | ||
return $screeb("survey.start", surveyId, { | ||
return callScreebCommand("survey.start", surveyId, { | ||
allow_multiple_responses: allowMultipleResponses, | ||
@@ -375,3 +389,3 @@ hidden_fields: hiddenFields, | ||
*/ | ||
var targetingCheck = function () { return $screeb("targeting.check"); }; | ||
var targetingCheck = function () { return callScreebCommand("targeting.check"); }; | ||
/** | ||
@@ -401,4 +415,4 @@ * Prints the current state of the targeting engine. | ||
*/ | ||
var targetingDebug = function () { return $screeb("targeting.debug"); }; | ||
var targetingDebug = function () { return callScreebCommand("targeting.debug"); }; | ||
export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, surveyClose, surveyStart, targetingCheck, targetingDebug }; |
@@ -11,2 +11,3 @@ @screeb/sdk-browser | ||
- [PropertyType](README.md#propertytype) | ||
- [ScreebIdentityGetReturn](README.md#screebidentitygetreturn) | ||
- [ScreebObject](README.md#screebobject) | ||
@@ -56,2 +57,22 @@ - [ScreebOptions](README.md#screeboptions) | ||
### ScreebIdentityGetReturn | ||
Ƭ **ScreebIdentityGetReturn**: `Object` | ||
This is the object returned by the function `identityGet()`. | ||
#### Type declaration | ||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `anonymous_id` | `string` | Anonymous id given to each user | | ||
| `channel_id` | `string` | The current channel id with which the tag was initialized | | ||
| `is_ready` | `boolean` | `true` if the tag us loaded, initialized and ready to rock | | ||
| `session_end` | `string` | The current user session end time | | ||
| `session_id` | `string` | The current user session id | | ||
| `session_start` | `string` | The current user session start time | | ||
| `user_id` | `string` | The authenticated id assigned to the user. | | ||
___ | ||
### ScreebObject | ||
@@ -61,2 +82,4 @@ | ||
This is the Screeb object publicly exposed in browser `window`. | ||
___ | ||
@@ -215,3 +238,3 @@ | ||
▸ **identityGet**(): `Promise`<`ScreebIdentityGetReturn`\> | ||
▸ **identityGet**(): `Promise`<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\> | ||
@@ -239,3 +262,3 @@ Retrieves the current user identity. | ||
`Promise`<`ScreebIdentityGetReturn`\> | ||
`Promise`<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\> | ||
@@ -242,0 +265,0 @@ ___ |
{ | ||
"name": "@screeb/sdk-browser", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Screeb's browser sdk.", | ||
@@ -49,8 +49,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"@screeb/eslint-config": "^0.1.2", | ||
"@screeb/typescript-config": "^0.1.2", | ||
"@screeb/eslint-config": "^0.1.4", | ||
"@screeb/typescript-config": "^0.1.4", | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "^18.16.3", | ||
"@typescript-eslint/eslint-plugin": "^5.59.2", | ||
"eslint": "^8.39.0", | ||
"@typescript-eslint/eslint-plugin": "^5.59.6", | ||
"eslint": "^8.41.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
@@ -63,5 +63,5 @@ "eslint-plugin-jest": "^27.2.1", | ||
"prettier": "^2.8.8", | ||
"rollup": "^3.21.4", | ||
"rollup": "^3.23.0", | ||
"ts-jest": "^29.1.0", | ||
"typedoc": "^0.24.6", | ||
"typedoc": "^0.24.7", | ||
"typedoc-plugin-markdown": "^3.15.3" | ||
@@ -68,0 +68,0 @@ }, |
<p align="center"> | ||
<a href="https://screeb.app" alt="Intercom"> | ||
<a href="https://screeb.app" alt="Screeb"> | ||
<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;"/> | ||
@@ -12,3 +12,3 @@ </a> | ||
<a href="https://screeb.app" alt="Intercom">Screeb</a> is the only Continuous Product Discovery platform that lets you analyse users' behaviour, ask in-app questions, recruit people for interviews and analyse data in a blink with AI. | ||
<a href="https://screeb.app" alt="Screeb">Screeb</a> is the only Continuous Product Discovery platform that lets you analyse users' behaviour, ask in-app questions, recruit people for interviews and analyse data in a blink with AI. | ||
</p> | ||
@@ -15,0 +15,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38931
774