@parra/parra-js-sdk 0.3.0 → 0.3.1

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.
@@ -438,7 +438,8 @@ export interface CampaignTrigger {
438
438
  }
439
439
  export declare type CampaignTriggerList = Array<CampaignTrigger>;
440
440
  export declare enum CampaignActionType {
441
- question = "question"
441
+ question = "question",
442
+ notification = "notification"
442
443
  }
443
444
  export declare enum CampaignActionDisplayType {
444
445
  popup = "popup",
@@ -446,6 +447,7 @@ export declare enum CampaignActionDisplayType {
446
447
  }
447
448
  export interface UpdateCampaignActionRequestBody {
448
449
  type: CampaignActionType;
450
+ notification_template_id?: string;
449
451
  question_id?: string;
450
452
  display_type?: CampaignActionDisplayType | null;
451
453
  app_area_id?: string | null;
@@ -457,6 +459,7 @@ export interface CampaignAction {
457
459
  updated_at: string;
458
460
  deleted_at?: string | null;
459
461
  type: CampaignActionType;
462
+ notification_template_id?: string;
460
463
  question_id?: string;
461
464
  display_type?: CampaignActionDisplayType | null;
462
465
  app_area_id?: string | null;
@@ -1053,6 +1056,26 @@ export interface InboxChannel {
1053
1056
  title: string;
1054
1057
  description?: string | null;
1055
1058
  }
1059
+ export interface InboxItem {
1060
+ id: string;
1061
+ created_at: string;
1062
+ updated_at: string;
1063
+ deleted_at?: string | null;
1064
+ title: string;
1065
+ description?: string;
1066
+ read: boolean;
1067
+ read_at?: string | null;
1068
+ }
1069
+ export interface ReadInboxItemsRequestBody {
1070
+ item_ids: Array<string>;
1071
+ }
1072
+ export interface InboxItemCollectionResponse {
1073
+ page: number;
1074
+ page_count: number;
1075
+ page_size: number;
1076
+ total_count: number;
1077
+ data: Array<InboxItem>;
1078
+ }
1056
1079
  export interface UpdateApnsConfigurationRequestBody {
1057
1080
  name: string;
1058
1081
  description?: string | null;
@@ -1146,7 +1169,7 @@ export interface SendNotificationApnsChannelOverrides {
1146
1169
  priority?: number;
1147
1170
  }
1148
1171
  export interface SendNotificationInboxChannelOverrides {
1149
- title: string;
1172
+ title?: string;
1150
1173
  description?: string | null;
1151
1174
  }
1152
1175
  export interface SendNotificationChannels {
@@ -1380,6 +1403,13 @@ declare class ParraAPI {
1380
1403
  updateApplicationByIdForTenantById: (tenant_id: string, application_id: string, body?: UpdateApplicationRequestBody | undefined) => Promise<Application>;
1381
1404
  deleteApplicationByIdForTenantById: (tenant_id: string, application_id: string) => Promise<Response>;
1382
1405
  updateApnsConfigurationForTenantApplication: (tenant_id: string, application_id: string, body?: UpdateApnsConfigurationRequestBody | undefined) => Promise<ApnsConfiguration>;
1406
+ getInboxItemsForTenantUser: (tenant_id: string, query?: {
1407
+ limit?: number | undefined;
1408
+ offset?: number | undefined;
1409
+ segment?: string | undefined;
1410
+ archived?: boolean | undefined;
1411
+ } | undefined) => Promise<InboxItemCollectionResponse>;
1412
+ readInboxItemsForTenantUser: (tenant_id: string, body?: ReadInboxItemsRequestBody | undefined) => Promise<Response>;
1383
1413
  createNotificationTemplate: (tenant_id: string, body?: CreateNotificationTemplateRequestBody | undefined) => Promise<NotificationTemplate>;
1384
1414
  paginateNotificationTemplatesForTenantById: (tenant_id: string, query?: {
1385
1415
  $select?: string | undefined;
package/dist/ParraAPI.js CHANGED
@@ -33,6 +33,7 @@ var CampaignStatus;
33
33
  var CampaignActionType;
34
34
  (function (CampaignActionType) {
35
35
  CampaignActionType["question"] = "question";
36
+ CampaignActionType["notification"] = "notification";
36
37
  })(CampaignActionType = exports.CampaignActionType || (exports.CampaignActionType = {}));
37
38
  var CampaignActionDisplayType;
38
39
  (function (CampaignActionDisplayType) {
@@ -595,6 +596,22 @@ var ParraAPI = /** @class */ (function () {
595
596
  },
596
597
  });
597
598
  };
599
+ this.getInboxItemsForTenantUser = function (tenant_id, query) {
600
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/notifications/inbox/items"), {
601
+ method: "get",
602
+ query: query,
603
+ });
604
+ };
605
+ this.readInboxItemsForTenantUser = function (tenant_id, body) {
606
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/notifications/inbox/items/read"), {
607
+ method: "post",
608
+ body: JSON.stringify(body),
609
+ headers: {
610
+ "content-type": "application/json",
611
+ },
612
+ raw: true,
613
+ });
614
+ };
598
615
  this.createNotificationTemplate = function (tenant_id, body) {
599
616
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/notifications/templates"), {
600
617
  method: "post",
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { AuthorizationProvider, HTTPInterceptor } from '@parra/http-client';
2
- import 'isomorphic-fetch';
3
2
  import { default as ParraAPI } from './ParraAPI';
4
3
  export { HTTPRequestBody, HTTPUrlComponent, HTTPResponse, HTTPHeaders, HTTPQuery, HTTPMethod, HTTPLogger, HTTPOptions, HTTPRequest, HTTPRequestWithoutMethod, HTTPClient, HTTPInterceptor, Authorization, AuthFunctionProvider, AuthPromiseProvider, AuthorizationProvider, AuthInterceptor } from '@parra/http-client';
5
4
  export * from './ParraAPI';
6
5
  export { ParraAPI };
7
6
  export declare type ParraAPIType = typeof ParraAPI;
8
7
  export interface ParraAPIOptions {
9
- authorization?: AuthorizationProvider;
8
+ authorization: AuthorizationProvider;
10
9
  baseUrl?: string;
11
10
  interceptors?: HTTPInterceptor[];
11
+ fetch: any;
12
12
  }
13
- export default function (options?: ParraAPIOptions): ParraAPI;
13
+ export default function (options: ParraAPIOptions): ParraAPI;
package/dist/index.js CHANGED
@@ -19,7 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.ParraAPI = exports.AuthInterceptor = exports.HTTPClient = void 0;
21
21
  var http_client_1 = require("@parra/http-client");
22
- require("isomorphic-fetch");
23
22
  var ParraAPI_1 = __importDefault(require("./ParraAPI"));
24
23
  Object.defineProperty(exports, "ParraAPI", { enumerable: true, get: function () { return ParraAPI_1.default; } });
25
24
  var http_client_2 = require("@parra/http-client");
@@ -27,7 +26,6 @@ Object.defineProperty(exports, "HTTPClient", { enumerable: true, get: function (
27
26
  Object.defineProperty(exports, "AuthInterceptor", { enumerable: true, get: function () { return http_client_2.AuthInterceptor; } });
28
27
  __exportStar(require("./ParraAPI"), exports);
29
28
  function default_1(options) {
30
- if (options === void 0) { options = {}; }
31
29
  var baseUrl = options.baseUrl || 'https://api.parra.io';
32
30
  var interceptors = [];
33
31
  if (options.authorization) {
@@ -37,7 +35,7 @@ function default_1(options) {
37
35
  if (options.interceptors) {
38
36
  interceptors.push.apply(interceptors, options.interceptors);
39
37
  }
40
- var http = new http_client_1.HTTPClient(interceptors);
38
+ var http = new http_client_1.HTTPClient({ interceptors: interceptors, fetch: options.fetch });
41
39
  return new ParraAPI_1.default(http, { baseUrl: baseUrl });
42
40
  }
43
41
  exports.default = default_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",