@flexbe/sdk 0.2.22 → 0.2.24

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,7 +1,17 @@
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
+ };
1
10
  import { FlexbeAuthType } from '../types';
2
11
  import { ApiClient } from './api-client';
3
12
  import { SiteApi } from './site-api';
4
13
  import { MetaApi } from './meta-api';
14
+ import { TokenManager } from './token-manager';
5
15
  export class FlexbeClient {
6
16
  constructor(config) {
7
17
  this.siteApis = new Map();
@@ -36,4 +46,17 @@ export class FlexbeClient {
36
46
  }
37
47
  return siteApi;
38
48
  }
49
+ /**
50
+ * Revokes the current authentication token and clears it from storage.
51
+ * This should be called during logout to ensure proper cleanup.
52
+ * @returns Promise that resolves when the token is revoked
53
+ */
54
+ revokeToken() {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ if (this.config.authType !== FlexbeAuthType.BEARER) {
57
+ return;
58
+ }
59
+ yield TokenManager.getInstance().revokeToken();
60
+ });
61
+ }
39
62
  }
@@ -272,4 +272,95 @@ export class Pages {
272
272
  return response.data;
273
273
  });
274
274
  }
275
+ /**
276
+ * Get all AB tests for a page
277
+ * @param pageId - ID of the page to get AB tests for
278
+ * @returns Array of AB tests
279
+ * @throws {UnauthorizedException} When the API key is invalid or expired
280
+ * @throws {NotFoundException} When the page is not found
281
+ * @throws {ForbiddenException} When the page does not belong to the site
282
+ * @throws {ServerException} When the server encounters an error
283
+ * @throws {TimeoutException} When the request times out
284
+ */
285
+ getAbTests(pageId) {
286
+ return __awaiter(this, void 0, void 0, function* () {
287
+ const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/abtests`);
288
+ return response.data;
289
+ });
290
+ }
291
+ /**
292
+ * Get a single AB test by ID
293
+ * @param pageId - ID of the page the AB test belongs to
294
+ * @param testId - ID of the AB test to get
295
+ * @returns The requested AB test
296
+ * @throws {UnauthorizedException} When the API key is invalid or expired
297
+ * @throws {NotFoundException} When the page or AB test is not found
298
+ * @throws {ForbiddenException} When the page does not belong to the site
299
+ * @throws {ServerException} When the server encounters an error
300
+ * @throws {TimeoutException} When the request times out
301
+ */
302
+ getAbTest(pageId, testId) {
303
+ return __awaiter(this, void 0, void 0, function* () {
304
+ const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`);
305
+ return response.data;
306
+ });
307
+ }
308
+ /**
309
+ * Create a new AB test
310
+ * @param pageId - ID of the page to create the AB test for
311
+ * @param data - Create parameters:
312
+ * - isActive: Whether the test is active (optional, defaults to true)
313
+ * @returns The created AB test
314
+ * @throws {UnauthorizedException} When the API key is invalid or expired
315
+ * @throws {NotFoundException} When the page is not found
316
+ * @throws {ForbiddenException} When the page does not belong to the site
317
+ * @throws {BadRequestException} When the create parameters are invalid
318
+ * @throws {ServerException} When the server encounters an error
319
+ * @throws {TimeoutException} When the request times out
320
+ */
321
+ createAbTest(pageId, data) {
322
+ return __awaiter(this, void 0, void 0, function* () {
323
+ const response = yield this.api.post(`/sites/${this.siteId}/pages/${pageId}/abtests`, data);
324
+ return response.data;
325
+ });
326
+ }
327
+ /**
328
+ * Update an AB test
329
+ * @param pageId - ID of the page the AB test belongs to
330
+ * @param testId - ID of the AB test to update
331
+ * @param data - Update parameters:
332
+ * - isActive: Whether the test is active
333
+ * - aCountView: Number of views for variant A
334
+ * - aCountLead: Number of leads for variant A
335
+ * - bCountView: Number of views for variant B
336
+ * - bCountLead: Number of leads for variant B
337
+ * @returns The updated AB test
338
+ * @throws {UnauthorizedException} When the API key is invalid or expired
339
+ * @throws {NotFoundException} When the page or AB test is not found
340
+ * @throws {ForbiddenException} When the page does not belong to the site
341
+ * @throws {BadRequestException} When the update parameters are invalid
342
+ * @throws {ServerException} When the server encounters an error
343
+ * @throws {TimeoutException} When the request times out
344
+ */
345
+ updateAbTest(pageId, testId, data) {
346
+ return __awaiter(this, void 0, void 0, function* () {
347
+ const response = yield this.api.put(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`, data);
348
+ return response.data;
349
+ });
350
+ }
351
+ /**
352
+ * Delete an AB test
353
+ * @param pageId - ID of the page the AB test belongs to
354
+ * @param testId - ID of the AB test to delete
355
+ * @throws {UnauthorizedException} When the API key is invalid or expired
356
+ * @throws {NotFoundException} When the page or AB test is not found
357
+ * @throws {ForbiddenException} When the page does not belong to the site
358
+ * @throws {ServerException} When the server encounters an error
359
+ * @throws {TimeoutException} When the request times out
360
+ */
361
+ deleteAbTest(pageId, testId) {
362
+ return __awaiter(this, void 0, void 0, function* () {
363
+ yield this.api.delete(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`);
364
+ });
365
+ }
275
366
  }
