@getdraft/plugin 1.14.0 → 1.15.0

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/src/types.ts CHANGED
@@ -2,6 +2,30 @@ export type EventHandler<T> = (data: T) => void;
2
2
 
3
3
  export type AsyncEventHandler<P, R> = (params: P) => Promise<R>;
4
4
 
5
+ export class DraftError extends Error {
6
+ public readonly code: string;
7
+
8
+ constructor(code: string, message: string) {
9
+ super(message);
10
+ this.name = 'DraftError';
11
+ this.code = code;
12
+ }
13
+ }
14
+
15
+ export type MessageData = {
16
+ source: string;
17
+ event: string;
18
+ ok?: boolean;
19
+ code?: string;
20
+ message?: string;
21
+ action?: string;
22
+ };
23
+
24
+ export interface ExportAsFileParams {
25
+ blob: Blob;
26
+ fileName: string;
27
+ }
28
+
5
29
  export interface SaveParams {
6
30
  json: TemplateJSON;
7
31
  html: string;
@@ -34,6 +58,7 @@ export interface ReadyParams extends SaveParams {
34
58
  export interface ErrorParams {
35
59
  message: string;
36
60
  code?: string;
61
+ details?: unknown;
37
62
  }
38
63
 
39
64
  export interface ExitParams extends SaveParams {}
@@ -239,6 +264,10 @@ export interface PluginConfig {
239
264
  interval: number;
240
265
  };
241
266
  token: string;
267
+ authData?: {
268
+ orgId: number;
269
+ projectId?: number;
270
+ };
242
271
  pluginId: string;
243
272
  apiUrl: string;
244
273
  disableHotkeysPassing?: boolean;
package/vite.config.ts CHANGED
@@ -9,8 +9,8 @@ export default defineConfig({
9
9
  sourcemap: true,
10
10
  lib: {
11
11
  entry: path.resolve(__dirname, 'src/index.ts'),
12
- name: 'seplugin',
13
- formats: ['es', 'cjs'],
12
+ name: 'DraftPlugin',
13
+ formats: ['es', 'cjs', 'iife'],
14
14
  fileName: (format) => `index.${format}.js`,
15
15
  },
16
16
  },