@flexbe/sdk 0.2.44 → 0.2.46

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.
@@ -243,42 +243,6 @@ export class Pages {
243
243
  return response.data;
244
244
  });
245
245
  }
246
- /**
247
- * @deprecated This method is deprecated and will be removed in a future release. Use the new page version API instead.
248
- * Get page content
249
- * @param pageId - ID of the page to get content for
250
- * @returns The page content
251
- * @throws {UnauthorizedException} When the API key is invalid or expired
252
- * @throws {NotFoundException} When the page is not found
253
- * @throws {ForbiddenException} When the page does not belong to the site
254
- * @throws {ServerException} When the server encounters an error
255
- * @throws {TimeoutException} When the request times out
256
- */
257
- getPageContent(pageId) {
258
- return __awaiter(this, void 0, void 0, function* () {
259
- const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/content`);
260
- return response.data;
261
- });
262
- }
263
- /**
264
- * @deprecated This method is deprecated and will be removed in a future release. Use the new page version API instead.
265
- * Update page content
266
- * @param pageId - ID of the page to update content for
267
- * @param content - The new page content (excluding versionId and versionTime)
268
- * @returns The updated page content
269
- * @throws {UnauthorizedException} When the API key is invalid or expired
270
- * @throws {NotFoundException} When the page is not found
271
- * @throws {ForbiddenException} When the page does not belong to the site
272
- * @throws {BadRequestException} When the update parameters are invalid
273
- * @throws {ServerException} When the server encounters an error
274
- * @throws {TimeoutException} When the request times out
275
- */
276
- updatePageContent(pageId, content) {
277
- return __awaiter(this, void 0, void 0, function* () {
278
- const response = yield this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
279
- return response.data;
280
- });
281
- }
282
246
  /**
283
247
  * Get list of page versions
284
248
  * @param pageId - ID of the page to get versions for
@@ -218,38 +218,6 @@ class Pages {
218
218
  });
219
219
  return response.data;
220
220
  }
221
- /**
222
- * @deprecated This method is deprecated and will be removed in a future release. Use the new page version API instead.
223
- * Get page content
224
- * @param pageId - ID of the page to get content for
225
- * @returns The page content
226
- * @throws {UnauthorizedException} When the API key is invalid or expired
227
- * @throws {NotFoundException} When the page is not found
228
- * @throws {ForbiddenException} When the page does not belong to the site
229
- * @throws {ServerException} When the server encounters an error
230
- * @throws {TimeoutException} When the request times out
231
- */
232
- async getPageContent(pageId) {
233
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/content`);
234
- return response.data;
235
- }
236
- /**
237
- * @deprecated This method is deprecated and will be removed in a future release. Use the new page version API instead.
238
- * Update page content
239
- * @param pageId - ID of the page to update content for
240
- * @param content - The new page content (excluding versionId and versionTime)
241
- * @returns The updated page content
242
- * @throws {UnauthorizedException} When the API key is invalid or expired
243
- * @throws {NotFoundException} When the page is not found
244
- * @throws {ForbiddenException} When the page does not belong to the site
245
- * @throws {BadRequestException} When the update parameters are invalid
246
- * @throws {ServerException} When the server encounters an error
247
- * @throws {TimeoutException} When the request times out
248
- */
249
- async updatePageContent(pageId, content) {
250
- const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
251
- return response.data;
252
- }
253
221
  /**
254
222
  * Get list of page versions
255
223
  * @param pageId - ID of the page to get versions for
@@ -215,38 +215,6 @@ export class Pages {
215
215
  });
216
216
  return response.data;
217
217
  }
218
- /**
219
- * @deprecated This method is deprecated and will be removed in a future release. Use the new page version API instead.
220
- * Get page content
221
- * @param pageId - ID of the page to get content for
222
- * @returns The page content
223
- * @throws {UnauthorizedException} When the API key is invalid or expired
224
- * @throws {NotFoundException} When the page is not found
225
- * @throws {ForbiddenException} When the page does not belong to the site
226
- * @throws {ServerException} When the server encounters an error
227
- * @throws {TimeoutException} When the request times out
228
- */
229
- async getPageContent(pageId) {
230
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/content`);
231
- return response.data;
232
- }
233
- /**
234
- * @deprecated This method is deprecated and will be removed in a future release. Use the new page version API instead.
235
- * Update page content
236
- * @param pageId - ID of the page to update content for
237
- * @param content - The new page content (excluding versionId and versionTime)
238
- * @returns The updated page content
239
- * @throws {UnauthorizedException} When the API key is invalid or expired
240
- * @throws {NotFoundException} When the page is not found
241
- * @throws {ForbiddenException} When the page does not belong to the site
242
- * @throws {BadRequestException} When the update parameters are invalid
243
- * @throws {ServerException} When the server encounters an error
244
- * @throws {TimeoutException} When the request times out
245
- */
246
- async updatePageContent(pageId, content) {
247
- const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
248
- return response.data;
249
- }
250
218
  /**
251
219
  * Get list of page versions
252
220
  * @param pageId - ID of the page to get versions for
@@ -1,5 +1,5 @@
1
1
  import { ApiClient } from './api-client';
2
- import { BulkDeleteResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkUpdatePageItem, BulkUpdateResponse, CreateFolderParams, CreatePageVersionParams, GetPagesParams, Page, PageContent, PageFolder, PageFolderListResponse, PageListResponse, PageVersionDataResponse, PageVersionListResponse, UpdateFolderParams, UpdatePageContentParams, UpdatePageParams } from '../types/pages';
2
+ import { BulkDeleteResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkUpdatePageItem, BulkUpdateResponse, CreateFolderParams, CreatePageVersionParams, GetPagesParams, Page, PageFolder, PageFolderListResponse, PageListResponse, PageVersionDataResponse, PageVersionListResponse, UpdateFolderParams, UpdatePageParams } from '../types/pages';
3
3
  export declare class Pages {
4
4
  private readonly api;
5
5
  private readonly siteId;
@@ -169,32 +169,6 @@ export declare class Pages {
169
169
  * @throws {TimeoutException} When the request times out
170
170
  */
171
171
  bulkDeletePages(ids: number[]): Promise<BulkDeleteResponse>;
172
- /**
173
- * @deprecated This method is deprecated and will be removed in a future release. Use the new page version API instead.
174
- * Get page content
175
- * @param pageId - ID of the page to get content for
176
- * @returns The page content
177
- * @throws {UnauthorizedException} When the API key is invalid or expired
178
- * @throws {NotFoundException} When the page is not found
179
- * @throws {ForbiddenException} When the page does not belong to the site
180
- * @throws {ServerException} When the server encounters an error
181
- * @throws {TimeoutException} When the request times out
182
- */
183
- getPageContent(pageId: number): Promise<PageContent>;
184
- /**
185
- * @deprecated This method is deprecated and will be removed in a future release. Use the new page version API instead.
186
- * Update page content
187
- * @param pageId - ID of the page to update content for
188
- * @param content - The new page content (excluding versionId and versionTime)
189
- * @returns The updated page content
190
- * @throws {UnauthorizedException} When the API key is invalid or expired
191
- * @throws {NotFoundException} When the page is not found
192
- * @throws {ForbiddenException} When the page does not belong to the site
193
- * @throws {BadRequestException} When the update parameters are invalid
194
- * @throws {ServerException} When the server encounters an error
195
- * @throws {TimeoutException} When the request times out
196
- */
197
- updatePageContent(pageId: number, content: Partial<UpdatePageContentParams>): Promise<PageContent>;
198
172
  /**
199
173
  * Get list of page versions
200
174
  * @param pageId - ID of the page to get versions for
@@ -20,6 +20,11 @@ export interface Screenshot {
20
20
  ext: string;
21
21
  url: string | null;
22
22
  }
23
+ export interface PageSchemaMarkup {
24
+ data: unknown;
25
+ updatedAt: string | null;
26
+ genProducts?: boolean;
27
+ }
23
28
  export interface PageMeta {
24
29
  title: string | null;
25
30
  description: string | null;
@@ -28,6 +33,7 @@ export interface PageMeta {
28
33
  ogTitle: string | null;
29
34
  ogDescription: string | null;
30
35
  noindex: boolean;
36
+ schemaMarkup?: PageSchemaMarkup | null;
31
37
  }
32
38
  export declare enum PageType {
33
39
  PAGE = "page",
@@ -173,6 +179,17 @@ export interface PageBackground {
173
179
  image: ImageObj | null;
174
180
  styles: PageBackgroundStyles;
175
181
  }
182
+ export type PageContainerViewport = number | 'auto';
183
+ export interface PageContainerBreakpoint {
184
+ width: number;
185
+ gutter: number;
186
+ viewport: PageContainerViewport;
187
+ maxViewport: PageContainerViewport;
188
+ }
189
+ export interface PageContainerSettings {
190
+ desktop: PageContainerBreakpoint;
191
+ mobile: PageContainerBreakpoint;
192
+ }
176
193
  export interface PageGrid {
177
194
  color: string;
178
195
  desktop: {
@@ -212,9 +229,11 @@ export interface TextStyleProperties {
212
229
  export interface FontFamilyItem {
213
230
  id?: string;
214
231
  name: string;
215
- source: 'user' | 'google' | 'system';
232
+ source: 'user' | 'google' | 'system' | 'flexbe';
216
233
  subsets?: string[];
217
234
  variants: FontVariant[];
235
+ /** For Flexbe fonts */
236
+ cssPath?: string;
218
237
  }
219
238
  export type UploadedFont = {
220
239
  id: string;
@@ -233,6 +252,45 @@ export interface StylesDataRaw {
233
252
  siteTextStyles: TextStyleItem[];
234
253
  pageTextStyles?: TextStyleItem[];
235
254
  }
255
+ export type PageCodeImage = {
256
+ type: 'img';
257
+ id: number;
258
+ name: string;
259
+ ext: string;
260
+ average: string;
261
+ proportion: number;
262
+ };
263
+ export type PageCodeFile = {
264
+ type: 'file';
265
+ id: number;
266
+ name: string;
267
+ };
268
+ export type PageCodeModule = {
269
+ id: string;
270
+ path: string;
271
+ content: string;
272
+ };
273
+ export type PageCodeSources = {
274
+ html: string;
275
+ js: string;
276
+ css: string;
277
+ modules: PageCodeModule[];
278
+ };
279
+ export type PageCodeAsset = PageCodeImage | PageCodeFile;
280
+ export interface PageCodeMeta {
281
+ id: string;
282
+ name: string;
283
+ show_code: boolean;
284
+ is_body: boolean;
285
+ }
286
+ export type PageCode = {
287
+ html: string;
288
+ js: string;
289
+ css: string;
290
+ files: PageCodeAsset[];
291
+ sources: PageCodeSources;
292
+ };
293
+ export type PageCodeWithMeta = PageCodeMeta & PageCode;
236
294
  export declare enum PageEntityType {
237
295
  Block = "block",
238
296
  Modal = "modal",
@@ -333,46 +391,41 @@ export interface PageVersionItem {
333
391
  export interface PageVersionListResponse {
334
392
  list: PageVersionItem[];
335
393
  }
394
+ /**
395
+ * Layout `entity.data` in page version JSON.
396
+ * Known fields + arbitrary keys per `template_id`.
397
+ */
398
+ export type PageLayoutData = {
399
+ background?: PageBackground;
400
+ responsive?: 'auto' | false;
401
+ container?: PageContainerSettings;
402
+ } & Record<string, unknown>;
403
+ /**
404
+ * Page version JSON (`d_pages_versions.data`).
405
+ */
336
406
  export interface PageDataStructure {
337
- is: string;
407
+ id?: string;
408
+ is: PageEntityType.Layout;
338
409
  template_id: string;
339
410
  blocks: PageBlock[];
340
411
  modals: PageModal[];
341
412
  widgets: PageWidget[];
342
413
  abtests?: PageABTest[];
343
- codes?: string[];
414
+ codes?: PageCodeWithMeta[];
344
415
  textStyles?: TextStyleItem[];
416
+ /** Layout settings (background, responsive) */
417
+ data?: PageLayoutData;
418
+ /**
419
+ * @deprecated Moved to `data.background`
420
+ */
345
421
  background?: PageBackground;
346
- responsive?: 'auto' | boolean;
422
+ /**
423
+ * @deprecated Moved to `data.responsive`
424
+ */
425
+ responsive?: 'auto' | false | boolean;
347
426
  }
348
427
  export interface PageVersionDataResponse extends PageVersionItem {
349
428
  data: PageDataStructure;
350
429
  abtests?: PageABTest[];
351
430
  }
352
- /**
353
- * @deprecated This type is deprecated and will be removed in a future release. Use PageDataStructure or related types instead.
354
- */
355
- export interface PageContent {
356
- versionId: number;
357
- versionTime: number;
358
- blocks: PageBlock[];
359
- modals: PageModal[];
360
- elements: PageElement[];
361
- widgets: PageWidget[];
362
- codes: string[];
363
- settings: {
364
- background?: PageBackground;
365
- textStyles?: TextStyleItem[];
366
- responsive?: string | boolean;
367
- } | null;
368
- abtests: PageABTest[];
369
- assets: {
370
- images: number[];
371
- files: string[];
372
- };
373
- }
374
- /**
375
- * @deprecated This type is deprecated and will be removed in a future release. Use PageDataStructure or related types instead.
376
- */
377
- export type UpdatePageContentParams = Omit<PageContent, 'versionId' | 'versionTime'>;
378
431
  export {};
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
1
  {
2
- "name": "@flexbe/sdk",
3
- "version": "0.2.44",
4
- "description": "TypeScript SDK for Flexbe API",
5
- "main": "dist/cjs/index.js",
6
- "module": "dist/esm/index.js",
7
- "types": "dist/types/index.d.ts",
8
- "browser": "dist/browser/index.js",
9
- "exports": {
10
- ".": {
11
- "import": "./dist/esm/index.js",
12
- "require": "./dist/cjs/index.js",
13
- "types": "./dist/types/index.d.ts"
14
- }
15
- },
16
- "scripts": {
17
- "build": "bun run build:esm && bun run build:cjs && bun run build:browser",
18
- "build:esm": "tsc -p tsconfig.esm.json",
19
- "build:cjs": "tsc -p tsconfig.cjs.json",
20
- "build:browser": "tsc -p tsconfig.browser.json",
21
- "dev": "tsc -p tsconfig.esm.json --watch",
22
- "test": "dotenv -e test/.env.test jest",
23
- "lint": "eslint src --ext .ts --fix",
24
- "format": "prettier --write \"src/**/*.ts\"",
25
- "prepare": "bun run build",
26
- "prepublishOnly": "bun run lint",
27
- "version": "changeset && changeset version",
28
- "release": "changeset publish"
29
- },
30
- "keywords": [
31
- "flexbe",
32
- "sdk",
33
- "typescript",
34
- "api-client"
35
- ],
36
- "author": "Flexbe",
37
- "license": "MIT",
38
- "repository": {
39
- "type": "git",
40
- "url": "git+https://github.com/flexbe/sdk-ts.git"
41
- },
42
- "bugs": {
43
- "url": "https://github.com/flexbe/sdk-ts/issues"
44
- },
45
- "homepage": "https://github.com/flexbe/sdk-ts#readme",
46
- "devDependencies": {
47
- "@changesets/cli": "^2.29.7",
48
- "@flexbe/eslint-config": "^1.0.11",
49
- "@types/jest": "^30.0.0",
50
- "@types/node": "^24.3.1",
51
- "dotenv-cli": "^10.0.0",
52
- "eslint": "^9.35.0",
53
- "jest": "^30.1.3",
54
- "ts-jest": "^29.4.1",
55
- "typescript": "~5.9.2"
56
- },
57
- "files": [
58
- "dist",
59
- "README.md"
60
- ],
61
- "engines": {
62
- "node": ">=20.0.0"
63
- },
64
- "publishConfig": {
65
- "access": "public"
66
- },
67
- "packageManager": "bun@1.2.21"
2
+ "name": "@flexbe/sdk",
3
+ "version": "0.2.46",
4
+ "description": "TypeScript SDK for Flexbe API",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "browser": "dist/browser/index.js",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/esm/index.js",
12
+ "require": "./dist/cjs/index.js",
13
+ "types": "./dist/types/index.d.ts"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "build": "bun run build:esm && bun run build:cjs && bun run build:browser",
18
+ "build:esm": "tsc -p tsconfig.esm.json",
19
+ "build:cjs": "tsc -p tsconfig.cjs.json",
20
+ "build:browser": "tsc -p tsconfig.browser.json",
21
+ "dev": "tsc -p tsconfig.esm.json --watch",
22
+ "test": "dotenv -e test/.env.test jest",
23
+ "lint": "eslint src --ext .ts --fix",
24
+ "format": "prettier --write \"src/**/*.ts\"",
25
+ "prepare": "bun run build",
26
+ "prepublishOnly": "bun run lint",
27
+ "version": "changeset && changeset version",
28
+ "release": "changeset publish"
29
+ },
30
+ "keywords": [
31
+ "flexbe",
32
+ "sdk",
33
+ "typescript",
34
+ "api-client"
35
+ ],
36
+ "author": "Flexbe",
37
+ "license": "MIT",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/flexbe/sdk-ts.git"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/flexbe/sdk-ts/issues"
44
+ },
45
+ "homepage": "https://github.com/flexbe/sdk-ts#readme",
46
+ "devDependencies": {
47
+ "@changesets/cli": "^2.29.7",
48
+ "@flexbe/eslint-config": "^1.0.11",
49
+ "@types/jest": "^30.0.0",
50
+ "@types/node": "^24.3.1",
51
+ "dotenv-cli": "^10.0.0",
52
+ "eslint": "^9.35.0",
53
+ "jest": "^30.1.3",
54
+ "ts-jest": "^29.4.1",
55
+ "typescript": "~5.9.2"
56
+ },
57
+ "files": [
58
+ "dist",
59
+ "README.md"
60
+ ],
61
+ "engines": {
62
+ "node": ">=20.0.0"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "packageManager": "bun@1.2.21"
68
68
  }