@screeb/sdk-vue 0.1.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 ADDED
@@ -0,0 +1,47 @@
1
+ # @screeb/sdk-vue
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@screeb/sdk-vue.svg)](https://www.npmjs.com/package/@screeb/sdk-vue)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Screeb SDK for Vue 3 — wraps `@screeb/sdk-browser` with a Plugin + `useScreeb` composable.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install @screeb/sdk-vue --save
12
+ ```
13
+
14
+ ## Setup
15
+
16
+ ```ts
17
+ // main.ts
18
+ import { createApp } from 'vue'
19
+ import { ScreebPlugin } from '@screeb/sdk-vue'
20
+ import App from './App.vue'
21
+
22
+ createApp(App)
23
+ .use(ScreebPlugin, {
24
+ websiteId: '<YOUR-CHANNEL-ID>',
25
+ autoInit: true,
26
+ userId: '<USER-ID>',
27
+ })
28
+ .mount('#app')
29
+ ```
30
+
31
+ ## Use in components
32
+
33
+ ```vue
34
+ <script setup lang="ts">
35
+ import { useScreeb } from '@screeb/sdk-vue'
36
+
37
+ const { eventTrack } = useScreeb()
38
+ </script>
39
+
40
+ <template>
41
+ <button @click="() => eventTrack('button-clicked')">Track</button>
42
+ </template>
43
+ ```
44
+
45
+ ## Documentation
46
+
47
+ [https://developers.screeb.app/sdk-vue/install](https://developers.screeb.app/sdk-vue/install)
@@ -0,0 +1,2 @@
1
+ import { ScreebContextValues } from "./types";
2
+ export declare function useScreeb(): ScreebContextValues;
@@ -0,0 +1,4 @@
1
+ declare const CONSTANTS: {
2
+ version: string;
3
+ };
4
+ export default CONSTANTS;
@@ -0,0 +1,399 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var Screeb = require('@screeb/sdk-browser');
5
+
6
+ function _interopNamespaceDefault(e) {
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var Screeb__namespace = /*#__PURE__*/_interopNamespaceDefault(Screeb);
24
+
25
+ /******************************************************************************
26
+ Copyright (c) Microsoft Corporation.
27
+
28
+ Permission to use, copy, modify, and/or distribute this software for any
29
+ purpose with or without fee is hereby granted.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
32
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
33
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
34
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
35
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
36
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
37
+ PERFORMANCE OF THIS SOFTWARE.
38
+ ***************************************************************************** */
39
+ /* global Reflect, Promise, SuppressedError, Symbol */
40
+
41
+
42
+ var __assign = function() {
43
+ __assign = Object.assign || function __assign(t) {
44
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
45
+ s = arguments[i];
46
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
47
+ }
48
+ return t;
49
+ };
50
+ return __assign.apply(this, arguments);
51
+ };
52
+
53
+ function __awaiter(thisArg, _arguments, P, generator) {
54
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
55
+ return new (P || (P = Promise))(function (resolve, reject) {
56
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
57
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
58
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
59
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
60
+ });
61
+ }
62
+
63
+ function __generator(thisArg, body) {
64
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
65
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
66
+ function verb(n) { return function (v) { return step([n, v]); }; }
67
+ function step(op) {
68
+ if (f) throw new TypeError("Generator is already executing.");
69
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
70
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
71
+ if (y = 0, t) op = [op[0] & 2, t.value];
72
+ switch (op[0]) {
73
+ case 0: case 1: t = op; break;
74
+ case 4: _.label++; return { value: op[1], done: false };
75
+ case 5: _.label++; y = op[1]; op = [0]; continue;
76
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
77
+ default:
78
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
79
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
80
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
81
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
82
+ if (t[2]) _.ops.pop();
83
+ _.trys.pop(); continue;
84
+ }
85
+ op = body.call(thisArg, _);
86
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
87
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
88
+ }
89
+ }
90
+
91
+ function __spreadArray(to, from, pack) {
92
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
93
+ if (ar || !(i in from)) {
94
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
95
+ ar[i] = from[i];
96
+ }
97
+ }
98
+ return to.concat(ar || Array.prototype.slice.call(from));
99
+ }
100
+
101
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
102
+ var e = new Error(message);
103
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
104
+ };
105
+
106
+ var CONSTANTS = { version: "0.0.0-dev" };
107
+
108
+ var log = function (level, message) {
109
+ var packageName = "[@screeb/vue-sdk]";
110
+ switch (level) {
111
+ case "info":
112
+ // eslint-disable-next-line no-console
113
+ console.log("".concat(packageName, " ").concat(message));
114
+ break;
115
+ case "warn":
116
+ // eslint-disable-next-line no-console
117
+ console.warn("".concat(packageName, " ").concat(message));
118
+ break;
119
+ case "error":
120
+ // eslint-disable-next-line no-console
121
+ console.error("".concat(packageName, " ").concat(message));
122
+ break;
123
+ default:
124
+ // eslint-disable-next-line no-console
125
+ console.log("".concat(packageName, " ").concat(message));
126
+ }
127
+ };
128
+
129
+ var isSSR = typeof window === "undefined";
130
+
131
+ var SCREEB_PLUGIN_KEY = Symbol("screeb");
132
+ var isInitialized = false;
133
+ var ScreebPlugin = {
134
+ install: function (app, config) {
135
+ var _this = this;
136
+ var _a;
137
+ var reactiveConfig = vue.reactive(config);
138
+ var ensureScreeb = function (functionName_1, callback_1) {
139
+ return __awaiter(this, arguments, void 0, function (functionName, callback, onlyLoaded) {
140
+ var shouldLoad, message, message;
141
+ var _a;
142
+ if (onlyLoaded === void 0) { onlyLoaded = false; }
143
+ return __generator(this, function (_b) {
144
+ shouldLoad = (_a = reactiveConfig.shouldLoad) !== null && _a !== void 0 ? _a : true;
145
+ if (!Screeb__namespace.isLoaded() && !shouldLoad) {
146
+ message = "Screeb instance is not loaded because `shouldLoad` is set to `false` in `ScreebPlugin`";
147
+ log("warn", message);
148
+ return [2 /*return*/, Promise.reject(message)];
149
+ }
150
+ if (!isInitialized && !onlyLoaded) {
151
+ message = [
152
+ "\"".concat(functionName, "\" was called but Screeb has not been initialized yet. "),
153
+ "Please call 'init' before calling '".concat(functionName, "' or "),
154
+ "set 'autoInit' to true in the ScreebPlugin config.",
155
+ ].join("");
156
+ log("warn", message);
157
+ return [2 /*return*/, Promise.reject(message)];
158
+ }
159
+ return [2 /*return*/, Promise.resolve(callback())];
160
+ });
161
+ });
162
+ };
163
+ var close = function () { return __awaiter(_this, void 0, void 0, function () {
164
+ return __generator(this, function (_a) {
165
+ switch (_a.label) {
166
+ case 0:
167
+ if (!Screeb__namespace.isLoaded()) return [3 /*break*/, 2];
168
+ return [4 /*yield*/, Screeb__namespace.close()];
169
+ case 1:
170
+ _a.sent();
171
+ isInitialized = false;
172
+ _a.label = 2;
173
+ case 2: return [2 /*return*/];
174
+ }
175
+ });
176
+ }); };
177
+ var debug = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
178
+ switch (_a.label) {
179
+ case 0: return [4 /*yield*/, ensureScreeb("debug", function () { return Screeb__namespace.debug(); })];
180
+ case 1: return [2 /*return*/, _a.sent()];
181
+ }
182
+ }); }); };
183
+ var eventTrack = function (eventName, eventProperties) { return __awaiter(_this, void 0, void 0, function () {
184
+ return __generator(this, function (_a) {
185
+ switch (_a.label) {
186
+ case 0: return [4 /*yield*/, ensureScreeb("eventTrack", function () {
187
+ return Screeb__namespace.eventTrack(eventName, eventProperties);
188
+ })];
189
+ case 1: return [2 /*return*/, _a.sent()];
190
+ }
191
+ });
192
+ }); };
193
+ var identity = function (userId, userProperties) { return __awaiter(_this, void 0, void 0, function () {
194
+ return __generator(this, function (_a) {
195
+ switch (_a.label) {
196
+ case 0: return [4 /*yield*/, ensureScreeb("identity", function () {
197
+ return Screeb__namespace.identity(userId, userProperties);
198
+ })];
199
+ case 1: return [2 /*return*/, _a.sent()];
200
+ }
201
+ });
202
+ }); };
203
+ var identityGet = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
204
+ switch (_a.label) {
205
+ case 0: return [4 /*yield*/, ensureScreeb("identityGet", function () { return Screeb__namespace.identityGet(); })];
206
+ case 1: return [2 /*return*/, _a.sent()];
207
+ }
208
+ }); }); };
209
+ var identityGroupAssign = function (groupName, groupType, groupProperties) { return __awaiter(_this, void 0, void 0, function () {
210
+ return __generator(this, function (_a) {
211
+ switch (_a.label) {
212
+ case 0: return [4 /*yield*/, ensureScreeb("identityGroupAssign", function () {
213
+ return Screeb__namespace.identityGroupAssign(groupName, groupType, groupProperties);
214
+ })];
215
+ case 1: return [2 /*return*/, _a.sent()];
216
+ }
217
+ });
218
+ }); };
219
+ var identityGroupUnassign = function (groupName, groupType) { return __awaiter(_this, void 0, void 0, function () {
220
+ return __generator(this, function (_a) {
221
+ switch (_a.label) {
222
+ case 0: return [4 /*yield*/, ensureScreeb("identityGroupUnassign", function () {
223
+ return Screeb__namespace.identityGroupUnassign(groupName, groupType);
224
+ })];
225
+ case 1: return [2 /*return*/, _a.sent()];
226
+ }
227
+ });
228
+ }); };
229
+ var identityProperties = function (userProperties) { return __awaiter(_this, void 0, void 0, function () {
230
+ return __generator(this, function (_a) {
231
+ switch (_a.label) {
232
+ case 0: return [4 /*yield*/, ensureScreeb("identityProperties", function () {
233
+ return Screeb__namespace.identityProperties(userProperties);
234
+ })];
235
+ case 1: return [2 /*return*/, _a.sent()];
236
+ }
237
+ });
238
+ }); };
239
+ var identityReset = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
240
+ switch (_a.label) {
241
+ case 0: return [4 /*yield*/, ensureScreeb("identityReset", function () { return Screeb__namespace.identityReset(); })];
242
+ case 1: return [2 /*return*/, _a.sent()];
243
+ }
244
+ }); }); };
245
+ var init = function (websiteId, userId, userProperties, hooks, language) { return __awaiter(_this, void 0, void 0, function () {
246
+ return __generator(this, function (_a) {
247
+ switch (_a.label) {
248
+ case 0: return [4 /*yield*/, ensureScreeb("init", function () {
249
+ if (!isInitialized) {
250
+ Screeb__namespace.init(websiteId, userId, userProperties, hooks, language);
251
+ isInitialized = true;
252
+ }
253
+ }, true)];
254
+ case 1:
255
+ _a.sent();
256
+ return [2 /*return*/];
257
+ }
258
+ });
259
+ }); };
260
+ var load = function (options) { return __awaiter(_this, void 0, void 0, function () {
261
+ var _a;
262
+ return __generator(this, function (_b) {
263
+ switch (_b.label) {
264
+ case 0:
265
+ if (!!Screeb__namespace.isLoaded()) return [3 /*break*/, 3];
266
+ Screeb__namespace.load(__assign({ sdkName: "sdk-vue", sdkVersion: CONSTANTS.version }, options));
267
+ if (!((_a = reactiveConfig.autoInit) !== null && _a !== void 0 ? _a : false)) return [3 /*break*/, 3];
268
+ if (!reactiveConfig.websiteId) return [3 /*break*/, 2];
269
+ return [4 /*yield*/, init(reactiveConfig.websiteId, reactiveConfig.userId, reactiveConfig.userProperties, reactiveConfig.hooks, reactiveConfig.language)];
270
+ case 1:
271
+ _b.sent();
272
+ return [3 /*break*/, 3];
273
+ case 2:
274
+ log("warn", "autoInit is set to true, but no websiteId have been provided.");
275
+ _b.label = 3;
276
+ case 3: return [2 /*return*/];
277
+ }
278
+ });
279
+ }); };
280
+ var surveyClose = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
281
+ switch (_a.label) {
282
+ case 0: return [4 /*yield*/, ensureScreeb("surveyClose", function () { return Screeb__namespace.surveyClose(); })];
283
+ case 1: return [2 /*return*/, _a.sent()];
284
+ }
285
+ }); }); };
286
+ var surveyStart = function (surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language, selectors) { return __awaiter(_this, void 0, void 0, function () {
287
+ return __generator(this, function (_a) {
288
+ switch (_a.label) {
289
+ case 0: return [4 /*yield*/, ensureScreeb("surveyStart", function () {
290
+ return Screeb__namespace.surveyStart(surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language, selectors);
291
+ })];
292
+ case 1: return [2 /*return*/, _a.sent()];
293
+ }
294
+ });
295
+ }); };
296
+ var messageClose = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
297
+ switch (_a.label) {
298
+ case 0: return [4 /*yield*/, ensureScreeb("messageClose", function () { return Screeb__namespace.messageClose(); })];
299
+ case 1: return [2 /*return*/, _a.sent()];
300
+ }
301
+ }); }); };
302
+ var messageStart = function (messageId_1) {
303
+ var args_1 = [];
304
+ for (var _i = 1; _i < arguments.length; _i++) {
305
+ args_1[_i - 1] = arguments[_i];
306
+ }
307
+ return __awaiter(_this, __spreadArray([messageId_1], args_1, true), void 0, function (messageId, allowMultipleResponses, hiddenFields, hooks, language) {
308
+ if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
309
+ return __generator(this, function (_a) {
310
+ switch (_a.label) {
311
+ case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
312
+ return Screeb__namespace.messageStart(messageId, allowMultipleResponses, hiddenFields, hooks, language);
313
+ })];
314
+ case 1: return [2 /*return*/, _a.sent()];
315
+ }
316
+ });
317
+ });
318
+ };
319
+ var sessionReplayStop = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
320
+ switch (_a.label) {
321
+ case 0: return [4 /*yield*/, ensureScreeb("sessionReplayStop", function () { return Screeb__namespace.sessionReplayStop(); })];
322
+ case 1: return [2 /*return*/, _a.sent()];
323
+ }
324
+ }); }); };
325
+ var sessionReplayStart = function () { return __awaiter(_this, void 0, void 0, function () {
326
+ return __generator(this, function (_a) {
327
+ switch (_a.label) {
328
+ case 0: return [4 /*yield*/, ensureScreeb("sessionReplayStart", function () {
329
+ return Screeb__namespace.sessionReplayStart();
330
+ })];
331
+ case 1: return [2 /*return*/, _a.sent()];
332
+ }
333
+ });
334
+ }); };
335
+ var targetingCheck = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
336
+ switch (_a.label) {
337
+ case 0: return [4 /*yield*/, ensureScreeb("targetingCheck", function () { return Screeb__namespace.targetingCheck(); })];
338
+ case 1: return [2 /*return*/, _a.sent()];
339
+ }
340
+ }); }); };
341
+ var targetingDebug = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
342
+ switch (_a.label) {
343
+ case 0: return [4 /*yield*/, ensureScreeb("targetingDebug", function () { return Screeb__namespace.targetingDebug(); })];
344
+ case 1: return [2 /*return*/, _a.sent()];
345
+ }
346
+ }); }); };
347
+ vue.watch(function () { return reactiveConfig.userId; }, function (newId, oldId) {
348
+ if (!isInitialized)
349
+ return;
350
+ if (newId === oldId)
351
+ return;
352
+ if (newId) {
353
+ Screeb__namespace.identity(newId);
354
+ }
355
+ else {
356
+ Screeb__namespace.identityReset();
357
+ }
358
+ });
359
+ var context = {
360
+ close: close,
361
+ debug: debug,
362
+ eventTrack: eventTrack,
363
+ identity: identity,
364
+ identityGet: identityGet,
365
+ identityGroupAssign: identityGroupAssign,
366
+ identityGroupUnassign: identityGroupUnassign,
367
+ identityProperties: identityProperties,
368
+ identityReset: identityReset,
369
+ init: init,
370
+ load: load,
371
+ surveyClose: surveyClose,
372
+ surveyStart: surveyStart,
373
+ messageClose: messageClose,
374
+ messageStart: messageStart,
375
+ sessionReplayStop: sessionReplayStop,
376
+ sessionReplayStart: sessionReplayStart,
377
+ targetingCheck: targetingCheck,
378
+ targetingDebug: targetingDebug,
379
+ };
380
+ app.provide(SCREEB_PLUGIN_KEY, context);
381
+ if (!isSSR && ((_a = reactiveConfig.shouldLoad) !== null && _a !== void 0 ? _a : true)) {
382
+ load(reactiveConfig.options);
383
+ }
384
+ },
385
+ };
386
+
387
+ function useScreeb() {
388
+ var context = vue.inject(SCREEB_PLUGIN_KEY);
389
+ if (!context) {
390
+ // eslint-disable-next-line no-console
391
+ console.warn("`useScreeb` must be called inside a component tree where ScreebPlugin is installed.");
392
+ }
393
+ return context;
394
+ }
395
+
396
+ exports.SCREEB_PLUGIN_KEY = SCREEB_PLUGIN_KEY;
397
+ exports.ScreebPlugin = ScreebPlugin;
398
+ exports.useScreeb = useScreeb;
399
+ CONSTANTS.version = '0.1.1'
@@ -0,0 +1,3 @@
1
+ export { ScreebPlugin, SCREEB_PLUGIN_KEY } from "./plugin";
2
+ export { useScreeb } from "./composable";
3
+ export * from "./types";
@@ -0,0 +1,3 @@
1
+ type LogLevel = "info" | "error" | "warn";
2
+ export declare const log: (level: LogLevel, message: string) => void;
3
+ export {};
@@ -0,0 +1,4 @@
1
+ import { InjectionKey, Plugin } from "vue";
2
+ import { ScreebContextValues } from "./types";
3
+ export declare const SCREEB_PLUGIN_KEY: InjectionKey<ScreebContextValues>;
4
+ export declare const ScreebPlugin: Plugin;
@@ -0,0 +1,69 @@
1
+ import { HooksInit, HooksMessageStart, HooksSurveyStart, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
2
+ /** Configuration for the ScreebPlugin */
3
+ export type ScreebConfig = {
4
+ /** Your website/channel id. */
5
+ websiteId: string;
6
+ /** The unique identifier of your user. */
7
+ userId?: string;
8
+ /** The properties of your user. */
9
+ userProperties?: PropertyRecord;
10
+ /** Hooks to define callback for various Screeb events */
11
+ hooks?: HooksInit;
12
+ /** Force a specific language (e.g. 'en'). Default: browser language. */
13
+ language?: string;
14
+ /**
15
+ * Indicates if Screeb should be automatically loaded.
16
+ * Set to false to prevent the SDK from loading (e.g. in CI).
17
+ * @default true
18
+ */
19
+ shouldLoad?: boolean;
20
+ /**
21
+ * Indicates if Screeb should be automatically initialized.
22
+ * When true, `init` is called automatically with `websiteId` and `userId`.
23
+ * @default false
24
+ */
25
+ autoInit?: boolean;
26
+ /** Screeb tag initialization options — handle with care. */
27
+ options?: ScreebOptions;
28
+ };
29
+ export type CloseFunction = () => Promise<void>;
30
+ export type DebugFunction = () => Promise<unknown>;
31
+ export type EventTrackFunction = (eventName: string, eventProperties?: PropertyRecord) => Promise<unknown>;
32
+ export type IdentityFunction = (userId: string, userProperties?: PropertyRecord) => Promise<unknown>;
33
+ export type IdentityGetFunction = () => Promise<ScreebIdentityGetReturn>;
34
+ export type IdentityGroupAssignFunction = (groupName: string, groupType?: string, groupProperties?: PropertyRecord) => Promise<unknown>;
35
+ export type IdentityGroupUnassignFunction = (groupName: string, groupType?: string) => Promise<unknown>;
36
+ export type IdentityPropertiesFunction = (userProperties: PropertyRecord) => Promise<unknown>;
37
+ export type IdentityResetFunction = () => Promise<unknown>;
38
+ export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string) => Promise<void>;
39
+ export type LoadFunction = (options?: ScreebOptions) => Promise<void>;
40
+ export type SurveyCloseFunction = () => Promise<unknown>;
41
+ export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string, selectors?: string | string[]) => Promise<unknown>;
42
+ export type MessageCloseFunction = () => Promise<unknown>;
43
+ export type MessageStartFunction = (messageId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
44
+ export type SessionReplayStopFunction = () => Promise<unknown>;
45
+ export type SessionReplayStartFunction = () => Promise<unknown>;
46
+ export type TargetingCheckFunction = () => Promise<unknown>;
47
+ export type TargetingDebugFunction = () => Promise<unknown>;
48
+ /** All Screeb methods provided via `useScreeb()` */
49
+ export type ScreebContextValues = {
50
+ close: CloseFunction;
51
+ debug: DebugFunction;
52
+ eventTrack: EventTrackFunction;
53
+ identity: IdentityFunction;
54
+ identityGet: IdentityGetFunction;
55
+ identityGroupAssign: IdentityGroupAssignFunction;
56
+ identityGroupUnassign: IdentityGroupUnassignFunction;
57
+ identityProperties: IdentityPropertiesFunction;
58
+ identityReset: IdentityResetFunction;
59
+ init: InitFunction;
60
+ load: LoadFunction;
61
+ surveyClose: SurveyCloseFunction;
62
+ surveyStart: SurveyStartFunction;
63
+ messageClose: MessageCloseFunction;
64
+ messageStart: MessageStartFunction;
65
+ sessionReplayStart: SessionReplayStartFunction;
66
+ sessionReplayStop: SessionReplayStopFunction;
67
+ targetingCheck: TargetingCheckFunction;
68
+ targetingDebug: TargetingDebugFunction;
69
+ };
@@ -0,0 +1 @@
1
+ export declare const isSSR: boolean;
@@ -0,0 +1,2 @@
1
+ import { ScreebContextValues } from "./types";
2
+ export declare function useScreeb(): ScreebContextValues;
@@ -0,0 +1,4 @@
1
+ declare const CONSTANTS: {
2
+ version: string;
3
+ };
4
+ export default CONSTANTS;
@@ -0,0 +1,3 @@
1
+ export { ScreebPlugin, SCREEB_PLUGIN_KEY } from "./plugin";
2
+ export { useScreeb } from "./composable";
3
+ export * from "./types";