@screeb/sdk-browser 0.1.17 → 0.2.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.
@@ -412,6 +412,7 @@ var surveyClose = function () { return callScreebCommand("survey.close"); };
412
412
  *
413
413
  * Screeb.surveyStart(
414
414
  * '<UUID>',
415
+ * '<UUID>',
415
416
  * false,
416
417
  * {
417
418
  * color: "green",
@@ -425,16 +426,58 @@ var surveyClose = function () { return callScreebCommand("survey.close"); };
425
426
  * );
426
427
  * ```
427
428
  */
428
- var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks, language) {
429
+ var surveyStart = function (surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language) {
429
430
  if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
430
431
  if (hiddenFields === void 0) { hiddenFields = {}; }
431
432
  return callScreebCommand("survey.start", surveyId, {
433
+ distribution_id: distributionId,
432
434
  allow_multiple_responses: allowMultipleResponses,
433
435
  language: language,
434
436
  hidden_fields: hiddenFields,
435
437
  hooks: hooks,
436
438
  });
437
439
  };
440
+ /**
441
+ * Interrupts a running message.
442
+ *
443
+ * @example
444
+ * ```ts
445
+ * import * as Screeb from "@screeb/sdk-browser";
446
+ *
447
+ * Screeb.messageClose();
448
+ * ```
449
+ */
450
+ var messageClose = function () { return callScreebCommand("message.close"); };
451
+ /**
452
+ * Starts a message by its ID.
453
+ *
454
+ * @example
455
+ * ```ts
456
+ * import * as Screeb from "@screeb/sdk-browser";
457
+ *
458
+ * Screeb.messageStart(
459
+ * '<UUID>',
460
+ * false,
461
+ * {
462
+ * color: "green",
463
+ * article_id: 42
464
+ * },
465
+ * {
466
+ * version: "1.0.0",
467
+ * onMessageShowed: (payload) => console.log("Message showed", payload),
468
+ * },
469
+ * "en"
470
+ * );
471
+ * ```
472
+ */
473
+ var messageStart = function (messageId, hiddenFields, hooks, language) {
474
+ if (hiddenFields === void 0) { hiddenFields = {}; }
475
+ return callScreebCommand("message.start", messageId, {
476
+ language: language,
477
+ hidden_fields: hiddenFields,
478
+ hooks: hooks,
479
+ });
480
+ };
438
481
  /**
439
482
  * Forces a targeting check.
440
483
  *
@@ -484,8 +527,10 @@ exports.identityReset = identityReset;
484
527
  exports.init = init;
485
528
  exports.isLoaded = isLoaded;
486
529
  exports.load = load;
530
+ exports.messageClose = messageClose;
531
+ exports.messageStart = messageStart;
487
532
  exports.surveyClose = surveyClose;
488
533
  exports.surveyStart = surveyStart;
489
534
  exports.targetingCheck = targetingCheck;
490
535
  exports.targetingDebug = targetingDebug;
491
- CONSTANTS.version = '0.1.17'
536
+ CONSTANTS.version = '0.2.0'
@@ -301,6 +301,7 @@ export declare const surveyClose: () => void | Promise<unknown>;
301
301
  *
302
302
  * Screeb.surveyStart(
303
303
  * '<UUID>',
304
+ * '<UUID>',
304
305
  * false,
305
306
  * {
306
307
  * color: "green",
@@ -314,7 +315,41 @@ export declare const surveyClose: () => void | Promise<unknown>;
314
315
  * );
315
316
  * ```
316
317
  */
317
- export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
318
+ export declare const surveyStart: (surveyId: string, distributionId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
319
+ /**
320
+ * Interrupts a running message.
321
+ *
322
+ * @example
323
+ * ```ts
324
+ * import * as Screeb from "@screeb/sdk-browser";
325
+ *
326
+ * Screeb.messageClose();
327
+ * ```
328
+ */
329
+ export declare const messageClose: () => void | Promise<unknown>;
330
+ /**
331
+ * Starts a message by its ID.
332
+ *
333
+ * @example
334
+ * ```ts
335
+ * import * as Screeb from "@screeb/sdk-browser";
336
+ *
337
+ * Screeb.messageStart(
338
+ * '<UUID>',
339
+ * false,
340
+ * {
341
+ * color: "green",
342
+ * article_id: 42
343
+ * },
344
+ * {
345
+ * version: "1.0.0",
346
+ * onMessageShowed: (payload) => console.log("Message showed", payload),
347
+ * },
348
+ * "en"
349
+ * );
350
+ * ```
351
+ */
352
+ export declare const messageStart: (messageId: string, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
318
353
  /**
319
354
  * Forces a targeting check.
320
355
  *
@@ -301,6 +301,7 @@ export declare const surveyClose: () => void | Promise<unknown>;
301
301
  *
302
302
  * Screeb.surveyStart(
303
303
  * '<UUID>',
304
+ * '<UUID>',
304
305
  * false,
305
306
  * {
306
307
  * color: "green",
@@ -314,7 +315,41 @@ export declare const surveyClose: () => void | Promise<unknown>;
314
315
  * );
315
316
  * ```
316
317
  */
317
- export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
318
+ export declare const surveyStart: (surveyId: string, distributionId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
319
+ /**
320
+ * Interrupts a running message.
321
+ *
322
+ * @example
323
+ * ```ts
324
+ * import * as Screeb from "@screeb/sdk-browser";
325
+ *
326
+ * Screeb.messageClose();
327
+ * ```
328
+ */
329
+ export declare const messageClose: () => void | Promise<unknown>;
330
+ /**
331
+ * Starts a message by its ID.
332
+ *
333
+ * @example
334
+ * ```ts
335
+ * import * as Screeb from "@screeb/sdk-browser";
336
+ *
337
+ * Screeb.messageStart(
338
+ * '<UUID>',
339
+ * false,
340
+ * {
341
+ * color: "green",
342
+ * article_id: 42
343
+ * },
344
+ * {
345
+ * version: "1.0.0",
346
+ * onMessageShowed: (payload) => console.log("Message showed", payload),
347
+ * },
348
+ * "en"
349
+ * );
350
+ * ```
351
+ */
352
+ export declare const messageStart: (messageId: string, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
318
353
  /**
319
354
  * Forces a targeting check.
320
355
  *
package/dist/es/index.mjs CHANGED
@@ -410,6 +410,7 @@ var surveyClose = function () { return callScreebCommand("survey.close"); };
410
410
  *
411
411
  * Screeb.surveyStart(
412
412
  * '<UUID>',
413
+ * '<UUID>',
413
414
  * false,
414
415
  * {
415
416
  * color: "green",
@@ -423,16 +424,58 @@ var surveyClose = function () { return callScreebCommand("survey.close"); };
423
424
  * );
424
425
  * ```
425
426
  */
426
- var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks, language) {
427
+ var surveyStart = function (surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language) {
427
428
  if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
428
429
  if (hiddenFields === void 0) { hiddenFields = {}; }
429
430
  return callScreebCommand("survey.start", surveyId, {
431
+ distribution_id: distributionId,
430
432
  allow_multiple_responses: allowMultipleResponses,
431
433
  language: language,
432
434
  hidden_fields: hiddenFields,
433
435
  hooks: hooks,
434
436
  });
435
437
  };
438
+ /**
439
+ * Interrupts a running message.
440
+ *
441
+ * @example
442
+ * ```ts
443
+ * import * as Screeb from "@screeb/sdk-browser";
444
+ *
445
+ * Screeb.messageClose();
446
+ * ```
447
+ */
448
+ var messageClose = function () { return callScreebCommand("message.close"); };
449
+ /**
450
+ * Starts a message by its ID.
451
+ *
452
+ * @example
453
+ * ```ts
454
+ * import * as Screeb from "@screeb/sdk-browser";
455
+ *
456
+ * Screeb.messageStart(
457
+ * '<UUID>',
458
+ * false,
459
+ * {
460
+ * color: "green",
461
+ * article_id: 42
462
+ * },
463
+ * {
464
+ * version: "1.0.0",
465
+ * onMessageShowed: (payload) => console.log("Message showed", payload),
466
+ * },
467
+ * "en"
468
+ * );
469
+ * ```
470
+ */
471
+ var messageStart = function (messageId, hiddenFields, hooks, language) {
472
+ if (hiddenFields === void 0) { hiddenFields = {}; }
473
+ return callScreebCommand("message.start", messageId, {
474
+ language: language,
475
+ hidden_fields: hiddenFields,
476
+ hooks: hooks,
477
+ });
478
+ };
436
479
  /**
437
480
  * Forces a targeting check.
438
481
  *
@@ -470,5 +513,5 @@ var targetingCheck = function () { return callScreebCommand("targeting.check");
470
513
  */
471
514
  var targetingDebug = function () { return callScreebCommand("targeting.debug"); };
472
515
 
473
- export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, surveyClose, surveyStart, targetingCheck, targetingDebug };
474
- CONSTANTS.version = '0.1.17'
516
+ export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, messageClose, messageStart, surveyClose, surveyStart, targetingCheck, targetingDebug };
517
+ CONSTANTS.version = '0.2.0'
package/docs/README.md CHANGED
@@ -46,6 +46,8 @@
46
46
  - [init](README.md#init)
47
47
  - [isLoaded](README.md#isloaded)
48
48
  - [load](README.md#load)
49
+ - [messageClose](README.md#messageclose)
50
+ - [messageStart](README.md#messagestart)
49
51
  - [surveyClose](README.md#surveyclose)
50
52
  - [surveyStart](README.md#surveystart)
51
53
  - [targetingCheck](README.md#targetingcheck)
@@ -793,6 +795,67 @@ Screeb.load();
793
795
 
794
796
  ___
795
797
 
798
+ ### messageClose
799
+
800
+ ▸ **messageClose**(): `void` \| `Promise`\<`unknown`\>
801
+
802
+ Interrupts a running message.
803
+
804
+ #### Returns
805
+
806
+ `void` \| `Promise`\<`unknown`\>
807
+
808
+ **`Example`**
809
+
810
+ ```ts
811
+ import * as Screeb from "@screeb/sdk-browser";
812
+
813
+ Screeb.messageClose();
814
+ ```
815
+
816
+ ___
817
+
818
+ ### messageStart
819
+
820
+ ▸ **messageStart**(`messageId`, `hiddenFields?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
821
+
822
+ Starts a message by its ID.
823
+
824
+ #### Parameters
825
+
826
+ | Name | Type |
827
+ | :------ | :------ |
828
+ | `messageId` | `string` |
829
+ | `hiddenFields` | [`PropertyRecord`](README.md#propertyrecord) |
830
+ | `hooks?` | [`Hooks`](README.md#hooks) |
831
+ | `language?` | `string` |
832
+
833
+ #### Returns
834
+
835
+ `void` \| `Promise`\<`unknown`\>
836
+
837
+ **`Example`**
838
+
839
+ ```ts
840
+ import * as Screeb from "@screeb/sdk-browser";
841
+
842
+ Screeb.messageStart(
843
+ '<UUID>',
844
+ false,
845
+ {
846
+ color: "green",
847
+ article_id: 42
848
+ },
849
+ {
850
+ version: "1.0.0",
851
+ onMessageShowed: (payload) => console.log("Message showed", payload),
852
+ },
853
+ "en"
854
+ );
855
+ ```
856
+
857
+ ___
858
+
796
859
  ### surveyClose
797
860
 
798
861
  ▸ **surveyClose**(): `void` \| `Promise`\<`unknown`\>
@@ -815,7 +878,7 @@ ___
815
878
 
816
879
  ### surveyStart
817
880
 
818
- ▸ **surveyStart**(`surveyId`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
881
+ ▸ **surveyStart**(`surveyId`, `distributionId`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
819
882
 
820
883
  Starts a survey by its ID.
821
884
 
@@ -824,6 +887,7 @@ Starts a survey by its ID.
824
887
  | Name | Type | Default value |
825
888
  | :------ | :------ | :------ |
826
889
  | `surveyId` | `string` | `undefined` |
890
+ | `distributionId` | `string` | `undefined` |
827
891
  | `allowMultipleResponses` | `boolean` | `true` |
828
892
  | `hiddenFields` | [`PropertyRecord`](README.md#propertyrecord) | `{}` |
829
893
  | `hooks?` | [`Hooks`](README.md#hooks) | `undefined` |
@@ -839,6 +903,7 @@ Starts a survey by its ID.
839
903
  import * as Screeb from "@screeb/sdk-browser";
840
904
 
841
905
  Screeb.surveyStart(
906
+ '<UUID>',
842
907
  '<UUID>',
843
908
  false,
844
909
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-browser",
3
- "version": "0.1.17",
3
+ "version": "0.2.0",
4
4
  "description": "Screeb's browser sdk.",
5
5
  "keywords": [
6
6
  "product discovery",
@@ -1,15 +0,0 @@
1
- <svg width="773" height="366" viewBox="0 0 773 366" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_201_47)">
3
- <path fill-rule="evenodd" clip-rule="evenodd"
4
- d="M711.7 197.1C714.6 194.1 717.2 191.1 719.7 187.9C750.7 201 772.5 230.9 772.4 266.5V364.7L684.5 365.3H606.7C558.6 365.3 520.5 325.3 520.5 277.1C520.5 261.5 524.5 245.9 531.5 232H630.4C661.2 232 690.1 219.5 711.7 197.1ZM600.2 292.8C609.1 292.8 616.1 285.6 616.1 276.9C616.1 268.4 609 261.2 600.2 261.2C591.5 261.2 584.5 268.4 584.5 276.9C584.5 285.6 591.5 292.8 600.2 292.8ZM645.5 292.8C654.4 292.8 661.4 285.6 661.4 276.9C661.4 268.4 654.4 261.2 645.5 261.2C636.8 261.2 629.8 268.4 629.8 276.9C629.8 285.6 636.8 292.8 645.5 292.8ZM690.9 292.8C699.8 292.8 706.8 285.6 706.8 276.9C706.8 268.4 699.7 261.2 690.9 261.2C682.2 261.2 675.2 268.4 675.2 276.9C675.2 285.6 682.2 292.8 690.9 292.8Z"
5
- fill="#5e21f1" />
6
- <path fill-rule="evenodd" clip-rule="evenodd"
7
- d="M626.5 213C682 213 725.9 166.6 725.9 111.1C725.9 55.6 682 0 626.4 0H102.7C47.2 0 0 42.7 0 98.3V211.8L102.7 213H626.5ZM98.8 147.6C98.8 151.7 100.9 155.4 103.8 157.5C117.2 167.1 133.1 171.9 148.6 171.7C174.4 171.7 192.5 158.4 192.5 134.6V134.3C192.5 113.4 178.9 104.7 154.6 98.4C133.9 93.1 128.8 90.6 128.8 82.7V82.4C128.8 76.6 134.1 72 144.2 72C152.4 72 160.6 74.9 169.3 80C171.4 81.2 173.4 81.9 176 81.9C182.8 81.9 188.3 76.6 188.3 69.8C188.3 64.7 185.4 61.1 182.5 59.4C171.8 52.6 159.1 48.8 144.6 48.8C120.1 48.8 102.7 63.2 102.7 84.9V85.2C102.7 109 118.3 115.6 142.4 121.8C162.4 126.9 166.5 130.3 166.5 137V137.4C166.5 144.4 160 148.7 149.2 148.7C137.6 148.7 127.7 144.6 118.6 137.9C116.9 136.7 114.5 135.5 111.1 135.5C104.3 135.5 98.8 140.8 98.8 147.6ZM200.8 124.9V124.6C200.8 98.4 220.8 76.9 248.8 76.9C262.6 76.9 272.4 80.7 280.1 87.2C281.8 88.6 284.2 91.6 284.2 96.1C284.2 102.6 278.9 107.7 272.4 107.7C269 107.7 266.4 106.3 264.9 105.1C260.3 101.5 255.5 99.3 248.7 99.3C235.7 99.3 226.5 110.8 226.5 124.3V124.6C226.5 138.6 235.6 149.9 249.7 149.9C256.5 149.9 261.8 147.5 266.8 143.6C268.2 142.6 270.7 141.2 273.8 141.2C280 141.2 284.7 146.2 284.7 152.3C284.7 155.7 283.2 158.5 280.9 160.5C273.2 167.5 263.5 172.3 248.4 172.3C220.9 172.2 200.8 151.1 200.8 124.9ZM308.1 77.5C300.9 77.5 295.1 83.3 295.1 90.5V158.1C295.1 165.3 300.9 171.1 308.1 171.1C315.3 171.1 321.1 165.3 321.1 158.1V133.8C321.1 115.4 328.4 105.3 341.6 102.2C346.9 101 351.3 96.9 351.3 90.1C351.3 82.8 346.7 77.5 338.7 77.5C331 77.5 324.9 85.7 321.1 94.6V90.5C321.1 83.3 315.3 77.5 308.1 77.5ZM521.3 121C521.3 102 507.8 76.9 477.2 76.9C458.9 76.9 444.3 87.1 437 101.9C430.9 88.5 418 76.9 397.2 76.9C370.5 76.9 351.9 98.4 351.9 124.6V124.9C351.9 152.9 372.2 172.3 399.8 172.3C413.1 172.3 423.6 168 431.6 161.2C433.5 159.5 435 156.9 435 153.5C435 147.7 430.7 143.2 424.9 143.2C422.2 143.2 420.5 143.9 418.6 145.3C413.3 149.2 407.3 151.5 400.1 151.5C388.5 151.5 380.3 145.3 377.7 133.6H432.561C436.215 156.976 455.14 172.4 479.8 172.4C493.1 172.4 503.6 168.1 511.6 161.3C513.5 159.6 515 157 515 153.6C515 147.8 510.7 143.3 504.9 143.3C502.2 143.3 500.5 144 498.6 145.4C493.3 149.3 487.3 151.6 480.1 151.6C468.5 151.6 460.3 145.4 457.7 133.7H509.2C516 133.4 521.3 128.5 521.3 121ZM432.5 133.2L432.522 133.349C432.308 133.302 432.246 133.251 432.5 133.2ZM377.4 117.2C379.5 105.4 386.5 97.7 397.2 97.7C408.1 97.7 415 105.6 416.5 117.2H377.4ZM457.4 117.2C459.5 105.4 466.5 97.7 477.2 97.7C488.1 97.7 495 105.6 496.5 117.2H457.4ZM546.4 44.4C539.2 44.4 533.4 50.2 533.4 57.4V158.3C533.4 165.5 539.2 171.3 546.4 171.3C553.6 171.3 559.4 165.5 559.4 158.5V158.3C565.5 165.7 574.1 172 587.9 172C609.6 172 629.6 155.2 629.6 124.6V124.3C629.6 93.7 609.3 76.9 587.9 76.9C574.4 76.9 565.7 83.3 559.4 91.8V57.4C559.4 50.2 553.6 44.4 546.4 44.4ZM603.7 124.3V124.6C603.7 139.9 593.4 149.9 581.3 149.9C569.2 149.9 559.1 139.8 559.1 124.6V124.3C559.1 109.1 569.2 99 581.3 99C593.4 99 603.7 109.1 603.7 124.3Z"
8
- fill="#5e21f1" />
9
- </g>
10
- <defs>
11
- <clipPath id="clip0_201_47">
12
- <rect width="772.5" height="365.4" fill="#5e21f1" />
13
- </clipPath>
14
- </defs>
15
- </svg>