@finsweet/webflow-apps-utils 1.0.2 → 1.0.3

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.
Files changed (226) hide show
  1. package/README.md +162 -1
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +1 -0
  4. package/dist/providers/GlobalProvider.mdx +322 -0
  5. package/dist/providers/GlobalProvider.svelte +58 -0
  6. package/dist/providers/GlobalProvider.svelte.d.ts +4 -0
  7. package/dist/providers/configuratorUtils.d.ts +37 -0
  8. package/dist/providers/configuratorUtils.js +219 -0
  9. package/dist/providers/globalContext.svelte.d.ts +18 -0
  10. package/dist/providers/globalContext.svelte.js +439 -0
  11. package/dist/providers/index.d.ts +5 -0
  12. package/dist/providers/index.js +7 -0
  13. package/dist/providers/types.d.ts +103 -0
  14. package/dist/providers/types.js +6 -0
  15. package/dist/router/README.md +2 -2
  16. package/dist/stores/index.d.ts +0 -1
  17. package/dist/stores/index.js +0 -1
  18. package/dist/types/webflow.d.ts +31 -47
  19. package/dist/ui/components/LoadingScreen.svelte +2 -1
  20. package/dist/ui/components/button/Button.svelte +1 -1
  21. package/dist/ui/components/button-group/ButtonGroup.stories.js +112 -0
  22. package/dist/ui/components/{ButtonGroup.svelte → button-group/ButtonGroup.svelte} +20 -33
  23. package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +13 -0
  24. package/dist/ui/components/button-group/index.d.ts +2 -0
  25. package/dist/ui/components/button-group/index.js +1 -0
  26. package/dist/ui/components/button-group/types.d.ts +32 -0
  27. package/dist/ui/components/checkbox/Checkbox.stories.d.ts +55 -0
  28. package/dist/ui/components/checkbox/Checkbox.stories.js +162 -0
  29. package/dist/ui/components/checkbox/Checkbox.svelte +141 -0
  30. package/dist/ui/components/checkbox/Checkbox.svelte.d.ts +4 -0
  31. package/dist/ui/components/checkbox/index.d.ts +2 -0
  32. package/dist/ui/components/checkbox/index.js +1 -0
  33. package/dist/ui/components/checkbox/types.d.ts +32 -0
  34. package/dist/ui/components/controlled-buttons/ControlledButtons.stories.d.ts +32 -0
  35. package/dist/ui/components/controlled-buttons/ControlledButtons.stories.js +152 -0
  36. package/dist/ui/components/{buttons/FooterButton.svelte → controlled-buttons/ControlledButtons.svelte} +18 -67
  37. package/dist/ui/components/controlled-buttons/ControlledButtons.svelte.d.ts +4 -0
  38. package/dist/ui/components/controlled-buttons/index.d.ts +2 -0
  39. package/dist/ui/components/controlled-buttons/index.js +1 -0
  40. package/dist/ui/components/{buttons → controlled-buttons}/types.d.ts +11 -4
  41. package/dist/ui/components/divider/Divider.stories.svelte +134 -0
  42. package/dist/ui/components/{clickable/Clickable.stories.svelte.d.ts → divider/Divider.stories.svelte.d.ts} +4 -4
  43. package/dist/ui/components/divider/Divider.svelte +30 -0
  44. package/dist/ui/components/divider/Divider.svelte.d.ts +4 -0
  45. package/dist/ui/components/divider/index.d.ts +2 -0
  46. package/dist/ui/components/divider/index.js +1 -0
  47. package/dist/ui/components/divider/types.d.ts +23 -0
  48. package/dist/ui/components/divider/types.js +1 -0
  49. package/dist/ui/components/iframe/Iframe.stories.svelte +122 -0
  50. package/dist/ui/components/{ToggleItem.svelte.d.ts → iframe/Iframe.stories.svelte.d.ts} +7 -8
  51. package/dist/ui/components/iframe/Iframe.svelte +75 -0
  52. package/dist/ui/components/iframe/Iframe.svelte.d.ts +4 -0
  53. package/dist/ui/components/iframe/index.d.ts +2 -0
  54. package/dist/ui/components/iframe/index.js +1 -0
  55. package/dist/ui/components/iframe/types.d.ts +38 -0
  56. package/dist/ui/components/iframe/types.js +1 -0
  57. package/dist/ui/components/index.d.ts +12 -39
  58. package/dist/ui/components/index.js +12 -39
  59. package/dist/ui/components/input/Input.stories.d.ts +24 -0
  60. package/dist/ui/components/input/Input.stories.js +98 -0
  61. package/dist/ui/components/input/Input.svelte +321 -80
  62. package/dist/ui/components/input/types.d.ts +27 -1
  63. package/dist/ui/components/layout/Layout.stories.svelte +3 -3
  64. package/dist/ui/components/layout/Layout.svelte +3 -5
  65. package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
  66. package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +34 -22
  67. package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
  68. package/dist/ui/components/{NoSettingsNeeded.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +3 -3
  69. package/dist/ui/components/layout/examples/index.d.ts +2 -0
  70. package/dist/ui/components/layout/examples/index.js +2 -0
  71. package/dist/ui/components/layout/index.d.ts +2 -1
  72. package/dist/ui/components/layout/index.js +2 -1
  73. package/dist/ui/components/modal/Example.svelte +320 -0
  74. package/dist/ui/components/modal/Example.svelte.d.ts +3 -0
  75. package/dist/ui/components/modal/Modal.stories.svelte +18 -0
  76. package/dist/ui/components/modal/Modal.stories.svelte.d.ts +26 -0
  77. package/dist/ui/components/modal/Modal.svelte +490 -0
  78. package/dist/ui/components/modal/Modal.svelte.d.ts +130 -0
  79. package/dist/ui/components/modal/index.d.ts +2 -0
  80. package/dist/ui/components/modal/index.js +1 -0
  81. package/dist/ui/components/modal/types.d.ts +75 -0
  82. package/dist/ui/components/modal/types.js +1 -0
  83. package/dist/ui/components/notification/Notification.stories.svelte +228 -0
  84. package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
  85. package/dist/ui/components/notification/Notification.svelte +289 -0
  86. package/dist/ui/components/notification/Notification.svelte.d.ts +67 -0
  87. package/dist/ui/components/notification/index.d.ts +2 -0
  88. package/dist/ui/components/notification/index.js +1 -0
  89. package/dist/ui/components/notification/types.d.ts +68 -0
  90. package/dist/ui/components/notification/types.js +1 -0
  91. package/dist/ui/components/section/Section.stories.svelte +263 -0
  92. package/dist/ui/components/section/Section.stories.svelte.d.ts +27 -0
  93. package/dist/ui/components/section/Section.svelte +324 -0
  94. package/dist/ui/components/section/Section.svelte.d.ts +5 -0
  95. package/dist/ui/components/section/index.d.ts +2 -0
  96. package/dist/ui/components/section/index.js +1 -0
  97. package/dist/ui/components/section/types.d.ts +106 -0
  98. package/dist/ui/components/section/types.js +1 -0
  99. package/dist/ui/components/{ImageUpload.svelte → shared/ImageUpload.svelte} +3 -3
  100. package/dist/ui/components/{SelectBodyOrDivBlock.svelte → shared/SelectBodyOrDivBlock.svelte} +1 -1
  101. package/dist/ui/components/shared/index.d.ts +2 -0
  102. package/dist/ui/components/shared/index.js +2 -0
  103. package/dist/ui/index.css +33 -5
  104. package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
  105. package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
  106. package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
  107. package/dist/utils/api/clipboard/handlePaste.js +2 -6
  108. package/dist/utils/api/getAllAssets.d.ts +1 -2
  109. package/dist/utils/api/getAllAssets.js +1 -2
  110. package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
  111. package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
  112. package/dist/utils/api/index.d.ts +0 -1
  113. package/dist/utils/api/index.js +0 -1
  114. package/dist/utils/api/insertWithXSCP.d.ts +1 -2
  115. package/dist/utils/api/insertWithXSCP.js +1 -2
  116. package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
  117. package/dist/utils/auth/crossWindowLogin.js +3 -0
  118. package/dist/utils/auth/index.d.ts +9 -25
  119. package/dist/utils/auth/index.js +9 -25
  120. package/dist/utils/browser-storage/localStorage.d.ts +4 -12
  121. package/dist/utils/browser-storage/localStorage.js +4 -12
  122. package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
  123. package/dist/utils/browser-storage/sessionStorage.js +4 -12
  124. package/dist/utils/custom-code/api.d.ts +3 -7
  125. package/dist/utils/custom-code/api.js +3 -7
  126. package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
  127. package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
  128. package/dist/utils/helpers/goto.d.ts +1 -4
  129. package/dist/utils/helpers/goto.js +2 -7
  130. package/dist/utils/helpers/index.d.ts +1 -0
  131. package/dist/utils/helpers/index.js +1 -0
  132. package/dist/utils/helpers/noop.d.ts +1 -1
  133. package/dist/utils/helpers/noop.js +1 -1
  134. package/dist/utils/helpers/numbers.d.ts +4 -14
  135. package/dist/utils/helpers/numbers.js +4 -14
  136. package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -3
  137. package/dist/utils/helpers/objectsToModuleExports.js +1 -3
  138. package/dist/utils/helpers/trimText.d.ts +1 -8
  139. package/dist/utils/helpers/trimText.js +1 -8
  140. package/dist/utils/index.d.ts +4 -0
  141. package/dist/utils/index.js +4 -0
  142. package/dist/utils/logger/index.d.ts +0 -2
  143. package/dist/utils/logger/index.js +0 -2
  144. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
  145. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
  146. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
  147. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
  148. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
  149. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
  150. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
  151. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
  152. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
  153. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
  154. package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
  155. package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
  156. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
  157. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
  158. package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
  159. package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
  160. package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
  161. package/dist/utils/webflow-canvas/getAllPages.js +3 -10
  162. package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
  163. package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
  164. package/dist/utils/webflow-canvas/index.d.ts +1 -0
  165. package/dist/utils/webflow-canvas/index.js +1 -0
  166. package/package.json +9 -2
  167. package/dist/stores/globalStore.d.ts +0 -10
  168. package/dist/stores/globalStore.js +0 -10
  169. package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
  170. package/dist/ui/components/Checkbox.svelte +0 -94
  171. package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
  172. package/dist/ui/components/Copy.svelte +0 -329
  173. package/dist/ui/components/Copy.svelte.d.ts +0 -35
  174. package/dist/ui/components/CustomModal.svelte +0 -192
  175. package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
  176. package/dist/ui/components/DisableInEditMode.svelte +0 -66
  177. package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
  178. package/dist/ui/components/Divider.svelte +0 -31
  179. package/dist/ui/components/Divider.svelte.d.ts +0 -31
  180. package/dist/ui/components/Header.svelte +0 -30
  181. package/dist/ui/components/Header.svelte.d.ts +0 -20
  182. package/dist/ui/components/Iframe.svelte +0 -89
  183. package/dist/ui/components/Iframe.svelte.d.ts +0 -40
  184. package/dist/ui/components/InjectComponent.svelte +0 -297
  185. package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
  186. package/dist/ui/components/Modal.svelte +0 -139
  187. package/dist/ui/components/Modal.svelte.d.ts +0 -42
  188. package/dist/ui/components/Navbar.svelte +0 -132
  189. package/dist/ui/components/Navbar.svelte.d.ts +0 -29
  190. package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
  191. package/dist/ui/components/Notification.svelte +0 -193
  192. package/dist/ui/components/Notification.svelte.d.ts +0 -64
  193. package/dist/ui/components/PlusMinusButton.svelte +0 -91
  194. package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
  195. package/dist/ui/components/PreviewBar.svelte +0 -40
  196. package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
  197. package/dist/ui/components/ScrollableContent.svelte +0 -18
  198. package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
  199. package/dist/ui/components/Section.svelte +0 -97
  200. package/dist/ui/components/Section.svelte.d.ts +0 -50
  201. package/dist/ui/components/Spacer.svelte +0 -9
  202. package/dist/ui/components/Spacer.svelte.d.ts +0 -22
  203. package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
  204. package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
  205. package/dist/ui/components/SpinnerUpDown.svelte +0 -194
  206. package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
  207. package/dist/ui/components/Tabs.svelte +0 -71
  208. package/dist/ui/components/Tabs.svelte.d.ts +0 -26
  209. package/dist/ui/components/ToggleItem.svelte +0 -29
  210. package/dist/ui/components/ToggleList.svelte +0 -57
  211. package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
  212. package/dist/ui/components/buttons/index.d.ts +0 -5
  213. package/dist/ui/components/buttons/index.js +0 -5
  214. package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
  215. package/dist/ui/components/clickable/Clickable.svelte +0 -93
  216. package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
  217. package/dist/ui/components/clickable/index.d.ts +0 -2
  218. package/dist/ui/components/clickable/index.js +0 -1
  219. package/dist/ui/components/clickable/types.d.ts +0 -17
  220. package/dist/utils/api/copyPaste/index.d.ts +0 -18
  221. /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
  222. /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
  223. /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
  224. /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
  225. /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
  226. /package/dist/ui/components/{SelectBodyOrDivBlock.svelte.d.ts → shared/SelectBodyOrDivBlock.svelte.d.ts} +0 -0
@@ -0,0 +1,106 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { TooltipProps } from '../tooltip/types.js';
4
+ export type BorderPosition = 'top' | 'right' | 'bottom' | 'left';
5
+ export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * Whether to hide the section completely
8
+ */
9
+ hide?: boolean;
10
+ /**
11
+ * Array of border positions to apply
12
+ */
13
+ borders?: BorderPosition[];
14
+ /**
15
+ * Whether the section is in active state
16
+ */
17
+ active?: boolean;
18
+ /**
19
+ * Whether the section should be clickable with keyboard support
20
+ */
21
+ clickable?: boolean;
22
+ /**
23
+ * Whether the section is disabled
24
+ */
25
+ disabled?: boolean;
26
+ /**
27
+ * Whether the section content should be scrollable with simplebar
28
+ */
29
+ scrollable?: boolean;
30
+ /**
31
+ * Width of the section (CSS value)
32
+ */
33
+ width?: string;
34
+ /**
35
+ * Height of the section (CSS value)
36
+ */
37
+ height?: string;
38
+ /**
39
+ * Background color of the section (CSS color value)
40
+ */
41
+ backgroundColor?: string;
42
+ /**
43
+ * Additional CSS classes to apply
44
+ */
45
+ class?: string;
46
+ /**
47
+ * Tooltip configuration
48
+ */
49
+ tooltip?: TooltipProps;
50
+ /**
51
+ * Message to show when section is disabled in edit mode
52
+ */
53
+ disabledMessage?: string;
54
+ /**
55
+ * Width of the disabled tooltip
56
+ */
57
+ disabledTooltipWidth?: string;
58
+ /**
59
+ * Content to render inside the section
60
+ */
61
+ children?: Snippet;
62
+ /**
63
+ * Click event handler
64
+ */
65
+ onclick?: (event: MouseEvent) => void;
66
+ /**
67
+ * Keydown event handler
68
+ */
69
+ onkeydown?: (event: KeyboardEvent) => void;
70
+ /**
71
+ * Mouse over event handler
72
+ */
73
+ onmouseover?: (event: MouseEvent) => void;
74
+ /**
75
+ * Mouse leave event handler
76
+ */
77
+ onmouseleave?: (event: MouseEvent) => void;
78
+ /**
79
+ * Focus event handler
80
+ */
81
+ onfocus?: (event: FocusEvent) => void;
82
+ /**
83
+ * Blur event handler
84
+ */
85
+ onblur?: (event: FocusEvent) => void;
86
+ }
87
+ export interface SectionEvents {
88
+ click: {
89
+ detail: MouseEvent;
90
+ };
91
+ keydown: {
92
+ detail: KeyboardEvent;
93
+ };
94
+ mouseover: {
95
+ detail: MouseEvent;
96
+ };
97
+ mouseleave: {
98
+ detail: MouseEvent;
99
+ };
100
+ focus: {
101
+ detail: FocusEvent;
102
+ };
103
+ blur: {
104
+ detail: FocusEvent;
105
+ };
106
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -2,9 +2,9 @@
2
2
  import { createEventDispatcher } from 'svelte';
3
3
  import { onDestroy } from 'svelte';
4
4
 
5
- import { DeleteOutlinedIcon, FileUploadIcon, RefreshIcon } from '../icons';
6
- import { Button } from './button';
7
- import { Text } from './text';
5
+ import { DeleteOutlinedIcon, FileUploadIcon, RefreshIcon } from '../../icons';
6
+ import { Button } from '../button';
7
+ import { Text } from '../text';
8
8
 
9
9
  type FileChangeEvent = {
10
10
  file: File | null;
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { BodyIcon, DivBlock, SelectIcon } from '../icons';
2
+ import { BodyIcon, DivBlock, SelectIcon } from '../../icons';
3
3
  </script>
4
4
 
5
5
  <div class="select-msg-wrap">
@@ -0,0 +1,2 @@
1
+ export { default as SelectBodyOrDivBlock } from './SelectBodyOrDivBlock.svelte';
2
+ export { default as ImageUpload } from './ImageUpload.svelte';
@@ -0,0 +1,2 @@
1
+ export { default as SelectBodyOrDivBlock } from './SelectBodyOrDivBlock.svelte';
2
+ export { default as ImageUpload } from './ImageUpload.svelte';
package/dist/ui/index.css CHANGED
@@ -11,6 +11,7 @@
11
11
  --black: #000000;
12
12
  --background2: #353535;
13
13
  --background3: #404040;
14
+ --background-background-3: #363636;
14
15
  --background4: #373737;
15
16
  --background5: #404040;
16
17
  --backgroundInactive: #292929;
@@ -266,13 +267,40 @@ label {
266
267
  opacity: 0.75 !important;
267
268
  }
268
269
 
269
- /* simplebar */
270
- .simplebar-content {
271
- position: relative;
270
+ /* OverlayScrollbars Global Theme */
271
+ :root {
272
+ /* OverlayScrollbars theme variables using design system colors */
273
+ --os-size: var(--sb-size, 6px);
274
+ --os-padding-perpendicular: 0px;
275
+ --os-padding-axis: 0px;
276
+ --os-track-bg: var(--background1);
277
+ --os-handle-bg: var(--background4);
278
+ --os-handle-bg-hover: var(--background3);
279
+ --os-handle-bg-active: var(--background2);
280
+ }
281
+
282
+ /* OverlayScrollbars global dark theme */
283
+ .os-theme-dark .os-scrollbar {
284
+ --os-size: var(--sb-size, 6px);
285
+ }
286
+
287
+ .os-theme-dark .os-scrollbar-track {
288
+ background: var(--background1);
289
+ border-radius: 4px;
290
+ }
291
+
292
+ .os-theme-dark .os-scrollbar-handle {
293
+ background: var(--background4);
294
+ border-radius: 4px;
295
+ transition: background-color 0.2s ease;
296
+ }
297
+
298
+ .os-theme-dark .os-scrollbar-handle:hover {
299
+ background: var(--background3);
272
300
  }
273
301
 
274
- .simplebar-mask {
275
- z-index: auto !important;
302
+ .os-theme-dark .os-scrollbar-handle:active {
303
+ background: var(--background2);
276
304
  }
277
305
 
278
306
  input {
@@ -1,5 +1,4 @@
1
1
  /**
2
- * Check if the app mode is design
3
- * @returns {Promise<boolean>}
2
+ * Checks if the app mode is design and shows error notification if not.
4
3
  */
5
4
  export declare const checkIfAppModeIsDesign: () => Promise<boolean>;
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Check if the app mode is design
3
- * @returns {Promise<boolean>}
2
+ * Checks if the app mode is design and shows error notification if not.
4
3
  */
5
4
  export const checkIfAppModeIsDesign = async () => {
6
5
  const capabilities = await webflow.canForAppMode([
@@ -1,46 +1,15 @@
1
- export type FsCopyPasteComponent = {
2
- meta: {
3
- droppedLinks: number;
4
- dynBindRemovedCount: number;
5
- dynListBindRemovedCount: number;
6
- paginationRemovedCount: number;
7
- universalBindingsRemovedCount: number;
8
- unlinkedSymbolCount: number;
9
- };
10
- type: string;
11
- payload: {
12
- nodes: PastedNodes[];
13
- styles: {
14
- name: string;
15
- type: string | 'class';
16
- }[];
17
- };
18
- };
19
- type PastedNodes = {
20
- children: string[];
21
- classes: string[];
22
- tag: string;
23
- type: string;
24
- data: {
25
- xattr: Attr[];
26
- };
27
- };
1
+ import type { XSCPMetadata } from '../../../types';
28
2
  /**
29
- * Process pasted component
30
- * @param component
31
- * @param strict - if true, check for exact match, else check for any child
3
+ * Processes pasted component data to validate Finsweet components.
32
4
  */
33
- export declare const processPastedComponent: (pasteData: FsCopyPasteComponent, component: string) => {
34
- data: FsCopyPasteComponent;
5
+ export declare const processPastedComponent: (pasteData: XSCPMetadata, component: string) => {
6
+ data: XSCPMetadata;
35
7
  key: string;
36
8
  } | undefined;
37
9
  /**
38
- * Handle pasting of Webflow components
39
- * @param e
40
- * @param strict - if true, check for exact match, else check for any child
10
+ * Handles pasting of Webflow components from clipboard.
41
11
  */
42
12
  export declare const handlePasteXSCP: (e: ClipboardEvent, component: string) => {
43
- data: FsCopyPasteComponent;
13
+ data: XSCPMetadata;
44
14
  key: string;
45
15
  } | undefined;
46
- export {};
@@ -1,9 +1,7 @@
1
1
  import { getLogger } from '../../logger';
2
2
  const logger = getLogger('webflow-apps-ui-utils');
3
3
  /**
4
- * Process pasted component
5
- * @param component
6
- * @param strict - if true, check for exact match, else check for any child
4
+ * Processes pasted component data to validate Finsweet components.
7
5
  */
8
6
  export const processPastedComponent = (pasteData, component) => {
9
7
  const valid = pasteData?.payload?.nodes?.some((node) => node?.data?.xattr?.some((attr) => {
@@ -20,9 +18,7 @@ export const processPastedComponent = (pasteData, component) => {
20
18
  }
21
19
  };
22
20
  /**
23
- * Handle pasting of Webflow components
24
- * @param e
25
- * @param strict - if true, check for exact match, else check for any child
21
+ * Handles pasting of Webflow components from clipboard.
26
22
  */
27
23
  export const handlePasteXSCP = (e, component) => {
28
24
  if (!e.clipboardData?.types.includes('application/json'))
@@ -6,7 +6,6 @@ export interface AllAssets {
6
6
  asset: Asset;
7
7
  }
8
8
  /**
9
- * Get all assets from the Webflow Canvas
10
- * @returns
9
+ * Gets all assets from the Webflow Canvas with their metadata.
11
10
  */
12
11
  export declare const getAllAssets: () => Promise<AllAssets[]>;
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Get all assets from the Webflow Canvas
3
- * @returns
2
+ * Gets all assets from the Webflow Canvas with their metadata.
4
3
  */
5
4
  export const getAllAssets = async () => {
6
5
  const assets = await webflow.getAllAssets();
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Get the Finsweet components environment.
3
- * @returns
2
+ * Gets the Finsweet components environment configuration.
4
3
  */
5
4
  export declare const getFinsweetComponentsEnvironment: () => {
6
5
  development: boolean;
@@ -9,9 +9,7 @@ const URL_DEV_MODE_API_KEY = 'api';
9
9
  let lastLogTime = 0;
10
10
  const LOG_THROTTLE_MS = 3000;
11
11
  /**
12
- * Gets a parameter value from the URL search params
13
- * @param key The key to search for in URL parameters
14
- * @returns The value of the parameter or null if not found
12
+ * Gets a parameter value from the URL search params.
15
13
  */
16
14
  const getUrlParam = (key) => {
17
15
  if (typeof window === 'undefined')
@@ -26,7 +24,7 @@ const getUrlParam = (key) => {
26
24
  }
27
25
  };
28
26
  /**
29
- * Simple throttled console log that only logs once within the throttle interval
27
+ * Throttled console log that only logs once within the throttle interval.
30
28
  */
31
29
  const throttledLog = (message, data) => {
32
30
  const now = Date.now();
@@ -36,8 +34,7 @@ const throttledLog = (message, data) => {
36
34
  }
37
35
  };
38
36
  /**
39
- * Get the Finsweet components environment.
40
- * @returns
37
+ * Gets the Finsweet components environment configuration.
41
38
  */
42
39
  export const getFinsweetComponentsEnvironment = () => {
43
40
  const devFromUrl = getUrlParam(URL_DEV_MODE_KEY);
@@ -1,6 +1,5 @@
1
1
  export * from './checkIfAppModeIsDesign';
2
2
  export * from './clipboard';
3
- export * from './copyPaste';
4
3
  export * from './getAllAssets';
5
4
  export * from './getFinsweetComponentsEnvironment';
6
5
  export * from './insertWithXSCP';
@@ -1,6 +1,5 @@
1
1
  export * from './checkIfAppModeIsDesign';
2
2
  export * from './clipboard';
3
- export * from './copyPaste';
4
3
  export * from './getAllAssets';
5
4
  export * from './getFinsweetComponentsEnvironment';
6
5
  export * from './insertWithXSCP';
@@ -1,5 +1,4 @@
1
1
  /**
2
- * Insert a template into the Designer Canvas using XSCP APIs
3
- * @param template - the template to insert, should be a string
2
+ * Inserts a template into the Designer Canvas using XSCP APIs.
4
3
  */
5
4
  export declare const insertWithXSCP: (template: string) => Promise<void>;
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Insert a template into the Designer Canvas using XSCP APIs
3
- * @param template - the template to insert, should be a string
2
+ * Inserts a template into the Designer Canvas using XSCP APIs.
4
3
  */
5
4
  export const insertWithXSCP = async (template) => {
6
5
  try {
@@ -1,2 +1,5 @@
1
1
  import type { FinsweetAuth } from '../../types';
2
+ /**
3
+ * Opens a popup window for cross-window authentication with Auth0.
4
+ */
2
5
  export declare const crossWindowLogin: () => Promise<FinsweetAuth>;
@@ -1,4 +1,7 @@
1
1
  import { AUTH0_AUDIENCE, AUTH0_CLIENT_ID, AUTH0_LOGIN_URL, AUTH0_REDIRECT_URL, AUTH0_SCOPE, PROD_FINSWEEET_ACCOUNTS_ORIGIN } from '../constants';
2
+ /**
3
+ * Opens a popup window for cross-window authentication with Auth0.
4
+ */
2
5
  export const crossWindowLogin = () => {
3
6
  return new Promise((resolve, reject) => {
4
7
  const timeout = setTimeout(() => {
@@ -5,55 +5,39 @@ import type { FinsweetAuth } from '../../types';
5
5
  export declare const finsweetUser: import("svelte/store").Writable<FinsweetAuth | null>;
6
6
  export declare const isLoggingIn: import("svelte/store").Writable<boolean>;
7
7
  /**
8
- * Fetches subscriptions from the server.
9
- * @param token
10
- * @returns
8
+ * Fetches user subscriptions from the server.
11
9
  */
12
10
  export declare const getSubscriptions: (token: string) => Promise<any>;
13
11
  /**
14
- * Fetches user data from the server.
15
- * @param token
16
- * @returns
12
+ * Fetches user data from the authentication server.
17
13
  */
18
14
  export declare const getUser: (token: string) => Promise<FinsweetAuth["user"]>;
19
15
  /**
20
- * Handles login
21
- * @returns void
16
+ * Handles user login authentication flow.
22
17
  */
23
18
  export declare const handleLogin: () => Promise<void>;
24
19
  /**
25
- * Handles logout
20
+ * Handles user logout and cleanup.
26
21
  */
27
22
  export declare const handleLogout: () => Promise<void>;
28
23
  /**
29
- * Checks if the user is logged in by checking the cookie for a valid token.
24
+ * Checks if the user is logged in by validating stored session.
30
25
  */
31
26
  export declare const checkInitialLoginState: () => Promise<void>;
32
27
  /**
33
- * Sets a cookie
34
- * @param {string} name - Name of the cookie
35
- * @param {string} value - Value of the cookie
36
- * @param {Object} options - Options for the cookie (expires, path, etc.)
28
+ * Sets a cookie with security options.
37
29
  */
38
30
  export declare const setCookie: (name: string, value: string, options?: {}) => void;
39
31
  /**
40
- * Gets a cookie
41
- * @param {string} name - Name of the cookie to retrieve
42
- * @returns {string | undefined} - Value of the cookie, if found
32
+ * Gets a cookie value by name.
43
33
  */
44
34
  export declare const getCookie: (name: string) => string | undefined;
45
35
  /**
46
- * Deletes a cookie
47
- * @param {string} name - Name of the cookie to delete
48
- * @param {Object} options - Options for the cookie (path, etc.)
36
+ * Deletes a cookie by name.
49
37
  */
50
38
  export declare const deleteCookie: (name: string, options?: {}) => void;
51
39
  /**
52
- * Checks if the user has access to a feature
53
- * @param loggedIn
54
- * @param access
55
- * @param required
56
- * @returns
40
+ * Checks if the user has access to a specific feature.
57
41
  */
58
42
  export declare const canAccessFeature: (loggedIn: boolean, access: FinsweetAuth["user"]["libraryAccess"] | null | undefined, required: FinsweetAuth["user"]["libraryAccess"]) => {
59
43
  granted: boolean;
@@ -34,9 +34,7 @@ const checkLibraryAccess = (user, subscriptions) => {
34
34
  return ['canFavourite'];
35
35
  };
36
36
  /**
37
- * Fetches subscriptions from the server.
38
- * @param token
39
- * @returns
37
+ * Fetches user subscriptions from the server.
40
38
  */
41
39
  export const getSubscriptions = async (token) => {
42
40
  try {
@@ -58,9 +56,7 @@ export const getSubscriptions = async (token) => {
58
56
  }
59
57
  };
60
58
  /**
61
- * Fetches user data from the server.
62
- * @param token
63
- * @returns
59
+ * Fetches user data from the authentication server.
64
60
  */
65
61
  export const getUser = async (token) => {
66
62
  const response = await fetch('/auth0/verify', {
@@ -73,8 +69,7 @@ export const getUser = async (token) => {
73
69
  return data;
74
70
  };
75
71
  /**
76
- * Handles login
77
- * @returns void
72
+ * Handles user login authentication flow.
78
73
  */
79
74
  export const handleLogin = async () => {
80
75
  if (get(isLoggingIn))
@@ -112,7 +107,7 @@ export const handleLogin = async () => {
112
107
  }
113
108
  };
114
109
  /**
115
- * Handles logout
110
+ * Handles user logout and cleanup.
116
111
  */
117
112
  export const handleLogout = async () => {
118
113
  removeLocalStorage('finsweetComponentsAuth');
@@ -124,7 +119,7 @@ export const handleLogout = async () => {
124
119
  await new Promise((resolve) => setTimeout(resolve, 1000));
125
120
  };
126
121
  /**
127
- * Checks if the user is logged in by checking the cookie for a valid token.
122
+ * Checks if the user is logged in by validating stored session.
128
123
  */
129
124
  export const checkInitialLoginState = async () => {
130
125
  const session = getLocalStorage('finsweetComponentsAuth');
@@ -150,36 +145,25 @@ export const checkInitialLoginState = async () => {
150
145
  await handleLogout();
151
146
  };
152
147
  /**
153
- * Sets a cookie
154
- * @param {string} name - Name of the cookie
155
- * @param {string} value - Value of the cookie
156
- * @param {Object} options - Options for the cookie (expires, path, etc.)
148
+ * Sets a cookie with security options.
157
149
  */
158
150
  export const setCookie = (name, value, options = {}) => {
159
151
  Cookies.set(name, value, { sameSite: 'None', secure: true, ...options });
160
152
  };
161
153
  /**
162
- * Gets a cookie
163
- * @param {string} name - Name of the cookie to retrieve
164
- * @returns {string | undefined} - Value of the cookie, if found
154
+ * Gets a cookie value by name.
165
155
  */
166
156
  export const getCookie = (name) => {
167
157
  return Cookies.get(name);
168
158
  };
169
159
  /**
170
- * Deletes a cookie
171
- * @param {string} name - Name of the cookie to delete
172
- * @param {Object} options - Options for the cookie (path, etc.)
160
+ * Deletes a cookie by name.
173
161
  */
174
162
  export const deleteCookie = (name, options = {}) => {
175
163
  Cookies.remove(name, options);
176
164
  };
177
165
  /**
178
- * Checks if the user has access to a feature
179
- * @param loggedIn
180
- * @param access
181
- * @param required
182
- * @returns
166
+ * Checks if the user has access to a specific feature.
183
167
  */
184
168
  export const canAccessFeature = (loggedIn, access, required) => {
185
169
  if (!loggedIn) {
@@ -1,24 +1,16 @@
1
1
  /**
2
- * Check if localStorage is available in the current environment.
3
- * @returns {boolean} True if localStorage is accessible, false otherwise.
2
+ * Checks if localStorage is available in the current environment.
4
3
  */
5
4
  export declare const isLocalStorageAvailable: () => boolean;
6
5
  /**
7
- * A utility function for getting a value from localStorage.
8
- * @param {string} key - The key to retrieve the value for.
9
- * @returns {string | null} The value associated with the key, or null if not found or localStorage is not available.
6
+ * Gets a value from localStorage.
10
7
  */
11
8
  export declare const getLocalStorage: (key: string) => string | null;
12
9
  /**
13
- * A utility function for setting a value in localStorage.
14
- * @param {string} key - The key to set the value for.
15
- * @param {string} value - The value to be stored.
16
- * @returns {boolean} True if the operation succeeded, false otherwise (or if localStorage is not available).
10
+ * Sets a value in localStorage.
17
11
  */
18
12
  export declare const setLocalStorage: (key: string, value: string) => boolean;
19
13
  /**
20
- * A utility function for removing a value from localStorage.
21
- * @param key - The key to remove the value for.
22
- * @returns {boolean} True if the operation succeeded, false otherwise (or if localStorage is not available).
14
+ * Removes a value from localStorage.
23
15
  */
24
16
  export declare const removeLocalStorage: (key: string) => boolean;
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Check if localStorage is available in the current environment.
3
- * @returns {boolean} True if localStorage is accessible, false otherwise.
2
+ * Checks if localStorage is available in the current environment.
4
3
  */
5
4
  export const isLocalStorageAvailable = () => {
6
5
  if (typeof window === 'undefined')
@@ -18,9 +17,7 @@ export const isLocalStorageAvailable = () => {
18
17
  }
19
18
  };
20
19
  /**
21
- * A utility function for getting a value from localStorage.
22
- * @param {string} key - The key to retrieve the value for.
23
- * @returns {string | null} The value associated with the key, or null if not found or localStorage is not available.
20
+ * Gets a value from localStorage.
24
21
  */
25
22
  export const getLocalStorage = (key) => {
26
23
  if (isLocalStorageAvailable()) {
@@ -30,10 +27,7 @@ export const getLocalStorage = (key) => {
30
27
  return null;
31
28
  };
32
29
  /**
33
- * A utility function for setting a value in localStorage.
34
- * @param {string} key - The key to set the value for.
35
- * @param {string} value - The value to be stored.
36
- * @returns {boolean} True if the operation succeeded, false otherwise (or if localStorage is not available).
30
+ * Sets a value in localStorage.
37
31
  */
38
32
  export const setLocalStorage = (key, value) => {
39
33
  if (isLocalStorageAvailable()) {
@@ -43,9 +37,7 @@ export const setLocalStorage = (key, value) => {
43
37
  return false;
44
38
  };
45
39
  /**
46
- * A utility function for removing a value from localStorage.
47
- * @param key - The key to remove the value for.
48
- * @returns {boolean} True if the operation succeeded, false otherwise (or if localStorage is not available).
40
+ * Removes a value from localStorage.
49
41
  */
50
42
  export const removeLocalStorage = (key) => {
51
43
  if (isLocalStorageAvailable()) {
@@ -1,24 +1,16 @@
1
1
  /**
2
- * Check if sessionStorage is available in the current environment.
3
- * @returns {boolean} True if sessionStorage is accessible, false otherwise.
2
+ * Checks if sessionStorage is available in the current environment.
4
3
  */
5
4
  export declare const isSessionStorageAvailable: () => boolean;
6
5
  /**
7
- * A utility function for getting a value from sessionStorage.
8
- * @param {string} key - The key to retrieve the value for.
9
- * @returns {string | null} The value associated with the key, or null if not found or sessionStorage is not available.
6
+ * Gets a value from sessionStorage.
10
7
  */
11
8
  export declare const getSessionStorage: (key: string) => string | null;
12
9
  /**
13
- * A utility function for setting a value in sessionStorage.
14
- * @param {string} key - The key to set the value for.
15
- * @param {string} value - The value to be stored.
16
- * @returns {boolean} True if the operation succeeded, false otherwise (or if sessionStorage is not available).
10
+ * Sets a value in sessionStorage.
17
11
  */
18
12
  export declare const setSessionStorage: (key: string, value: string) => boolean;
19
13
  /**
20
- * A utility function for removing a value from sessionStorage.
21
- * @param key - The key to remove the value for.
22
- * @returns {boolean} True if the operation succeeded, false otherwise (or if sessionStorage is not available).
14
+ * Removes a value from sessionStorage.
23
15
  */
24
16
  export declare const removeSessionStorage: (key: string) => boolean;