datocms-plugin-sdk 0.3.0-alpha.0 → 0.3.4
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.
- package/README.md +1 -1
- package/dist/cjs/connect.js.map +1 -1
- package/dist/cjs/guards.js.map +1 -1
- package/dist/esm/SiteApiSchema.d.ts +643 -1391
- package/dist/esm/connect.d.ts +27 -27
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/guards.js.map +1 -1
- package/dist/esm/types.d.ts +280 -260
- package/dist/types/SiteApiSchema.d.ts +643 -1391
- package/dist/types/connect.d.ts +27 -27
- package/dist/types/types.d.ts +280 -260
- package/package.json +2 -2
- package/types.json +593 -530
package/dist/types/types.d.ts
CHANGED
|
@@ -10,19 +10,15 @@ export declare type MainNavigationTab = {
|
|
|
10
10
|
pageId: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* Expresses where you want to place the tab in the top-bar. If not specified,
|
|
14
|
-
*
|
|
13
|
+
* Expresses where you want to place the tab in the top-bar. If not specified, the tab
|
|
14
|
+
* will be placed after the standard tabs provided by DatoCMS itself.
|
|
15
15
|
*/
|
|
16
|
-
placement?: [
|
|
17
|
-
'before' | 'after',
|
|
18
|
-
'content' | 'mediaArea' | 'apiExplorer' | 'settings'
|
|
19
|
-
];
|
|
16
|
+
placement?: ['before' | 'after', 'content' | 'mediaArea' | 'apiExplorer' | 'settings'];
|
|
20
17
|
/**
|
|
21
|
-
* If different plugins specify the same `placement` for their tabs, they will
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* clash with the one of another plugin! *
|
|
18
|
+
* If different plugins specify the same `placement` for their tabs, they will be
|
|
19
|
+
* displayed by ascending `rank`. If you want to specify an explicit value for `rank`,
|
|
20
|
+
* make sure to offer a way for final users to customize it inside the plugin's settings
|
|
21
|
+
* form, otherwise the hardcoded value you choose might clash with the one of another plugin! *
|
|
26
22
|
*/
|
|
27
23
|
rank?: number;
|
|
28
24
|
};
|
|
@@ -38,9 +34,8 @@ export declare type SettingsAreaSidebarItem = {
|
|
|
38
34
|
};
|
|
39
35
|
};
|
|
40
36
|
/**
|
|
41
|
-
* The sidebar in the Settings Area presents a number of pages grouped by topic.
|
|
42
|
-
*
|
|
43
|
-
* standard ones DatoCMS provides.
|
|
37
|
+
* The sidebar in the Settings Area presents a number of pages grouped by topic. This
|
|
38
|
+
* object represents a new group to be added in the sideebar to the standard ones DatoCMS provides.
|
|
44
39
|
*/
|
|
45
40
|
export declare type SettingsAreaSidebarItemGroup = {
|
|
46
41
|
/** Label to be shown. Must be unique. */
|
|
@@ -48,26 +43,24 @@ export declare type SettingsAreaSidebarItemGroup = {
|
|
|
48
43
|
/** The list of items it contains * */
|
|
49
44
|
items: SettingsAreaSidebarItem[];
|
|
50
45
|
/**
|
|
51
|
-
* Expresses where you want the group to be placed inside the sidebar. If not
|
|
52
|
-
*
|
|
53
|
-
* DatoCMS itself.
|
|
46
|
+
* Expresses where you want the group to be placed inside the sidebar. If not specified,
|
|
47
|
+
* the item will be placed after the standard items provided by DatoCMS itself.
|
|
54
48
|
*/
|
|
55
49
|
placement?: [
|
|
56
50
|
'before' | 'after',
|
|
57
51
|
('environment' | 'project' | 'permissions' | 'webhooks' | 'deployment' | 'sso' | 'auditLog' | 'usage')
|
|
58
52
|
];
|
|
59
53
|
/**
|
|
60
|
-
* If different plugins specify the same `placement` for their sections, they
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* might clash with the one of another plugin! *
|
|
54
|
+
* If different plugins specify the same `placement` for their sections, they will be
|
|
55
|
+
* displayed by ascending `rank`. If you want to specify an explicit value for `rank`,
|
|
56
|
+
* make sure to offer a way for final users to customize it inside the plugin's settings
|
|
57
|
+
* form, otherwise the hardcoded value you choose might clash with the one of another plugin! *
|
|
65
58
|
*/
|
|
66
59
|
rank?: number;
|
|
67
60
|
};
|
|
68
61
|
/**
|
|
69
|
-
* The sidebar in the Content Area presents a number of user-defined menu-items.
|
|
70
|
-
*
|
|
62
|
+
* The sidebar in the Content Area presents a number of user-defined menu-items. This
|
|
63
|
+
* object represents a new item to be added in the sidebar.
|
|
71
64
|
*/
|
|
72
65
|
export declare type ContentAreaSidebarItem = {
|
|
73
66
|
/** Label to be shown. Must be unique. */
|
|
@@ -79,44 +72,38 @@ export declare type ContentAreaSidebarItem = {
|
|
|
79
72
|
pageId: string;
|
|
80
73
|
};
|
|
81
74
|
/**
|
|
82
|
-
* Expresses where you want the item to be placed inside the sidebar. If not
|
|
83
|
-
*
|
|
84
|
-
* DatoCMS itself.
|
|
75
|
+
* Expresses where you want the item to be placed inside the sidebar. If not specified,
|
|
76
|
+
* the item will be placed after the standard items provided by DatoCMS itself.
|
|
85
77
|
*/
|
|
86
78
|
placement?: ['before' | 'after', 'menuItems' | 'settings'];
|
|
87
79
|
/**
|
|
88
|
-
* If different plugins specify the same `placement` for their panels, they
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* might clash with the one of another plugin! *
|
|
80
|
+
* If different plugins specify the same `placement` for their panels, they will be
|
|
81
|
+
* displayed by ascending `rank`. If you want to specify an explicit value for `rank`,
|
|
82
|
+
* make sure to offer a way for final users to customize it inside the plugin's settings
|
|
83
|
+
* form, otherwise the hardcoded value you choose might clash with the one of another plugin! *
|
|
93
84
|
*/
|
|
94
85
|
rank?: number;
|
|
95
86
|
};
|
|
96
87
|
export declare type FieldExtensionType = 'editor' | 'addon';
|
|
97
88
|
/**
|
|
98
|
-
* Field extensions extend the basic functionality of DatoCMS when it comes to
|
|
99
|
-
*
|
|
100
|
-
*
|
|
89
|
+
* Field extensions extend the basic functionality of DatoCMS when it comes to presenting
|
|
90
|
+
* record's fields to the final user. Depending on the extension type (`editor` or
|
|
91
|
+
* `addon`) they will be shown in different places of the interface.
|
|
101
92
|
*/
|
|
102
93
|
export declare type ManualFieldExtension = {
|
|
103
|
-
/**
|
|
104
|
-
* ID of field extension. Will be the first argument for the
|
|
105
|
-
* `renderFieldExtension` function
|
|
106
|
-
*/
|
|
94
|
+
/** ID of field extension. Will be the first argument for the `renderFieldExtension` function */
|
|
107
95
|
id: string;
|
|
108
96
|
/** Name to be shown when editing fields */
|
|
109
97
|
name: string;
|
|
110
98
|
/**
|
|
111
|
-
* Type of field extension. An `editor` extension replaces the default field
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* setup multiple field addons for every field.
|
|
99
|
+
* Type of field extension. An `editor` extension replaces the default field editor that
|
|
100
|
+
* DatoCMS provides, while an `addon` extension is placed underneath the field editor to
|
|
101
|
+
* provide additional info/behaviour. You can setup multiple field addons for every field.
|
|
115
102
|
*/
|
|
116
103
|
type: FieldExtensionType;
|
|
117
104
|
/**
|
|
118
|
-
* For `editor` extensions: moves the field to the sidebar of the record
|
|
119
|
-
*
|
|
105
|
+
* For `editor` extensions: moves the field to the sidebar of the record editing page,
|
|
106
|
+
* mimicking a sidebar panel
|
|
120
107
|
*/
|
|
121
108
|
asSidebarPanel?: boolean | {
|
|
122
109
|
startOpen: boolean;
|
|
@@ -124,9 +111,8 @@ export declare type ManualFieldExtension = {
|
|
|
124
111
|
/** The type of fields that the field extension in compatible with */
|
|
125
112
|
fieldTypes: NonNullable<PluginAttributes['field_types']>;
|
|
126
113
|
/**
|
|
127
|
-
* Whether this field extension needs some configuration options before being
|
|
128
|
-
*
|
|
129
|
-
* `renderManualFieldExtensionConfigScreen` and
|
|
114
|
+
* Whether this field extension needs some configuration options before being installed
|
|
115
|
+
* in a field or not. Will trigger the `renderManualFieldExtensionConfigScreen` and
|
|
130
116
|
* `validateManualFieldExtensionParameters` methods
|
|
131
117
|
*/
|
|
132
118
|
configurable?: boolean | {
|
|
@@ -141,32 +127,27 @@ export declare type ItemFormSidebarPanelPlacement = [
|
|
|
141
127
|
];
|
|
142
128
|
/** A sidebar panel to be shown inside the record's editing page */
|
|
143
129
|
export declare type ItemFormSidebarPanel = {
|
|
144
|
-
/**
|
|
145
|
-
* ID of the panel. Will be the first argument for the
|
|
146
|
-
* `renderItemFormSidebarPanel` function
|
|
147
|
-
*/
|
|
130
|
+
/** ID of the panel. Will be the first argument for the `renderItemFormSidebarPanel` function */
|
|
148
131
|
id: string;
|
|
149
132
|
/** Label to be shown on the collapsible sidebar panel handle */
|
|
150
133
|
label: string;
|
|
151
134
|
/**
|
|
152
|
-
* An arbitrary configuration object that will be passed as the `parameters`
|
|
153
|
-
*
|
|
135
|
+
* An arbitrary configuration object that will be passed as the `parameters` property of
|
|
136
|
+
* the second argument of the `renderItemFormSidebarPanel` function
|
|
154
137
|
*/
|
|
155
138
|
parameters?: Record<string, unknown>;
|
|
156
139
|
/** Whether the sidebar panel will start open or collapsed */
|
|
157
140
|
startOpen?: boolean;
|
|
158
141
|
/**
|
|
159
|
-
* Expresses where you want the item to be placed inside the sidebar. If not
|
|
160
|
-
*
|
|
161
|
-
* DatoCMS itself.
|
|
142
|
+
* Expresses where you want the item to be placed inside the sidebar. If not specified,
|
|
143
|
+
* the item will be placed after the standard panels provided by DatoCMS itself.
|
|
162
144
|
*/
|
|
163
145
|
placement?: ItemFormSidebarPanelPlacement;
|
|
164
146
|
/**
|
|
165
|
-
* If multiple sidebar panels specify the same `placement`, they will be
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* clash with the one of another plugin! *
|
|
147
|
+
* If multiple sidebar panels specify the same `placement`, they will be sorted by
|
|
148
|
+
* ascending `rank`. If you want to specify an explicit value for `rank`, make sure to
|
|
149
|
+
* offer a way for final users to customize it inside the plugin's settings form,
|
|
150
|
+
* otherwise the hardcoded value you choose might clash with the one of another plugin! *
|
|
170
151
|
*/
|
|
171
152
|
rank?: number;
|
|
172
153
|
/** The initial height to set for the iframe that will render the sidebar panel */
|
|
@@ -174,10 +155,7 @@ export declare type ItemFormSidebarPanel = {
|
|
|
174
155
|
};
|
|
175
156
|
/** A field editor/sidebar forced on a field */
|
|
176
157
|
export declare type EditorOverride = {
|
|
177
|
-
/**
|
|
178
|
-
* ID of field extension. Will be the first argument for the
|
|
179
|
-
* `renderFieldExtension` function
|
|
180
|
-
*/
|
|
158
|
+
/** ID of field extension. Will be the first argument for the `renderFieldExtension` function */
|
|
181
159
|
id: string;
|
|
182
160
|
/** Moves the field to the sidebar of the record editing page, mimicking a sidebar panel */
|
|
183
161
|
asSidebarPanel?: boolean | {
|
|
@@ -185,16 +163,15 @@ export declare type EditorOverride = {
|
|
|
185
163
|
placement?: ItemFormSidebarPanelPlacement;
|
|
186
164
|
};
|
|
187
165
|
/**
|
|
188
|
-
* An arbitrary configuration object that will be passed as the `parameters`
|
|
189
|
-
*
|
|
166
|
+
* An arbitrary configuration object that will be passed as the `parameters` property of
|
|
167
|
+
* the second argument of the `renderFieldExtension` function
|
|
190
168
|
*/
|
|
191
169
|
parameters?: Record<string, unknown>;
|
|
192
170
|
/**
|
|
193
|
-
* If multiple plugins override a field, the one with the highest `rank` will
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* another plugin! *
|
|
171
|
+
* If multiple plugins override a field, the one with the highest `rank` will win. If
|
|
172
|
+
* you want to specify an explicit value for `rank`, make sure to offer a way for final
|
|
173
|
+
* users to customize it inside the plugin's settings form, otherwise the hardcoded
|
|
174
|
+
* value you choose might clash with the one of another plugin! *
|
|
198
175
|
*/
|
|
199
176
|
rank?: number;
|
|
200
177
|
/** The initial height to set for the iframe that will render the field extension */
|
|
@@ -202,22 +179,18 @@ export declare type EditorOverride = {
|
|
|
202
179
|
};
|
|
203
180
|
/** A field addon extension forced on a field */
|
|
204
181
|
export declare type AddonOverride = {
|
|
205
|
-
/**
|
|
206
|
-
* ID of field extension. Will be the first argument for the
|
|
207
|
-
* `renderFieldExtension` function
|
|
208
|
-
*/
|
|
182
|
+
/** ID of field extension. Will be the first argument for the `renderFieldExtension` function */
|
|
209
183
|
id: string;
|
|
210
184
|
/**
|
|
211
|
-
* An arbitrary configuration object that will be passed as the `parameters`
|
|
212
|
-
*
|
|
185
|
+
* An arbitrary configuration object that will be passed as the `parameters` property of
|
|
186
|
+
* the second argument of the `renderFieldExtension` function
|
|
213
187
|
*/
|
|
214
188
|
parameters?: Record<string, unknown>;
|
|
215
189
|
/**
|
|
216
|
-
* If multiple addons are present for a field, they will be sorted by
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* the one of another plugin! *
|
|
190
|
+
* If multiple addons are present for a field, they will be sorted by ascending `rank`.
|
|
191
|
+
* If you want to specify an explicit value for `rank`, make sure to offer a way for
|
|
192
|
+
* final users to customize it inside the plugin's settings form, otherwise the
|
|
193
|
+
* hardcoded value you choose might clash with the one of another plugin! *
|
|
221
194
|
*/
|
|
222
195
|
rank?: number;
|
|
223
196
|
/** The initial height to set for the iframe that will render the field extension */
|
|
@@ -269,8 +242,8 @@ export declare type Modal = {
|
|
|
269
242
|
/** Width of the modal. Can be a number, or one of the predefined sizes */
|
|
270
243
|
width?: 's' | 'm' | 'l' | 'xl' | 'fullWidth' | number;
|
|
271
244
|
/**
|
|
272
|
-
* An arbitrary configuration object that will be passed as the `parameters`
|
|
273
|
-
*
|
|
245
|
+
* An arbitrary configuration object that will be passed as the `parameters` property of
|
|
246
|
+
* the second argument of the `renderModal` function
|
|
274
247
|
*/
|
|
275
248
|
parameters?: Record<string, unknown>;
|
|
276
249
|
/** The initial height to set for the iframe that will render the modal content */
|
|
@@ -286,17 +259,14 @@ export declare type Toast<CtaValue = unknown> = {
|
|
|
286
259
|
cta?: {
|
|
287
260
|
/** Label for the button */
|
|
288
261
|
label: string;
|
|
289
|
-
/**
|
|
290
|
-
* The value to be returned by the `customToast` promise if the button is
|
|
291
|
-
* clicked by the user
|
|
292
|
-
*/
|
|
262
|
+
/** The value to be returned by the `customToast` promise if the button is clicked by the user */
|
|
293
263
|
value: CtaValue;
|
|
294
264
|
};
|
|
295
265
|
/** Whether the toast is to be automatically closed if the user changes page */
|
|
296
266
|
dismissOnPageChange?: boolean;
|
|
297
267
|
/**
|
|
298
|
-
* Whether the toast is to be automatically closed after some time (`true`
|
|
299
|
-
*
|
|
268
|
+
* Whether the toast is to be automatically closed after some time (`true` will use the
|
|
269
|
+
* default DatoCMS time interval)
|
|
300
270
|
*/
|
|
301
271
|
dismissAfterTimeout?: boolean | number;
|
|
302
272
|
};
|
|
@@ -304,10 +274,7 @@ export declare type Toast<CtaValue = unknown> = {
|
|
|
304
274
|
export declare type ConfirmChoice = {
|
|
305
275
|
/** The label to be shown for the choice */
|
|
306
276
|
label: string;
|
|
307
|
-
/**
|
|
308
|
-
* The value to be returned by the `openConfirm` promise if the button is
|
|
309
|
-
* clicked by the user
|
|
310
|
-
*/
|
|
277
|
+
/** The value to be returned by the `openConfirm` promise if the button is clicked by the user */
|
|
311
278
|
value: unknown;
|
|
312
279
|
/** The intent of the button. Will present the button in a different color accent. */
|
|
313
280
|
intent?: 'positive' | 'negative';
|
|
@@ -332,23 +299,20 @@ export declare type CommonProperties = {
|
|
|
332
299
|
/** All the models of the current DatoCMS project, indexed by ID */
|
|
333
300
|
itemTypes: Partial<Record<string, ModelBlock>>;
|
|
334
301
|
/**
|
|
335
|
-
* The current DatoCMS user. It can either be the owner or one of the
|
|
336
|
-
*
|
|
302
|
+
* The current DatoCMS user. It can either be the owner or one of the collaborators
|
|
303
|
+
* (regular or SSO).
|
|
337
304
|
*/
|
|
338
305
|
currentUser: User | SsoUser | Account;
|
|
339
306
|
/** The role for the current DatoCMS user */
|
|
340
307
|
currentRole: Role;
|
|
341
308
|
/**
|
|
342
|
-
* The access token to perform API calls on behalf of the current user. Only
|
|
343
|
-
*
|
|
309
|
+
* The access token to perform API calls on behalf of the current user. Only available
|
|
310
|
+
* if `currentAccessToken` permission is granted
|
|
344
311
|
*/
|
|
345
312
|
currentAccessToken: string | undefined;
|
|
346
313
|
/** The current plugin */
|
|
347
314
|
plugin: Plugin;
|
|
348
|
-
/**
|
|
349
|
-
* UI preferences of the current user (right now, only the preferred locale is
|
|
350
|
-
* available)
|
|
351
|
-
*/
|
|
315
|
+
/** UI preferences of the current user (right now, only the preferred locale is available) */
|
|
352
316
|
ui: {
|
|
353
317
|
/** Preferred locale */
|
|
354
318
|
locale: string;
|
|
@@ -365,25 +329,24 @@ export declare type InitPropertiesAndMethods = InitMethods & InitProperties;
|
|
|
365
329
|
/** Additional properties available in all `renderXXX` hooks */
|
|
366
330
|
export declare type RenderAdditionalProperties = {
|
|
367
331
|
/**
|
|
368
|
-
* All the fields currently loaded for the current DatoCMS project, indexed by
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* to load them.
|
|
332
|
+
* All the fields currently loaded for the current DatoCMS project, indexed by ID. It
|
|
333
|
+
* will always contain the current model fields and all the fields of the blocks it
|
|
334
|
+
* might contain via Modular Content/Structured Text fields. If some fields you need are
|
|
335
|
+
* not present, use the `loadItemTypeFields` function to load them.
|
|
373
336
|
*/
|
|
374
337
|
fields: Partial<Record<string, Field>>;
|
|
375
338
|
/** An object containing the theme colors for the current DatoCMS project */
|
|
376
339
|
theme: Theme;
|
|
377
340
|
/**
|
|
378
|
-
* All the regular users currently loaded for the current DatoCMS project,
|
|
379
|
-
*
|
|
380
|
-
*
|
|
341
|
+
* All the regular users currently loaded for the current DatoCMS project, indexed by
|
|
342
|
+
* ID. It will always contain the current user. If some users you need are not present,
|
|
343
|
+
* use the `loadUsers` function to load them.
|
|
381
344
|
*/
|
|
382
345
|
users: Partial<Record<string, User>>;
|
|
383
346
|
/**
|
|
384
|
-
* All the SSO users currently loaded for the current DatoCMS project, indexed
|
|
385
|
-
*
|
|
386
|
-
*
|
|
347
|
+
* All the SSO users currently loaded for the current DatoCMS project, indexed by ID. It
|
|
348
|
+
* will always contain the current user. If some users you need are not present, use the
|
|
349
|
+
* `loadSsoUsers` function to load them.
|
|
387
350
|
*/
|
|
388
351
|
ssoUsers: Partial<Record<string, SsoUser>>;
|
|
389
352
|
/** The project owner */
|
|
@@ -397,7 +360,7 @@ export declare type FieldAppearanceChange = {
|
|
|
397
360
|
} | {
|
|
398
361
|
operation: 'updateEditor';
|
|
399
362
|
newFieldExtensionId?: string;
|
|
400
|
-
|
|
363
|
+
newParameters?: Record<string, unknown>;
|
|
401
364
|
} | {
|
|
402
365
|
operation: 'setEditor';
|
|
403
366
|
fieldExtensionId: string;
|
|
@@ -416,117 +379,147 @@ export declare type FieldAppearanceChange = {
|
|
|
416
379
|
fieldExtensionId: string;
|
|
417
380
|
parameters: Record<string, unknown>;
|
|
418
381
|
};
|
|
382
|
+
/**
|
|
383
|
+
* These methods can be used to update both plugin parameters and manual field extensions
|
|
384
|
+
* configuration.
|
|
385
|
+
*/
|
|
419
386
|
export declare type UpdateParametersMethods = {
|
|
420
387
|
/**
|
|
421
388
|
* Updates the plugin parameters.
|
|
422
389
|
*
|
|
423
|
-
* Always check `ctx.currentRole.meta.final_permissions.can_edit_schema`
|
|
424
|
-
*
|
|
425
|
-
* the operation.
|
|
390
|
+
* Always check `ctx.currentRole.meta.final_permissions.can_edit_schema` before calling
|
|
391
|
+
* this, as the user might not have the permission to perform the operation.
|
|
426
392
|
*
|
|
427
393
|
* @example
|
|
428
|
-
* ctx.updatePluginParameters({ debugMode: true });
|
|
394
|
+
* await ctx.updatePluginParameters({ debugMode: true });
|
|
395
|
+
* await ctx.notice('Plugin parameters successfully updated!');
|
|
429
396
|
*/
|
|
430
397
|
updatePluginParameters: (params: Record<string, unknown>) => Promise<void>;
|
|
431
398
|
/**
|
|
432
|
-
* Performs changes in the appearance of a field. You can install/remove a
|
|
433
|
-
*
|
|
434
|
-
*
|
|
399
|
+
* Performs changes in the appearance of a field. You can install/remove a manual field
|
|
400
|
+
* extension, or tweak their parameters. If multiple changes are passed, they will be
|
|
401
|
+
* applied sequencially.
|
|
435
402
|
*
|
|
436
|
-
* Always check `ctx.currentRole.meta.final_permissions.can_edit_schema`
|
|
437
|
-
*
|
|
438
|
-
* the operation.
|
|
403
|
+
* Always check `ctx.currentRole.meta.final_permissions.can_edit_schema` before calling
|
|
404
|
+
* this, as the user might not have the permission to perform the operation.
|
|
439
405
|
*
|
|
440
406
|
* @example
|
|
441
|
-
* const
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
407
|
+
* const fields = await ctx.loadFieldsUsingPlugin();
|
|
408
|
+
*
|
|
409
|
+
* if (fields.length === 0) {
|
|
410
|
+
* ctx.alert('No field is using this plugin as a manual extension!');
|
|
411
|
+
* return;
|
|
412
|
+
* }
|
|
413
|
+
*
|
|
414
|
+
* for (const field of fields) {
|
|
415
|
+
* const { appearance } = field.attributes;
|
|
416
|
+
* const operations = [];
|
|
417
|
+
*
|
|
418
|
+
* if (appearance.editor === ctx.plugin.id) {
|
|
419
|
+
* operations.push({
|
|
420
|
+
* operation: 'updateEditor',
|
|
421
|
+
* newParameters: {
|
|
422
|
+
* ...appearance.parameters,
|
|
423
|
+
* foo: 'bar',
|
|
424
|
+
* },
|
|
425
|
+
* });
|
|
426
|
+
* }
|
|
427
|
+
*
|
|
428
|
+
* appearance.addons.forEach((addon, i) => {
|
|
429
|
+
* if (addon.id !== ctx.plugin.id) {
|
|
430
|
+
* return;
|
|
431
|
+
* }
|
|
432
|
+
*
|
|
433
|
+
* operations.push({
|
|
434
|
+
* operation: 'updateAddon',
|
|
435
|
+
* index: i,
|
|
436
|
+
* newParameters: { ...addon.parameters, foo: 'bar' },
|
|
437
|
+
* });
|
|
438
|
+
* });
|
|
439
|
+
*
|
|
440
|
+
* await ctx.updateFieldAppearance(field.id, operations);
|
|
441
|
+
* await ctx.notice(`Successfully edited field ${field.attributes.api_key}`);
|
|
442
|
+
* }
|
|
453
443
|
*/
|
|
454
444
|
updateFieldAppearance: (fieldId: string, changes: FieldAppearanceChange[]) => Promise<void>;
|
|
455
445
|
};
|
|
456
|
-
/**
|
|
457
|
-
* These methods can be used to asyncronously load additional information your
|
|
458
|
-
* plugin needs to work
|
|
459
|
-
*/
|
|
446
|
+
/** These methods can be used to asyncronously load additional information your plugin needs to work */
|
|
460
447
|
export declare type LoadDataMethods = {
|
|
461
448
|
/**
|
|
462
|
-
* Loads all the fields for a specific model (or block). Fields will be
|
|
463
|
-
*
|
|
449
|
+
* Loads all the fields for a specific model (or block). Fields will be returned and
|
|
450
|
+
* will also be available in the the `fields` property.
|
|
464
451
|
*
|
|
465
452
|
* @example
|
|
466
|
-
* const
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
453
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
454
|
+
*
|
|
455
|
+
* const fields = await ctx.loadItemTypeFields(itemTypeId);
|
|
456
|
+
*
|
|
457
|
+
* ctx.notice(
|
|
458
|
+
* `Success! ${fields.map((field) => field.attributes.api_key).join(', ')}`,
|
|
471
459
|
* );
|
|
472
460
|
*/
|
|
473
461
|
loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
|
|
474
462
|
/**
|
|
475
|
-
* Loads all the fields in the project that are currently using the plugin for
|
|
476
|
-
*
|
|
463
|
+
* Loads all the fields in the project that are currently using the plugin for one of
|
|
464
|
+
* its manual field extensions.
|
|
477
465
|
*
|
|
478
466
|
* @example
|
|
479
|
-
* const fields = await
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
* .join(', ')}`,
|
|
467
|
+
* const fields = await ctx.loadFieldsUsingPlugin();
|
|
468
|
+
*
|
|
469
|
+
* ctx.notice(
|
|
470
|
+
* `Success! ${fields.map((field) => field.attributes.api_key).join(', ')}`,
|
|
484
471
|
* );
|
|
485
472
|
*/
|
|
486
473
|
loadFieldsUsingPlugin: () => Promise<Field[]>;
|
|
487
474
|
/**
|
|
488
|
-
* Loads all regular users. Users will be returned and will also be available
|
|
489
|
-
*
|
|
475
|
+
* Loads all regular users. Users will be returned and will also be available in the the
|
|
476
|
+
* `users` property.
|
|
490
477
|
*
|
|
491
478
|
* @example
|
|
492
|
-
* const users = await
|
|
493
|
-
*
|
|
479
|
+
* const users = await ctx.loadUsers();
|
|
480
|
+
*
|
|
481
|
+
* ctx.notice(`Success! ${users.map((user) => user.id).join(', ')}`);
|
|
494
482
|
*/
|
|
495
483
|
loadUsers: () => Promise<User[]>;
|
|
496
484
|
/**
|
|
497
|
-
* Loads all SSO users. Users will be returned and will also be available in
|
|
498
|
-
*
|
|
485
|
+
* Loads all SSO users. Users will be returned and will also be available in the the
|
|
486
|
+
* `ssoUsers` property.
|
|
499
487
|
*
|
|
500
488
|
* @example
|
|
501
|
-
* const users = await
|
|
502
|
-
*
|
|
489
|
+
* const users = await ctx.loadSsoUsers();
|
|
490
|
+
*
|
|
491
|
+
* ctx.notice(`Success! ${users.map((user) => user.id).join(', ')}`);
|
|
503
492
|
*/
|
|
504
493
|
loadSsoUsers: () => Promise<SsoUser[]>;
|
|
505
494
|
};
|
|
506
495
|
/** These methods let you open the standard DatoCMS dialogs needed to interact with records */
|
|
507
496
|
export declare type ItemDialogMethods = {
|
|
508
497
|
/**
|
|
509
|
-
* Opens a dialog for creating a new record. It returns a promise resolved
|
|
510
|
-
*
|
|
511
|
-
* without creating anything.
|
|
498
|
+
* Opens a dialog for creating a new record. It returns a promise resolved with the
|
|
499
|
+
* newly created record or `null` if the user closes the dialog without creating anything.
|
|
512
500
|
*
|
|
513
501
|
* @example
|
|
514
|
-
* const
|
|
502
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
503
|
+
*
|
|
504
|
+
* const item = await ctx.createNewItem(itemTypeId);
|
|
505
|
+
*
|
|
515
506
|
* if (item) {
|
|
516
|
-
*
|
|
507
|
+
* ctx.notice(`Success! ${item.id}`);
|
|
517
508
|
* } else {
|
|
518
|
-
*
|
|
509
|
+
* ctx.alert('Closed!');
|
|
519
510
|
* }
|
|
520
511
|
*/
|
|
521
512
|
createNewItem: (itemTypeId: string) => Promise<Item | null>;
|
|
522
513
|
/**
|
|
523
|
-
* Opens a dialog for selecting one (or multiple) record(s) from a list of
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
* choosing any record.
|
|
514
|
+
* Opens a dialog for selecting one (or multiple) record(s) from a list of existing
|
|
515
|
+
* records of type `itemTypeId`. It returns a promise resolved with the selected
|
|
516
|
+
* record(s), or `null` if the user closes the dialog without choosing any record.
|
|
527
517
|
*
|
|
528
518
|
* @example
|
|
529
|
-
* const
|
|
519
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
520
|
+
*
|
|
521
|
+
* const items = await ctx.selectItem(itemTypeId, { multiple: true });
|
|
522
|
+
*
|
|
530
523
|
* if (items) {
|
|
531
524
|
* ctx.notice(`Success! ${items.map((i) => i.id).join(', ')}`);
|
|
532
525
|
* } else {
|
|
@@ -542,17 +535,18 @@ export declare type ItemDialogMethods = {
|
|
|
542
535
|
}): Promise<Item | null>;
|
|
543
536
|
};
|
|
544
537
|
/**
|
|
545
|
-
* Opens a dialog for editing an existing record. It returns a promise
|
|
546
|
-
*
|
|
547
|
-
* without persisting any change.
|
|
538
|
+
* Opens a dialog for editing an existing record. It returns a promise resolved with the
|
|
539
|
+
* edited record, or `null` if the user closes the dialog without persisting any change.
|
|
548
540
|
*
|
|
549
541
|
* @example
|
|
550
|
-
* const
|
|
542
|
+
* const itemId = prompt('Please insert a record ID:');
|
|
543
|
+
*
|
|
544
|
+
* const item = await ctx.editItem(itemId);
|
|
551
545
|
*
|
|
552
546
|
* if (item) {
|
|
553
|
-
*
|
|
547
|
+
* ctx.notice(`Success! ${item.id}`);
|
|
554
548
|
* } else {
|
|
555
|
-
*
|
|
549
|
+
* ctx.alert('Closed!');
|
|
556
550
|
* }
|
|
557
551
|
*/
|
|
558
552
|
editItem: (itemId: string) => Promise<Item | null>;
|
|
@@ -563,25 +557,29 @@ export declare type ToastMethods = {
|
|
|
563
557
|
* Triggers an "error" toast displaying the selected message
|
|
564
558
|
*
|
|
565
559
|
* @example
|
|
566
|
-
*
|
|
560
|
+
* const message = prompt('Please insert a message:', 'This is an alert message!');
|
|
561
|
+
*
|
|
562
|
+
* await ctx.alert(message);
|
|
567
563
|
*/
|
|
568
|
-
alert: (message: string) => void
|
|
564
|
+
alert: (message: string) => Promise<void>;
|
|
569
565
|
/**
|
|
570
566
|
* Triggers a "success" toast displaying the selected message
|
|
571
567
|
*
|
|
572
568
|
* @example
|
|
573
|
-
*
|
|
569
|
+
* const message = prompt('Please insert a message:', 'This is a notice message!');
|
|
570
|
+
*
|
|
571
|
+
* await ctx.notice(message);
|
|
574
572
|
*/
|
|
575
|
-
notice: (message: string) => void
|
|
573
|
+
notice: (message: string) => Promise<void>;
|
|
576
574
|
/**
|
|
577
575
|
* Triggers a custom toast displaying the selected message (and optionally a CTA)
|
|
578
576
|
*
|
|
579
577
|
* @example
|
|
580
|
-
* const result = await
|
|
578
|
+
* const result = await ctx.customToast({
|
|
581
579
|
* type: 'warning',
|
|
582
580
|
* message: 'Just a sample warning notification!',
|
|
583
581
|
* dismissOnPageChange: true,
|
|
584
|
-
* dismissAfterTimeout:
|
|
582
|
+
* dismissAfterTimeout: 5000,
|
|
585
583
|
* cta: {
|
|
586
584
|
* label: 'Execute call-to-action',
|
|
587
585
|
* value: 'cta',
|
|
@@ -589,28 +587,25 @@ export declare type ToastMethods = {
|
|
|
589
587
|
* });
|
|
590
588
|
*
|
|
591
589
|
* if (result === 'cta') {
|
|
592
|
-
*
|
|
590
|
+
* ctx.notice(`Clicked CTA!`);
|
|
593
591
|
* }
|
|
594
592
|
*/
|
|
595
593
|
customToast: <CtaValue = unknown>(toast: Toast<CtaValue>) => Promise<CtaValue | null>;
|
|
596
594
|
};
|
|
597
|
-
/**
|
|
598
|
-
* These methods let you open the standard DatoCMS dialogs needed to interact
|
|
599
|
-
* with Media Area assets
|
|
600
|
-
*/
|
|
595
|
+
/** These methods let you open the standard DatoCMS dialogs needed to interact with Media Area assets */
|
|
601
596
|
export declare type UploadDialogMethods = {
|
|
602
597
|
/**
|
|
603
|
-
* Opens a dialog for selecting one (or multiple) existing asset(s). It
|
|
604
|
-
*
|
|
605
|
-
*
|
|
598
|
+
* Opens a dialog for selecting one (or multiple) existing asset(s). It returns a
|
|
599
|
+
* promise resolved with the selected asset(s), or `null` if the user closes the dialog
|
|
600
|
+
* without selecting any upload.
|
|
606
601
|
*
|
|
607
602
|
* @example
|
|
608
|
-
* const item = await
|
|
603
|
+
* const item = await ctx.selectUpload({ multiple: false });
|
|
609
604
|
*
|
|
610
605
|
* if (item) {
|
|
611
|
-
*
|
|
606
|
+
* ctx.notice(`Success! ${item.id}`);
|
|
612
607
|
* } else {
|
|
613
|
-
*
|
|
608
|
+
* ctx.alert('Closed!');
|
|
614
609
|
* }
|
|
615
610
|
*/
|
|
616
611
|
selectUpload: {
|
|
@@ -626,29 +621,33 @@ export declare type UploadDialogMethods = {
|
|
|
626
621
|
*
|
|
627
622
|
* - The updated asset, if the user persists some changes to the asset itself
|
|
628
623
|
* - `null`, if the user closes the dialog without persisting any change
|
|
629
|
-
* - An asset structure with an additional `deleted` property set to true, if
|
|
630
|
-
*
|
|
624
|
+
* - An asset structure with an additional `deleted` property set to true, if the user
|
|
625
|
+
* deletes the asset
|
|
631
626
|
*
|
|
632
627
|
* @example
|
|
633
|
-
* const
|
|
628
|
+
* const uploadId = prompt('Please insert an asset ID:');
|
|
629
|
+
*
|
|
630
|
+
* const item = await ctx.editUpload(uploadId);
|
|
634
631
|
*
|
|
635
632
|
* if (item) {
|
|
636
|
-
*
|
|
633
|
+
* ctx.notice(`Success! ${item.id}`);
|
|
637
634
|
* } else {
|
|
638
|
-
*
|
|
635
|
+
* ctx.alert('Closed!');
|
|
639
636
|
* }
|
|
640
637
|
*/
|
|
641
638
|
editUpload: (uploadId: string) => Promise<(Upload & {
|
|
642
639
|
deleted?: true;
|
|
643
640
|
}) | null>;
|
|
644
641
|
/**
|
|
645
|
-
* Opens a dialog for editing a "single asset" field structure. It returns a
|
|
646
|
-
*
|
|
647
|
-
*
|
|
642
|
+
* Opens a dialog for editing a "single asset" field structure. It returns a promise
|
|
643
|
+
* resolved with the updated structure, or `null` if the user closes the dialog without
|
|
644
|
+
* persisting any change.
|
|
648
645
|
*
|
|
649
646
|
* @example
|
|
650
|
-
* const
|
|
651
|
-
*
|
|
647
|
+
* const uploadId = prompt('Please insert an asset ID:');
|
|
648
|
+
*
|
|
649
|
+
* const result = await ctx.editUploadMetadata({
|
|
650
|
+
* upload_id: uploadId,
|
|
652
651
|
* alt: null,
|
|
653
652
|
* title: null,
|
|
654
653
|
* custom_data: {},
|
|
@@ -656,9 +655,9 @@ export declare type UploadDialogMethods = {
|
|
|
656
655
|
* });
|
|
657
656
|
*
|
|
658
657
|
* if (result) {
|
|
659
|
-
*
|
|
658
|
+
* ctx.notice(`Success! ${JSON.stringify(result)}`);
|
|
660
659
|
* } else {
|
|
661
|
-
*
|
|
660
|
+
* ctx.alert('Closed!');
|
|
662
661
|
* }
|
|
663
662
|
*/
|
|
664
663
|
editUploadMetadata: (
|
|
@@ -670,29 +669,30 @@ export declare type UploadDialogMethods = {
|
|
|
670
669
|
/** These methods can be used to open custom dialogs/confirmation panels */
|
|
671
670
|
export declare type CustomDialogMethods = {
|
|
672
671
|
/**
|
|
673
|
-
* Opens a custom modal. Returns a promise resolved with what the modal itself
|
|
674
|
-
*
|
|
672
|
+
* Opens a custom modal. Returns a promise resolved with what the modal itself returns
|
|
673
|
+
* calling the `resolve()` function
|
|
675
674
|
*
|
|
676
675
|
* @example
|
|
677
|
-
* const result = await
|
|
676
|
+
* const result = await ctx.openModal({
|
|
678
677
|
* id: 'regular',
|
|
679
678
|
* title: 'Custom title!',
|
|
680
679
|
* width: 'l',
|
|
681
680
|
* parameters: { foo: 'bar' },
|
|
682
681
|
* });
|
|
682
|
+
*
|
|
683
683
|
* if (result) {
|
|
684
|
-
*
|
|
684
|
+
* ctx.notice(`Success! ${JSON.stringify(result)}`);
|
|
685
685
|
* } else {
|
|
686
|
-
*
|
|
686
|
+
* ctx.alert('Closed!');
|
|
687
687
|
* }
|
|
688
688
|
*/
|
|
689
689
|
openModal: (modal: Modal) => Promise<unknown>;
|
|
690
690
|
/**
|
|
691
|
-
* Opens a UI-consistent confirmation dialog. Returns a promise resolved with
|
|
692
|
-
*
|
|
691
|
+
* Opens a UI-consistent confirmation dialog. Returns a promise resolved with the value
|
|
692
|
+
* of the choice made by the user
|
|
693
693
|
*
|
|
694
694
|
* @example
|
|
695
|
-
* const result = await
|
|
695
|
+
* const result = await ctx.openConfirm({
|
|
696
696
|
* title: 'Custom title',
|
|
697
697
|
* content:
|
|
698
698
|
* 'Lorem Ipsum is simply dummy text of the printing and typesetting industry',
|
|
@@ -713,10 +713,11 @@ export declare type CustomDialogMethods = {
|
|
|
713
713
|
* value: false,
|
|
714
714
|
* },
|
|
715
715
|
* });
|
|
716
|
+
*
|
|
716
717
|
* if (result) {
|
|
717
|
-
*
|
|
718
|
+
* ctx.notice(`Success! ${result}`);
|
|
718
719
|
* } else {
|
|
719
|
-
*
|
|
720
|
+
* ctx.alert('Cancelled!');
|
|
720
721
|
* }
|
|
721
722
|
*/
|
|
722
723
|
openConfirm: (options: ConfirmOptions) => Promise<unknown>;
|
|
@@ -727,19 +728,19 @@ export declare type NavigateMethods = {
|
|
|
727
728
|
* Moves the user to another URL internal to the backend
|
|
728
729
|
*
|
|
729
730
|
* @example
|
|
730
|
-
*
|
|
731
|
+
* await ctx.navigateTo('/');
|
|
731
732
|
*/
|
|
732
|
-
navigateTo: (path: string) => void
|
|
733
|
+
navigateTo: (path: string) => Promise<void>;
|
|
733
734
|
};
|
|
734
735
|
/** These methods can be used to set various properties of the containing iframe */
|
|
735
736
|
export declare type IframeMethods = {
|
|
736
737
|
/** Sets the height for the iframe */
|
|
737
|
-
setHeight: (number: number) => void
|
|
738
|
+
setHeight: (number: number) => Promise<void>;
|
|
738
739
|
};
|
|
739
740
|
export declare type RenderMethods = LoadDataMethods & UpdateParametersMethods & ToastMethods & CustomDialogMethods & NavigateMethods;
|
|
740
741
|
/**
|
|
741
|
-
* These information describe the current state of the form that's being shown
|
|
742
|
-
*
|
|
742
|
+
* These information describe the current state of the form that's being shown to the
|
|
743
|
+
* end-user to edit a record
|
|
743
744
|
*/
|
|
744
745
|
export declare type ItemFormAdditionalProperties = {
|
|
745
746
|
/** The currently active locale for the record */
|
|
@@ -759,44 +760,64 @@ export declare type ItemFormAdditionalProperties = {
|
|
|
759
760
|
};
|
|
760
761
|
export declare type ItemFormProperties = RenderProperties & ItemFormAdditionalProperties;
|
|
761
762
|
/**
|
|
762
|
-
* These methods can be used to interact with the form that's being shown to the
|
|
763
|
-
*
|
|
763
|
+
* These methods can be used to interact with the form that's being shown to the end-user
|
|
764
|
+
* to edit a record
|
|
764
765
|
*/
|
|
765
766
|
export declare type ItemFormAdditionalMethods = {
|
|
766
767
|
/**
|
|
767
768
|
* Hides/shows a specific field in the form
|
|
768
769
|
*
|
|
769
770
|
* @example
|
|
770
|
-
*
|
|
771
|
+
* const fieldPath = prompt(
|
|
772
|
+
* 'Please insert the path of a field in the form',
|
|
773
|
+
* ctx.fieldPath,
|
|
774
|
+
* );
|
|
775
|
+
*
|
|
776
|
+
* await ctx.toggleField(fieldPath, true);
|
|
771
777
|
*/
|
|
772
|
-
toggleField: (path: string, show: boolean) => void
|
|
778
|
+
toggleField: (path: string, show: boolean) => Promise<void>;
|
|
773
779
|
/**
|
|
774
780
|
* Disables/re-enables a specific field in the form
|
|
775
781
|
*
|
|
776
782
|
* @example
|
|
777
|
-
*
|
|
783
|
+
* const fieldPath = prompt(
|
|
784
|
+
* 'Please insert the path of a field in the form',
|
|
785
|
+
* ctx.fieldPath,
|
|
786
|
+
* );
|
|
787
|
+
*
|
|
788
|
+
* await ctx.disableField(fieldPath, true);
|
|
778
789
|
*/
|
|
779
|
-
disableField: (path: string, disable: boolean) => void
|
|
790
|
+
disableField: (path: string, disable: boolean) => Promise<void>;
|
|
780
791
|
/**
|
|
781
|
-
* Smoothly navigates to a specific field in the form. If the field is
|
|
782
|
-
*
|
|
792
|
+
* Smoothly navigates to a specific field in the form. If the field is localized it will
|
|
793
|
+
* switch language tab and then navigate to the chosen field.
|
|
783
794
|
*
|
|
784
795
|
* @example
|
|
785
|
-
*
|
|
796
|
+
* const fieldPath = prompt(
|
|
797
|
+
* 'Please insert the path of a field in the form',
|
|
798
|
+
* ctx.fieldPath,
|
|
799
|
+
* );
|
|
800
|
+
*
|
|
801
|
+
* await ctx.scrollToField(fieldPath);
|
|
786
802
|
*/
|
|
787
|
-
scrollToField: (path: string, locale?: string) => void
|
|
803
|
+
scrollToField: (path: string, locale?: string) => Promise<void>;
|
|
788
804
|
/**
|
|
789
805
|
* Changes a specific path of the `formValues` object
|
|
790
806
|
*
|
|
791
807
|
* @example
|
|
792
|
-
*
|
|
808
|
+
* const fieldPath = prompt(
|
|
809
|
+
* 'Please insert the path of a field in the form',
|
|
810
|
+
* ctx.fieldPath,
|
|
811
|
+
* );
|
|
812
|
+
*
|
|
813
|
+
* await ctx.setFieldValue(fieldPath, 'new value');
|
|
793
814
|
*/
|
|
794
|
-
setFieldValue: (path: string, value: unknown) => void
|
|
815
|
+
setFieldValue: (path: string, value: unknown) => Promise<void>;
|
|
795
816
|
/**
|
|
796
817
|
* Triggers a submit form for current record
|
|
797
818
|
*
|
|
798
819
|
* @example
|
|
799
|
-
* await
|
|
820
|
+
* await ctx.saveCurrentItem();
|
|
800
821
|
*/
|
|
801
822
|
saveCurrentItem: () => Promise<void>;
|
|
802
823
|
};
|
|
@@ -806,10 +827,7 @@ export declare type RenderSidebarPanelAdditionalProperties = {
|
|
|
806
827
|
mode: 'renderItemFormSidebarPanel';
|
|
807
828
|
/** The ID of the sidebar panel that needs to be rendered */
|
|
808
829
|
sidebarPaneId: string;
|
|
809
|
-
/**
|
|
810
|
-
* The arbitrary `parameters` of the panel declared in the
|
|
811
|
-
* `itemFormSidebarPanels` function
|
|
812
|
-
*/
|
|
830
|
+
/** The arbitrary `parameters` of the panel declared in the `itemFormSidebarPanels` function */
|
|
813
831
|
parameters: Record<string, unknown>;
|
|
814
832
|
};
|
|
815
833
|
export declare type RenderSidebarPanelProperties = ItemFormProperties & RenderSidebarPanelAdditionalProperties;
|
|
@@ -818,10 +836,7 @@ export declare type RenderSidebarPanelAdditionalMethods = {
|
|
|
818
836
|
};
|
|
819
837
|
export declare type RenderSidebarPanelMethods = ItemFormMethods & RenderSidebarPanelAdditionalMethods;
|
|
820
838
|
export declare type RenderSidebarPanePropertiesAndMethods = RenderSidebarPanelMethods & RenderSidebarPanelProperties;
|
|
821
|
-
/**
|
|
822
|
-
* Information regarding the state of a specific field where you need to render
|
|
823
|
-
* the field extension
|
|
824
|
-
*/
|
|
839
|
+
/** Information regarding the state of a specific field where you need to render the field extension */
|
|
825
840
|
export declare type RenderFieldExtensionAdditionalProperties = {
|
|
826
841
|
mode: 'renderFieldExtension';
|
|
827
842
|
/** The ID of the field extension that needs to be rendered */
|
|
@@ -837,8 +852,8 @@ export declare type RenderFieldExtensionAdditionalProperties = {
|
|
|
837
852
|
/** The field where the field extension is installed to */
|
|
838
853
|
field: Field;
|
|
839
854
|
/**
|
|
840
|
-
* If the field extension is installed in a field of a block, returns the top
|
|
841
|
-
*
|
|
855
|
+
* If the field extension is installed in a field of a block, returns the top level
|
|
856
|
+
* Modular Content/Structured Text field containing the block itself
|
|
842
857
|
*/
|
|
843
858
|
parentField: Field | undefined;
|
|
844
859
|
};
|
|
@@ -861,10 +876,18 @@ export declare type RenderModalProperties = RenderProperties & RenderModalAdditi
|
|
|
861
876
|
export declare type RenderModalAdditionalMethods = {
|
|
862
877
|
getSettings: () => Promise<RenderModalProperties>;
|
|
863
878
|
/**
|
|
864
|
-
* A function to be called by the plugin to close the modal. The `openModal`
|
|
865
|
-
*
|
|
879
|
+
* A function to be called by the plugin to close the modal. The `openModal` call will
|
|
880
|
+
* be resolved with the passed return value
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* const returnValue = prompt(
|
|
884
|
+
* 'Please specify the value to return to the caller:',
|
|
885
|
+
* 'success',
|
|
886
|
+
* );
|
|
887
|
+
*
|
|
888
|
+
* await ctx.resolve(returnValue);
|
|
866
889
|
*/
|
|
867
|
-
resolve: (returnValue: unknown) => void
|
|
890
|
+
resolve: (returnValue: unknown) => Promise<void>;
|
|
868
891
|
};
|
|
869
892
|
export declare type RenderModalMethods = RenderMethods & IframeMethods & RenderModalAdditionalMethods;
|
|
870
893
|
export declare type RenderModalPropertiesAndMethods = RenderModalMethods & RenderModalProperties;
|
|
@@ -881,8 +904,8 @@ export declare type RenderPageAdditionalMethods = {
|
|
|
881
904
|
export declare type RenderPageMethods = RenderMethods & RenderPageAdditionalMethods;
|
|
882
905
|
export declare type RenderPagePropertiesAndMethods = RenderPageMethods & RenderPageProperties;
|
|
883
906
|
/**
|
|
884
|
-
* Information regarding the specific form that you need to render to let the
|
|
885
|
-
*
|
|
907
|
+
* Information regarding the specific form that you need to render to let the end-user
|
|
908
|
+
* edit the configuration object of a field extension
|
|
886
909
|
*/
|
|
887
910
|
export declare type RenderManualFieldExtensionConfigScreenAdditionalProperties = {
|
|
888
911
|
mode: 'renderManualFieldExtensionConfigScreen';
|
|
@@ -894,23 +917,20 @@ export declare type RenderManualFieldExtensionConfigScreenAdditionalProperties =
|
|
|
894
917
|
*/
|
|
895
918
|
parameters: Record<string, unknown>;
|
|
896
919
|
/**
|
|
897
|
-
* The current validation errors for the parameters (you can set them
|
|
898
|
-
*
|
|
920
|
+
* The current validation errors for the parameters (you can set them implementing the
|
|
921
|
+
* `validateManualFieldExtensionParameters` function)
|
|
899
922
|
*/
|
|
900
923
|
errors: Record<string, unknown>;
|
|
901
924
|
};
|
|
902
925
|
export declare type RenderManualFieldExtensionConfigScreenProperties = RenderProperties & RenderManualFieldExtensionConfigScreenAdditionalProperties;
|
|
903
|
-
/**
|
|
904
|
-
* These methods can be used to update the configuration object of a specific
|
|
905
|
-
* field extension
|
|
906
|
-
*/
|
|
926
|
+
/** These methods can be used to update the configuration object of a specific field extension */
|
|
907
927
|
export declare type RenderManualFieldExtensionConfigScreenAdditionalMethods = {
|
|
908
928
|
getSettings: () => Promise<RenderManualFieldExtensionConfigScreenProperties>;
|
|
909
929
|
/**
|
|
910
930
|
* Sets a new value for the parameters
|
|
911
931
|
*
|
|
912
932
|
* @example
|
|
913
|
-
* ctx.setParameters({ color: '#ff0000' });
|
|
933
|
+
* await ctx.setParameters({ color: '#ff0000' });
|
|
914
934
|
*/
|
|
915
935
|
setParameters: (params: Record<string, unknown>) => Promise<void>;
|
|
916
936
|
};
|