Fix lint errors and cleanup node_modules from git

This commit is contained in:
MivoDev
2026-01-18 11:21:31 +07:00
parent 266a4b1296
commit 9b71ee65ed
10681 changed files with 19 additions and 1469308 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
node_modules
.DS_Store
dist
dist-ssr
cache
.idea
.vscode
*.log

View File

@@ -1,4 +1,5 @@
import DefaultTheme from 'vitepress/theme'
import type { EnhanceAppContext } from 'vitepress'
import Layout from './Layout.vue'
import Icon from './components/Icon.vue'
import 'flag-icons/css/flag-icons.min.css'
@@ -7,7 +8,7 @@ import './style.css'
export default {
extends: DefaultTheme,
Layout: Layout,
enhanceApp({ app }) {
enhanceApp({ app }: EnhanceAppContext) {
app.component('Icon', Icon)
}
}

16
node_modules/.bin/autoprefixer generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../autoprefixer/bin/autoprefixer" "$@"
else
exec node "$basedir/../autoprefixer/bin/autoprefixer" "$@"
fi

17
node_modules/.bin/autoprefixer.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\autoprefixer\bin\autoprefixer" %*

28
node_modules/.bin/autoprefixer.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../autoprefixer/bin/autoprefixer" $args
} else {
& "$basedir/node$exe" "$basedir/../autoprefixer/bin/autoprefixer" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../autoprefixer/bin/autoprefixer" $args
} else {
& "node$exe" "$basedir/../autoprefixer/bin/autoprefixer" $args
}
$ret=$LASTEXITCODE
}
exit $ret

View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../baseline-browser-mapping/dist/cli.js" "$@"
else
exec node "$basedir/../baseline-browser-mapping/dist/cli.js" "$@"
fi

View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\baseline-browser-mapping\dist\cli.js" %*

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../baseline-browser-mapping/dist/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../baseline-browser-mapping/dist/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../baseline-browser-mapping/dist/cli.js" $args
} else {
& "node$exe" "$basedir/../baseline-browser-mapping/dist/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/browserslist generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../browserslist/cli.js" "$@"
else
exec node "$basedir/../browserslist/cli.js" "$@"
fi

17
node_modules/.bin/browserslist.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\browserslist\cli.js" %*

28
node_modules/.bin/browserslist.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../browserslist/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../browserslist/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../browserslist/cli.js" $args
} else {
& "node$exe" "$basedir/../browserslist/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/cssesc generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../cssesc/bin/cssesc" "$@"
else
exec node "$basedir/../cssesc/bin/cssesc" "$@"
fi

17
node_modules/.bin/cssesc.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\cssesc\bin\cssesc" %*

28
node_modules/.bin/cssesc.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../cssesc/bin/cssesc" $args
} else {
& "$basedir/node$exe" "$basedir/../cssesc/bin/cssesc" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../cssesc/bin/cssesc" $args
} else {
& "node$exe" "$basedir/../cssesc/bin/cssesc" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/esbuild generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../esbuild/bin/esbuild" "$@"
else
exec node "$basedir/../esbuild/bin/esbuild" "$@"
fi

17
node_modules/.bin/esbuild.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esbuild\bin\esbuild" %*

28
node_modules/.bin/esbuild.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args
} else {
& "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../esbuild/bin/esbuild" $args
} else {
& "node$exe" "$basedir/../esbuild/bin/esbuild" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/jiti generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../jiti/bin/jiti.js" "$@"
else
exec node "$basedir/../jiti/bin/jiti.js" "$@"
fi

17
node_modules/.bin/jiti.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\jiti\bin\jiti.js" %*

28
node_modules/.bin/jiti.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../jiti/bin/jiti.js" $args
} else {
& "$basedir/node$exe" "$basedir/../jiti/bin/jiti.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../jiti/bin/jiti.js" $args
} else {
& "node$exe" "$basedir/../jiti/bin/jiti.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/nanoid generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../nanoid/bin/nanoid.cjs" "$@"
else
exec node "$basedir/../nanoid/bin/nanoid.cjs" "$@"
fi

17
node_modules/.bin/nanoid.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nanoid\bin\nanoid.cjs" %*

28
node_modules/.bin/nanoid.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
} else {
& "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
} else {
& "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/parser generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../@babel/parser/bin/babel-parser.js" "$@"
else
exec node "$basedir/../@babel/parser/bin/babel-parser.js" "$@"
fi

17
node_modules/.bin/parser.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@babel\parser\bin\babel-parser.js" %*

28
node_modules/.bin/parser.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args
} else {
& "$basedir/node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args
} else {
& "node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/resolve generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../resolve/bin/resolve" "$@"
else
exec node "$basedir/../resolve/bin/resolve" "$@"
fi

17
node_modules/.bin/resolve.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\resolve\bin\resolve" %*

28
node_modules/.bin/resolve.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args
} else {
& "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../resolve/bin/resolve" $args
} else {
& "node$exe" "$basedir/../resolve/bin/resolve" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/rollup generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../rollup/dist/bin/rollup" "$@"
else
exec node "$basedir/../rollup/dist/bin/rollup" "$@"
fi

17
node_modules/.bin/rollup.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rollup\dist\bin\rollup" %*

28
node_modules/.bin/rollup.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../rollup/dist/bin/rollup" $args
} else {
& "$basedir/node$exe" "$basedir/../rollup/dist/bin/rollup" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../rollup/dist/bin/rollup" $args
} else {
& "node$exe" "$basedir/../rollup/dist/bin/rollup" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/sucrase generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../sucrase/bin/sucrase" "$@"
else
exec node "$basedir/../sucrase/bin/sucrase" "$@"
fi

16
node_modules/.bin/sucrase-node generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../sucrase/bin/sucrase-node" "$@"
else
exec node "$basedir/../sucrase/bin/sucrase-node" "$@"
fi

17
node_modules/.bin/sucrase-node.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\sucrase\bin\sucrase-node" %*

28
node_modules/.bin/sucrase-node.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../sucrase/bin/sucrase-node" $args
} else {
& "$basedir/node$exe" "$basedir/../sucrase/bin/sucrase-node" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../sucrase/bin/sucrase-node" $args
} else {
& "node$exe" "$basedir/../sucrase/bin/sucrase-node" $args
}
$ret=$LASTEXITCODE
}
exit $ret

