@intlayer/design-system 5.5.6 → 5.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/.vite/manifest.json +33 -14
- package/dist/components/Auth/AuthModal/index.cjs +0 -1
- package/dist/components/Auth/AuthModal/index.cjs.map +1 -1
- package/dist/components/Auth/AuthModal/index.mjs +0 -1
- package/dist/components/Auth/AuthModal/index.mjs.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs +11 -14
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.d.ts +3 -19
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.d.ts.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs +11 -14
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs.map +1 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.cjs +8 -10
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.cjs.map +1 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.d.ts +3 -15
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.d.ts.map +1 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.mjs +8 -10
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.mjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs +5 -6
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.d.ts +3 -7
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.d.ts.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs +5 -6
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs.map +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.cjs +5 -4
- package/dist/components/Auth/SignInForm/SignInForm.cjs.map +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.d.ts.map +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.mjs +5 -4
- package/dist/components/Auth/SignInForm/SignInForm.mjs.map +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.cjs +8 -10
- package/dist/components/Auth/SignInForm/useSignInSchema.cjs.map +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.d.ts +3 -9
- package/dist/components/Auth/SignInForm/useSignInSchema.d.ts.map +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.mjs +8 -10
- package/dist/components/Auth/SignInForm/useSignInSchema.mjs.map +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs +1 -0
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs.map +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.d.ts.map +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs +1 -0
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs.map +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs +11 -14
- package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs.map +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.d.ts +4 -20
- package/dist/components/Auth/SignUpForm/useSignUpSchema.d.ts.map +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs +11 -14
- package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs.map +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.cjs +2 -2
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.cjs.map +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.d.ts +2 -2
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.d.ts.map +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.mjs +2 -2
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs +0 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs +0 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +0 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +0 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs +8 -10
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts +3 -9
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +8 -10
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +0 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +0 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +16 -20
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +5 -17
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +16 -20
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +0 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +0 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/Form/FormBase.cjs +4 -3
- package/dist/components/Form/FormBase.cjs.map +1 -1
- package/dist/components/Form/FormBase.d.ts +5 -5
- package/dist/components/Form/FormBase.d.ts.map +1 -1
- package/dist/components/Form/FormBase.mjs +4 -3
- package/dist/components/Form/FormBase.mjs.map +1 -1
- package/dist/components/Form/elements/FormElementWrapper.cjs +5 -5
- package/dist/components/Form/elements/FormElementWrapper.cjs.map +1 -1
- package/dist/components/Form/elements/FormElementWrapper.d.ts +3 -3
- package/dist/components/Form/elements/FormElementWrapper.d.ts.map +1 -1
- package/dist/components/Form/elements/FormElementWrapper.mjs +5 -5
- package/dist/components/Form/elements/FormElementWrapper.mjs.map +1 -1
- package/dist/hooks/index.cjs +3 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +4 -1
- package/dist/hooks/intlayerAPIHooks.cjs +24 -1
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +6 -0
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +24 -1
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.d.ts +5 -0
- package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
- package/dist/schemas-7jC6hy_u.js +2725 -0
- package/dist/schemas-7jC6hy_u.js.map +1 -0
- package/dist/schemas-DJhUvjsx.cjs +2724 -0
- package/dist/schemas-DJhUvjsx.cjs.map +1 -0
- package/dist/{zod-BV4nCGJE.js → zod-DIGMabE8.js} +16 -15
- package/dist/zod-DIGMabE8.js.map +1 -0
- package/dist/{zod-DSrtTSD_.cjs → zod-DpajDxlG.cjs} +16 -15
- package/dist/zod-DpajDxlG.cjs.map +1 -0
- package/package.json +30 -30
- package/dist/components/Command/index.d.ts +0 -83
- package/dist/components/Command/index.d.ts.map +0 -1
- package/dist/zod-BV4nCGJE.js.map +0 -1
- package/dist/zod-DSrtTSD_.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport {\n ArrowUpFromLine,\n Download,\n RotateCcw,\n Save,\n Trash,\n} from 'lucide-react';\nimport {\n type DetailedHTMLProps,\n type FC,\n type FormHTMLAttributes,\n useState,\n} from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Modal } from '../../../components/Modal';\nimport {\n useDeleteDictionary,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { cn } from '../../../utils/cn';\nimport { useAuth } from '../../Auth';\nimport { Form } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n} & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n className,\n onDelete,\n ...props\n}) => {\n const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = useState(false);\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { deleteDictionary, isLoading: isDeleting } = useDeleteDictionary();\n const { writeDictionary, isLoading: isWriting } = useWriteDictionary();\n const { pushDictionaries, isLoading: isPushing } = usePushDictionaries();\n const isLoading = isWriting || isPushing;\n const isJsonFormat =\n mode.includes('local') && dictionary.filePath?.endsWith('.json');\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const {\n deleteButton,\n resetButton,\n saveButton,\n publishButton,\n downloadButton,\n confirmation,\n } = useDictionary(saveDictionaryContent);\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = editedContent?.[dictionary.key];\n\n const isEdited =\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);\n\n const isDistantDictionary =\n typeof (dictionary as DistantDictionary)?._id !== 'undefined';\n\n const handleSaveDictionaryConfirmation = async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await writeDictionary(updatedDictionary).then(() => {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n });\n };\n\n const handlePushDictionary = async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await pushDictionaries([updatedDictionary]).then((res) => {\n if (res) {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n }\n });\n };\n\n const handleDeleteDictionary = async () => {\n if (!(dictionary as DistantDictionary)._id) return;\n\n await deleteDictionary(\n (dictionary as DistantDictionary)._id.toString()\n ).then((res) => {\n if (res) {\n onDelete?.();\n }\n });\n };\n\n return (\n <>\n <Modal\n isOpen={isFormatAlertModalOpen}\n title={confirmation.title.value}\n size=\"md\"\n >\n <form className=\"size-full px-3\">\n {isJsonFormat ? (\n <p className=\"text-neutral py-4 text-sm\">{confirmation.message}</p>\n ) : (\n <p className=\"text-neutral py-4 text-sm\">\n {confirmation.differentFormatMessage}\n </p>\n )}\n <div className=\"mt-12 flex justify-end gap-2 max-md:flex-col\">\n <Form.Button\n label={confirmation.cancelButton.label.value}\n disabled={!isEdited || isLoading}\n color=\"text\"\n className=\"max-md:w-full\"\n variant=\"outline\"\n onClick={() => setIsFormatAlertModalOpen(false)}\n >\n {confirmation.cancelButton.text}\n </Form.Button>\n <Form.Button\n label={confirmation.confirmButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handleSaveDictionaryConfirmation}\n >\n {confirmation.confirmButton.text}\n </Form.Button>\n </div>\n </form>\n </Modal>\n <form\n className={cn('flex justify-end gap-2 max-md:flex-col', className)}\n {...props}\n >\n {mode.includes('remote') &&\n isDistantDictionary &&\n onDelete &&\n isAuthenticated && (\n <Form.Button\n label={deleteButton.label.value}\n Icon={Trash}\n color=\"error\"\n variant=\"outline\"\n className=\"max-md:w-full\"\n isLoading={isDeleting}\n onClick={handleDeleteDictionary}\n >\n {deleteButton.text}\n </Form.Button>\n )}\n {isEdited && (\n <Form.Button\n label={resetButton.label.value}\n disabled={!isEdited}\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n className=\"max-md:w-full\"\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode.includes('local') && (\n <Form.Button\n label={downloadButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Download}\n color=\"text\"\n variant={isAuthenticated ? 'outline' : 'default'}\n className=\"max-md:w-full\"\n isLoading={isWriting}\n onClick={() => setIsFormatAlertModalOpen(true)}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') && isAuthenticated && !isDistantDictionary && (\n <Form.Button\n label={publishButton.label.value}\n disabled={isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') &&\n isAuthenticated &&\n isDistantDictionary &&\n isEdited && (\n <Form.Button\n label={saveButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n </form>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,wBAAwB,yBAAyB,IAAI,SAAS,KAAK;AACpE,QAAA,EAAE,oBAAoB,IAAI,6BAA6B;AAC7D,QAAM,EAAE,kBAAkB,WAAW,WAAA,IAAe,oBAAoB;AACxE,QAAM,EAAE,iBAAiB,WAAW,UAAA,IAAc,mBAAmB;AACrE,QAAM,EAAE,kBAAkB,WAAW,UAAA,IAAc,oBAAoB;AACvE,QAAM,YAAY,aAAa;AACzB,QAAA,eACJ,KAAK,SAAS,OAAO,KAAK,WAAW,UAAU,SAAS,OAAO;AAEjE,QAAM,EAAE,eAAe,qBAAqB,IAAI,iBAAiB;AAC3D,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,qBAAqB;AACjC,QAAA,EAAE,gBAAgB,IAAI,QAAQ;AAE9B,QAAA,mBAAmB,gBAAgB,WAAW,GAAG;AAEjD,QAAA,WACJ,oBACA,KAAK,UAAU,gBAAgB,MAAM,KAAK,UAAU,UAAU;AAE1D,QAAA,sBACJ,OAAQ,YAAkC,QAAQ;AAEpD,QAAM,mCAAmC,YAAY;AACnD,QAAI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AA,YAAL;AAAA,cACC,OAAO,eAAe,MAAM;AAAA,cAC5B,UAAU,CAAC,YAAY;AAAA,cACvB,MAAM;AAAA,cACN,OAAM;AAAA,cACN,SAAS,kBAAkB,YAAY;AAAA,cACvC,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS,MAAM,0BAA0B,IAAI;AAAA,cAE5C,UAAe,eAAA;AAAA,YAAA;AAAA,UAClB;AAAA,UAED,KAAK,SAAS,QAAQ,KAAK,mBAAmB,CAAC,uBAC9C;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,cAAc,MAAM;AAAA,cAC3B,UAAU;AAAA,cACV,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAc,cAAA;AAAA,YAAA;AAAA,UACjB;AAAA,UAED,KAAK,SAAS,QAAQ,KACrB,mBACA,uBACA,YACE;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,WAAW,MAAM;AAAA,cACxB,UAAU,CAAC,YAAY;AAAA,cACvB,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAW,WAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"SaveForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport {\n ArrowUpFromLine,\n Download,\n RotateCcw,\n Save,\n Trash,\n} from 'lucide-react';\nimport {\n type DetailedHTMLProps,\n type FC,\n type FormHTMLAttributes,\n useState,\n} from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Modal } from '../../../components/Modal';\nimport {\n useDeleteDictionary,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { cn } from '../../../utils/cn';\nimport { useAuth } from '../../Auth';\nimport { Form } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n} & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n className,\n onDelete,\n ...props\n}) => {\n const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = useState(false);\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { deleteDictionary, isLoading: isDeleting } = useDeleteDictionary();\n const { writeDictionary, isLoading: isWriting } = useWriteDictionary();\n const { pushDictionaries, isLoading: isPushing } = usePushDictionaries();\n const isLoading = isWriting || isPushing;\n const isJsonFormat =\n mode.includes('local') && dictionary.filePath?.endsWith('.json');\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const {\n deleteButton,\n resetButton,\n saveButton,\n publishButton,\n downloadButton,\n confirmation,\n } = useDictionary(saveDictionaryContent);\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = editedContent?.[dictionary.key];\n\n const isEdited =\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);\n\n const isDistantDictionary =\n typeof (dictionary as DistantDictionary)?._id !== 'undefined';\n\n const handleSaveDictionaryConfirmation = async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await writeDictionary(updatedDictionary).then(() => {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n });\n };\n\n const handlePushDictionary = async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await pushDictionaries([updatedDictionary]).then((res) => {\n if (res) {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n }\n });\n };\n\n const handleDeleteDictionary = async () => {\n if (!(dictionary as DistantDictionary)._id) return;\n\n await deleteDictionary(\n (dictionary as DistantDictionary)._id.toString()\n ).then((res) => {\n if (res) {\n onDelete?.();\n }\n });\n };\n\n return (\n <>\n <Modal\n isOpen={isFormatAlertModalOpen}\n title={confirmation.title.value}\n size=\"md\"\n >\n <form className=\"size-full px-3\">\n {isJsonFormat ? (\n <p className=\"text-neutral py-4 text-sm\">{confirmation.message}</p>\n ) : (\n <p className=\"text-neutral py-4 text-sm\">\n {confirmation.differentFormatMessage}\n </p>\n )}\n <div className=\"mt-12 flex justify-end gap-2 max-md:flex-col\">\n <Form.Button\n label={confirmation.cancelButton.label.value}\n disabled={!isEdited || isLoading}\n color=\"text\"\n className=\"max-md:w-full\"\n variant=\"outline\"\n onClick={() => setIsFormatAlertModalOpen(false)}\n >\n {confirmation.cancelButton.text}\n </Form.Button>\n <Form.Button\n label={confirmation.confirmButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handleSaveDictionaryConfirmation}\n >\n {confirmation.confirmButton.text}\n </Form.Button>\n </div>\n </form>\n </Modal>\n <form\n className={cn('flex justify-end gap-2 max-md:flex-col', className)}\n {...props}\n >\n {mode.includes('remote') &&\n isDistantDictionary &&\n onDelete &&\n isAuthenticated && (\n <Form.Button\n label={deleteButton.label.value}\n Icon={Trash}\n color=\"error\"\n variant=\"outline\"\n className=\"max-md:w-full\"\n isLoading={isDeleting}\n onClick={handleDeleteDictionary}\n >\n {deleteButton.text}\n </Form.Button>\n )}\n {isEdited && (\n <Form.Button\n label={resetButton.label.value}\n disabled={!isEdited}\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n className=\"max-md:w-full\"\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode.includes('local') && (\n <Form.Button\n label={downloadButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Download}\n color=\"text\"\n variant={isAuthenticated ? 'outline' : 'default'}\n className=\"max-md:w-full\"\n isLoading={isWriting}\n onClick={() => setIsFormatAlertModalOpen(true)}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') && isAuthenticated && !isDistantDictionary && (\n <Form.Button\n label={publishButton.label.value}\n disabled={isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') &&\n isAuthenticated &&\n isDistantDictionary &&\n isEdited && (\n <Form.Button\n label={saveButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n </form>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,wBAAwB,yBAAyB,IAAI,SAAS,KAAK;AACpE,QAAA,EAAE,oBAAoB,IAAI,6BAA6B;AAC7D,QAAM,EAAE,kBAAkB,WAAW,WAAA,IAAe,oBAAoB;AACxE,QAAM,EAAE,iBAAiB,WAAW,UAAA,IAAc,mBAAmB;AACrE,QAAM,EAAE,kBAAkB,WAAW,UAAA,IAAc,oBAAoB;AACvE,QAAM,YAAY,aAAa;AACzB,QAAA,eACJ,KAAK,SAAS,OAAO,KAAK,WAAW,UAAU,SAAS,OAAO;AAEjE,QAAM,EAAE,eAAe,qBAAqB,IAAI,iBAAiB;AAC3D,QAAA;A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strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const zod = require("../../zod-
|
|
5
|
+
const zod = require("../../zod-DpajDxlG.cjs");
|
|
6
6
|
const reactHookForm = require("react-hook-form");
|
|
7
7
|
const utils_cn = require("../../utils/cn.cjs");
|
|
8
8
|
const awaitFunction = async (fn) => {
|
|
@@ -33,7 +33,7 @@ const Form = ({
|
|
|
33
33
|
await awaitFunction(
|
|
34
34
|
onSubmitErrorProp?.(
|
|
35
35
|
new Error(
|
|
36
|
-
parsedValues.error.
|
|
36
|
+
parsedValues.error.issues.map((error) => error.message).join(", ")
|
|
37
37
|
)
|
|
38
38
|
)
|
|
39
39
|
);
|
|
@@ -45,13 +45,14 @@ const Form = ({
|
|
|
45
45
|
className: utils_cn.cn("flex size-full flex-col gap-y-6", className),
|
|
46
46
|
onSubmit: props.handleSubmit(onSubmit),
|
|
47
47
|
autoComplete: autoComplete ? "on" : "off",
|
|
48
|
+
noValidate: true,
|
|
48
49
|
children
|
|
49
50
|
}
|
|
50
51
|
) });
|
|
51
52
|
};
|
|
52
53
|
const useForm = (schema, props) => {
|
|
53
54
|
const form = reactHookForm.useForm({
|
|
54
|
-
resolver: zod.
|
|
55
|
+
resolver: zod.s(schema),
|
|
55
56
|
...props
|
|
56
57
|
});
|
|
57
58
|
const isSubmitting = form.formState.isSubmitting;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBase.cjs","sources":["../../../src/components/Form/FormBase.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { type HTMLAttributes } from 'react';\nimport {\n FormProvider,\n
|
|
1
|
+
{"version":3,"file":"FormBase.cjs","sources":["../../../src/components/Form/FormBase.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { type HTMLAttributes } from 'react';\nimport {\n FormProvider,\n useForm as useFormReactHookForm,\n type FormProviderProps,\n type UseFormProps,\n} from 'react-hook-form';\nimport type { ZodObject, z } from 'zod/v4';\nimport { cn } from '../../utils/cn';\n\ntype FormProps<T extends ZodObject> = HTMLAttributes<HTMLFormElement> &\n FormProviderProps<z.infer<T>> & {\n schema?: T;\n onSubmit?: (data: z.infer<T>) => void | Promise<void>;\n onSubmitSuccess?: (data: z.infer<T>) => void | Promise<void>;\n onSubmitError?: (error: Error) => void | Promise<void>;\n autoComplete?: boolean;\n };\n\nconst awaitFunction = async (fn: any) => {\n // Check if result is a Promise (Thenable)\n\n if (fn && typeof fn.then === 'function') {\n // It's a Promise, so wait for it to resolve\n return await fn;\n }\n // If not a Promise, it will just execute without awaiting\n return fn;\n};\n\nexport const Form = <T extends ZodObject>({\n schema,\n onSubmit: onSubmitProp,\n onSubmitSuccess: onSubmitSuccessProp,\n onSubmitError: onSubmitErrorProp,\n className,\n children,\n autoComplete,\n ...props\n}: FormProps<T>) => {\n const onSubmit = async (values: z.infer<T>) => {\n const parsedValues = schema?.safeParse(values) ?? {\n success: true,\n data: undefined,\n };\n\n // onSubmitProp?.(values);\n await awaitFunction(onSubmitProp?.(values));\n\n if (parsedValues.success) {\n await awaitFunction(onSubmitSuccessProp?.(parsedValues.data));\n } else {\n await awaitFunction(\n onSubmitErrorProp?.(\n new Error(\n parsedValues.error.issues.map((error) => error.message).join(', ')\n )\n )\n );\n }\n };\n\n return (\n <FormProvider {...props}>\n <form\n className={cn('flex size-full flex-col gap-y-6', className)}\n onSubmit={props.handleSubmit(onSubmit)}\n autoComplete={autoComplete ? 'on' : 'off'}\n noValidate\n >\n {children}\n </form>\n </FormProvider>\n );\n};\n\nexport const useForm = <T extends ZodObject>(\n schema: T,\n props?: UseFormProps<z.infer<T>>\n) => {\n const form = useFormReactHookForm<z.infer<T>>({\n resolver: zodResolver(schema as any),\n ...props,\n });\n\n const isSubmitting = form.formState.isSubmitting;\n const isSubmitted = form.formState.isSubmitted;\n const isLoading = form.formState.isLoading;\n const isValid = form.formState.isValid;\n\n return {\n form,\n isSubmitting,\n isSubmitted,\n isLoading,\n isValid,\n };\n};\n"],"names":["jsx","FormProvider","cn","useFormReactHookForm","zodResolver"],"mappings":";;;;;;;AAsBA,MAAM,gBAAgB,OAAO,OAAY;AAGvC,MAAI,MAAM,OAAO,GAAG,SAAS,YAAY;AAEvC,WAAO,MAAM;AAAA,EAAA;AAGR,SAAA;AACT;AAEO,MAAM,OAAO,CAAsB;AAAA,EACxC;AAAA,EACA,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoB;AACZ,QAAA,WAAW,OAAO,WAAuB;AAC7C,UAAM,eAAe,QAAQ,UAAU,MAAM,KAAK;AAAA,MAChD,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAGM,UAAA,cAAc,eAAe,MAAM,CAAC;AAE1C,QAAI,aAAa,SAAS;AACxB,YAAM,cAAc,sBAAsB,aAAa,IAAI,CAAC;AAAA,IAAA,OACvD;AACC,YAAA;AAAA,QACJ;AAAA,UACE,IAAI;AAAA,YACF,aAAa,MAAM,OAAO,IAAI,CAAC,UAAU,MAAM,OAAO,EAAE,KAAK,IAAI;AAAA,UAAA;AAAA,QACnE;AAAA,MAEJ;AAAA,IAAA;AAAA,EAEJ;AAGE,SAAAA,2BAAA,IAACC,cAAc,cAAA,EAAA,GAAG,OAChB,UAAAD,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWE,SAAAA,GAAG,mCAAmC,SAAS;AAAA,MAC1D,UAAU,MAAM,aAAa,QAAQ;AAAA,MACrC,cAAc,eAAe,OAAO;AAAA,MACpC,YAAU;AAAA,MAET;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAEa,MAAA,UAAU,CACrB,QACA,UACG;AACH,QAAM,OAAOC,cAAAA,QAAiC;AAAA,IAC5C,UAAUC,MAAY,MAAa;AAAA,IACnC,GAAG;AAAA,EAAA,CACJ;AAEK,QAAA,eAAe,KAAK,UAAU;AAC9B,QAAA,cAAc,KAAK,UAAU;AAC7B,QAAA,YAAY,KAAK,UAAU;AAC3B,QAAA,UAAU,KAAK,UAAU;AAExB,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { FormProviderProps, UseFormProps } from 'react-hook-form';
|
|
3
|
-
import {
|
|
4
|
-
type FormProps<T extends
|
|
3
|
+
import { ZodObject, z } from 'zod/v4';
|
|
4
|
+
type FormProps<T extends ZodObject> = HTMLAttributes<HTMLFormElement> & FormProviderProps<z.infer<T>> & {
|
|
5
5
|
schema?: T;
|
|
6
6
|
onSubmit?: (data: z.infer<T>) => void | Promise<void>;
|
|
7
7
|
onSubmitSuccess?: (data: z.infer<T>) => void | Promise<void>;
|
|
8
8
|
onSubmitError?: (error: Error) => void | Promise<void>;
|
|
9
9
|
autoComplete?: boolean;
|
|
10
10
|
};
|
|
11
|
-
export declare const Form: <T extends
|
|
12
|
-
export declare const useForm: <T extends
|
|
13
|
-
form: import('react-hook-form').UseFormReturn<z.
|
|
11
|
+
export declare const Form: <T extends ZodObject>({ schema, onSubmit: onSubmitProp, onSubmitSuccess: onSubmitSuccessProp, onSubmitError: onSubmitErrorProp, className, children, autoComplete, ...props }: FormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const useForm: <T extends ZodObject>(schema: T, props?: UseFormProps<z.infer<T>>) => {
|
|
13
|
+
form: import('react-hook-form').UseFormReturn<z.core.output<T>, any, z.core.output<T>>;
|
|
14
14
|
isSubmitting: boolean;
|
|
15
15
|
isSubmitted: boolean;
|
|
16
16
|
isLoading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBase.d.ts","sourceRoot":"","sources":["../../../src/components/Form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 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { s } from "../../zod-DIGMabE8.js";
|
|
4
4
|
import { useForm as useForm$1, FormProvider } from "react-hook-form";
|
|
5
5
|
import { cn } from "../../utils/cn.mjs";
|
|
6
6
|
const awaitFunction = async (fn) => {
|
|
@@ -31,7 +31,7 @@ const Form = ({
|
|
|
31
31
|
await awaitFunction(
|
|
32
32
|
onSubmitErrorProp?.(
|
|
33
33
|
new Error(
|
|
34
|
-
parsedValues.error.
|
|
34
|
+
parsedValues.error.issues.map((error) => error.message).join(", ")
|
|
35
35
|
)
|
|
36
36
|
)
|
|
37
37
|
);
|
|
@@ -43,13 +43,14 @@ const Form = ({
|
|
|
43
43
|
className: cn("flex size-full flex-col gap-y-6", className),
|
|
44
44
|
onSubmit: props.handleSubmit(onSubmit),
|
|
45
45
|
autoComplete: autoComplete ? "on" : "off",
|
|
46
|
+
noValidate: true,
|
|
46
47
|
children
|
|
47
48
|
}
|
|
48
49
|
) });
|
|
49
50
|
};
|
|
50
51
|
const useForm = (schema, props) => {
|
|
51
52
|
const form = useForm$1({
|
|
52
|
-
resolver:
|
|
53
|
+
resolver: s(schema),
|
|
53
54
|
...props
|
|
54
55
|
});
|
|
55
56
|
const isSubmitting = form.formState.isSubmitting;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBase.mjs","sources":["../../../src/components/Form/FormBase.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { type HTMLAttributes } from 'react';\nimport {\n FormProvider,\n
|
|
1
|
+
{"version":3,"file":"FormBase.mjs","sources":["../../../src/components/Form/FormBase.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { type HTMLAttributes } from 'react';\nimport {\n FormProvider,\n useForm as useFormReactHookForm,\n type FormProviderProps,\n type UseFormProps,\n} from 'react-hook-form';\nimport type { ZodObject, z } from 'zod/v4';\nimport { cn } from '../../utils/cn';\n\ntype FormProps<T extends ZodObject> = HTMLAttributes<HTMLFormElement> &\n FormProviderProps<z.infer<T>> & {\n schema?: T;\n onSubmit?: (data: z.infer<T>) => void | Promise<void>;\n onSubmitSuccess?: (data: z.infer<T>) => void | Promise<void>;\n onSubmitError?: (error: Error) => void | Promise<void>;\n autoComplete?: boolean;\n };\n\nconst awaitFunction = async (fn: any) => {\n // Check if result is a Promise (Thenable)\n\n if (fn && typeof fn.then === 'function') {\n // It's a Promise, so wait for it to resolve\n return await fn;\n }\n // If not a Promise, it will just execute without awaiting\n return fn;\n};\n\nexport const Form = <T extends ZodObject>({\n schema,\n onSubmit: onSubmitProp,\n onSubmitSuccess: onSubmitSuccessProp,\n onSubmitError: onSubmitErrorProp,\n className,\n children,\n autoComplete,\n ...props\n}: FormProps<T>) => {\n const onSubmit = async (values: z.infer<T>) => {\n const parsedValues = schema?.safeParse(values) ?? {\n success: true,\n data: undefined,\n };\n\n // onSubmitProp?.(values);\n await awaitFunction(onSubmitProp?.(values));\n\n if (parsedValues.success) {\n await awaitFunction(onSubmitSuccessProp?.(parsedValues.data));\n } else {\n await awaitFunction(\n onSubmitErrorProp?.(\n new Error(\n parsedValues.error.issues.map((error) => error.message).join(', ')\n )\n )\n );\n }\n };\n\n return (\n <FormProvider {...props}>\n <form\n className={cn('flex size-full flex-col gap-y-6', className)}\n onSubmit={props.handleSubmit(onSubmit)}\n autoComplete={autoComplete ? 'on' : 'off'}\n noValidate\n >\n {children}\n </form>\n </FormProvider>\n );\n};\n\nexport const useForm = <T extends ZodObject>(\n schema: T,\n props?: UseFormProps<z.infer<T>>\n) => {\n const form = useFormReactHookForm<z.infer<T>>({\n resolver: zodResolver(schema as any),\n ...props,\n });\n\n const isSubmitting = form.formState.isSubmitting;\n const isSubmitted = form.formState.isSubmitted;\n const isLoading = form.formState.isLoading;\n const isValid = form.formState.isValid;\n\n return {\n form,\n isSubmitting,\n isS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,UAAU;AAC3B,QAAA,UAAU,KAAK,UAAU;AAExB,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;"}
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const zod
|
|
5
|
+
const zod = require("../../../zod-DpajDxlG.cjs");
|
|
6
6
|
const reactHookForm = require("react-hook-form");
|
|
7
|
-
const
|
|
8
|
-
const Schema =
|
|
9
|
-
test:
|
|
7
|
+
const schemas = require("../../../schemas-DJhUvjsx.cjs");
|
|
8
|
+
const Schema = schemas.object({
|
|
9
|
+
test: schemas.string().min(3, "test error")
|
|
10
10
|
});
|
|
11
11
|
const FormElementWrapper = (props) => {
|
|
12
12
|
const objectFormSchema = props.schema ?? Schema;
|
|
13
13
|
const form = reactHookForm.useForm({
|
|
14
|
-
resolver: zod
|
|
14
|
+
resolver: zod.s(objectFormSchema),
|
|
15
15
|
values: props.values
|
|
16
16
|
});
|
|
17
17
|
const { children, onSubmit, ...rest } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormElementWrapper.cjs","sources":["../../../../src/components/Form/elements/FormElementWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport type { FC, FormEvent, HTMLProps } from 'react';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\nconst Schema = z.object({\n test: z.string().min(3, 'test error'),\n});\n\ntype FormElementWrapperProps = HTMLProps<HTMLFormElement> & {\n schema?: z.
|
|
1
|
+
{"version":3,"file":"FormElementWrapper.cjs","sources":["../../../../src/components/Form/elements/FormElementWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport type { FC, FormEvent, HTMLProps } from 'react';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport { z } from 'zod/v4';\n\nconst Schema = z.object({\n test: z.string().min(3, 'test error'),\n});\n\ntype FormElementWrapperProps = HTMLProps<HTMLFormElement> & {\n schema?: z.ZodObject;\n values?: z.infer<z.ZodObject>;\n};\n\nexport const FormElementWrapper: FC<FormElementWrapperProps> = (props) => {\n const objectFormSchema = props.schema ?? Schema;\n\n const form = useForm<z.infer<typeof objectFormSchema>>({\n resolver: zodResolver(objectFormSchema as any),\n values: props.values,\n });\n\n const { children, onSubmit, ...rest } = props;\n\n const onSubmitForm = (\n values: z.infer<typeof objectFormSchema>,\n event: FormEvent<HTMLFormElement>\n ) => {\n const parsedValues = objectFormSchema.safeParse(values);\n if (parsedValues.success) {\n onSubmit?.(event);\n }\n };\n\n return (\n <FormProvider {...form}>\n <form\n {...rest}\n onSubmit={(e) => {\n e.preventDefault();\n form.handleSubmit((values) => onSubmitForm(values, e));\n }}\n >\n {children}\n </form>\n </FormProvider>\n );\n};\n"],"names":["z.object","z.string","useForm","zodResolver","jsx","FormProvider"],"mappings":";;;;;;;AAOA,MAAM,SAASA,QAAAA,OAAS;AAAA,EACtB,MAAMC,QAAE,OAAA,EAAS,IAAI,GAAG,YAAY;AACtC,CAAC;AAOY,MAAA,qBAAkD,CAAC,UAAU;AAClE,QAAA,mBAAmB,MAAM,UAAU;AAEzC,QAAM,OAAOC,cAAAA,QAA0C;AAAA,IACrD,UAAUC,MAAY,gBAAuB;AAAA,IAC7C,QAAQ,MAAM;AAAA,EAAA,CACf;AAED,QAAM,EAAE,UAAU,UAAU,GAAG,KAAS,IAAA;AAElC,QAAA,eAAe,CACnB,QACA,UACG;AACG,UAAA,eAAe,iBAAiB,UAAU,MAAM;AACtD,QAAI,aAAa,SAAS;AACxB,iBAAW,KAAK;AAAA,IAAA;AAAA,EAEpB;AAGE,SAAAC,2BAAA,IAACC,cAAc,cAAA,EAAA,GAAG,MAChB,UAAAD,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,CAAC,MAAM;AACf,UAAE,eAAe;AACjB,aAAK,aAAa,CAAC,WAAW,aAAa,QAAQ,CAAC,CAAC;AAAA,MACvD;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FC, HTMLProps } from 'react';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
3
|
type FormElementWrapperProps = HTMLProps<HTMLFormElement> & {
|
|
4
|
-
schema?: z.
|
|
5
|
-
values?: z.infer<z.
|
|
4
|
+
schema?: z.ZodObject;
|
|
5
|
+
values?: z.infer<z.ZodObject>;
|
|
6
6
|
};
|
|
7
7
|
export declare const FormElementWrapper: FC<FormElementWrapperProps>;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormElementWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/elements/FormElementWrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"FormElementWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/elements/FormElementWrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAM3B,KAAK,uBAAuB,GAAG,SAAS,CAAC,eAAe,CAAC,GAAG;IAC1D,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAiC1D,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { s } from "../../../zod-DIGMabE8.js";
|
|
4
4
|
import { useForm, FormProvider } from "react-hook-form";
|
|
5
|
-
import {
|
|
6
|
-
const Schema =
|
|
7
|
-
test:
|
|
5
|
+
import { o as object, s as string } from "../../../schemas-7jC6hy_u.js";
|
|
6
|
+
const Schema = object({
|
|
7
|
+
test: string().min(3, "test error")
|
|
8
8
|
});
|
|
9
9
|
const FormElementWrapper = (props) => {
|
|
10
10
|
const objectFormSchema = props.schema ?? Schema;
|
|
11
11
|
const form = useForm({
|
|
12
|
-
resolver:
|
|
12
|
+
resolver: s(objectFormSchema),
|
|
13
13
|
values: props.values
|
|
14
14
|
});
|
|
15
15
|
const { children, onSubmit, ...rest } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormElementWrapper.mjs","sources":["../../../../src/components/Form/elements/FormElementWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport type { FC, FormEvent, HTMLProps } from 'react';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\nconst Schema = z.object({\n test: z.string().min(3, 'test error'),\n});\n\ntype FormElementWrapperProps = HTMLProps<HTMLFormElement> & {\n schema?: z.
|
|
1
|
+
{"version":3,"file":"FormElementWrapper.mjs","sources":["../../../../src/components/Form/elements/FormElementWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport type { FC, FormEvent, HTMLProps } from 'react';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport { z } from 'zod/v4';\n\nconst Schema = z.object({\n test: z.string().min(3, 'test error'),\n});\n\ntype FormElementWrapperProps = HTMLProps<HTMLFormElement> & {\n schema?: z.ZodObject;\n values?: z.infer<z.ZodObject>;\n};\n\nexport const FormElementWrapper: FC<FormElementWrapperProps> = (props) => {\n const objectFormSchema = props.schema ?? Schema;\n\n const form = useForm<z.infer<typeof objectFormSchema>>({\n resolver: zodResolver(objectFormSchema as any),\n values: props.values,\n });\n\n const { children, onSubmit, ...rest } = props;\n\n const onSubmitForm = (\n values: z.infer<typeof objectFormSchema>,\n event: FormEvent<HTMLFormElement>\n ) => {\n const parsedValues = objectFormSchema.safeParse(values);\n if (parsedValues.success) {\n onSubmit?.(event);\n }\n };\n\n return (\n <FormProvider {...form}>\n <form\n {...rest}\n onSubmit={(e) => {\n e.preventDefault();\n form.handleSubmit((values) => onSubmitForm(values, e));\n }}\n >\n {children}\n </form>\n </FormProvider>\n );\n};\n"],"names":["z.object","z.string","zodResolver"],"mappings":";;;;;AAOA,MAAM,SAASA,OAAS;AAAA,EACtB,MAAMC,OAAE,EAAS,IAAI,GAAG,YAAY;AACtC,CAAC;AAOY,MAAA,qBAAkD,CAAC,UAAU;AAClE,QAAA,mBAAmB,MAAM,UAAU;AAEzC,QAAM,OAAO,QAA0C;AAAA,IACrD,UAAUC,EAAY,gBAAuB;AAAA,IAC7C,QAAQ,MAAM;AAAA,EAAA,CACf;AAED,QAAM,EAAE,UAAU,UAAU,GAAG,KAAS,IAAA;AAElC,QAAA,eAAe,CACnB,QACA,UACG;AACG,UAAA,eAAe,iBAAiB,UAAU,MAAM;AACtD,QAAI,aAAa,SAAS;AACxB,iBAAW,KAAK;AAAA,IAAA;AAAA,EAEpB;AAGE,SAAA,oBAAC,cAAc,EAAA,GAAG,MAChB,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,CAAC,MAAM;AACf,UAAE,eAAe;AACjB,aAAK,aAAa,CAAC,WAAW,aAAa,QAAQ,CAAC,CAAC;AAAA,MACvD;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;"}
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -54,6 +54,7 @@ exports.useGetDictionaries = hooks_intlayerAPIHooks.useGetDictionaries;
|
|
|
54
54
|
exports.useGetDictionariesKeys = hooks_intlayerAPIHooks.useGetDictionariesKeys;
|
|
55
55
|
exports.useGetDictionary = hooks_intlayerAPIHooks.useGetDictionary;
|
|
56
56
|
exports.useGetEditorDictionaries = hooks_intlayerAPIHooks.useGetEditorDictionaries;
|
|
57
|
+
exports.useGetNewsletterStatus = hooks_intlayerAPIHooks.useGetNewsletterStatus;
|
|
57
58
|
exports.useGetOrganizations = hooks_intlayerAPIHooks.useGetOrganizations;
|
|
58
59
|
exports.useGetPricing = hooks_intlayerAPIHooks.useGetPricing;
|
|
59
60
|
exports.useGetProjects = hooks_intlayerAPIHooks.useGetProjects;
|
|
@@ -69,9 +70,11 @@ exports.useRegister = hooks_intlayerAPIHooks.useRegister;
|
|
|
69
70
|
exports.useSearchDoc = hooks_intlayerAPIHooks.useSearchDoc;
|
|
70
71
|
exports.useSelectOrganization = hooks_intlayerAPIHooks.useSelectOrganization;
|
|
71
72
|
exports.useSelectProject = hooks_intlayerAPIHooks.useSelectProject;
|
|
73
|
+
exports.useSubscribeToNewsletter = hooks_intlayerAPIHooks.useSubscribeToNewsletter;
|
|
72
74
|
exports.useTranslateJSONDeclaration = hooks_intlayerAPIHooks.useTranslateJSONDeclaration;
|
|
73
75
|
exports.useUnselectOrganization = hooks_intlayerAPIHooks.useUnselectOrganization;
|
|
74
76
|
exports.useUnselectProject = hooks_intlayerAPIHooks.useUnselectProject;
|
|
77
|
+
exports.useUnsubscribeFromNewsletter = hooks_intlayerAPIHooks.useUnsubscribeFromNewsletter;
|
|
75
78
|
exports.useUpdateDictionary = hooks_intlayerAPIHooks.useUpdateDictionary;
|
|
76
79
|
exports.useUpdateOrganization = hooks_intlayerAPIHooks.useUpdateOrganization;
|
|
77
80
|
exports.useUpdateOrganizationMembers = hooks_intlayerAPIHooks.useUpdateOrganizationMembers;
|
package/dist/hooks/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { useIsMounted } from "./useIsMounted.mjs";
|
|
|
5
5
|
import { useScrollDetection } from "./useScrollDetection.mjs";
|
|
6
6
|
import { useAsync } from "./useAsync/useAsync.mjs";
|
|
7
7
|
import { AsyncStateProvider, useAsyncState } from "./useAsync/useAsyncStateStore.mjs";
|
|
8
|
-
import { useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddProject, useAddTag, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditTag, useAutocomplete, useCancelSubscription, useChangePassword, useCheckIfUserHasPassword, useCreateUser, useDefineNewPassword, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteProject, useDeleteTag, useDeleteUser, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetEditorDictionaries, useGetOrganizations, useGetPricing, useGetProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUsers, useLogin, useLogout, usePushDictionaries, useRefreshAccessKey, useRegister, useSearchDoc, useSelectOrganization, useSelectProject, useTranslateJSONDeclaration, useUnselectOrganization, useUnselectProject, useUpdateDictionary, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateProject, useUpdateProjectMembers, useUpdateTag, useUpdateUser, useVerifyEmail, useWriteDictionary } from "./intlayerAPIHooks.mjs";
|
|
8
|
+
import { useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddProject, useAddTag, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditTag, useAutocomplete, useCancelSubscription, useChangePassword, useCheckIfUserHasPassword, useCreateUser, useDefineNewPassword, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteProject, useDeleteTag, useDeleteUser, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetEditorDictionaries, useGetNewsletterStatus, useGetOrganizations, useGetPricing, useGetProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUsers, useLogin, useLogout, usePushDictionaries, useRefreshAccessKey, useRegister, useSearchDoc, useSelectOrganization, useSelectProject, useSubscribeToNewsletter, useTranslateJSONDeclaration, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateDictionary, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateProject, useUpdateProjectMembers, useUpdateTag, useUpdateUser, useVerifyEmail, useWriteDictionary } from "./intlayerAPIHooks.mjs";
|
|
9
9
|
import { useItemSelector } from "./useItemSelector.mjs";
|
|
10
10
|
import { useGetAllDictionaries } from "./useGetAllDictionaries.mjs";
|
|
11
11
|
import { usePersistedStore } from "./usePersistedStore.mjs";
|
|
@@ -51,6 +51,7 @@ export {
|
|
|
51
51
|
useGetDictionary,
|
|
52
52
|
useGetEditorDictionaries,
|
|
53
53
|
useGetElementOrWindow,
|
|
54
|
+
useGetNewsletterStatus,
|
|
54
55
|
useGetOrganizations,
|
|
55
56
|
useGetPricing,
|
|
56
57
|
useGetProjects,
|
|
@@ -73,9 +74,11 @@ export {
|
|
|
73
74
|
useSearchDoc,
|
|
74
75
|
useSelectOrganization,
|
|
75
76
|
useSelectProject,
|
|
77
|
+
useSubscribeToNewsletter,
|
|
76
78
|
useTranslateJSONDeclaration,
|
|
77
79
|
useUnselectOrganization,
|
|
78
80
|
useUnselectProject,
|
|
81
|
+
useUnsubscribeFromNewsletter,
|
|
79
82
|
useUpdateDictionary,
|
|
80
83
|
useUpdateOrganization,
|
|
81
84
|
useUpdateOrganizationMembers,
|
|
@@ -9,6 +9,9 @@ require("react/jsx-runtime");
|
|
|
9
9
|
const hooks_useAsync_useAsync = require("./useAsync/useAsync.cjs");
|
|
10
10
|
const hooks_useIntlayerAPI = require("./useIntlayerAPI.cjs");
|
|
11
11
|
var define_process_env_default = {};
|
|
12
|
+
const formatErrorCode = (errorCode) => {
|
|
13
|
+
return errorCode.split("_").join(" ");
|
|
14
|
+
};
|
|
12
15
|
const useErrorHandling = (options) => {
|
|
13
16
|
const { toast } = components_Toaster_useToast.useToast();
|
|
14
17
|
return {
|
|
@@ -23,7 +26,9 @@ const useErrorHandling = (options) => {
|
|
|
23
26
|
}
|
|
24
27
|
[error].flatMap((error2) => error2).forEach(
|
|
25
28
|
(error2) => toast({
|
|
26
|
-
title: (
|
|
29
|
+
title: formatErrorCode(
|
|
30
|
+
(define_process_env_default.NODE_ENV === "production" ? error2.title : error2.code) ?? "Error"
|
|
31
|
+
),
|
|
27
32
|
description: error2.message ?? errorMessage ?? "An error occurred",
|
|
28
33
|
variant: "error"
|
|
29
34
|
})
|
|
@@ -454,6 +459,21 @@ const useAuditTag = (args) => useAppAsync("auditTag", hooks_useIntlayerAPI.useIn
|
|
|
454
459
|
const useAskDocQuestion = (args) => useAppAsync("askDocQuestion", hooks_useIntlayerAPI.useIntlayerAuth().ai.askDocQuestion, args);
|
|
455
460
|
const useAutocomplete = (args) => useAppAsync("autocomplete", hooks_useIntlayerAPI.useIntlayerAuth().ai.autocomplete, args);
|
|
456
461
|
const useSearchDoc = (args) => useAppAsync("searchDoc", hooks_useIntlayerAPI.useIntlayerAuth().search.searchDoc, args);
|
|
462
|
+
const useSubscribeToNewsletter = (args) => useAppAsync(
|
|
463
|
+
"subscribeToNewsletter",
|
|
464
|
+
hooks_useIntlayerAPI.useIntlayerAuth().newsletter.subscribeToNewsletter,
|
|
465
|
+
args
|
|
466
|
+
);
|
|
467
|
+
const useUnsubscribeFromNewsletter = (args) => useAppAsync(
|
|
468
|
+
"unsubscribeFromNewsletter",
|
|
469
|
+
hooks_useIntlayerAPI.useIntlayerAuth().newsletter.unsubscribeFromNewsletter,
|
|
470
|
+
args
|
|
471
|
+
);
|
|
472
|
+
const useGetNewsletterStatus = (args) => useAppAsync(
|
|
473
|
+
"getNewsletterStatus",
|
|
474
|
+
hooks_useIntlayerAPI.useIntlayerAuth().newsletter.getNewsletterStatus,
|
|
475
|
+
args
|
|
476
|
+
);
|
|
457
477
|
const useWriteDictionary = (args) => useEditorAsync(
|
|
458
478
|
"writeDictionary",
|
|
459
479
|
hooks_useIntlayerAPI.useIntlayerAuth().editor.writeDictionary,
|
|
@@ -492,6 +512,7 @@ exports.useGetDictionaries = useGetDictionaries;
|
|
|
492
512
|
exports.useGetDictionariesKeys = useGetDictionariesKeys;
|
|
493
513
|
exports.useGetDictionary = useGetDictionary;
|
|
494
514
|
exports.useGetEditorDictionaries = useGetEditorDictionaries;
|
|
515
|
+
exports.useGetNewsletterStatus = useGetNewsletterStatus;
|
|
495
516
|
exports.useGetOrganizations = useGetOrganizations;
|
|
496
517
|
exports.useGetPricing = useGetPricing;
|
|
497
518
|
exports.useGetProjects = useGetProjects;
|
|
@@ -507,9 +528,11 @@ exports.useRegister = useRegister;
|
|
|
507
528
|
exports.useSearchDoc = useSearchDoc;
|
|
508
529
|
exports.useSelectOrganization = useSelectOrganization;
|
|
509
530
|
exports.useSelectProject = useSelectProject;
|
|
531
|
+
exports.useSubscribeToNewsletter = useSubscribeToNewsletter;
|
|
510
532
|
exports.useTranslateJSONDeclaration = useTranslateJSONDeclaration;
|
|
511
533
|
exports.useUnselectOrganization = useUnselectOrganization;
|
|
512
534
|
exports.useUnselectProject = useUnselectProject;
|
|
535
|
+
exports.useUnsubscribeFromNewsletter = useUnsubscribeFromNewsletter;
|
|
513
536
|
exports.useUpdateDictionary = useUpdateDictionary;
|
|
514
537
|
exports.useUpdateOrganization = useUpdateOrganization;
|
|
515
538
|
exports.useUpdateOrganizationMembers = useUpdateOrganizationMembers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerAPIHooks.cjs","sources":["../../src/hooks/intlayerAPIHooks.ts"],"sourcesContent":["'use client';\n\nimport type { IntlayerAPI } from '@intlayer/api';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { useAuth } from '../components/Auth/useAuth/index';\nimport { useToast } from '../components/Toaster';\nimport { type UseAsyncOptions, useAsync } from './useAsync/useAsync';\nimport { useIntlayerAuth } from './useIntlayerAPI';\n\n/**\n * Hook to handle error logging and toast notifications\n */\nconst useErrorHandling = <T extends UseAsyncOptions<any>>(options: T): T => {\n const { toast } = useToast();\n\n return {\n ...options,\n onError: (errorMessage) => {\n let error;\n\n // If json is valid, parse it\n try {\n if (typeof errorMessage === 'undefined') return;\n\n error = JSON.parse(errorMessage);\n } catch (e) {\n // If json is not valid, set error to the original errorMessage\n\n error = errorMessage;\n }\n\n // render toast for each error if there is more than one\n // otherwise render the toast with the error message\n [error]\n .flatMap((error) => error)\n .forEach((error) =>\n toast({\n title:\n (process.env.NODE_ENV === 'production'\n ? error.title\n : error.code) ?? 'Error',\n description: error.message ?? errorMessage ?? 'An error occurred',\n variant: 'error',\n })\n );\n options.onError?.(errorMessage);\n },\n onSuccess: (data) => {\n if (data?.message)\n toast({\n title: data.message,\n description: data.description,\n variant: 'success',\n });\n options.onSuccess?.(data);\n },\n };\n};\n\ntype AuthEnableOptions = {\n requireUser?: boolean;\n requireProject?: boolean;\n requireOrganization?: boolean;\n};\n\n/**\n * Hook to enable authentication\n */\nconst useAuthEnable = <T extends UseAsyncOptions<any>>(\n options: T,\n { requireUser, requireProject, requireOrganization }: AuthEnableOptions = {}\n): T => {\n const configuration = useConfiguration();\n const { csrfToken, oAuth2AccessToken, session } = useAuth({\n intlayerConfiguration: configuration,\n });\n\n const isEnabledOption = options?.enable ?? true;\n const user = session ? session.user : oAuth2AccessToken?.user;\n\n const organization = session\n ? session.organization\n : oAuth2AccessToken?.organization;\n\n const project = session ? session.project : oAuth2AccessToken?.project;\n\n const isUserEnabled = requireUser ? Boolean(user) : true;\n\n const isProjectEnabled = requireProject ? Boolean(project) : true;\n\n const isOrganizationEnabled = requireOrganization\n ? Boolean(organization)\n : true;\n\n const isCSRFEnabled =\n Boolean(csrfToken) ||\n // If auth using session, csrf token is not required\n (!session && Boolean(oAuth2AccessToken));\n\n const isEnabled =\n isEnabledOption &&\n isUserEnabled &&\n isProjectEnabled &&\n isOrganizationEnabled &&\n isCSRFEnabled;\n\n return {\n ...options,\n enable: isEnabled,\n };\n};\n\nconst useAppAsync = <\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>,\n authOptions?: AuthEnableOptions\n) => {\n // Enhance options using custom hooks\n const optionsWithAuth = useAuthEnable(options ?? {}, authOptions);\n\n const optionsWithErrorHandling = useErrorHandling(optionsWithAuth);\n\n // Call the main useAsync hook with enhanced options\n return useAsync(key, asyncFunction, optionsWithErrorHandling);\n};\n\nconst useEditorAsync = <\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n) => {\n const optionsWithErrorHandling = useErrorHandling(options ?? {});\n\n // Call the main useAsync hook with enhanced options\n return useAsync(key, asyncFunction, optionsWithErrorHandling);\n};\n\n/**\n * Auth\n */\n\nexport const useLogin = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['login']>\n) =>\n useAppAsync('login', useIntlayerAuth().auth.login, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useRegister = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['register']>\n) =>\n useAppAsync('register', useIntlayerAuth().auth.register, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useLogout = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['logout']>\n) =>\n useAppAsync('logout', useIntlayerAuth().auth.logout, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useChangePassword = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['changePassword']>\n) => useAppAsync('changePassword', useIntlayerAuth().auth.changePassword, args);\n\nexport const useAskResetPassword = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['askResetPassword']>\n) =>\n useAppAsync(\n 'askResetPassword',\n useIntlayerAuth().auth.askResetPassword,\n args\n );\n\nexport const useDefineNewPassword = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['defineNewPassword']>\n) =>\n useAppAsync(\n 'defineNewPassword',\n useIntlayerAuth().auth.defineNewPassword,\n args\n );\n\nexport const useCheckIfUserHasPassword = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['checkIfUserHasPassword']>\n) =>\n useAppAsync(\n 'checkIfUserHasPassword',\n useIntlayerAuth().auth.checkIfUserHasPassword,\n args,\n {\n requireUser: true,\n }\n );\n\nexport const useVerifyEmail = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['verifyEmail']>\n) => useAppAsync('verifyEmail', useIntlayerAuth().auth.verifyEmail, args);\n\nexport const useGetUserByAccount = (\n args?: UseAsyncOptions<IntlayerAPI['user']['getUserByAccount']>\n) =>\n useAppAsync(\n 'getUserByAccount',\n useIntlayerAuth().user.getUserByAccount,\n args\n );\n\n/**\n * User\n */\n\nexport const useGetUsers = (\n args?: UseAsyncOptions<IntlayerAPI['user']['getUsers']>\n) =>\n useAppAsync(\n 'getUsers',\n useIntlayerAuth().user.getUsers,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n }\n );\n\nexport const useCreateUser = (\n args?: UseAsyncOptions<IntlayerAPI['user']['createUser']>\n) =>\n useAppAsync('createUser', useIntlayerAuth().user.createUser, {\n invalidateQueries: ['getUsers'],\n ...args,\n });\n\nexport const useUpdateUser = (\n args?: UseAsyncOptions<IntlayerAPI['user']['updateUser']>\n) =>\n useAppAsync('updateUser', useIntlayerAuth().user.updateUser, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useDeleteUser = (\n args?: UseAsyncOptions<IntlayerAPI['user']['deleteUser']>\n) =>\n useAppAsync('deleteUser', useIntlayerAuth().user.deleteUser, {\n invalidateQueries: ['getUsers'],\n ...args,\n });\n\n/**\n * Organization\n */\n\nexport const useGetOrganizations = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['getOrganizations']>\n) =>\n useAppAsync(\n 'getOrganizations',\n useIntlayerAuth().organization.getOrganizations,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n }\n );\n\nexport const useAddOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['addOrganization']>\n) =>\n useAppAsync(\n 'addOrganization',\n useIntlayerAuth().organization.addOrganization,\n {\n invalidateQueries: ['getOrganizations'],\n ...args,\n }\n );\n\nexport const useUpdateOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['updateOrganization']>\n) =>\n useAppAsync(\n 'updateOrganization',\n useIntlayerAuth().organization.updateOrganization,\n {\n invalidateQueries: ['getSession'],\n ...args,\n }\n );\n\nexport const useUpdateOrganizationMembers = (\n args?: UseAsyncOptions<\n IntlayerAPI['organization']['updateOrganizationMembers']\n >\n) =>\n useAppAsync(\n 'updateOrganizationMembers',\n useIntlayerAuth().organization.updateOrganizationMembers,\n {\n invalidateQueries: ['getOrganizations', 'getSession'],\n ...args,\n }\n );\n\nexport const useAddOrganizationMember = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['addOrganizationMember']>\n) =>\n useAppAsync(\n 'addOrganizationMember',\n useIntlayerAuth().organization.addOrganizationMember,\n {\n invalidateQueries: ['getOrganizations', 'getSession'],\n ...args,\n }\n );\n\nexport const useDeleteOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['deleteOrganization']>\n) =>\n useAppAsync(\n 'deleteOrganization',\n useIntlayerAuth().organization.deleteOrganization,\n {\n invalidateQueries: ['getOrganizations', 'getSession'],\n ...args,\n }\n );\n\nexport const useSelectOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['selectOrganization']>\n) =>\n useAppAsync(\n 'selectOrganization',\n useIntlayerAuth().organization.selectOrganization,\n {\n invalidateQueries: ['getSession'],\n ...args,\n }\n );\n\nexport const useUnselectOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['unselectOrganization']>\n) =>\n useAppAsync(\n 'unselectOrganization',\n useIntlayerAuth().organization.unselectOrganization,\n {\n invalidateQueries: ['getSession'],\n ...args,\n }\n );\n\n/**\n * Project\n */\n\nexport const useGetProjects = (\n args?: UseAsyncOptions<IntlayerAPI['project']['getProjects']>\n) =>\n useAppAsync(\n 'getProjects',\n useIntlayerAuth().project.getProjects,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n }\n );\n\nexport const useAddProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['addProject']>\n) =>\n useAppAsync('addProject', useIntlayerAuth().project.addProject, {\n invalidateQueries: ['getProjects'],\n ...args,\n });\n\nexport const useUpdateProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['updateProject']>\n) =>\n useAppAsync('updateProject', useIntlayerAuth().project.updateProject, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useUpdateProjectMembers = (\n args?: UseAsyncOptions<IntlayerAPI['project']['updateProjectMembers']>\n) =>\n useAppAsync(\n 'updateProjectMembers',\n useIntlayerAuth().project.updateProjectMembers,\n {\n invalidateQueries: ['getSession'],\n ...args,\n }\n );\n\nexport const useDeleteProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['deleteProject']>\n) =>\n useAppAsync('deleteProject', useIntlayerAuth().project.deleteProject, {\n invalidateQueries: ['getProjects', 'getSession'],\n ...args,\n });\n\nexport const useSelectProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['selectProject']>\n) =>\n useAppAsync('selectProject', useIntlayerAuth().project.selectProject, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useUnselectProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['unselectProject']>\n) =>\n useAppAsync('unselectProject', useIntlayerAuth().project.unselectProject, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useAddNewAccessKey = (\n args?: UseAsyncOptions<IntlayerAPI['project']['addNewAccessKey']>\n) =>\n useAppAsync('addNewAccessKey', useIntlayerAuth().project.addNewAccessKey, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useDeleteAccessKey = (\n args?: UseAsyncOptions<IntlayerAPI['project']['deleteAccessKey']>\n) =>\n useAppAsync('deleteAccessKey', useIntlayerAuth().project.deleteAccessKey, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useRefreshAccessKey = (\n args?: UseAsyncOptions<IntlayerAPI['project']['refreshAccessKey']>\n) =>\n useAppAsync('refreshAccessKey', useIntlayerAuth().project.refreshAccessKey, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\n/**\n * Dictionary\n */\n\nexport const useGetDictionaries = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['getDictionaries']>\n) =>\n useAppAsync(\n 'getDictionaries',\n useIntlayerAuth().dictionary.getDictionaries,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useGetDictionariesKeys = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['getDictionariesKeys']>\n) =>\n useAppAsync(\n 'getDictionariesKeys',\n useIntlayerAuth().dictionary.getDictionariesKeys,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useGetDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['getDictionary']>\n) =>\n useAppAsync(\n 'getDictionary',\n useIntlayerAuth().dictionary.getDictionary,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useAddDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['addDictionary']>\n) =>\n useAppAsync('addDictionary', useIntlayerAuth().dictionary.addDictionary, {\n invalidateQueries: ['getDictionaries', 'getDictionariesKeys'],\n ...args,\n });\n\nexport const usePushDictionaries = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['pushDictionaries']>\n) =>\n useAppAsync(\n 'pushDictionaries',\n useIntlayerAuth().dictionary.pushDictionaries,\n {\n invalidateQueries: [\n 'getDictionaries',\n 'getDictionary',\n 'getDictionariesKeys',\n ],\n ...args,\n }\n );\n\nexport const useUpdateDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['updateDictionary']>\n) =>\n useAppAsync(\n 'updateDictionary',\n useIntlayerAuth().dictionary.updateDictionary,\n {\n invalidateQueries: ['getDictionaries', 'getDictionary'],\n ...args,\n }\n );\n\nexport const useDeleteDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['deleteDictionary']>\n) =>\n useAppAsync(\n 'deleteDictionary',\n useIntlayerAuth().dictionary.deleteDictionary,\n {\n invalidateQueries: [\n 'getDictionaries',\n 'getDictionary',\n 'getDictionariesKeys',\n ],\n ...args,\n }\n );\n\n/**\n * Tag\n */\n\nexport const useGetTags = (\n args?: UseAsyncOptions<IntlayerAPI['tag']['getTags']>\n) =>\n useAppAsync(\n 'getTags',\n useIntlayerAuth().tag.getTags,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n }\n );\n\nexport const useAddTag = (\n args?: UseAsyncOptions<IntlayerAPI['tag']['addTag']>\n) =>\n useAppAsync('addTag', useIntlayerAuth().tag.addTag, {\n invalidateQueries: ['getTags'],\n ...args,\n });\n\nexport const useUpdateTag = (\n args?: UseAsyncOptions<IntlayerAPI['tag']['updateTag']>\n) =>\n useAppAsync('updateTag', useIntlayerAuth().tag.updateTag, {\n invalidateQueries: ['getTags'],\n ...args,\n });\n\nexport const useDeleteTag = (\n args?: UseAsyncOptions<IntlayerAPI['tag']['deleteTag']>\n) =>\n useAppAsync('deleteTag', useIntlayerAuth().tag.deleteTag, {\n invalidateQueries: ['getTags'],\n ...args,\n });\n\n/**\n * Stripe\n */\n\nexport const useGetPricing = (\n args?: UseAsyncOptions<IntlayerAPI['stripe']['getPricing']>\n) =>\n useAppAsync('getPricing', useIntlayerAuth().stripe.getPricing, {\n store: true,\n cache: true,\n ...args,\n });\n\nexport const useGetSubscription = (\n args?: UseAsyncOptions<IntlayerAPI['stripe']['getSubscription']>\n) =>\n useAppAsync(\n 'getSubscription',\n useIntlayerAuth().stripe.getSubscription,\n args,\n {\n requireUser: true,\n requireOrganization: true,\n }\n );\n\nexport const useCancelSubscription = (\n args?: UseAsyncOptions<IntlayerAPI['stripe']['cancelSubscription']>\n) =>\n useAppAsync(\n 'cancelSubscription',\n useIntlayerAuth().stripe.cancelSubscription,\n { invalidateQueries: ['getSession'], ...args },\n {\n requireUser: true,\n requireOrganization: true,\n }\n );\n\n/**\n * AI\n */\n\nexport const useTranslateJSONDeclaration = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['translateJSON']>\n) =>\n useAppAsync('translateJSON', useIntlayerAuth().ai.translateJSON, args, {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n });\n\nexport const useAuditContentDeclaration = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['auditContentDeclaration']>\n) =>\n useAppAsync(\n 'auditContentDeclaration',\n useIntlayerAuth().ai.auditContentDeclaration,\n args,\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useAuditContentDeclarationMetadata = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['auditContentDeclarationMetadata']>\n) =>\n useAppAsync(\n 'auditContentDeclaration',\n useIntlayerAuth().ai.auditContentDeclarationMetadata,\n args,\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useAuditContentDeclarationField = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['auditContentDeclarationField']>\n) =>\n useAppAsync(\n 'auditContentDeclarationField',\n useIntlayerAuth().ai.auditContentDeclarationField,\n args,\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useAuditTag = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['auditTag']>\n) =>\n useAppAsync('auditTag', useIntlayerAuth().ai.auditTag, args, {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n });\n\nexport const useAskDocQuestion = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['askDocQuestion']>\n) => useAppAsync('askDocQuestion', useIntlayerAuth().ai.askDocQuestion, args);\n\nexport const useAutocomplete = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['autocomplete']>\n) => useAppAsync('autocomplete', useIntlayerAuth().ai.autocomplete, args);\n\n/**\n * Search\n */\n\nexport const useSearchDoc = (\n args?: UseAsyncOptions<IntlayerAPI['search']['searchDoc']>\n) => useAppAsync('searchDoc', useIntlayerAuth().search.searchDoc, args);\n\n/**\n * Editor\n */\n\nexport const useWriteDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['editor']['writeDictionary']>\n) =>\n useEditorAsync(\n 'writeDictionary',\n useIntlayerAuth().editor.writeDictionary,\n args\n );\n\nexport const useGetEditorDictionaries = (\n args?: UseAsyncOptions<IntlayerAPI['editor']['getDictionaries']>\n) =>\n useEditorAsync('getDictionaries', useIntlayerAuth().editor.getDictionaries, {\n store: true,\n cache: true,\n ...args,\n });\n"],"names":["useToast","error","useConfiguration","useAuth","useAsync","useIntlayerAuth"],"mappings":";;;;;;;;;;;AAYA,MAAM,mBAAmB,CAAiC,YAAkB;AACpE,QAAA,EAAE,MAAM,IAAIA,qCAAS;AAEpB,SAAA;AAAA,IACL,GAAG;AAAA,IACH,SAAS,CAAC,iBAAiB;AACrB,UAAA;AAGA,UAAA;AACE,YAAA,OAAO,iBAAiB,YAAa;AAEjC,gBAAA,KAAK,MAAM,YAAY;AAAA,eACxB,GAAG;AAGF,gBAAA;AAAA,MAAA;AAKV,OAAC,KAAK,EACH,QAAQ,CAACC,WAAUA,MAAK,EACxB;AAAA,QAAQ,CAACA,WACR,MAAM;AAAA,UACJ,QACG,2BAAY,aAAa,eACtBA,OAAM,QACNA,OAAM,SAAS;AAAA,UACrB,aAAaA,OAAM,WAAW,gBAAgB;AAAA,UAC9C,SAAS;AAAA,QACV,CAAA;AAAA,MACH;AACF,cAAQ,UAAU,YAAY;AAAA,IAChC;AAAA,IACA,WAAW,CAAC,SAAS;AACnB,UAAI,MAAM;AACF,cAAA;AAAA,UACJ,OAAO,KAAK;AAAA,UACZ,aAAa,KAAK;AAAA,UAClB,SAAS;AAAA,QAAA,CACV;AACH,cAAQ,YAAY,IAAI;AAAA,IAAA;AAAA,EAE5B;AACF;AAWA,MAAM,gBAAgB,CACpB,SACA,EAAE,aAAa,gBAAgB,oBAA2C,IAAA,OACpE;AACN,QAAM,gBAAgBC,YAAAA,iBAAiB;AACvC,QAAM,EAAE,WAAW,mBAAmB,QAAA,IAAYC,8BAAAA,QAAQ;AAAA,IACxD,uBAAuB;AAAA,EAAA,CACxB;AAEK,QAAA,kBAAkB,SAAS,UAAU;AAC3C,QAAM,OAAO,UAAU,QAAQ,OAAO,mBAAmB;AAEzD,QAAM,eAAe,UACjB,QAAQ,eACR,mBAAmB;AAEvB,QAAM,UAAU,UAAU,QAAQ,UAAU,mBAAmB;AAE/D,QAAM,gBAAgB,cAAc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MAAA,qCAAqC,CAChD,SAEA;AAAA,EACE;AAAA,EACAA,qBAAA,gBAAA,EAAkB,GAAG;AAAA,EACrB;AAAA,EACA;AAAA,IACE,aAAa;AAAA,IACb,qBAAqB;AAAA,IACrB,gBAAgB;AAAA,EAAA;AAEpB;AAEW,MAAA,kCAAkC,CAC7C,SAEA;AAAA,EACE;AAAA,EACAA,qBAAA,gBAAA,EAAkB,GAAG;AAAA,EACrB;AAAA,EACA;AAAA,IACE,aAAa;AAAA,IACb,qBAAqB;AAAA,IACrB,gBAAgB;AAAA,EAAA;AAEpB;AAEW,MAAA,cAAc,CACzB,SAEA,YAAY,YAAYA,qBAAAA,kBAAkB,GAAG,UAAU,MAAM;AAAA,EAC3D,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,gBAAgB;AAClB,CAAC;AAEU,MAAA,oBAAoB,CAC/B,SACG,YAAY,kBAAkBA,qBAAAA,kBAAkB,GAAG,gBAAgB,IAAI;AAE/D,MAAA,kBAAkB,CAC7B,SACG,YAAY,gBAAgBA,qBAAAA,kBAAkB,GAAG,cAAc,IAAI;AAM3D,MAAA,eAAe,CAC1B,SACG,YAAY,aAAaA,qBAAAA,kBAAkB,OAAO,WAAW,IAAI;AAMzD,MAAA,qBAAqB,CAChC,SAEA;AAAA,EACE;AAAA,EACAA,qBAAA,gBAAA,EAAkB,OAAO;AAAA,EACzB;AACF;AAEW,MAAA,2BAA2B,CACtC,SAEA,eAAe,mBAAmBA,qCAAgB,EAAE,OAAO,iBAAiB;AAAA,EAC1E,OAAO;AAAA,EACP,OAAO;AAAA,EACP,GAAG;AACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"intlayerAPIHooks.cjs","sources":["../../src/hooks/intlayerAPIHooks.ts"],"sourcesContent":["'use client';\n\nimport type { IntlayerAPI } from '@intlayer/api';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { useAuth } from '../components/Auth/useAuth/index';\nimport { useToast } from '../components/Toaster';\nimport { type UseAsyncOptions, useAsync } from './useAsync/useAsync';\nimport { useIntlayerAuth } from './useIntlayerAPI';\n\nconst formatErrorCode = (errorCode: string) => {\n return errorCode.split('_').join(' ');\n};\n\n/**\n * Hook to handle error logging and toast notifications\n */\nconst useErrorHandling = <T extends UseAsyncOptions<any>>(options: T): T => {\n const { toast } = useToast();\n\n return {\n ...options,\n onError: (errorMessage) => {\n let error;\n\n // If json is valid, parse it\n try {\n if (typeof errorMessage === 'undefined') return;\n\n error = JSON.parse(errorMessage);\n } catch (e) {\n // If json is not valid, set error to the original errorMessage\n\n error = errorMessage;\n }\n\n // render toast for each error if there is more than one\n // otherwise render the toast with the error message\n [error]\n .flatMap((error) => error)\n .forEach((error) =>\n toast({\n title: formatErrorCode(\n (process.env.NODE_ENV === 'production'\n ? error.title\n : error.code) ?? 'Error'\n ),\n description: error.message ?? errorMessage ?? 'An error occurred',\n variant: 'error',\n })\n );\n options.onError?.(errorMessage);\n },\n onSuccess: (data) => {\n if (data?.message)\n toast({\n title: data.message,\n description: data.description,\n variant: 'success',\n });\n options.onSuccess?.(data);\n },\n };\n};\n\ntype AuthEnableOptions = {\n requireUser?: boolean;\n requireProject?: boolean;\n requireOrganization?: boolean;\n};\n\n/**\n * Hook to enable authentication\n */\nconst useAuthEnable = <T extends UseAsyncOptions<any>>(\n options: T,\n { requireUser, requireProject, requireOrganization }: AuthEnableOptions = {}\n): T => {\n const configuration = useConfiguration();\n const { csrfToken, oAuth2AccessToken, session } = useAuth({\n intlayerConfiguration: configuration,\n });\n\n const isEnabledOption = options?.enable ?? true;\n const user = session ? session.user : oAuth2AccessToken?.user;\n\n const organization = session\n ? session.organization\n : oAuth2AccessToken?.organization;\n\n const project = session ? session.project : oAuth2AccessToken?.project;\n\n const isUserEnabled = requireUser ? Boolean(user) : true;\n\n const isProjectEnabled = requireProject ? Boolean(project) : true;\n\n const isOrganizationEnabled = requireOrganization\n ? Boolean(organization)\n : true;\n\n const isCSRFEnabled =\n Boolean(csrfToken) ||\n // If auth using session, csrf token is not required\n (!session && Boolean(oAuth2AccessToken));\n\n const isEnabled =\n isEnabledOption &&\n isUserEnabled &&\n isProjectEnabled &&\n isOrganizationEnabled &&\n isCSRFEnabled;\n\n return {\n ...options,\n enable: isEnabled,\n };\n};\n\nconst useAppAsync = <\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>,\n authOptions?: AuthEnableOptions\n) => {\n // Enhance options using custom hooks\n const optionsWithAuth = useAuthEnable(options ?? {}, authOptions);\n\n const optionsWithErrorHandling = useErrorHandling(optionsWithAuth);\n\n // Call the main useAsync hook with enhanced options\n return useAsync(key, asyncFunction, optionsWithErrorHandling);\n};\n\nconst useEditorAsync = <\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n) => {\n const optionsWithErrorHandling = useErrorHandling(options ?? {});\n\n // Call the main useAsync hook with enhanced options\n return useAsync(key, asyncFunction, optionsWithErrorHandling);\n};\n\n/**\n * Auth\n */\n\nexport const useLogin = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['login']>\n) =>\n useAppAsync('login', useIntlayerAuth().auth.login, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useRegister = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['register']>\n) =>\n useAppAsync('register', useIntlayerAuth().auth.register, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useLogout = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['logout']>\n) =>\n useAppAsync('logout', useIntlayerAuth().auth.logout, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useChangePassword = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['changePassword']>\n) => useAppAsync('changePassword', useIntlayerAuth().auth.changePassword, args);\n\nexport const useAskResetPassword = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['askResetPassword']>\n) =>\n useAppAsync(\n 'askResetPassword',\n useIntlayerAuth().auth.askResetPassword,\n args\n );\n\nexport const useDefineNewPassword = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['defineNewPassword']>\n) =>\n useAppAsync(\n 'defineNewPassword',\n useIntlayerAuth().auth.defineNewPassword,\n args\n );\n\nexport const useCheckIfUserHasPassword = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['checkIfUserHasPassword']>\n) =>\n useAppAsync(\n 'checkIfUserHasPassword',\n useIntlayerAuth().auth.checkIfUserHasPassword,\n args,\n {\n requireUser: true,\n }\n );\n\nexport const useVerifyEmail = (\n args?: UseAsyncOptions<IntlayerAPI['auth']['verifyEmail']>\n) => useAppAsync('verifyEmail', useIntlayerAuth().auth.verifyEmail, args);\n\nexport const useGetUserByAccount = (\n args?: UseAsyncOptions<IntlayerAPI['user']['getUserByAccount']>\n) =>\n useAppAsync(\n 'getUserByAccount',\n useIntlayerAuth().user.getUserByAccount,\n args\n );\n\n/**\n * User\n */\n\nexport const useGetUsers = (\n args?: UseAsyncOptions<IntlayerAPI['user']['getUsers']>\n) =>\n useAppAsync(\n 'getUsers',\n useIntlayerAuth().user.getUsers,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n }\n );\n\nexport const useCreateUser = (\n args?: UseAsyncOptions<IntlayerAPI['user']['createUser']>\n) =>\n useAppAsync('createUser', useIntlayerAuth().user.createUser, {\n invalidateQueries: ['getUsers'],\n ...args,\n });\n\nexport const useUpdateUser = (\n args?: UseAsyncOptions<IntlayerAPI['user']['updateUser']>\n) =>\n useAppAsync('updateUser', useIntlayerAuth().user.updateUser, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useDeleteUser = (\n args?: UseAsyncOptions<IntlayerAPI['user']['deleteUser']>\n) =>\n useAppAsync('deleteUser', useIntlayerAuth().user.deleteUser, {\n invalidateQueries: ['getUsers'],\n ...args,\n });\n\n/**\n * Organization\n */\n\nexport const useGetOrganizations = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['getOrganizations']>\n) =>\n useAppAsync(\n 'getOrganizations',\n useIntlayerAuth().organization.getOrganizations,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n }\n );\n\nexport const useAddOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['addOrganization']>\n) =>\n useAppAsync(\n 'addOrganization',\n useIntlayerAuth().organization.addOrganization,\n {\n invalidateQueries: ['getOrganizations'],\n ...args,\n }\n );\n\nexport const useUpdateOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['updateOrganization']>\n) =>\n useAppAsync(\n 'updateOrganization',\n useIntlayerAuth().organization.updateOrganization,\n {\n invalidateQueries: ['getSession'],\n ...args,\n }\n );\n\nexport const useUpdateOrganizationMembers = (\n args?: UseAsyncOptions<\n IntlayerAPI['organization']['updateOrganizationMembers']\n >\n) =>\n useAppAsync(\n 'updateOrganizationMembers',\n useIntlayerAuth().organization.updateOrganizationMembers,\n {\n invalidateQueries: ['getOrganizations', 'getSession'],\n ...args,\n }\n );\n\nexport const useAddOrganizationMember = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['addOrganizationMember']>\n) =>\n useAppAsync(\n 'addOrganizationMember',\n useIntlayerAuth().organization.addOrganizationMember,\n {\n invalidateQueries: ['getOrganizations', 'getSession'],\n ...args,\n }\n );\n\nexport const useDeleteOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['deleteOrganization']>\n) =>\n useAppAsync(\n 'deleteOrganization',\n useIntlayerAuth().organization.deleteOrganization,\n {\n invalidateQueries: ['getOrganizations', 'getSession'],\n ...args,\n }\n );\n\nexport const useSelectOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['selectOrganization']>\n) =>\n useAppAsync(\n 'selectOrganization',\n useIntlayerAuth().organization.selectOrganization,\n {\n invalidateQueries: ['getSession'],\n ...args,\n }\n );\n\nexport const useUnselectOrganization = (\n args?: UseAsyncOptions<IntlayerAPI['organization']['unselectOrganization']>\n) =>\n useAppAsync(\n 'unselectOrganization',\n useIntlayerAuth().organization.unselectOrganization,\n {\n invalidateQueries: ['getSession'],\n ...args,\n }\n );\n\n/**\n * Project\n */\n\nexport const useGetProjects = (\n args?: UseAsyncOptions<IntlayerAPI['project']['getProjects']>\n) =>\n useAppAsync(\n 'getProjects',\n useIntlayerAuth().project.getProjects,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n }\n );\n\nexport const useAddProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['addProject']>\n) =>\n useAppAsync('addProject', useIntlayerAuth().project.addProject, {\n invalidateQueries: ['getProjects'],\n ...args,\n });\n\nexport const useUpdateProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['updateProject']>\n) =>\n useAppAsync('updateProject', useIntlayerAuth().project.updateProject, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useUpdateProjectMembers = (\n args?: UseAsyncOptions<IntlayerAPI['project']['updateProjectMembers']>\n) =>\n useAppAsync(\n 'updateProjectMembers',\n useIntlayerAuth().project.updateProjectMembers,\n {\n invalidateQueries: ['getSession'],\n ...args,\n }\n );\n\nexport const useDeleteProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['deleteProject']>\n) =>\n useAppAsync('deleteProject', useIntlayerAuth().project.deleteProject, {\n invalidateQueries: ['getProjects', 'getSession'],\n ...args,\n });\n\nexport const useSelectProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['selectProject']>\n) =>\n useAppAsync('selectProject', useIntlayerAuth().project.selectProject, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useUnselectProject = (\n args?: UseAsyncOptions<IntlayerAPI['project']['unselectProject']>\n) =>\n useAppAsync('unselectProject', useIntlayerAuth().project.unselectProject, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useAddNewAccessKey = (\n args?: UseAsyncOptions<IntlayerAPI['project']['addNewAccessKey']>\n) =>\n useAppAsync('addNewAccessKey', useIntlayerAuth().project.addNewAccessKey, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useDeleteAccessKey = (\n args?: UseAsyncOptions<IntlayerAPI['project']['deleteAccessKey']>\n) =>\n useAppAsync('deleteAccessKey', useIntlayerAuth().project.deleteAccessKey, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\nexport const useRefreshAccessKey = (\n args?: UseAsyncOptions<IntlayerAPI['project']['refreshAccessKey']>\n) =>\n useAppAsync('refreshAccessKey', useIntlayerAuth().project.refreshAccessKey, {\n invalidateQueries: ['getSession'],\n ...args,\n });\n\n/**\n * Dictionary\n */\n\nexport const useGetDictionaries = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['getDictionaries']>\n) =>\n useAppAsync(\n 'getDictionaries',\n useIntlayerAuth().dictionary.getDictionaries,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useGetDictionariesKeys = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['getDictionariesKeys']>\n) =>\n useAppAsync(\n 'getDictionariesKeys',\n useIntlayerAuth().dictionary.getDictionariesKeys,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useGetDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['getDictionary']>\n) =>\n useAppAsync(\n 'getDictionary',\n useIntlayerAuth().dictionary.getDictionary,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useAddDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['addDictionary']>\n) =>\n useAppAsync('addDictionary', useIntlayerAuth().dictionary.addDictionary, {\n invalidateQueries: ['getDictionaries', 'getDictionariesKeys'],\n ...args,\n });\n\nexport const usePushDictionaries = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['pushDictionaries']>\n) =>\n useAppAsync(\n 'pushDictionaries',\n useIntlayerAuth().dictionary.pushDictionaries,\n {\n invalidateQueries: [\n 'getDictionaries',\n 'getDictionary',\n 'getDictionariesKeys',\n ],\n ...args,\n }\n );\n\nexport const useUpdateDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['updateDictionary']>\n) =>\n useAppAsync(\n 'updateDictionary',\n useIntlayerAuth().dictionary.updateDictionary,\n {\n invalidateQueries: ['getDictionaries', 'getDictionary'],\n ...args,\n }\n );\n\nexport const useDeleteDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['dictionary']['deleteDictionary']>\n) =>\n useAppAsync(\n 'deleteDictionary',\n useIntlayerAuth().dictionary.deleteDictionary,\n {\n invalidateQueries: [\n 'getDictionaries',\n 'getDictionary',\n 'getDictionariesKeys',\n ],\n ...args,\n }\n );\n\n/**\n * Tag\n */\n\nexport const useGetTags = (\n args?: UseAsyncOptions<IntlayerAPI['tag']['getTags']>\n) =>\n useAppAsync(\n 'getTags',\n useIntlayerAuth().tag.getTags,\n {\n cache: true,\n store: true,\n retryLimit: 3,\n autoFetch: true,\n revalidation: true,\n revalidateTime: 5 * 60 * 1000, // 5 minutes\n ...args,\n },\n {\n requireUser: true,\n requireOrganization: true,\n }\n );\n\nexport const useAddTag = (\n args?: UseAsyncOptions<IntlayerAPI['tag']['addTag']>\n) =>\n useAppAsync('addTag', useIntlayerAuth().tag.addTag, {\n invalidateQueries: ['getTags'],\n ...args,\n });\n\nexport const useUpdateTag = (\n args?: UseAsyncOptions<IntlayerAPI['tag']['updateTag']>\n) =>\n useAppAsync('updateTag', useIntlayerAuth().tag.updateTag, {\n invalidateQueries: ['getTags'],\n ...args,\n });\n\nexport const useDeleteTag = (\n args?: UseAsyncOptions<IntlayerAPI['tag']['deleteTag']>\n) =>\n useAppAsync('deleteTag', useIntlayerAuth().tag.deleteTag, {\n invalidateQueries: ['getTags'],\n ...args,\n });\n\n/**\n * Stripe\n */\n\nexport const useGetPricing = (\n args?: UseAsyncOptions<IntlayerAPI['stripe']['getPricing']>\n) =>\n useAppAsync('getPricing', useIntlayerAuth().stripe.getPricing, {\n store: true,\n cache: true,\n ...args,\n });\n\nexport const useGetSubscription = (\n args?: UseAsyncOptions<IntlayerAPI['stripe']['getSubscription']>\n) =>\n useAppAsync(\n 'getSubscription',\n useIntlayerAuth().stripe.getSubscription,\n args,\n {\n requireUser: true,\n requireOrganization: true,\n }\n );\n\nexport const useCancelSubscription = (\n args?: UseAsyncOptions<IntlayerAPI['stripe']['cancelSubscription']>\n) =>\n useAppAsync(\n 'cancelSubscription',\n useIntlayerAuth().stripe.cancelSubscription,\n { invalidateQueries: ['getSession'], ...args },\n {\n requireUser: true,\n requireOrganization: true,\n }\n );\n\n/**\n * AI\n */\n\nexport const useTranslateJSONDeclaration = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['translateJSON']>\n) =>\n useAppAsync('translateJSON', useIntlayerAuth().ai.translateJSON, args, {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n });\n\nexport const useAuditContentDeclaration = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['auditContentDeclaration']>\n) =>\n useAppAsync(\n 'auditContentDeclaration',\n useIntlayerAuth().ai.auditContentDeclaration,\n args,\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useAuditContentDeclarationMetadata = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['auditContentDeclarationMetadata']>\n) =>\n useAppAsync(\n 'auditContentDeclaration',\n useIntlayerAuth().ai.auditContentDeclarationMetadata,\n args,\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useAuditContentDeclarationField = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['auditContentDeclarationField']>\n) =>\n useAppAsync(\n 'auditContentDeclarationField',\n useIntlayerAuth().ai.auditContentDeclarationField,\n args,\n {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n }\n );\n\nexport const useAuditTag = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['auditTag']>\n) =>\n useAppAsync('auditTag', useIntlayerAuth().ai.auditTag, args, {\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n });\n\nexport const useAskDocQuestion = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['askDocQuestion']>\n) => useAppAsync('askDocQuestion', useIntlayerAuth().ai.askDocQuestion, args);\n\nexport const useAutocomplete = (\n args?: UseAsyncOptions<IntlayerAPI['ai']['autocomplete']>\n) => useAppAsync('autocomplete', useIntlayerAuth().ai.autocomplete, args);\n\n/**\n * Search\n */\n\nexport const useSearchDoc = (\n args?: UseAsyncOptions<IntlayerAPI['search']['searchDoc']>\n) => useAppAsync('searchDoc', useIntlayerAuth().search.searchDoc, args);\n\n/**\n * Newsletter\n */\n\nexport const useSubscribeToNewsletter = (\n args?: UseAsyncOptions<IntlayerAPI['newsletter']['subscribeToNewsletter']>\n) =>\n useAppAsync(\n 'subscribeToNewsletter',\n useIntlayerAuth().newsletter.subscribeToNewsletter,\n args\n );\n\nexport const useUnsubscribeFromNewsletter = (\n args?: UseAsyncOptions<IntlayerAPI['newsletter']['unsubscribeFromNewsletter']>\n) =>\n useAppAsync(\n 'unsubscribeFromNewsletter',\n useIntlayerAuth().newsletter.unsubscribeFromNewsletter,\n args\n );\n\nexport const useGetNewsletterStatus = (\n args?: UseAsyncOptions<IntlayerAPI['newsletter']['getNewsletterStatus']>\n) =>\n useAppAsync(\n 'getNewsletterStatus',\n useIntlayerAuth().newsletter.getNewsletterStatus,\n args\n );\n\n/**\n * Editor\n */\n\nexport const useWriteDictionary = (\n args?: UseAsyncOptions<IntlayerAPI['editor']['writeDictionary']>\n) =>\n useEditorAsync(\n 'writeDictionary',\n useIntlayerAuth().editor.writeDictionary,\n args\n );\n\nexport const useGetEditorDictionaries = (\n args?: UseAsyncOptions<IntlayerAPI['editor']['getDictionaries']>\n) =>\n useEditorAsync('getDictionaries', useIntlayerAuth().editor.getDictionaries, {\n store: true,\n cache: true,\n ...args,\n });\n"],"names":["useToast","error","useConfiguration","useAuth","useAsync","useIntlayerAuth"],"mappings":";;;;;;;;;;;AASA,MAAM,kBAAkB,CAAC,cAAsB;AAC7C,SAAO,UAAU,MAAM,GAAG,EAAE,KAAK,GAAG;AACtC;AAKA,MAAM,mBAAmB,CAAiC,YAAkB;AACpE,QAAA,EAAE,MAAM,IAAIA,qCAAS;AAEpB,SAAA;AAAA,IACL,GAAG;AAAA,IACH,SAAS,CAAC,iBAAiB;AACrB,UAAA;AAGA,UAAA;AACE,YAAA,OAAO,iBAAiB,YAAa;AAEjC,gBAAA,KAAK,MAAM,YAAY;AAAA,eACxB,GAAG;AAGF,gBAAA;AAAA,MAAA;AAKV,OAAC,KAAK,EACH,QAAQ,CAACC,WAAUA,MAAK,EACxB;AAAA,QAAQ,CAACA,WACR,MAAM;AAAA,UACJ,OAAO;AAAA,aACJ,2BAAY,aAAa,eACtBA,OAAM,QACNA,OAAM,SAAS;AAAA,UACrB;AAAA,UACA,aAAaA,OAAM,WAAW,gBAAgB;AAAA,UAC9C,SAAS;AAAA,QACV,CAAA;AAAA,MACH;AACF,cAAQ,UAAU,YAAY;AAAA,IAChC;AAAA,IACA,WAAW,CAAC,SAAS;AACnB,UAAI,MAAM;AACF,cAAA;AAAA,UACJ,OAAO,K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,YAAY,aAAaA,qBAAAA,kBAAkB,OAAO,WAAW,IAAI;AAMzD,MAAA,2BAA2B,CACtC,SAEA;AAAA,EACE;AAAA,EACAA,qBAAA,gBAAA,EAAkB,WAAW;AAAA,EAC7B;AACF;AAEW,MAAA,+BAA+B,CAC1C,SAEA;AAAA,EACE;AAAA,EACAA,qBAAA,gBAAA,EAAkB,WAAW;AAAA,EAC7B;AACF;AAEW,MAAA,yBAAyB,CACpC,SAEA;AAAA,EACE;AAAA,EACAA,qBAAA,gBAAA,EAAkB,WAAW;AAAA,EAC7B;AACF;AAMW,MAAA,qBAAqB,CAChC,SAEA;AAAA,EACE;AAAA,EACAA,qBAAA,gBAAA,EAAkB,OAAO;AAAA,EACzB;AACF;AAEW,MAAA,2BAA2B,CACtC,SAEA,eAAe,mBAAmBA,qCAAgB,EAAE,OAAO,iBAAiB;AAAA,EAC1E,OAAO;AAAA,EACP,OAAO;AAAA,EACP,GAAG;AACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -80,6 +80,12 @@ export declare const useAutocomplete: (args?: UseAsyncOptions<IntlayerAPI["ai"][
|
|
|
80
80
|
* Search
|
|
81
81
|
*/
|
|
82
82
|
export declare const useSearchDoc: (args?: UseAsyncOptions<IntlayerAPI["search"]["searchDoc"]>) => import('./useAsync').UseAsyncResult<"searchDoc", (params?: import('@intlayer/backend').SearchDocUtilParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').SearchDocUtilResult>>;
|
|
83
|
+
/**
|
|
84
|
+
* Newsletter
|
|
85
|
+
*/
|
|
86
|
+
export declare const useSubscribeToNewsletter: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["subscribeToNewsletter"]>) => import('./useAsync').UseAsyncResult<"subscribeToNewsletter", (body: import('@intlayer/backend').NewsletterSubscriptionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').NewsletterSubscriptionResult>>;
|
|
87
|
+
export declare const useUnsubscribeFromNewsletter: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["unsubscribeFromNewsletter"]>) => import('./useAsync').UseAsyncResult<"unsubscribeFromNewsletter", (body: import('@intlayer/backend').NewsletterUnsubscriptionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').NewsletterSubscriptionResult>>;
|
|
88
|
+
export declare const useGetNewsletterStatus: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["getNewsletterStatus"]>) => import('./useAsync').UseAsyncResult<"getNewsletterStatus", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').NewsletterSubscriptionResult>>;
|
|
83
89
|
/**
|
|
84
90
|
* Editor
|
|
85
91
|
*/
|