@parra/parra-js-sdk 0.2.113 → 0.2.115

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.
@@ -342,6 +342,7 @@ export interface UpdateCampaignRequestBody {
342
342
  description?: string | null;
343
343
  start_at?: string | null;
344
344
  end_at?: string | null;
345
+ paused_at?: string | null;
345
346
  triggers?: UpdateCampaignTriggerList;
346
347
  actions?: UpdateCampaignActionList;
347
348
  }
@@ -350,6 +351,7 @@ export interface CreateCampaignRequestBody {
350
351
  description?: string | null;
351
352
  start_at?: string | null;
352
353
  end_at?: string | null;
354
+ paused_at?: string | null;
353
355
  triggers?: UpdateCampaignTriggerList;
354
356
  actions?: UpdateCampaignActionList;
355
357
  }
@@ -433,22 +435,35 @@ export interface Answer {
433
435
  question_id: string;
434
436
  user_id: string;
435
437
  tenant_id: string;
438
+ campaign_id?: string | null;
439
+ bucket_item_id?: string | null;
436
440
  data: AnswerData;
437
441
  }
438
442
  export interface AnswerQuestionBody {
443
+ bucket_item_id?: string | null;
439
444
  data: AnswerData;
440
445
  }
441
446
  export interface BulkAnswerQuestionBody {
442
447
  question_id: string;
448
+ bucket_item_id?: string | null;
443
449
  data: AnswerData;
444
450
  }
445
451
  export declare type BulkAnswerQuestionsBody = Array<BulkAnswerQuestionBody>;
446
452
  export declare type CardItemData = Question;
453
+ export declare enum CardItemDisplayType {
454
+ inline = "inline",
455
+ popup = "popup"
456
+ }
447
457
  export declare enum CardItemType {
448
458
  question = "question"
449
459
  }
450
460
  export interface CardItem {
461
+ id: string;
462
+ campaign_id: string;
463
+ campaign_action_id: string;
464
+ question_id?: string | null;
451
465
  type: CardItemType;
466
+ display_type?: CardItemDisplayType;
452
467
  version: string;
453
468
  data: CardItemData;
454
469
  }
@@ -601,57 +616,29 @@ export declare type QuestionData = ChoiceQuestionBody | CheckboxQuestionBody | I
601
616
  export interface UpdateQuestionRequestBody {
602
617
  title: string;
603
618
  subtitle?: string | null;
604
- app_area_id?: string | null;
605
619
  data: MutableQuestionData;
606
- active?: boolean;
607
- expires_at?: string | null;
608
- answer_quota?: number | null;
609
- show_expires_at: boolean;
610
- show_answer_count: boolean;
611
- show_answer_quota: boolean;
612
620
  }
613
621
  export interface CreateQuestionRequestBody {
614
622
  title: string;
615
623
  subtitle?: string | null;
616
- app_area_id?: string | null;
617
624
  data: MutableQuestionData;
618
- active?: boolean;
619
- expires_at?: string | null;
620
- answer_quota?: number | null;
621
- show_expires_at: boolean;
622
- show_answer_count: boolean;
623
- show_answer_quota: boolean;
624
625
  type: QuestionType;
625
626
  kind: QuestionKind;
626
627
  }
627
- export declare enum QuestionStatus {
628
- open = "open",
629
- closed = "closed"
630
- }
631
628
  export interface Question {
632
629
  id: string;
633
630
  created_at: string;
634
631
  updated_at: string;
635
632
  deleted_at?: string | null;
636
- status: QuestionStatus;
637
633
  tenant_id: string;
638
634
  title: string;
639
635
  subtitle?: string | null;
640
- app_area_id?: string | null;
641
636
  type: QuestionType;
642
637
  kind: QuestionKind;
643
638
  data: QuestionData;
644
- active?: boolean;
645
- answer_quota?: number | null;
646
639
  answer_count?: number | null;
647
- show_answer_count: boolean;
648
- show_answer_quota: boolean;
649
- show_expires_at: boolean;
650
- expires_at?: string | null;
651
- closed_at?: string | null;
652
640
  answer?: Answer;
653
641
  metrics?: QuestionMetrics;
654
- app_area?: AppArea;
655
642
  }
