@webflow/designer-extension-typings 2.0.2 → 2.0.5

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/api.d.ts CHANGED
@@ -68,6 +68,18 @@ interface WebflowApi {
68
68
  * ```
69
69
  */
70
70
  getMediaQuery(): Promise<BreakpointId>;
71
+
72
+ /**
73
+ * Get the current pseudo mode.
74
+ * @returns A Promise that resolves to a PseudoStateKey which is a string representing the current pseudo mode.
75
+ * @example
76
+ * ```ts
77
+ * const pseudoMode = await webflow.getPseudoMode();
78
+ * console.log('Current Pseudo Mode:', pseudoMode);
79
+ * ```
80
+ */
81
+ getPseudoMode(): Promise<null | PseudoStateKey>;
82
+
71
83
  /**
72
84
  * Create a component by promoting a Root Element.
73
85
  * @param name - The name of the component.
@@ -312,10 +324,11 @@ interface WebflowApi {
312
324
  * webflow.notify({ type: 'Info', message: 'Great work!' }); // General notification
313
325
  * webflow.notify({ type: 'Error', message: 'Something went wrong, try again!' }); // Error notification
314
326
  * webflow.notify({ type: 'Success', message: 'Successfully did something!' }); // Success notification
327
+ * webflow.notify({ type: 'Warning', message: 'Something is not right, please check again!' }); // Warning notification
315
328
  * ```
316
329
  */
317
330
  notify(opts: {
318
- type: 'Error' | 'Info' | 'Success';
331
+ type: 'Error' | 'Info' | 'Success' | 'Warning';
319
332
  message: string;
320
333
  }): Promise<void>;
321
334
  /**
@@ -411,6 +424,11 @@ interface WebflowApi {
411
424
 
412
425
  subscribe(event: 'currentappmode', callback: () => void): Unsubscribe;
413
426
 
427
+ subscribe(
428
+ event: 'pseudomode',
429
+ callback: (pseudoMode: null | PseudoStateKey) => void
430
+ ): Unsubscribe;
431
+
414
432
  getIdToken(): Promise<string>;
415
433
  getAppSubscriptions(): Promise<Array<AppSubscription>>;
416
434
  elementPresets: ElementPresets;
@@ -452,6 +470,33 @@ interface WebflowApi {
452
470
  */
453
471
  getAllAssets(): Promise<Array<Asset>>;
454
472
 
473
+ /**
474
+ * Gets all asset folders for the site
475
+ * @example
476
+ * ```ts
477
+ * const assetFolders = await webflow.getAssetFolders();
478
+ * console.log('Asset folders:', assetFolders);
479
+ * ```
480
+ * @returns A Promise that resolves to an array of AssetFolder objects
481
+ */
482
+ getAllAssetFolders(): Promise<Array<AssetFolder>>;
483
+
484
+ /**
485
+ * Creates a new asset folder within a given site
486
+ * @param name - The name of the new asset folder.
487
+ * @param parentFolderId - Optional. The ID of the parent folder. If not provided, the folder will be created at the root level.
488
+ * @returns A Promise that resolves to the newly created AssetFolder object.
489
+ * @example
490
+ * ```ts
491
+ * const newFolder = await webflow.createAssetFolder('My New Folder');
492
+ * console.log('New folder created:', newFolder.id);
493
+ * ```
494
+ */
495
+ createAssetFolder(
496
+ name: string,
497
+ parentFolderId?: string
498
+ ): Promise<AssetFolder>;
499
+
455
500
  /**
456
501
  * Checks if the user has the ability to perform the given App Mode
457
502
  * @param appModes
@@ -466,6 +511,14 @@ interface WebflowApi {
466
511
  */
467
512
  appModes: {[key in AppMode]: AppMode};
468
513
 
514
+ /**
515
+ * Closes the extension
516
+ * ```ts
517
+ * await webflow.closeExtension();
518
+ * ```
519
+ */
520
+ closeExtension(): Promise<null>;
521
+
469
522
  /**
470
523
  * Gets the current App connection
471
524
  * ```ts
@@ -481,6 +534,14 @@ interface WebflowApi {
481
534
  * ```
482
535
  */
483
536
  getCurrentAppConnectionResource(): Promise<null | AppConnectionResource>;
537
+
538
+ /**
539
+ * Gets the current App launch context (i.e how the app was launched)
540
+ * ```ts
541
+ * const launchContext = await webflow.getLaunchContext();
542
+ * ```
543
+ */
544
+ getLaunchContext(): Promise<null | LaunchContext>;
484
545
  }
