@parra/parra-js-sdk 0.2.109 → 0.2.111

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.
@@ -330,6 +330,7 @@ export interface AppAreaCollectionResponse {
330
330
  export declare type AppAreaListResponse = Array<AppArea>;
331
331
  export declare enum CampaignStatus {
332
332
  active = "active",
333
+ paused = "paused",
333
334
  draft = "draft",
334
335
  scheduled = "scheduled",
335
336
  complete = "complete",
@@ -337,12 +338,16 @@ export declare enum CampaignStatus {
337
338
  archived = "archived"
338
339
  }
339
340
  export interface UpdateCampaignRequestBody {
340
- name: string;
341
+ name?: string;
341
342
  description?: string | null;
343
+ triggers?: UpdateCampaignTriggerList;
344
+ actions?: UpdateCampaignActionList;
342
345
  }
343
346
  export interface CreateCampaignRequestBody {
344
- name: string;
347
+ name?: string;
345
348
  description?: string | null;
349
+ triggers?: UpdateCampaignTriggerList;
350
+ actions?: UpdateCampaignActionList;
346
351
  }
347
352
  export interface Campaign {
348
353
  id: string;
@@ -355,7 +360,11 @@ export interface Campaign {
355
360
  published_at?: string | null;
356
361
  start_at?: string | null;
357
362
  end_at?: string | null;
363
+ paused_at?: string | null;
364
+ closed_at?: string | null;
358
365
  status: CampaignStatus;
366
+ triggers?: CampaignTriggerList;
367
+ actions?: CampaignActionList;
359
368
  }
360
369
  export interface CampaignCollectionResponse {
361
370
  page: number;
@@ -365,6 +374,30 @@ export interface CampaignCollectionResponse {
365
374
  data: Array<Campaign>;
366
375
  }
367
376
  export declare type CampaignListResponse = Array<Campaign>;
377
+ export interface UpdateCampaignTriggerRequestBody {
378
+ analytic_event_type_id: string;
379
+ }
380
+ export declare type UpdateCampaignTriggerList = Array<UpdateCampaignTriggerRequestBody>;
381
+ export interface CampaignTrigger {
382
+ id: string;
383
+ created_at: string;
384
+ updated_at: string;
385
+ deleted_at?: string | null;
386
+ analytic_event_type_id: string;
387
+ }
388
+ export declare type CampaignTriggerList = Array<CampaignTrigger>;
389
+ export interface UpdateCampaignActionRequestBody {
390
+ question_id?: string;
391
+ }
392
+ export declare type UpdateCampaignActionList = Array<UpdateCampaignActionRequestBody>;
393
+ export interface CampaignAction {
394
+ id: string;
395
+ created_at: string;
396
+ updated_at: string;
397
+ deleted_at?: string | null;
398
+ question_id?: string;
399
+ }
400
+ export declare type CampaignActionList = Array<CampaignAction>;
368
401
  export interface FormResponse {
369
402
  }
370
403
  export interface Form {
@@ -974,9 +1007,13 @@ declare class ParraAPI {
974
1007
  $expand?: string | undefined;
975
1008
  $search?: string | undefined;
976
1009
  } | undefined) => Promise<CampaignCollectionResponse>;
977
- getCampaignById: (tenant_id: string, campaign_id: string) => Promise<Campaign>;
1010
+ getCampaignById: (tenant_id: string, campaign_id: string, query?: {
1011
+ include?: string | undefined;
1012
+ } | undefined) => Promise<Campaign>;
978
1013
  updateCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody | undefined) => Promise<Campaign>;
979
1014
  deleteCampaignById: (tenant_id: string, campaign_id: string) => Promise<Response>;
1015
+ publishCampaignById: (tenant_id: string, campaign_id: string, body?: UpdateCampaignRequestBody | undefined) => Promise<Campaign>;
1016
+ closeCampaignById: (tenant_id: string, campaign_id: string) => Promise<Campaign>;
980
1017
  getCards: (query?: {
981
1018
  app_area_id?: string | undefined;
982
1019
  } | undefined) => Promise<CardsResponse>;
package/dist/ParraAPI.js CHANGED
@@ -23,6 +23,7 @@ var SubscriptionStatus;
23
23
  var CampaignStatus;
24
24
  (function (CampaignStatus) {
25
25
  CampaignStatus["active"] = "active";
26
+ CampaignStatus["paused"] = "paused";
26
27
  CampaignStatus["draft"] = "draft";
27
28
  CampaignStatus["scheduled"] = "scheduled";
28
29
  CampaignStatus["complete"] = "complete";
@@ -317,14 +318,15 @@ var ParraAPI = /** @class */ (function () {
317
318
  query: query,
318
319
  });
319
320
  };
320
- this.getCampaignById = function (tenant_id, campaign_id) {
321
+ this.getCampaignById = function (tenant_id, campaign_id, query) {
321
322
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id), {
322
323
  method: "get",
324
+ query: query,
323
325
  });
324
326
  };
325
327
  this.updateCampaignById = function (tenant_id, campaign_id, body) {
326
328
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id), {
327
- method: "put",
329
+ method: "patch",
328
330
  body: JSON.stringify(body),
329
331
  headers: {
330
332
  "content-type": "application/json",
@@ -336,6 +338,20 @@ var ParraAPI = /** @class */ (function () {
336
338
  method: "delete",
337
339
  });
338
340
  };
341
+ this.publishCampaignById = function (tenant_id, campaign_id, body) {
342
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id, "/publish"), {
343
+ method: "post",
344
+ body: JSON.stringify(body),
345
+ headers: {
346
+ "content-type": "application/json",
347
+ },
348
+ });
349
+ };
350
+ this.closeCampaignById = function (tenant_id, campaign_id) {
351
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/campaigns/").concat(campaign_id, "/close"), {
352
+ method: "post",
353
+ });
354
+ };
339
355
  this.getCards = function (query) {
340
356
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/cards"), {
341
357
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.109",
3
+ "version": "0.2.111",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",