@flexbe/sdk 0.2.23 → 0.2.25

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.
@@ -1,6 +1,8 @@
1
1
  import { Pages } from './pages';
2
+ import { Stat } from './stat';
2
3
  export class SiteApi {
3
4
  constructor(api, siteId) {
4
5
  this.pages = new Pages(api, siteId);
6
+ this.stat = new Stat(api, siteId);
5
7
  }
6
8
  }
@@ -0,0 +1,28 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export class Stat {
11
+ constructor(api, siteId) {
12
+ this.api = api;
13
+ this.siteId = siteId;
14
+ }
15
+ getAbTest(testId) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const response = yield this.api.get(`/sites/${this.siteId}/stat-abtests/${testId}`);
18
+ return response.data;
19
+ });
20
+ }
21
+ createAbTest(pageId) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const request = { pageId };
24
+ const response = yield this.api.post(`/sites/${this.siteId}/stat-abtests`, request);
25
+ return response.data;
26
+ });
27
+ }
28
+ }
@@ -2,3 +2,4 @@ export * from './client/client';
2
2
  export * from './client/pages';
3
3
  export * from './types';
4
4
  export * from './types/pages';
5
+ export * from './types/stat';
@@ -0,0 +1 @@
1
+ export {};
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SiteApi = void 0;
4
4
  const pages_1 = require("./pages");
5
+ const stat_1 = require("./stat");
5
6
  class SiteApi {
6
7
  constructor(api, siteId) {
7
8
  this.pages = new pages_1.Pages(api, siteId);
9
+ this.stat = new stat_1.Stat(api, siteId);
8
10
  }
9
11
  }
10
12
  exports.SiteApi = SiteApi;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Stat = void 0;
4
+ class Stat {
5
+ constructor(api, siteId) {
6
+ this.api = api;
7
+ this.siteId = siteId;
8
+ }
9
+ async getAbTest(testId) {
10
+ const response = await this.api.get(`/sites/${this.siteId}/stat-abtests/${testId}`);
11
+ return response.data;
12
+ }
13
+ async createAbTest(pageId) {
14
+ const request = { pageId };
15
+ const response = await this.api.post(`/sites/${this.siteId}/stat-abtests`, request);
16
+ return response.data;
17
+ }
18
+ }
19
+ exports.Stat = Stat;
package/dist/cjs/index.js CHANGED
@@ -18,3 +18,4 @@ __exportStar(require("./client/client"), exports);
18
18
  __exportStar(require("./client/pages"), exports);
19
19
  __exportStar(require("./types"), exports);
20
20
  __exportStar(require("./types/pages"), exports);
21
+ __exportStar(require("./types/stat"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,8 @@
1
1
  import { Pages } from './pages';
2
+ import { Stat } from './stat';
2
3
  export class SiteApi {
3
4
  constructor(api, siteId) {
4
5
  this.pages = new Pages(api, siteId);
6
+ this.stat = new Stat(api, siteId);
5
7
  }
6
8
  }
@@ -0,0 +1,15 @@
1
+ export class Stat {
2
+ constructor(api, siteId) {
3
+ this.api = api;
4
+ this.siteId = siteId;
5
+ }
6
+ async getAbTest(testId) {
7
+ const response = await this.api.get(`/sites/${this.siteId}/stat-abtests/${testId}`);
8
+ return response.data;
9
+ }
10
+ async createAbTest(pageId) {
11
+ const request = { pageId };
12
+ const response = await this.api.post(`/sites/${this.siteId}/stat-abtests`, request);
13
+ return response.data;
14
+ }
15
+ }
package/dist/esm/index.js CHANGED
@@ -2,3 +2,4 @@ export * from './client/client';
2
2
  export * from './client/pages';
3
3
  export * from './types';
4
4
  export * from './types/pages';
5
+ export * from './types/stat';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,8 @@
1
1
  import { ApiClient } from './api-client';
2
2
  import { Pages } from './pages';
3
+ import { Stat } from './stat';
3
4
  export declare class SiteApi {
4
5
  readonly pages: Pages;
6
+ readonly stat: Stat;
5
7
  constructor(api: ApiClient, siteId: number);
6
8
  }
@@ -0,0 +1,9 @@
1
+ import { ApiClient } from './api-client';
2
+ import { AbTest } from '../types/stat';
3
+ export declare class Stat {
4
+ private readonly api;
5
+ private readonly siteId;
6
+ constructor(api: ApiClient, siteId: number);
7
+ getAbTest(testId: number): Promise<AbTest>;
8
+ createAbTest(pageId: number): Promise<AbTest>;
9
+ }
@@ -2,3 +2,4 @@ export * from './client/client';
2
2
  export * from './client/pages';
3
3
  export * from './types';
4
4
  export * from './types/pages';
5
+ export * from './types/stat';
@@ -0,0 +1,12 @@
1
+ export interface AbTest {
2
+ id: number;
3
+ pageId: number;
4
+ createdAt: string;
5
+ aCountView: number;
6
+ aCountLead: number;
7
+ bCountView: number;
8
+ bCountLead: number;
9
+ }
10
+ export interface CreateAbTestRequest {
11
+ pageId: number;
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexbe/sdk",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",