@screeb/sdk-vue 0.2.1 → 0.3.0

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.
@@ -242,12 +242,12 @@ var ScreebPlugin = {
242
242
  case 1: return [2 /*return*/, _a.sent()];
243
243
  }
244
244
  }); }); };
245
- var init = function (websiteId, userId, userProperties, hooks, language) { return __awaiter(_this, void 0, void 0, function () {
245
+ var init = function (websiteId, userId, userProperties, hooks, language, spaNavigationHandler) { return __awaiter(_this, void 0, void 0, function () {
246
246
  return __generator(this, function (_a) {
247
247
  switch (_a.label) {
248
248
  case 0: return [4 /*yield*/, ensureScreeb("init", function () {
249
249
  if (!isInitialized) {
250
- Screeb__namespace.init(websiteId, userId, userProperties, hooks, language);
250
+ Screeb__namespace.init(websiteId, userId, userProperties, hooks, language, spaNavigationHandler);
251
251
  isInitialized = true;
252
252
  }
253
253
  }, true)];
@@ -266,7 +266,7 @@ var ScreebPlugin = {
266
266
  Screeb__namespace.load(__assign({ sdkName: "sdk-vue", sdkVersion: CONSTANTS.version }, options));
267
267
  if (!((_a = reactiveConfig.autoInit) !== null && _a !== void 0 ? _a : false)) return [3 /*break*/, 3];
268
268
  if (!reactiveConfig.websiteId) return [3 /*break*/, 2];
269
- return [4 /*yield*/, init(reactiveConfig.websiteId, reactiveConfig.userId, reactiveConfig.userProperties, reactiveConfig.hooks, reactiveConfig.language)];
269
+ return [4 /*yield*/, init(reactiveConfig.websiteId, reactiveConfig.userId, reactiveConfig.userProperties, reactiveConfig.hooks, reactiveConfig.language, reactiveConfig.spaNavigationHandler)];
270
270
  case 1:
271
271
  _b.sent();
272
272
  return [3 /*break*/, 3];
@@ -332,12 +332,6 @@ var ScreebPlugin = {
332
332
  }
333
333
  });
334
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
335
  var targetingDebug = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
342
336
  switch (_a.label) {
343
337
  case 0: return [4 /*yield*/, ensureScreeb("targetingDebug", function () { return Screeb__namespace.targetingDebug(); })];
@@ -374,7 +368,6 @@ var ScreebPlugin = {
374
368
  messageStart: messageStart,
375
369
  sessionReplayStop: sessionReplayStop,
376
370
  sessionReplayStart: sessionReplayStart,
377
- targetingCheck: targetingCheck,
378
371
  targetingDebug: targetingDebug,
379
372
  };
380
373
  app.provide(SCREEB_PLUGIN_KEY, context);
@@ -396,4 +389,4 @@ function useScreeb() {
396
389
  exports.SCREEB_PLUGIN_KEY = SCREEB_PLUGIN_KEY;
397
390
  exports.ScreebPlugin = ScreebPlugin;
398
391
  exports.useScreeb = useScreeb;
399
- CONSTANTS.version = '0.2.1'
392
+ CONSTANTS.version = '0.3.0'
@@ -1,4 +1,4 @@
1
- import { HooksInit, HooksMessageStart, HooksSurveyStart, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
1
+ import { HooksInit, HooksMessageStart, HooksSurveyStart, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions, SpaNavigationHandler } from "@screeb/sdk-browser";
2
2
  /** Configuration for the ScreebPlugin */
3
3
  export type ScreebConfig = {
4
4
  /** Your website/channel id. */
@@ -11,6 +11,8 @@ export type ScreebConfig = {
11
11
  hooks?: HooksInit;
12
12
  /** Force a specific language (e.g. 'en'). Default: browser language. */
13
13
  language?: string;
14
+ /** Optional handler for the `in-page-spa` "Navigate to URL" target (custom SPA routers). */
15
+ spaNavigationHandler?: SpaNavigationHandler;
14
16
  /**
15
17
  * Indicates if Screeb should be automatically loaded.
16
18
  * Set to false to prevent the SDK from loading (e.g. in CI).
@@ -35,7 +37,7 @@ export type IdentityGroupAssignFunction = (groupName: string, groupType?: string
35
37
  export type IdentityGroupUnassignFunction = (groupName: string, groupType?: string) => Promise<unknown>;
36
38
  export type IdentityPropertiesFunction = (userProperties: PropertyRecord) => Promise<unknown>;
37
39
  export type IdentityResetFunction = () => Promise<unknown>;
38
- export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string) => Promise<void>;
40
+ export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string, spaNavigationHandler?: SpaNavigationHandler) => Promise<void>;
39
41
  export type LoadFunction = (options?: ScreebOptions) => Promise<void>;
40
42
  export type SurveyCloseFunction = () => Promise<unknown>;
41
43
  export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string, selectors?: string | string[]) => Promise<unknown>;
@@ -43,7 +45,6 @@ export type MessageCloseFunction = () => Promise<unknown>;
43
45
  export type MessageStartFunction = (messageId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
44
46
  export type SessionReplayStopFunction = () => Promise<unknown>;
45
47
  export type SessionReplayStartFunction = () => Promise<unknown>;
46
- export type TargetingCheckFunction = () => Promise<unknown>;
47
48
  export type TargetingDebugFunction = () => Promise<unknown>;
48
49
  /** All Screeb methods provided via `useScreeb()` */
49
50
  export type ScreebContextValues = {
@@ -64,6 +65,5 @@ export type ScreebContextValues = {
64
65
  messageStart: MessageStartFunction;
65
66
  sessionReplayStart: SessionReplayStartFunction;
66
67
  sessionReplayStop: SessionReplayStopFunction;
67
- targetingCheck: TargetingCheckFunction;
68
68
  targetingDebug: TargetingDebugFunction;
69
69
  };
package/dist/es/index.mjs CHANGED
@@ -221,12 +221,12 @@ var ScreebPlugin = {
221
221
  case 1: return [2 /*return*/, _a.sent()];
222
222
  }
223
223
  }); }); };
224
- var init = function (websiteId, userId, userProperties, hooks, language) { return __awaiter(_this, void 0, void 0, function () {
224
+ var init = function (websiteId, userId, userProperties, hooks, language, spaNavigationHandler) { return __awaiter(_this, void 0, void 0, function () {
225
225
  return __generator(this, function (_a) {
226
226
  switch (_a.label) {
227
227
  case 0: return [4 /*yield*/, ensureScreeb("init", function () {
228
228
  if (!isInitialized) {
229
- Screeb.init(websiteId, userId, userProperties, hooks, language);
229
+ Screeb.init(websiteId, userId, userProperties, hooks, language, spaNavigationHandler);
230
230
  isInitialized = true;
231
231
  }
232
232
  }, true)];
@@ -245,7 +245,7 @@ var ScreebPlugin = {
245
245
  Screeb.load(__assign({ sdkName: "sdk-vue", sdkVersion: CONSTANTS.version }, options));
246
246
  if (!((_a = reactiveConfig.autoInit) !== null && _a !== void 0 ? _a : false)) return [3 /*break*/, 3];
247
247
  if (!reactiveConfig.websiteId) return [3 /*break*/, 2];
248
- return [4 /*yield*/, init(reactiveConfig.websiteId, reactiveConfig.userId, reactiveConfig.userProperties, reactiveConfig.hooks, reactiveConfig.language)];
248
+ return [4 /*yield*/, init(reactiveConfig.websiteId, reactiveConfig.userId, reactiveConfig.userProperties, reactiveConfig.hooks, reactiveConfig.language, reactiveConfig.spaNavigationHandler)];
249
249
  case 1:
250
250
  _b.sent();
251
251
  return [3 /*break*/, 3];
@@ -311,12 +311,6 @@ var ScreebPlugin = {
311
311
  }
312
312
  });
313
313
  }); };
314
- var targetingCheck = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
315
- switch (_a.label) {
316
- case 0: return [4 /*yield*/, ensureScreeb("targetingCheck", function () { return Screeb.targetingCheck(); })];
317
- case 1: return [2 /*return*/, _a.sent()];
318
- }
319
- }); }); };
320
314
  var targetingDebug = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
321
315
  switch (_a.label) {
322
316
  case 0: return [4 /*yield*/, ensureScreeb("targetingDebug", function () { return Screeb.targetingDebug(); })];
@@ -353,7 +347,6 @@ var ScreebPlugin = {
353
347
  messageStart: messageStart,
354
348
  sessionReplayStop: sessionReplayStop,
355
349
  sessionReplayStart: sessionReplayStart,
356
- targetingCheck: targetingCheck,
357
350
  targetingDebug: targetingDebug,
358
351
  };
359
352
  app.provide(SCREEB_PLUGIN_KEY, context);
@@ -373,4 +366,4 @@ function useScreeb() {
373
366
  }
374
367
 
375
368
  export { SCREEB_PLUGIN_KEY, ScreebPlugin, useScreeb };
376
- CONSTANTS.version = '0.2.1'
369
+ CONSTANTS.version = '0.3.0'
@@ -1,4 +1,4 @@
1
- import { HooksInit, HooksMessageStart, HooksSurveyStart, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
1
+ import { HooksInit, HooksMessageStart, HooksSurveyStart, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions, SpaNavigationHandler } from "@screeb/sdk-browser";
2
2
  /** Configuration for the ScreebPlugin */
3
3
  export type ScreebConfig = {
4
4
  /** Your website/channel id. */
@@ -11,6 +11,8 @@ export type ScreebConfig = {
11
11
  hooks?: HooksInit;
12
12
  /** Force a specific language (e.g. 'en'). Default: browser language. */
13
13
  language?: string;
14
+ /** Optional handler for the `in-page-spa` "Navigate to URL" target (custom SPA routers). */
15
+ spaNavigationHandler?: SpaNavigationHandler;
14
16
  /**
15
17
  * Indicates if Screeb should be automatically loaded.
16
18
  * Set to false to prevent the SDK from loading (e.g. in CI).
@@ -35,7 +37,7 @@ export type IdentityGroupAssignFunction = (groupName: string, groupType?: string
35
37
  export type IdentityGroupUnassignFunction = (groupName: string, groupType?: string) => Promise<unknown>;
36
38
  export type IdentityPropertiesFunction = (userProperties: PropertyRecord) => Promise<unknown>;
37
39
  export type IdentityResetFunction = () => Promise<unknown>;
38
- export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string) => Promise<void>;
40
+ export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string, spaNavigationHandler?: SpaNavigationHandler) => Promise<void>;
39
41
  export type LoadFunction = (options?: ScreebOptions) => Promise<void>;
40
42
  export type SurveyCloseFunction = () => Promise<unknown>;
41
43
  export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string, selectors?: string | string[]) => Promise<unknown>;
@@ -43,7 +45,6 @@ export type MessageCloseFunction = () => Promise<unknown>;
43
45
  export type MessageStartFunction = (messageId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
44
46
  export type SessionReplayStopFunction = () => Promise<unknown>;
45
47
  export type SessionReplayStartFunction = () => Promise<unknown>;
46
- export type TargetingCheckFunction = () => Promise<unknown>;
47
48
  export type TargetingDebugFunction = () => Promise<unknown>;
48
49
  /** All Screeb methods provided via `useScreeb()` */
49
50
  export type ScreebContextValues = {
@@ -64,6 +65,5 @@ export type ScreebContextValues = {
64
65
  messageStart: MessageStartFunction;
65
66
  sessionReplayStart: SessionReplayStartFunction;
66
67
  sessionReplayStop: SessionReplayStopFunction;
67
- targetingCheck: TargetingCheckFunction;
68
68
  targetingDebug: TargetingDebugFunction;
69
69
  };
package/docs/README.md CHANGED
@@ -25,7 +25,6 @@
25
25
  - [SessionReplayStopFunction](README.md#sessionreplaystopfunction)
26
26
  - [SurveyCloseFunction](README.md#surveyclosefunction)
27
27
  - [SurveyStartFunction](README.md#surveystartfunction)
28
- - [TargetingCheckFunction](README.md#targetingcheckfunction)
29
28
  - [TargetingDebugFunction](README.md#targetingdebugfunction)
30
29
 
31
30
  ### Variables
@@ -202,11 +201,11 @@ ___
202
201
 
203
202
  ### InitFunction
204
203
 
205
- Ƭ **InitFunction**: (`websiteId`: `string`, `userId?`: `string`, `userProperties?`: `PropertyRecord`, `hooks?`: `HooksInit`, `language?`: `string`) => `Promise`\<`void`\>
204
+ Ƭ **InitFunction**: (`websiteId`: `string`, `userId?`: `string`, `userProperties?`: `PropertyRecord`, `hooks?`: `HooksInit`, `language?`: `string`, `spaNavigationHandler?`: `SpaNavigationHandler`) => `Promise`\<`void`\>
206
205
 
207
206
  #### Type declaration
208
207
 
209
- ▸ (`websiteId`, `userId?`, `userProperties?`, `hooks?`, `language?`): `Promise`\<`void`\>
208
+ ▸ (`websiteId`, `userId?`, `userProperties?`, `hooks?`, `language?`, `spaNavigationHandler?`): `Promise`\<`void`\>
210
209
 
211
210
  ##### Parameters
212
211
 
@@ -217,6 +216,7 @@ ___
217
216
  | `userProperties?` | `PropertyRecord` |
218
217
  | `hooks?` | `HooksInit` |
219
218
  | `language?` | `string` |
219
+ | `spaNavigationHandler?` | `SpaNavigationHandler` |
220
220
 
221
221
  ##### Returns
222
222
 
@@ -297,6 +297,7 @@ Configuration for the ScreebPlugin
297
297
  | `language?` | `string` | Force a specific language (e.g. 'en'). Default: browser language. |
298
298
  | `options?` | `ScreebOptions` | Screeb tag initialization options — handle with care. |
299
299
  | `shouldLoad?` | `boolean` | Indicates if Screeb should be automatically loaded. Set to false to prevent the SDK from loading (e.g. in CI). **`Default`** ```ts true ``` |
300
+ | `spaNavigationHandler?` | `SpaNavigationHandler` | Optional handler for the `in-page-spa` "Navigate to URL" target (custom SPA routers). |
300
301
  | `userId?` | `string` | The unique identifier of your user. |
301
302
  | `userProperties?` | `PropertyRecord` | The properties of your user. |
302
303
  | `websiteId` | `string` | Your website/channel id. |
@@ -330,7 +331,6 @@ All Screeb methods provided via `useScreeb()`
330
331
  | `sessionReplayStop` | [`SessionReplayStopFunction`](README.md#sessionreplaystopfunction) |
331
332
  | `surveyClose` | [`SurveyCloseFunction`](README.md#surveyclosefunction) |
332
333
  | `surveyStart` | [`SurveyStartFunction`](README.md#surveystartfunction) |
333
- | `targetingCheck` | [`TargetingCheckFunction`](README.md#targetingcheckfunction) |
334
334
  | `targetingDebug` | [`TargetingDebugFunction`](README.md#targetingdebugfunction) |
335
335
 
336
336
  ___
@@ -403,20 +403,6 @@ ___
403
403
 
404
404
  ___
405
405
 
406
- ### TargetingCheckFunction
407
-
408
- Ƭ **TargetingCheckFunction**: () => `Promise`\<`unknown`\>
409
-
410
- #### Type declaration
411
-
412
- ▸ (): `Promise`\<`unknown`\>
413
-
414
- ##### Returns
415
-
416
- `Promise`\<`unknown`\>
417
-
418
- ___
419
-
420
406
  ### TargetingDebugFunction
421
407
 
422
408
  Ƭ **TargetingDebugFunction**: () => `Promise`\<`unknown`\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-vue",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Screeb's browser SDK, optimized for Vue 3.",
5
5
  "keywords": [
6
6
  "product discovery",
@@ -41,11 +41,11 @@
41
41
  "test": "echo '@TODO'"
42
42
  },
43
43
  "dependencies": {
44
- "@screeb/sdk-browser": "^0.6.1"
44
+ "@screeb/sdk-browser": "^0.7.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@screeb/eslint-config": "^0.1.7",
48
- "@screeb/typescript-config": "^0.1.12",
47
+ "@screeb/eslint-config": "^0.1.8",
48
+ "@screeb/typescript-config": "^0.1.13",
49
49
  "@typescript-eslint/eslint-plugin": "^6.7.5",
50
50
  "eslint": "^8.51.0",
51
51
  "eslint-plugin-import": "^2.28.1",