@flexbe/sdk 0.2.38 → 0.2.40

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.
Files changed (41) hide show
  1. package/dist/browser/client/pages.js +2 -49
  2. package/dist/browser/index.js +0 -2
  3. package/dist/browser/types/index.js +4 -0
  4. package/dist/browser/types/pages.js +14 -0
  5. package/dist/cjs/client/pages.js +2 -43
  6. package/dist/cjs/index.js +0 -2
  7. package/dist/cjs/types/index.js +18 -0
  8. package/dist/cjs/types/pages.js +15 -1
  9. package/dist/esm/client/pages.js +2 -43
  10. package/dist/esm/index.js +0 -2
  11. package/dist/esm/types/index.js +4 -0
  12. package/dist/esm/types/pages.js +14 -0
  13. package/dist/types/client/pages.d.ts +3 -35
  14. package/dist/types/index.d.ts +0 -2
  15. package/dist/types/types/animations.d.ts +61 -0
  16. package/dist/types/types/index.d.ts +4 -0
  17. package/dist/types/types/pages.d.ts +101 -58
  18. package/package.json +2 -2
  19. package/dist/browser/client/auth.js +0 -74
  20. package/dist/cjs/client/auth.js +0 -63
  21. package/dist/client/flexbe-client.d.ts +0 -13
  22. package/dist/client/flexbe-client.js +0 -62
  23. package/dist/esm/client/auth.js +0 -59
  24. package/dist/index.d.ts +0 -2
  25. package/dist/index.js +0 -18
  26. package/dist/src/client/flexbe-client.d.ts +0 -20
  27. package/dist/src/client/flexbe-client.js +0 -86
  28. package/dist/src/client/pages-client.d.ts +0 -14
  29. package/dist/src/client/pages-client.js +0 -23
  30. package/dist/src/index.d.ts +0 -4
  31. package/dist/src/index.js +0 -20
  32. package/dist/src/types/index.d.ts +0 -23
  33. package/dist/src/types/pages.d.ts +0 -41
  34. package/dist/src/types/pages.js +0 -19
  35. package/dist/test/client/flexbe-client.test.js +0 -38
  36. package/dist/test/client/pages-client.test.js +0 -82
  37. package/dist/types/client/auth.d.ts +0 -11
  38. package/dist/types/index.js +0 -2
  39. /package/dist/{test/client/flexbe-client.test.d.ts → browser/types/animations.js} +0 -0
  40. /package/dist/{src/types/index.js → cjs/types/animations.js} +0 -0
  41. /package/dist/{test/client/pages-client.test.d.ts → esm/types/animations.js} +0 -0
@@ -1,3 +1,4 @@
1
+ import type { PageEntityAnimation } from './animations';
1
2
  import type { FlexbeBulkError, Pagination } from './index';
