@screeb/sdk-react 0.1.12 → 0.1.14

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.
@@ -309,6 +309,22 @@ var ScreebProvider = function (_a) {
309
309
  }
310
310
  });
311
311
  }); }, []);
312
+ var messageClose = React__namespace.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
313
+ switch (_a.label) {
314
+ case 0: return [4 /*yield*/, ensureScreeb("messageClose", function () { return Screeb__namespace.messageClose(); })];
315
+ case 1: return [2 /*return*/, _a.sent()];
316
+ }
317
+ }); }); }, []);
318
+ var messageStart = React__namespace.useCallback(function (messageId, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
319
+ return __generator(this, function (_a) {
320
+ switch (_a.label) {
321
+ case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
322
+ return Screeb__namespace.messageStart(messageId, hiddenFields, hooks, language);
323
+ })];
324
+ case 1: return [2 /*return*/, _a.sent()];
325
+ }
326
+ });
327
+ }); }, []);
312
328
  var targetingCheck = React__namespace.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
313
329
  switch (_a.label) {
314
330
  case 0: return [4 /*yield*/, ensureScreeb("targetingCheck", function () { return Screeb__namespace.targetingCheck(); })];
@@ -335,6 +351,8 @@ var ScreebProvider = function (_a) {
335
351
  load: load,
336
352
  surveyClose: surveyClose,
337
353
  surveyStart: surveyStart,
354
+ messageClose: messageClose,
355
+ messageStart: messageStart,
338
356
  targetingCheck: targetingCheck,
339
357
  targetingDebug: targetingDebug,
340
358
  }); }, [
@@ -351,6 +369,8 @@ var ScreebProvider = function (_a) {
351
369
  load,
352
370
  surveyClose,
353
371
  surveyStart,
372
+ messageClose,
373
+ messageStart,
354
374
  targetingCheck,
355
375
  targetingDebug,
356
376
  ]);
@@ -374,4 +394,4 @@ var useScreeb = function () {
374
394
 
375
395
  exports.ScreebProvider = ScreebProvider;
376
396
  exports.useScreeb = useScreeb;
377
- CONSTANTS.version = '0.1.12'
397
+ CONSTANTS.version = '0.1.14'
@@ -301,6 +301,35 @@ export type SurveyCloseFunction = () => Promise<unknown>;
301
301
  * ```
302
302
  */
303
303
  export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
+ /**
305
+ * Interrupts a running message.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * const { messageClose } = useScreeb();
310
+ *
311
+ * messageClose();
312
+ * ```
313
+ */
314
+ export type MessageCloseFunction = () => Promise<unknown>;
315
+ /**
316
+ * Starts a message by its ID.
317
+ *
318
+ * @example
319
+ * ```ts
320
+ * const { messageStart } = useScreeb();
321
+ *
322
+ * messageStart(
323
+ * '<UUID>',
324
+ * false,
325
+ * {
326
+ * color: "green",
327
+ * article_id: 42
328
+ * }
329
+ * );
330
+ * ```
331
+ */
332
+ export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
333
  /**
305
334
  * Forces a targeting check.
306
335
  *
@@ -352,6 +381,8 @@ export type ScreebContextValues = {
352
381
  load: LoadFunction;
353
382
  surveyClose: SurveyCloseFunction;
354
383
  surveyStart: SurveyStartFunction;
384
+ messageClose: MessageCloseFunction;
385
+ messageStart: MessageStartFunction;
355
386
  targetingCheck: TargetingCheckFunction;
356
387
  targetingDebug: TargetingDebugFunction;
357
388
  };
package/dist/es/index.mjs CHANGED
@@ -287,6 +287,22 @@ var ScreebProvider = function (_a) {
287
287
  }
288
288
  });
289
289
  }); }, []);
290
+ var messageClose = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
291
+ switch (_a.label) {
292
+ case 0: return [4 /*yield*/, ensureScreeb("messageClose", function () { return Screeb.messageClose(); })];
293
+ case 1: return [2 /*return*/, _a.sent()];
294
+ }
295
+ }); }); }, []);
296
+ var messageStart = React.useCallback(function (messageId, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
297
+ return __generator(this, function (_a) {
298
+ switch (_a.label) {
299
+ case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
300
+ return Screeb.messageStart(messageId, hiddenFields, hooks, language);
301
+ })];
302
+ case 1: return [2 /*return*/, _a.sent()];
303
+ }
304
+ });
305
+ }); }, []);
290
306
  var targetingCheck = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
291
307
  switch (_a.label) {
292
308
  case 0: return [4 /*yield*/, ensureScreeb("targetingCheck", function () { return Screeb.targetingCheck(); })];
@@ -313,6 +329,8 @@ var ScreebProvider = function (_a) {
313
329
  load: load,
314
330
  surveyClose: surveyClose,
315
331
  surveyStart: surveyStart,
332
+ messageClose: messageClose,
333
+ messageStart: messageStart,
316
334
  targetingCheck: targetingCheck,
317
335
  targetingDebug: targetingDebug,
318
336
  }); }, [
@@ -329,6 +347,8 @@ var ScreebProvider = function (_a) {
329
347
  load,
330
348
  surveyClose,
331
349
  surveyStart,
350
+ messageClose,
351
+ messageStart,
332
352
  targetingCheck,
333
353
  targetingDebug,
334
354
  ]);
@@ -351,4 +371,4 @@ var useScreeb = function () {
351
371
  };
352
372
 