@@ -235,4 +235,31 @@ export class TokenManager {
235
235
  localStorage.removeItem(TOKEN_STORAGE_KEY);
236
236
  }
237
237
  }
238
+ revokeToken() {
239
+ return __awaiter(this, void 0, void 0, function* () {
240
+ const token = this.token;
241
+ this.clearToken();
242
+ if (!token)
243
+ return;
244
+ try {
245
+ const controller = new AbortController();
246
+ const timeoutId = setTimeout(() => controller.abort(), 30000);
247
+ yield fetch('/oauth/revoke', {
248
+ method: 'POST',
249
+ headers: {
250
+ 'Content-Type': 'application/json',
251
+ 'Authorization': `Bearer ${token.accessToken}`
252
+ },
253
+ body: JSON.stringify({ token: token.accessToken }),
254
+ credentials: 'include',
255
+ signal: controller.signal,
256
+ });
257
+ clearTimeout(timeoutId);
258
+ }
259
+ catch (error) {
260
+ console.error('Failed to revoke token:', error);
261
+ // Even if revocation fails, we still want to clear the local token
262
+ }
263
+ });
264
+ }
238
265
  }
@@ -5,6 +5,7 @@ const types_1 = require("../types");
5
5
  const api_client_1 = require("./api-client");
6
6
  const site_api_1 = require("./site-api");
7
7
  const meta_api_1 = require("./meta-api");
8
+ const token_manager_1 = require("./token-manager");
8
9
  class FlexbeClient {
9
10
  constructor(config) {
10
11
  this.siteApis = new Map();
@@ -39,5 +40,16 @@ class FlexbeClient {
39
40
  }
40
41
  return siteApi;
41
42
  }
43
+ /**
44
+ * Revokes the current authentication token and clears it from storage.
45
+ * This should be called during logout to ensure proper cleanup.
46
+ * @returns Promise that resolves when the token is revoked
47
+ */
48
+ async revokeToken() {
49
+ if (this.config.authType !== types_1.FlexbeAuthType.BEARER) {
50
+ return;
51
+ }
52
+ await token_manager_1.TokenManager.getInstance().revokeToken();
53
+ }
42
54
  }
43
55
  exports.FlexbeClient = FlexbeClient;
@@ -242,5 +242,86 @@ class Pages {
242
242
  const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
243
243
  return response.data;
244
244
  }