2
3
  export interface GridConfig {
3
4
  color?: string;
@@ -232,35 +233,81 @@ export interface StylesDataRaw {
232
233
  siteTextStyles: TextStyleItem[];
233
234
  pageTextStyles?: TextStyleItem[];
234
235
  }
235
- export interface PageBlock {
236
- update_time: number;
237
- data: Record<string, unknown>;
236
+ export declare enum PageEntityType {
237
+ Block = "block",
238
+ Modal = "modal",
239
+ Element = "element",
240
+ Widget = "widget",
241
+ Layout = "layout"
242
+ }
243
+ export declare enum PageEntityHidden {
244
+ All = "all",
245
+ Mobile = "mobile",
246
+ Desktop = "desktop"
247
+ }
248
+ export type PageEntityEvent = {
249
+ event: string;
250
+ action: string;
251
+ action_code: string;
252
+ onlyFirst: boolean;
253
+ state: 'all' | 'in' | 'out';
254
+ [key: string]: any;
255
+ };
256
+ export type PageEntityData<T = Record<string, unknown>> = T;
257
+ export type PageEntityMultiVars<T> = Record<string, {
258
+ data: PageEntityData<T>;
259
+ }>;
260
+ export interface PageEntity<T = Record<string, unknown>> {
238
261
  id: string;
239
- is: string;
262
+ is: PageEntityType;
240
263
  template_id: string;
264
+ mod_id?: string;
265
+ source_id?: string;
266
+ update_time: number;
267
+ data: T;
268
+ p_id?: number;
269
+ untouched?: boolean;
270
+ hidden?: 'none' | 'mobile' | 'desktop';
271
+ className?: string;
272
+ modals?: PageModal[];
273
+ animation?: PageEntityAnimation;
274
+ events?: PageEntityEvent[];
275
+ multidata?: {
276
+ enabled: boolean;
277
+ vars: PageEntityMultiVars<T>;
278
+ };
279
+ }
280
+ export interface PageBlock<T = Record<string, unknown>> extends PageEntity<T> {
281
+ is: PageEntityType.Block;
241
282
  refPageId?: number;
242
- p_id: number;
243
283
  aboveTheFold?: boolean;
284
+ children?: Array<PageBlock | PageElement>;
285
+ multisection?: {
286
+ enabled: boolean;
287
+ main_var: string;
288
+ vars: PageEntityMultiVars<T>;
289
+ };
290
+ geolanding?: {
291
+ enabled: boolean;
292
+ vars: Record<string, {
293
+ city: string;
294
+ data: PageEntityData<T>;
295
+ }>;
296
+ };
244
297
  }
245
- export interface PageElement {
246
- update_time: number;
247
- data: Record<string, unknown>;
248
- id: string;
249
- is: string;
250
- template_id: string;
251
- mod_id?: string;
252
- p_id: number;
253
- aboveTheFold?: boolean;
254
- hidden?: string;
298
+ export interface PageWidget<T = Record<string, unknown>> extends PageEntity<T> {
299
+ is: PageEntityType.Widget;
300
+ children?: PageElement[];
255
301
  }
256
- export interface PageWidget {
257
- update_time: number;
258
- data: Record<string, unknown>;
259
- id: string;
260
- is: string;
261
- template_id: string;
262
- untouched?: boolean;
263
- p_id: number;
302
+ export interface PageModal<T = Record<string, unknown>> extends PageEntity<T> {
303
+ is: PageEntityType.Modal;
304
+ screenshot: ImageObj | null;
305
+ children?: PageElement[];
306
+ }
307
+ export interface PageElement<T = Record<string, unknown>> extends PageEntity<T> {
308
+ is: PageEntityType.Element;
309
+ aboveTheFold?: boolean;
310
+ children?: PageElement[];
264
311
  }
265
312
  export interface PageABTest {
266
313
  id: number;
@@ -268,36 +315,6 @@ export interface PageABTest {
268
315
  b: string;
269
316
  isActive: boolean;
270
317
  }
271
- export interface PageModal {
272
- update_time: number;
273
- data: Record<string, unknown>;
274
- id: string;
275
- is: string;
276
- template_id: string;
277
- mod_id: string;
278
- p_id: number;
279
- screenshot: ImageObj | null;
280
- }
281
- export interface PageContent {
282
- versionId: number;
283
- versionTime: number;
284
- blocks: PageBlock[];
285
- modals: PageModal[];
286
- elements: PageElement[];
287
- widgets: PageWidget[];
288
- codes: string[];
289
- settings: {
290
- background?: PageBackground;
291
- textStyles?: TextStyleItem[];
292
- responsive?: string | boolean;
293
- } | null;
294
- abtests: PageABTest[];
295
- assets: {
296
- images: number[];
297
- files: string[];
298
- };
299
- }
300
- export type UpdatePageContentParams = Omit<PageContent, 'versionId' | 'versionTime'>;
301
318
  export interface PageHistoryItem {
302
319
  id: number;
303
320
  createdAt: string;
@@ -322,13 +339,39 @@ export interface PageDataStructure {
322
339
  blocks: PageBlock[];
323
340
  modals: PageModal[];
324
341
  widgets: PageWidget[];
325
- codes: string[];
326
- abtests: PageABTest[];
327
- background: PageBackground;
328
- textStyles: TextStyleItem[];
329
- responsive: string | boolean;
342
+ abtests?: PageABTest[];
343
+ codes?: string[];
344
+ textStyles?: TextStyleItem[];
345
+ background?: PageBackground;
346
+ responsive?: 'auto' | boolean;
330
347
  }
331
348
  export interface PageVersionDataResponse extends PageVersionItem {
332
349
  data: PageDataStructure;
333
350
  }
351
+ /**
352
+ * @deprecated This type is deprecated and will be removed in a future release. Use PageDataStructure or related types instead.
353
+ */
354
+ export interface PageContent {
355
+ versionId: number;
356
+ versionTime: number;
357
+ blocks: PageBlock[];
358
+ modals: PageModal[];
359
+ elements: PageElement[];
360
+ widgets: PageWidget[];
361
+ codes: string[];
362
+ settings: {
363
+ background?: PageBackground;
364
+ textStyles?: TextStyleItem[];
365
+ responsive?: string | boolean;
366
+ } | null;
367
+ abtests: PageABTest[];
368
+ assets: {
369
+ images: number[];
370
+ files: string[];
371
+ };
372
+ }
373
+ /**
374
+ * @deprecated This type is deprecated and will be removed in a future release. Use PageDataStructure or related types instead.
375
+ */
376
+ export type UpdatePageContentParams = Omit<PageContent, 'versionId' | 'versionTime'>;
334
377
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexbe/sdk",
3
- "version": "0.2.38",
3
+ "version": "0.2.40",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -23,7 +23,7 @@
23
23
  "lint": "eslint src --ext .ts",
24
24
  "format": "prettier --write \"src/**/*.ts\"",
25
25
  "prepare": "npm run build",
26
- "prepublishOnly": "npm test && npm run lint"
26
+ "prepublishOnly_": "npm test && npm run lint"
27
27
  },
28
28
  "keywords": [
29
29
  "flexbe",
@@ -1,74 +0,0 @@
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
- import { FlexbeAuthType } from '../types';
11
- import { TokenManager } from './token-manager';
12
- export class FlexbeAuth {
13
- constructor(config) {
14
- this.initialized = false;
15
- this.initializationPromise = null;
16
- this.config = config;
17
- this.tokenManager = TokenManager.getInstance();
18
- if (this.config.authType === FlexbeAuthType.BEARER) {
19
- // Start initialization but don't wait for it
20
- this.initializationPromise = this.initialize();
21
- }
22
- else {
23
- this.initialized = true;
24
- }
25
- }
26
- initialize() {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- try {
29
- const token = yield this.tokenManager.getToken();
30
- this.initialized = !!token;
31
- }
32
- catch (error) {
33
- console.error('Failed to initialize auth:', error);
34
- this.initialized = false;
35
- }
36
- finally {
37
- this.initializationPromise = null;
38
- }
39
- });
40
- }
41
- ensureInitialized() {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- if (this.config.authType !== FlexbeAuthType.BEARER || this.initialized) {
44
- return;
45
- }
46
- // If initialization is in progress, wait for it
47
- if (this.initializationPromise) {
48
- yield this.initializationPromise;
49
- return;
50
- }
51
- // If not initialized and no initialization in progress, start one
52
- yield this.initialize();
53
- });
54
- }
55
- getAuthHeaders() {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- yield this.ensureInitialized();
58
- const headers = {
59
- 'Content-Type': 'application/json',
60
- };
61
- if (this.config.authType === FlexbeAuthType.API_KEY) {
62
- headers['x-api-key'] = this.config.apiKey;
63
- }
64
- else if (this.config.authType === FlexbeAuthType.BEARER) {
65
- const token = yield this.tokenManager.getToken();
66
- if (!token) {
67
- throw new Error('No valid bearer token available');
68
- }
69
- headers['Authorization'] = `Bearer ${token}`;
70
- }
71
- return headers;
72
- });
73
- }
74
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlexbeAuth = void 0;
4
- const types_1 = require("../types");
5
- const token_manager_1 = require("./token-manager");
6
- class FlexbeAuth {
7
- constructor(config) {
8
- this.initialized = false;
9
- this.initializationPromise = null;
10
- this.config = config;
11
- this.tokenManager = token_manager_1.TokenManager.getInstance();
12
- if (this.config.authType === types_1.FlexbeAuthType.BEARER) {
13
- // Start initialization but don't wait for it
14
- this.initializationPromise = this.initialize();
15
- }
16
- else {
17
- this.initialized = true;
18
- }
19
- }
20
- async initialize() {
21
- try {
22
- const token = await this.tokenManager.getToken();
23
- this.initialized = !!token;
24
- }
25
- catch (error) {
26
- console.error('Failed to initialize auth:', error);
27
- this.initialized = false;
28
- }
29
- finally {
30
- this.initializationPromise = null;
31
- }
32
- }
33
- async ensureInitialized() {
34
- if (this.config.authType !== types_1.FlexbeAuthType.BEARER || this.initialized) {
35
- return;
36
- }
37
- // If initialization is in progress, wait for it
38
- if (this.initializationPromise) {
39
- await this.initializationPromise;
40
- return;
41
- }
42
- // If not initialized and no initialization in progress, start one
43
- await this.initialize();
44
- }
45
- async getAuthHeaders() {
46
- await this.ensureInitialized();
47
- const headers = {
48
- 'Content-Type': 'application/json',
49
- };
50
- if (this.config.authType === types_1.FlexbeAuthType.API_KEY) {
51
- headers['x-api-key'] = this.config.apiKey;
52
- }
53
- else if (this.config.authType === types_1.FlexbeAuthType.BEARER) {
54
- const token = await this.tokenManager.getToken();
55
- if (!token) {
56
- throw new Error('No valid bearer token available');
57
- }
58
- headers['Authorization'] = `Bearer ${token}`;
59
- }
60
- return headers;
61
- }
62
- }
63
- exports.FlexbeAuth = FlexbeAuth;
@@ -1,13 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { FlexbeConfig, FlexbeResponse } from '../types';
3
- export declare class FlexbeClient {
4
- private readonly client;
5
- private readonly config;
6
- constructor(config: FlexbeConfig);
7
- private setupInterceptors;
8
- protected request<T>(config: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
9
- protected get<T>(url: string, config?: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
10
- protected post<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
11
- protected put<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
12
- protected delete<T>(url: string, config?: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
13
- }
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FlexbeClient = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- class FlexbeClient {
9
- constructor(config) {
10
- this.config = {
11
- baseUrl: config.baseUrl || 'https://api.flexbe.com',
12
- timeout: config.timeout || 30000,
13
- ...config,
14
- };
15
- this.client = axios_1.default.create({
16
- baseURL: this.config.baseUrl,
17
- timeout: this.config.timeout,
18
- headers: {
19
- 'Authorization': `Bearer ${this.config.apiKey}`,
20
- 'Content-Type': 'application/json',
21
- },
22
- });
23
- this.setupInterceptors();
24
- }
25
- setupInterceptors() {
26
- this.client.interceptors.response.use((response) => response, (error) => {
27
- const flexbeError = {
28
- message: error.response?.data?.message || error.message,
29
- code: error.response?.data?.code,
30
- status: error.response?.status,
31
- details: error.response?.data?.details,
32
- };
33
- return Promise.reject(flexbeError);
34
- });
35
- }
36
- async request(config) {
37
- try {
38
- const response = await this.client.request(config);
39
- return {
40
- data: response.data,
41
- status: response.status,
42
- statusText: response.statusText,
43
- };
44
- }
45
- catch (error) {
46
- throw error;
47
- }
48
- }
49
- get(url, config) {
50
- return this.request({ ...config, method: 'GET', url });
51
- }
52
- post(url, data, config) {
53
- return this.request({ ...config, method: 'POST', url, data });
54
- }
55
- put(url, data, config) {
56
- return this.request({ ...config, method: 'PUT', url, data });
57
- }
58
- delete(url, config) {
59
- return this.request({ ...config, method: 'DELETE', url });
60
- }
61
- }
62
- exports.FlexbeClient = FlexbeClient;
@@ -1,59 +0,0 @@
1
- import { FlexbeAuthType } from '../types';
2
- import { TokenManager } from './token-manager';
3
- export class FlexbeAuth {
4
- constructor(config) {
5
- this.initialized = false;
6
- this.initializationPromise = null;
7
- this.config = config;
8
- this.tokenManager = TokenManager.getInstance();
9
- if (this.config.authType === FlexbeAuthType.BEARER) {
10
- // Start initialization but don't wait for it
11
- this.initializationPromise = this.initialize();
12
- }
13
- else {
14
- this.initialized = true;
15
- }
16
- }
17
- async initialize() {
18
- try {
19
- const token = await this.tokenManager.getToken();
20
- this.initialized = !!token;
21
- }
22
- catch (error) {
23
- console.error('Failed to initialize auth:', error);
24
- this.initialized = false;
25
- }
26
- finally {
27
- this.initializationPromise = null;
28
- }
29
- }
30
- async ensureInitialized() {
31
- if (this.config.authType !== FlexbeAuthType.BEARER || this.initialized) {
32
- return;
33
- }
34
- // If initialization is in progress, wait for it
35
- if (this.initializationPromise) {
36
- await this.initializationPromise;
37
- return;
38
- }
39
- // If not initialized and no initialization in progress, start one
40
- await this.initialize();
41
- }
42
- async getAuthHeaders() {
43
- await this.ensureInitialized();
44
- const headers = {
45
- 'Content-Type': 'application/json',
46
- };
47
- if (this.config.authType === FlexbeAuthType.API_KEY) {
48
- headers['x-api-key'] = this.config.apiKey;
49
- }
50
- else if (this.config.authType === FlexbeAuthType.BEARER) {
51
- const token = await this.tokenManager.getToken();
52
- if (!token) {
53
- throw new Error('No valid bearer token available');
54
- }
55
- headers['Authorization'] = `Bearer ${token}`;
56
- }
57
- return headers;
58
- }
59
- }
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './types';
2
- export * from './client/flexbe-client';
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./client/flexbe-client"), exports);
@@ -1,20 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { FlexbeConfig, FlexbeResponse } from '../types';
3
- import { PagesClient } from './pages-client';
4
- export declare class FlexbeClient {
5
- private readonly client;
6
- private readonly config;
7
- readonly pages: PagesClient;
8
- constructor(config?: Partial<FlexbeConfig>);
9
- private setupInterceptors;
10
- private request;
11
- private get;
12
- private post;
13
- private put;
14
- private delete;
15
- private getSiteUrl;
16
- sitesGet<T>(path: string, config?: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
17
- sitesPost<T>(path: string, data?: unknown, config?: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
18
- sitesPut<T>(path: string, data?: unknown, config?: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
19
- sitesDelete<T>(path: string, config?: AxiosRequestConfig): Promise<FlexbeResponse<T>>;
20
- }
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FlexbeClient = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const pages_client_1 = require("./pages-client");
9
- class FlexbeClient {
10
- constructor(config) {
11
- this.config = {
12
- baseUrl: config?.baseUrl || process.env.FLEXBE_API_URL || 'https://api.flexbe.com',
13
- timeout: config?.timeout || 30000,
14
- apiKey: config?.apiKey || process.env.FLEXBE_API_KEY || '',
15
- siteId: config?.siteId || process.env.FLEXBE_SITE_ID,
16
- };
17
- if (!this.config.apiKey) {
18
- throw new Error('API key is required. Please provide it either through config or FLEXBE_API_KEY environment variable.');
19
- }
20
- this.client = axios_1.default.create({
21
- baseURL: this.config.baseUrl,
22
- timeout: this.config.timeout,
23
- headers: {
24
- 'Authorization': `Bearer ${this.config.apiKey}`,
25
- 'Content-Type': 'application/json',
26
- },
27
- });
28
- this.setupInterceptors();
29
- this.pages = new pages_client_1.PagesClient(this);
30
- }
31
- setupInterceptors() {
32
- this.client.interceptors.response.use((response) => response, (error) => {
33
- const flexbeError = {
34
- message: error.response?.data?.message || error.message,
35
- code: error.response?.data?.code,
36
- status: error.response?.status,
37
- details: error.response?.data?.details,
38
- };
39
- return Promise.reject(flexbeError);
40
- });
41
- }
42
- async request(config) {
43
- try {
44
- const response = await this.client.request(config);
45
- return {
46
- data: response.data,
47
- status: response.status,
48
- statusText: response.statusText,
49
- };
50
- }
51
- catch (error) {
52
- throw error;
53
- }
54
- }
55
- get(url, config) {
56
- return this.request({ ...config, method: 'GET', url });
57
- }
58
- post(url, data, config) {
59
- return this.request({ ...config, method: 'POST', url, data });
60
- }
61
- put(url, data, config) {
62
- return this.request({ ...config, method: 'PUT', url, data });
63
- }
64
- delete(url, config) {
65
- return this.request({ ...config, method: 'DELETE', url });
66
- }
67
- getSiteUrl(path) {
68
- if (!this.config.siteId) {
69
- return path;
70
- }
71
- return `/sites/${this.config.siteId}${path}`;
72
- }
73
- sitesGet(path, config) {
74
- return this.get(this.getSiteUrl(path), config);
75
- }
76
- sitesPost(path, data, config) {
77
- return this.post(this.getSiteUrl(path), data, config);
78
- }
79
- sitesPut(path, data, config) {
80
- return this.put(this.getSiteUrl(path), data, config);
81
- }
82
- sitesDelete(path, config) {
83
- return this.delete(this.getSiteUrl(path), config);
84
- }
85
- }
86
- exports.FlexbeClient = FlexbeClient;
@@ -1,14 +0,0 @@
1
- import { Page, GetPagesParams, PageListResponse } from '../types/pages';
2
- import { FlexbeClient } from './flexbe-client';
3
- export declare class PagesClient {
4
- private readonly client;
5
- constructor(client: FlexbeClient);
6
- /**
7
- * Get list of pages for a site
8
- */
9
- getPages(params?: GetPagesParams): Promise<PageListResponse>;
10
- /**
11
- * Get a single page by ID
12
- */
13
- getPage(pageId: number): Promise<Page>;
14
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PagesClient = void 0;
4
- class PagesClient {
5
- constructor(client) {
6
- this.client = client;
7
- }
8
- /**
9
- * Get list of pages for a site
10
- */
11
- async getPages(params) {
12
- const response = await this.client.sitesGet('/pages', { params });
13
- return response.data;
14
- }
15
- /**
16
- * Get a single page by ID
17
- */
18
- async getPage(pageId) {
19
- const response = await this.client.sitesGet(`/pages/${pageId}`);
20
- return response.data;
21
- }
22
- }
23
- exports.PagesClient = PagesClient;
@@ -1,4 +0,0 @@
1
- export * from './client/flexbe-client';
2
- export * from './client/pages-client';
3
- export * from './types';
4
- export * from './types/pages';
package/dist/src/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./client/flexbe-client"), exports);
18
- __exportStar(require("./client/pages-client"), exports);
19
- __exportStar(require("./types"), exports);
20
- __exportStar(require("./types/pages"), exports);