@finsweet/webflow-apps-utils 1.0.2 → 1.0.4
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 +2 -1
- package/dist/index.js +2 -1
- 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/Router.mdx +958 -0
- package/dist/router/Router.stories.d.ts +6 -0
- package/dist/router/Router.stories.js +47 -0
- package/dist/router/examples/RouterExample.svelte +271 -0
- package/dist/{ui/components/NoSettingsNeeded.svelte.d.ts → router/examples/RouterExample.svelte.d.ts} +3 -3
- package/dist/router/examples/index.d.ts +4 -0
- package/dist/router/examples/index.js +4 -0
- package/dist/router/examples/pages/AboutPage.svelte +568 -0
- package/dist/router/examples/pages/AboutPage.svelte.d.ts +13 -0
- package/dist/router/examples/pages/HomePage.svelte +200 -0
- package/dist/router/examples/pages/HomePage.svelte.d.ts +14 -0
- package/dist/router/examples/pages/NotFoundPage.svelte +307 -0
- package/dist/router/examples/pages/NotFoundPage.svelte.d.ts +17 -0
- package/dist/router/hooks.svelte.d.ts +2 -2
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.js +3 -0
- package/dist/router/{Link.svelte → providers/Link.svelte} +1 -1
- package/dist/router/{Route.svelte → providers/Route.svelte} +1 -1
- package/dist/router/{Route.svelte.d.ts → providers/Route.svelte.d.ts} +1 -1
- package/dist/router/{Router.svelte → providers/RouterProvider.svelte} +22 -5
- package/dist/router/{Router.svelte.d.ts → providers/RouterProvider.svelte.d.ts} +8 -4
- package/dist/router/providers/index.d.ts +3 -0
- package/dist/router/providers/index.js +3 -0
- package/dist/router/{index.svelte.d.ts → router.svelte.d.ts} +1 -3
- package/dist/router/{index.svelte.js → router.svelte.js} +1 -4
- package/dist/stores/docs/Form.mdx +542 -0
- package/dist/stores/forms.d.ts +41 -4
- package/dist/stores/forms.js +86 -32
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -1
- package/dist/types/customCode.d.ts +1 -1
- package/dist/types/webflow.d.ts +31 -47
- package/dist/types/window.d.ts +1 -0
- 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/copy-text/CopyText.stories.d.ts +70 -0
- package/dist/ui/components/copy-text/CopyText.stories.js +241 -0
- package/dist/ui/components/copy-text/CopyText.svelte +249 -0
- package/dist/ui/components/copy-text/CopyText.svelte.d.ts +4 -0
- package/dist/ui/components/copy-text/index.d.ts +2 -0
- package/dist/ui/components/copy-text/index.js +1 -0
- package/dist/ui/components/copy-text/types.d.ts +52 -0
- package/dist/ui/components/copy-text/types.js +1 -0
- 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 +13 -39
- package/dist/ui/components/index.js +13 -39
- package/dist/ui/components/input/Input.stories.d.ts +33 -0
- package/dist/ui/components/input/Input.stories.js +176 -0
- package/dist/ui/components/input/Input.svelte +358 -81
- package/dist/ui/components/input/types.d.ts +33 -1
- package/dist/ui/components/layout/Layout.stories.svelte +3 -3
- package/dist/ui/components/layout/Layout.svelte +10 -64
- package/dist/ui/components/layout/Layout.svelte.d.ts +2 -2
- package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
- package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +56 -39
- package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
- package/dist/ui/components/{Header.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +4 -6
- 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 +3 -2
- package/dist/ui/components/layout/index.js +2 -1
- package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte +20 -0
- package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte.d.ts +7 -0
- package/dist/ui/components/layout/types.d.ts +1 -10
- 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 +239 -0
- package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
- package/dist/ui/components/notification/Notification.svelte +294 -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 +326 -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 +114 -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/components/text/Text.stories.svelte +67 -1
- package/dist/ui/components/text/Text.svelte +209 -8
- package/dist/ui/components/text/types.d.ts +4 -0
- package/dist/ui/index.css +33 -5
- package/dist/utils/animations/factory.d.ts +7 -0
- package/dist/utils/animations/factory.js +101 -0
- package/dist/utils/animations/index.d.ts +7 -0
- package/dist/utils/animations/index.js +62 -0
- package/dist/utils/animations/types.d.ts +39 -0
- package/dist/utils/animations/types.js +1 -0
- 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/custom-code/configs.d.ts +22 -0
- package/dist/utils/custom-code/configs.js +40 -0
- package/dist/utils/custom-code/index.d.ts +1 -0
- package/dist/utils/custom-code/index.js +1 -0
- package/dist/utils/helpers/capitalizeFirstLetter.d.ts +4 -0
- package/dist/utils/helpers/capitalizeFirstLetter.js +9 -0
- package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
- package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
- package/dist/utils/helpers/getTimeNow.d.ts +4 -0
- package/dist/utils/helpers/getTimeNow.js +8 -0
- package/dist/utils/helpers/goto.d.ts +1 -4
- package/dist/utils/helpers/goto.js +2 -7
- package/dist/utils/helpers/index.d.ts +5 -0
- package/dist/utils/helpers/index.js +5 -0
- package/dist/utils/helpers/minifyCode.d.ts +10 -0
- package/dist/utils/helpers/minifyCode.js +73 -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 +2 -4
- package/dist/utils/helpers/objectsToModuleExports.js +2 -3
- package/dist/utils/helpers/toHumanReadableList.d.ts +4 -0
- package/dist/utils/helpers/toHumanReadableList.js +11 -0
- package/dist/utils/helpers/trimText.d.ts +1 -8
- package/dist/utils/helpers/trimText.js +1 -8
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +5 -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/getAllChildren.d.ts +16 -0
- package/dist/utils/webflow-canvas/getAllChildren.js +65 -0
- package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
- package/dist/utils/webflow-canvas/getAllPages.js +3 -10
- package/dist/utils/webflow-canvas/getElementClassList.d.ts +9 -0
- package/dist/utils/webflow-canvas/getElementClassList.js +19 -0
- 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 +3 -0
- package/dist/utils/webflow-canvas/index.js +3 -0
- package/package.json +14 -2
- package/dist/router/README.md +0 -397
- 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/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/router/{Link.svelte.d.ts → providers/Link.svelte.d.ts} +0 -0
- /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
|
@@ -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;
|
|
@@ -1,6 +1,5 @@
|
|
|
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
|
import { getLogger } from '../logger';
|
|
6
5
|
const logger = getLogger('webflow-apps-ui-utils');
|
|
@@ -18,9 +17,7 @@ export const isSessionStorageAvailable = () => {
|
|
|
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 sessionStorage is not available.
|
|
20
|
+
* Gets a value from sessionStorage.
|
|
24
21
|
*/
|
|
25
22
|
export const getSessionStorage = (key) => {
|
|
26
23
|
if (isSessionStorageAvailable()) {
|
|
@@ -30,10 +27,7 @@ export const getSessionStorage = (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 sessionStorage is not available).
|
|
30
|
+
* Sets a value in sessionStorage.
|
|
37
31
|
*/
|
|
38
32
|
export const setSessionStorage = (key, value) => {
|
|
39
33
|
if (isSessionStorageAvailable()) {
|
|
@@ -43,9 +37,7 @@ export const setSessionStorage = (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 sessionStorage is not available).
|
|
40
|
+
* Removes a value from sessionStorage.
|
|
49
41
|
*/
|
|
50
42
|
export const removeSessionStorage = (key) => {
|
|
51
43
|
if (isSessionStorageAvailable()) {
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import type { CustomCodeBlock } from '../../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param {string} id - The Custom Code block ID identifier. If not provided, all stored configs will be returned.
|
|
5
|
-
* @returns {CustomCodeBlock | null} The stored configs, or null if not found.
|
|
3
|
+
* Gets stored Custom Code blocks by ID or returns all if no ID provided.
|
|
6
4
|
*/
|
|
7
5
|
export declare const getCustomCode: (id?: string) => Promise<Array<CustomCodeBlock>>;
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param {CustomCodeBlock} customCodeBlock - The custom code block to be stored.
|
|
11
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
7
|
+
* Sets custom code blocks in the site.
|
|
12
8
|
*/
|
|
13
9
|
export declare const setCustomCode: (customCodeBlock: Array<CustomCodeBlock>) => Promise<void>;
|
|
14
10
|
/**
|
|
15
|
-
*
|
|
11
|
+
* Removes a custom code block.
|
|
16
12
|
*/
|
|
17
13
|
export declare const removeCustomCode: () => boolean;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { getLogger } from '../logger';
|
|
2
2
|
const logger = getLogger('webflow-apps-ui-utils');
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {string} id - The Custom Code block ID identifier. If not provided, all stored configs will be returned.
|
|
6
|
-
* @returns {CustomCodeBlock | null} The stored configs, or null if not found.
|
|
4
|
+
* Gets stored Custom Code blocks by ID or returns all if no ID provided.
|
|
7
5
|
*/
|
|
8
6
|
export const getCustomCode = async (id) => {
|
|
9
7
|
//TODO: update this when typings are available plus any other place we have disabled this warning.
|
|
@@ -19,9 +17,7 @@ export const getCustomCode = async (id) => {
|
|
|
19
17
|
return [];
|
|
20
18
|
};
|
|
21
19
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @param {CustomCodeBlock} customCodeBlock - The custom code block to be stored.
|
|
24
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
20
|
+
* Sets custom code blocks in the site.
|
|
25
21
|
*/
|
|
26
22
|
export const setCustomCode = async (customCodeBlock) => {
|
|
27
23
|
try {
|
|
@@ -33,7 +29,7 @@ export const setCustomCode = async (customCodeBlock) => {
|
|
|
33
29
|
}
|
|
34
30
|
};
|
|
35
31
|
/**
|
|
36
|
-
*
|
|
32
|
+
* Removes a custom code block.
|
|
37
33
|
*/
|
|
38
34
|
export const removeCustomCode = () => {
|
|
39
35
|
//TODO: implement when available
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store for Custom Code stored Component configs
|
|
3
|
+
*/
|
|
4
|
+
export declare const componentConfigsStore: import("svelte/store").Writable<null>;
|
|
5
|
+
export type CustomCodeConfigsStore = {
|
|
6
|
+
component: string;
|
|
7
|
+
instance: string[];
|
|
8
|
+
}[];
|
|
9
|
+
/**
|
|
10
|
+
* Store for Custom Code stored Component configs instances
|
|
11
|
+
*/
|
|
12
|
+
export declare const customCodeConfigsStore: import("svelte/store").Writable<CustomCodeConfigsStore>;
|
|
13
|
+
/**
|
|
14
|
+
* Get configs from custom code.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getProjectConfigs: () => Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetches configs stored in custom code for a given component.
|
|
19
|
+
* @param component
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare const getComponentConfigs: (component: string) => Promise<any>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { writable } from 'svelte/store';
|
|
2
|
+
import { getLogger } from '../logger';
|
|
3
|
+
import { getCustomCode } from './api';
|
|
4
|
+
const logger = getLogger('utils');
|
|
5
|
+
const DISPLAY_NAME = 'finsweetcomponentsconfig';
|
|
6
|
+
/**
|
|
7
|
+
* Store for Custom Code stored Component configs
|
|
8
|
+
*/
|
|
9
|
+
export const componentConfigsStore = writable(null);
|
|
10
|
+
/**
|
|
11
|
+
* Store for Custom Code stored Component configs instances
|
|
12
|
+
*/
|
|
13
|
+
export const customCodeConfigsStore = writable([]);
|
|
14
|
+
/**
|
|
15
|
+
* Get configs from custom code.
|
|
16
|
+
*/
|
|
17
|
+
export const getProjectConfigs = async () => {
|
|
18
|
+
const [customCodeBlock] = await getCustomCode(DISPLAY_NAME);
|
|
19
|
+
if (!customCodeBlock || !customCodeBlock.hostedLocation) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
// activate loading state to block iife scripts
|
|
23
|
+
window.isLoadingCustomCodeConfigs = true;
|
|
24
|
+
const configs = await import(/* @vite-ignore */ customCodeBlock.hostedLocation);
|
|
25
|
+
window.isLoadingCustomCodeConfigs = false;
|
|
26
|
+
customCodeConfigsStore.set(configs);
|
|
27
|
+
logger.log({}, 'Project custom code configs', configs);
|
|
28
|
+
return configs;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Fetches configs stored in custom code for a given component.
|
|
32
|
+
* @param component
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
export const getComponentConfigs = async (component) => {
|
|
36
|
+
const customCodeBlock = await getProjectConfigs();
|
|
37
|
+
if (!customCodeBlock || Object.keys(customCodeBlock[component]).length === 0)
|
|
38
|
+
return null;
|
|
39
|
+
return customCodeBlock[component];
|
|
40
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capitalizes the first letter of each word in a comma-separated string and adds a space after commas.
|
|
3
|
+
*/
|
|
4
|
+
export const capitalizeFirstLetter = (input) => {
|
|
5
|
+
return input
|
|
6
|
+
.split(',')
|
|
7
|
+
.map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`)
|
|
8
|
+
.join(', ');
|
|
9
|
+
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* It then users svelte-routing's navigate function to navigate to the new path.
|
|
4
|
-
* @param path - The path to navigate to. Defaults to '/'.
|
|
5
|
-
* @param state - The state to pass to the new path. Read more about state here: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
|
|
2
|
+
* Navigates to a new path using the router store hash.
|
|
6
3
|
*/
|
|
7
4
|
export declare const goto: (path?: string, state?: Record<string, unknown>) => void;
|
|
@@ -4,9 +4,7 @@ import { routerStore } from '../../stores';
|
|
|
4
4
|
import { getLogger } from '../logger';
|
|
5
5
|
const logger = getLogger('webflow-apps-ui-utils');
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param path
|
|
9
|
-
* @returns
|
|
7
|
+
* Normalizes a URL path to ensure proper formatting.
|
|
10
8
|
*/
|
|
11
9
|
const normalizeUrlPath = (path, hash) => {
|
|
12
10
|
const safePath = path.replace(/([^:]\/)\/+/g, '$1');
|
|
@@ -18,10 +16,7 @@ const normalizeUrlPath = (path, hash) => {
|
|
|
18
16
|
return url;
|
|
19
17
|
};
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
22
|
-
* It then users svelte-routing's navigate function to navigate to the new path.
|
|
23
|
-
* @param path - The path to navigate to. Defaults to '/'.
|
|
24
|
-
* @param state - The state to pass to the new path. Read more about state here: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
|
|
19
|
+
* Navigates to a new path using the router store hash.
|
|
25
20
|
*/
|
|
26
21
|
export const goto = (path = '/', state = {}) => {
|
|
27
22
|
const { hash = '' } = get(routerStore);
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export * from './capitalizeFirstLetter';
|
|
1
2
|
export * from './cleanupTooltipMessage';
|
|
2
3
|
export * from './goto';
|
|
4
|
+
export * from './getTimeNow';
|
|
5
|
+
export * from './minifyCode';
|
|
3
6
|
export * from './noop';
|
|
4
7
|
export * from './numbers';
|
|
8
|
+
export * from './objectsToModuleExports';
|
|
5
9
|
export * from './trimText';
|
|
10
|
+
export * from './toHumanReadableList';
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export * from './capitalizeFirstLetter';
|
|
1
2
|
export * from './cleanupTooltipMessage';
|
|
2
3
|
export * from './goto';
|
|
4
|
+
export * from './getTimeNow';
|
|
5
|
+
export * from './minifyCode';
|
|
3
6
|
export * from './noop';
|
|
4
7
|
export * from './numbers';
|
|
8
|
+
export * from './objectsToModuleExports';
|
|
5
9
|
export * from './trimText';
|
|
10
|
+
export * from './toHumanReadableList';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type MinifyOptions } from 'terser';
|
|
2
|
+
/**
|
|
3
|
+
* Minifies the provided JavaScript code string.
|
|
4
|
+
*/
|
|
5
|
+
export declare const minifyCode: (code: string, options?: MinifyOptions) => Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Core script as a string.
|
|
8
|
+
* TODO: temporary, migrate it to a re-usable util
|
|
9
|
+
*/
|
|
10
|
+
export declare const createScriptContent: (coreScript: string) => string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { minify } from 'terser';
|
|
2
|
+
/**
|
|
3
|
+
* Minifies the provided JavaScript code string.
|
|
4
|
+
*/
|
|
5
|
+
export const minifyCode = async (code, options) => {
|
|
6
|
+
try {
|
|
7
|
+
const result = await minify(code, options);
|
|
8
|
+
if (result.code) {
|
|
9
|
+
return result.code;
|
|
10
|
+
}
|
|
11
|
+
throw new Error('Minification failed: No output code produced.');
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (error instanceof Error) {
|
|
15
|
+
// Handle specific Error object
|
|
16
|
+
throw new Error(`Minification error: ${error.message}`);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// Handle unknown error types
|
|
20
|
+
throw new Error(`Unexpected error: ${String(error)}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Core script as a string.
|
|
26
|
+
* TODO: temporary, migrate it to a re-usable util
|
|
27
|
+
*/
|
|
28
|
+
export const createScriptContent = (coreScript) => {
|
|
29
|
+
const scriptToAdd = `
|
|
30
|
+
const injectStyles = () => {
|
|
31
|
+
const curr = document.querySelector(\`style[fs-components-cloak]\`);
|
|
32
|
+
curr?.remove();
|
|
33
|
+
const cloak = document.createElement('style');
|
|
34
|
+
cloak.setAttribute('fs-components-cloak', 'cloak');
|
|
35
|
+
cloak.textContent = \`
|
|
36
|
+
[fs-marquee-instance],[fs-cnumbercount-instance]{ opacity: 0; }
|
|
37
|
+
[fs-consent-element="internal-component"],[fs-consent-element="banner"],[fs-consent-element="fixed-preferences"],[fs-consent-element="preferences"],[fs-consent-element="interaction"]{display:none}
|
|
38
|
+
\`;
|
|
39
|
+
document.head.appendChild(cloak);
|
|
40
|
+
};
|
|
41
|
+
const initFsComponents = async (url) => {
|
|
42
|
+
injectStyles();
|
|
43
|
+
// happens in-app, check to prevent script being invoked in-app
|
|
44
|
+
const configsLoading = window?.finsweetComponentsConfigLoading;
|
|
45
|
+
|
|
46
|
+
const found = document?.querySelector("script[fs-components-src]");
|
|
47
|
+
if (typeof import.meta !== "undefined" && !(found || configsLoading)) {
|
|
48
|
+
const corescript = document?.querySelector(
|
|
49
|
+
'script[finsweet="components"][async][type="module"]'
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const appConfigs = (await import(/* @vite-ignore */ import.meta.url));
|
|
53
|
+
const components = Object.keys(appConfigs) || [];
|
|
54
|
+
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
const script = document.createElement("script");
|
|
57
|
+
const srcUrl = url + "?v=" + new Date().getTime();
|
|
58
|
+
script.src = srcUrl;
|
|
59
|
+
script.type = "module";
|
|
60
|
+
script.async = true;
|
|
61
|
+
script.setAttribute("fs-components-src", import.meta.url);
|
|
62
|
+
script.setAttribute("fs-components-installed", components?.join(","));
|
|
63
|
+
script.onload = () => resolve();
|
|
64
|
+
script.onerror = () => reject(new Error("Failed to load script"));
|
|
65
|
+
document.head.appendChild(script);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Load dev script
|
|
71
|
+
initFsComponents("${coreScript}");`;
|
|
72
|
+
return scriptToAdd;
|
|
73
|
+
};
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Converts a string to a number, removing
|
|
3
|
-
* @param value A string number.
|
|
4
|
-
* @returns The valid number value.
|
|
2
|
+
* Converts a string to a number, removing invalid symbols.
|
|
5
3
|
*/
|
|
6
4
|
export declare const normalizeNumber: (value: string) => number | undefined;
|
|
7
5
|
/**
|
|
8
|
-
* Parses a numeric
|
|
9
|
-
* @param rawValue The raw string. Example: "20", "-25.3"...
|
|
10
|
-
* @param fallback A value to fall back to when the parsed value is not valid.
|
|
6
|
+
* Parses a numeric attribute string with fallback support.
|
|
11
7
|
*/
|
|
12
8
|
export declare function parseNumericAttribute(rawValue: string | number | null | undefined, fallback: number): number;
|
|
13
9
|
export declare function parseNumericAttribute(rawValue: string | number | null | undefined, fallback?: number | null): number | null;
|
|
14
10
|
/**
|
|
15
|
-
* Calculates the
|
|
16
|
-
* @param value A number.
|
|
11
|
+
* Calculates the number of decimal places in a float.
|
|
17
12
|
*/
|
|
18
13
|
export declare const getDecimalPrecision: (value: number) => number;
|
|
19
14
|
/**
|
|
20
|
-
* Adjusts a numeric value to a step factor.
|
|
21
|
-
* @param value The numeric value to adjust.
|
|
22
|
-
* @param step The increment step.
|
|
23
|
-
* @param precision The step's decimal precision. If not provided, it will be calculated.
|
|
24
|
-
* @param minRange A minimum range value, used for offsetting.
|
|
25
|
-
* @returns The adjusted value.
|
|
15
|
+
* Adjusts a numeric value to align with a step factor.
|
|
26
16
|
*/
|
|
27
17
|
export declare const adjustValueToStep: (value: number, step: number, precision?: number, minRange?: number) => number;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Converts a string to a number, removing
|
|
3
|
-
* @param value A string number.
|
|
4
|
-
* @returns The valid number value.
|
|
2
|
+
* Converts a string to a number, removing invalid symbols.
|
|
5
3
|
*/
|
|
6
4
|
export const normalizeNumber = (value) => {
|
|
7
5
|
if (!value)
|
|
@@ -19,8 +17,7 @@ export function parseNumericAttribute(rawValue, fallback) {
|
|
|
19
17
|
return null;
|
|
20
18
|
}
|
|
21
19
|
/**
|
|
22
|
-
* Calculates the
|
|
23
|
-
* @param value A number.
|
|
20
|
+
* Calculates the number of decimal places in a float.
|
|
24
21
|
*/
|
|
25
22
|
export const getDecimalPrecision = (value) => {
|
|
26
23
|
if (!isFinite(value))
|
|
@@ -34,21 +31,14 @@ export const getDecimalPrecision = (value) => {
|
|
|
34
31
|
return precision;
|
|
35
32
|
};
|
|
36
33
|
/**
|
|
37
|
-
* Ensures a decimal precision on a number.
|
|
38
|
-
* @param value The number to handle.
|
|
39
|
-
* @param precision The amount of decimals.
|
|
34
|
+
* Ensures a specific decimal precision on a number.
|
|
40
35
|
*/
|
|
41
36
|
const setDecimalPrecision = (value, precision) => {
|
|
42
37
|
const pow = Math.pow(10, precision);
|
|
43
38
|
return Math.round(value * pow) / pow;
|
|
44
39
|
};
|
|
45
40
|
/**
|
|
46
|
-
* Adjusts a numeric value to a step factor.
|
|
47
|
-
* @param value The numeric value to adjust.
|
|
48
|
-
* @param step The increment step.
|
|
49
|
-
* @param precision The step's decimal precision. If not provided, it will be calculated.
|
|
50
|
-
* @param minRange A minimum range value, used for offsetting.
|
|
51
|
-
* @returns The adjusted value.
|
|
41
|
+
* Adjusts a numeric value to align with a step factor.
|
|
52
42
|
*/
|
|
53
43
|
export const adjustValueToStep = (value, step, precision, minRange = 0) => {
|
|
54
44
|
precision ??= getDecimalPrecision(step);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Converts an array of objects to
|
|
3
|
-
* @param exportsArray - Array of objects with variable names and objects.
|
|
4
|
-
* @returns The combined module export string.
|
|
2
|
+
* Converts an array of objects to module export statements.
|
|
5
3
|
*/
|
|
6
4
|
export declare const objectsToModuleExports: (exportsArray: Array<{
|
|
7
5
|
moduleName: string;
|
|
8
|
-
data:
|
|
6
|
+
data: any;
|
|
9
7
|
}>) => string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
/**
|
|
2
|
-
* Converts an array of objects to
|
|
3
|
-
* @param exportsArray - Array of objects with variable names and objects.
|
|
4
|
-
* @returns The combined module export string.
|
|
3
|
+
* Converts an array of objects to module export statements.
|
|
5
4
|
*/
|
|
6
5
|
export const objectsToModuleExports = (exportsArray) => {
|
|
7
6
|
return exportsArray
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an array of strings into a human-readable list by adding commas and "and" before the last item.
|
|
3
|
+
*/
|
|
4
|
+
export const toHumanReadableList = (arr, conjunction = 'and') => {
|
|
5
|
+
const len = arr.length;
|
|
6
|
+
if (len === 0)
|
|
7
|
+
return '';
|
|
8
|
+
if (len === 1)
|
|
9
|
+
return arr[0];
|
|
10
|
+
return `${arr.slice(0, -1).join(', ')} ${conjunction} ${arr[len - 1]}`;
|
|
11
|
+
};
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Trims
|
|
3
|
-
*
|
|
4
|
-
* @param text - The input text to be trimmed.
|
|
5
|
-
* @param maxLength - The maximum length of the trimmed text. Default is 40.
|
|
6
|
-
* @returns The trimmed text with ellipsis in the middle, if applicable.
|
|
2
|
+
* Trims text in the middle and adds ellipsis if it exceeds the maximum length.
|
|
7
3
|
*/
|
|
8
4
|
export declare const trimText: (text: string, maxLength?: number) => string | undefined;
|
|
9
5
|
/**
|
|
10
6
|
* Trims whitespaces and extra spaces in a given text.
|
|
11
|
-
*
|
|
12
|
-
* @param text - The input text to be trimmed.
|
|
13
|
-
* @returns The trimmed text with removed extra spaces.
|
|
14
7
|
*/
|
|
15
8
|
export declare const trimExtraSpaces: (text: string) => string | undefined;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Trims
|
|
3
|
-
*
|
|
4
|
-
* @param text - The input text to be trimmed.
|
|
5
|
-
* @param maxLength - The maximum length of the trimmed text. Default is 40.
|
|
6
|
-
* @returns The trimmed text with ellipsis in the middle, if applicable.
|
|
2
|
+
* Trims text in the middle and adds ellipsis if it exceeds the maximum length.
|
|
7
3
|
*/
|
|
8
4
|
export const trimText = (text, maxLength = 40) => {
|
|
9
5
|
if (!text)
|
|
@@ -18,9 +14,6 @@ export const trimText = (text, maxLength = 40) => {
|
|
|
18
14
|
};
|
|
19
15
|
/**
|
|
20
16
|
* Trims whitespaces and extra spaces in a given text.
|
|
21
|
-
*
|
|
22
|
-
* @param text - The input text to be trimmed.
|
|
23
|
-
* @returns The trimmed text with removed extra spaces.
|
|
24
17
|
*/
|
|
25
18
|
export const trimExtraSpaces = (text) => {
|
|
26
19
|
if (!text)
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
export * from './animations';
|
|
2
|
+
export * from './api';
|
|
1
3
|
export * from './auth';
|
|
4
|
+
export * from './browser-storage';
|
|
2
5
|
export * from './constants';
|
|
6
|
+
export * from './custom-code';
|
|
3
7
|
export * from './helpers';
|
|
4
8
|
export * from './logger';
|
|
9
|
+
export * from './webflow-canvas';
|
package/dist/utils/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
export * from './animations';
|
|
2
|
+
export * from './api';
|
|
1
3
|
export * from './auth';
|
|
4
|
+
export * from './browser-storage';
|
|
2
5
|
export * from './constants';
|
|
6
|
+
export * from './custom-code';
|
|
3
7
|
export * from './helpers';
|
|
4
8
|
export * from './logger';
|
|
9
|
+
export * from './webflow-canvas';
|
|
@@ -13,7 +13,5 @@ export interface Logger {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Create a logger instance for the given context
|
|
16
|
-
* @param context - The context/identity for this logger instance
|
|
17
|
-
* @returns Logger instance with all log methods
|
|
18
16
|
*/
|
|
19
17
|
export declare function getLogger(context: LoggerContext): Logger;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
import { getFinsweetComponentsEnvironment } from '../api';
|
|
3
3
|
/**
|
|
4
4
|
* Create a logger instance for the given context
|
|
5
|
-
* @param context - The context/identity for this logger instance
|
|
6
|
-
* @returns Logger instance with all log methods
|
|
7
5
|
*/
|
|
8
6
|
export function getLogger(context) {
|
|
9
7
|
const createLogMethod = (level) => {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {AnyElement} params.element - The data object of the element.
|
|
4
|
-
* @returns
|
|
2
|
+
* Gets all custom attributes from a Webflow element.
|
|
5
3
|
*/
|
|
6
4
|
export declare const getAllWebflowElementAttributes: (element: AnyElement) => Promise<NamedValue[] | null>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { getLogger } from '../../logger';
|
|
2
2
|
const logger = getLogger('webflow-apps-ui-utils');
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {AnyElement} params.element - The data object of the element.
|
|
6
|
-
* @returns
|
|
4
|
+
* Gets all custom attributes from a Webflow element.
|
|
7
5
|
*/
|
|
8
6
|
export const getAllWebflowElementAttributes = async (element) => {
|
|
9
7
|
try {
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param obj - The object to get the instance names from
|
|
4
|
-
* @param component - The component key
|
|
5
|
-
* @param hasInstances - Whether the object has instances
|
|
6
|
-
* @returns The instance names
|
|
2
|
+
* Gets instance names from an object based on component configuration.
|
|
7
3
|
*/
|
|
8
4
|
export declare const getInstanceNamesFromObject: (obj: Record<string, any>, component: string, hasInstances?: boolean) => string[];
|