245
+ /**
246
+ * Get all AB tests for a page
247
+ * @param pageId - ID of the page to get AB tests for
248
+ * @returns Array of AB tests
249
+ * @throws {UnauthorizedException} When the API key is invalid or expired
250
+ * @throws {NotFoundException} When the page is not found
251
+ * @throws {ForbiddenException} When the page does not belong to the site
252
+ * @throws {ServerException} When the server encounters an error
253
+ * @throws {TimeoutException} When the request times out
254
+ */
255
+ async getAbTests(pageId) {
256
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/abtests`);
257
+ return response.data;
258
+ }
259
+ /**
260
+ * Get a single AB test by ID
261
+ * @param pageId - ID of the page the AB test belongs to
262
+ * @param testId - ID of the AB test to get
263
+ * @returns The requested AB test
264
+ * @throws {UnauthorizedException} When the API key is invalid or expired
265
+ * @throws {NotFoundException} When the page or AB test is not found
266
+ * @throws {ForbiddenException} When the page does not belong to the site
267
+ * @throws {ServerException} When the server encounters an error
268
+ * @throws {TimeoutException} When the request times out
269
+ */
270
+ async getAbTest(pageId, testId) {
271
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`);
272
+ return response.data;
273
+ }
274
+ /**
275
+ * Create a new AB test
276
+ * @param pageId - ID of the page to create the AB test for
277
+ * @param data - Create parameters:
278
+ * - isActive: Whether the test is active (optional, defaults to true)
279
+ * @returns The created AB test
280
+ * @throws {UnauthorizedException} When the API key is invalid or expired
281
+ * @throws {NotFoundException} When the page is not found
282
+ * @throws {ForbiddenException} When the page does not belong to the site
283
+ * @throws {BadRequestException} When the create parameters are invalid
284
+ * @throws {ServerException} When the server encounters an error
285
+ * @throws {TimeoutException} When the request times out
286
+ */
287
+ async createAbTest(pageId, data) {
288
+ const response = await this.api.post(`/sites/${this.siteId}/pages/${pageId}/abtests`, data);
289
+ return response.data;
290
+ }
291
+ /**
292
+ * Update an AB test
293
+ * @param pageId - ID of the page the AB test belongs to
294
+ * @param testId - ID of the AB test to update
295
+ * @param data - Update parameters:
296
+ * - isActive: Whether the test is active
297
+ * - aCountView: Number of views for variant A
298
+ * - aCountLead: Number of leads for variant A
299
+ * - bCountView: Number of views for variant B
300
+ * - bCountLead: Number of leads for variant B
301
+ * @returns The updated AB test
302
+ * @throws {UnauthorizedException} When the API key is invalid or expired
303
+ * @throws {NotFoundException} When the page or AB test is not found
304
+ * @throws {ForbiddenException} When the page does not belong to the site
305
+ * @throws {BadRequestException} When the update parameters are invalid
306
+ * @throws {ServerException} When the server encounters an error
307
+ * @throws {TimeoutException} When the request times out
308
+ */
309
+ async updateAbTest(pageId, testId, data) {
310
+ const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`, data);
311
+ return response.data;
312
+ }
313
+ /**
314
+ * Delete an AB test
315
+ * @param pageId - ID of the page the AB test belongs to
316
+ * @param testId - ID of the AB test to delete
317
+ * @throws {UnauthorizedException} When the API key is invalid or expired
318
+ * @throws {NotFoundException} When the page or AB test is not found
319
+ * @throws {ForbiddenException} When the page does not belong to the site
320
+ * @throws {ServerException} When the server encounters an error
321
+ * @throws {TimeoutException} When the request times out
322
+ */
323
+ async deleteAbTest(pageId, testId) {
324
+ await this.api.delete(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`);
325
+ }
245
326
  }
246
327
  exports.Pages = Pages;
@@ -226,5 +226,30 @@ class TokenManager {
226
226
  localStorage.removeItem(TOKEN_STORAGE_KEY);
227
227
  }
228
228
  }
229
+ async revokeToken() {
230
+ const token = this.token;
231
+ this.clearToken();
232
+ if (!token)
233
+ return;
234
+ try {
235
+ const controller = new AbortController();
236
+ const timeoutId = setTimeout(() => controller.abort(), 30000);
237
+ await fetch('/oauth/revoke', {
238
+ method: 'POST',
239
+ headers: {
240
+ 'Content-Type': 'application/json',
241
+ 'Authorization': `Bearer ${token.accessToken}`
242
+ },
243
+ body: JSON.stringify({ token: token.accessToken }),
244
+ credentials: 'include',
245
+ signal: controller.signal,
246
+ });
247
+ clearTimeout(timeoutId);
248
+ }
249
+ catch (error) {
250
+ console.error('Failed to revoke token:', error);
251
+ // Even if revocation fails, we still want to clear the local token
252
+ }
253
+ }
229
254
  }