353
373
  export { ScreebProvider, useScreeb };
354
- CONSTANTS.version = '0.1.12'
374
+ CONSTANTS.version = '0.1.14'
@@ -301,6 +301,35 @@ export type SurveyCloseFunction = () => Promise<unknown>;
301
301
  * ```
302
302
  */
303
303
  export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
+ /**
305
+ * Interrupts a running message.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * const { messageClose } = useScreeb();
310
+ *
311
+ * messageClose();
312
+ * ```
313
+ */
314
+ export type MessageCloseFunction = () => Promise<unknown>;
315
+ /**
316
+ * Starts a message by its ID.
317
+ *
318
+ * @example
319
+ * ```ts
320
+ * const { messageStart } = useScreeb();
321
+ *
322
+ * messageStart(
323
+ * '<UUID>',
324
+ * false,
325
+ * {
326
+ * color: "green",
327
+ * article_id: 42
328
+ * }
329
+ * );
330
+ * ```
331
+ */
332
+ export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
333
  /**
305
334
  * Forces a targeting check.
306
335
  *
@@ -352,6 +381,8 @@ export type ScreebContextValues = {
352
381
  load: LoadFunction;
353
382
  surveyClose: SurveyCloseFunction;
354
383
  surveyStart: SurveyStartFunction;
384
+ messageClose: MessageCloseFunction;
385
+ messageStart: MessageStartFunction;
355
386
  targetingCheck: TargetingCheckFunction;
356
387
  targetingDebug: TargetingDebugFunction;
357
388
  };
package/docs/README.md CHANGED
@@ -17,6 +17,8 @@
17
17
  - [IdentityResetFunction](README.md#identityresetfunction)
18
18
  - [InitFunction](README.md#initfunction)
19
19
  - [LoadFunction](README.md#loadfunction)
20
+ - [MessageCloseFunction](README.md#messageclosefunction)
21
+ - [MessageStartFunction](README.md#messagestartfunction)
20
22
  - [ScreebContextValues](README.md#screebcontextvalues)
21
23
  - [ScreebProps](README.md#screebprops)
22
24
  - [ScreebProviderProps](README.md#screebproviderprops)
@@ -437,6 +439,70 @@ load();
437
439
 
438
440
  ___
439
441
 
442
+ ### MessageCloseFunction
443
+
444
+ Ƭ **MessageCloseFunction**: () => `Promise`\<`unknown`\>
445
+
446
+ Interrupts a running message.
447
+
448
+ **`Example`**
449
+
450
+ ```ts
451
+ const { messageClose } = useScreeb();
452
+
453
+ messageClose();
454
+ ```
455
+
456
+ #### Type declaration
457
+
458
+ ▸ (): `Promise`\<`unknown`\>
459
+
460
+ ##### Returns
461
+
462
+ `Promise`\<`unknown`\>
463
+
464
+ ___
465
+
466
+ ### MessageStartFunction
467
+
468
+ Ƭ **MessageStartFunction**: (`messageId`: `string`, `hiddenFields`: `PropertyRecord`, `hooks?`: `Hooks`, `language?`: `string`) => `Promise`\<`unknown`\>
469
+
470
+ Starts a message by its ID.
471
+
472
+ **`Example`**
473
+
474
+ ```ts
475
+ const { messageStart } = useScreeb();
476
+
477
+ messageStart(
478
+ '<UUID>',
479
+ false,
480
+ {
481
+ color: "green",
482
+ article_id: 42
483
+ }
484
+ );
485
+ ```
486
+
487
+ #### Type declaration
488
+
489
+ ▸ (`messageId`, `hiddenFields`, `hooks?`, `language?`): `Promise`\<`unknown`\>
490
+
491
+ ##### Parameters
492
+
493
+ | Name | Type |
494
+ | :------ | :------ |
495
+ | `messageId` | `string` |
496
+ | `hiddenFields` | `PropertyRecord` |
497
+ | `hooks?` | `Hooks` |
498
+ | `language?` | `string` |
499
+
500
+ ##### Returns
501
+
502
+ `Promise`\<`unknown`\>
503
+
504
+ ___
505
+
440
506
  ### ScreebContextValues
441
507
 
442
508
  Ƭ **ScreebContextValues**: `Object`
@@ -458,6 +524,8 @@ Screeb context API
458
524
  | `identityReset` | [`IdentityResetFunction`](README.md#identityresetfunction) |
459
525
  | `init` | [`InitFunction`](README.md#initfunction) |
460
526
  | `load` | [`LoadFunction`](README.md#loadfunction) |
527
+ | `messageClose` | [`MessageCloseFunction`](README.md#messageclosefunction) |
528
+ | `messageStart` | [`MessageStartFunction`](README.md#messagestartfunction) |
461
529
  | `surveyClose` | [`SurveyCloseFunction`](README.md#surveyclosefunction) |
462
530
  | `surveyStart` | [`SurveyStartFunction`](README.md#surveystartfunction) |
463
531
  | `targetingCheck` | [`TargetingCheckFunction`](README.md#targetingcheckfunction) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-react",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Screeb's browser sdk, optimized for React.",
5
5
  "keywords": [
6
6
  "product discovery",
@@ -41,7 +41,7 @@
41
41
  "test": "echo '@TODO'"
42
42
  },
43
43
  "dependencies": {
44
- "@screeb/sdk-browser": "^0.1.17"
44
+ "@screeb/sdk-browser": "^0.1.18"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@screeb/eslint-config": "^0.1.6",