17
node_modules/.bin/sucrase.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\sucrase\bin\sucrase" %*

28
node_modules/.bin/sucrase.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../sucrase/bin/sucrase" $args
} else {
& "$basedir/node$exe" "$basedir/../sucrase/bin/sucrase" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../sucrase/bin/sucrase" $args
} else {
& "node$exe" "$basedir/../sucrase/bin/sucrase" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/tailwind generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../tailwindcss/lib/cli.js" "$@"
else
exec node "$basedir/../tailwindcss/lib/cli.js" "$@"
fi

17
node_modules/.bin/tailwind.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\tailwindcss\lib\cli.js" %*

28
node_modules/.bin/tailwind.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../tailwindcss/lib/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../tailwindcss/lib/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../tailwindcss/lib/cli.js" $args
} else {
& "node$exe" "$basedir/../tailwindcss/lib/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/tailwindcss generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../tailwindcss/lib/cli.js" "$@"
else
exec node "$basedir/../tailwindcss/lib/cli.js" "$@"
fi

17
node_modules/.bin/tailwindcss.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\tailwindcss\lib\cli.js" %*

28
node_modules/.bin/tailwindcss.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../tailwindcss/lib/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../tailwindcss/lib/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../tailwindcss/lib/cli.js" $args
} else {
& "node$exe" "$basedir/../tailwindcss/lib/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../update-browserslist-db/cli.js" "$@"
else
exec node "$basedir/../update-browserslist-db/cli.js" "$@"
fi

View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\update-browserslist-db\cli.js" %*

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../update-browserslist-db/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../update-browserslist-db/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../update-browserslist-db/cli.js" $args
} else {
& "node$exe" "$basedir/../update-browserslist-db/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/vite generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
else
exec node "$basedir/../vite/bin/vite.js" "$@"
fi

17
node_modules/.bin/vite.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\vite\bin\vite.js" %*

28
node_modules/.bin/vite.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
} else {
& "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../vite/bin/vite.js" $args
} else {
& "node$exe" "$basedir/../vite/bin/vite.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
node_modules/.bin/vitepress generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../vitepress/bin/vitepress.js" "$@"
else
exec node "$basedir/../vitepress/bin/vitepress.js" "$@"
fi

17
node_modules/.bin/vitepress.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\vitepress\bin\vitepress.js" %*

28
node_modules/.bin/vitepress.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../vitepress/bin/vitepress.js" $args
} else {
& "$basedir/node$exe" "$basedir/../vitepress/bin/vitepress.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../vitepress/bin/vitepress.js" $args
} else {
& "node$exe" "$basedir/../vitepress/bin/vitepress.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

3630
node_modules/.package-lock.json generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2013-Present Algolia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,76 +0,0 @@
<p align="center">
<a href="https://www.algolia.com">
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" >
</a>
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4>
<p align="center">
<a href="https://npmjs.com/package/@algolia/abtesting"><img src="https://img.shields.io/npm/v/@algolia/abtesting.svg?style=flat-square" alt="NPM version"></img></a>
<a href="http://npm-stat.com/charts.html?package=@algolia/abtesting"><img src="https://img.shields.io/npm/dm/@algolia/abtesting.svg?style=flat-square" alt="NPM downloads"></a>
<a href="https://www.jsdelivr.com/package/npm/@algolia/abtesting"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/abtesting/badge" alt="jsDelivr Downloads"></img></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
</p>
</p>
<p align="center">
<a href="https://www.algolia.com/doc/libraries/sdk/install#javascript" target="_blank">Documentation</a> •
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a> •
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a> •
<a href="https://alg.li/support" target="_blank">Support</a>
</p>
## ✨ Features
- Thin & **minimal low-level HTTP client** to interact with Algolia's API
- Works both on the **browser** and **node.js**
- **UMD and ESM compatible**, you can use it with any module loader
- Built with TypeScript
## 💡 Getting Started
> [!TIP]
> This API client is already a dependency of [the algoliasearch client](https://www.npmjs.com/package/algoliasearch), you don't need to manually install `@algolia/abtesting` if you already have `algoliasearch` installed.
To get started, you first need to install @algolia/abtesting (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
### With a package manager
```bash
yarn add @algolia/abtesting@1.12.3
# or
npm install @algolia/abtesting@1.12.3
# or
pnpm add @algolia/abtesting@1.12.3
```
### Without a package manager
Add the following JavaScript snippet to the <head> of your website:
```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/abtesting@1.12.3/dist/builds/browser.umd.js"></script>
```
### Usage
You can now import the Algolia API client in your project and play with it.
```js
import { abtestingV3Client } from '@algolia/abtesting';
const client = abtestingV3Client('YOUR_APP_ID', 'YOUR_API_KEY');
```
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/sdk/methods/abtesting-v3/)**.
## ❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://support.algolia.com/hc/en-us/sections/15061037630609-API-Client-FAQs) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
## 📄 License
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).

View File

@@ -1,676 +0,0 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* Date and time when the A/B test was stopped, in RFC 3339 format.
*/
stoppedAt?: string | null | undefined;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](https://www.algolia.com/doc/rest-api/search/get-task) and this task ID.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.12.3";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

View File

@@ -1,434 +0,0 @@
// builds/browser.ts
import { createXhrRequester } from "@algolia/requester-browser-xhr";
import {
createBrowserLocalStorageCache,
createFallbackableCache,
createMemoryCache,
createNullLogger
} from "@algolia/client-common";
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.12.3";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/browser.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 1e3,
read: 2e3,
write: 3e4
},
logger: createNullLogger(),
requester: createXhrRequester(),
algoliaAgents: [{ segment: "Browser" }],
authMode: "WithinQueryParameters",
responsesCache: createMemoryCache(),
requestsCache: createMemoryCache({ serializable: false }),
hostsCache: createFallbackableCache({
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()]
}),
...options
});
}
export {
abtestingV3Client,
apiClientVersion
};
//# sourceMappingURL=browser.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,428 +0,0 @@
// builds/fetch.ts
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
import { createFetchRequester } from "@algolia/requester-fetch";
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.12.3";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/fetch.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Fetch" }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingV3Client,
apiClientVersion
};
//# sourceMappingURL=fetch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,454 +0,0 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// builds/node.ts
var node_exports = {};
__export(node_exports, {
abtestingV3Client: () => abtestingV3Client,
apiClientVersion: () => apiClientVersion
});
module.exports = __toCommonJS(node_exports);
var import_requester_node_http = require("@algolia/requester-node-http");
var import_client_common2 = require("@algolia/client-common");
// src/abtestingV3Client.ts
var import_client_common = require("@algolia/client-common");
var apiClientVersion = "1.12.3";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
const transporter = (0, import_client_common.createTransporter)({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/node.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: (0, import_client_common2.createNullLogger)(),
requester: (0, import_requester_node_http.createHttpRequester)(),
algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
responsesCache: (0, import_client_common2.createNullCache)(),
requestsCache: (0, import_client_common2.createNullCache)(),
hostsCache: (0, import_client_common2.createMemoryCache)(),
...options
})
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
abtestingV3Client,
apiClientVersion
});
//# sourceMappingURL=node.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -1,428 +0,0 @@
// builds/node.ts
import { createHttpRequester } from "@algolia/requester-node-http";
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.12.3";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/node.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createHttpRequester(),
algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingV3Client,
apiClientVersion
};
//# sourceMappingURL=node.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,428 +0,0 @@
// builds/worker.ts
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
import { createFetchRequester } from "@algolia/requester-fetch";
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.12.3";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/worker.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Worker" }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingV3Client,
apiClientVersion
};
//# sourceMappingURL=worker.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,677 +0,0 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* Date and time when the A/B test was stopped, in RFC 3339 format.
*/
stoppedAt?: string | null | undefined;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](https://www.algolia.com/doc/rest-api/search/get-task) and this task ID.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.12.3";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

View File

@@ -1,677 +0,0 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* Date and time when the A/B test was stopped, in RFC 3339 format.
*/
stoppedAt?: string | null | undefined;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](https://www.algolia.com/doc/rest-api/search/get-task) and this task ID.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.12.3";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

View File

@@ -1,677 +0,0 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* Date and time when the A/B test was stopped, in RFC 3339 format.
*/
stoppedAt?: string | null | undefined;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](https://www.algolia.com/doc/rest-api/search/get-task) and this task ID.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.12.3";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

View File

@@ -1,420 +0,0 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/abtestingV3Client.ts
var abtestingV3Client_exports = {};
__export(abtestingV3Client_exports, {
REGIONS: () => REGIONS,
apiClientVersion: () => apiClientVersion,
createAbtestingV3Client: () => createAbtestingV3Client
});
module.exports = __toCommonJS(abtestingV3Client_exports);
var import_client_common = require("@algolia/client-common");
var apiClientVersion = "1.12.3";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
const transporter = (0, import_client_common.createTransporter)({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
REGIONS,
apiClientVersion,
createAbtestingV3Client
});
//# sourceMappingURL=abtestingV3Client.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -1,393 +0,0 @@
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.12.3";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
export {
REGIONS,
apiClientVersion,
createAbtestingV3Client
};
//# sourceMappingURL=abtestingV3Client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,677 +0,0 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* Date and time when the A/B test was stopped, in RFC 3339 format.
*/
stoppedAt?: string | null | undefined;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](https://www.algolia.com/doc/rest-api/search/get-task) and this task ID.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.12.3";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

View File

@@ -1 +0,0 @@
export * from './dist/node';

View File

@@ -1 +0,0 @@
module.exports = require('./dist/builds/node.cjs');

View File

@@ -1,69 +0,0 @@
{
"version": "1.12.3",
"repository": {
"type": "git",
"url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
},
"homepage": "https://github.com/algolia/algoliasearch-client-javascript/tree/main/packages/abtesting#readme",
"type": "module",
"license": "MIT",
"author": "Algolia",
"scripts": {
"build": "yarn clean && yarn tsup && yarn rollup -c rollup.config.js",
"clean": "rm -rf ./dist || true",
"test:bundle": "publint . && attw --pack ."
},
"name": "@algolia/abtesting",
"description": "JavaScript client for abtesting",
"exports": {
".": {
"node": {
"types": {
"import": "./dist/node.d.ts",
"module": "./dist/node.d.ts",
"require": "./dist/node.d.cts"
},
"import": "./dist/builds/node.js",
"module": "./dist/builds/node.js",
"require": "./dist/builds/node.cjs"
},
"worker": {
"types": "./dist/worker.d.ts",
"default": "./dist/builds/worker.js"
},
"default": {
"types": "./dist/browser.d.ts",
"module": "./dist/builds/browser.js",
"import": "./dist/builds/browser.js",
"default": "./dist/builds/browser.umd.js"
}
},
"./dist/builds/*": "./dist/builds/*.js"
},
"jsdelivr": "./dist/builds/browser.umd.js",
"unpkg": "./dist/builds/browser.umd.js",
"react-native": "./dist/builds/browser.js",
"files": [
"dist",
"index.js",
"index.d.ts"
],
"dependencies": {
"@algolia/client-common": "5.46.3",
"@algolia/requester-browser-xhr": "5.46.3",
"@algolia/requester-fetch": "5.46.3",
"@algolia/requester-node-http": "5.46.3"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.18.2",
"@types/node": "25.0.6",
"publint": "0.3.16",
"rollup": "4.55.1",
"tsup": "8.5.1",
"typescript": "5.9.3"
},
"engines": {
"node": ">= 14.0.0"
},
"gitHead": "5be82d3f2ae7cd97f5d42c3451e966daa53fd06a"
}

View File

@@ -1,17 +0,0 @@
# @algolia/autocomplete-core
The [`autocomplete-core`](https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-core/createAutocomplete) package is the foundation of Autocomplete. It exposes primitives to build an autocomplete experience.
You likely dont need to use this package directly unless youre building a [renderer](https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer).
## Installation
```sh
yarn add @algolia/autocomplete-core
# or
npm install @algolia/autocomplete-core
```
## Documentation
See [**Documentation**](https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-core).

View File

@@ -1,2 +0,0 @@
import { AutocompleteOptions, BaseItem } from './types';
export declare function checkOptions<TItem extends BaseItem>(options: AutocompleteOptions<TItem>): void;

View File

@@ -1,4 +0,0 @@
import { warn } from '@algolia/autocomplete-shared';
export function checkOptions(options) {
process.env.NODE_ENV !== 'production' ? warn(!options.debug, 'The `debug` option is meant for development debugging and should not be used in production.') : void 0;
}

View File

@@ -1,8 +0,0 @@
import { AutocompleteApi, AutocompleteOptions as AutocompleteCoreOptions, BaseItem } from './types';
export interface AutocompleteOptionsWithMetadata<TItem extends BaseItem> extends AutocompleteCoreOptions<TItem> {
/**
* @internal
*/
__autocomplete_metadata?: Record<string, unknown>;
}
export declare function createAutocomplete<TItem extends BaseItem, TEvent = Event, TMouseEvent = MouseEvent, TKeyboardEvent = KeyboardEvent>(options: AutocompleteOptionsWithMetadata<TItem>): AutocompleteApi<TItem, TEvent, TMouseEvent, TKeyboardEvent>;

View File

@@ -1,106 +0,0 @@
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { createAlgoliaInsightsPlugin } from '@algolia/autocomplete-plugin-algolia-insights';
import { checkOptions } from './checkOptions';
import { createStore } from './createStore';
import { getAutocompleteSetters } from './getAutocompleteSetters';
import { getDefaultProps } from './getDefaultProps';
import { getPropGetters } from './getPropGetters';
import { getMetadata, injectMetadata } from './metadata';
import { onInput } from './onInput';
import { stateReducer } from './stateReducer';
export function createAutocomplete(options) {
checkOptions(options);
var subscribers = [];
var props = getDefaultProps(options, subscribers);
var store = createStore(stateReducer, props, onStoreStateChange);
var setters = getAutocompleteSetters({
store: store
});
var propGetters = getPropGetters(_objectSpread({
props: props,
refresh: refresh,
store: store,
navigator: props.navigator
}, setters));
function onStoreStateChange(_ref) {
var _state$context, _state$context$algoli;
var prevState = _ref.prevState,
state = _ref.state;
props.onStateChange(_objectSpread({
prevState: prevState,
state: state,
refresh: refresh,
navigator: props.navigator
}, setters));
if (!isAlgoliaInsightsPluginEnabled() && (_state$context = state.context) !== null && _state$context !== void 0 && (_state$context$algoli = _state$context.algoliaInsightsPlugin) !== null && _state$context$algoli !== void 0 && _state$context$algoli.__automaticInsights && props.insights !== false) {
var plugin = createAlgoliaInsightsPlugin({
__autocomplete_clickAnalytics: false
});
props.plugins.push(plugin);
subscribePlugins([plugin]);
}
}
function refresh() {
return onInput(_objectSpread({
event: new Event('input'),
nextState: {
isOpen: store.getState().isOpen
},
props: props,
navigator: props.navigator,
query: store.getState().query,
refresh: refresh,
store: store
}, setters));
}
function subscribePlugins(plugins) {
plugins.forEach(function (plugin) {
var _plugin$subscribe;
return (_plugin$subscribe = plugin.subscribe) === null || _plugin$subscribe === void 0 ? void 0 : _plugin$subscribe.call(plugin, _objectSpread(_objectSpread({}, setters), {}, {
navigator: props.navigator,
refresh: refresh,
onSelect: function onSelect(fn) {
subscribers.push({
onSelect: fn
});
},
onActive: function onActive(fn) {
subscribers.push({
onActive: fn
});
},
onResolve: function onResolve(fn) {
subscribers.push({
onResolve: fn
});
}
}));
});
}
function isAlgoliaInsightsPluginEnabled() {
return props.plugins.some(function (plugin) {
return plugin.name === 'aa.algoliaInsightsPlugin';
});
}
if (props.insights && !isAlgoliaInsightsPluginEnabled()) {
var insightsParams = typeof props.insights === 'boolean' ? {} : props.insights;
props.plugins.push(createAlgoliaInsightsPlugin(insightsParams));
}
subscribePlugins(props.plugins);
injectMetadata({
metadata: getMetadata({
plugins: props.plugins,
options: options
}),
environment: props.environment
});
return _objectSpread(_objectSpread({
refresh: refresh,
navigator: props.navigator
}, propGetters), setters);
}

View File

@@ -1,7 +0,0 @@
import { AutocompleteState, AutocompleteStore, BaseItem, InternalAutocompleteOptions, Reducer } from './types';
declare type OnStoreStateChange<TItem extends BaseItem> = ({ prevState, state, }: {
prevState: AutocompleteState<TItem>;
state: AutocompleteState<TItem>;
}) => void;
export declare function createStore<TItem extends BaseItem>(reducer: Reducer, props: InternalAutocompleteOptions<TItem>, onStoreStateChange: OnStoreStateChange<TItem>): AutocompleteStore<TItem>;
export {};

View File

@@ -1,28 +0,0 @@
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { createCancelablePromiseList } from './utils';
export function createStore(reducer, props, onStoreStateChange) {
var state = props.initialState;
return {
getState: function getState() {
return state;
},
dispatch: function dispatch(action, payload) {
var prevState = _objectSpread({}, state);
state = reducer(state, {
type: action,
props: props,
payload: payload
});
onStoreStateChange({
state: state,
prevState: prevState
});
},
pendingRequests: createCancelablePromiseList()
};
}

View File

@@ -1,13 +0,0 @@
import { AutocompleteCollection, AutocompleteStore, BaseItem } from './types';
interface GetAutocompleteSettersOptions<TItem extends BaseItem> {
store: AutocompleteStore<TItem>;
}
export declare function getAutocompleteSetters<TItem extends BaseItem>({ store, }: GetAutocompleteSettersOptions<TItem>): {
setActiveItemId: import("@algolia/autocomplete-shared/dist/esm/core/AutocompleteSetters").StateUpdater<number | null>;
setQuery: import("@algolia/autocomplete-shared/dist/esm/core/AutocompleteSetters").StateUpdater<string>;
setCollections: import("@algolia/autocomplete-shared/dist/esm/core/AutocompleteSetters").StateUpdater<(AutocompleteCollection<TItem> | import("@algolia/autocomplete-shared/dist/esm/core/AutocompleteCollection").AutocompleteCollectionItemsArray<TItem>)[]>;
setIsOpen: import("@algolia/autocomplete-shared/dist/esm/core/AutocompleteSetters").StateUpdater<boolean>;
setStatus: import("@algolia/autocomplete-shared/dist/esm/core/AutocompleteSetters").StateUpdater<"idle" | "loading" | "stalled" | "error">;
setContext: import("@algolia/autocomplete-shared/dist/esm/core/AutocompleteSetters").StateUpdater<import("@algolia/autocomplete-shared/dist/esm/core/AutocompleteContext").AutocompleteContext>;
};
export {};

View File

@@ -1,48 +0,0 @@
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { flatten } from '@algolia/autocomplete-shared';
export function getAutocompleteSetters(_ref) {
var store = _ref.store;
var setActiveItemId = function setActiveItemId(value) {
store.dispatch('setActiveItemId', value);
};
var setQuery = function setQuery(value) {
store.dispatch('setQuery', value);
};
var setCollections = function setCollections(rawValue) {
var baseItemId = 0;
var value = rawValue.map(function (collection) {
return _objectSpread(_objectSpread({}, collection), {}, {
// We flatten the stored items to support calling `getAlgoliaResults`
// from the source itself.
items: flatten(collection.items).map(function (item) {
return _objectSpread(_objectSpread({}, item), {}, {
__autocomplete_id: baseItemId++
});
})
});
});
store.dispatch('setCollections', value);
};
var setIsOpen = function setIsOpen(value) {
store.dispatch('setIsOpen', value);
};
var setStatus = function setStatus(value) {
store.dispatch('setStatus', value);
};
var setContext = function setContext(value) {
store.dispatch('setContext', value);
};
return {
setActiveItemId: setActiveItemId,
setQuery: setQuery,
setCollections: setCollections,
setIsOpen: setIsOpen,
setStatus: setStatus,
setContext: setContext
};
}

View File

@@ -1,6 +0,0 @@
import { AutocompleteState, BaseItem } from './types';
interface GetCompletionProps<TItem extends BaseItem> {
state: AutocompleteState<TItem>;
}
export declare function getCompletion<TItem extends BaseItem>({ state, }: GetCompletionProps<TItem>): string | null;
export {};

View File

@@ -1,9 +0,0 @@
import { getActiveItem } from './utils';
export function getCompletion(_ref) {
var _getActiveItem;
var state = _ref.state;
if (state.isOpen === false || state.activeItemId === null) {
return null;
}
return ((_getActiveItem = getActiveItem(state)) === null || _getActiveItem === void 0 ? void 0 : _getActiveItem.itemInputValue) || null;
}

View File

@@ -1,2 +0,0 @@
import { AutocompleteOptions, AutocompleteSubscribers, BaseItem, InternalAutocompleteOptions } from './types';
export declare function getDefaultProps<TItem extends BaseItem>(props: AutocompleteOptions<TItem>, pluginSubscribers: AutocompleteSubscribers<TItem>): InternalAutocompleteOptions<TItem>;

View File

@@ -1,130 +0,0 @@
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { getItemsCount, generateAutocompleteId, flatten } from '@algolia/autocomplete-shared';
import { getNormalizedSources } from './utils';
export function getDefaultProps(props, pluginSubscribers) {
var _props$id;
/* eslint-disable no-restricted-globals */
var environment = typeof window !== 'undefined' ? window : {};
/* eslint-enable no-restricted-globals */
var plugins = props.plugins || [];
return _objectSpread(_objectSpread({
debug: false,
openOnFocus: false,
enterKeyHint: undefined,
ignoreCompositionEvents: false,
placeholder: '',
autoFocus: false,
defaultActiveItemId: null,
stallThreshold: 300,
insights: undefined,
environment: environment,
shouldPanelOpen: function shouldPanelOpen(_ref) {
var state = _ref.state;
return getItemsCount(state) > 0;
},
reshape: function reshape(_ref2) {
var sources = _ref2.sources;
return sources;
}
}, props), {}, {
// Since `generateAutocompleteId` triggers a side effect (it increments
// an internal counter), we don't want to execute it if unnecessary.
id: (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : generateAutocompleteId(),
plugins: plugins,
// The following props need to be deeply defaulted.
initialState: _objectSpread({
activeItemId: null,
query: '',
completion: null,
collections: [],
isOpen: false,
status: 'idle',
context: {}
}, props.initialState),
onStateChange: function onStateChange(params) {
var _props$onStateChange;
(_props$onStateChange = props.onStateChange) === null || _props$onStateChange === void 0 ? void 0 : _props$onStateChange.call(props, params);
plugins.forEach(function (x) {
var _x$onStateChange;
return (_x$onStateChange = x.onStateChange) === null || _x$onStateChange === void 0 ? void 0 : _x$onStateChange.call(x, params);
});
},
onSubmit: function onSubmit(params) {
var _props$onSubmit;
(_props$onSubmit = props.onSubmit) === null || _props$onSubmit === void 0 ? void 0 : _props$onSubmit.call(props, params);
plugins.forEach(function (x) {
var _x$onSubmit;
return (_x$onSubmit = x.onSubmit) === null || _x$onSubmit === void 0 ? void 0 : _x$onSubmit.call(x, params);
});
},
onReset: function onReset(params) {
var _props$onReset;
(_props$onReset = props.onReset) === null || _props$onReset === void 0 ? void 0 : _props$onReset.call(props, params);
plugins.forEach(function (x) {
var _x$onReset;
return (_x$onReset = x.onReset) === null || _x$onReset === void 0 ? void 0 : _x$onReset.call(x, params);
});
},
getSources: function getSources(params) {
return Promise.all([].concat(_toConsumableArray(plugins.map(function (plugin) {
return plugin.getSources;
})), [props.getSources]).filter(Boolean).map(function (getSources) {
return getNormalizedSources(getSources, params);
})).then(function (nested) {
return flatten(nested);
}).then(function (sources) {
return sources.map(function (source) {
return _objectSpread(_objectSpread({}, source), {}, {
onSelect: function onSelect(params) {
source.onSelect(params);
pluginSubscribers.forEach(function (x) {
var _x$onSelect;
return (_x$onSelect = x.onSelect) === null || _x$onSelect === void 0 ? void 0 : _x$onSelect.call(x, params);
});
},
onActive: function onActive(params) {
source.onActive(params);
pluginSubscribers.forEach(function (x) {
var _x$onActive;
return (_x$onActive = x.onActive) === null || _x$onActive === void 0 ? void 0 : _x$onActive.call(x, params);
});
},
onResolve: function onResolve(params) {
source.onResolve(params);
pluginSubscribers.forEach(function (x) {
var _x$onResolve;
return (_x$onResolve = x.onResolve) === null || _x$onResolve === void 0 ? void 0 : _x$onResolve.call(x, params);
});
}
});
});
});
},
navigator: _objectSpread({
navigate: function navigate(_ref3) {
var itemUrl = _ref3.itemUrl;
environment.location.assign(itemUrl);
},
navigateNewTab: function navigateNewTab(_ref4) {
var itemUrl = _ref4.itemUrl;
var windowReference = environment.open(itemUrl, '_blank', 'noopener');
windowReference === null || windowReference === void 0 ? void 0 : windowReference.focus();
},
navigateNewWindow: function navigateNewWindow(_ref5) {
var itemUrl = _ref5.itemUrl;
environment.open(itemUrl, '_blank', 'noopener');
}
}, props.navigator)
});
}

View File

@@ -1,16 +0,0 @@
import { AutocompleteScopeApi, AutocompleteStore, BaseItem, GetEnvironmentProps, GetFormProps, GetInputProps, GetItemProps, GetLabelProps, GetListProps, GetPanelProps, GetRootProps, InternalAutocompleteOptions } from './types';
interface GetPropGettersOptions<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
store: AutocompleteStore<TItem>;
props: InternalAutocompleteOptions<TItem>;
}
export declare function getPropGetters<TItem extends BaseItem, TEvent, TMouseEvent, TKeyboardEvent>({ props, refresh, store, ...setters }: GetPropGettersOptions<TItem>): {
getEnvironmentProps: GetEnvironmentProps;
getRootProps: GetRootProps;
getFormProps: GetFormProps<TEvent>;
getLabelProps: GetLabelProps;
getInputProps: GetInputProps<TEvent, TMouseEvent, TKeyboardEvent>;
getPanelProps: GetPanelProps<TMouseEvent>;
getListProps: GetListProps;
getItemProps: GetItemProps<any, TMouseEvent>;
};
export {};

View File

@@ -1,335 +0,0 @@
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
var _excluded = ["props", "refresh", "store"],
_excluded2 = ["inputElement", "formElement", "panelElement"],
_excluded3 = ["inputElement"],
_excluded4 = ["inputElement", "maxLength"],
_excluded5 = ["source"],
_excluded6 = ["item", "source"];
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import { noop } from '@algolia/autocomplete-shared';
import { onInput } from './onInput';
import { onKeyDown as _onKeyDown } from './onKeyDown';
import { getActiveItem, getAutocompleteElementId, isOrContainsNode, isSamsung, getNativeEvent } from './utils';
export function getPropGetters(_ref) {
var props = _ref.props,
refresh = _ref.refresh,
store = _ref.store,
setters = _objectWithoutProperties(_ref, _excluded);
var getEnvironmentProps = function getEnvironmentProps(providedProps) {
var inputElement = providedProps.inputElement,
formElement = providedProps.formElement,
panelElement = providedProps.panelElement,
rest = _objectWithoutProperties(providedProps, _excluded2);
function onMouseDownOrTouchStart(event) {
// The `onTouchStart`/`onMouseDown` events shouldn't trigger the `blur`
// handler when it's not an interaction with Autocomplete.
// We detect it with the following heuristics:
// - the panel is closed AND there are no pending requests
// (no interaction with the autocomplete, no future state updates)
// - OR the touched target is the input element (should open the panel)
var isAutocompleteInteraction = store.getState().isOpen || !store.pendingRequests.isEmpty();
if (!isAutocompleteInteraction || event.target === inputElement) {
return;
}
// @TODO: support cases where there are multiple Autocomplete instances.
// Right now, a second instance makes this computation return false.
var isTargetWithinAutocomplete = [formElement, panelElement].some(function (contextNode) {
return isOrContainsNode(contextNode, event.target);
});
if (isTargetWithinAutocomplete === false) {
store.dispatch('blur', null);
// If requests are still pending when the user closes the panel, they
// could reopen the panel once they resolve.
// We want to prevent any subsequent query from reopening the panel
// because it would result in an unsolicited UI behavior.
if (!props.debug) {
store.pendingRequests.cancelAll();
}
}
}
return _objectSpread({
// We do not rely on the native `blur` event of the input to close the
// panel, but rather on a custom `touchstart`/`mousedown` event outside
// of the autocomplete elements.
// This ensures we don't mistakenly interpret interactions within the
// autocomplete (but outside of the input) as a signal to close the panel.
// For example, clicking reset button causes an input blur, but if
// `openOnFocus=true`, it shouldn't close the panel.
// On touch devices, scrolling results (`touchmove`) causes an input blur
// but shouldn't close the panel.
onTouchStart: onMouseDownOrTouchStart,
onMouseDown: onMouseDownOrTouchStart,
// When scrolling on touch devices (mobiles, tablets, etc.), we want to
// mimic the native platform behavior where the input is blurred to
// hide the virtual keyboard. This gives more vertical space to
// discover all the suggestions showing up in the panel.
onTouchMove: function onTouchMove(event) {
if (store.getState().isOpen === false || inputElement !== props.environment.document.activeElement || event.target === inputElement) {
return;
}
inputElement.blur();
}
}, rest);
};
var getRootProps = function getRootProps(rest) {
return _objectSpread({
role: 'combobox',
'aria-expanded': store.getState().isOpen,
'aria-haspopup': 'listbox',
'aria-controls': store.getState().isOpen ? store.getState().collections.map(function (_ref2) {
var source = _ref2.source;
return getAutocompleteElementId(props.id, 'list', source);
}).join(' ') : undefined,
'aria-labelledby': getAutocompleteElementId(props.id, 'label')
}, rest);
};
var getFormProps = function getFormProps(providedProps) {
var inputElement = providedProps.inputElement,
rest = _objectWithoutProperties(providedProps, _excluded3);
return _objectSpread({
action: '',
noValidate: true,
role: 'search',
onSubmit: function onSubmit(event) {
var _providedProps$inputE;
event.preventDefault();
props.onSubmit(_objectSpread({
event: event,
refresh: refresh,
state: store.getState()
}, setters));
store.dispatch('submit', null);
(_providedProps$inputE = providedProps.inputElement) === null || _providedProps$inputE === void 0 ? void 0 : _providedProps$inputE.blur();
},
onReset: function onReset(event) {
var _providedProps$inputE2;
event.preventDefault();
props.onReset(_objectSpread({
event: event,
refresh: refresh,
state: store.getState()
}, setters));
store.dispatch('reset', null);
(_providedProps$inputE2 = providedProps.inputElement) === null || _providedProps$inputE2 === void 0 ? void 0 : _providedProps$inputE2.focus();
}
}, rest);
};
var getInputProps = function getInputProps(providedProps) {
var _props$environment$na;
function onFocus(event) {
// We want to trigger a query when `openOnFocus` is true
// because the panel should open with the current query.
if (props.openOnFocus || Boolean(store.getState().query)) {
onInput(_objectSpread({
event: event,
props: props,
query: store.getState().completion || store.getState().query,
refresh: refresh,
store: store
}, setters));
}
store.dispatch('focus', null);
}
var _ref3 = providedProps || {},
inputElement = _ref3.inputElement,
_ref3$maxLength = _ref3.maxLength,
maxLength = _ref3$maxLength === void 0 ? 512 : _ref3$maxLength,
rest = _objectWithoutProperties(_ref3, _excluded4);
var activeItem = getActiveItem(store.getState());
var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
var shouldFallbackKeyHint = isSamsung(userAgent);
var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search');
return _objectSpread({
'aria-autocomplete': 'both',
'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? getAutocompleteElementId(props.id, "item-".concat(store.getState().activeItemId), activeItem === null || activeItem === void 0 ? void 0 : activeItem.source) : undefined,
'aria-controls': store.getState().isOpen ? store.getState().collections.map(function (_ref4) {
var source = _ref4.source;
return getAutocompleteElementId(props.id, 'list', source);
}).join(' ') : undefined,
'aria-labelledby': getAutocompleteElementId(props.id, 'label'),
value: store.getState().completion || store.getState().query,
id: getAutocompleteElementId(props.id, 'input'),
autoComplete: 'off',
autoCorrect: 'off',
autoCapitalize: 'off',
enterKeyHint: enterKeyHint,
spellCheck: 'false',
autoFocus: props.autoFocus,
placeholder: props.placeholder,
maxLength: maxLength,
type: 'search',
onChange: function onChange(event) {
var value = event.currentTarget.value;
if (props.ignoreCompositionEvents && getNativeEvent(event).isComposing) {
setters.setQuery(value);
return;
}
onInput(_objectSpread({
event: event,
props: props,
query: value.slice(0, maxLength),
refresh: refresh,
store: store
}, setters));
},
onCompositionEnd: function onCompositionEnd(event) {
onInput(_objectSpread({
event: event,
props: props,
query: event.currentTarget.value.slice(0, maxLength),
refresh: refresh,
store: store
}, setters));
},
onKeyDown: function onKeyDown(event) {
if (getNativeEvent(event).isComposing) {
return;
}
_onKeyDown(_objectSpread({
event: event,
props: props,
refresh: refresh,
store: store
}, setters));
},
onFocus: onFocus,
// We don't rely on the `blur` event.
// See explanation in `onTouchStart`/`onMouseDown`.
// @MAJOR See if we need to keep this handler.
onBlur: noop,
onClick: function onClick(event) {
// When the panel is closed and you click on the input while
// the input is focused, the `onFocus` event is not triggered
// (default browser behavior).
// In an autocomplete context, it makes sense to open the panel in this
// case.
// We mimic this event by catching the `onClick` event which
// triggers the `onFocus` for the panel to open.
if (providedProps.inputElement === props.environment.document.activeElement && !store.getState().isOpen) {
onFocus(event);
}
}
}, rest);
};
var getLabelProps = function getLabelProps(rest) {
return _objectSpread({
htmlFor: getAutocompleteElementId(props.id, 'input'),
id: getAutocompleteElementId(props.id, 'label')
}, rest);
};
var getListProps = function getListProps(providedProps) {
var _ref5 = providedProps || {},
source = _ref5.source,
rest = _objectWithoutProperties(_ref5, _excluded5);
return _objectSpread({
role: 'listbox',
'aria-labelledby': getAutocompleteElementId(props.id, 'label'),
id: getAutocompleteElementId(props.id, 'list', source)
}, rest);
};
var getPanelProps = function getPanelProps(rest) {
return _objectSpread({
onMouseDown: function onMouseDown(event) {
// Prevents the `activeElement` from being changed to the panel so
// that the blur event is not triggered, otherwise it closes the
// panel.
event.preventDefault();
},
onMouseLeave: function onMouseLeave() {
store.dispatch('mouseleave', null);
}
}, rest);
};
var getItemProps = function getItemProps(providedProps) {
var item = providedProps.item,
source = providedProps.source,
rest = _objectWithoutProperties(providedProps, _excluded6);
return _objectSpread({
id: getAutocompleteElementId(props.id, "item-".concat(item.__autocomplete_id), source),
role: 'option',
'aria-selected': store.getState().activeItemId === item.__autocomplete_id,
onMouseMove: function onMouseMove(event) {
if (item.__autocomplete_id === store.getState().activeItemId) {
return;
}
store.dispatch('mousemove', item.__autocomplete_id);
var activeItem = getActiveItem(store.getState());
if (store.getState().activeItemId !== null && activeItem) {
var _item = activeItem.item,
itemInputValue = activeItem.itemInputValue,
itemUrl = activeItem.itemUrl,
_source = activeItem.source;
_source.onActive(_objectSpread({
event: event,
item: _item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: _source,
state: store.getState()
}, setters));
}
},
onMouseDown: function onMouseDown(event) {
// Prevents the `activeElement` from being changed to the item so it
// can remain with the current `activeElement`.
event.preventDefault();
},
onClick: function onClick(event) {
var itemInputValue = source.getItemInputValue({
item: item,
state: store.getState()
});
var itemUrl = source.getItemUrl({
item: item,
state: store.getState()
});
// If `getItemUrl` is provided, it means that the suggestion
// is a link, not plain text that aims at updating the query.
// We can therefore skip the state change because it will update
// the `activeItemId`, resulting in a UI flash, especially
// noticeable on mobile.
var runPreCommand = itemUrl ? Promise.resolve() : onInput(_objectSpread({
event: event,
nextState: {
isOpen: false
},
props: props,
query: itemInputValue,
refresh: refresh,
store: store
}, setters));
runPreCommand.then(function () {
source.onSelect(_objectSpread({
event: event,
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: source,
state: store.getState()
}, setters));
});
}
}, rest);
};
return {
getEnvironmentProps: getEnvironmentProps,
getRootProps: getRootProps,
getFormProps: getFormProps,
getLabelProps: getLabelProps,
getInputProps: getInputProps,
getPanelProps: getPanelProps,
getListProps: getListProps,
getItemProps: getItemProps
};
}

View File

@@ -1,3 +0,0 @@
export * from './createAutocomplete';
export * from './getDefaultProps';
export * from './types';

View File

@@ -1,3 +0,0 @@
export * from './createAutocomplete';
export * from './getDefaultProps';
export * from './types';

View File

@@ -1,33 +0,0 @@
import { UserAgent } from '@algolia/autocomplete-shared';
import { AutocompleteEnvironment, AutocompleteOptionsWithMetadata, AutocompletePlugin, BaseItem } from '.';
declare type AutocompleteMetadata = {
plugins: Array<{
name: string | undefined;
options: string[];
}>;
options: Record<string, string[]>;
ua: UserAgent[];
};
declare type GetMetadataParams<TItem extends BaseItem, TData = unknown> = {
plugins: Array<AutocompletePlugin<TItem, TData>>;
options: AutocompleteOptionsWithMetadata<TItem>;
};
export declare function getMetadata<TItem extends BaseItem, TData = unknown>({ plugins, options, }: GetMetadataParams<TItem, TData>): {
plugins: {
name: string | undefined;
options: string[];
}[];
options: {
'autocomplete-core': string[];
};
ua: {
segment: string;
version: string;
}[];
};
declare type InlineMetadataParams = {
metadata: AutocompleteMetadata;
environment: AutocompleteEnvironment;
};
export declare function injectMetadata({ metadata, environment, }: InlineMetadataParams): void;
export {};

View File

@@ -1,41 +0,0 @@
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { userAgents } from '@algolia/autocomplete-shared';
export function getMetadata(_ref) {
var _, _options$__autocomple, _options$__autocomple2, _options$__autocomple3;
var plugins = _ref.plugins,
options = _ref.options;
var optionsKey = (_ = (((_options$__autocomple = options.__autocomplete_metadata) === null || _options$__autocomple === void 0 ? void 0 : _options$__autocomple.userAgents) || [])[0]) === null || _ === void 0 ? void 0 : _.segment;
var extraOptions = optionsKey ? _defineProperty({}, optionsKey, Object.keys(((_options$__autocomple2 = options.__autocomplete_metadata) === null || _options$__autocomple2 === void 0 ? void 0 : _options$__autocomple2.options) || {})) : {};
return {
plugins: plugins.map(function (plugin) {
return {
name: plugin.name,
options: Object.keys(plugin.__autocomplete_pluginOptions || [])
};
}),
options: _objectSpread({
'autocomplete-core': Object.keys(options)
}, extraOptions),
ua: userAgents.concat(((_options$__autocomple3 = options.__autocomplete_metadata) === null || _options$__autocomple3 === void 0 ? void 0 : _options$__autocomple3.userAgents) || [])
};
}
export function injectMetadata(_ref3) {
var _environment$navigato, _environment$navigato2;
var metadata = _ref3.metadata,
environment = _ref3.environment;
var isMetadataEnabled = (_environment$navigato = environment.navigator) === null || _environment$navigato === void 0 ? void 0 : (_environment$navigato2 = _environment$navigato.userAgent) === null || _environment$navigato2 === void 0 ? void 0 : _environment$navigato2.includes('Algolia Crawler');
if (isMetadataEnabled) {
var metadataContainer = environment.document.createElement('meta');
var headRef = environment.document.querySelector('head');
metadataContainer.name = 'algolia:metadata';
setTimeout(function () {
metadataContainer.content = JSON.stringify(metadata);
headRef.appendChild(metadataContainer);
}, 0);
}
}

Some files were not shown because too many files have changed in this diff Show More