@webflow/designer-extension-typings 2.0.29 → 2.0.31

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.
@@ -0,0 +1,150 @@
1
+ // Instance Props types
2
+
3
+ interface LinkResolvedValue {
4
+ mode:
5
+ | 'url'
6
+ | 'page'
7
+ | 'pageSection'
8
+ | 'email'
9
+ | 'phone'
10
+ | 'file'
11
+ | 'collectionPage';
12
+ to?:
13
+ | string
14
+ | {pageId: string}
15
+ | {assetId: string}
16
+ | {fullElementId: {element: string; component: string}}
17
+ | {pageSlug: string};
18
+ openInNewTab?: boolean;
19
+ emailSubject?: string;
20
+ rel?: string;
21
+ }
22
+
23
+ interface VideoResolvedValue {
24
+ src?: string;
25
+ title?: string;
26
+ }
27
+
28
+ interface RichTextResolvedValue {
29
+ innerText: string;
30
+ }
31
+
32
+ type ResolvedValue =
33
+ | string
34
+ | number
35
+ | boolean
36
+ | null
37
+ | LinkResolvedValue
38
+ | VideoResolvedValue
39
+ | RichTextResolvedValue;
40
+
41
+ interface StaticPropValue {
42
+ sourceType: 'static';
43
+ value: ResolvedValue | null;
44
+ }
45
+
46
+ type BindingPropValue =
47
+ | {
48
+ sourceType: 'prop';
49
+ propId: string;
50
+ propName: string;
51
+ propGroup: string | null;
52
+ }
53
+ | {
54
+ sourceType: 'cms';
55
+ collectionId: string;
56
+ collectionName: string;
57
+ fieldId: string;
58
+ fieldName: string;
59
+ fieldGroup: string | null;
60
+ fieldType: CmsFieldType;
61
+ }
62
+ | {
63
+ sourceType: 'locale';
64
+ fieldKey: string;
65
+ fieldName: string;
66
+ fieldType: 'string';
67
+ }
68
+ | {
69
+ sourceType: 'localeItem';
70
+ fieldKey: string;
71
+ fieldName: string;
72
+ fieldType: 'string';
73
+ }
74
+ | {
75
+ sourceType: 'page';
76
+ fieldKey: string;
77
+ fieldName: string;
78
+ }
79
+ | {sourceType: 'conditional'}
80
+ | {sourceType: 'legacy'};
81
+
82
+ type InstancePropValue = StaticPropValue | BindingPropValue;
83
+
84
+ interface InstancePropDisplay {
85
+ label: string;
86
+ group: string | null;
87
+ trueLabel?: string;
88
+ falseLabel?: string;
89
+ }
90
+
91
+ interface InstanceProp {
92
+ propId: string;
93
+ valueType: BindableValueType;
94
+ hasOverride: boolean;
95
+ value: InstancePropValue;
96
+ resolvedValue: ResolvedValue | null;
97
+ defaultValue: ResolvedValue | null;
98
+ display: InstancePropDisplay;
99
+ }
100
+
101
+ interface InstancePropSummary {
102
+ propId: string;
103
+ value: ResolvedValue | BindingPropValue | null;
104
+ hasOverride: boolean;
105
+ }
106
+
107
+ interface SearchInstancePropsOptions {
108
+ /** Filter to props that produce a specific value type (e.g., "string", "boolean") */
109
+ valueType?: BindableValueType;
110
+ }
111
+
112
+ // Set Instance Props types
113
+
114
+ interface PropBindingInput {
115
+ sourceType: 'prop';
116
+ propId: string;
117
+ }
118
+
119
+ interface CmsBindingInput {
120
+ sourceType: 'cms';
121
+ collectionId: string;
122
+ fieldId: string;
123
+ }
124
+
125
+ interface PageBindingInput {
126
+ sourceType: 'page';
127
+ fieldKey: string;
128
+ }
129
+
130
+ interface LocaleBindingInput {
131
+ sourceType: 'locale';
132
+ fieldKey: string;
133
+ }
134
+
135
+ interface LocaleItemBindingInput {
136
+ sourceType: 'localeItem';
137
+ fieldKey: string;
138
+ }
139
+
140
+ type BindingInput =
141
+ | PropBindingInput
142
+ | CmsBindingInput
143
+ | PageBindingInput
144
+ | LocaleBindingInput
145
+ | LocaleItemBindingInput;
146
+
147
+ interface SetInstancePropEntry {
148
+ propId: string;
149
+ value: ResolvedValue | BindingInput | null;
150
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/designer-extension-typings",
3
- "version": "2.0.29",
3
+ "version": "2.0.31",
4
4
  "license": "MIT",
5
5
  "description": "Typings for the Webflow Designer Extension API",
6
6
  "main": "",
package/pages.d.ts CHANGED
@@ -459,6 +459,53 @@ interface Page {
459
459
  | 'utility'
460
460
  | 'staticTemplate'
461
461
  >;
462
+ /**
463
+ * Get the branch ID of this page, if it exists on a branch.
464
+ * Returns null if the page is not on a branch.
465
+ * @returns The branch ID string, or null.
466
+ * @example
467
+ * ```ts
468
+ * const branchId = await myPage.getBranchId();
469
+ * if (branchId) {
470
+ * console.log("Page is on branch:", branchId);
471
+ * }
472
+ * ```
473
+ */
474
+ getBranchId(): Promise<string | null>;
475
+ /**
476
+ * Get the ID of this page's parent. For branch pages, this returns the ID
477
+ * of the original page that was branched — use it with `switchPage()` to
478
+ * navigate back to main. For pages inside folders, returns the folder ID.
479
+ * Returns null for root-level non-branch pages.
480
+ * @returns The parent page or folder ID, or null.
481
+ * @example
482
+ * ```ts
483
+ * // Navigate back to main from a branch
484
+ * const parentId = await myPage.getParentPageId();
485
+ * if (parentId) {
486
+ * const mainPage = await webflow.getPage(parentId);
487
+ * await webflow.switchPage(mainPage);
488
+ * }
489
+ * ```
490
+ */
491
+ getParentPageId(): Promise<string | null>;
492
+
493
+ /**
494
+ * List all branch pages that exist for this page.
495
+ * Returns an array of objects with `pageId` and `branchId` for each branch.
496
+ * Use `pageId` with `webflow.getPage()` and `webflow.switchPage()` to navigate.
497
+ * Returns an empty array if the page has no branches.
498
+ * @returns Array of branch objects with pageId and branchId.
499
+ * @example
500
+ * ```ts
501
+ * const branches = await myPage.listBranches();
502
+ * if (branches.length > 0) {
503
+ * const branchPage = await webflow.getPage(branches[0].pageId);
504
+ * await webflow.switchPage(branchPage);
505
+ * }
506
+ * ```
507
+ */
508
+ listBranches(): Promise<Array<{pageId: string; branchId: string}>>;
462
509
  }
463
510
 
464
511
  type FolderId = string;