656
643
  export interface QuestionCollectionResponse {
657
644
  page: number;
@@ -660,12 +647,16 @@ export interface QuestionCollectionResponse {
660
647
  total_count: number;
661
648
  data: Array<Question>;
662
649
  }
650
+ export interface CreateQuestionMetricsRequestBody {
651
+ campaign_id?: string | null;
652
+ }
663
653
  export interface QuestionMetrics {
664
654
  id: string;
665
655
  created_at: string;
666
656
  updated_at: string;
667
657
  deleted_at?: string | null;
668
658
  question_id: string;
659
+ campaign_id?: string | null;
669
660
  answer_count: number;
670
661
  type: QuestionType;
671
662
  kind: QuestionKind;
@@ -757,6 +748,11 @@ export interface Session {
757
748
  user_properties?: Map<string, any> | null;
758
749
  events?: Array<Event>;
759
750
  }
751
+ export interface ReportSessionResponse {
752
+ should_poll: boolean;
753
+ retry_delay: number;
754
+ retry_times: number;
755
+ }
760
756
  export interface UpdateTemplateRequestBody {
761
757
  description?: string | null;
762
758
  }
@@ -1049,8 +1045,7 @@ declare class ParraAPI {
1049
1045
  getQuestionById: (question_id: string) => Promise<Question>;
1050
1046
  updateQuestionById: (question_id: string, body?: UpdateQuestionRequestBody | undefined) => Promise<Question>;
1051
1047
  deleteQuestionById: (question_id: string) => Promise<Response>;
1052
- closeQuestionById: (question_id: string) => Promise<Response>;
1053
- createMetricsForQuestionById: (question_id: string) => Promise<QuestionMetrics>;
1048
+ createMetricsForQuestionById: (question_id: string, body?: CreateQuestionMetricsRequestBody | undefined) => Promise<QuestionMetrics>;
1054
1049
  answerQuestionById: (question_id: string, body?: AnswerQuestionBody | undefined) => Promise<Response>;
1055
1050
  paginateAnswersForQuestionById: (question_id: string, query?: {
1056
1051
  $select?: string | undefined;
package/dist/ParraAPI.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TemplateType = exports.QuestionStatus = exports.QuestionKind = exports.QuestionType = exports.CardItemType = exports.CampaignActionDisplayType = exports.CampaignActionType = exports.CampaignStatus = exports.SubscriptionStatus = exports.Interval = exports.Currency = void 0;
3
+ exports.TemplateType = exports.QuestionKind = exports.QuestionType = exports.CardItemType = exports.CardItemDisplayType = exports.CampaignActionDisplayType = exports.CampaignActionType = exports.CampaignStatus = exports.SubscriptionStatus = exports.Interval = exports.Currency = void 0;
4
4
  var Currency;
5
5
  (function (Currency) {
6
6
  Currency["usd"] = "usd";
@@ -39,6 +39,11 @@ var CampaignActionDisplayType;
39
39
  CampaignActionDisplayType["popup"] = "popup";
40
40
  CampaignActionDisplayType["inline"] = "inline";
41
41
  })(CampaignActionDisplayType = exports.CampaignActionDisplayType || (exports.CampaignActionDisplayType = {}));
42
+ var CardItemDisplayType;
43
+ (function (CardItemDisplayType) {
44
+ CardItemDisplayType["inline"] = "inline";
45
+ CardItemDisplayType["popup"] = "popup";
46
+ })(CardItemDisplayType = exports.CardItemDisplayType || (exports.CardItemDisplayType = {}));
42
47
  var CardItemType;
43
48
  (function (CardItemType) {
44
49
  CardItemType["question"] = "question";
@@ -66,11 +71,6 @@ var QuestionKind;
66
71
  QuestionKind["rankedChoice"] = "ranked-choice";
67
72
  QuestionKind["tag"] = "tag";
68
73
  })(QuestionKind = exports.QuestionKind || (exports.QuestionKind = {}));
69
- var QuestionStatus;
70
- (function (QuestionStatus) {
71
- QuestionStatus["open"] = "open";
72
- QuestionStatus["closed"] = "closed";
73
- })(QuestionStatus = exports.QuestionStatus || (exports.QuestionStatus = {}));
74
74
  var TemplateType;
75
75
  (function (TemplateType) {
76
76
  TemplateType["question"] = "question";
@@ -416,14 +416,13 @@ var ParraAPI = /** @class */ (function () {
416
416
  method: "delete",
417
417
  });
418
418
  };
419
- this.closeQuestionById = function (question_id) {
420
- return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions/").concat(question_id, "/close"), {
421
- method: "post",
422
- });
423
- };
424
- this.createMetricsForQuestionById = function (question_id) {
419
+ this.createMetricsForQuestionById = function (question_id, body) {
425
420
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions/").concat(question_id, "/metrics"), {
426
421
  method: "post",
422
+ body: JSON.stringify(body),
423
+ headers: {
424
+ "content-type": "application/json",
425
+ },
427
426
  });
428
427
  };
429
428
  this.answerQuestionById = function (question_id, body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.113",
3
+ "version": "0.2.115",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",