230
255
  exports.TokenManager = TokenManager;
@@ -2,6 +2,7 @@ import { FlexbeAuthType } from '../types';
2
2
  import { ApiClient } from './api-client';
3
3
  import { SiteApi } from './site-api';
4
4
  import { MetaApi } from './meta-api';
5
+ import { TokenManager } from './token-manager';
5
6
  export class FlexbeClient {
6
7
  constructor(config) {
7
8
  this.siteApis = new Map();
@@ -36,4 +37,15 @@ export class FlexbeClient {
36
37
  }
37
38
  return siteApi;
38
39
  }
40
+ /**
41
+ * Revokes the current authentication token and clears it from storage.
42
+ * This should be called during logout to ensure proper cleanup.
43
+ * @returns Promise that resolves when the token is revoked
44
+ */
45
+ async revokeToken() {
46
+ if (this.config.authType !== FlexbeAuthType.BEARER) {
47
+ return;
48
+ }
49
+ await TokenManager.getInstance().revokeToken();
50
+ }
39
51
  }
@@ -239,4 +239,85 @@ export class Pages {
239
239
  const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
240
240
  return response.data;
241
241
  }
242
+ /**
243
+ * Get all AB tests for a page
244
+ * @param pageId - ID of the page to get AB tests for
245
+ * @returns Array of AB tests
246
+ * @throws {UnauthorizedException} When the API key is invalid or expired
247
+ * @throws {NotFoundException} When the page is not found
248
+ * @throws {ForbiddenException} When the page does not belong to the site
249
+ * @throws {ServerException} When the server encounters an error
250
+ * @throws {TimeoutException} When the request times out
251
+ */
252
+ async getAbTests(pageId) {
253
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/abtests`);
254
+ return response.data;
255
+ }
256
+ /**
257
+ * Get a single AB test by ID
258
+ * @param pageId - ID of the page the AB test belongs to
259
+ * @param testId - ID of the AB test to get
260
+ * @returns The requested AB test
261
+ * @throws {UnauthorizedException} When the API key is invalid or expired
262
+ * @throws {NotFoundException} When the page or AB test is not found
263
+ * @throws {ForbiddenException} When the page does not belong to the site
264
+ * @throws {ServerException} When the server encounters an error
265
+ * @throws {TimeoutException} When the request times out
266
+ */
267
+ async getAbTest(pageId, testId) {
268
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`);
269
+ return response.data;
270
+ }
271
+ /**
272
+ * Create a new AB test
273
+ * @param pageId - ID of the page to create the AB test for
274
+ * @param data - Create parameters:
275
+ * - isActive: Whether the test is active (optional, defaults to true)
276
+ * @returns The created AB test
277
+ * @throws {UnauthorizedException} When the API key is invalid or expired
278
+ * @throws {NotFoundException} When the page is not found
279
+ * @throws {ForbiddenException} When the page does not belong to the site
280
+ * @throws {BadRequestException} When the create parameters are invalid
281
+ * @throws {ServerException} When the server encounters an error
282
+ * @throws {TimeoutException} When the request times out
283
+ */
284
+ async createAbTest(pageId, data) {
285
+ const response = await this.api.post(`/sites/${this.siteId}/pages/${pageId}/abtests`, data);
286
+ return response.data;
287
+ }
288
+ /**
289
+ * Update an AB test
290
+ * @param pageId - ID of the page the AB test belongs to
291
+ * @param testId - ID of the AB test to update
292
+ * @param data - Update parameters:
293
+ * - isActive: Whether the test is active
294
+ * - aCountView: Number of views for variant A
295
+ * - aCountLead: Number of leads for variant A
296
+ * - bCountView: Number of views for variant B
297
+ * - bCountLead: Number of leads for variant B
298
+ * @returns The updated AB test
299
+ * @throws {UnauthorizedException} When the API key is invalid or expired
300
+ * @throws {NotFoundException} When the page or AB test is not found
301
+ * @throws {ForbiddenException} When the page does not belong to the site
302
+ * @throws {BadRequestException} When the update parameters are invalid
303
+ * @throws {ServerException} When the server encounters an error
304
+ * @throws {TimeoutException} When the request times out
305
+ */
306
+ async updateAbTest(pageId, testId, data) {
307
+ const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`, data);
308
+ return response.data;
309
+ }
310
+ /**
311
+ * Delete an AB test
312
+ * @param pageId - ID of the page the AB test belongs to
313
+ * @param testId - ID of the AB test to delete
314
+ * @throws {UnauthorizedException} When the API key is invalid or expired
315
+ * @throws {NotFoundException} When the page or AB test is not found
316
+ * @throws {ForbiddenException} When the page does not belong to the site
317
+ * @throws {ServerException} When the server encounters an error
318
+ * @throws {TimeoutException} When the request times out
319
+ */
320
+ async deleteAbTest(pageId, testId) {
321
+ await this.api.delete(`/sites/${this.siteId}/pages/${pageId}/abtests/${testId}`);
322
+ }
242
323
  }
@@ -223,4 +223,29 @@ export class TokenManager {
223
223
  localStorage.removeItem(TOKEN_STORAGE_KEY);
224
224
  }
225
225
  }
226
+ async revokeToken() {
227
+ const token = this.token;
228
+ this.clearToken();
229
+ if (!token)
230
+ return;
231
+ try {
232
+ const controller = new AbortController();
233
+ const timeoutId = setTimeout(() => controller.abort(), 30000);
234
+ await fetch('/oauth/revoke', {
235
+ method: 'POST',
236
+ headers: {
237
+ 'Content-Type': 'application/json',
238
+ 'Authorization': `Bearer ${token.accessToken}`
239
+ },
240
+ body: JSON.stringify({ token: token.accessToken }),
241
+ credentials: 'include',
242
+ signal: controller.signal,
243
+ });
244
+ clearTimeout(timeoutId);
245
+ }
246
+ catch (error) {
247
+ console.error('Failed to revoke token:', error);
248
+ // Even if revocation fails, we still want to clear the local token
249
+ }
250
+ }
226
251
  }
@@ -13,4 +13,10 @@ export declare class FlexbeClient {
13
13
  * @returns A SiteApi instance for the specified site
14
14
  */
15
15
  getSiteApi(siteId: number): SiteApi;
16
+ /**
17
+ * Revokes the current authentication token and clears it from storage.
18
+ * This should be called during logout to ensure proper cleanup.
19
+ * @returns Promise that resolves when the token is revoked
20
+ */
21
+ revokeToken(): Promise<void>;
16
22
  }
@@ -1,4 +1,4 @@
1
- import { Page, GetPagesParams, PageListResponse, PageFolder, PageFolderListResponse, UpdateFolderParams, CreateFolderParams, UpdatePageParams, BulkUpdatePageItem, BulkUpdateResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkDeleteResponse, PageContent, UpdatePageContentParams } from '../types/pages';
1
+ import { Page, GetPagesParams, PageListResponse, PageFolder, PageFolderListResponse, UpdateFolderParams, CreateFolderParams, UpdatePageParams, BulkUpdatePageItem, BulkUpdateResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkDeleteResponse, PageContent, UpdatePageContentParams, AbTest, CreateAbTestParams, UpdateAbTestParams } from '../types/pages';
2
2
  import { ApiClient } from './api-client';
3
3
  export declare class Pages {
4
4
  private readonly api;
@@ -193,4 +193,71 @@ export declare class Pages {
193
193
  * @throws {TimeoutException} When the request times out
194
194
  */
195
195
  updatePageContent(pageId: number, content: Partial<UpdatePageContentParams>): Promise<PageContent>;
196
+ /**
197
+ * Get all AB tests for a page
198
+ * @param pageId - ID of the page to get AB tests for
199
+ * @returns Array of AB tests
200
+ * @throws {UnauthorizedException} When the API key is invalid or expired
201
+ * @throws {NotFoundException} When the page is not found
202
+ * @throws {ForbiddenException} When the page does not belong to the site
203
+ * @throws {ServerException} When the server encounters an error
204
+ * @throws {TimeoutException} When the request times out
205
+ */
206
+ getAbTests(pageId: number): Promise<AbTest[]>;
207
+ /**
208
+ * Get a single AB test by ID
209
+ * @param pageId - ID of the page the AB test belongs to
210
+ * @param testId - ID of the AB test to get
211
+ * @returns The requested AB test
212
+ * @throws {UnauthorizedException} When the API key is invalid or expired
213
+ * @throws {NotFoundException} When the page or AB test is not found
214
+ * @throws {ForbiddenException} When the page does not belong to the site
215
+ * @throws {ServerException} When the server encounters an error
216
+ * @throws {TimeoutException} When the request times out
217
+ */
218
+ getAbTest(pageId: number, testId: number): Promise<AbTest>;
219
+ /**
220
+ * Create a new AB test
221
+ * @param pageId - ID of the page to create the AB test for
222
+ * @param data - Create parameters:
223
+ * - isActive: Whether the test is active (optional, defaults to true)
224
+ * @returns The created AB test
225
+ * @throws {UnauthorizedException} When the API key is invalid or expired
226
+ * @throws {NotFoundException} When the page is not found
227
+ * @throws {ForbiddenException} When the page does not belong to the site
228
+ * @throws {BadRequestException} When the create parameters are invalid
229
+ * @throws {ServerException} When the server encounters an error
230
+ * @throws {TimeoutException} When the request times out
231
+ */
232
+ createAbTest(pageId: number, data: CreateAbTestParams): Promise<AbTest>;
233
+ /**
234
+ * Update an AB test
235
+ * @param pageId - ID of the page the AB test belongs to
236
+ * @param testId - ID of the AB test to update
237
+ * @param data - Update parameters:
238
+ * - isActive: Whether the test is active
239
+ * - aCountView: Number of views for variant A
240
+ * - aCountLead: Number of leads for variant A
241
+ * - bCountView: Number of views for variant B
242
+ * - bCountLead: Number of leads for variant B
243
+ * @returns The updated AB test
244
+ * @throws {UnauthorizedException} When the API key is invalid or expired
245
+ * @throws {NotFoundException} When the page or AB test is not found
246
+ * @throws {ForbiddenException} When the page does not belong to the site
247
+ * @throws {BadRequestException} When the update parameters are invalid
248
+ * @throws {ServerException} When the server encounters an error
249
+ * @throws {TimeoutException} When the request times out
250
+ */
251
+ updateAbTest(pageId: number, testId: number, data: UpdateAbTestParams): Promise<AbTest>;
252
+ /**
253
+ * Delete an AB test
254
+ * @param pageId - ID of the page the AB test belongs to
255
+ * @param testId - ID of the AB test to delete
256
+ * @throws {UnauthorizedException} When the API key is invalid or expired
257
+ * @throws {NotFoundException} When the page or AB test is not found
258
+ * @throws {ForbiddenException} When the page does not belong to the site
259
+ * @throws {ServerException} When the server encounters an error
260
+ * @throws {TimeoutException} When the request times out
261
+ */
262
+ deleteAbTest(pageId: number, testId: number): Promise<void>;
196
263
  }
@@ -20,4 +20,5 @@ export declare class TokenManager {
20
20
  private logTokenStatus;
21
21
  setToken(tokenResponse: TokenResponse): void;
22
22
  clearToken(): void;
23
+ revokeToken(): Promise<void>;
23
24
  }
@@ -292,4 +292,24 @@ export interface PageContent {
292
292
  };
293
293
  }
294
294
  export type UpdatePageContentParams = Omit<PageContent, 'versionId' | 'versionTime'>;
295
+ export interface AbTest {
296
+ id: number;
297
+ a: string;
298
+ b: string;
299
+ isActive: boolean;
300
+ aCountView?: number;
301
+ aCountLead?: number;
302
+ bCountView?: number;
303
+ bCountLead?: number;
304
+ }
305
+ export interface CreateAbTestParams {
306
+ isActive?: boolean;
307
+ }
308
+ export interface UpdateAbTestParams {
309
+ isActive?: boolean;
310
+ aCountView?: number;
311
+ aCountLead?: number;
312
+ bCountView?: number;
313
+ bCountLead?: number;
314
+ }
295
315
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexbe/sdk",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",