@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.
- package/README.md +162 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/providers/GlobalProvider.mdx +322 -0
- package/dist/providers/GlobalProvider.svelte +58 -0
- package/dist/providers/GlobalProvider.svelte.d.ts +4 -0
- package/dist/providers/configuratorUtils.d.ts +37 -0
- package/dist/providers/configuratorUtils.js +219 -0
- package/dist/providers/globalContext.svelte.d.ts +18 -0
- package/dist/providers/globalContext.svelte.js +439 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.js +7 -0
- package/dist/providers/types.d.ts +103 -0
- package/dist/providers/types.js +6 -0
- package/dist/router/README.md +2 -2
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -1
- package/dist/types/webflow.d.ts +31 -47
- package/dist/ui/components/LoadingScreen.svelte +2 -1
- package/dist/ui/components/button/Button.svelte +1 -1
- package/dist/ui/components/button-group/ButtonGroup.stories.js +112 -0
- package/dist/ui/components/{ButtonGroup.svelte → button-group/ButtonGroup.svelte} +20 -33
- package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +13 -0
- package/dist/ui/components/button-group/index.d.ts +2 -0
- package/dist/ui/components/button-group/index.js +1 -0
- package/dist/ui/components/button-group/types.d.ts +32 -0
- package/dist/ui/components/checkbox/Checkbox.stories.d.ts +55 -0
- package/dist/ui/components/checkbox/Checkbox.stories.js +162 -0
- package/dist/ui/components/checkbox/Checkbox.svelte +141 -0
- package/dist/ui/components/checkbox/Checkbox.svelte.d.ts +4 -0
- package/dist/ui/components/checkbox/index.d.ts +2 -0
- package/dist/ui/components/checkbox/index.js +1 -0
- package/dist/ui/components/checkbox/types.d.ts +32 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.stories.d.ts +32 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.stories.js +152 -0
- package/dist/ui/components/{buttons/FooterButton.svelte → controlled-buttons/ControlledButtons.svelte} +18 -67
- package/dist/ui/components/controlled-buttons/ControlledButtons.svelte.d.ts +4 -0
- package/dist/ui/components/controlled-buttons/index.d.ts +2 -0
- package/dist/ui/components/controlled-buttons/index.js +1 -0
- package/dist/ui/components/{buttons → controlled-buttons}/types.d.ts +11 -4
- package/dist/ui/components/divider/Divider.stories.svelte +134 -0
- package/dist/ui/components/{clickable/Clickable.stories.svelte.d.ts → divider/Divider.stories.svelte.d.ts} +4 -4
- package/dist/ui/components/divider/Divider.svelte +30 -0
- package/dist/ui/components/divider/Divider.svelte.d.ts +4 -0
- package/dist/ui/components/divider/index.d.ts +2 -0
- package/dist/ui/components/divider/index.js +1 -0
- package/dist/ui/components/divider/types.d.ts +23 -0
- package/dist/ui/components/divider/types.js +1 -0
- package/dist/ui/components/iframe/Iframe.stories.svelte +122 -0
- package/dist/ui/components/{ToggleItem.svelte.d.ts → iframe/Iframe.stories.svelte.d.ts} +7 -8
- package/dist/ui/components/iframe/Iframe.svelte +75 -0
- package/dist/ui/components/iframe/Iframe.svelte.d.ts +4 -0
- package/dist/ui/components/iframe/index.d.ts +2 -0
- package/dist/ui/components/iframe/index.js +1 -0
- package/dist/ui/components/iframe/types.d.ts +38 -0
- package/dist/ui/components/iframe/types.js +1 -0
- package/dist/ui/components/index.d.ts +12 -39
- package/dist/ui/components/index.js +12 -39
- package/dist/ui/components/input/Input.stories.d.ts +24 -0
- package/dist/ui/components/input/Input.stories.js +98 -0
- package/dist/ui/components/input/Input.svelte +321 -80
- package/dist/ui/components/input/types.d.ts +27 -1
- package/dist/ui/components/layout/Layout.stories.svelte +3 -3
- package/dist/ui/components/layout/Layout.svelte +3 -5
- package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
- package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +34 -22
- package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
- package/dist/ui/components/{NoSettingsNeeded.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +3 -3
- package/dist/ui/components/layout/examples/index.d.ts +2 -0
- package/dist/ui/components/layout/examples/index.js +2 -0
- package/dist/ui/components/layout/index.d.ts +2 -1
- package/dist/ui/components/layout/index.js +2 -1
- package/dist/ui/components/modal/Example.svelte +320 -0
- package/dist/ui/components/modal/Example.svelte.d.ts +3 -0
- package/dist/ui/components/modal/Modal.stories.svelte +18 -0
- package/dist/ui/components/modal/Modal.stories.svelte.d.ts +26 -0
- package/dist/ui/components/modal/Modal.svelte +490 -0
- package/dist/ui/components/modal/Modal.svelte.d.ts +130 -0
- package/dist/ui/components/modal/index.d.ts +2 -0
- package/dist/ui/components/modal/index.js +1 -0
- package/dist/ui/components/modal/types.d.ts +75 -0
- package/dist/ui/components/modal/types.js +1 -0
- package/dist/ui/components/notification/Notification.stories.svelte +228 -0
- package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
- package/dist/ui/components/notification/Notification.svelte +289 -0
- package/dist/ui/components/notification/Notification.svelte.d.ts +67 -0
- package/dist/ui/components/notification/index.d.ts +2 -0
- package/dist/ui/components/notification/index.js +1 -0
- package/dist/ui/components/notification/types.d.ts +68 -0
- package/dist/ui/components/notification/types.js +1 -0
- package/dist/ui/components/section/Section.stories.svelte +263 -0
- package/dist/ui/components/section/Section.stories.svelte.d.ts +27 -0
- package/dist/ui/components/section/Section.svelte +324 -0
- package/dist/ui/components/section/Section.svelte.d.ts +5 -0
- package/dist/ui/components/section/index.d.ts +2 -0
- package/dist/ui/components/section/index.js +1 -0
- package/dist/ui/components/section/types.d.ts +106 -0
- package/dist/ui/components/section/types.js +1 -0
- package/dist/ui/components/{ImageUpload.svelte → shared/ImageUpload.svelte} +3 -3
- package/dist/ui/components/{SelectBodyOrDivBlock.svelte → shared/SelectBodyOrDivBlock.svelte} +1 -1
- package/dist/ui/components/shared/index.d.ts +2 -0
- package/dist/ui/components/shared/index.js +2 -0
- package/dist/ui/index.css +33 -5
- package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
- package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
- package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
- package/dist/utils/api/clipboard/handlePaste.js +2 -6
- package/dist/utils/api/getAllAssets.d.ts +1 -2
- package/dist/utils/api/getAllAssets.js +1 -2
- package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
- package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
- package/dist/utils/api/index.d.ts +0 -1
- package/dist/utils/api/index.js +0 -1
- package/dist/utils/api/insertWithXSCP.d.ts +1 -2
- package/dist/utils/api/insertWithXSCP.js +1 -2
- package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
- package/dist/utils/auth/crossWindowLogin.js +3 -0
- package/dist/utils/auth/index.d.ts +9 -25
- package/dist/utils/auth/index.js +9 -25
- package/dist/utils/browser-storage/localStorage.d.ts +4 -12
- package/dist/utils/browser-storage/localStorage.js +4 -12
- package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
- package/dist/utils/browser-storage/sessionStorage.js +4 -12
- package/dist/utils/custom-code/api.d.ts +3 -7
- package/dist/utils/custom-code/api.js +3 -7
- package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
- package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
- package/dist/utils/helpers/goto.d.ts +1 -4
- package/dist/utils/helpers/goto.js +2 -7
- package/dist/utils/helpers/index.d.ts +1 -0
- package/dist/utils/helpers/index.js +1 -0
- package/dist/utils/helpers/noop.d.ts +1 -1
- package/dist/utils/helpers/noop.js +1 -1
- package/dist/utils/helpers/numbers.d.ts +4 -14
- package/dist/utils/helpers/numbers.js +4 -14
- package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -3
- package/dist/utils/helpers/objectsToModuleExports.js +1 -3
- package/dist/utils/helpers/trimText.d.ts +1 -8
- package/dist/utils/helpers/trimText.js +1 -8
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/logger/index.d.ts +0 -2
- package/dist/utils/logger/index.js +0 -2
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
- package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
- package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
- package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
- package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
- package/dist/utils/webflow-canvas/getAllPages.js +3 -10
- package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
- package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
- package/dist/utils/webflow-canvas/index.d.ts +1 -0
- package/dist/utils/webflow-canvas/index.js +1 -0
- package/package.json +9 -2
- package/dist/stores/globalStore.d.ts +0 -10
- package/dist/stores/globalStore.js +0 -10
- package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
- package/dist/ui/components/Checkbox.svelte +0 -94
- package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
- package/dist/ui/components/Copy.svelte +0 -329
- package/dist/ui/components/Copy.svelte.d.ts +0 -35
- package/dist/ui/components/CustomModal.svelte +0 -192
- package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
- package/dist/ui/components/DisableInEditMode.svelte +0 -66
- package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
- package/dist/ui/components/Divider.svelte +0 -31
- package/dist/ui/components/Divider.svelte.d.ts +0 -31
- package/dist/ui/components/Header.svelte +0 -30
- package/dist/ui/components/Header.svelte.d.ts +0 -20
- package/dist/ui/components/Iframe.svelte +0 -89
- package/dist/ui/components/Iframe.svelte.d.ts +0 -40
- package/dist/ui/components/InjectComponent.svelte +0 -297
- package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
- package/dist/ui/components/Modal.svelte +0 -139
- package/dist/ui/components/Modal.svelte.d.ts +0 -42
- package/dist/ui/components/Navbar.svelte +0 -132
- package/dist/ui/components/Navbar.svelte.d.ts +0 -29
- package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
- package/dist/ui/components/Notification.svelte +0 -193
- package/dist/ui/components/Notification.svelte.d.ts +0 -64
- package/dist/ui/components/PlusMinusButton.svelte +0 -91
- package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
- package/dist/ui/components/PreviewBar.svelte +0 -40
- package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
- package/dist/ui/components/ScrollableContent.svelte +0 -18
- package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
- package/dist/ui/components/Section.svelte +0 -97
- package/dist/ui/components/Section.svelte.d.ts +0 -50
- package/dist/ui/components/Spacer.svelte +0 -9
- package/dist/ui/components/Spacer.svelte.d.ts +0 -22
- package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
- package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
- package/dist/ui/components/SpinnerUpDown.svelte +0 -194
- package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
- package/dist/ui/components/Tabs.svelte +0 -71
- package/dist/ui/components/Tabs.svelte.d.ts +0 -26
- package/dist/ui/components/ToggleItem.svelte +0 -29
- package/dist/ui/components/ToggleList.svelte +0 -57
- package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
- package/dist/ui/components/buttons/index.d.ts +0 -5
- package/dist/ui/components/buttons/index.js +0 -5
- package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
- package/dist/ui/components/clickable/Clickable.svelte +0 -93
- package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
- package/dist/ui/components/clickable/index.d.ts +0 -2
- package/dist/ui/components/clickable/index.js +0 -1
- package/dist/ui/components/clickable/types.d.ts +0 -17
- package/dist/utils/api/copyPaste/index.d.ts +0 -18
- /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
- /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
- /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
- /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
- /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
- /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 '
|
|
6
|
-
import { Button } from '
|
|
7
|
-
import { Text } from '
|
|
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;
|
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
|
-
/*
|
|
270
|
-
|
|
271
|
-
|
|
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
|
-
.
|
|
275
|
-
|
|
302
|
+
.os-theme-dark .os-scrollbar-handle:active {
|
|
303
|
+
background: var(--background2);
|
|
276
304
|
}
|
|
277
305
|
|
|
278
306
|
input {
|
|
@@ -1,46 +1,15 @@
|
|
|
1
|
-
|
|
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
|
-
*
|
|
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:
|
|
34
|
-
data:
|
|
5
|
+
export declare const processPastedComponent: (pasteData: XSCPMetadata, component: string) => {
|
|
6
|
+
data: XSCPMetadata;
|
|
35
7
|
key: string;
|
|
36
8
|
} | undefined;
|
|
37
9
|
/**
|
|
38
|
-
*
|
|
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:
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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'))
|
|
@@ -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
|
-
*
|
|
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
|
-
*
|
|
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);
|
package/dist/utils/api/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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,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
|
|
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;
|
package/dist/utils/auth/index.js
CHANGED
|
@@ -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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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;
|