@getmicdrop/svelte-components 5.5.5 → 5.6.1
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/dist/calendar/AboutShow/AboutShow.svelte +172 -172
- package/dist/calendar/Calendar/MiniMonthCalendar.svelte +782 -782
- package/dist/calendar/FAQs/FAQs.svelte +75 -75
- package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte +126 -126
- package/dist/calendar/OrderSummary/OrderSummary.svelte +367 -367
- package/dist/calendar/PublicCard/PublicCard.svelte +134 -134
- package/dist/calendar/ShowCard/ShowCard.svelte +157 -157
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte +61 -61
- package/dist/components/Layout/AppShell.svelte +104 -0
- package/dist/components/Layout/AppShell.svelte.d.ts +26 -0
- package/dist/components/Layout/AppShell.svelte.d.ts.map +1 -0
- package/dist/components/Layout/ContentSection.svelte +80 -0
- package/dist/components/Layout/ContentSection.svelte.d.ts +23 -0
- package/dist/components/Layout/ContentSection.svelte.d.ts.map +1 -0
- package/dist/components/Layout/Grid.svelte +4 -4
- package/dist/components/Layout/Heading.svelte +81 -0
- package/dist/components/Layout/Heading.svelte.d.ts +24 -0
- package/dist/components/Layout/Heading.svelte.d.ts.map +1 -0
- package/dist/components/Layout/PageContainer.svelte +69 -0
- package/dist/components/Layout/PageContainer.svelte.d.ts +23 -0
- package/dist/components/Layout/PageContainer.svelte.d.ts.map +1 -0
- package/dist/components/Layout/Responsive.svelte +75 -0
- package/dist/components/Layout/Responsive.svelte.d.ts +19 -0
- package/dist/components/Layout/Responsive.svelte.d.ts.map +1 -0
- package/dist/components/Layout/Section.svelte +80 -80
- package/dist/components/Layout/ShowOnDesktop.svelte +37 -0
- package/dist/components/Layout/ShowOnDesktop.svelte.d.ts +16 -0
- package/dist/components/Layout/ShowOnDesktop.svelte.d.ts.map +1 -0
- package/dist/components/Layout/ShowOnMobile.svelte +37 -0
- package/dist/components/Layout/ShowOnMobile.svelte.d.ts +16 -0
- package/dist/components/Layout/ShowOnMobile.svelte.d.ts.map +1 -0
- package/dist/components/Layout/Sidebar.svelte +108 -108
- package/dist/components/Layout/Stack.spec.js +1 -1
- package/dist/components/Layout/Stack.svelte +6 -6
- package/dist/components/Layout/Text.svelte +87 -0
- package/dist/components/Layout/Text.svelte.d.ts +28 -0
- package/dist/components/Layout/Text.svelte.d.ts.map +1 -0
- package/dist/components/Layout/TwoColumn.svelte +108 -0
- package/dist/components/Layout/TwoColumn.svelte.d.ts +28 -0
- package/dist/components/Layout/TwoColumn.svelte.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/AppShell.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/AppShell.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/AppShell.test.js +95 -0
- package/dist/components/Layout/__tests__/ContentSection.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/ContentSection.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/ContentSection.test.js +112 -0
- package/dist/components/Layout/__tests__/Heading.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/Heading.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/Heading.test.js +123 -0
- package/dist/components/Layout/__tests__/PageContainer.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/PageContainer.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/PageContainer.test.js +133 -0
- package/dist/components/Layout/__tests__/Responsive.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/Responsive.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/Responsive.test.js +123 -0
- package/dist/components/Layout/__tests__/ShowOnDesktop.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/ShowOnDesktop.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/ShowOnDesktop.test.js +84 -0
- package/dist/components/Layout/__tests__/ShowOnMobile.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/ShowOnMobile.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/ShowOnMobile.test.js +80 -0
- package/dist/components/Layout/__tests__/Text.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/Text.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/Text.test.js +146 -0
- package/dist/components/Layout/__tests__/TwoColumn.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/TwoColumn.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/TwoColumn.test.js +129 -0
- package/dist/constants/validation.js +91 -91
- package/dist/constants/validation.spec.js +64 -64
- package/dist/datetime/__tests__/format.test.js +1 -1
- package/dist/datetime/__tests__/parse.test.js +1 -1
- package/dist/datetime/__tests__/timezone.test.js +1 -1
- package/dist/datetime/parse.js +1 -1
- package/dist/forms/createFormStore.svelte.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/patterns/data/DataGrid.svelte +45 -45
- package/dist/patterns/data/DataList.svelte +24 -24
- package/dist/patterns/data/DataTable.svelte +36 -36
- package/dist/patterns/forms/FormActions.spec.js +95 -95
- package/dist/patterns/forms/FormActions.stories.svelte +97 -97
- package/dist/patterns/forms/FormActions.svelte +46 -46
- package/dist/patterns/forms/FormGrid.svelte +33 -33
- package/dist/patterns/forms/FormSection.svelte +32 -32
- package/dist/patterns/forms/FormValidationSummary.stories.svelte +83 -83
- package/dist/patterns/forms/FormValidationSummary.svelte +74 -74
- package/dist/patterns/layout/Sidebar.svelte +39 -39
- package/dist/patterns/layout/index.d.ts +9 -0
- package/dist/patterns/layout/index.js +22 -0
- package/dist/patterns/navigation/BottomNav.stories.svelte +117 -117
- package/dist/patterns/navigation/BottomNav.svelte +74 -64
- package/dist/patterns/navigation/BottomNav.svelte.d.ts.map +1 -1
- package/dist/patterns/navigation/Header.stories.svelte +77 -77
- package/dist/patterns/navigation/Header.svelte +193 -193
- package/dist/patterns/page/PageHeader.svelte +18 -18
- package/dist/patterns/page/PageLayout.svelte +40 -40
- package/dist/patterns/page/PageLoader.spec.js +57 -57
- package/dist/patterns/page/PageLoader.stories.svelte +137 -137
- package/dist/patterns/page/PageLoader.svelte +24 -24
- package/dist/patterns/page/SectionHeader.svelte +29 -29
- package/dist/presets/badges.js +112 -112
- package/dist/presets/buttons.js +76 -76
- package/dist/presets/index.js +9 -9
- package/dist/primitives/Accordion/Accordion.stories.svelte +75 -75
- package/dist/primitives/Accordion/Accordion.svelte +42 -42
- package/dist/primitives/Accordion/AccordionItem.svelte +95 -95
- package/dist/primitives/Accordion/AccordionItemWrapper.test.svelte +107 -107
- package/dist/primitives/Accordion/AccordionItemWrapper.test.svelte.d.ts +2 -2
- package/dist/primitives/Accordion/AccordionItemWrapper.test.svelte.d.ts.map +1 -1
- package/dist/primitives/Alert/Alert.spec.js +173 -173
- package/dist/primitives/Alert/Alert.stories.svelte +88 -88
- package/dist/primitives/Alert/Alert.svelte +27 -27
- package/dist/primitives/Avatar/Avatar.stories.svelte +94 -94
- package/dist/primitives/Avatar/Avatar.svelte +66 -66
- package/dist/primitives/Badges/Badge.spec.js +144 -144
- package/dist/primitives/Badges/Badge.stories.svelte +86 -86
- package/dist/primitives/Badges/Badge.svelte +79 -79
- package/dist/primitives/BottomSheet/BottomSheet.spec.js +136 -136
- package/dist/primitives/BottomSheet/BottomSheet.stories.svelte +83 -83
- package/dist/primitives/BottomSheet/BottomSheet.svelte +100 -100
- package/dist/primitives/Breadcrumb/Breadcrumb.spec.js +122 -122
- package/dist/primitives/Breadcrumb/Breadcrumb.stories.svelte +23 -23
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +89 -89
- package/dist/primitives/Button/Button.spec.js +223 -223
- package/dist/primitives/Button/Button.stories.svelte +76 -76
- package/dist/primitives/Button/Button.svelte +270 -270
- package/dist/primitives/Button/ButtonSaveDemo.spec.js +146 -146
- package/dist/primitives/Button/ButtonSaveDemo.svelte +25 -25
- package/dist/primitives/Button/ButtonVariantShowcase.svelte +129 -129
- package/dist/primitives/Card.spec.js +49 -49
- package/dist/primitives/Card.stories.svelte +22 -22
- package/dist/primitives/Card.svelte +28 -28
- package/dist/primitives/Checkbox/Checkbox.stories.svelte +84 -84
- package/dist/primitives/Checkbox/Checkbox.svelte +88 -88
- package/dist/primitives/DarkModeToggle.spec.js +390 -390
- package/dist/primitives/DarkModeToggle.stories.svelte +57 -57
- package/dist/primitives/DarkModeToggle.svelte +136 -136
- package/dist/primitives/Drawer/Drawer.stories.svelte +80 -80
- package/dist/primitives/Drawer/Drawer.svelte +120 -120
- package/dist/primitives/Dropdown/Dropdown.stories.svelte +137 -137
- package/dist/primitives/Dropdown/Dropdown.svelte +14 -14
- package/dist/primitives/Dropdown/DropdownDivider.svelte +9 -0
- package/dist/primitives/Dropdown/DropdownDivider.svelte.d.ts +7 -0
- package/dist/primitives/Dropdown/DropdownDivider.svelte.d.ts.map +1 -0
- package/dist/primitives/Dropdown/DropdownItem.svelte +80 -80
- package/dist/primitives/Helper/Helper.svelte +33 -0
- package/dist/primitives/Helper/Helper.svelte.d.ts +18 -0
- package/dist/primitives/Helper/Helper.svelte.d.ts.map +1 -0
- package/dist/primitives/Icons/ArrowLeft.svelte +8 -8
- package/dist/primitives/Icons/ArrowRight.svelte +8 -8
- package/dist/primitives/Icons/Availability.svelte +14 -14
- package/dist/primitives/Icons/Back.svelte +14 -14
- package/dist/primitives/Icons/CheckCircle.svelte +6 -6
- package/dist/primitives/Icons/CheckCircleOutline.svelte +15 -15
- package/dist/primitives/Icons/ChevronLeft.svelte +4 -4
- package/dist/primitives/Icons/ChevronRight.svelte +4 -4
- package/dist/primitives/Icons/Copy.svelte +15 -15
- package/dist/primitives/Icons/Cross.svelte +5 -5
- package/dist/primitives/Icons/DownArrow.svelte +8 -8
- package/dist/primitives/Icons/ErrorCircle.svelte +6 -6
- package/dist/primitives/Icons/FacebookIcon.svelte +2 -2
- package/dist/primitives/Icons/Home.svelte +15 -15
- package/dist/primitives/Icons/Icon.spec.js +169 -169
- package/dist/primitives/Icons/Icon.stories.svelte +100 -100
- package/dist/primitives/Icons/Icon.svelte +52 -52
- package/dist/primitives/Icons/IconGallery.stories.svelte +235 -235
- package/dist/primitives/Icons/Info.svelte +7 -7
- package/dist/primitives/Icons/InstagramIcon.svelte +4 -4
- package/dist/primitives/Icons/LogoInstagram.svelte +2 -2
- package/dist/primitives/Icons/Message.svelte +15 -15
- package/dist/primitives/Icons/MoonIcon.svelte +5 -5
- package/dist/primitives/Icons/More.svelte +21 -21
- package/dist/primitives/Icons/MoreHori.spec.js +61 -61
- package/dist/primitives/Icons/MoreHori.svelte +22 -22
- package/dist/primitives/Icons/Notification.svelte +14 -14
- package/dist/primitives/Icons/Payment.svelte +14 -14
- package/dist/primitives/Icons/Profile.svelte +21 -21
- package/dist/primitives/Icons/Reload.svelte +29 -29
- package/dist/primitives/Icons/Shows.svelte +21 -21
- package/dist/primitives/Icons/Signout.svelte +21 -21
- package/dist/primitives/Icons/SunIcon.svelte +8 -8
- package/dist/primitives/Icons/TiktokIcon.svelte +2 -2
- package/dist/primitives/Icons/TwitterIcon.svelte +2 -2
- package/dist/primitives/Icons/WarningIcon.spec.js +18 -18
- package/dist/primitives/Icons/WarningIcon.svelte +5 -5
- package/dist/primitives/Input/Input.spec.js +573 -573
- package/dist/primitives/Input/Input.stories.svelte +139 -139
- package/dist/primitives/Input/Input.svelte +1 -2
- package/dist/primitives/Input/Input.svelte.d.ts +2 -4
- package/dist/primitives/Input/Input.svelte.d.ts.map +1 -1
- package/dist/primitives/Input/Select.spec.js +212 -212
- package/dist/primitives/Input/Select.stories.svelte +112 -112
- package/dist/primitives/Input/Select.svelte +128 -128
- package/dist/primitives/Input/Textarea.stories.svelte +137 -137
- package/dist/primitives/Input/Textarea.svelte +35 -35
- package/dist/primitives/Label/Label.svelte +37 -37
- package/dist/primitives/Modal/Modal.spec.js +99 -99
- package/dist/primitives/Modal/Modal.stories.svelte +86 -86
- package/dist/primitives/Modal/Modal.svelte +3 -4
- package/dist/primitives/Modal/Modal.svelte.d.ts +6 -8
- package/dist/primitives/Modal/Modal.svelte.d.ts.map +1 -1
- package/dist/primitives/NumberInput/NumberInput.svelte +0 -1
- package/dist/primitives/NumberInput/NumberInput.svelte.d.ts +0 -2
- package/dist/primitives/NumberInput/NumberInput.svelte.d.ts.map +1 -1
- package/dist/primitives/Pagination/Pagination.stories.svelte +76 -76
- package/dist/primitives/Pagination/Pagination.svelte +261 -261
- package/dist/primitives/Radio/Radio.stories.svelte +80 -80
- package/dist/primitives/Radio/Radio.svelte +67 -67
- package/dist/primitives/Skeleton/CardPlaceholder.svelte +87 -87
- package/dist/primitives/Skeleton/ImagePlaceholder.svelte +59 -59
- package/dist/primitives/Skeleton/ListPlaceholder.svelte +76 -76
- package/dist/primitives/Skeleton/Skeleton.stories.svelte +151 -151
- package/dist/primitives/Skeleton/Skeleton.svelte +26 -26
- package/dist/primitives/Spinner/Spinner.spec.js +71 -71
- package/dist/primitives/Spinner/Spinner.stories.svelte +29 -29
- package/dist/primitives/Spinner/Spinner.svelte +20 -20
- package/dist/primitives/Tabs/TabItem.svelte +49 -49
- package/dist/primitives/Tabs/Tabs.stories.svelte +112 -112
- package/dist/primitives/Tabs/Tabs.svelte +123 -123
- package/dist/primitives/Toggle.spec.js +143 -143
- package/dist/primitives/Toggle.stories.svelte +92 -92
- package/dist/primitives/Toggle.svelte +1 -2
- package/dist/primitives/Toggle.svelte.d.ts +2 -4
- package/dist/primitives/Toggle.svelte.d.ts.map +1 -1
- package/dist/primitives/Tooltip/Tooltip.svelte +83 -0
- package/dist/primitives/Tooltip/Tooltip.svelte.d.ts +15 -0
- package/dist/primitives/Tooltip/Tooltip.svelte.d.ts.map +1 -0
- package/dist/primitives/Typography/Typography.svelte +53 -53
- package/dist/primitives/ValidationError.spec.js +103 -103
- package/dist/primitives/ValidationError.stories.svelte +69 -69
- package/dist/primitives/ValidationError.svelte +29 -29
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +91 -84
- package/dist/recipes/CropImage/CropImage.spec.js +208 -208
- package/dist/recipes/CropImage/CropImage.stories.svelte +104 -104
- package/dist/recipes/CropImage/CropImage.svelte +238 -238
- package/dist/recipes/ImageUploader/ImageUploader.spec.js +6 -5
- package/dist/recipes/ImageUploader/ImageUploader.stories.svelte +125 -125
- package/dist/recipes/ImageUploader/ImageUploader.svelte +804 -804
- package/dist/recipes/SuperLogin/SuperLogin.spec.js +17 -17
- package/dist/recipes/Toaster/Toaster.stories.svelte +62 -62
- package/dist/recipes/feedback/EmptyState/EmptyState.svelte +1 -1
- package/dist/recipes/feedback/ErrorDisplay.spec.js +69 -69
- package/dist/recipes/feedback/ErrorDisplay.stories.svelte +101 -101
- package/dist/recipes/feedback/ErrorDisplay.svelte +1 -1
- package/dist/recipes/feedback/StatusIndicator/StatusIndicator.spec.js +133 -133
- package/dist/recipes/feedback/StatusIndicator/StatusIndicator.svelte +157 -157
- package/dist/recipes/fields/CheckboxField.svelte +85 -85
- package/dist/recipes/fields/FormField.svelte +58 -58
- package/dist/recipes/fields/RadioGroup.svelte +95 -95
- package/dist/recipes/fields/SelectField.svelte +80 -80
- package/dist/recipes/fields/TextareaField.svelte +97 -97
- package/dist/recipes/fields/ToggleField.svelte +60 -60
- package/dist/recipes/fields/index.js +7 -7
- package/dist/recipes/inputs/MultiSelect.spec.js +258 -258
- package/dist/recipes/inputs/MultiSelect.stories.svelte +133 -133
- package/dist/recipes/inputs/MultiSelect.svelte +29 -8
- package/dist/recipes/inputs/MultiSelect.svelte.d.ts +54 -21
- package/dist/recipes/inputs/MultiSelect.svelte.d.ts.map +1 -1
- package/dist/recipes/inputs/OTPInput.spec.js +251 -251
- package/dist/recipes/inputs/OTPInput.stories.svelte +162 -162
- package/dist/recipes/inputs/OTPInput.svelte +29 -29
- package/dist/recipes/inputs/PasswordInput.svelte +22 -22
- package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte +117 -117
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.spec.js +9 -4
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.stories.svelte +123 -123
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +30 -25
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts +12 -1
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts.map +1 -1
- package/dist/recipes/inputs/Search.svelte +37 -37
- package/dist/recipes/inputs/SelectDropdown.svelte +57 -57
- package/dist/recipes/modals/AlertModal.svelte +130 -130
- package/dist/recipes/modals/ConfirmationModal.spec.js +206 -206
- package/dist/recipes/modals/ConfirmationModal.stories.svelte +119 -119
- package/dist/recipes/modals/ConfirmationModal.svelte +152 -152
- package/dist/recipes/modals/InputModal.svelte +182 -182
- package/dist/recipes/modals/ModalStateManager.spec.js +100 -100
- package/dist/recipes/modals/ModalStateManager.svelte +77 -77
- package/dist/recipes/modals/ModalTestWrapper.svelte +65 -65
- package/dist/recipes/modals/StatusModal.svelte +206 -206
- package/dist/services/EventService.js +75 -75
- package/dist/services/EventService.spec.js +217 -217
- package/dist/services/ShowService.spec.js +345 -345
- package/dist/stores/auth.js +44 -36
- package/dist/stores/auth.spec.js +139 -139
- package/dist/stores/auth.svelte.d.ts +39 -0
- package/dist/stores/auth.svelte.d.ts.map +1 -0
- package/dist/stores/auth.svelte.js +60 -0
- package/dist/stores/formDataStore.d.ts.map +1 -1
- package/dist/stores/formDataStore.js +8 -0
- package/dist/stores/formDataStore.svelte.d.ts +47 -0
- package/dist/stores/formDataStore.svelte.d.ts.map +1 -0
- package/dist/stores/formDataStore.svelte.js +84 -0
- package/dist/stores/formSave.d.ts.map +1 -1
- package/dist/stores/formSave.js +8 -0
- package/dist/stores/formSave.svelte.d.ts +33 -0
- package/dist/stores/formSave.svelte.d.ts.map +1 -0
- package/dist/stores/formSave.svelte.js +113 -0
- package/dist/stores/navigation.d.ts.map +1 -1
- package/dist/stores/navigation.js +8 -0
- package/dist/stores/navigation.svelte.d.ts +35 -0
- package/dist/stores/navigation.svelte.d.ts.map +1 -0
- package/dist/stores/navigation.svelte.js +69 -0
- package/dist/stores/toaster.js +13 -13
- package/dist/stories/ButtonAuditReview.stories.svelte +14 -14
- package/dist/stories/ButtonAuditReview.svelte +427 -427
- package/dist/stories/PatternsGallery.stories.svelte +19 -19
- package/dist/stories/PatternsGallery.svelte +206 -206
- package/dist/stories/PrimitivesGallery.stories.svelte +19 -19
- package/dist/stories/PrimitivesGallery.svelte +725 -725
- package/dist/stories/RecipesGallery.stories.svelte +19 -19
- package/dist/stories/RecipesGallery.svelte +271 -271
- package/dist/stories/button-audit-manifest.json +11186 -11186
- package/dist/tailwind/preset.cjs +82 -82
- package/dist/telemetry.js +405 -405
- package/dist/telemetry.server.spec.js +11 -8
- package/dist/telemetry.spec.js +1169 -1144
- package/dist/tokens/__tests__/typography-base.test.d.ts +2 -0
- package/dist/tokens/__tests__/typography-base.test.d.ts.map +1 -0
- package/dist/tokens/__tests__/typography-base.test.js +138 -0
- package/dist/tokens/tokens.css +87 -87
- package/dist/tokens/typography-base.css +163 -0
- package/dist/utils/apiConfig.spec.js +219 -219
- package/dist/utils/imageValidation.spec.js +62 -59
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +47 -0
- package/dist/utils/transitions.js +62 -62
- package/dist/utils/utils.js +354 -354
- package/package.json +21 -16
package/dist/stores/auth.js
CHANGED
|
@@ -1,36 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use the Svelte 5 runes version from './auth.svelte.ts' instead.
|
|
3
|
+
* This file is maintained for backwards compatibility with Svelte 4 components.
|
|
4
|
+
*/
|
|
5
|
+
import { writable } from "svelte/store";
|
|
6
|
+
|
|
7
|
+
console.warn(
|
|
8
|
+
"[DEPRECATED] auth.js is deprecated. Use auth.svelte.ts for Svelte 5 runes."
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
// Store to manage authentication state
|
|
12
|
+
export const auth = writable({
|
|
13
|
+
isAuthenticated: false,
|
|
14
|
+
token: null,
|
|
15
|
+
userDetails: null, // To store email and first name
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Function to set authentication state
|
|
19
|
+
export const setAuthState = (state) => {
|
|
20
|
+
auth.set(state);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Function to clear the authentication state
|
|
24
|
+
export const clearAuthState = () => {
|
|
25
|
+
auth.set({ isAuthenticated: false, token: null, userDetails: null });
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Initialize the store from cookies
|
|
29
|
+
export const initializeAuthState = () => {
|
|
30
|
+
const cookies = Object.fromEntries(
|
|
31
|
+
document.cookie
|
|
32
|
+
.split("; ")
|
|
33
|
+
.map((c) => c.split("="))
|
|
34
|
+
.map(([k, v]) => [k, decodeURIComponent(v)])
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (cookies.performer_token) {
|
|
38
|
+
setAuthState({
|
|
39
|
+
isAuthenticated: true,
|
|
40
|
+
token: cookies.performer_token,
|
|
41
|
+
userDetails: cookies.userDetails ? JSON.parse(cookies.userDetails) : null,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
package/dist/stores/auth.spec.js
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { get } from 'svelte/store';
|
|
3
|
-
import { auth, setAuthState, clearAuthState, initializeAuthState } from './auth';
|
|
4
|
-
|
|
5
|
-
describe('auth store', () => {
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
// Reset auth state before each test
|
|
8
|
-
clearAuthState();
|
|
9
|
-
// Clear cookies
|
|
10
|
-
Object.defineProperty(document, 'cookie', {
|
|
11
|
-
writable: true,
|
|
12
|
-
value: '',
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('initial state', () => {
|
|
17
|
-
it('starts with isAuthenticated as false', () => {
|
|
18
|
-
expect(get(auth).isAuthenticated).toBe(false);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('starts with token as null', () => {
|
|
22
|
-
expect(get(auth).token).toBe(null);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('starts with userDetails as null', () => {
|
|
26
|
-
expect(get(auth).userDetails).toBe(null);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe('setAuthState', () => {
|
|
31
|
-
it('sets authentication state', () => {
|
|
32
|
-
setAuthState({
|
|
33
|
-
isAuthenticated: true,
|
|
34
|
-
token: 'test-token',
|
|
35
|
-
userDetails: { email: 'test@test.com' },
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const state = get(auth);
|
|
39
|
-
expect(state.isAuthenticated).toBe(true);
|
|
40
|
-
expect(state.token).toBe('test-token');
|
|
41
|
-
expect(state.userDetails).toEqual({ email: 'test@test.com' });
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('can update partial state', () => {
|
|
45
|
-
setAuthState({ isAuthenticated: true, token: 'token1', userDetails: null });
|
|
46
|
-
setAuthState({ isAuthenticated: true, token: 'token2', userDetails: { name: 'User' } });
|
|
47
|
-
|
|
48
|
-
const state = get(auth);
|
|
49
|
-
expect(state.token).toBe('token2');
|
|
50
|
-
expect(state.userDetails).toEqual({ name: 'User' });
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe('clearAuthState', () => {
|
|
55
|
-
it('clears authentication state', () => {
|
|
56
|
-
setAuthState({
|
|
57
|
-
isAuthenticated: true,
|
|
58
|
-
token: 'test-token',
|
|
59
|
-
userDetails: { email: 'test@test.com' },
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
clearAuthState();
|
|
63
|
-
|
|
64
|
-
const state = get(auth);
|
|
65
|
-
expect(state.isAuthenticated).toBe(false);
|
|
66
|
-
expect(state.token).toBe(null);
|
|
67
|
-
expect(state.userDetails).toBe(null);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('initializeAuthState', () => {
|
|
72
|
-
it('does nothing when no performer_token cookie exists', () => {
|
|
73
|
-
Object.defineProperty(document, 'cookie', {
|
|
74
|
-
writable: true,
|
|
75
|
-
value: '',
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
initializeAuthState();
|
|
79
|
-
|
|
80
|
-
const state = get(auth);
|
|
81
|
-
expect(state.isAuthenticated).toBe(false);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('sets auth state from performer_token cookie', () => {
|
|
85
|
-
Object.defineProperty(document, 'cookie', {
|
|
86
|
-
writable: true,
|
|
87
|
-
value: 'performer_token=my-token',
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
initializeAuthState();
|
|
91
|
-
|
|
92
|
-
const state = get(auth);
|
|
93
|
-
expect(state.isAuthenticated).toBe(true);
|
|
94
|
-
expect(state.token).toBe('my-token');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('parses userDetails cookie when present', () => {
|
|
98
|
-
const userDetails = JSON.stringify({ email: 'test@test.com', firstName: 'Test' });
|
|
99
|
-
Object.defineProperty(document, 'cookie', {
|
|
100
|
-
writable: true,
|
|
101
|
-
value: `performer_token=my-token; userDetails=${encodeURIComponent(userDetails)}`,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
initializeAuthState();
|
|
105
|
-
|
|
106
|
-
const state = get(auth);
|
|
107
|
-
expect(state.userDetails).toEqual({ email: 'test@test.com', firstName: 'Test' });
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('handles missing userDetails cookie', () => {
|
|
111
|
-
Object.defineProperty(document, 'cookie', {
|
|
112
|
-
writable: true,
|
|
113
|
-
value: 'performer_token=my-token',
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
initializeAuthState();
|
|
117
|
-
|
|
118
|
-
const state = get(auth);
|
|
119
|
-
expect(state.isAuthenticated).toBe(true);
|
|
120
|
-
expect(state.userDetails).toBe(null);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
describe('store subscription', () => {
|
|
125
|
-
it('can subscribe to auth changes', () => {
|
|
126
|
-
const values = [];
|
|
127
|
-
const unsubscribe = auth.subscribe((value) => {
|
|
128
|
-
values.push(value.isAuthenticated);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
setAuthState({ isAuthenticated: true, token: 'token', userDetails: null });
|
|
132
|
-
clearAuthState();
|
|
133
|
-
|
|
134
|
-
unsubscribe();
|
|
135
|
-
|
|
136
|
-
expect(values).toEqual([false, true, false]);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { get } from 'svelte/store';
|
|
3
|
+
import { auth, setAuthState, clearAuthState, initializeAuthState } from './auth';
|
|
4
|
+
|
|
5
|
+
describe('auth store', () => {
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
// Reset auth state before each test
|
|
8
|
+
clearAuthState();
|
|
9
|
+
// Clear cookies
|
|
10
|
+
Object.defineProperty(document, 'cookie', {
|
|
11
|
+
writable: true,
|
|
12
|
+
value: '',
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('initial state', () => {
|
|
17
|
+
it('starts with isAuthenticated as false', () => {
|
|
18
|
+
expect(get(auth).isAuthenticated).toBe(false);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('starts with token as null', () => {
|
|
22
|
+
expect(get(auth).token).toBe(null);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('starts with userDetails as null', () => {
|
|
26
|
+
expect(get(auth).userDetails).toBe(null);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('setAuthState', () => {
|
|
31
|
+
it('sets authentication state', () => {
|
|
32
|
+
setAuthState({
|
|
33
|
+
isAuthenticated: true,
|
|
34
|
+
token: 'test-token',
|
|
35
|
+
userDetails: { email: 'test@test.com' },
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const state = get(auth);
|
|
39
|
+
expect(state.isAuthenticated).toBe(true);
|
|
40
|
+
expect(state.token).toBe('test-token');
|
|
41
|
+
expect(state.userDetails).toEqual({ email: 'test@test.com' });
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('can update partial state', () => {
|
|
45
|
+
setAuthState({ isAuthenticated: true, token: 'token1', userDetails: null });
|
|
46
|
+
setAuthState({ isAuthenticated: true, token: 'token2', userDetails: { name: 'User' } });
|
|
47
|
+
|
|
48
|
+
const state = get(auth);
|
|
49
|
+
expect(state.token).toBe('token2');
|
|
50
|
+
expect(state.userDetails).toEqual({ name: 'User' });
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('clearAuthState', () => {
|
|
55
|
+
it('clears authentication state', () => {
|
|
56
|
+
setAuthState({
|
|
57
|
+
isAuthenticated: true,
|
|
58
|
+
token: 'test-token',
|
|
59
|
+
userDetails: { email: 'test@test.com' },
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
clearAuthState();
|
|
63
|
+
|
|
64
|
+
const state = get(auth);
|
|
65
|
+
expect(state.isAuthenticated).toBe(false);
|
|
66
|
+
expect(state.token).toBe(null);
|
|
67
|
+
expect(state.userDetails).toBe(null);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('initializeAuthState', () => {
|
|
72
|
+
it('does nothing when no performer_token cookie exists', () => {
|
|
73
|
+
Object.defineProperty(document, 'cookie', {
|
|
74
|
+
writable: true,
|
|
75
|
+
value: '',
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
initializeAuthState();
|
|
79
|
+
|
|
80
|
+
const state = get(auth);
|
|
81
|
+
expect(state.isAuthenticated).toBe(false);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('sets auth state from performer_token cookie', () => {
|
|
85
|
+
Object.defineProperty(document, 'cookie', {
|
|
86
|
+
writable: true,
|
|
87
|
+
value: 'performer_token=my-token',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
initializeAuthState();
|
|
91
|
+
|
|
92
|
+
const state = get(auth);
|
|
93
|
+
expect(state.isAuthenticated).toBe(true);
|
|
94
|
+
expect(state.token).toBe('my-token');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('parses userDetails cookie when present', () => {
|
|
98
|
+
const userDetails = JSON.stringify({ email: 'test@test.com', firstName: 'Test' });
|
|
99
|
+
Object.defineProperty(document, 'cookie', {
|
|
100
|
+
writable: true,
|
|
101
|
+
value: `performer_token=my-token; userDetails=${encodeURIComponent(userDetails)}`,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
initializeAuthState();
|
|
105
|
+
|
|
106
|
+
const state = get(auth);
|
|
107
|
+
expect(state.userDetails).toEqual({ email: 'test@test.com', firstName: 'Test' });
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('handles missing userDetails cookie', () => {
|
|
111
|
+
Object.defineProperty(document, 'cookie', {
|
|
112
|
+
writable: true,
|
|
113
|
+
value: 'performer_token=my-token',
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
initializeAuthState();
|
|
117
|
+
|
|
118
|
+
const state = get(auth);
|
|
119
|
+
expect(state.isAuthenticated).toBe(true);
|
|
120
|
+
expect(state.userDetails).toBe(null);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
describe('store subscription', () => {
|
|
125
|
+
it('can subscribe to auth changes', () => {
|
|
126
|
+
const values = [];
|
|
127
|
+
const unsubscribe = auth.subscribe((value) => {
|
|
128
|
+
values.push(value.isAuthenticated);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
setAuthState({ isAuthenticated: true, token: 'token', userDetails: null });
|
|
132
|
+
clearAuthState();
|
|
133
|
+
|
|
134
|
+
unsubscribe();
|
|
135
|
+
|
|
136
|
+
expect(values).toEqual([false, true, false]);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication store using Svelte 5 runes
|
|
3
|
+
* Manages authentication state for the components library
|
|
4
|
+
*/
|
|
5
|
+
interface UserDetails {
|
|
6
|
+
email?: string;
|
|
7
|
+
firstName?: string;
|
|
8
|
+
lastName?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
interface AuthState {
|
|
12
|
+
isAuthenticated: boolean;
|
|
13
|
+
token: string | null;
|
|
14
|
+
userDetails: UserDetails | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Authentication store
|
|
18
|
+
*/
|
|
19
|
+
export declare const auth: {
|
|
20
|
+
readonly value: AuthState;
|
|
21
|
+
readonly isAuthenticated: boolean;
|
|
22
|
+
readonly token: string | null;
|
|
23
|
+
readonly userDetails: UserDetails | null;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Set the authentication state
|
|
27
|
+
*/
|
|
28
|
+
export declare function setAuthState(state: AuthState): void;
|
|
29
|
+
/**
|
|
30
|
+
* Clear the authentication state
|
|
31
|
+
*/
|
|
32
|
+
export declare function clearAuthState(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the store from cookies
|
|
35
|
+
* Should only be called in browser environment
|
|
36
|
+
*/
|
|
37
|
+
export declare function initializeAuthState(): void;
|
|
38
|
+
export type { AuthState, UserDetails };
|
|
39
|
+
//# sourceMappingURL=auth.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/stores/auth.svelte.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,SAAS;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC;AAWD;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;CAahB,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAEnD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAkB1C;AAGD,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication store using Svelte 5 runes
|
|
3
|
+
* Manages authentication state for the components library
|
|
4
|
+
*/
|
|
5
|
+
const defaultAuthState = {
|
|
6
|
+
isAuthenticated: false,
|
|
7
|
+
token: null,
|
|
8
|
+
userDetails: null,
|
|
9
|
+
};
|
|
10
|
+
// State using Svelte 5 runes
|
|
11
|
+
let authState = $state(structuredClone(defaultAuthState));
|
|
12
|
+
/**
|
|
13
|
+
* Authentication store
|
|
14
|
+
*/
|
|
15
|
+
export const auth = {
|
|
16
|
+
get value() {
|
|
17
|
+
return authState;
|
|
18
|
+
},
|
|
19
|
+
get isAuthenticated() {
|
|
20
|
+
return authState.isAuthenticated;
|
|
21
|
+
},
|
|
22
|
+
get token() {
|
|
23
|
+
return authState.token;
|
|
24
|
+
},
|
|
25
|
+
get userDetails() {
|
|
26
|
+
return authState.userDetails;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Set the authentication state
|
|
31
|
+
*/
|
|
32
|
+
export function setAuthState(state) {
|
|
33
|
+
authState = state;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Clear the authentication state
|
|
37
|
+
*/
|
|
38
|
+
export function clearAuthState() {
|
|
39
|
+
authState = structuredClone(defaultAuthState);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Initialize the store from cookies
|
|
43
|
+
* Should only be called in browser environment
|
|
44
|
+
*/
|
|
45
|
+
export function initializeAuthState() {
|
|
46
|
+
if (typeof document === "undefined")
|
|
47
|
+
return;
|
|
48
|
+
const cookies = Object.fromEntries(document.cookie
|
|
49
|
+
.split("; ")
|
|
50
|
+
.filter((c) => c)
|
|
51
|
+
.map((c) => c.split("="))
|
|
52
|
+
.map(([k, v]) => [k, decodeURIComponent(v || "")]));
|
|
53
|
+
if (cookies.performer_token) {
|
|
54
|
+
setAuthState({
|
|
55
|
+
isAuthenticated: true,
|
|
56
|
+
token: cookies.performer_token,
|
|
57
|
+
userDetails: cookies.userDetails ? JSON.parse(cookies.userDetails) : null,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formDataStore.d.ts","sourceRoot":"","sources":["../../src/lib/stores/formDataStore.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formDataStore.d.ts","sourceRoot":"","sources":["../../src/lib/stores/formDataStore.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AAEH,oEAA8C;AAE9C,kEAKE"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use the Svelte 5 runes version from './formDataStore.svelte.ts' instead.
|
|
3
|
+
* This file is maintained for backwards compatibility with Svelte 4 components.
|
|
4
|
+
*/
|
|
1
5
|
import { writable, derived } from "svelte/store";
|
|
2
6
|
|
|
7
|
+
console.warn(
|
|
8
|
+
"[DEPRECATED] formDataStore.js is deprecated. Use formDataStore.svelte.ts for Svelte 5 runes."
|
|
9
|
+
);
|
|
10
|
+
|
|
3
11
|
export const profileFormData = writable({
|
|
4
12
|
basicInfo: {
|
|
5
13
|
firstName: "",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form data store using Svelte 5 runes
|
|
3
|
+
* Tracks profile form data and change detection
|
|
4
|
+
*/
|
|
5
|
+
interface BasicInfo {
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
email: string;
|
|
9
|
+
phone: string;
|
|
10
|
+
stageName: string;
|
|
11
|
+
location: string;
|
|
12
|
+
}
|
|
13
|
+
interface SocialMedia {
|
|
14
|
+
videoLink: string;
|
|
15
|
+
}
|
|
16
|
+
interface ProfileFormData {
|
|
17
|
+
basicInfo: BasicInfo;
|
|
18
|
+
socialMedia: SocialMedia;
|
|
19
|
+
extraDetails: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Profile form data store
|
|
23
|
+
*/
|
|
24
|
+
export declare const profileFormData: {
|
|
25
|
+
value: ProfileFormData;
|
|
26
|
+
basicInfo: BasicInfo;
|
|
27
|
+
socialMedia: SocialMedia;
|
|
28
|
+
extraDetails: Record<string, unknown>;
|
|
29
|
+
update(updater: (data: ProfileFormData) => ProfileFormData): void;
|
|
30
|
+
reset(): void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Initial form data store (for comparison)
|
|
34
|
+
*/
|
|
35
|
+
export declare const initialFormData: {
|
|
36
|
+
value: ProfileFormData | null;
|
|
37
|
+
setFromCurrent(): void;
|
|
38
|
+
reset(): void;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Derived store indicating if form has unsaved changes
|
|
42
|
+
*/
|
|
43
|
+
export declare const hasChanges: {
|
|
44
|
+
readonly value: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type { ProfileFormData, BasicInfo, SocialMedia };
|
|
47
|
+
//# sourceMappingURL=formDataStore.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formDataStore.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/stores/formDataStore.svelte.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,SAAS;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,eAAe;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AA2BD;;GAEG;AACH,eAAO,MAAM,eAAe;WAIV,eAAe;eAMX,SAAS;iBAMN,WAAW;kBAMR,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;oBAGjC,CAAC,IAAI,EAAE,eAAe,KAAK,eAAe;;CAM3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;WAIV,eAAe,GAAG,IAAI;;;CASvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU;;CAItB,CAAC;AAGF,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form data store using Svelte 5 runes
|
|
3
|
+
* Tracks profile form data and change detection
|
|
4
|
+
*/
|
|
5
|
+
const defaultFormData = {
|
|
6
|
+
basicInfo: {
|
|
7
|
+
firstName: "",
|
|
8
|
+
lastName: "",
|
|
9
|
+
email: "",
|
|
10
|
+
phone: "",
|
|
11
|
+
stageName: "",
|
|
12
|
+
location: "",
|
|
13
|
+
},
|
|
14
|
+
socialMedia: {
|
|
15
|
+
videoLink: "",
|
|
16
|
+
},
|
|
17
|
+
extraDetails: {},
|
|
18
|
+
};
|
|
19
|
+
// State using Svelte 5 runes
|
|
20
|
+
let profileFormDataState = $state(structuredClone(defaultFormData));
|
|
21
|
+
let initialFormDataState = $state(null);
|
|
22
|
+
// Derived state for change detection
|
|
23
|
+
const hasChangesValue = $derived(initialFormDataState !== null &&
|
|
24
|
+
JSON.stringify(profileFormDataState) !== JSON.stringify(initialFormDataState));
|
|
25
|
+
/**
|
|
26
|
+
* Profile form data store
|
|
27
|
+
*/
|
|
28
|
+
export const profileFormData = {
|
|
29
|
+
get value() {
|
|
30
|
+
return profileFormDataState;
|
|
31
|
+
},
|
|
32
|
+
set value(data) {
|
|
33
|
+
profileFormDataState = data;
|
|
34
|
+
},
|
|
35
|
+
get basicInfo() {
|
|
36
|
+
return profileFormDataState.basicInfo;
|
|
37
|
+
},
|
|
38
|
+
set basicInfo(info) {
|
|
39
|
+
profileFormDataState.basicInfo = info;
|
|
40
|
+
},
|
|
41
|
+
get socialMedia() {
|
|
42
|
+
return profileFormDataState.socialMedia;
|
|
43
|
+
},
|
|
44
|
+
set socialMedia(media) {
|
|
45
|
+
profileFormDataState.socialMedia = media;
|
|
46
|
+
},
|
|
47
|
+
get extraDetails() {
|
|
48
|
+
return profileFormDataState.extraDetails;
|
|
49
|
+
},
|
|
50
|
+
set extraDetails(details) {
|
|
51
|
+
profileFormDataState.extraDetails = details;
|
|
52
|
+
},
|
|
53
|
+
update(updater) {
|
|
54
|
+
profileFormDataState = updater(profileFormDataState);
|
|
55
|
+
},
|
|
56
|
+
reset() {
|
|
57
|
+
profileFormDataState = structuredClone(defaultFormData);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Initial form data store (for comparison)
|
|
62
|
+
*/
|
|
63
|
+
export const initialFormData = {
|
|
64
|
+
get value() {
|
|
65
|
+
return initialFormDataState;
|
|
66
|
+
},
|
|
67
|
+
set value(data) {
|
|
68
|
+
initialFormDataState = data;
|
|
69
|
+
},
|
|
70
|
+
setFromCurrent() {
|
|
71
|
+
initialFormDataState = structuredClone(profileFormDataState);
|
|
72
|
+
},
|
|
73
|
+
reset() {
|
|
74
|
+
initialFormDataState = null;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Derived store indicating if form has unsaved changes
|
|
79
|
+
*/
|
|
80
|
+
export const hasChanges = {
|
|
81
|
+
get value() {
|
|
82
|
+
return hasChangesValue;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formSave.d.ts","sourceRoot":"","sources":["../../src/lib/stores/formSave.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formSave.d.ts","sourceRoot":"","sources":["../../src/lib/stores/formSave.js"],"names":[],"mappings":"AAWA;;;;;;;;;GASG;AACH,yCAPG;IAAwB,QAAQ,EAAxB,MAAM;IACU,cAAc,EAA9B,MAAM;IACU,YAAY,EAA5B,MAAM;IACY,SAAS;IACT,OAAO;CACjC,GAAU,MAAM,CA6FlB;AAED;;;;GAIG;AACH,gDAHW,MAAM,GACJ,MAAM,CAsBlB"}
|
package/dist/stores/formSave.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use the Svelte 5 runes version from './formSave.svelte.ts' instead.
|
|
3
|
+
* This file is maintained for backwards compatibility with Svelte 4 components.
|
|
4
|
+
*/
|
|
1
5
|
import { writable, get } from "svelte/store";
|
|
2
6
|
import { showToast } from "./toaster";
|
|
3
7
|
|
|
8
|
+
console.warn(
|
|
9
|
+
"[DEPRECATED] formSave.js is deprecated. Use formSave.svelte.ts for Svelte 5 runes."
|
|
10
|
+
);
|
|
11
|
+
|
|
4
12
|
/**
|
|
5
13
|
* Creates a form save handler with loading and success states
|
|
6
14
|
* @param {Object} options - Configuration options
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form save utilities using Svelte 5 runes
|
|
3
|
+
* Handles form submission with loading and success states
|
|
4
|
+
*/
|
|
5
|
+
interface FormSaveOptions {
|
|
6
|
+
endpoint?: string;
|
|
7
|
+
successMessage?: string;
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
onSuccess?: () => void;
|
|
10
|
+
onError?: (error: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a form save handler with loading and success states
|
|
14
|
+
* Uses Svelte 5 runes for reactive state
|
|
15
|
+
*/
|
|
16
|
+
export declare function createFormSave(options?: FormSaveOptions): {
|
|
17
|
+
readonly isLoading: boolean;
|
|
18
|
+
readonly isSuccess: boolean;
|
|
19
|
+
readonly error: string | null;
|
|
20
|
+
save: (data: Record<string, unknown>, customEndpoint?: string | null) => Promise<boolean>;
|
|
21
|
+
resetSuccess: () => void;
|
|
22
|
+
reset: () => void;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Creates a simple dirty state tracker for forms
|
|
26
|
+
*/
|
|
27
|
+
export declare function createDirtyTracker(initialData: Record<string, unknown>): {
|
|
28
|
+
readonly isDirty: boolean;
|
|
29
|
+
check: (currentData: Record<string, unknown>) => boolean;
|
|
30
|
+
reset: (newInitialData: Record<string, unknown>) => void;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=formSave.svelte.d.ts.map
|