485
546
 
486
547
  type Unsubscribe = () => void;
@@ -2,3 +2,8 @@ type AppConnectionResource = {
2
2
  type: 'Element';
3
3
  value: AnyElement;
4
4
  };
5
+
6
+ type LaunchContext = {
7
+ type: 'AppConnection' | 'AppIntent' | 'DeepLink';
8
+ value: null | string | {[key in 'form' | 'image']?: 'create' | 'manage'};
9
+ };
package/assets.d.ts CHANGED
@@ -48,6 +48,35 @@ interface Asset {
48
48
  * ```
49
49
  */
50
50
  getMimeType(): Promise<string>;
51
+
52
+ /**
53
+ * Set the parent folder of the asset.
54
+ * @example
55
+ * ```ts
56
+ * const asset = await webflow.getAssetById('123');
57
+ * const folder = await webflow.createAssetFolder('New Folder');
58
+ * await asset.setParent(folder);
59
+ * ```
60
+ */
61
+ setParent(assetFolder: AssetFolder): Promise<null>;
62
+
63
+ /**
64
+ * Get the parent folder of the asset.
65
+ * @example
66
+ * ```ts
67
+ * const asset = await webflow.getAssetById('123');
68
+ * const parentFolder = await asset.getParent();
69
+ * ```
70
+ */
71
+ getParent(): Promise<AssetFolder | null>;
51
72
  }
52
73
 
53
74
  type AssetId = string;
75
+
76
+ type AssetFolder = {
77
+ readonly id: AssetFolderId;
78
+
79
+ getName(): Promise<string>;
80
+ };
81
+
82
+ type AssetFolderId = string;
@@ -103,14 +103,6 @@ type ElementPresets = {
103
103
  LayoutFooterDark: ElementPreset<SectionElement>;
104
104
  LayoutFooterLight: ElementPreset<SectionElement>;
105
105
  LayoutFooterSubscribe: ElementPreset<SectionElement>;
106
- StructureLayoutQuickStack1x1: ElementPreset<SectionElement>;
107
- StructureLayoutQuickStack2x1: ElementPreset<SectionElement>;
108
- StructureLayoutQuickStack3x1: ElementPreset<SectionElement>;
109
- StructureLayoutQuickStack4x1: ElementPreset<SectionElement>;
110
- StructureLayoutQuickStack2x2: ElementPreset<SectionElement>;
111
- StructureLayoutQuickStack2plus1: ElementPreset<SectionElement>;
112
- StructureLayoutQuickStack1plus2: ElementPreset<SectionElement>;
113
- StructureLayoutQuickStackMasonry: ElementPreset<SectionElement>;
114
106
  UserAccountSubscriptionList: ElementPreset<UserAccountSubscriptionListWrapperElement>;
115
107
  UserLogOutLogIn: ElementPreset<UserLogOutLogInElement>;
116
108
  SignUp: ElementPreset<UserSignUpFormWrapperElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/designer-extension-typings",
3
- "version": "2.0.2",
3
+ "version": "2.0.5",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Typings for the Webflow Designer Extension API",
6
6
  "main": "",
@@ -562,3 +562,21 @@ type StyleProperty =
562
562
  | '-webkit-text-fill-color'
563
563
  | '-webkit-text-stroke-color'
564
564
  | '-webkit-text-stroke-width';
565
+
566
+ type PseudoStateKey =
567
+ | 'noPseudo'
568
+ | 'nth-child(odd)'
569
+ | 'nth-child(even)'
570
+ | 'first-child'
571
+ | 'last-child'
572
+ | 'hover'
573
+ | 'active'
574
+ | 'pressed'
575
+ | 'visited'
576
+ | 'focus'
577
+ | 'focus-visible'
578
+ | 'focus-within'
579
+ | 'placeholder'
580
+ | 'empty'
581
+ | 'before'
582
+ | 'after';
package/styles.d.ts CHANGED
@@ -100,21 +100,3 @@ type BreakpointId =
100
100
  | 'medium'
101
101
  | 'small'
102
102
  | 'tiny';
103
-
104
- type PseudoStateKey =
105
- | 'noPseudo'
106
- | 'nth-child(odd)'
107
- | 'nth-child(even)'
108
- | 'first-child'
109
- | 'last-child'
110
- | 'hover'
111
- | 'active'
112
- | 'pressed'
113
- | 'visited'
114
- | 'focus'
115
- | 'focus-visible'
116
- | 'focus-within'
117
- | 'placeholder'
118
- | 'empty'
119
- | 'before'
120
- | 'after';