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