@intlayer/design-system 8.10.1 → 8.11.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/Button/Button.mjs +1 -1
- package/dist/esm/components/Button/Button.mjs.map +1 -1
- package/dist/esm/components/Carousel/index.mjs +3 -3
- package/dist/esm/components/Carousel/index.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/esm/components/ExpandCollapse/ExpandCollapse.mjs +2 -2
- package/dist/esm/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
- package/dist/esm/components/IDE/FileList.mjs +1 -1
- package/dist/esm/components/IDE/FileList.mjs.map +1 -1
- package/dist/esm/components/IDE/IDE.mjs +1 -1
- package/dist/esm/components/IDE/IDE.mjs.map +1 -1
- package/dist/esm/components/Input/Checkbox.mjs +1 -1
- package/dist/esm/components/Input/Checkbox.mjs.map +1 -1
- package/dist/esm/components/LanguageBackground/index.mjs +11 -5
- package/dist/esm/components/LanguageBackground/index.mjs.map +1 -1
- package/dist/esm/components/Loader/spinner.mjs +1 -1
- package/dist/esm/components/Loader/spinner.mjs.map +1 -1
- package/dist/esm/components/Popover/dynamic.mjs +2 -2
- package/dist/esm/components/Popover/dynamic.mjs.map +1 -1
- package/dist/esm/components/Tag/index.mjs +1 -1
- package/dist/esm/components/Tag/index.mjs.map +1 -1
- package/dist/esm/components/Terminal/Terminal.mjs +1 -1
- package/dist/esm/components/Terminal/Terminal.mjs.map +1 -1
- package/dist/esm/components/TextArea/AutoSizeTextArea.mjs +2 -2
- package/dist/esm/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/esm/components/TextArea/ContentEditableTextArea.mjs +3 -3
- package/dist/esm/components/TextArea/ContentEditableTextArea.mjs.map +1 -1
- package/dist/esm/components/WithResizer/index.mjs +7 -2
- package/dist/esm/components/WithResizer/index.mjs.map +1 -1
- package/dist/esm/hooks/index.mjs +2 -2
- package/dist/esm/hooks/reactQuery.mjs +400 -1
- package/dist/esm/hooks/reactQuery.mjs.map +1 -1
- package/dist/esm/hooks/useAuth/useOAuth2.mjs +1 -1
- package/dist/esm/hooks/useAuth/useSession.mjs +1 -1
- package/dist/esm/libs/auth.mjs +1 -1
- package/dist/esm/routes.mjs +20 -1
- package/dist/esm/routes.mjs.map +1 -1
- package/dist/types/components/Badge/index.d.ts +1 -1
- package/dist/types/components/Button/Button.d.ts +2 -2
- package/dist/types/components/Carousel/index.d.ts.map +1 -1
- package/dist/types/components/Command/index.d.ts +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/types/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/dist/types/components/Input/Checkbox.d.ts +1 -1
- package/dist/types/components/LanguageBackground/index.d.ts.map +1 -1
- package/dist/types/components/Link/Link.d.ts +2 -2
- package/dist/types/components/Loader/spinner.d.ts +1 -1
- package/dist/types/components/Tag/index.d.ts +1 -1
- package/dist/types/components/TextArea/ContentEditableTextArea.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +2 -2
- package/dist/types/hooks/reactQuery.d.ts +50 -2
- package/dist/types/hooks/reactQuery.d.ts.map +1 -1
- package/dist/types/routes.d.ts +20 -1
- package/dist/types/routes.d.ts.map +1 -1
- package/package.json +23 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/WithResizer/index.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@utils/cn';\nimport React, {\n type FC,\n type PropsWithChildren,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nconst HANDLE_DOUBLE_CLICK_ZONE_PX = 16;\n\n/**\n * Props for the WithResizer component.\n *\n * Defines the configuration for a resizable container with drag-based width adjustment.\n *\n * @example\n * ```tsx\n * // Basic resizable container\n * <WithResizer initialWidth={300} minWidth={200} maxWidth={600}>\n * <div className=\"p-4\">Resizable content</div>\n * </WithResizer>\n *\n * // Sidebar with resizing\n * <WithResizer\n * initialWidth={250}\n * minWidth={180}\n * maxWidth={400}\n * >\n * <nav className=\"h-full p-4\">\n * <SidebarContent />\n * </nav>\n * </WithResizer>\n *\n * // Panel with unlimited growth\n * <WithResizer initialWidth={400} minWidth={300}>\n * <div className=\"h-full overflow-auto\">\n * <PanelContent />\n * </div>\n * </WithResizer>\n * ```\n */\ntype WithResizerProps = {\n /** Initial width of the resizable container in pixels */\n initialWidth: number;\n /** Maximum allowed width in pixels (optional, no limit if not specified) */\n maxWidth?: number;\n /** Minimum allowed width in pixels */\n minWidth?: number;\n /** Position of the resize handle (default: 'right') */\n handlePosition?: 'left' | 'right';\n /** Apply base styles */\n style?: boolean;\n /** Additional className */\n className?: string;\n /** Controlled open/close — true expands to defaultOpenWidth (or last used), false collapses to 0 */\n isOpen?: boolean;\n /** Width to restore when isOpen becomes true and current width is 0 */\n defaultOpenWidth?: number;\n};\n\n/**\n * WithResizer Component\n *\n * A flexible container component that allows users to dynamically resize its width\n * through mouse or touch drag interactions. Perfect for creating adjustable panels,\n * sidebars, and split-pane layouts.\n *\n * ## Features\n * - **Mouse & Touch Support**: Works with both mouse drag and touch interactions\n * - **Constraint Enforcement**: Respects minimum and maximum width boundaries\n * - **Visual Feedback**: Clear resize handle with hover and active states\n * - **Smooth Interactions**: Passive event listeners for optimal performance\n * - **Accessibility**: ARIA slider role with proper value announcements\n * - **Responsive Design**: Adapts to different screen sizes and containers\n *\n * ## Technical Implementation\n * - **Event Handling**: Uses `useCallback` for optimal performance\n * - **Boundary Calculation**: Real-time width calculation based on mouse/touch position\n * - **State Management**: Tracks resizing state for visual feedback\n * - **Memory Management**: Proper cleanup of global event listeners\n * - **Touch Events**: Full support for mobile touch interactions\n *\n * ## Visual Design\n * - **Resize Handle**: Rounded handle positioned on the right border\n * - **Border Indicator**: Visual border showing resizable edge\n * - **State Feedback**: Different colors for normal, hover, and active states\n * - **Dark Mode**: Full support with appropriate color scheme\n * - **Smooth Transitions**: CSS transitions for visual polish\n *\n * ## Use Cases\n * - **Application Sidebars**: Collapsible navigation and tool panels\n * - **Content Panels**: Adjustable content areas in complex layouts\n * - **Split Panes**: Dividing screen space between multiple content areas\n * - **Inspector Panels**: Debugging tools and property inspectors\n * - **File Explorers**: Tree views with adjustable column widths\n * - **Dashboard Widgets**: Customizable widget sizes for dashboards\n *\n * ## Accessibility Features\n * - **ARIA Slider**: Proper slider role for screen readers\n * - **Value Announcements**: Current, minimum, and maximum values announced\n * - **Keyboard Focus**: Focusable with tab navigation\n * - **Clear Affordances**: Visual indicators for interactive elements\n *\n * @example\n * ```tsx\n * // Application sidebar with resizing\n * const [sidebarWidth, setSidebarWidth] = useState(250);\n *\n * <div className=\"flex h-screen\">\n * <WithResizer\n * initialWidth={sidebarWidth}\n * minWidth={200}\n * maxWidth={400}\n * >\n * <aside className=\"h-full bg-gray-100 p-4\">\n * <nav>\n * <NavItems />\n * </nav>\n * </aside>\n * </WithResizer>\n *\n * <main className=\"flex-1 p-6\">\n * <MainContent />\n * </main>\n * </div>\n *\n * // Developer tools panel\n * <WithResizer\n * initialWidth={350}\n * minWidth={250}\n * maxWidth={600}\n * >\n * <div className=\"h-full flex flex-col\">\n * <div className=\"flex-1 overflow-auto p-4\">\n * <InspectorContent />\n * </div>\n * <div className=\"border-t p-2\">\n * <Controls />\n * </div>\n * </div>\n * </WithResizer>\n *\n * // Multi-column layout\n * <div className=\"flex h-full\">\n * <WithResizer initialWidth={300} minWidth={200} maxWidth={500}>\n * <FileExplorer />\n * </WithResizer>\n *\n * <WithResizer initialWidth={400} minWidth={300}>\n * <CodeEditor />\n * </WithResizer>\n *\n * <div className=\"flex-1 min-w-0\">\n * <OutputPanel />\n * </div>\n * </div>\n * ```\n *\n * ## Performance Considerations\n * - Uses passive event listeners to prevent scroll blocking\n * - Optimized with `useCallback` to prevent unnecessary re-renders\n * - Efficient boundary calculations using `getBoundingClientRect`\n * - Minimal DOM manipulation for smooth drag interactions\n *\n * ## Browser Support\n * - Modern browsers with support for touch events\n * - Graceful degradation for older browsers\n * - Mobile-first touch interaction handling\n */\nexport const WithResizer: FC<PropsWithChildren<WithResizerProps>> = ({\n initialWidth,\n maxWidth,\n minWidth = 0,\n handlePosition = 'right',\n children,\n style = true,\n className,\n isOpen,\n defaultOpenWidth,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [width, setWidth] = useState(initialWidth);\n const [isResizing, setIsResizing] = useState(false);\n const lastExpandedWidthRef = useRef(initialWidth);\n\n const resizeState = useRef({\n startX: 0,\n startWidth: 0,\n factor: 1,\n });\n\n // Handler to resize the div\n const resize = useCallback(\n (mouseMoveEvent: MouseEvent | TouchEvent) => {\n if (resizeState.current.startWidth === 0) return;\n\n let clientX = 0;\n if (mouseMoveEvent instanceof MouseEvent) {\n clientX = mouseMoveEvent.clientX;\n } else if (\n typeof TouchEvent !== 'undefined' &&\n mouseMoveEvent instanceof TouchEvent\n ) {\n clientX = mouseMoveEvent.touches[0].clientX;\n }\n\n const { startX, startWidth, factor } = resizeState.current;\n const delta = (clientX - startX) / factor;\n // Invert delta for left handle (moving left decreases width, moving right increases width)\n const adjustedDelta = handlePosition === 'left' ? -delta : delta;\n const newWidth = startWidth + adjustedDelta;\n\n const constrainedWidth = Math.max(\n Math.min(newWidth, maxWidth ?? Infinity),\n minWidth\n );\n\n setWidth(constrainedWidth);\n },\n [maxWidth, minWidth, handlePosition]\n );\n\n // Handler to stop resizing\n const stopResizing = useCallback(() => {\n setIsResizing(false);\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n window.removeEventListener('mousemove', resize);\n window.removeEventListener('mouseup', stopResizing);\n window.removeEventListener('touchmove', resize);\n window.removeEventListener('touchend', stopResizing);\n }, [resize]);\n\n // Handler to start resizing\n const startResizing = useCallback(\n (\n mouseDownEvent:\n | React.MouseEvent<HTMLDivElement>\n | React.TouchEvent<HTMLDivElement>\n ) => {\n mouseDownEvent.preventDefault();\n const container = containerRef.current;\n\n if (!container) return;\n\n const { width: rectWidth } = container.getBoundingClientRect();\n const offsetWidth = container.offsetWidth;\n const factor = offsetWidth > 0 ? rectWidth / offsetWidth : 1;\n\n let clientX = 0;\n if ('touches' in mouseDownEvent) {\n clientX = mouseDownEvent.touches[0].clientX;\n } else {\n clientX = mouseDownEvent.clientX;\n }\n\n resizeState.current = {\n startX: clientX,\n startWidth: offsetWidth,\n factor,\n };\n\n setIsResizing(true);\n document.body.style.cursor = 'ew-resize';\n document.body.style.userSelect = 'none';\n\n window.addEventListener('mousemove', resize, { passive: true });\n window.addEventListener('mouseup', stopResizing);\n window.addEventListener('touchmove', resize, { passive: true });\n window.addEventListener('touchend', stopResizing);\n },\n [resize, stopResizing]\n );\n\n useEffect(() => {\n return () => {\n window.removeEventListener('mousemove', resize);\n window.removeEventListener('mouseup', stopResizing);\n window.removeEventListener('touchmove', resize);\n window.removeEventListener('touchend', stopResizing);\n };\n }, [resize, stopResizing]);\n\n useEffect(() => {\n if (width > minWidth) {\n lastExpandedWidthRef.current = width;\n }\n }, [width, minWidth]);\n\n useEffect(() => {\n if (isOpen === undefined) return;\n if (!isOpen) {\n setWidth(0);\n } else {\n const target =\n lastExpandedWidthRef.current > 0\n ? lastExpandedWidthRef.current\n : (defaultOpenWidth ?? initialWidth);\n setWidth(Math.max(target, minWidth));\n }\n }, [isOpen]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleDoubleClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n const el = containerRef.current;\n if (!el) return;\n\n const { left, right } = el.getBoundingClientRect();\n const inHandleZone =\n handlePosition === 'right'\n ? right - event.clientX <= HANDLE_DOUBLE_CLICK_ZONE_PX\n : event.clientX - left <= HANDLE_DOUBLE_CLICK_ZONE_PX;\n\n if (!inHandleZone) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n if (width > minWidth) {\n setWidth(minWidth);\n return;\n }\n\n const target = Math.min(\n Math.max(lastExpandedWidthRef.current, minWidth),\n maxWidth ?? Infinity\n );\n setWidth(target);\n },\n [handlePosition, maxWidth, minWidth, width]\n );\n\n return (\n <div\n className={cn(\n 'relative h-full w-full max-w-[80%] shrink-0',\n style &&\n (handlePosition === 'right' ? 'border-r-[2px]' : 'border-l-[2px]'),\n style &&\n 'border-neutral-200 transition active:border-neutral-400 dark:border-neutral-950 dark:active:border-neutral-600',\n minWidth && `min-w-[${minWidth}px]`,\n maxWidth && `max-w-[${maxWidth}px]`,\n !style && className\n )}\n style={{\n width: `${width}px`,\n transition: isResizing ? 'none' : 'width 200ms ease-in-out',\n }}\n ref={containerRef}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n aria-valuenow={width}\n aria-label=\"Resizable component\"\n role=\"slider\"\n tabIndex={0}\n >\n {/* biome-ignore lint/a11y/noStaticElementInteractions: This div stops event propagation to prevent content clicks from triggering resize */}\n <div\n role=\"presentation\"\n className=\"absolute top-0 left-0 size-full cursor-default overflow-hidden\"\n onMouseDown={(e) => e.stopPropagation()}\n onTouchStart={(e) => e.stopPropagation()}\n >\n {children}\n </div>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: Invisible handle strip — owns resize events so content stopPropagation doesn't block them */}\n <div\n role=\"presentation\"\n className={cn(\n 'absolute top-0 z-10 h-full w-3 cursor-ew-resize',\n handlePosition === 'right' ? 'right-0' : 'left-0'\n )}\n onMouseDown={startResizing}\n onTouchStart={startResizing}\n onDoubleClick={handleDoubleClick}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;AAYA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiKpC,MAAa,eAAwD,EACnE,cACA,UACA,WAAW,GACX,iBAAiB,SACjB,UACA,QAAQ,MACR,WACA,QACA,uBACI;CACJ,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,CAAC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C;EAAgB;EAAU;EAAU;CAAK,CAC5C;CAEA,OACE,qBAAC,OAAD;EACE,WAAW,GACT,+CACA,UACG,mBAAmB,UAAU,mBAAmB,mBACnD,SACE,kHACF,YAAY,UAAU,SAAS,MAC/B,YAAY,UAAU,SAAS,MAC/B,CAAC,SAAS,SACZ;EACA,OAAO;GACL,OAAO,GAAG,MAAM;GAChB,YAAY,aAAa,SAAS;EACpC;EACA,KAAK;EACL,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,cAAW;EACX,MAAK;EACL,UAAU;YArBZ,CAwBE,oBAAC,OAAD;GACE,MAAK;GACL,WAAU;GACV,cAAc,MAAM,EAAE,gBAAgB;GACtC,eAAe,MAAM,EAAE,gBAAgB;GAEtC;EACE,IAEL,oBAAC,OAAD;GACE,MAAK;GACL,WAAW,GACT,mDACA,mBAAmB,UAAU,YAAY,QAC3C;GACA,aAAa;GACb,cAAc;GACd,eAAe;EAChB,EACE;;AAET"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/WithResizer/index.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@utils/cn';\nimport React, {\n type FC,\n type PropsWithChildren,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nconst HANDLE_DOUBLE_CLICK_ZONE_PX = 16;\n\n/**\n * Props for the WithResizer component.\n *\n * Defines the configuration for a resizable container with drag-based width adjustment.\n *\n * @example\n * ```tsx\n * // Basic resizable container\n * <WithResizer initialWidth={300} minWidth={200} maxWidth={600}>\n * <div className=\"p-4\">Resizable content</div>\n * </WithResizer>\n *\n * // Sidebar with resizing\n * <WithResizer\n * initialWidth={250}\n * minWidth={180}\n * maxWidth={400}\n * >\n * <nav className=\"h-full p-4\">\n * <SidebarContent />\n * </nav>\n * </WithResizer>\n *\n * // Panel with unlimited growth\n * <WithResizer initialWidth={400} minWidth={300}>\n * <div className=\"h-full overflow-auto\">\n * <PanelContent />\n * </div>\n * </WithResizer>\n * ```\n */\ntype WithResizerProps = {\n /** Initial width of the resizable container in pixels */\n initialWidth: number;\n /** Maximum allowed width in pixels (optional, no limit if not specified) */\n maxWidth?: number;\n /** Minimum allowed width in pixels */\n minWidth?: number;\n /** Position of the resize handle (default: 'right') */\n handlePosition?: 'left' | 'right';\n /** Apply base styles */\n style?: boolean;\n /** Additional className */\n className?: string;\n /** Controlled open/close — true expands to defaultOpenWidth (or last used), false collapses to 0 */\n isOpen?: boolean;\n /** Width to restore when isOpen becomes true and current width is 0 */\n defaultOpenWidth?: number;\n};\n\n/**\n * WithResizer Component\n *\n * A flexible container component that allows users to dynamically resize its width\n * through mouse or touch drag interactions. Perfect for creating adjustable panels,\n * sidebars, and split-pane layouts.\n *\n * ## Features\n * - **Mouse & Touch Support**: Works with both mouse drag and touch interactions\n * - **Constraint Enforcement**: Respects minimum and maximum width boundaries\n * - **Visual Feedback**: Clear resize handle with hover and active states\n * - **Smooth Interactions**: Passive event listeners for optimal performance\n * - **Accessibility**: ARIA slider role with proper value announcements\n * - **Responsive Design**: Adapts to different screen sizes and containers\n *\n * ## Technical Implementation\n * - **Event Handling**: Uses `useCallback` for optimal performance\n * - **Boundary Calculation**: Real-time width calculation based on mouse/touch position\n * - **State Management**: Tracks resizing state for visual feedback\n * - **Memory Management**: Proper cleanup of global event listeners\n * - **Touch Events**: Full support for mobile touch interactions\n *\n * ## Visual Design\n * - **Resize Handle**: Rounded handle positioned on the right border\n * - **Border Indicator**: Visual border showing resizable edge\n * - **State Feedback**: Different colors for normal, hover, and active states\n * - **Dark Mode**: Full support with appropriate color scheme\n * - **Smooth Transitions**: CSS transitions for visual polish\n *\n * ## Use Cases\n * - **Application Sidebars**: Collapsible navigation and tool panels\n * - **Content Panels**: Adjustable content areas in complex layouts\n * - **Split Panes**: Dividing screen space between multiple content areas\n * - **Inspector Panels**: Debugging tools and property inspectors\n * - **File Explorers**: Tree views with adjustable column widths\n * - **Dashboard Widgets**: Customizable widget sizes for dashboards\n *\n * ## Accessibility Features\n * - **ARIA Slider**: Proper slider role for screen readers\n * - **Value Announcements**: Current, minimum, and maximum values announced\n * - **Keyboard Focus**: Focusable with tab navigation\n * - **Clear Affordances**: Visual indicators for interactive elements\n *\n * @example\n * ```tsx\n * // Application sidebar with resizing\n * const [sidebarWidth, setSidebarWidth] = useState(250);\n *\n * <div className=\"flex h-screen\">\n * <WithResizer\n * initialWidth={sidebarWidth}\n * minWidth={200}\n * maxWidth={400}\n * >\n * <aside className=\"h-full bg-gray-100 p-4\">\n * <nav>\n * <NavItems />\n * </nav>\n * </aside>\n * </WithResizer>\n *\n * <main className=\"flex-1 p-6\">\n * <MainContent />\n * </main>\n * </div>\n *\n * // Developer tools panel\n * <WithResizer\n * initialWidth={350}\n * minWidth={250}\n * maxWidth={600}\n * >\n * <div className=\"h-full flex flex-col\">\n * <div className=\"flex-1 overflow-auto p-4\">\n * <InspectorContent />\n * </div>\n * <div className=\"border-t p-2\">\n * <Controls />\n * </div>\n * </div>\n * </WithResizer>\n *\n * // Multi-column layout\n * <div className=\"flex h-full\">\n * <WithResizer initialWidth={300} minWidth={200} maxWidth={500}>\n * <FileExplorer />\n * </WithResizer>\n *\n * <WithResizer initialWidth={400} minWidth={300}>\n * <CodeEditor />\n * </WithResizer>\n *\n * <div className=\"flex-1 min-w-0\">\n * <OutputPanel />\n * </div>\n * </div>\n * ```\n *\n * ## Performance Considerations\n * - Uses passive event listeners to prevent scroll blocking\n * - Optimized with `useCallback` to prevent unnecessary re-renders\n * - Efficient boundary calculations using `getBoundingClientRect`\n * - Minimal DOM manipulation for smooth drag interactions\n *\n * ## Browser Support\n * - Modern browsers with support for touch events\n * - Graceful degradation for older browsers\n * - Mobile-first touch interaction handling\n */\nexport const WithResizer: FC<PropsWithChildren<WithResizerProps>> = ({\n initialWidth,\n maxWidth,\n minWidth = 0,\n handlePosition = 'right',\n children,\n style = true,\n className,\n isOpen,\n defaultOpenWidth,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [width, setWidth] = useState(initialWidth);\n const [isResizing, setIsResizing] = useState(false);\n const lastExpandedWidthRef = useRef(initialWidth);\n\n const resizeState = useRef({\n startX: 0,\n startWidth: 0,\n factor: 1,\n });\n\n // Handler to resize the div\n const resize = useCallback(\n (mouseMoveEvent: MouseEvent | TouchEvent) => {\n if (resizeState.current.startWidth === 0) return;\n\n let clientX = 0;\n if (mouseMoveEvent instanceof MouseEvent) {\n clientX = mouseMoveEvent.clientX;\n } else if (\n typeof TouchEvent !== 'undefined' &&\n mouseMoveEvent instanceof TouchEvent\n ) {\n clientX = mouseMoveEvent.touches[0].clientX;\n }\n\n const { startX, startWidth, factor } = resizeState.current;\n const delta = (clientX - startX) / factor;\n // Invert delta for left handle (moving left decreases width, moving right increases width)\n const adjustedDelta = handlePosition === 'left' ? -delta : delta;\n const newWidth = startWidth + adjustedDelta;\n\n const constrainedWidth = Math.max(\n Math.min(newWidth, maxWidth ?? Infinity),\n minWidth\n );\n\n setWidth(constrainedWidth);\n },\n [maxWidth, minWidth, handlePosition]\n );\n\n // Handler to stop resizing\n const stopResizing = useCallback(() => {\n setIsResizing(false);\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n window.removeEventListener('mousemove', resize);\n window.removeEventListener('mouseup', stopResizing);\n window.removeEventListener('touchmove', resize);\n window.removeEventListener('touchend', stopResizing);\n }, [resize]);\n\n // Handler to start resizing\n const startResizing = useCallback(\n (\n mouseDownEvent:\n | React.MouseEvent<HTMLDivElement>\n | React.TouchEvent<HTMLDivElement>\n ) => {\n if (isOpen === false) return;\n mouseDownEvent.preventDefault();\n const container = containerRef.current;\n\n if (!container) return;\n\n const { width: rectWidth } = container.getBoundingClientRect();\n const offsetWidth = container.offsetWidth;\n const factor = offsetWidth > 0 ? rectWidth / offsetWidth : 1;\n\n let clientX = 0;\n if ('touches' in mouseDownEvent) {\n clientX = mouseDownEvent.touches[0].clientX;\n } else {\n clientX = mouseDownEvent.clientX;\n }\n\n resizeState.current = {\n startX: clientX,\n startWidth: offsetWidth,\n factor,\n };\n\n setIsResizing(true);\n document.body.style.cursor = 'ew-resize';\n document.body.style.userSelect = 'none';\n\n window.addEventListener('mousemove', resize, { passive: true });\n window.addEventListener('mouseup', stopResizing);\n window.addEventListener('touchmove', resize, { passive: true });\n window.addEventListener('touchend', stopResizing);\n },\n [isOpen, resize, stopResizing]\n );\n\n useEffect(() => {\n return () => {\n window.removeEventListener('mousemove', resize);\n window.removeEventListener('mouseup', stopResizing);\n window.removeEventListener('touchmove', resize);\n window.removeEventListener('touchend', stopResizing);\n };\n }, [resize, stopResizing]);\n\n useEffect(() => {\n if (width > minWidth) {\n lastExpandedWidthRef.current = width;\n }\n }, [width, minWidth]);\n\n useEffect(() => {\n if (isOpen === undefined) return;\n if (!isOpen) {\n setWidth(0);\n } else {\n const target =\n lastExpandedWidthRef.current > 0\n ? lastExpandedWidthRef.current\n : (defaultOpenWidth ?? initialWidth);\n setWidth(Math.max(target, minWidth));\n }\n }, [isOpen]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleDoubleClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n const el = containerRef.current;\n if (!el) return;\n\n const { left, right } = el.getBoundingClientRect();\n const inHandleZone =\n handlePosition === 'right'\n ? right - event.clientX <= HANDLE_DOUBLE_CLICK_ZONE_PX\n : event.clientX - left <= HANDLE_DOUBLE_CLICK_ZONE_PX;\n\n if (!inHandleZone) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n if (width > minWidth) {\n setWidth(minWidth);\n return;\n }\n\n const target = Math.min(\n Math.max(lastExpandedWidthRef.current, minWidth),\n maxWidth ?? Infinity\n );\n setWidth(target);\n },\n [handlePosition, maxWidth, minWidth, width]\n );\n\n return (\n <div\n className={cn(\n 'relative h-full w-full max-w-[80%] shrink-0',\n style &&\n (handlePosition === 'right' ? 'border-r-[2px]' : 'border-l-[2px]'),\n style &&\n 'border-neutral-200 transition active:border-neutral-400 dark:border-neutral-950 dark:active:border-neutral-600',\n minWidth && `min-w-[${minWidth}px]`,\n maxWidth && `max-w-[${maxWidth}px]`,\n !style && className\n )}\n style={{\n width: `${width}px`,\n transition: isResizing ? 'none' : 'width 200ms ease-in-out',\n }}\n ref={containerRef}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n aria-valuenow={width}\n aria-label=\"Resizable component\"\n role=\"slider\"\n tabIndex={0}\n >\n {/* biome-ignore lint/a11y/noStaticElementInteractions: This div stops event propagation to prevent content clicks from triggering resize */}\n <div\n role=\"presentation\"\n className=\"absolute top-0 left-0 size-full cursor-default overflow-hidden\"\n onMouseDown={(e) => e.stopPropagation()}\n onTouchStart={(e) => e.stopPropagation()}\n >\n {children}\n </div>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: Invisible handle strip — owns resize events so content stopPropagation doesn't block them */}\n <div\n role=\"presentation\"\n className={cn(\n 'absolute top-0 z-10 h-full w-3',\n isOpen !== false ? 'cursor-ew-resize' : 'cursor-default',\n handlePosition === 'right' ? 'right-0' : 'left-0'\n )}\n onMouseDown={startResizing}\n onTouchStart={startResizing}\n onDoubleClick={handleDoubleClick}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;AAYA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiKpC,MAAa,eAAwD,EACnE,cACA,UACA,WAAW,GACX,iBAAiB,SACjB,UACA,QAAQ,MACR,WACA,QACA,uBACI;CACJ,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,CAAC,OAAO,YAAY,SAAS,YAAY;CAC/C,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,uBAAuB,OAAO,YAAY;CAEhD,MAAM,cAAc,OAAO;EACzB,QAAQ;EACR,YAAY;EACZ,QAAQ;CACV,CAAC;CAGD,MAAM,SAAS,aACZ,mBAA4C;EAC3C,IAAI,YAAY,QAAQ,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O;GACL,OAAO,GAAG,MAAM;GAChB,YAAY,aAAa,SAAS;EACpC;EACA,KAAK;EACL,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,cAAW;EACX,MAAK;EACL,UAAU;YArBZ,CAwBE,oBAAC,OAAD;GACE,MAAK;GACL,WAAU;GACV,cAAc,MAAM,EAAE,gBAAgB;GACtC,eAAe,MAAM,EAAE,gBAAgB;GAEtC;EACE,IAEL,oBAAC,OAAD;GACE,MAAK;GACL,WAAW,GACT,kCACA,WAAW,QAAQ,qBAAqB,kBACxC,mBAAmB,UAAU,YAAY,QAC3C;GACA,aAAa;GACb,cAAc;GACd,eAAe;EAChB,EACE;;AAET"}
|
package/dist/esm/hooks/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { useOAuth2 } from "./useAuth/useOAuth2.mjs";
|
|
|
9
9
|
import { useSession } from "./useAuth/useSession.mjs";
|
|
10
10
|
import { useAuth } from "./useAuth/useAuth.mjs";
|
|
11
11
|
import { useIntlayerAuth, useIntlayerOAuth } from "./useIntlayerAPI.mjs";
|
|
12
|
-
import { useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAppQuery, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAutocomplete, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useCreatePortalSession, useCreateUser, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDisableTwoFactor, useEnableTwoFactor, useFillAllTranslations, useGetCIConfig, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetInvoices, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjects, useGetRecursiveAuditStatus, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useInfiniteGetDictionaries, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, usePauseTranslationJob, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useQueryClient, useRefreshAccessKey, useRegister, useRegisterSSO, useResetPassword, useResumeTranslationJob, useSearchDoc, useSelectOrganization, useSelectProject, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useSubmitShowcaseProject, useSubscribeToNewsletter, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateDictionary, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadUserAvatar, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary } from "./reactQuery.mjs";
|
|
12
|
+
import { useAcceptAffiliateInvitation, useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAppQuery, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAutocomplete, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useContactReviewer, useCreateMission, useCreatePortalSession, useCreateUser, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeleteReviewerProfile, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDisableTwoFactor, useEnableTwoFactor, useEstimateMission, useFillAllTranslations, useGetAdminReviewers, useGetAffiliate, useGetAffiliateAccountSession, useGetAffiliateById, useGetAffiliateInvitation, useGetAffiliateStats, useGetAffiliates, useGetCIConfig, useGetChatHistory, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetInvoices, useGetMissionById, useGetMyMissions, useGetMyReviewerProfile, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjects, useGetRecursiveAuditStatus, useGetReviewerById, useGetReviewerMarketplace, useGetReviewerPriceDistribution, useGetReviewerReviews, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useGrantAffiliateAccess, useInfiniteGetDictionaries, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, usePauseTranslationJob, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useQueryClient, useRefreshAccessKey, useRegister, useRegisterAsReviewer, useRegisterSSO, useResetPassword, useResumeTranslationJob, useSearchDoc, useSelectOrganization, useSelectProject, useSendAffiliateInvitation, useSendReviewerMessage, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useSubmitReview, useSubmitShowcaseProject, useSubscribeToNewsletter, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateAffiliateStatus, useUpdateDictionary, useUpdateMissionStatus, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdateReviewerProfile, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadReviewerCoverPicture, useUploadReviewerMainPicture, useUploadUserAvatar, useValidateReviewerProfile, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary } from "./reactQuery.mjs";
|
|
13
13
|
import { useSearch } from "./useSearch.mjs";
|
|
14
14
|
import { useIsMounted } from "./useIsMounted.mjs";
|
|
15
15
|
import { useGetElementById } from "./useGetElementById.mjs";
|
|
@@ -19,4 +19,4 @@ import { useScrollBlockage } from "./useScrollBlockage/index.mjs";
|
|
|
19
19
|
import { useScrollDetection } from "./useScrollDetection.mjs";
|
|
20
20
|
import { useUser } from "./useUser/index.mjs";
|
|
21
21
|
|
|
22
|
-
export { calculateIsMobile, checkIsIOS, checkIsIphoneOrSafariDevice, checkIsMac, checkIsMobileScreen, checkIsMobileUserAgent, getBreakpointFromSize, useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAppQuery, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAuth, useAutocomplete, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useCreatePortalSession, useCreateUser, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDevice, useDisableTwoFactor, useEnableTwoFactor, useFillAllTranslations, useGetCIConfig, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetElementById, useGetElementOrWindow, useGetInvoices, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjects, useGetRecursiveAuditStatus, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useHorizontalSwipe, useInfiniteGetDictionaries, useIntlayerAuth, useIntlayerOAuth, useIsDarkMode, useIsMounted, useItemSelector, useKeyboardDetector, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useOAuth2, usePauseTranslationJob, usePersistedStore, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useQueryClient, useRefreshAccessKey, useRegister, useRegisterSSO, useResetPassword, useResumeTranslationJob, useScreenWidth, useScrollBlockage, useScrollDetection, useScrollY, useSearch, useSearchDoc, useSelectOrganization, useSelectProject, useSession, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useSubmitShowcaseProject, useSubscribeToNewsletter, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateDictionary, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadUserAvatar, useUser, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary };
|
|
22
|
+
export { calculateIsMobile, checkIsIOS, checkIsIphoneOrSafariDevice, checkIsMac, checkIsMobileScreen, checkIsMobileUserAgent, getBreakpointFromSize, useAcceptAffiliateInvitation, useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAppQuery, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAuth, useAutocomplete, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useContactReviewer, useCreateMission, useCreatePortalSession, useCreateUser, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeleteReviewerProfile, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDevice, useDisableTwoFactor, useEnableTwoFactor, useEstimateMission, useFillAllTranslations, useGetAdminReviewers, useGetAffiliate, useGetAffiliateAccountSession, useGetAffiliateById, useGetAffiliateInvitation, useGetAffiliateStats, useGetAffiliates, useGetCIConfig, useGetChatHistory, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetElementById, useGetElementOrWindow, useGetInvoices, useGetMissionById, useGetMyMissions, useGetMyReviewerProfile, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjects, useGetRecursiveAuditStatus, useGetReviewerById, useGetReviewerMarketplace, useGetReviewerPriceDistribution, useGetReviewerReviews, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useGrantAffiliateAccess, useHorizontalSwipe, useInfiniteGetDictionaries, useIntlayerAuth, useIntlayerOAuth, useIsDarkMode, useIsMounted, useItemSelector, useKeyboardDetector, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useOAuth2, usePauseTranslationJob, usePersistedStore, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useQueryClient, useRefreshAccessKey, useRegister, useRegisterAsReviewer, useRegisterSSO, useResetPassword, useResumeTranslationJob, useScreenWidth, useScrollBlockage, useScrollDetection, useScrollY, useSearch, useSearchDoc, useSelectOrganization, useSelectProject, useSendAffiliateInvitation, useSendReviewerMessage, useSession, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useSubmitReview, useSubmitShowcaseProject, useSubscribeToNewsletter, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateAffiliateStatus, useUpdateDictionary, useUpdateMissionStatus, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdateReviewerProfile, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadReviewerCoverPicture, useUploadReviewerMainPicture, useUploadUserAvatar, useUser, useValidateReviewerProfile, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary };
|
|
@@ -1181,7 +1181,406 @@ const useResumeTranslationJob = () => {
|
|
|
1181
1181
|
mutationFn: (jobId) => intlayerOAuth.translate.resumeTranslationJob(jobId)
|
|
1182
1182
|
});
|
|
1183
1183
|
};
|
|
1184
|
+
/**
|
|
1185
|
+
* Affiliate
|
|
1186
|
+
*/
|
|
1187
|
+
const useGetAffiliates = (params, options) => {
|
|
1188
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1189
|
+
return useAppQuery({
|
|
1190
|
+
queryKey: ["affiliates", params],
|
|
1191
|
+
queryFn: ({ signal }) => intlayerOAuth.stripe.getAffiliates(params, { signal }),
|
|
1192
|
+
requireUser: true,
|
|
1193
|
+
...options
|
|
1194
|
+
});
|
|
1195
|
+
};
|
|
1196
|
+
const useGetAffiliateById = (id, options) => {
|
|
1197
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1198
|
+
return useAppQuery({
|
|
1199
|
+
queryKey: ["affiliates", id],
|
|
1200
|
+
queryFn: ({ signal }) => intlayerOAuth.stripe.getAffiliateById({ id }, { signal }),
|
|
1201
|
+
requireUser: true,
|
|
1202
|
+
enabled: Boolean(id),
|
|
1203
|
+
...options
|
|
1204
|
+
});
|
|
1205
|
+
};
|
|
1206
|
+
const useGetAffiliate = (options) => {
|
|
1207
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1208
|
+
return useAppQuery({
|
|
1209
|
+
queryKey: ["affiliate"],
|
|
1210
|
+
queryFn: ({ signal }) => intlayerOAuth.stripe.getAffiliate({ signal }),
|
|
1211
|
+
requireUser: true,
|
|
1212
|
+
...options
|
|
1213
|
+
});
|
|
1214
|
+
};
|
|
1215
|
+
const useGetAffiliateAccountSession = (options) => {
|
|
1216
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1217
|
+
return useAppQuery({
|
|
1218
|
+
queryKey: ["affiliate", "account-session"],
|
|
1219
|
+
queryFn: () => intlayerOAuth.stripe.getAffiliateAccountSession(),
|
|
1220
|
+
requireUser: true,
|
|
1221
|
+
...options
|
|
1222
|
+
});
|
|
1223
|
+
};
|
|
1224
|
+
const useGetAffiliateStats = (options) => {
|
|
1225
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1226
|
+
return useAppQuery({
|
|
1227
|
+
queryKey: ["affiliate", "stats"],
|
|
1228
|
+
queryFn: ({ signal }) => intlayerOAuth.stripe.getAffiliateStats({ signal }),
|
|
1229
|
+
requireUser: true,
|
|
1230
|
+
...options
|
|
1231
|
+
});
|
|
1232
|
+
};
|
|
1233
|
+
const useGrantAffiliateAccess = () => {
|
|
1234
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1235
|
+
return useMutation({
|
|
1236
|
+
mutationKey: ["affiliate", "grant"],
|
|
1237
|
+
mutationFn: (body) => intlayerOAuth.stripe.grantAffiliateAccess(body),
|
|
1238
|
+
meta: { invalidateQueries: [["affiliate"]] }
|
|
1239
|
+
});
|
|
1240
|
+
};
|
|
1241
|
+
const useSendAffiliateInvitation = () => {
|
|
1242
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1243
|
+
return useMutation({
|
|
1244
|
+
mutationKey: [
|
|
1245
|
+
"affiliate",
|
|
1246
|
+
"invitation",
|
|
1247
|
+
"send"
|
|
1248
|
+
],
|
|
1249
|
+
mutationFn: (body) => intlayerOAuth.stripe.sendAffiliateInvitation(body)
|
|
1250
|
+
});
|
|
1251
|
+
};
|
|
1252
|
+
const useGetAffiliateInvitation = (token, options) => {
|
|
1253
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1254
|
+
return useQuery({
|
|
1255
|
+
queryKey: [
|
|
1256
|
+
"affiliate",
|
|
1257
|
+
"invitation",
|
|
1258
|
+
token
|
|
1259
|
+
],
|
|
1260
|
+
queryFn: () => intlayerOAuth.stripe.getAffiliateInvitation({ token }),
|
|
1261
|
+
enabled: Boolean(token),
|
|
1262
|
+
...options
|
|
1263
|
+
});
|
|
1264
|
+
};
|
|
1265
|
+
const useAcceptAffiliateInvitation = () => {
|
|
1266
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1267
|
+
const queryClient = useQueryClient();
|
|
1268
|
+
return useMutation({
|
|
1269
|
+
mutationKey: [
|
|
1270
|
+
"affiliate",
|
|
1271
|
+
"invitation",
|
|
1272
|
+
"accept"
|
|
1273
|
+
],
|
|
1274
|
+
mutationFn: ({ token, country }) => intlayerOAuth.stripe.acceptAffiliateInvitation({
|
|
1275
|
+
token,
|
|
1276
|
+
country
|
|
1277
|
+
}),
|
|
1278
|
+
onSuccess: (_data, { token }) => {
|
|
1279
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
1280
|
+
"affiliate",
|
|
1281
|
+
"invitation",
|
|
1282
|
+
token
|
|
1283
|
+
] });
|
|
1284
|
+
queryClient.invalidateQueries({ queryKey: ["affiliate"] });
|
|
1285
|
+
}
|
|
1286
|
+
});
|
|
1287
|
+
};
|
|
1288
|
+
const useUpdateAffiliateStatus = () => {
|
|
1289
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1290
|
+
const queryClient = useQueryClient();
|
|
1291
|
+
return useMutation({
|
|
1292
|
+
mutationKey: ["affiliate", "update"],
|
|
1293
|
+
mutationFn: ({ id, status, category }) => intlayerOAuth.stripe.updateAffiliateStatus({ id }, {
|
|
1294
|
+
status,
|
|
1295
|
+
category
|
|
1296
|
+
}),
|
|
1297
|
+
onSuccess: (_data, { id }) => {
|
|
1298
|
+
queryClient.invalidateQueries({ queryKey: ["affiliates", id] });
|
|
1299
|
+
queryClient.invalidateQueries({ queryKey: ["affiliates"] });
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1302
|
+
};
|
|
1303
|
+
/**
|
|
1304
|
+
* Reviewer Marketplace
|
|
1305
|
+
*/
|
|
1306
|
+
const useGetReviewerMarketplace = (params, options) => {
|
|
1307
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1308
|
+
return useAppQuery({
|
|
1309
|
+
queryKey: [
|
|
1310
|
+
"reviewer",
|
|
1311
|
+
"marketplace",
|
|
1312
|
+
params
|
|
1313
|
+
],
|
|
1314
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getMarketplace(params, { signal }),
|
|
1315
|
+
...options
|
|
1316
|
+
});
|
|
1317
|
+
};
|
|
1318
|
+
const useGetReviewerPriceDistribution = (params, options) => {
|
|
1319
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1320
|
+
return useAppQuery({
|
|
1321
|
+
queryKey: [
|
|
1322
|
+
"reviewer",
|
|
1323
|
+
"marketplace",
|
|
1324
|
+
"price-distribution",
|
|
1325
|
+
params
|
|
1326
|
+
],
|
|
1327
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getPriceDistribution(params, { signal }),
|
|
1328
|
+
...options
|
|
1329
|
+
});
|
|
1330
|
+
};
|
|
1331
|
+
const useGetReviewerById = (reviewerId, options) => {
|
|
1332
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1333
|
+
return useAppQuery({
|
|
1334
|
+
queryKey: ["reviewer", reviewerId],
|
|
1335
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getReviewerById(reviewerId, { signal }),
|
|
1336
|
+
enabled: Boolean(reviewerId),
|
|
1337
|
+
...options
|
|
1338
|
+
});
|
|
1339
|
+
};
|
|
1340
|
+
const useGetReviewerReviews = (reviewerId, params, options) => {
|
|
1341
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1342
|
+
return useAppQuery({
|
|
1343
|
+
queryKey: [
|
|
1344
|
+
"reviewer",
|
|
1345
|
+
reviewerId,
|
|
1346
|
+
"reviews",
|
|
1347
|
+
params
|
|
1348
|
+
],
|
|
1349
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getReviewerReviews(reviewerId, params, { signal }),
|
|
1350
|
+
enabled: Boolean(reviewerId),
|
|
1351
|
+
...options
|
|
1352
|
+
});
|
|
1353
|
+
};
|
|
1354
|
+
const useGetMyReviewerProfile = (options) => {
|
|
1355
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1356
|
+
return useAppQuery({
|
|
1357
|
+
queryKey: ["reviewer", "me"],
|
|
1358
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getMyReviewerProfile({ signal }),
|
|
1359
|
+
requireUser: true,
|
|
1360
|
+
...options
|
|
1361
|
+
});
|
|
1362
|
+
};
|
|
1363
|
+
const useRegisterAsReviewer = () => {
|
|
1364
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1365
|
+
const queryClient = useQueryClient();
|
|
1366
|
+
return useMutation({
|
|
1367
|
+
mutationKey: ["reviewer", "register"],
|
|
1368
|
+
mutationFn: (body) => intlayerOAuth.reviewer.registerAsReviewer(body),
|
|
1369
|
+
onSuccess: () => {
|
|
1370
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "me"] });
|
|
1371
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "marketplace"] });
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
};
|
|
1375
|
+
const useUpdateReviewerProfile = () => {
|
|
1376
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1377
|
+
const queryClient = useQueryClient();
|
|
1378
|
+
return useMutation({
|
|
1379
|
+
mutationKey: ["reviewer", "update"],
|
|
1380
|
+
mutationFn: (body) => intlayerOAuth.reviewer.updateReviewerProfile(body),
|
|
1381
|
+
onSuccess: () => {
|
|
1382
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "me"] });
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
};
|
|
1386
|
+
const useDeleteReviewerProfile = () => {
|
|
1387
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1388
|
+
const queryClient = useQueryClient();
|
|
1389
|
+
return useMutation({
|
|
1390
|
+
mutationKey: ["reviewer", "delete"],
|
|
1391
|
+
mutationFn: () => intlayerOAuth.reviewer.deleteReviewerProfile(),
|
|
1392
|
+
onSuccess: () => {
|
|
1393
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "me"] });
|
|
1394
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "marketplace"] });
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
};
|
|
1398
|
+
const useUploadReviewerMainPicture = () => {
|
|
1399
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1400
|
+
const queryClient = useQueryClient();
|
|
1401
|
+
return useMutation({
|
|
1402
|
+
mutationKey: [
|
|
1403
|
+
"reviewer",
|
|
1404
|
+
"picture",
|
|
1405
|
+
"main"
|
|
1406
|
+
],
|
|
1407
|
+
mutationFn: (file) => intlayerOAuth.reviewer.uploadMainPicture(file),
|
|
1408
|
+
onSuccess: () => {
|
|
1409
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "me"] });
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1412
|
+
};
|
|
1413
|
+
const useUploadReviewerCoverPicture = () => {
|
|
1414
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1415
|
+
const queryClient = useQueryClient();
|
|
1416
|
+
return useMutation({
|
|
1417
|
+
mutationKey: [
|
|
1418
|
+
"reviewer",
|
|
1419
|
+
"picture",
|
|
1420
|
+
"cover"
|
|
1421
|
+
],
|
|
1422
|
+
mutationFn: (file) => intlayerOAuth.reviewer.uploadCoverPicture(file),
|
|
1423
|
+
onSuccess: () => {
|
|
1424
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "me"] });
|
|
1425
|
+
}
|
|
1426
|
+
});
|
|
1427
|
+
};
|
|
1428
|
+
const useEstimateMission = () => {
|
|
1429
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1430
|
+
return useMutation({
|
|
1431
|
+
mutationKey: [
|
|
1432
|
+
"reviewer",
|
|
1433
|
+
"mission",
|
|
1434
|
+
"estimate"
|
|
1435
|
+
],
|
|
1436
|
+
mutationFn: (body) => intlayerOAuth.reviewer.estimateMission(body)
|
|
1437
|
+
});
|
|
1438
|
+
};
|
|
1439
|
+
const useCreateMission = () => {
|
|
1440
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1441
|
+
const queryClient = useQueryClient();
|
|
1442
|
+
return useMutation({
|
|
1443
|
+
mutationKey: [
|
|
1444
|
+
"reviewer",
|
|
1445
|
+
"mission",
|
|
1446
|
+
"create"
|
|
1447
|
+
],
|
|
1448
|
+
mutationFn: (body) => intlayerOAuth.reviewer.createMission(body),
|
|
1449
|
+
onSuccess: () => {
|
|
1450
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "missions"] });
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
};
|
|
1454
|
+
const useGetMyMissions = (params, options) => {
|
|
1455
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1456
|
+
return useAppQuery({
|
|
1457
|
+
queryKey: [
|
|
1458
|
+
"reviewer",
|
|
1459
|
+
"missions",
|
|
1460
|
+
params
|
|
1461
|
+
],
|
|
1462
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getMyMissions(params, { signal }),
|
|
1463
|
+
requireUser: true,
|
|
1464
|
+
...options
|
|
1465
|
+
});
|
|
1466
|
+
};
|
|
1467
|
+
const useGetMissionById = (missionId, options) => {
|
|
1468
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1469
|
+
return useAppQuery({
|
|
1470
|
+
queryKey: [
|
|
1471
|
+
"reviewer",
|
|
1472
|
+
"mission",
|
|
1473
|
+
missionId
|
|
1474
|
+
],
|
|
1475
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getMissionById(missionId, { signal }),
|
|
1476
|
+
enabled: Boolean(missionId),
|
|
1477
|
+
requireUser: true,
|
|
1478
|
+
...options
|
|
1479
|
+
});
|
|
1480
|
+
};
|
|
1481
|
+
const useUpdateMissionStatus = () => {
|
|
1482
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1483
|
+
const queryClient = useQueryClient();
|
|
1484
|
+
return useMutation({
|
|
1485
|
+
mutationKey: [
|
|
1486
|
+
"reviewer",
|
|
1487
|
+
"mission",
|
|
1488
|
+
"status"
|
|
1489
|
+
],
|
|
1490
|
+
mutationFn: ({ missionId, body }) => intlayerOAuth.reviewer.updateMissionStatus(missionId, body),
|
|
1491
|
+
onSuccess: (_data, { missionId }) => {
|
|
1492
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
1493
|
+
"reviewer",
|
|
1494
|
+
"mission",
|
|
1495
|
+
missionId
|
|
1496
|
+
] });
|
|
1497
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", "missions"] });
|
|
1498
|
+
}
|
|
1499
|
+
});
|
|
1500
|
+
};
|
|
1501
|
+
const useSubmitReview = () => {
|
|
1502
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1503
|
+
const queryClient = useQueryClient();
|
|
1504
|
+
return useMutation({
|
|
1505
|
+
mutationKey: ["reviewer", "review"],
|
|
1506
|
+
mutationFn: ({ missionId, body }) => intlayerOAuth.reviewer.submitReview(missionId, body),
|
|
1507
|
+
onSuccess: () => {
|
|
1508
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer"] });
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
};
|
|
1512
|
+
const useGetChatHistory = (missionId, options) => {
|
|
1513
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1514
|
+
return useAppQuery({
|
|
1515
|
+
queryKey: [
|
|
1516
|
+
"reviewer",
|
|
1517
|
+
"mission",
|
|
1518
|
+
missionId,
|
|
1519
|
+
"chat"
|
|
1520
|
+
],
|
|
1521
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getChatHistory(missionId, { signal }),
|
|
1522
|
+
enabled: Boolean(missionId),
|
|
1523
|
+
requireUser: true,
|
|
1524
|
+
...options
|
|
1525
|
+
});
|
|
1526
|
+
};
|
|
1527
|
+
const useSendReviewerMessage = () => {
|
|
1528
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1529
|
+
const queryClient = useQueryClient();
|
|
1530
|
+
return useMutation({
|
|
1531
|
+
mutationKey: [
|
|
1532
|
+
"reviewer",
|
|
1533
|
+
"chat",
|
|
1534
|
+
"send"
|
|
1535
|
+
],
|
|
1536
|
+
mutationFn: ({ missionId, content }) => intlayerOAuth.reviewer.sendMessage(missionId, { content }),
|
|
1537
|
+
onSuccess: (_data, { missionId }) => {
|
|
1538
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
1539
|
+
"reviewer",
|
|
1540
|
+
"mission",
|
|
1541
|
+
missionId,
|
|
1542
|
+
"chat"
|
|
1543
|
+
] });
|
|
1544
|
+
}
|
|
1545
|
+
});
|
|
1546
|
+
};
|
|
1547
|
+
const useContactReviewer = () => {
|
|
1548
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1549
|
+
return useMutation({
|
|
1550
|
+
mutationKey: ["reviewer", "contact"],
|
|
1551
|
+
mutationFn: ({ reviewerId, message }) => intlayerOAuth.reviewer.contactReviewer(reviewerId, { message })
|
|
1552
|
+
});
|
|
1553
|
+
};
|
|
1554
|
+
const useGetAdminReviewers = (params = {}, options) => {
|
|
1555
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1556
|
+
return useAppQuery({
|
|
1557
|
+
queryKey: [
|
|
1558
|
+
"admin",
|
|
1559
|
+
"reviewers",
|
|
1560
|
+
params
|
|
1561
|
+
],
|
|
1562
|
+
queryFn: ({ signal }) => intlayerOAuth.reviewer.getAdminReviewers(params, { signal }),
|
|
1563
|
+
requireUser: true,
|
|
1564
|
+
...options
|
|
1565
|
+
});
|
|
1566
|
+
};
|
|
1567
|
+
const useValidateReviewerProfile = () => {
|
|
1568
|
+
const intlayerOAuth = useIntlayerOAuth();
|
|
1569
|
+
const queryClient = useQueryClient();
|
|
1570
|
+
return useMutation({
|
|
1571
|
+
mutationKey: [
|
|
1572
|
+
"admin",
|
|
1573
|
+
"reviewer",
|
|
1574
|
+
"validate"
|
|
1575
|
+
],
|
|
1576
|
+
mutationFn: (reviewerId) => intlayerOAuth.reviewer.validateReviewerProfile(reviewerId),
|
|
1577
|
+
onSuccess: (_data, reviewerId) => {
|
|
1578
|
+
queryClient.invalidateQueries({ queryKey: ["admin", "reviewers"] });
|
|
1579
|
+
queryClient.invalidateQueries({ queryKey: ["reviewer", reviewerId] });
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
};
|
|
1184
1583
|
|
|
1185
1584
|
//#endregion
|
|
1186
|
-
export { useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAppQuery, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAutocomplete, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useCreatePortalSession, useCreateUser, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDisableTwoFactor, useEnableTwoFactor, useFillAllTranslations, useGetCIConfig, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetInvoices, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjects, useGetRecursiveAuditStatus, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useInfiniteGetDictionaries, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, usePauseTranslationJob, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useQueryClient, useRefreshAccessKey, useRegister, useRegisterSSO, useResetPassword, useResumeTranslationJob, useSearchDoc, useSelectOrganization, useSelectProject, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useSubmitShowcaseProject, useSubscribeToNewsletter, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateDictionary, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadUserAvatar, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary };
|
|
1585
|
+
export { useAcceptAffiliateInvitation, useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAppQuery, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAutocomplete, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useContactReviewer, useCreateMission, useCreatePortalSession, useCreateUser, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeleteReviewerProfile, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDisableTwoFactor, useEnableTwoFactor, useEstimateMission, useFillAllTranslations, useGetAdminReviewers, useGetAffiliate, useGetAffiliateAccountSession, useGetAffiliateById, useGetAffiliateInvitation, useGetAffiliateStats, useGetAffiliates, useGetCIConfig, useGetChatHistory, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetInvoices, useGetMissionById, useGetMyMissions, useGetMyReviewerProfile, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjects, useGetRecursiveAuditStatus, useGetReviewerById, useGetReviewerMarketplace, useGetReviewerPriceDistribution, useGetReviewerReviews, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useGrantAffiliateAccess, useInfiniteGetDictionaries, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, usePauseTranslationJob, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useQueryClient, useRefreshAccessKey, useRegister, useRegisterAsReviewer, useRegisterSSO, useResetPassword, useResumeTranslationJob, useSearchDoc, useSelectOrganization, useSelectProject, useSendAffiliateInvitation, useSendReviewerMessage, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useSubmitReview, useSubmitShowcaseProject, useSubscribeToNewsletter, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateAffiliateStatus, useUpdateDictionary, useUpdateMissionStatus, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdateReviewerProfile, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadReviewerCoverPicture, useUploadReviewerMainPicture, useUploadUserAvatar, useValidateReviewerProfile, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary };
|
|
1187
1586
|
//# sourceMappingURL=reactQuery.mjs.map
|