@intlayer/design-system 5.8.1 → 6.0.0-canary.0
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/.vite/manifest.json +34 -106
- package/dist/better-auth.CMQ3rA-I-7umXOENE.js.map +1 -1
- package/dist/better-auth.CMQ3rA-I-C2nBKRMa.cjs.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.content.cjs +3 -1
- package/dist/components/Breadcrumb/breadcrumb.content.cjs.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.content.d.ts +3 -0
- package/dist/components/Breadcrumb/breadcrumb.content.d.ts.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.content.mjs +3 -1
- package/dist/components/Breadcrumb/breadcrumb.content.mjs.map +1 -1
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/components/CopyButton/CopyButton.content.cjs +3 -1
- package/dist/components/CopyButton/CopyButton.content.cjs.map +1 -1
- package/dist/components/CopyButton/CopyButton.content.d.ts +3 -0
- package/dist/components/CopyButton/CopyButton.content.d.ts.map +1 -1
- package/dist/components/CopyButton/CopyButton.content.mjs +3 -1
- package/dist/components/CopyButton/CopyButton.content.mjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs +7 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs +7 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +83 -34
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +83 -34
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +13 -9
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +12 -8
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs +27 -13
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +27 -0
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +27 -13
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.cjs +9 -4
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts +9 -0
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs +9 -4
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +29 -25
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +27 -23
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +37 -17
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +64 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +37 -17
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs +25 -12
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +25 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs +25 -12
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +4 -5
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +4 -5
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs +25 -12
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +25 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs +25 -12
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +36 -31
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +36 -31
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +32 -28
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +32 -5
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +32 -28
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +2 -5
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -5
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs +9 -4
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts +9 -0
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs +9 -4
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs +3 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +3 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +4 -6
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts +3 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +4 -6
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs +7 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +7 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs +7 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.cjs +9 -6
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts +9 -4
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs +9 -6
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs +28 -14
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +29 -2
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs +28 -14
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs.map +1 -1
- package/dist/components/DropDown/index.cjs +2 -2
- package/dist/components/DropDown/index.cjs.map +1 -1
- package/dist/components/DropDown/index.d.ts.map +1 -1
- package/dist/components/DropDown/index.mjs +2 -2
- package/dist/components/DropDown/index.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs +2 -5
- package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.mjs +2 -5
- package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +2 -2
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
- package/dist/components/ExpandCollapse/expandCollapse.content.cjs +5 -2
- package/dist/components/ExpandCollapse/expandCollapse.content.cjs.map +1 -1
- package/dist/components/ExpandCollapse/expandCollapse.content.d.ts +3 -0
- package/dist/components/ExpandCollapse/expandCollapse.content.d.ts.map +1 -1
- package/dist/components/ExpandCollapse/expandCollapse.content.mjs +5 -2
- package/dist/components/ExpandCollapse/expandCollapse.content.mjs.map +1 -1
- package/dist/components/Flags/Flag.cjs +2 -1
- package/dist/components/Flags/Flag.cjs.map +1 -1
- package/dist/components/Flags/Flag.d.ts.map +1 -1
- package/dist/components/Flags/Flag.mjs +2 -1
- package/dist/components/Flags/Flag.mjs.map +1 -1
- package/dist/components/IDE/Code.cjs +8 -8
- package/dist/components/IDE/Code.cjs.map +1 -1
- package/dist/components/IDE/Code.mjs +8 -8
- package/dist/components/IDE/Code.mjs.map +1 -1
- package/dist/components/IDE/CodeBlockClient.cjs +1 -1
- package/dist/components/IDE/CodeBlockClient.cjs.map +1 -1
- package/dist/components/IDE/CodeBlockClient.d.ts +1 -1
- package/dist/components/IDE/CodeBlockClient.d.ts.map +1 -1
- package/dist/components/IDE/CodeBlockClient.mjs +1 -1
- package/dist/components/IDE/CodeBlockClient.mjs.map +1 -1
- package/dist/components/IDE/CodeContext.cjs +1 -3
- package/dist/components/IDE/CodeContext.cjs.map +1 -1
- package/dist/components/IDE/CodeContext.mjs +1 -3
- package/dist/components/IDE/CodeContext.mjs.map +1 -1
- package/dist/components/IDE/code.content.cjs +5 -2
- package/dist/components/IDE/code.content.cjs.map +1 -1
- package/dist/components/IDE/code.content.d.ts +5 -0
- package/dist/components/IDE/code.content.d.ts.map +1 -1
- package/dist/components/IDE/code.content.mjs +5 -2
- package/dist/components/IDE/code.content.mjs.map +1 -1
- package/dist/components/IDE/copyCode.content.cjs +5 -2
- package/dist/components/IDE/copyCode.content.cjs.map +1 -1
- package/dist/components/IDE/copyCode.content.d.ts +5 -0
- package/dist/components/IDE/copyCode.content.d.ts.map +1 -1
- package/dist/components/IDE/copyCode.content.mjs +5 -2
- package/dist/components/IDE/copyCode.content.mjs.map +1 -1
- package/dist/components/Input/Checkbox.cjs.map +1 -1
- package/dist/components/Input/Checkbox.d.ts +2 -2
- package/dist/components/Input/Checkbox.d.ts.map +1 -1
- package/dist/components/Input/Checkbox.mjs.map +1 -1
- package/dist/components/Loader/index.content.cjs +6 -1
- package/dist/components/Loader/index.content.cjs.map +1 -1
- package/dist/components/Loader/index.content.d.ts +33 -2
- package/dist/components/Loader/index.content.d.ts.map +1 -1
- package/dist/components/Loader/index.content.mjs +6 -1
- package/dist/components/Loader/index.content.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +1 -3
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -3
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +1 -3
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +1 -3
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs +17 -8
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +17 -0
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs +17 -8
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs +13 -6
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +13 -0
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs +13 -6
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +2 -4
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.mjs +2 -4
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +1 -3
- package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +1 -3
- package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/components/Navbar/index.cjs +2 -4
- package/dist/components/Navbar/index.cjs.map +1 -1
- package/dist/components/Navbar/index.mjs +2 -4
- package/dist/components/Navbar/index.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs +1 -3
- package/dist/components/SwitchSelector/index.cjs.map +1 -1
- package/dist/components/SwitchSelector/index.mjs +1 -3
- package/dist/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.cjs +1 -3
- package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.d.ts +1 -1
- package/dist/components/TabSelector/TabSelector.d.ts.map +1 -1
- package/dist/components/TabSelector/TabSelector.mjs +1 -3
- package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
- package/dist/components/Table/table.content.cjs +3 -1
- package/dist/components/Table/table.content.cjs.map +1 -1
- package/dist/components/Table/table.content.d.ts +3 -0
- package/dist/components/Table/table.content.d.ts.map +1 -1
- package/dist/components/Table/table.content.mjs +3 -1
- package/dist/components/Table/table.content.mjs.map +1 -1
- package/dist/components/Tag/index.cjs +22 -88
- package/dist/components/Tag/index.cjs.map +1 -1
- package/dist/components/Tag/index.d.ts +5 -5
- package/dist/components/Tag/index.mjs +22 -88
- package/dist/components/Tag/index.mjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.cjs +20 -21
- package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.mjs +20 -21
- package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/hooks/auth.cjs +26 -11
- package/dist/hooks/auth.cjs.map +1 -1
- package/dist/hooks/auth.mjs +26 -11
- package/dist/hooks/auth.mjs.map +1 -1
- package/dist/hooks/index.cjs +65 -66
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -3
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +4 -8
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/reactQuery.cjs +648 -0
- package/dist/hooks/reactQuery.cjs.map +1 -0
- package/dist/hooks/reactQuery.d.ts +899 -0
- package/dist/hooks/reactQuery.d.ts.map +1 -0
- package/dist/hooks/reactQuery.mjs +646 -0
- package/dist/hooks/reactQuery.mjs.map +1 -0
- package/dist/hooks/useAuth/useOAuth2.cjs +13 -10
- package/dist/hooks/useAuth/useOAuth2.cjs.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.d.ts +1 -1
- package/dist/hooks/useAuth/useOAuth2.d.ts.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.mjs +13 -10
- package/dist/hooks/useAuth/useOAuth2.mjs.map +1 -1
- package/dist/hooks/useAuth/useSession.cjs +23 -26
- package/dist/hooks/useAuth/useSession.cjs.map +1 -1
- package/dist/hooks/useAuth/useSession.d.ts +4 -352
- package/dist/hooks/useAuth/useSession.d.ts.map +1 -1
- package/dist/hooks/useAuth/useSession.mjs +23 -26
- package/dist/hooks/useAuth/useSession.mjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.cjs +2 -3
- package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.mjs +2 -3
- package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
- package/dist/hooks/useUser/index.cjs +6 -9
- package/dist/hooks/useUser/index.cjs.map +1 -1
- package/dist/hooks/useUser/index.d.ts +2 -18
- package/dist/hooks/useUser/index.d.ts.map +1 -1
- package/dist/hooks/useUser/index.mjs +6 -9
- package/dist/hooks/useUser/index.mjs.map +1 -1
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/providers/ReactQueryProvider.cjs +85 -0
- package/dist/providers/ReactQueryProvider.cjs.map +1 -0
- package/dist/providers/ReactQueryProvider.d.ts +13 -0
- package/dist/providers/ReactQueryProvider.d.ts.map +1 -0
- package/dist/providers/ReactQueryProvider.mjs +85 -0
- package/dist/providers/ReactQueryProvider.mjs.map +1 -0
- package/dist/providers/index.cjs +5 -0
- package/dist/{hooks/useAsync → providers}/index.cjs.map +1 -1
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.mjs +5 -0
- package/dist/{hooks/useAsync → providers}/index.mjs.map +1 -1
- package/package.json +31 -21
- package/dist/hooks/intlayerAPIHooks.cjs +0 -542
- package/dist/hooks/intlayerAPIHooks.cjs.map +0 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +0 -968
- package/dist/hooks/intlayerAPIHooks.d.ts.map +0 -1
- package/dist/hooks/intlayerAPIHooks.mjs +0 -542
- package/dist/hooks/intlayerAPIHooks.mjs.map +0 -1
- package/dist/hooks/useAsync/index.cjs +0 -8
- package/dist/hooks/useAsync/index.d.ts +0 -3
- package/dist/hooks/useAsync/index.d.ts.map +0 -1
- package/dist/hooks/useAsync/index.mjs +0 -8
- package/dist/hooks/useAsync/useAsync.cjs +0 -244
- package/dist/hooks/useAsync/useAsync.cjs.map +0 -1
- package/dist/hooks/useAsync/useAsync.d.ts +0 -73
- package/dist/hooks/useAsync/useAsync.d.ts.map +0 -1
- package/dist/hooks/useAsync/useAsync.mjs +0 -244
- package/dist/hooks/useAsync/useAsync.mjs.map +0 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs +0 -150
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +0 -1
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts +0 -52
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +0 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs +0 -150
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +0 -1
- package/dist/hooks/useAsync/useAsyncWrapper.cjs +0 -10
- package/dist/hooks/useAsync/useAsyncWrapper.cjs.map +0 -1
- package/dist/hooks/useAsync/useAsyncWrapper.d.ts +0 -37
- package/dist/hooks/useAsync/useAsyncWrapper.d.ts.map +0 -1
- package/dist/hooks/useAsync/useAsyncWrapper.mjs +0 -10
- package/dist/hooks/useAsync/useAsyncWrapper.mjs.map +0 -1
- package/dist/hooks/useGetAllDictionaries.cjs +0 -35
- package/dist/hooks/useGetAllDictionaries.cjs.map +0 -1
- package/dist/hooks/useGetAllDictionaries.d.ts +0 -11
- package/dist/hooks/useGetAllDictionaries.d.ts.map +0 -1
- package/dist/hooks/useGetAllDictionaries.mjs +0 -35
- package/dist/hooks/useGetAllDictionaries.mjs.map +0 -1
|
@@ -1,43 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import configuration from "@intlayer/config/built";
|
|
3
3
|
import { useConfiguration } from "@intlayer/editor-react";
|
|
4
|
+
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
|
4
5
|
import { getAuthAPI } from "../auth.mjs";
|
|
5
|
-
import
|
|
6
|
-
import "../useAsync/useAsyncStateStore.mjs";
|
|
6
|
+
import "@intlayer/api";
|
|
7
7
|
const useSession = (sessionProp, intlayerConfiguration) => {
|
|
8
8
|
const configuration$1 = useConfiguration();
|
|
9
9
|
const config = intlayerConfiguration ?? configuration$1 ?? configuration;
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
setData: setSession,
|
|
15
|
-
isFetched
|
|
16
|
-
} = useAsync(
|
|
17
|
-
"getSession",
|
|
18
|
-
async () => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
const { data, isFetched, refetch } = useQuery({
|
|
12
|
+
queryKey: ["session"],
|
|
13
|
+
queryFn: async () => {
|
|
19
14
|
const intlayerAPI = getAuthAPI(config);
|
|
20
15
|
const result = await intlayerAPI.getSession();
|
|
21
16
|
return result.data;
|
|
22
17
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"getDictionaries"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
);
|
|
18
|
+
staleTime: 0,
|
|
19
|
+
gcTime: 0,
|
|
20
|
+
enabled: !sessionProp,
|
|
21
|
+
refetchOnWindowFocus: false,
|
|
22
|
+
refetchOnMount: false,
|
|
23
|
+
refetchOnReconnect: false,
|
|
24
|
+
refetchInterval: false,
|
|
25
|
+
refetchIntervalInBackground: false
|
|
26
|
+
});
|
|
36
27
|
const session = data ?? (isFetched ? null : void 0);
|
|
28
|
+
const setSession = (nextSession) => queryClient.setQueryData(["session"], nextSession);
|
|
29
|
+
const fetchSession = async () => {
|
|
30
|
+
const res = await refetch();
|
|
31
|
+
return res.data;
|
|
32
|
+
};
|
|
33
|
+
const revalidateSession = fetchSession;
|
|
37
34
|
return {
|
|
38
35
|
session,
|
|
39
|
-
fetchSession
|
|
40
|
-
revalidateSession
|
|
36
|
+
fetchSession,
|
|
37
|
+
revalidateSession,
|
|
41
38
|
setSession
|
|
42
39
|
};
|
|
43
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSession.mjs","sources":["../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI } from '../auth';\nimport {
|
|
1
|
+
{"version":3,"file":"useSession.mjs","sources":["../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { useQuery } from '@tanstack/react-query';\nimport { getAuthAPI } from '../auth';\nimport { useQueryClient } from '../reactQuery';\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n\n const queryClient = useQueryClient();\n\n const { data, isFetched, refetch } = useQuery({\n queryKey: ['session'],\n queryFn: async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n return result.data as unknown as SessionAPI;\n },\n staleTime: 0,\n gcTime: 0,\n enabled: !sessionProp,\n refetchOnWindowFocus: false,\n refetchOnMount: false,\n refetchOnReconnect: false,\n refetchInterval: false,\n refetchIntervalInBackground: false,\n });\n\n const session = data ?? (isFetched ? null : undefined);\n\n const setSession = (nextSession: SessionAPI | null) =>\n queryClient.setQueryData(['session'], nextSession);\n\n const fetchSession = async (): Promise<SessionAPI | null | undefined> => {\n const res = await refetch();\n return res.data as SessionAPI | null | undefined;\n };\n\n const revalidateSession = fetchSession;\n\n return {\n session,\n fetchSession,\n revalidateSession,\n setSession,\n };\n};\n"],"names":["configuration","defaultConfiguration"],"mappings":";;;;;;AAUO,MAAM,aAAa,CACxB,aACA,0BACG;AACH,QAAMA,kBAAgB,iBAAA;AACtB,QAAM,SAAS,yBAAyBA,mBAAiBC;AAEzD,QAAM,cAAc,eAAA;AAEpB,QAAM,EAAE,MAAM,WAAW,QAAA,IAAY,SAAS;AAAA,IAC5C,UAAU,CAAC,SAAS;AAAA,IACpB,SAAS,YAAY;AACnB,YAAM,cAAc,WAAW,MAAM;AACrC,YAAM,SAAS,MAAM,YAAY,WAAA;AACjC,aAAO,OAAO;AAAA,IAChB;AAAA,IACA,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,SAAS,CAAC;AAAA,IACV,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,iBAAiB;AAAA,IACjB,6BAA6B;AAAA,EAAA,CAC9B;AAED,QAAM,UAAU,SAAS,YAAY,OAAO;AAE5C,QAAM,aAAa,CAAC,gBAClB,YAAY,aAAa,CAAC,SAAS,GAAG,WAAW;AAEnD,QAAM,eAAe,YAAoD;AACvE,UAAM,MAAM,MAAM,QAAA;AAClB,WAAO,IAAI;AAAA,EACb;AAEA,QAAM,oBAAoB;AAE1B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
|
|
@@ -5,8 +5,7 @@ const editorReact = require("@intlayer/editor-react");
|
|
|
5
5
|
const hooks_auth = require("./auth.cjs");
|
|
6
6
|
const hooks_useAuth_useAuth = require("./useAuth/useAuth.cjs");
|
|
7
7
|
require("@intlayer/config/built");
|
|
8
|
-
require("react");
|
|
9
|
-
require("./useAsync/useAsyncStateStore.cjs");
|
|
8
|
+
require("@tanstack/react-query");
|
|
10
9
|
const useIntlayerOAuth = (props) => {
|
|
11
10
|
const configuration = editorReact.useConfiguration();
|
|
12
11
|
const { oAuth2AccessToken } = hooks_useAuth_useAuth.useAuth();
|
|
@@ -14,7 +13,7 @@ const useIntlayerOAuth = (props) => {
|
|
|
14
13
|
{
|
|
15
14
|
...oAuth2AccessToken && {
|
|
16
15
|
headers: {
|
|
17
|
-
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
16
|
+
Authorization: `Bearer ${oAuth2AccessToken.accessToken}`
|
|
18
17
|
}
|
|
19
18
|
},
|
|
20
19
|
...props?.options ?? {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayerAPI.cjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":["useConfiguration","useAuth","getIntlayerAPI","getAuthAPI"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIntlayerAPI.cjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken.accessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":["useConfiguration","useAuth","getIntlayerAPI","getAuthAPI"],"mappings":";;;;;;;;AAeO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,gBAAgBA,YAAAA,iBAAA;AACtB,QAAM,EAAE,kBAAA,IAAsBC,8BAAA;AAE9B,SAAOC,IAAAA;AAAAA,IACL;AAAA,MACE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,kBAAkB,WAAW;AAAA,QAAA;AAAA,MACxD;AAAA,MAEF,GAAI,OAAO,WAAW,CAAA;AAAA,IAAC;AAAA,IAEzB,OAAO,yBAAyB;AAAA,EAAA;AAEpC;AAEO,MAAM,kBAAkB,CAAC,UAA0C;AACxE,QAAM,gBAAgBF,YAAAA,iBAAA;AAEtB,SAAOG,sBAAW,OAAO,yBAAyB,aAAa;AACjE;;;"}
|
|
@@ -3,8 +3,7 @@ import { useConfiguration } from "@intlayer/editor-react";
|
|
|
3
3
|
import { getAuthAPI } from "./auth.mjs";
|
|
4
4
|
import { useAuth } from "./useAuth/useAuth.mjs";
|
|
5
5
|
import "@intlayer/config/built";
|
|
6
|
-
import "react";
|
|
7
|
-
import "./useAsync/useAsyncStateStore.mjs";
|
|
6
|
+
import "@tanstack/react-query";
|
|
8
7
|
const useIntlayerOAuth = (props) => {
|
|
9
8
|
const configuration = useConfiguration();
|
|
10
9
|
const { oAuth2AccessToken } = useAuth();
|
|
@@ -12,7 +11,7 @@ const useIntlayerOAuth = (props) => {
|
|
|
12
11
|
{
|
|
13
12
|
...oAuth2AccessToken && {
|
|
14
13
|
headers: {
|
|
15
|
-
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
14
|
+
Authorization: `Bearer ${oAuth2AccessToken.accessToken}`
|
|
16
15
|
}
|
|
17
16
|
},
|
|
18
17
|
...props?.options ?? {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayerAPI.mjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIntlayerAPI.mjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken.accessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":[],"mappings":";;;;;;AAeO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,gBAAgB,iBAAA;AACtB,QAAM,EAAE,kBAAA,IAAsB,QAAA;AAE9B,SAAO;AAAA,IACL;AAAA,MACE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,kBAAkB,WAAW;AAAA,QAAA;AAAA,MACxD;AAAA,MAEF,GAAI,OAAO,WAAW,CAAA;AAAA,IAAC;AAAA,IAEzB,OAAO,yBAAyB;AAAA,EAAA;AAEpC;AAEO,MAAM,kBAAkB,CAAC,UAA0C;AACxE,QAAM,gBAAgB,iBAAA;AAEtB,SAAO,WAAW,OAAO,yBAAyB,aAAa;AACjE;"}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
require("
|
|
5
|
-
require("../../better-auth.CMQ3rA-I-C2nBKRMa.cjs");
|
|
6
|
-
const hooks_intlayerAPIHooks = require("../intlayerAPIHooks.cjs");
|
|
7
|
-
require("react");
|
|
8
|
-
require("../useAsync/useAsyncStateStore.cjs");
|
|
4
|
+
const hooks_reactQuery = require("../reactQuery.cjs");
|
|
9
5
|
const hooks_useAuth_useAuth = require("../useAuth/useAuth.cjs");
|
|
10
6
|
require("@intlayer/api");
|
|
7
|
+
require("@intlayer/config/built");
|
|
11
8
|
require("@intlayer/editor-react");
|
|
12
|
-
require("
|
|
13
|
-
require("
|
|
9
|
+
require("@tanstack/react-query");
|
|
10
|
+
require("../../better-auth.CMQ3rA-I-C2nBKRMa.cjs");
|
|
14
11
|
const useUser = () => {
|
|
15
12
|
const { session, revalidateSession, setSession } = hooks_useAuth_useAuth.useAuth();
|
|
16
|
-
const { logout } =
|
|
13
|
+
const { mutate: logout } = hooks_reactQuery.useLogout();
|
|
17
14
|
const status = session?.user ? "authenticated" : "unauthenticated";
|
|
18
15
|
const isAuthenticated = status === "authenticated";
|
|
19
16
|
const isUnauthenticated = status === "unauthenticated";
|
|
20
17
|
const user = session?.user;
|
|
21
18
|
const logoutHandle = async () => {
|
|
22
19
|
setSession(null);
|
|
23
|
-
|
|
20
|
+
logout({});
|
|
24
21
|
};
|
|
25
22
|
return {
|
|
26
23
|
isAuthenticated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useUser/index.ts"],"sourcesContent":["'use client';\n\nimport { useLogout } from '
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useUser/index.ts"],"sourcesContent":["'use client';\n\nimport { useLogout } from '../reactQuery';\nimport { useAuth } from '../useAuth';\n\nexport const useUser = () => {\n const { session, revalidateSession, setSession } = useAuth();\n const { mutate: logout } = useLogout();\n\n const status = session?.user ? 'authenticated' : 'unauthenticated';\n\n const isAuthenticated = status === 'authenticated';\n const isUnauthenticated = status === 'unauthenticated';\n\n const user = session?.user;\n\n const logoutHandle = async () => {\n setSession(null);\n logout({});\n };\n\n return {\n isAuthenticated,\n isUnauthenticated,\n user,\n revalidateSession,\n logout: logoutHandle,\n };\n};\n"],"names":["useAuth","useLogout"],"mappings":";;;;;;;;;;AAKO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,SAAS,mBAAmB,WAAA,IAAeA,sBAAAA,QAAA;AACnD,QAAM,EAAE,QAAQ,OAAA,IAAWC,2BAAA;AAE3B,QAAM,SAAS,SAAS,OAAO,kBAAkB;AAEjD,QAAM,kBAAkB,WAAW;AACnC,QAAM,oBAAoB,WAAW;AAErC,QAAM,OAAO,SAAS;AAEtB,QAAM,eAAe,YAAY;AAC/B,eAAW,IAAI;AACf,WAAO,CAAA,CAAE;AAAA,EACX;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EAAA;AAEZ;;"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
export declare const useUser: () => {
|
|
2
2
|
isAuthenticated: boolean;
|
|
3
3
|
isUnauthenticated: boolean;
|
|
4
|
-
user:
|
|
5
|
-
|
|
6
|
-
name: string;
|
|
7
|
-
image?: string | null | undefined;
|
|
8
|
-
createdAt: Date;
|
|
9
|
-
updatedAt: Date;
|
|
10
|
-
emailVerified: boolean;
|
|
11
|
-
phone?: string | undefined;
|
|
12
|
-
dateOfBirth?: Date | undefined;
|
|
13
|
-
id: string;
|
|
14
|
-
emailsList?: {
|
|
15
|
-
newsLetter: boolean;
|
|
16
|
-
} | undefined;
|
|
17
|
-
customerId?: string | undefined;
|
|
18
|
-
role?: string | undefined;
|
|
19
|
-
lang?: string | undefined;
|
|
20
|
-
} | undefined;
|
|
21
|
-
revalidateSession: () => Promise<import('@intlayer/backend').SessionAPI | null | undefined>;
|
|
4
|
+
user: any;
|
|
5
|
+
revalidateSession: () => Promise<SessionAPI | null | undefined>;
|
|
22
6
|
logout: () => Promise<void>;
|
|
23
7
|
};
|
|
24
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUser/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUser/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;;;;;CAuBnB,CAAC"}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "
|
|
3
|
-
import "../../better-auth.CMQ3rA-I-7umXOENE.js";
|
|
4
|
-
import { useLogout } from "../intlayerAPIHooks.mjs";
|
|
5
|
-
import "react";
|
|
6
|
-
import "../useAsync/useAsyncStateStore.mjs";
|
|
2
|
+
import { useLogout } from "../reactQuery.mjs";
|
|
7
3
|
import { useAuth } from "../useAuth/useAuth.mjs";
|
|
8
4
|
import "@intlayer/api";
|
|
5
|
+
import "@intlayer/config/built";
|
|
9
6
|
import "@intlayer/editor-react";
|
|
10
|
-
import "
|
|
11
|
-
import "
|
|
7
|
+
import "@tanstack/react-query";
|
|
8
|
+
import "../../better-auth.CMQ3rA-I-7umXOENE.js";
|
|
12
9
|
const useUser = () => {
|
|
13
10
|
const { session, revalidateSession, setSession } = useAuth();
|
|
14
|
-
const { logout } = useLogout();
|
|
11
|
+
const { mutate: logout } = useLogout();
|
|
15
12
|
const status = session?.user ? "authenticated" : "unauthenticated";
|
|
16
13
|
const isAuthenticated = status === "authenticated";
|
|
17
14
|
const isUnauthenticated = status === "unauthenticated";
|
|
18
15
|
const user = session?.user;
|
|
19
16
|
const logoutHandle = async () => {
|
|
20
17
|
setSession(null);
|
|
21
|
-
|
|
18
|
+
logout({});
|
|
22
19
|
};
|
|
23
20
|
return {
|
|
24
21
|
isAuthenticated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/hooks/useUser/index.ts"],"sourcesContent":["'use client';\n\nimport { useLogout } from '
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/hooks/useUser/index.ts"],"sourcesContent":["'use client';\n\nimport { useLogout } from '../reactQuery';\nimport { useAuth } from '../useAuth';\n\nexport const useUser = () => {\n const { session, revalidateSession, setSession } = useAuth();\n const { mutate: logout } = useLogout();\n\n const status = session?.user ? 'authenticated' : 'unauthenticated';\n\n const isAuthenticated = status === 'authenticated';\n const isUnauthenticated = status === 'unauthenticated';\n\n const user = session?.user;\n\n const logoutHandle = async () => {\n setSession(null);\n logout({});\n };\n\n return {\n isAuthenticated,\n isUnauthenticated,\n user,\n revalidateSession,\n logout: logoutHandle,\n };\n};\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,SAAS,mBAAmB,WAAA,IAAe,QAAA;AACnD,QAAM,EAAE,QAAQ,OAAA,IAAW,UAAA;AAE3B,QAAM,SAAS,SAAS,OAAO,kBAAkB;AAEjD,QAAM,kBAAkB,WAAW;AACnC,QAAM,oBAAoB,WAAW;AAErC,QAAM,OAAO,SAAS;AAEtB,QAAM,eAAe,YAAY;AAC/B,eAAW,IAAI;AACf,WAAO,CAAA,CAAE;AAAA,EACX;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EAAA;AAEZ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-BCuMWKyy.js","sources":["../../../../node_modules/.pnpm/zustand@4.5.7_@types+react@19.1.
|
|
1
|
+
{"version":3,"file":"index-BCuMWKyy.js","sources":["../../../../node_modules/.pnpm/zustand@4.5.7_@types+react@19.1.12_immer@9.0.21_react@19.1.1/node_modules/zustand/esm/react/shallow.mjs","../src/hooks/useScrollBlockage/index.tsx"],"sourcesContent":["import ReactExports from 'react';\n\nfunction shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size) return false;\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) {\n return false;\n }\n }\n return true;\n }\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size) return false;\n for (const value of objA) {\n if (!objB.has(value)) {\n return false;\n }\n }\n return true;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (const keyA of keysA) {\n if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {\n return false;\n }\n }\n return true;\n}\n\nconst { useRef } = ReactExports;\nfunction useShallow(selector) {\n const prev = useRef();\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","'use client';\n\nimport { useEffect } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetElementOrWindow } from '../useGetElementOrWindow';\n\nimport { useScrollBlockageStore } from './useScrollBlockageStore';\n\ntype useScrollBlockagePropsReadOnly = {\n disableScroll: undefined;\n key: undefined;\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\ntype useScrollBlockageProps = {\n disableScroll: boolean;\n key: string; // The key to identify the blockage to avoid conflicts. Required if disableScroll is defined\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\nexport const useScrollBlockage = (\n props?: useScrollBlockageProps | useScrollBlockagePropsReadOnly\n) => {\n const {\n disableScroll = false,\n element,\n key = 'unnamed_blocker',\n } = props ?? {};\n\n const { isElementScrollBlocked, addBlockage, removeBlockage } =\n useScrollBlockageStore(\n useShallow((s) => ({\n isElementScrollBlocked: s.isElementScrollBlocked,\n addBlockage: s.addBlockage,\n removeBlockage: s.removeBlockage,\n }))\n );\n\n const containerElement = useGetElementOrWindow(element);\n\n useEffect(() => {\n const el = element ?? window.document.body;\n\n if (disableScroll) {\n addBlockage(key, el);\n } else {\n removeBlockage(key, el);\n }\n }, [addBlockage, disableScroll, element, key, removeBlockage]);\n\n const isScrollBlocked = containerElement\n ? isElementScrollBlocked(containerElement)\n : false;\n\n return { isScrollBlocked };\n};\n"],"names":[],"mappings":";;;;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACT;AACA,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,CAAC,KAAK,KAAK,KAAK,MAAM;AAC/B,UAAI,CAAC,OAAO,GAAG,OAAO,KAAK,IAAI,GAAG,CAAC,GAAG;AACpC,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,SAAS,MAAM;AACxB,UAAI,CAAC,KAAK,IAAI,KAAK,GAAG;AACpB,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,MAAI,MAAM,WAAW,OAAO,KAAK,IAAI,EAAE,QAAQ;AAC7C,WAAO;AAAA,EACT;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG;AAC3F,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,EAAE,OAAM,IAAK;AACnB,SAAS,WAAW,UAAU;AAC5B,QAAM,OAAO,OAAM;AACnB,SAAO,CAAC,UAAU;AAChB,UAAM,OAAO,SAAS,KAAK;AAC3B,WAAO,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,KAAK,UAAU;AAAA,EACrE;AACF;AC1BO,MAAM,oBAAoB,CAC/B,UACG;AACH,QAAM;AAAA,IACJ,gBAAgB;AAAA,IAChB;AAAA,IACA,MAAM;AAAA,EAAA,IACJ,SAAS,CAAA;AAEb,QAAM,EAAE,wBAAwB,aAAa,eAAA,IAC3C;AAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,wBAAwB,EAAE;AAAA,MAC1B,aAAa,EAAE;AAAA,MACf,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EAAA;AAGN,QAAM,mBAAmB,sBAAsB,OAAO;AAEtD,YAAU,MAAM;AACd,UAAM,KAAK,WAAW,OAAO,SAAS;AAEtC,QAAI,eAAe;AACjB,kBAAY,KAAK,EAAE;AAAA,IACrB,OAAO;AACL,qBAAe,KAAK,EAAE;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,SAAS,KAAK,cAAc,CAAC;AAE7D,QAAM,kBAAkB,mBACpB,uBAAuB,gBAAgB,IACvC;AAEJ,SAAO,EAAE,gBAAA;AACX;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-BYzBot7l.cjs","sources":["../../../../node_modules/.pnpm/zustand@4.5.7_@types+react@19.1.
|
|
1
|
+
{"version":3,"file":"index-BYzBot7l.cjs","sources":["../../../../node_modules/.pnpm/zustand@4.5.7_@types+react@19.1.12_immer@9.0.21_react@19.1.1/node_modules/zustand/esm/react/shallow.mjs","../src/hooks/useScrollBlockage/index.tsx"],"sourcesContent":["import ReactExports from 'react';\n\nfunction shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size) return false;\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) {\n return false;\n }\n }\n return true;\n }\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size) return false;\n for (const value of objA) {\n if (!objB.has(value)) {\n return false;\n }\n }\n return true;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (const keyA of keysA) {\n if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {\n return false;\n }\n }\n return true;\n}\n\nconst { useRef } = ReactExports;\nfunction useShallow(selector) {\n const prev = useRef();\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","'use client';\n\nimport { useEffect } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetElementOrWindow } from '../useGetElementOrWindow';\n\nimport { useScrollBlockageStore } from './useScrollBlockageStore';\n\ntype useScrollBlockagePropsReadOnly = {\n disableScroll: undefined;\n key: undefined;\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\ntype useScrollBlockageProps = {\n disableScroll: boolean;\n key: string; // The key to identify the blockage to avoid conflicts. Required if disableScroll is defined\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\nexport const useScrollBlockage = (\n props?: useScrollBlockageProps | useScrollBlockagePropsReadOnly\n) => {\n const {\n disableScroll = false,\n element,\n key = 'unnamed_blocker',\n } = props ?? {};\n\n const { isElementScrollBlocked, addBlockage, removeBlockage } =\n useScrollBlockageStore(\n useShallow((s) => ({\n isElementScrollBlocked: s.isElementScrollBlocked,\n addBlockage: s.addBlockage,\n removeBlockage: s.removeBlockage,\n }))\n );\n\n const containerElement = useGetElementOrWindow(element);\n\n useEffect(() => {\n const el = element ?? window.document.body;\n\n if (disableScroll) {\n addBlockage(key, el);\n } else {\n removeBlockage(key, el);\n }\n }, [addBlockage, disableScroll, element, key, removeBlockage]);\n\n const isScrollBlocked = containerElement\n ? isElementScrollBlocked(containerElement)\n : false;\n\n return { isScrollBlocked };\n};\n"],"names":["useScrollBlockageStore","useGetElementOrWindow","useEffect"],"mappings":";;;;;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACT;AACA,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,CAAC,KAAK,KAAK,KAAK,MAAM;AAC/B,UAAI,CAAC,OAAO,GAAG,OAAO,KAAK,IAAI,GAAG,CAAC,GAAG;AACpC,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,SAAS,MAAM;AACxB,UAAI,CAAC,KAAK,IAAI,KAAK,GAAG;AACpB,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,MAAI,MAAM,WAAW,OAAO,KAAK,IAAI,EAAE,QAAQ;AAC7C,WAAO;AAAA,EACT;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG;AAC3F,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,EAAE,OAAM,IAAK;AACnB,SAAS,WAAW,UAAU;AAC5B,QAAM,OAAO,OAAM;AACnB,SAAO,CAAC,UAAU;AAChB,UAAM,OAAO,SAAS,KAAK;AAC3B,WAAO,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,KAAK,UAAU;AAAA,EACrE;AACF;AC1BO,MAAM,oBAAoB,CAC/B,UACG;AACH,QAAM;AAAA,IACJ,gBAAgB;AAAA,IAChB;AAAA,IACA,MAAM;AAAA,EAAA,IACJ,SAAS,CAAA;AAEb,QAAM,EAAE,wBAAwB,aAAa,eAAA,IAC3CA,+CAAAA;AAAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,wBAAwB,EAAE;AAAA,MAC1B,aAAa,EAAE;AAAA,MACf,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EAAA;AAGN,QAAM,mBAAmBC,4BAAAA,sBAAsB,OAAO;AAEtDC,eAAAA,UAAU,MAAM;AACd,UAAM,KAAK,WAAW,OAAO,SAAS;AAEtC,QAAI,eAAe;AACjB,kBAAY,KAAK,EAAE;AAAA,IACrB,OAAO;AACL,qBAAe,KAAK,EAAE;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,SAAS,KAAK,cAAc,CAAC;AAE7D,QAAM,kBAAkB,mBACpB,uBAAuB,gBAAgB,IACvC;AAEJ,SAAO,EAAE,gBAAA;AACX;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
const reactQuery = require("@tanstack/react-query");
|
|
6
|
+
require("../components/Toaster/Toast.cjs");
|
|
7
|
+
const components_Toaster_useToast = require("../components/Toaster/useToast.cjs");
|
|
8
|
+
var define_process_env_default = {};
|
|
9
|
+
const defaultQueryOptions = {
|
|
10
|
+
queries: {
|
|
11
|
+
retry: 1,
|
|
12
|
+
refetchOnWindowFocus: false,
|
|
13
|
+
staleTime: 0,
|
|
14
|
+
gcTime: 1e3 * 60 * 10
|
|
15
|
+
// 10 minutes
|
|
16
|
+
},
|
|
17
|
+
mutations: {
|
|
18
|
+
retry: 0
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const formatErrorCode = (errorCode) => errorCode.split("_").join(" ");
|
|
22
|
+
const useToastEvents = () => {
|
|
23
|
+
const { toast } = components_Toaster_useToast.useToast();
|
|
24
|
+
const onError = (error) => {
|
|
25
|
+
const parsed = (() => {
|
|
26
|
+
try {
|
|
27
|
+
if (typeof error === "string") return JSON.parse(error);
|
|
28
|
+
} catch (_) {
|
|
29
|
+
}
|
|
30
|
+
return error;
|
|
31
|
+
})();
|
|
32
|
+
[parsed].flat().forEach(
|
|
33
|
+
(err) => toast({
|
|
34
|
+
title: formatErrorCode(
|
|
35
|
+
(define_process_env_default.NODE_ENV === "production" ? err?.title : err?.code) ?? "Error"
|
|
36
|
+
),
|
|
37
|
+
description: err?.message ?? String(err ?? "An error occurred"),
|
|
38
|
+
variant: "error"
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
const onSuccess = (data) => {
|
|
43
|
+
if (data?.error) {
|
|
44
|
+
toast({
|
|
45
|
+
title: formatErrorCode(data.error.title ?? data.error.code ?? "Error"),
|
|
46
|
+
description: data.error.message ?? data.error.code ?? "An error occurred",
|
|
47
|
+
variant: "error"
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (data?.message) {
|
|
51
|
+
toast({
|
|
52
|
+
title: data.message,
|
|
53
|
+
description: data.description,
|
|
54
|
+
variant: "success"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
onError,
|
|
60
|
+
onSuccess
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const ReactQueryProvider = ({ children }) => {
|
|
64
|
+
const { onError, onSuccess } = useToastEvents();
|
|
65
|
+
const mutationCache = new reactQuery.MutationCache({
|
|
66
|
+
onSuccess,
|
|
67
|
+
onError,
|
|
68
|
+
onSettled: (_data, _error, _variables, _context, mutation) => {
|
|
69
|
+
if (mutation.meta?.invalidateQueries) {
|
|
70
|
+
mutation.meta.invalidateQueries.forEach((queryKey) => {
|
|
71
|
+
queryClient.invalidateQueries({
|
|
72
|
+
queryKey
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const queryClient = new reactQuery.QueryClient({
|
|
79
|
+
defaultOptions: defaultQueryOptions,
|
|
80
|
+
mutationCache
|
|
81
|
+
});
|
|
82
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children });
|
|
83
|
+
};
|
|
84
|
+
exports.ReactQueryProvider = ReactQueryProvider;
|
|
85
|
+
//# sourceMappingURL=ReactQueryProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactQueryProvider.cjs","sources":["../../src/providers/ReactQueryProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n MutationCache,\n QueryClient,\n QueryClientProvider,\n QueryKey,\n UseMutationOptions,\n type DefaultOptions,\n} from '@tanstack/react-query';\nimport { type FC, type PropsWithChildren } from 'react';\nimport { useToast } from '../components/Toaster';\n\nconst defaultQueryOptions: DefaultOptions = {\n queries: {\n retry: 1,\n refetchOnWindowFocus: false,\n staleTime: 0,\n gcTime: 1000 * 60 * 10, // 10 minutes\n },\n mutations: {\n retry: 0,\n },\n};\n\ndeclare module '@tanstack/react-query' {\n interface Register {\n mutationMeta: {\n onSuccess?: UseMutationOptions['onSuccess'];\n onError?: UseMutationOptions['onError'];\n invalidateQueries?: QueryKey[];\n };\n }\n}\n\nconst formatErrorCode = (errorCode: string) => errorCode.split('_').join(' ');\n\n/**\n * Hook to handle error logging and toast notifications\n */\nconst useToastEvents = () => {\n const { toast } = useToast();\n\n const onError: MutationCache['config']['onError'] = (error: any) => {\n const parsed = (() => {\n try {\n if (typeof error === 'string') return JSON.parse(error);\n } catch (_) {}\n return error;\n })();\n\n [parsed].flat().forEach((err: any) =>\n toast({\n title: formatErrorCode(\n (process.env.NODE_ENV === 'production' ? err?.title : err?.code) ??\n 'Error'\n ),\n description: err?.message ?? String(err ?? 'An error occurred'),\n variant: 'error',\n })\n );\n };\n\n const onSuccess: MutationCache['config']['onSuccess'] = (data: any) => {\n if (data?.error) {\n toast({\n title: formatErrorCode(data.error.title ?? data.error.code ?? 'Error'),\n description:\n data.error.message ?? data.error.code ?? 'An error occurred',\n variant: 'error',\n });\n }\n\n if (data?.message) {\n toast({\n title: data.message,\n description: data.description,\n variant: 'success',\n });\n }\n };\n\n return {\n onError,\n onSuccess,\n };\n};\n\nexport const ReactQueryProvider: FC<PropsWithChildren> = ({ children }) => {\n const { onError, onSuccess } = useToastEvents();\n\n const mutationCache = new MutationCache({\n onSuccess,\n onError,\n onSettled: (_data, _error, _variables, _context, mutation) => {\n if (mutation.meta?.invalidateQueries) {\n mutation.meta.invalidateQueries.forEach((queryKey) => {\n queryClient.invalidateQueries({\n queryKey,\n });\n });\n }\n },\n });\n\n const queryClient = new QueryClient({\n defaultOptions: defaultQueryOptions,\n mutationCache,\n });\n\n return (\n <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n );\n};\n"],"names":["useToast","MutationCache","QueryClient","QueryClientProvider"],"mappings":";;;;;;;;AAaA,MAAM,sBAAsC;AAAA,EAC1C,SAAS;AAAA,IACP,OAAO;AAAA,IACP,sBAAsB;AAAA,IACtB,WAAW;AAAA,IACX,QAAQ,MAAO,KAAK;AAAA;AAAA,EAAA;AAAA,EAEtB,WAAW;AAAA,IACT,OAAO;AAAA,EAAA;AAEX;AAYA,MAAM,kBAAkB,CAAC,cAAsB,UAAU,MAAM,GAAG,EAAE,KAAK,GAAG;AAK5E,MAAM,iBAAiB,MAAM;AAC3B,QAAM,EAAE,MAAA,IAAUA,qCAAA;AAElB,QAAM,UAA8C,CAAC,UAAe;AAClE,UAAM,UAAU,MAAM;AACpB,UAAI;AACF,YAAI,OAAO,UAAU,SAAU,QAAO,KAAK,MAAM,KAAK;AAAA,MACxD,SAAS,GAAG;AAAA,MAAC;AACb,aAAO;AAAA,IACT,GAAA;AAEA,KAAC,MAAM,EAAE,KAAA,EAAO;AAAA,MAAQ,CAAC,QACvB,MAAM;AAAA,QACJ,OAAO;AAAA,WACJ,2BAAY,aAAa,eAAe,KAAK,QAAQ,KAAK,SACzD;AAAA,QAAA;AAAA,QAEJ,aAAa,KAAK,WAAW,OAAO,OAAO,mBAAmB;AAAA,QAC9D,SAAS;AAAA,MAAA,CACV;AAAA,IAAA;AAAA,EAEL;AAEA,QAAM,YAAkD,CAAC,SAAc;AACrE,QAAI,MAAM,OAAO;AACf,YAAM;AAAA,QACJ,OAAO,gBAAgB,KAAK,MAAM,SAAS,KAAK,MAAM,QAAQ,OAAO;AAAA,QACrE,aACE,KAAK,MAAM,WAAW,KAAK,MAAM,QAAQ;AAAA,QAC3C,SAAS;AAAA,MAAA,CACV;AAAA,IACH;AAEA,QAAI,MAAM,SAAS;AACjB,YAAM;AAAA,QACJ,OAAO,KAAK;AAAA,QACZ,aAAa,KAAK;AAAA,QAClB,SAAS;AAAA,MAAA,CACV;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,qBAA4C,CAAC,EAAE,eAAe;AACzE,QAAM,EAAE,SAAS,UAAA,IAAc,eAAA;AAE/B,QAAM,gBAAgB,IAAIC,yBAAc;AAAA,IACtC;AAAA,IACA;AAAA,IACA,WAAW,CAAC,OAAO,QAAQ,YAAY,UAAU,aAAa;AAC5D,UAAI,SAAS,MAAM,mBAAmB;AACpC,iBAAS,KAAK,kBAAkB,QAAQ,CAAC,aAAa;AACpD,sBAAY,kBAAkB;AAAA,YAC5B;AAAA,UAAA,CACD;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EAAA,CACD;AAED,QAAM,cAAc,IAAIC,uBAAY;AAAA,IAClC,gBAAgB;AAAA,IAChB;AAAA,EAAA,CACD;AAED,wCACGC,WAAAA,qBAAA,EAAoB,QAAQ,aAAc,UAAS;AAExD;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QueryKey, UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import { FC, PropsWithChildren } from 'react';
|
|
3
|
+
declare module '@tanstack/react-query' {
|
|
4
|
+
interface Register {
|
|
5
|
+
mutationMeta: {
|
|
6
|
+
onSuccess?: UseMutationOptions['onSuccess'];
|
|
7
|
+
onError?: UseMutationOptions['onError'];
|
|
8
|
+
invalidateQueries?: QueryKey[];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const ReactQueryProvider: FC<PropsWithChildren>;
|
|
13
|
+
//# sourceMappingURL=ReactQueryProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactQueryProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ReactQueryProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,QAAQ,EACR,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAexD,OAAO,QAAQ,uBAAuB,CAAC;IACrC,UAAU,QAAQ;QAChB,YAAY,EAAE;YACZ,SAAS,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAC5C,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACxC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC;SAChC,CAAC;KACH;CACF;AAuDD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,iBAAiB,CAyBpD,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { MutationCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
+
import "../components/Toaster/Toast.mjs";
|
|
5
|
+
import { useToast } from "../components/Toaster/useToast.mjs";
|
|
6
|
+
var define_process_env_default = {};
|
|
7
|
+
const defaultQueryOptions = {
|
|
8
|
+
queries: {
|
|
9
|
+
retry: 1,
|
|
10
|
+
refetchOnWindowFocus: false,
|
|
11
|
+
staleTime: 0,
|
|
12
|
+
gcTime: 1e3 * 60 * 10
|
|
13
|
+
// 10 minutes
|
|
14
|
+
},
|
|
15
|
+
mutations: {
|
|
16
|
+
retry: 0
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const formatErrorCode = (errorCode) => errorCode.split("_").join(" ");
|
|
20
|
+
const useToastEvents = () => {
|
|
21
|
+
const { toast } = useToast();
|
|
22
|
+
const onError = (error) => {
|
|
23
|
+
const parsed = (() => {
|
|
24
|
+
try {
|
|
25
|
+
if (typeof error === "string") return JSON.parse(error);
|
|
26
|
+
} catch (_) {
|
|
27
|
+
}
|
|
28
|
+
return error;
|
|
29
|
+
})();
|
|
30
|
+
[parsed].flat().forEach(
|
|
31
|
+
(err) => toast({
|
|
32
|
+
title: formatErrorCode(
|
|
33
|
+
(define_process_env_default.NODE_ENV === "production" ? err?.title : err?.code) ?? "Error"
|
|
34
|
+
),
|
|
35
|
+
description: err?.message ?? String(err ?? "An error occurred"),
|
|
36
|
+
variant: "error"
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
const onSuccess = (data) => {
|
|
41
|
+
if (data?.error) {
|
|
42
|
+
toast({
|
|
43
|
+
title: formatErrorCode(data.error.title ?? data.error.code ?? "Error"),
|
|
44
|
+
description: data.error.message ?? data.error.code ?? "An error occurred",
|
|
45
|
+
variant: "error"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (data?.message) {
|
|
49
|
+
toast({
|
|
50
|
+
title: data.message,
|
|
51
|
+
description: data.description,
|
|
52
|
+
variant: "success"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
onError,
|
|
58
|
+
onSuccess
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const ReactQueryProvider = ({ children }) => {
|
|
62
|
+
const { onError, onSuccess } = useToastEvents();
|
|
63
|
+
const mutationCache = new MutationCache({
|
|
64
|
+
onSuccess,
|
|
65
|
+
onError,
|
|
66
|
+
onSettled: (_data, _error, _variables, _context, mutation) => {
|
|
67
|
+
if (mutation.meta?.invalidateQueries) {
|
|
68
|
+
mutation.meta.invalidateQueries.forEach((queryKey) => {
|
|
69
|
+
queryClient.invalidateQueries({
|
|
70
|
+
queryKey
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const queryClient = new QueryClient({
|
|
77
|
+
defaultOptions: defaultQueryOptions,
|
|
78
|
+
mutationCache
|
|
79
|
+
});
|
|
80
|
+
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children });
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
ReactQueryProvider
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=ReactQueryProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactQueryProvider.mjs","sources":["../../src/providers/ReactQueryProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n MutationCache,\n QueryClient,\n QueryClientProvider,\n QueryKey,\n UseMutationOptions,\n type DefaultOptions,\n} from '@tanstack/react-query';\nimport { type FC, type PropsWithChildren } from 'react';\nimport { useToast } from '../components/Toaster';\n\nconst defaultQueryOptions: DefaultOptions = {\n queries: {\n retry: 1,\n refetchOnWindowFocus: false,\n staleTime: 0,\n gcTime: 1000 * 60 * 10, // 10 minutes\n },\n mutations: {\n retry: 0,\n },\n};\n\ndeclare module '@tanstack/react-query' {\n interface Register {\n mutationMeta: {\n onSuccess?: UseMutationOptions['onSuccess'];\n onError?: UseMutationOptions['onError'];\n invalidateQueries?: QueryKey[];\n };\n }\n}\n\nconst formatErrorCode = (errorCode: string) => errorCode.split('_').join(' ');\n\n/**\n * Hook to handle error logging and toast notifications\n */\nconst useToastEvents = () => {\n const { toast } = useToast();\n\n const onError: MutationCache['config']['onError'] = (error: any) => {\n const parsed = (() => {\n try {\n if (typeof error === 'string') return JSON.parse(error);\n } catch (_) {}\n return error;\n })();\n\n [parsed].flat().forEach((err: any) =>\n toast({\n title: formatErrorCode(\n (process.env.NODE_ENV === 'production' ? err?.title : err?.code) ??\n 'Error'\n ),\n description: err?.message ?? String(err ?? 'An error occurred'),\n variant: 'error',\n })\n );\n };\n\n const onSuccess: MutationCache['config']['onSuccess'] = (data: any) => {\n if (data?.error) {\n toast({\n title: formatErrorCode(data.error.title ?? data.error.code ?? 'Error'),\n description:\n data.error.message ?? data.error.code ?? 'An error occurred',\n variant: 'error',\n });\n }\n\n if (data?.message) {\n toast({\n title: data.message,\n description: data.description,\n variant: 'success',\n });\n }\n };\n\n return {\n onError,\n onSuccess,\n };\n};\n\nexport const ReactQueryProvider: FC<PropsWithChildren> = ({ children }) => {\n const { onError, onSuccess } = useToastEvents();\n\n const mutationCache = new MutationCache({\n onSuccess,\n onError,\n onSettled: (_data, _error, _variables, _context, mutation) => {\n if (mutation.meta?.invalidateQueries) {\n mutation.meta.invalidateQueries.forEach((queryKey) => {\n queryClient.invalidateQueries({\n queryKey,\n });\n });\n }\n },\n });\n\n const queryClient = new QueryClient({\n defaultOptions: defaultQueryOptions,\n mutationCache,\n });\n\n return (\n <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;AAaA,MAAM,sBAAsC;AAAA,EAC1C,SAAS;AAAA,IACP,OAAO;AAAA,IACP,sBAAsB;AAAA,IACtB,WAAW;AAAA,IACX,QAAQ,MAAO,KAAK;AAAA;AAAA,EAAA;AAAA,EAEtB,WAAW;AAAA,IACT,OAAO;AAAA,EAAA;AAEX;AAYA,MAAM,kBAAkB,CAAC,cAAsB,UAAU,MAAM,GAAG,EAAE,KAAK,GAAG;AAK5E,MAAM,iBAAiB,MAAM;AAC3B,QAAM,EAAE,MAAA,IAAU,SAAA;AAElB,QAAM,UAA8C,CAAC,UAAe;AAClE,UAAM,UAAU,MAAM;AACpB,UAAI;AACF,YAAI,OAAO,UAAU,SAAU,QAAO,KAAK,MAAM,KAAK;AAAA,MACxD,SAAS,GAAG;AAAA,MAAC;AACb,aAAO;AAAA,IACT,GAAA;AAEA,KAAC,MAAM,EAAE,KAAA,EAAO;AAAA,MAAQ,CAAC,QACvB,MAAM;AAAA,QACJ,OAAO;AAAA,WACJ,2BAAY,aAAa,eAAe,KAAK,QAAQ,KAAK,SACzD;AAAA,QAAA;AAAA,QAEJ,aAAa,KAAK,WAAW,OAAO,OAAO,mBAAmB;AAAA,QAC9D,SAAS;AAAA,MAAA,CACV;AAAA,IAAA;AAAA,EAEL;AAEA,QAAM,YAAkD,CAAC,SAAc;AACrE,QAAI,MAAM,OAAO;AACf,YAAM;AAAA,QACJ,OAAO,gBAAgB,KAAK,MAAM,SAAS,KAAK,MAAM,QAAQ,OAAO;AAAA,QACrE,aACE,KAAK,MAAM,WAAW,KAAK,MAAM,QAAQ;AAAA,QAC3C,SAAS;AAAA,MAAA,CACV;AAAA,IACH;AAEA,QAAI,MAAM,SAAS;AACjB,YAAM;AAAA,QACJ,OAAO,KAAK;AAAA,QACZ,aAAa,KAAK;AAAA,QAClB,SAAS;AAAA,MAAA,CACV;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,qBAA4C,CAAC,EAAE,eAAe;AACzE,QAAM,EAAE,SAAS,UAAA,IAAc,eAAA;AAE/B,QAAM,gBAAgB,IAAI,cAAc;AAAA,IACtC;AAAA,IACA;AAAA,IACA,WAAW,CAAC,OAAO,QAAQ,YAAY,UAAU,aAAa;AAC5D,UAAI,SAAS,MAAM,mBAAmB;AACpC,iBAAS,KAAK,kBAAkB,QAAQ,CAAC,aAAa;AACpD,sBAAY,kBAAkB;AAAA,YAC5B;AAAA,UAAA,CACD;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EAAA,CACD;AAED,QAAM,cAAc,IAAI,YAAY;AAAA,IAClC,gBAAgB;AAAA,IAChB;AAAA,EAAA,CACD;AAED,6BACG,qBAAA,EAAoB,QAAQ,aAAc,UAAS;AAExD;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const providers_ReactQueryProvider = require("./ReactQueryProvider.cjs");
|
|
4
|
+
exports.ReactQueryProvider = providers_ReactQueryProvider.ReactQueryProvider;
|
|
5
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|