@inploi/sdk 2.3.1 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sdk.logger.ts","../src/sdk.plugins.ts","../../core/src/common/common.utils.ts","../../core/src/common/common.currency.ts","../../core/src/common/common.datetime.ts","../src/sdk.api.ts","../package.json","../src/sdk.constants.ts","../src/sdk.uuid.ts","../src/sdk.analytics.ts","../src/sdk.rpc.ts","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/enums.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/pagination.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/candidate.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/application.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/_shared.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/interview.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/http/identify.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/http/applications.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/http/candidates.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_10df75439917e0ceb329c65a7cbdd4a8/node_modules/@inploi/talent-bank/dist/contract/http/metrics.js","../src/sdk.talent-bank.ts","../src/sdk.ts","../src/sdk.consent.ts","../src/ready.ts"],"sourcesContent":["export const CONSOLE_PREFIX = '%c[inploi SDK]';\nexport const CONSOLE_STYLE = 'color: #65BC67; font-weight: bold;';\n\ntype LogMessage = (...data: any[]) => void;\nexport type Logger = {\n\twarn: LogMessage;\n\terror: LogMessage;\n\tinfo: LogMessage;\n\tlog: LogMessage;\n};\n\nexport const inploiBrandedLogger: Logger = {\n\twarn: (...args) => console.warn(CONSOLE_PREFIX, CONSOLE_STYLE, ...args),\n\terror: (...args) => console.error(CONSOLE_PREFIX, CONSOLE_STYLE, ...args),\n\tinfo: (...args) => console.info(CONSOLE_PREFIX, CONSOLE_STYLE, ...args),\n\tlog: (...args) => console.log(CONSOLE_PREFIX, CONSOLE_STYLE, ...args),\n};\n\nexport const noLogging: Logger = { info: () => void 0, error: () => void 0, log: () => void 0, warn: () => void 0 };\n","import { AnalyticsService } from './sdk.analytics';\nimport { ApiClient } from './sdk.api';\nimport { InploiSdkEnvironment } from './sdk.constants';\nimport { Logger } from './sdk.logger';\nimport { InploiRpcClient } from './sdk.rpc';\n\nexport type PluginParams = {\n\tapiClient: ApiClient;\n\tlogger: Logger;\n};\n\nexport type Plugin<T extends string, P extends Record<string, unknown>> = {\n\tpluginName: T;\n\tpure_createActions: (params: PluginParams) => P;\n};\n\ntype PluginDependencies = {\n\tapiClient: ApiClient;\n\trpcClient: InploiRpcClient;\n\tlogger: Logger;\n\tanalytics: AnalyticsService;\n\t/** The publishable key used to initialise the SDK (available when registered via initialiseSdk) */\n\tpublishableKey?: string;\n\t/** The environment the SDK was initialised with — plugins can use this to select the correct service URL */\n\tenv?: InploiSdkEnvironment;\n};\n\nexport type InploiSdkPlugin = (dependencies: PluginDependencies) => any;\n\nexport const createPlugin = <T extends InploiSdkPlugin>(pluginFn: T) => pluginFn;\n","export const exhaustive = (value: never) => {\n\tthrow new Error(`Unhandled discriminated union member: ${JSON.stringify(value)}`);\n};\n\nexport function invariant(condition: any, message?: string): asserts condition {\n\tif (condition) {\n\t\treturn;\n\t}\n\n\tthrow new Error(message);\n}\n\nexport const uniqueOrThrow = <T>(array: T[]) => {\n\tconst uniqueValues = new Set(array);\n\n\tif (array.length !== uniqueValues.size) {\n\t\tthrow new Error('Duplicate values found');\n\t}\n\treturn true;\n};\n\nexport const uniqueByPropertyOrThrow =\n\t<T extends PropertyKey>(propertyKey: T) =>\n\t(array: { [K in T]: any }[]) => {\n\t\tconst values = array.map(item => item[propertyKey]);\n\t\tconst uniqueValues = new Set(values);\n\n\t\tif (values.length !== uniqueValues.size) {\n\t\t\tthrow new Error(`Duplicate values found for property: ${propertyKey.toString()}`);\n\t\t}\n\t\treturn true;\n\t};\n\n/**\n * A destructive way to ensure an object has a property.\n * This is useful when working with unknowns.\n */\nexport function hasProp<K extends PropertyKey>(data: object, prop: K): data is Record<K, unknown> {\n\treturn prop in data;\n}\n\n/**\n * A sort of type-safe way to check whether a key exists in an object.\n */\nexport function isKeyInObj<O extends Record<string, unknown>>(key: PropertyKey, obj: O): key is keyof O {\n\treturn key in obj;\n}\n","type TFunction = (key: 'competitive' | 'invalid_salary' | 'from' | 'up_to') => string;\n\ninterface SalaryParams {\n\tpay: string | null;\n\tpay_min: string | null;\n\tpay_mask: boolean;\n\tpay_max: string | null;\n\tpay_type: 'ANNUALLY' | 'HOURLY' | 'MONTHLY' | 'WEEKLY' | 'DAILY' | null;\n\tpay_currency: string;\n\tpay_display: boolean;\n}\n\nconst payPeriods: Record<NonNullable<SalaryParams['pay_type']>, string> = {\n\tANNUALLY: 'per year',\n\tDAILY: 'per day',\n\tHOURLY: 'per hour',\n\tMONTHLY: 'per month',\n\tWEEKLY: 'per week',\n};\n\nexport const getSalaryAsText = (params: {\n\tsalary: SalaryParams;\n\tconfig: { locales: string | string[] | undefined };\n\tt?: TFunction;\n}) => {\n\tconst { salary, config, t = s => s } = params;\n\tconst numberFormatter = new Intl.NumberFormat(config.locales, {\n\t\tstyle: 'currency',\n\t\tcurrency: salary.pay_currency,\n\t\ttrailingZeroDisplay: 'stripIfInteger',\n\t});\n\tif (salary.pay_display === false) return undefined;\n\tif (salary.pay === null && salary.pay_min === null && salary.pay_max === null) return undefined;\n\tif (salary.pay_mask) return t('competitive');\n\n\tif (salary.pay_max && Number.isNaN(+salary.pay_max)) return t('invalid_salary');\n\tif (salary.pay_min && Number.isNaN(+salary.pay_min)) return t('invalid_salary');\n\tif (salary.pay && Number.isNaN(+salary.pay)) return t('invalid_salary');\n\n\tconst period = salary.pay_type && salary.pay_type in payPeriods ? payPeriods[salary.pay_type] : undefined;\n\n\tif (salary.pay) return [numberFormatter.format(+salary.pay), period].filter(Boolean).join(' ');\n\n\tif (salary.pay_max && salary.pay_min)\n\t\treturn [numberFormatter.formatRange(+salary.pay_min, +salary.pay_max), period].filter(Boolean).join(' ') || '';\n\n\tif (salary.pay_max)\n\t\treturn `${t('up_to')} ${[numberFormatter.format(+salary.pay_max), period].filter(Boolean).join(' ')}`;\n\tif (salary.pay_min)\n\t\treturn `${t('from')} ${[numberFormatter.format(+salary.pay_min), period].filter(Boolean).join(' ')}`;\n\treturn t('invalid_salary');\n};\n","type TFunction = (key: 'today' | 'over_30_days_ago' | 'in_over_30_days') => string;\n\ntype Params = {\n\tfrom?: Date;\n\tto: string | number | Date;\n\tformatter?: Intl.RelativeTimeFormat;\n\tt?: TFunction;\n};\n\nconst DEFAULT_FORMATTER = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });\n/** From a date, calculates the relative time difference from now */\nexport const getRelativeTimeDifference = ({\n\tfrom = new Date(),\n\tto,\n\tformatter = DEFAULT_FORMATTER,\n\tt = s => s,\n}: Params) => {\n\tconst then = to instanceof Date ? to : new Date(to);\n\tconst diff = then.getTime() - from.getTime();\n\n\tconst diffIn = {\n\t\tdays: Math.round(diff / 1000 / 60 / 60 / 24),\n\t\tmonths: Math.round(diff / 1000 / 60 / 60 / 24 / 30),\n\t};\n\n\tif (diffIn.days === 0) return t('today');\n\tif (Math.abs(diffIn.days) < 30) return formatter.format(diffIn.days, 'days');\n\tif (Math.abs(diffIn.days) < 3) return formatter.format(diffIn.months, 'months');\n\treturn diffIn.months < 0 ? t('over_30_days_ago') : t('in_over_30_days');\n};\n","import { hasProp } from '@inploi/core/common';\nimport { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport const unauthenticatedMessage = 'Unauthenticated';\nexport const unauthorisedMessage = 'This action is unauthorized.';\n\nexport class ErrorWithStatus extends Error {\n\tpublic status?: number;\n\tconstructor(message?: string, status?: number) {\n\t\tsuper(message);\n\t\tthis.status = status;\n\t\tthis.name = 'ErrorWithStatus';\n\t}\n}\n\nexport class NotFoundError extends ErrorWithStatus {\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Not found');\n\t\tthis.name = 'NotFoundError';\n\t\tthis.status = 404;\n\t}\n}\n\nexport class UnauthorisedError extends ErrorWithStatus {\n\tconstructor(message?: string, status?: number) {\n\t\tsuper(message ?? 'You are not authorised to perform this action.');\n\t\tthis.name = 'UnauthorisedError';\n\t\tthis.status = status ?? 401;\n\t}\n}\n\nexport class SchemaValidationError extends ErrorWithStatus {\n\tconstructor(\n\t\tpublic issues: readonly StandardSchemaV1.Issue[],\n\t\tpublic source?: 'body' | 'searchParams' | 'response',\n\t) {\n\t\tconst sourceText = source ? ` in ${source}` : '';\n\t\tsuper(`Schema validation failed${sourceText}`);\n\t\tthis.name = 'SchemaValidationError';\n\t\tthis.status = 400;\n\t}\n}\n\nexport class ApiError extends ErrorWithStatus {\n\tconstructor(\n\t\tmessage: string,\n\t\tstatus?: number,\n\t\tpublic data?: unknown,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'ApiError';\n\t\tthis.status = status ?? 500;\n\t}\n}\n\nexport const isApiErrorWithData = (error: unknown): error is ApiError & { data: unknown } =>\n\terror instanceof ApiError && error.data !== undefined;\n\nexport class JsonParsingError extends ErrorWithStatus {\n\tpublic contentType?: string;\n\n\tconstructor(public response?: Response) {\n\t\tsuper('Error parsing response into JSON.');\n\t\tthis.name = 'ParsingError';\n\t\tthis.status = response && response.status >= 300 ? response.status : 500;\n\t\tthis.contentType = new Headers(response?.headers).get('content-type') ?? undefined;\n\t}\n}\n\n/** @deprecated - use `JsonParsingError` instead */\nexport class ParsingError extends JsonParsingError {}\n\nexport type ApiClient = {\n\tfetch: (pathname: string, options?: RequestInit) => Promise<unknown>;\n};\n\nexport async function parseJsonResponse(response: Response): Promise<unknown> {\n\tconst contentType = new Headers(response.headers).get('content-type');\n\tconst mediaType = contentType?.replace(/;.*/, '').trim().toLowerCase();\n\tif (mediaType && mediaType !== 'application/json' && !mediaType.endsWith('+json')) {\n\t\tthrow new JsonParsingError(response);\n\t}\n\n\treturn response.json().catch(() => {\n\t\tthrow new JsonParsingError(response);\n\t});\n}\n\nconst ERROR_MESSAGE_KEYS = ['message', 'error', 'errors', 'exception', 'exceptions'] as const;\nfunction getErrorMessageFromJson(json: unknown): string {\n\tconst messages: string[] = [];\n\tif (typeof json === 'object' && json !== null) {\n\t\tfor (const key of ERROR_MESSAGE_KEYS) {\n\t\t\tif (hasProp(json, key)) {\n\t\t\t\tconst value = json[key];\n\t\t\t\tif (typeof value === 'string') messages.push(value);\n\t\t\t\tif (Array.isArray(value) && value.every((item): item is string => typeof item === 'string'))\n\t\t\t\t\tmessages.push(...value);\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\thasProp(json, 'integration_response') &&\n\t\t\ttypeof json.integration_response === 'object' &&\n\t\t\tjson.integration_response !== null &&\n\t\t\thasProp(json.integration_response, 'error') &&\n\t\t\ttypeof json.integration_response.error === 'object' &&\n\t\t\tjson.integration_response.error !== null &&\n\t\t\thasProp(json.integration_response.error, 'message') &&\n\t\t\ttypeof json.integration_response.error.message === 'string'\n\t\t) {\n\t\t\tmessages.push(json.integration_response.error.message);\n\t\t}\n\t}\n\tif (messages.length === 0) messages.push('Unknown error');\n\treturn [...new Set(messages)].join(', ');\n}\n\n/** Throws branded errors when API returns a known error. */\nexport function handleApiExceptions(json: unknown, status: number) {\n\tif (status >= 300) {\n\t\tconst message = getErrorMessageFromJson(json);\n\t\tif (status === 404) {\n\t\t\tthrow new NotFoundError(message);\n\t\t}\n\t\tif (message === unauthenticatedMessage) {\n\t\t\tthrow new UnauthorisedError('You are not authenticated.', status);\n\t\t}\n\t\tif (message === unauthorisedMessage) {\n\t\t\tthrow new UnauthorisedError(message, status);\n\t\t}\n\t\tthrow new ApiError(message, status, json);\n\t}\n}\n\nexport const createApiClient = (params: { baseUrl: string; publishableKey: string }): ApiClient => {\n\tconst defaultHeaders: HeadersInit = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t\t'x-publishable-key': params.publishableKey,\n\t};\n\n\treturn {\n\t\t/** Fetches from a pathname with a pre-established base path.\n\t\t * Parses received output as JSON, and throw if one of the common error messages is received.\n\t\t */\n\t\tfetch: async (pathname, options = {}) => {\n\t\t\tconst init = { ...options, headers: { ...options.headers, ...defaultHeaders } };\n\t\t\tconst response = await fetch(`${params.baseUrl}${pathname}`, init);\n\t\t\tif (response.status === 404) throw new NotFoundError();\n\n\t\t\tconst json = await parseJsonResponse(response);\n\n\t\t\thandleApiExceptions(json, response.status);\n\n\t\t\t// We’re assuming no other exceptions have happened.\n\t\t\treturn json;\n\t\t},\n\t};\n};\n\nexport const SdkError = {\n\tNotFound: NotFoundError,\n\tUnauthorised: UnauthorisedError,\n\tSchemaValidation: SchemaValidationError,\n\tApi: ApiError,\n\tJsonParsing: JsonParsingError,\n};\n\nexport function isSdkError(error: unknown): error is (typeof SdkError)[keyof typeof SdkError] {\n\treturn Object.values(SdkError).some(ErrorClass => error instanceof ErrorClass);\n}\n","{\n\t\"name\": \"@inploi/sdk\",\n\t\"version\": \"2.3.1\",\n\t\"main\": \"dist/index.js\",\n\t\"types\": \"dist/index.d.ts\",\n\t\"license\": \"MIT\",\n\t\"files\": [\n\t\t\"/dist\",\n\t\t\"/cdn\"\n\t],\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"require\": \"./dist/index.js\",\n\t\t\t\"import\": \"./dist/index.mjs\",\n\t\t\t\"types\": \"./dist/index.d.ts\"\n\t\t}\n\t},\n\t\"scripts\": {\n\t\t\"build:npm\": \"tsup --dts --dts-resolve && node scripts/check-npm-bundle.mjs\",\n\t\t\"build:cdn\": \"tsup --config tsup.cdn.config.ts\",\n\t\t\"build\": \"concurrently 'pnpm run build:npm' 'pnpm run build:cdn'\",\n\t\t\"dev\": \"tsup --watch --config tsup.cdn.config.ts\",\n\t\t\"check\": \"eslint src --fix --max-warnings 0 && tsc\",\n\t\t\"test\": \"bun test\",\n\t\t\"test:coverage\": \"bun test --coverage --coverage-reporter=lcov\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@happy-dom/global-registrator\": \"^13.6.2\",\n\t\t\"@inploi/core\": \"workspace:*\",\n\t\t\"@inploi/talent-bank\": \"github:inploi/talent-bank#e587d4a8a0f9ebf12e24393b3d917bf095ddf908\",\n\t\t\"@total-typescript/ts-reset\": \"^0.5.1\",\n\t\t\"@types/bun\": \"^1.2.5\",\n\t\t\"@types/react\": \"^18.2.33\",\n\t\t\"@types/react-dom\": \"^18.2.14\",\n\t\t\"autoprefixer\": \"^10.4.16\",\n\t\t\"concurrently\": \"9.1.2\",\n\t\t\"eslint\": \"^7.32.0\",\n\t\t\"eslint-config-custom\": \"workspace:*\",\n\t\t\"happy-dom\": \"^12.6.0\",\n\t\t\"ts-toolbelt\": \"^9.6.0\",\n\t\t\"tsconfig\": \"workspace:*\",\n\t\t\"tsup\": \"^7.2.0\"\n\t},\n\t\"dependencies\": {\n\t\t\"@standard-schema/spec\": \"^1.0.0\",\n\t\t\"neoqs\": \"^6.13.0\",\n\t\t\"valibot\": \"^1.3.1\"\n\t}\n}\n","import { version } from '../package.json';\n\n/**\n * The environment the SDK should run in.\n * - `production`: data will be stored and displayed on dashboards\n * - `sandbox`: data will be stored temporarily and purged periodically\n */\nexport type InploiSdkEnvironment = 'production' | 'sandbox';\n\nexport const ENV_TO_API_URL: Record<InploiSdkEnvironment, string> = {\n\tsandbox: 'https://api.staging.inploi.com',\n\tproduction: 'https://api.inploi.com',\n\t// @ts-expect-error - local test environment\n\t_internal_local: 'http://api.test',\n};\n\nexport const ENV_TO_TALENT_BANK_URL: Record<InploiSdkEnvironment, string> = {\n\tsandbox: 'https://talent-bank.staging.inploi.com',\n\tproduction: 'https://talent-bank.inploi.com',\n\t// @ts-expect-error - local test environment\n\t_internal_local: 'http://localhost:8787',\n};\n\nexport const ANALYTICS_VERSION = version;\n\nexport const LOG_PATHNAME = '/log';\n\nexport const ANALYTICS_COOKIE_NAME = 'isdk_session';\n\n/**\n * Local-storage key used to persist the Talent Bank `candidateId` once the\n * user has identified via the SDK. The SDK forwards this id on every\n * subsequent analytics log request so Laravel can stamp it onto the session.\n */\nexport const ANALYTICS_CANDIDATE_ID_STORAGE_KEY = `${ANALYTICS_COOKIE_NAME}-candidate_id`;\n\n/**\n * Local-storage key prefix for the candidate's consent / approval state\n * (PROD-5763). The final key is composed of:\n *\n * `${CONSENT_STORAGE_KEY_PREFIX}:<publishableKey>:<configHash>`\n *\n * The `configHash` is a deterministic hash of the consent message +\n * labels. Any material wording change produces a new hash → new\n * storage key → candidate is automatically re-prompted, without the\n * customer having to manage a `version` field manually.\n *\n * Per-tenant scoping (the `publishableKey` segment) matters because\n * the consent UI runs inside the Kin iframe at `sdk.inploi.com`, so\n * one origin's localStorage is shared across every tenant a candidate\n * has visited from this browser.\n */\nexport const CONSENT_STORAGE_KEY_PREFIX = `${ANALYTICS_COOKIE_NAME}-consent`;\n","/**\n * Generates a RFC 4122 v4 UUID.\n *\n * `crypto.randomUUID()` is only available in secure contexts (HTTPS). This\n * utility falls back to `crypto.getRandomValues`, which is available in all\n * browsing contexts including HTTP, so the SDK works on non-HTTPS staging\n * environments.\n */\nexport const generateUUID = (): `${string}-${string}-${string}-${string}-${string}` => {\n\tif (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n\t\treturn crypto.randomUUID();\n\t}\n\n\treturn '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, c =>\n\t\t(+c ^ (crypto.getRandomValues(new Uint8Array(1))[0]! & (15 >> (+c / 4)))).toString(16),\n\t) as `${string}-${string}-${string}-${string}-${string}`;\n};\n","import type { ResponseObj } from '@inploi/core/common';\nimport { invariant } from '@inploi/core/common';\n\nimport { InploiRpcClient, Logger, endpoint, typed } from '.';\nimport {\n\tANALYTICS_CANDIDATE_ID_STORAGE_KEY,\n\tANALYTICS_COOKIE_NAME,\n\tANALYTICS_VERSION,\n} from './sdk.constants';\nimport type { TalentBankClient } from './sdk.talent-bank';\nimport { generateUUID } from './sdk.uuid';\n\nconst formatCookie = (value: string) => {\n\tconst now = new Date();\n\tnow.setTime(now.getTime() + 7 * 24 * 60 * 60 * 1000); // 7 days expiration\n\n\treturn `${ANALYTICS_COOKIE_NAME}=${value};expires=${now.toUTCString()};path=/`;\n};\n\ntype FlowProperties = { flow_id: string; flow_version: number; flow_session_id: string; flow_build: number };\n\nexport type FlowType = 'CHATBOT_DRAWER' | 'FORM_DRAWER' | 'FORM_EMBED';\n\ntype FunnelFlowProperties = FlowProperties & { flow_type?: FlowType };\n\ntype JobProperties = {\n\tid: string;\n\tid_type: 'internal' | 'external';\n};\n\nexport type AnalyticsLogParams =\n\t| {\n\t\t\tevent: 'VIEW_JOB';\n\t\t\tproperties: { job: JobProperties };\n\t }\n\t| {\n\t\t\tevent: 'FLOW_REDIRECT';\n\t\t\tproperties: { href: string; job: JobProperties | undefined } & FlowProperties;\n\t }\n\t| {\n\t\t\tevent: 'FLOW_START' | 'FLOW_INTERACT';\n\t\t\tproperties: { job: JobProperties | undefined } & FunnelFlowProperties;\n\t }\n\t| {\n\t\t\tevent: 'FLOW_END';\n\t\t\tproperties: { job: JobProperties | undefined } & FlowProperties;\n\t }\n\t| {\n\t\t\tevent: 'FLOW_SUBMIT';\n\t\t\tproperties: {\n\t\t\t\tservice: string;\n\t\t\t\tresponse: {\n\t\t\t\t\tstatus: number;\n\t\t\t\t\tpayload: unknown;\n\t\t\t\t};\n\t\t\t\tjob: JobProperties | undefined;\n\t\t\t\t/**\n\t\t\t\t * Set when the provider confirmed a duplicate (distinguishing one within an hour of the candidate's own\n\t\t\t\t * failed attempt on that application), or when the API accepted the application for later delivery (`pending`).\n\t\t\t\t */\n\t\t\t\toutcome?: 'duplicate' | 'duplicate_after_own_attempt' | 'pending';\n\t\t\t} & FunnelFlowProperties;\n\t }\n\t| {\n\t\t\tevent: 'SUBMIT_FORM' | 'VIEW_PAGE';\n\t\t\tproperties?: {\n\t\t\t\tjob: JobProperties | undefined;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'IDENTIFY';\n\t\t\tproperties: {\n\t\t\t\tidentifier: string;\n\t\t\t\tfirst_name?: string;\n\t\t\t\tlast_name?: string;\n\t\t\t\tphone_number?: string;\n\t\t\t\temail?: string;\n\t\t\t\tcustom_traits?: Record<string, unknown>;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'SEARCH_PAGINATE';\n\t\t\tproperties: {\n\t\t\t\tquery?: string;\n\t\t\t\tfilters?: Record<string, string[]>;\n\t\t\t\tdefault_filters?: Record<string, string[]>;\n\t\t\t\ttotal_count: number;\n\t\t\t\tpage_size: number;\n\t\t\t\tpage: number;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'SEARCH_SETTLE';\n\t\t\tproperties: {\n\t\t\t\tquery?: string;\n\t\t\t\tfilters?: Record<string, string[]>;\n\t\t\t\tdefault_filters?: Record<string, string[]>;\n\t\t\t\ttotal_count: number;\n\t\t\t\tpage_size: number;\n\t\t\t\tpage: number;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'SEARCH_JOB_CLICK';\n\t\t\tproperties: {\n\t\t\t\tjob_id: number;\n\t\t\t\tquery?: string;\n\t\t\t\tfilters?: Record<string, string[]>;\n\t\t\t\tdefault_filters?: Record<string, string[]>;\n\t\t\t\ttotal_count: number;\n\t\t\t\tpage_size: number;\n\t\t\t\tpage: number;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'VIEW_SEARCH';\n\t\t\tproperties: {\n\t\t\t\tquery?: string;\n\t\t\t\tfilters?: Record<string, string[]>;\n\t\t\t\tdefault_filters?: Record<string, string[]>;\n\t\t\t\ttotal_count: number;\n\t\t\t\tpage_size: number;\n\t\t\t\tpage: number;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'FEEDBACK';\n\t\t\tproperties: {\n\t\t\t\tkey: string;\n\t\t\t\tscore?: -1 | 0 | 1;\n\t\t\t\tcomment?: string;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'LINK_CLICK';\n\t\t\tproperties: {\n\t\t\t\ttarget_href: string;\n\t\t\t\tjob_id: string | undefined;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'INTERACTION';\n\t\t\tproperties: {\n\t\t\t\ttag: string;\n\t\t\t};\n\t };\n\nexport type AnalyticsLogEvent = AnalyticsLogParams['event'];\n\ntype EventPropertyMap = {\n\t[Param in AnalyticsLogParams as Param['event']]: Omit<Param, 'event'>;\n};\n\ntype AnalyticsContext = {\n\tlibrary: {\n\t\tname: 'inploi-sdk';\n\t\tversion: string;\n\t};\n\tpage: {\n\t\thref: string;\n\t\treferrer: string;\n\t\ttitle: string;\n\t};\n};\n\ntype TrackPayload<P = EventPropertyMap[keyof EventPropertyMap]['properties']> = {\n\tanonymous_id: string | null;\n\tsession_id: string | null;\n\t/**\n\t * Talent Bank candidate id — set once the SDK has identified the user\n\t * (via `TalentBankClient.identify`). Laravel's session middleware reads\n\t * this and stamps it onto `session.context.candidate_id` for attribution.\n\t * `null` for anonymous / unidentified users.\n\t */\n\tcandidate_id: string | null;\n\tevent: AnalyticsLogEvent;\n\tsent_at: string;\n\tcontext: AnalyticsContext;\n\tproperties: P;\n\tcustom_properties?: Record<string, unknown>;\n};\n\ntype LogFnParams<T extends keyof EventPropertyMap> = {\n\tevent: T;\n\tcustomProperties?: Record<string, unknown>;\n\t/** Passing a request will make logging possible on a server environment. */\n\trequest?: Request;\n} & EventPropertyMap[T];\n\ntype LogFn = <TEvent extends keyof EventPropertyMap>(\n\tparams: LogFnParams<TEvent>,\n) => Promise<ResponseObj<TrackPayload<EventPropertyMap[TEvent]['properties']>>>;\n\nexport type AnalyticsService = {\n\tlog: LogFn;\n\t/** From a log payload data, generate headers to use in server environments to update the anonymous_id */\n\tgetHeaders: (payload?: TrackPayload) => Headers;\n\tgetSessionInfo: typeof getSessionInfo;\n};\n\nconst getSessionId = (searchParams: URLSearchParams, isServer: boolean) => {\n\tconst fromSearchParams = searchParams.get('session_id');\n\tif (isServer) return fromSearchParams;\n\tif (fromSearchParams) return fromSearchParams;\n\tconst fromSessionStorage = sessionStorage.getItem(`${ANALYTICS_COOKIE_NAME}-session_id`);\n\tif (typeof fromSessionStorage === 'string') return fromSessionStorage;\n\treturn null;\n};\n\n/**\n * Read the cached Talent Bank candidate id from localStorage.\n *\n * Returns `null` in non-browser / no-localStorage environments so server-side\n * logging and tests don't explode.\n */\nconst getStoredCandidateId = (): string | null => {\n\tif (typeof window === 'undefined') return null;\n\ttry {\n\t\tconst stored = window.localStorage.getItem(ANALYTICS_CANDIDATE_ID_STORAGE_KEY);\n\t\treturn typeof stored === 'string' && stored !== '' ? stored : null;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\nconst setStoredCandidateId = (candidateId: string | null): void => {\n\tif (typeof window === 'undefined') return;\n\ttry {\n\t\tif (candidateId) {\n\t\t\twindow.localStorage.setItem(ANALYTICS_CANDIDATE_ID_STORAGE_KEY, candidateId);\n\t\t} else {\n\t\t\twindow.localStorage.removeItem(ANALYTICS_CANDIDATE_ID_STORAGE_KEY);\n\t\t}\n\t} catch {\n\t\t// localStorage may be unavailable (Safari private mode, sandboxed\n\t\t// iframes, etc). Identification still works for the current page — we\n\t\t// just won't remember it across reloads.\n\t}\n};\n\nconst cookieRegex = new RegExp(`${ANALYTICS_COOKIE_NAME}=([^;]+)`);\nconst getSessionInfo = (request?: Request) => {\n\tconst href = request ? request.url : location.href;\n\tconst { searchParams } = new URL(href);\n\tconst anonymous_id = searchParams.get('anonymous_id');\n\tconst session_id = getSessionId(searchParams, typeof window === 'undefined');\n\n\t// If there's an anonymous_id in the search params, use it\n\tif (anonymous_id)\n\t\treturn {\n\t\t\tanonymous_id,\n\t\t\tsession_id,\n\t\t};\n\n\t// If there's a cookie, use it\n\tconst cookie = request ? request.headers.get('cookie') : document.cookie;\n\tif (cookie) {\n\t\tconst match = cookieRegex.exec(cookie);\n\t\tconst anonymous_id = match?.[1];\n\t\treturn {\n\t\t\tanonymous_id: anonymous_id ?? null,\n\t\t\tsession_id,\n\t\t};\n\t}\n\n\t// Otherwise, return what we have\n\treturn {\n\t\tanonymous_id,\n\t\tsession_id,\n\t};\n};\n\n/**\n * Get or create a persistent anonymous ID.\n *\n * This is the universal identifier that bridges:\n * - SDK analytics (Laravel tracking)\n * - Agent conversations (Durable Object routing)\n * - Identity resolution\n *\n * The ID is:\n * - Generated client-side if none exists\n * - Persisted in cookie for 7 days\n * - The same across all SDK plugins\n *\n * @returns The anonymous ID (existing or newly generated)\n */\nexport const getOrCreateAnonymousId = (): string => {\n\t// Server-side: cannot generate, return empty (should not happen in normal flow)\n\tif (typeof window === 'undefined') {\n\t\tthrow new Error('getOrCreateAnonymousId() can only be called in browser environment');\n\t}\n\n\t// Check existing sources first\n\tconst existing = getSessionInfo().anonymous_id;\n\tif (existing) return existing;\n\n\t// Generate new ID and immediately persist to cookie\n\tconst newId = generateUUID();\n\tdocument.cookie = formatCookie(newId);\n\treturn newId;\n};\n\nconst getSessionInfoFromResponse = (response: unknown) => {\n\tif (typeof response !== 'object' || response === null) return null;\n\treturn {\n\t\tanonymous_id:\n\t\t\t'anonymous_id' in response && typeof response.anonymous_id === 'string' ? response.anonymous_id : null,\n\t\tsession_id: 'session_id' in response && typeof response.session_id === 'string' ? response.session_id : null,\n\t};\n};\n\nconst serverReferrer = (referrer: typeof Request.prototype.referrer) => {\n\tif (referrer === 'about:client') return '';\n\treturn referrer;\n};\n\nconst analyticsLogEndpoint = endpoint({\n\tpathname: '/log',\n\tmethod: 'POST',\n\tschema: {\n\t\tresponse: typed<unknown>(),\n\t\tbody: typed<TrackPayload>(),\n\t},\n});\n\nexport type AnalyticsOnEventCallback = (event: AnalyticsLogParams) => void;\n\nexport const createAnalyticsService = ({\n\trpcClient,\n\tlogger,\n\tonEvent,\n\ttalentBank,\n}: {\n\tlogger: Logger;\n\trpcClient: InploiRpcClient;\n\tonEvent?: AnalyticsOnEventCallback;\n\t/**\n\t * Optional Talent Bank client. When provided, `IDENTIFY` events are sent\n\t * directly to Talent Bank's `POST /identify` (in addition to Laravel's\n\t * `/log`), and the returned `candidateId` is cached locally and forwarded\n\t * on every subsequent log call.\n\t */\n\ttalentBank?: TalentBankClient;\n}): AnalyticsService => {\n\tconst logFn: LogFn = async params => {\n\t\tinvariant(\n\t\t\tparams.request || typeof window !== 'undefined',\n\t\t\t'Cannot log on the server without a request. Please pass a request to `log`.',\n\t\t);\n\n\t\t// if there’s a request, use it instead of browser APIs\n\t\tconst page =\n\t\t\t'request' in params && params.request ?\n\t\t\t\t{\n\t\t\t\t\thref: params.request.url,\n\t\t\t\t\treferrer: serverReferrer(params.request.referrer),\n\t\t\t\t\ttitle: '',\n\t\t\t\t}\n\t\t\t:\t{\n\t\t\t\t\thref: location.href,\n\t\t\t\t\treferrer: document.referrer,\n\t\t\t\t\ttitle: document.title,\n\t\t\t\t};\n\n\t\ttry {\n\t\t\tconst context: AnalyticsContext = {\n\t\t\t\tlibrary: {\n\t\t\t\t\tname: 'inploi-sdk',\n\t\t\t\t\tversion: ANALYTICS_VERSION,\n\t\t\t\t},\n\t\t\t\tpage,\n\t\t\t};\n\n\t\t\tlet sessionInfo = getSessionInfo(params.request);\n\t\t\tif (params.event === 'IDENTIFY' && !sessionInfo.anonymous_id && !params.request && typeof window !== 'undefined') {\n\t\t\t\tsessionInfo = { ...sessionInfo, anonymous_id: getOrCreateAnonymousId() };\n\t\t\t}\n\n\t\t\t// For IDENTIFY events, resolve the Talent Bank candidate directly\n\t\t\t// from the SDK before firing the /log call. The returned candidateId\n\t\t\t// is cached so every subsequent log request includes it. Identify\n\t\t\t// is best-effort: a failure here must not prevent the analytics log.\n\t\t\tlet resolvedCandidateId = getStoredCandidateId();\n\t\t\tif (params.event === 'IDENTIFY' && talentBank && sessionInfo.anonymous_id) {\n\t\t\t\tconst identifyProperties = params.properties as EventPropertyMap['IDENTIFY']['properties'];\n\t\t\t\tconst result = await talentBank.identify({\n\t\t\t\t\temail: identifyProperties.email ?? identifyProperties.identifier,\n\t\t\t\t\tfirstName: identifyProperties.first_name,\n\t\t\t\t\tlastName: identifyProperties.last_name,\n\t\t\t\t\tphone: identifyProperties.phone_number,\n\t\t\t\t\tanonymousId: sessionInfo.anonymous_id,\n\t\t\t\t\tsource: 'sdk',\n\t\t\t\t});\n\t\t\t\tif (result?.candidateId) {\n\t\t\t\t\tresolvedCandidateId = result.candidateId;\n\t\t\t\t\tsetStoredCandidateId(result.candidateId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst payload: TrackPayload = {\n\t\t\t\tanonymous_id: sessionInfo.anonymous_id,\n\t\t\t\tsession_id: sessionInfo.session_id,\n\t\t\t\tcandidate_id: resolvedCandidateId,\n\t\t\t\tevent: params.event,\n\t\t\t\tsent_at: new Date().toISOString(),\n\t\t\t\tcontext,\n\t\t\t\tproperties: params.properties,\n\t\t\t\tcustom_properties: params.customProperties,\n\t\t\t};\n\n\t\t\tconst responseJson = await rpcClient.request(analyticsLogEndpoint, {\n\t\t\t\tbody: payload,\n\t\t\t});\n\n\t\t\tconst newSession = getSessionInfoFromResponse(responseJson);\n\t\t\tif (newSession?.anonymous_id) {\n\t\t\t\tpayload.anonymous_id = newSession.anonymous_id;\n\t\t\t}\n\t\t\tif (newSession?.session_id) {\n\t\t\t\tpayload.session_id = newSession.session_id;\n\t\t\t}\n\n\t\t\tif (typeof window !== 'undefined' && payload.anonymous_id) {\n\t\t\t\tif (payload.session_id) {\n\t\t\t\t\tsessionStorage.setItem(`${ANALYTICS_COOKIE_NAME}-session_id`, payload.session_id.toString());\n\t\t\t\t}\n\t\t\t\tdocument.cookie = formatCookie(payload.anonymous_id);\n\t\t\t}\n\n\t\t\tonEvent?.(payload as AnalyticsLogParams);\n\t\t\treturn { success: true, data: payload };\n\t\t} catch (e) {\n\t\t\t/** We dont’t log any PII on the console */\n\t\t\tlogger.error('Failed to send log to API. Inspect error response of `log` for more information.');\n\t\t\treturn { success: false, error: e };\n\t\t}\n\t};\n\n\treturn {\n\t\tlog: logFn,\n\t\tgetHeaders: payload => {\n\t\t\tconst headers = new Headers();\n\t\t\tif (!payload?.anonymous_id) return headers;\n\n\t\t\theaders.append('Set-Cookie', formatCookie(payload.anonymous_id));\n\t\t\treturn headers;\n\t\t},\n\t\tgetSessionInfo,\n\t};\n};\n","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { stringify } from 'neoqs';\n\nimport { SchemaValidationError, handleApiExceptions, parseJsonResponse } from './sdk.api';\nimport { ENV_TO_API_URL, InploiSdkEnvironment } from './sdk.constants';\nimport { Logger } from './sdk.logger';\n\ntype RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';\n\n/** Extract parameter names from a pathname string */\ntype ExtractParamNames<T extends string> =\n\tT extends `${infer _Before}:${infer Param}/${infer After}` ? Param | ExtractParamNames<`/${After}`>\n\t: T extends `${infer _Before}:${infer Param}` ? Param\n\t: never;\n\n/** Create params object from parameter names */\ntype ExtractPathParams<T extends string> =\n\tstring extends T ? Record<string, string | number>\n\t: ExtractParamNames<T> extends never ? Record<string, never>\n\t: { [K in ExtractParamNames<T>]: string | number };\n\n/** Parses a StandardSchemaV1 schema and input into an output. */\nexport function parse<T extends StandardSchemaV1>(\n\tschema: T,\n\tinput: StandardSchemaV1.InferInput<T>,\n\tsource?: 'body' | 'searchParams' | 'response',\n): StandardSchemaV1.InferOutput<T> {\n\tconst result = schema['~standard'].validate(input);\n\tif (result instanceof Promise) {\n\t\tthrow new TypeError('Async schema');\n\t}\n\n\tif (result.issues) {\n\t\tthrow new SchemaValidationError(result.issues, source);\n\t}\n\n\treturn result.value;\n}\n\n/** Parses a StandardSchemaV1 schema and input into an output, returning a success flag and issues if the parse fails. */\nexport function safeParse<T extends StandardSchemaV1>(\n\tschema: T,\n\tinput: StandardSchemaV1.InferInput<T>,\n\tsource?: 'body' | 'searchParams' | 'response',\n):\n\t| {\n\t\t\tsuccess: true;\n\t\t\toutput: StandardSchemaV1.InferOutput<T>;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\tissues: readonly StandardSchemaV1.Issue[];\n\t\t\tsource?: 'body' | 'searchParams' | 'response';\n\t } {\n\ttry {\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\toutput: parse(schema, input, source),\n\t\t};\n\t} catch (e) {\n\t\tif (e instanceof SchemaValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tissues: e.issues,\n\t\t\t\tsource: e.source,\n\t\t\t};\n\t\t}\n\t\tthrow e;\n\t}\n}\n\nexport interface InploiRpcClientParams {\n\tenvironment: InploiSdkEnvironment;\n\tlogger: Logger;\n\tapiKey:\n\t\t| {\n\t\t\t\t/** Makes the API call with an x-secret-key header\n\t\t\t\t * This will error if used in a browser environment.\n\t\t\t\t */\n\t\t\t\ttype: 'secret';\n\t\t\t\tkey: string;\n\t\t }\n\t\t| {\n\t\t\t\t/** Makes the API call with an x-publishable-key header\n\t\t\t\t * This can be called in a browser or server environment.\n\t\t\t\t */\n\t\t\t\ttype: 'publishable';\n\t\t\t\tkey: string;\n\t\t };\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype NonReducibleUnknown = {} | null | undefined;\ntype LooseAutocomplete<T extends BaseType, BaseType> = T | BaseType;\n\n/** RPC client for making API calls to the Inploi API. */\nexport class InploiRpcClient {\n\tprivate baseUrl: string;\n\tprivate headers: Headers;\n\tprivate logger: Logger;\n\tprivate _environment: InploiSdkEnvironment;\n\n\tconstructor(params: InploiRpcClientParams) {\n\t\tthis.baseUrl = ENV_TO_API_URL[params.environment];\n\t\tthis.headers = new Headers({\n\t\t\t'Content-Type': 'application/json',\n\t\t\tAccept: 'application/json',\n\t\t});\n\t\tif (params.apiKey.type === 'secret') {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\tthrow new Error('Secret key cannot be used in a browser environment');\n\t\t\t}\n\t\t\tthis.headers.set('x-secret-key', params.apiKey.key);\n\t\t} else {\n\t\t\tthis.headers.set('x-publishable-key', params.apiKey.key);\n\t\t}\n\t\tthis.logger = params.logger;\n\t\tthis._environment = params.environment;\n\t}\n\n\tget environment() {\n\t\treturn this._environment;\n\t}\n\n\t/** Gets params for a fetch request to the given endpoint */\n\tgetFetchParams<T extends RpcEndpoint>(\n\t\tendpoint: T,\n\t\toptions: T extends RpcEndpoint<infer _, infer _TPathname, infer TPathParams, infer TSearch, infer TBody> ?\n\t\t\tGetSchemaValues<{\n\t\t\t\tbody: TBody;\n\t\t\t\tsearchParams: TSearch;\n\t\t\t\tparams: TPathParams;\n\t\t\t}> & {\n\t\t\t\tsignal?: AbortSignal;\n\t\t\t\t/**\n\t\t\t\t * Whether to validate the inputs against the schema.\n\t\t\t\t * If you want to skip validation (e.g.: already validated yourself or with `validateEndpontInputs`), set this to false.\n\t\t\t\t */\n\t\t\t\tvalidateIn?: boolean;\n\t\t\t}\n\t\t:\tnever,\n\t): [url: string, options: RequestInit] {\n\t\tconst validateIn = options.validateIn ?? true;\n\t\tconst { searchParams, body } = validateIn ? validateEndpointInputs(endpoint, options) : options;\n\n\t\tconst url = new URL(this.baseUrl);\n\n\t\t// Replace path parameters in pathname\n\t\tlet pathname = endpoint.pathname;\n\t\tif ('params' in options && options.params) {\n\t\t\tfor (const [key, value] of Object.entries(options.params)) {\n\t\t\t\tpathname = pathname.replace(`:${key}`, String(value));\n\t\t\t}\n\t\t}\n\t\turl.pathname = pathname;\n\n\t\tif (endpoint.schema.searchParams) {\n\t\t\turl.search = stringify(searchParams);\n\t\t}\n\n\t\treturn [\n\t\t\turl.toString(),\n\t\t\t{\n\t\t\t\tmethod: endpoint.method,\n\t\t\t\tbody: body ? JSON.stringify(body) : undefined,\n\t\t\t\theaders: this.headers,\n\t\t\t\tsignal: options.signal,\n\t\t\t},\n\t\t];\n\t}\n\n\t/** Parses a response against an endpoint’s response schema, considering common errors thrown from the API.\n\t * @throws {JsonParsingError} - If the response is not valid JSON.\n\t * @throws {SchemaValidationError} - If the response does not match the schema.\n\t * @throws {ApiError} - If the API responded with an error message.\n\t */\n\tasync parseResponse<T extends RpcEndpoint>(\n\t\tendpoint: T,\n\t\toptions: {\n\t\t\tresponse: Response;\n\t\t\t/**\n\t\t\t * Whether to validate the response against the schema.\n\t\t\t * This is meant more as an escape hatch for when the response is not as expected and you want to handle it separately yourself.\n\t\t\t * ⚠️ This will lead to potential type/runtime mismatch as it does not verify the response against the schema.\n\t\t\t */\n\t\t\tvalidateOut?: boolean;\n\t\t},\n\t): Promise<StandardSchemaV1.InferOutput<T['schema']['response']>> {\n\t\tconst json = await parseJsonResponse(options.response);\n\n\t\tconst validateOut = options.validateOut ?? true;\n\t\tif (!validateOut) return json as StandardSchemaV1.InferOutput<T['schema']['response']>;\n\n\t\tconst result = safeParse(endpoint.schema.response, json, 'response');\n\t\tif (!result.success) {\n\t\t\thandleApiExceptions(json, options.response.status);\n\t\t\tthrow new SchemaValidationError(result.issues, result.source);\n\t\t}\n\n\t\treturn result.output as StandardSchemaV1.InferOutput<T['schema']['response']>;\n\t}\n\n\t/** Fetches, parses and validates an API endpoint.\n\t * Logs errors and throws them again so that the caller can handle them.\n\t *\n\t * @throws {JsonParsingError} - If the response is not valid JSON.\n\t * @throws {SchemaValidationError} - If the searchParams, body or response does not match the schema.\n\t * @throws {ApiError} - If the API responded with an error message.\n\t * @throws {UnauthorisedError} - If the request is unauthorised either by missing key or unmet permissions.\n\t * @throws {NotFoundError} - If the endpoint is not found.\n\t * @throws {Error} - Another unhandled error.\n\t */\n\tasync request<T extends RpcEndpoint>(\n\t\tendpoint: T,\n\t\toptions: T extends RpcEndpoint<infer _, infer _TPathname, infer TPathParams, infer TSearch, infer TBody> ?\n\t\t\tGetSchemaValues<{\n\t\t\t\tbody: TBody;\n\t\t\t\tsearchParams: TSearch;\n\t\t\t\tparams: TPathParams;\n\t\t\t}> & {\n\t\t\t\tsignal?: AbortSignal;\n\t\t\t\t/**\n\t\t\t\t * Whether to validate the inputs against the schema.\n\t\t\t\t * If you want to skip validation (e.g.: already validated yourself or with `validateEndpontInputs`), set this to false.\n\t\t\t\t */\n\t\t\t\tvalidateIn?: boolean;\n\t\t\t\t/**\n\t\t\t\t * Whether to validate the response against the schema.\n\t\t\t\t * This is meant more as an escape hatch for when the response is not as expected and you want to handle it separately yourself.\n\t\t\t\t * ⚠️ This will lead to potential type/runtime mismatch as it does not verify the response against the schema.\n\t\t\t\t */\n\t\t\t\tvalidateOut?: boolean;\n\t\t\t}\n\t\t:\tnever,\n\t): Promise<StandardSchemaV1.InferOutput<T['schema']['response']>> {\n\t\ttry {\n\t\t\tconst fetchParams = this.getFetchParams(endpoint, options);\n\t\t\tconst response = await fetch(...fetchParams);\n\t\t\treturn await this.parseResponse(endpoint, { response, validateOut: options.validateOut });\n\t\t} catch (e) {\n\t\t\tif (e instanceof SchemaValidationError) {\n\t\t\t\tthis.logger.error(e.message, e.issues);\n\t\t\t} else {\n\t\t\t\tthis.logger.error(e);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n}\n\ntype GetSchemaValues<T extends { searchParams: any; body: any; params?: any }> = {\n\t[K in keyof T as T[K] extends never ? never\n\t: T[K] extends Record<string, never> ? never\n\t: K]: T[K] extends never ? never : LooseAutocomplete<T[K], NonReducibleUnknown>;\n};\n\n/**\n * Typed but *not runtime validated* schema\n * useful for type-checking the schema without bundling validation schemas\n */\nexport function typed<T>(): StandardSchemaV1<T, T> {\n\treturn {\n\t\t'~standard': {\n\t\t\tvendor: 'inploi',\n\t\t\tversion: 1,\n\t\t\tvalidate: input => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: input as T,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport interface RpcEndpoint<\n\tTMethod extends RequestMethod = RequestMethod,\n\tTPathname extends string = string,\n\tTPathParams = any,\n\tTSearch = any,\n\tTBody = any,\n\tTResponse = any,\n> {\n\tpathname: TPathname;\n\tmethod: TMethod;\n\theaders?: Headers;\n\tschema: {\n\t\tsearchParams?: StandardSchemaV1<TSearch, TSearch>;\n\t\tbody?: StandardSchemaV1<TBody, TBody>;\n\t\tresponse: StandardSchemaV1<TResponse, TResponse>;\n\t};\n\t/** Type-only property to store path parameter types */\n\treadonly __pathParams?: TPathParams;\n}\n\nexport function endpoint<\n\tTMethod extends RequestMethod,\n\tTPathname extends string,\n\tTSearch extends StandardSchemaV1 | never = never,\n\tTBody extends StandardSchemaV1 | never = never,\n\tTResponse extends StandardSchemaV1 | never = never,\n>(endpoint: {\n\tpathname: TPathname;\n\tmethod: TMethod;\n\theaders?: Headers;\n\tschema: {\n\t\tsearchParams?: TSearch;\n\t\tbody?: TBody;\n\t\tresponse: TResponse;\n\t};\n}) {\n\ttype PathParams = ExtractPathParams<TPathname>;\n\treturn endpoint as RpcEndpoint<\n\t\tTMethod,\n\t\tTPathname,\n\t\tPathParams,\n\t\tStandardSchemaV1.InferInput<TSearch>,\n\t\tStandardSchemaV1.InferInput<TBody>,\n\t\tStandardSchemaV1.InferOutput<TResponse>\n\t>;\n}\n\n/** Validates the inputs for an endpoint ahead of time\n * Useful when you need to validate and throw earlier, or use the inputs for something other than the API call.\n */\nexport function validateEndpointInputs<T extends RpcEndpoint>(\n\tendpoint: T,\n\toptions: GetSchemaValues<{ body: unknown; searchParams: unknown }>,\n) {\n\tconst validatedInputs = {\n\t\tsearchParams: undefined,\n\t\tbody: undefined,\n\t\tvalidateIn: false,\n\t} as T extends RpcEndpoint<infer _, infer __, infer ___, infer TSearch, infer TBody> ?\n\t\tGetSchemaValues<{\n\t\t\tbody: TBody;\n\t\t\tsearchParams: TSearch;\n\t\t}> & {\n\t\t\tvalidateIn: false;\n\t\t}\n\t:\tnever;\n\n\tif (endpoint.schema.searchParams) {\n\t\tvalidatedInputs.searchParams = parse(\n\t\t\tendpoint.schema.searchParams,\n\t\t\t'searchParams' in options ? options.searchParams : {},\n\t\t);\n\t}\n\n\tif (endpoint.schema.body) {\n\t\tvalidatedInputs.body = parse(endpoint.schema.body, 'body' in options ? options.body : {});\n\t}\n\n\treturn validatedInputs;\n}\n","import * as v from \"valibot\";\nexport const CANDIDATE_SOURCES = [\n \"agent\",\n \"sdk\",\n \"form\",\n \"integration\",\n \"migration\",\n];\n/**\n * Canonical funnel-milestone groups. Stable enum baked into the contract —\n * lifecycle decisions key off this, never off `stage` (which is free-text).\n */\nexport const STAGE_GROUPS = [\n \"APPLIED\",\n \"SHORTLISTED\",\n \"INTERVIEWED\",\n \"OFFERED\",\n \"HIRED\",\n \"REJECTED\",\n \"WITHDRAWN\",\n];\n/**\n * Historical 1:1 stage slugs per group. Stages are now free-text at the\n * contract boundary — studio owns the per-company list — so this constant\n * exists only as the default-per-group fallback for callers (and tests)\n * that don't supply an explicit stage. See {@link DEFAULT_STAGE_FOR_GROUP}.\n */\nexport const STAGES = [\n \"applied\",\n \"shortlisted\",\n \"interviewed\",\n \"offered\",\n \"hired\",\n \"rejected\",\n \"withdrawn\",\n];\nexport const SCORE_TYPES = [\n \"screening\",\n \"cv_match\",\n \"interview\",\n \"overall\",\n];\nexport const INTERVIEW_STATUSES = [\n \"PENDING\",\n \"SCHEDULED\",\n \"IN_PROGRESS\",\n \"COMPLETED\",\n \"CANCELLED\",\n];\nexport const DUPLICATE_CHECK_SCOPES = [\"job\", \"company\"];\nexport const APPLICATION_SORT_FIELDS = [\"created_at\", \"updated_at\"];\nexport const SORT_ORDERS = [\"asc\", \"desc\"];\n/** Per-application source label. Set once on submit; never mutated thereafter. */\nexport const APPLICATION_SOURCES = [\n \"careers_site\",\n \"chatbot\",\n \"plugin_job_search\",\n \"ats_import\",\n \"referral\",\n \"agency\",\n \"other\",\n \"unknown\",\n];\n/**\n * The closed set of state-mutating actions that can be recorded in the\n * `application_logs` audit table.\n *\n * The named group transitions (`shortlist`, `move_to_interview`,\n * `make_offer`, `hire`, `withdraw`) exist *alongside* the generic\n * `move_to_stage` because the action key is what flows into audit +\n * analytics: a `shortlist` row and a `move_to_stage` row that happen to\n * both land in `SHORTLISTED` carry different intent and the dashboards\n * pivot on that. The legacy `stage_transition` is kept as an alias for\n * `move_to_stage` so existing consumers don't break.\n *\n * `submit` and `score_written` are server-emitted only — never accepted\n * via the generic apply-action surface.\n */\nexport const APPLICATION_ACTIONS = [\n \"submit\",\n \"stage_transition\",\n \"move_to_stage\",\n \"shortlist\",\n \"move_to_interview\",\n \"make_offer\",\n \"hire\",\n \"withdraw\",\n \"disqualify\",\n \"reinstate\",\n \"rate\",\n \"score_written\",\n];\n/** Who initiated the audited action. Verbatim from the request body. */\nexport const ACTOR_TYPES = [\n \"user\",\n \"system\",\n \"automation\",\n \"integration\",\n \"candidate\",\n];\nexport const CandidateSourceSchema = v.picklist(CANDIDATE_SOURCES);\nexport const StageGroupSchema = v.picklist(STAGE_GROUPS);\n/**\n * Stage slug — free-text from talent-bank's POV. Studio owns the per-company\n * stage configuration; talent-bank just stores and reflects whatever slug the\n * caller sends. The trimmed length cap mirrors the column intent (TEXT, but\n * we don't want kilobyte-sized slugs leaking through accidents).\n */\nexport const StageSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(100));\nexport const ScoreTypeSchema = v.picklist(SCORE_TYPES);\nexport const InterviewStatusSchema = v.picklist(INTERVIEW_STATUSES);\nexport const DuplicateCheckScopeSchema = v.picklist(DUPLICATE_CHECK_SCOPES);\nexport const ApplicationSortFieldSchema = v.picklist(APPLICATION_SORT_FIELDS);\nexport const SortOrderSchema = v.picklist(SORT_ORDERS);\n/**\n * Disqualification reason slug — free-text from talent-bank's POV. Studio owns\n * the per-company reason configuration (label, ordering, whether a note is\n * required); talent-bank just stores and reflects whatever slug the caller\n * sends, exactly like {@link StageSchema}. The length cap mirrors the column\n * intent (TEXT, but we don't want kilobyte-sized slugs leaking through).\n */\nexport const DisqualificationReasonSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(100));\nexport const ApplicationSourceSchema = v.picklist(APPLICATION_SOURCES);\nexport const ApplicationActionSchema = v.picklist(APPLICATION_ACTIONS);\nexport const ActorTypeSchema = v.picklist(ACTOR_TYPES);\n/**\n * The actor type that marks a shortlist as initiated by one of our own\n * automations (e.g. the Studio \"Sync shortlist to Talent Bank\" workflow node).\n *\n * This value is load-bearing across repos: the `/metrics` soft-cap query\n * (`buildShortlistCountQuery`) counts only `application.shortlisted` rows whose\n * `actorType` equals this constant, and the API workflow node must send exactly\n * this `actor.type` for its shortlists to be counted. Keeping it as a single\n * `satisfies ActorType` constant means a typo or a removal from {@link ACTOR_TYPES}\n * is a compile error rather than a silently-zero metric.\n */\nexport const AUTOMATION_ACTOR_TYPE = \"automation\";\n/**\n * Historical default-slug → group map. **Not a runtime validator** — stages\n * are now free-text and studio owns the per-company stage list. Only useful\n * for resolving the v1 default slugs in tests and back-compat paths.\n */\nexport const STAGE_TO_GROUP = {\n applied: \"APPLIED\",\n shortlisted: \"SHORTLISTED\",\n interviewed: \"INTERVIEWED\",\n offered: \"OFFERED\",\n hired: \"HIRED\",\n rejected: \"REJECTED\",\n withdrawn: \"WITHDRAWN\",\n};\n/**\n * Default stage slug per stage group. Used by named group-transition actions\n * when the caller does not supply an explicit `stage`, and by `submit` when\n * the request body omits both `stage` and `stageGroup`.\n */\nexport const DEFAULT_STAGE_FOR_GROUP = {\n APPLIED: \"applied\",\n SHORTLISTED: \"shortlisted\",\n INTERVIEWED: \"interviewed\",\n OFFERED: \"offered\",\n HIRED: \"hired\",\n REJECTED: \"rejected\",\n WITHDRAWN: \"withdrawn\",\n};\n/** Convention default applied on submit when the caller does not supply a stage. */\nexport const DEFAULT_STAGE = \"applied\";\nexport const DEFAULT_STAGE_GROUP = \"APPLIED\";\n/** Terminal stage groups — disqualified or self-withdrawn. */\nexport const TERMINAL_STAGE_GROUPS = new Set([\n \"REJECTED\",\n \"WITHDRAWN\",\n \"HIRED\",\n]);\n/**\n * Source stage groups that `reinstate` is permitted to move an application\n * *out of*. The set is engine-internal — it answers \"given a target row,\n * may the reinstate action proceed?\" — not a synonym for \"is this row\n * disqualified\" (the row's `disqualifiedAt` column answers that).\n *\n * HIRED is included so fat-finger hires can be corrected on the kanban\n * without resorting to a back-channel DB edit. `reinstate.apply` always\n * clears `disqualifiedAt` and `disqualificationReason`, which is a no-op\n * on HIRED rows (already null) — so adding HIRED has no semantic effect\n * on genuine disqualified reinstates.\n *\n * The complementary \"cannot reinstate INTO terminal\" guard\n * ({@link TERMINAL_STAGE_GROUPS}) is unchanged: this action moves\n * applications back into the active funnel, never sideways between\n * terminal states (use `disqualify` for HIRED → REJECTED).\n */\nexport const REINSTATABLE_STAGE_GROUPS = new Set([\n \"REJECTED\",\n \"WITHDRAWN\",\n \"HIRED\",\n]);\n/**\n * Discriminated actor block. Sent on every mutating route's body and\n * written verbatim into the matching `application_logs` row.\n */\nexport const ActorInputSchema = v.variant(\"type\", [\n v.object({\n type: v.literal(\"user\"),\n id: v.pipe(v.string(), v.minLength(1)),\n email: v.pipe(v.string(), v.minLength(1)),\n name: v.pipe(v.string(), v.minLength(1)),\n }),\n v.object({\n type: v.literal(\"system\"),\n id: v.pipe(v.string(), v.minLength(1)),\n name: v.optional(v.string()),\n }),\n v.object({\n type: v.literal(\"automation\"),\n id: v.pipe(v.string(), v.minLength(1)),\n name: v.optional(v.string()),\n }),\n v.object({\n type: v.literal(\"integration\"),\n id: v.pipe(v.string(), v.minLength(1)),\n name: v.optional(v.string()),\n }),\n v.object({\n type: v.literal(\"candidate\"),\n id: v.pipe(v.string(), v.minLength(1)),\n email: v.optional(v.string()),\n }),\n]);\n","import * as v from \"valibot\";\nexport const PaginationSchema = v.object({\n total: v.number(),\n page: v.number(),\n perPage: v.number(),\n lastPage: v.number(),\n});\nexport function paginatedResultSchema(itemSchema) {\n return v.object({\n data: v.array(itemSchema),\n pagination: PaginationSchema,\n });\n}\n","import * as v from \"valibot\";\nimport { CandidateSourceSchema } from \"./enums.js\";\nexport const CandidateSchema = v.object({\n id: v.string(),\n email: v.nullable(v.string()),\n firstName: v.nullable(v.string()),\n lastName: v.nullable(v.string()),\n phone: v.nullable(v.string()),\n source: v.nullable(CandidateSourceSchema),\n identifiedAt: v.nullable(v.string()),\n createdAt: v.string(),\n updatedAt: v.string(),\n});\n","import * as v from \"valibot\";\nimport { UnknownRecordSchema } from \"./_shared.js\";\nimport { CandidateSchema } from \"./candidate.js\";\nimport { ActorTypeSchema, ApplicationActionSchema, ApplicationSourceSchema, DisqualificationReasonSchema, ScoreTypeSchema, StageGroupSchema, StageSchema, } from \"./enums.js\";\nimport { InterviewSchema } from \"./interview.js\";\nexport const ScoreCategorySchema = v.object({\n score: v.number(),\n reason: v.string(),\n confidence: v.number(),\n});\nexport const ApplicationSchema = v.object({\n id: v.string(),\n candidateId: v.string(),\n jobId: v.number(),\n stage: StageSchema,\n stageGroup: StageGroupSchema,\n stageEnteredAt: v.string(),\n rating: v.nullable(v.number()),\n disqualifiedAt: v.nullable(v.string()),\n disqualificationReason: v.nullable(DisqualificationReasonSchema),\n disqualificationNote: v.nullable(v.string()),\n source: ApplicationSourceSchema,\n sourceDetail: v.nullable(v.string()),\n sessionId: v.nullable(v.number()),\n externalApplicationId: v.nullable(v.string()),\n meta: v.nullable(UnknownRecordSchema),\n context: v.nullable(UnknownRecordSchema),\n scoredAt: v.nullable(v.string()),\n createdAt: v.string(),\n updatedAt: v.string(),\n});\nexport const ApplicationScoreSchema = v.object({\n id: v.string(),\n applicationId: v.string(),\n scoreType: ScoreTypeSchema,\n score: v.nullable(v.number()),\n reason: v.nullable(v.string()),\n categories: v.nullable(v.record(v.string(), ScoreCategorySchema)),\n scoredBy: v.nullable(v.string()),\n createdAt: v.string(),\n});\nexport const ApplicationDetailSchema = v.object({\n ...ApplicationSchema.entries,\n candidate: v.nullable(CandidateSchema),\n score: v.nullable(ApplicationScoreSchema),\n interview: v.nullable(InterviewSchema),\n});\nexport const CandidateDetailSchema = v.object({\n ...CandidateSchema.entries,\n applications: v.array(ApplicationSchema),\n});\n/**\n * Audit-log row recording a single state-mutating action against an\n * application. Structured stage columns carry every transition-relevant\n * field in typed form; `meta` carries opaque action-specific extras.\n */\nexport const ApplicationLogSchema = v.object({\n id: v.string(),\n applicationId: v.string(),\n action: ApplicationActionSchema,\n fromStage: v.nullable(StageSchema),\n fromStageGroup: v.nullable(StageGroupSchema),\n toStage: v.nullable(StageSchema),\n toStageGroup: v.nullable(StageGroupSchema),\n disqualificationReason: v.nullable(DisqualificationReasonSchema),\n disqualificationNote: v.nullable(v.string()),\n actorId: v.nullable(v.string()),\n actorType: ActorTypeSchema,\n actorEmail: v.nullable(v.string()),\n actorName: v.nullable(v.string()),\n meta: v.nullable(UnknownRecordSchema),\n schemaVersion: v.number(),\n createdAt: v.string(),\n});\n","import * as v from \"valibot\";\n// Shared building blocks used by HTTP DTO schemas. Not re-exported from the\n// public barrel — these stay private to the contract folder so consumers don't\n// depend on incidental helpers.\nexport const RequiredStringSchema = v.pipe(v.string(), v.minLength(1));\nexport const PositiveIntegerSchema = v.pipe(v.number(), v.integer(), v.minValue(1));\nexport const UnknownRecordSchema = v.record(v.string(), v.unknown());\n","import * as v from \"valibot\";\nimport { UnknownRecordSchema } from \"./_shared.js\";\nimport { InterviewStatusSchema } from \"./enums.js\";\nexport const InterviewSchema = v.object({\n id: v.string(),\n applicationId: v.string(),\n status: InterviewStatusSchema,\n scheduledAt: v.nullable(v.string()),\n completedAt: v.nullable(v.string()),\n meta: v.nullable(UnknownRecordSchema),\n createdAt: v.string(),\n updatedAt: v.string(),\n});\n","import * as v from \"valibot\";\nimport { RequiredStringSchema } from \"../_shared.js\";\nimport { CandidateSourceSchema } from \"../enums.js\";\nexport const IdentifyInputSchema = v.object({\n anonymousId: RequiredStringSchema,\n email: RequiredStringSchema,\n firstName: v.nullish(v.string()),\n lastName: v.nullish(v.string()),\n phone: v.nullish(v.string()),\n source: v.nullish(CandidateSourceSchema),\n});\nexport const IdentifyResultSchema = v.object({\n candidateId: v.string(),\n isNew: v.boolean(),\n});\n","import * as v from \"valibot\";\nimport { PositiveIntegerSchema, RequiredStringSchema, UnknownRecordSchema, } from \"../_shared.js\";\nimport { ApplicationDetailSchema, ApplicationLogSchema, ScoreCategorySchema, } from \"../application.js\";\nimport { ActorInputSchema, ApplicationSortFieldSchema, ApplicationSourceSchema, DisqualificationReasonSchema, ScoreTypeSchema, SortOrderSchema, StageGroupSchema, StageSchema, } from \"../enums.js\";\nimport { paginatedResultSchema } from \"../pagination.js\";\n/**\n * Action keys exposed to consumers via the generic `applyAction` endpoint.\n * Excludes server-driven entries from {@link APPLICATION_ACTIONS} (`submit`,\n * `score_written`) because those are write-only audit-log labels emitted by\n * the store's dedicated paths, not user-dispatchable actions.\n */\nexport const APPLY_ACTION_KEYS = [\n \"stage_transition\",\n \"move_to_stage\",\n \"shortlist\",\n \"move_to_interview\",\n \"make_offer\",\n \"hire\",\n \"withdraw\",\n \"disqualify\",\n \"reinstate\",\n \"rate\",\n];\nexport const ApplyActionKeySchema = v.picklist(APPLY_ACTION_KEYS);\n/**\n * Comma-separated string in query parameters; transformed into a string[]\n * for downstream use. e.g. `?stages=applied,shortlisted`.\n */\nconst CommaSeparatedStringSchema = v.pipe(v.string(), v.transform((s) => s\n .split(\",\")\n .map((t) => t.trim())\n .filter((t) => t.length > 0)));\n// Stages are free-text post-v6 — the query filter accepts whatever the\n// caller passes. Stage groups remain picklist-validated below.\nconst StagesQuerySchema = v.pipe(CommaSeparatedStringSchema, v.array(StageSchema));\nconst StageGroupsQuerySchema = v.pipe(CommaSeparatedStringSchema, v.array(StageGroupSchema));\nconst JobIdsQuerySchema = v.pipe(v.string(), v.transform((s) => s\n .split(\",\")\n .map((t) => Number(t.trim()))\n .filter((n) => Number.isInteger(n) && n > 0)));\nexport const ListApplicationsQuerySchema = v.object({\n stages: v.optional(StagesQuerySchema),\n stage_groups: v.optional(StageGroupsQuerySchema),\n job_id: v.optional(v.string()),\n job_ids: v.optional(JobIdsQuerySchema),\n candidate_id: v.optional(v.string()),\n is_disqualified: v.optional(v.picklist([\"true\", \"false\"])),\n created_from: v.optional(v.string()),\n created_to: v.optional(v.string()),\n updated_from: v.optional(v.string()),\n updated_to: v.optional(v.string()),\n entered_stage_from: v.optional(v.string()),\n entered_stage_to: v.optional(v.string()),\n from: v.optional(v.string()),\n to: v.optional(v.string()),\n q: v.optional(v.string()),\n scored: v.optional(v.picklist([\"true\", \"false\"])),\n sort: v.optional(ApplicationSortFieldSchema),\n order: v.optional(SortOrderSchema),\n page: v.optional(v.string()),\n per_page: v.optional(v.string()),\n});\n/**\n * `stage` and `stageGroup` must be supplied together, or both omitted. Only\n * studio knows which stage slug belongs in which group (the slug is free-text\n * and the platform deliberately does not carry the per-tenant mapping), so a\n * `stage` arriving without an explicit `stageGroup` cannot be classified\n * without guessing. Omitting both still works and falls back to the\n * `applied` / `APPLIED` defaults inside the store.\n */\nexport const SubmitApplicationInputSchema = v.pipe(v.object({\n candidateId: RequiredStringSchema,\n jobId: PositiveIntegerSchema,\n meta: v.nullish(UnknownRecordSchema),\n sessionId: v.nullish(v.number()),\n externalApplicationId: v.nullish(v.string()),\n context: v.nullish(UnknownRecordSchema),\n source: v.nullish(ApplicationSourceSchema),\n sourceDetail: v.nullish(v.string()),\n stage: v.nullish(StageSchema),\n stageGroup: v.nullish(StageGroupSchema),\n actor: v.nullish(ActorInputSchema),\n}), v.check((input) => (input.stage == null) === (input.stageGroup == null), \"stage and stageGroup must be supplied together\"));\nconst DuplicateApplicationSchema = v.object({\n id: v.string(),\n stageGroup: v.string(),\n createdAt: v.string(),\n});\nexport const SubmitApplicationResultSchema = v.union([\n v.object({\n ok: v.literal(true),\n duplicate: v.literal(false),\n applicationId: v.string(),\n candidateId: v.string(),\n }),\n v.object({\n ok: v.literal(true),\n duplicate: v.literal(true),\n existingApplication: DuplicateApplicationSchema,\n }),\n]);\nexport const DuplicateCheckResultSchema = v.object({\n isDuplicate: v.boolean(),\n existingApplication: v.optional(DuplicateApplicationSchema),\n});\nexport const WriteScoreInputSchema = v.object({\n applicationId: RequiredStringSchema,\n scoreType: ScoreTypeSchema,\n score: v.number(),\n reason: v.nullish(v.string()),\n categories: v.nullish(v.record(v.string(), ScoreCategorySchema)),\n scoredBy: v.nullish(v.string()),\n actor: v.nullish(ActorInputSchema),\n});\nexport const WriteScoreResponseSchema = v.object({ scoreId: v.string() });\nexport const ListApplicationsResponseSchema = paginatedResultSchema(ApplicationDetailSchema);\nexport const GetApplicationResponseSchema = ApplicationDetailSchema;\n/**\n * Single-row stage transition. The server does **not** validate the\n * `(toStage, toStageGroup)` pair against any closed map — `toStage` is\n * free-text and studio is the only system that knows whether a given slug\n * belongs to its configured group.\n */\n/**\n * Skip reasons surfaced by the dispatcher when a stage-changing action is a\n * no-op. Kept as a top-level schema because it's a primitive reused both in\n * `ApplyActionSkipReasonSchema` (which adds `already_disqualified`) and by\n * internal store types via the inferred `TransitionSkipReason` type.\n */\nconst TransitionSkipReasonSchema = v.picklist([\n \"already_in_target_stage\",\n \"not_in_source_stage\",\n \"disqualified\",\n]);\nexport const ListApplicationLogsResponseSchema = v.array(ApplicationLogSchema);\n/* ─────────────────────────────────────────────────────────────\n * Generic applyAction surface\n * ──────────────────────────────────────────────────────────── */\n/**\n * Meta schemas per action key. The generic `applyAction` HTTP body wraps one\n * of these in a discriminated union so each action's payload is validated\n * before reaching the store.\n *\n * `note` fields are optional everywhere except where the rule itself\n * requires them (e.g. `disqualify` with `reason='other'`, enforced inside\n * the registry — not duplicated here).\n */\nconst NoteMeta = v.object({\n stage: v.nullish(StageSchema),\n note: v.nullish(v.string()),\n});\nconst HireMeta = v.object({\n stage: v.nullish(StageSchema),\n startDate: v.nullish(v.string()),\n note: v.nullish(v.string()),\n});\nexport const ApplyActionInputSchema = v.variant(\"action\", [\n v.object({\n action: v.literal(\"shortlist\"),\n actor: ActorInputSchema,\n meta: v.nullish(NoteMeta),\n }),\n v.object({\n action: v.literal(\"move_to_interview\"),\n actor: ActorInputSchema,\n meta: v.nullish(NoteMeta),\n }),\n v.object({\n action: v.literal(\"make_offer\"),\n actor: ActorInputSchema,\n meta: v.nullish(NoteMeta),\n }),\n v.object({\n action: v.literal(\"hire\"),\n actor: ActorInputSchema,\n meta: v.nullish(HireMeta),\n }),\n v.object({\n action: v.literal(\"withdraw\"),\n actor: ActorInputSchema,\n meta: v.nullish(NoteMeta),\n }),\n v.object({\n action: v.literal(\"move_to_stage\"),\n actor: ActorInputSchema,\n meta: v.object({\n stage: StageSchema,\n stageGroup: StageGroupSchema,\n note: v.nullish(v.string()),\n }),\n }),\n v.object({\n action: v.literal(\"stage_transition\"),\n actor: ActorInputSchema,\n meta: v.object({\n toStage: StageSchema,\n toStageGroup: StageGroupSchema,\n note: v.nullish(v.string()),\n }),\n }),\n v.object({\n action: v.literal(\"disqualify\"),\n actor: ActorInputSchema,\n meta: v.object({\n reason: DisqualificationReasonSchema,\n note: v.nullish(v.string()),\n }),\n }),\n v.object({\n action: v.literal(\"reinstate\"),\n actor: ActorInputSchema,\n meta: v.object({\n toStage: StageSchema,\n toStageGroup: StageGroupSchema,\n note: v.nullish(v.string()),\n }),\n }),\n v.object({\n action: v.literal(\"rate\"),\n actor: ActorInputSchema,\n meta: v.object({\n rating: v.nullable(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(5))),\n }),\n }),\n]);\nexport const BulkApplyActionInputSchema = v.object({\n applicationIds: v.pipe(v.array(v.string()), v.minLength(1)),\n body: ApplyActionInputSchema,\n});\nconst ApplyActionSkipReasonSchema = v.picklist([\n \"already_in_target_stage\",\n \"not_in_source_stage\",\n \"disqualified\",\n \"already_disqualified\",\n]);\n/**\n * Result envelope for the generic apply-action endpoint. `updated` returns\n * the new application detail; `skipped` returns the no-op reason; `failed`\n * is reserved for bulk responses (single-row failures surface as HTTP 4xx).\n */\nexport const ApplyActionResultSchema = v.variant(\"kind\", [\n v.object({\n kind: v.literal(\"updated\"),\n action: ApplyActionKeySchema,\n application: ApplicationDetailSchema,\n }),\n v.object({\n kind: v.literal(\"skipped\"),\n action: ApplyActionKeySchema,\n applicationId: v.string(),\n reason: ApplyActionSkipReasonSchema,\n }),\n]);\nexport const BulkApplyActionResultSchema = v.object({\n updated: v.array(v.object({\n kind: v.literal(\"updated\"),\n action: ApplyActionKeySchema,\n application: ApplicationDetailSchema,\n })),\n skipped: v.array(v.object({\n kind: v.literal(\"skipped\"),\n action: ApplyActionKeySchema,\n applicationId: v.string(),\n reason: ApplyActionSkipReasonSchema,\n })),\n failed: v.array(v.object({ applicationId: v.string(), error: v.string() })),\n});\n/* ─────────────────────────────────────────────────────────────\n * Per-job application counts (jobs list page badge / column)\n * ──────────────────────────────────────────────────────────── */\nconst NonNegativeIntegerSchema = v.pipe(v.number(), v.integer(), v.minValue(0));\n/**\n * Zero-filled count for every stage group. Talent-bank always returns the\n * full shape so studio (and other consumers) never need to defensive-merge\n * against missing keys when a job has no applications in a particular group.\n */\nexport const JobApplicationCountsSchema = v.object({\n APPLIED: NonNegativeIntegerSchema,\n SHORTLISTED: NonNegativeIntegerSchema,\n INTERVIEWED: NonNegativeIntegerSchema,\n OFFERED: NonNegativeIntegerSchema,\n HIRED: NonNegativeIntegerSchema,\n REJECTED: NonNegativeIntegerSchema,\n WITHDRAWN: NonNegativeIntegerSchema,\n});\nexport const ListJobApplicationCountsQuerySchema = v.object({\n job_ids: JobIdsQuerySchema,\n});\n/**\n * Response is keyed by job-ID string. Every requested job appears in the\n * map, even when it has zero applications, so callers can safely iterate\n * over their input job list without nullable-handling.\n */\nexport const ListJobApplicationCountsResponseSchema = v.object({\n counts: v.record(v.string(), JobApplicationCountsSchema),\n});\n","import { CandidateDetailSchema } from \"../application.js\";\nimport { CandidateSchema } from \"../candidate.js\";\nimport { paginatedResultSchema } from \"../pagination.js\";\nexport const ListCandidatesResponseSchema = paginatedResultSchema(CandidateSchema);\nexport const GetCandidateResponseSchema = CandidateDetailSchema;\n","import * as v from \"valibot\";\nexport const JobMetricsResponseSchema = v.object({\n avg_score: v.nullable(v.number()),\n p90_score: v.nullable(v.number()),\n p85_score: v.nullable(v.number()),\n p80_score: v.nullable(v.number()),\n total_scores: v.number(),\n /**\n * Cumulative count of distinct applications shortlisted by our own\n * automations for this job (\"ever shortlisted by us\"), sourced from\n * `application.shortlisted` analytics events whose actor type is\n * `automation`. Append-only; does not decrease when a candidate moves out\n * of a shortlisted column. Excludes recruiter-initiated shortlists made\n * directly in the ATS (which never reach the action engine) and human\n * shortlists made in studio (actor type `user`).\n */\n total_shortlists: v.number(),\n});\n","import { DuplicateCheckResultSchema, IdentifyInputSchema, IdentifyResultSchema } from '@inploi/talent-bank/contract';\nimport * as v from 'valibot';\n\nimport { ENV_TO_TALENT_BANK_URL, InploiSdkEnvironment } from './sdk.constants';\nimport { Logger } from './sdk.logger';\n\n// `@inploi/talent-bank` is a private package: tsup bundles its schemas into the\n// npm build, but cannot inline its types into `dist/index.d.ts`, so the shapes\n// this client exposes are declared here. The call sites below (`parsed.output`\n// return values and the schema-typed `identify` body) keep them assignable to\n// the bundled contract.\ntype DuplicateCheckScope = 'job' | 'company';\n\ntype CandidateSource = 'agent' | 'sdk' | 'form' | 'integration' | 'migration';\n\nexport type TalentBankCheckDuplicateResult = {\n\tisDuplicate: boolean;\n\texistingApplication?: { id: string; stageGroup: string; createdAt: string };\n};\n\nexport type TalentBankIdentifyParams = {\n\tanonymousId: string;\n\temail: string;\n\tfirstName?: string | null;\n\tlastName?: string | null;\n\tphone?: string | null;\n\t/** Caller tag — defaults to `'sdk'`. */\n\tsource?: CandidateSource;\n};\n\nexport type TalentBankIdentifyResult = { candidateId: string; isNew: boolean };\n\nexport interface TalentBankClient {\n\tcheckDuplicate(params: {\n\t\temail: string;\n\t\tjobId?: string | number;\n\t\tscope: DuplicateCheckScope;\n\t}): Promise<TalentBankCheckDuplicateResult>;\n\n\t/**\n\t * Resolve or create a Talent Bank candidate for the supplied identifier.\n\t *\n\t * This is the direct-to-Talent-Bank replacement for the old Laravel-proxied\n\t * `/log` IDENTIFY flow. The SDK calls this and then forwards the returned\n\t * `candidateId` on every subsequent analytics log so Laravel can stamp it\n\t * onto the session for attribution.\n\t *\n\t * Returns `null` if the call fails — identification is best-effort and must\n\t * never break the host page.\n\t */\n\tidentify(params: TalentBankIdentifyParams): Promise<TalentBankIdentifyResult | null>;\n}\n\nexport const createTalentBankClient = ({\n\tenvironment,\n\tpublishableKey,\n\tlogger,\n}: {\n\tenvironment: InploiSdkEnvironment;\n\tpublishableKey: string;\n\tlogger: Logger;\n}): TalentBankClient => {\n\tconst baseUrl = ENV_TO_TALENT_BANK_URL[environment];\n\n\treturn {\n\t\tasync checkDuplicate(params) {\n\t\t\ttry {\n\t\t\t\tconst searchParams = new URLSearchParams({ email: params.email, scope: params.scope });\n\t\t\t\tif (params.scope === 'job' && params.jobId != null) {\n\t\t\t\t\tsearchParams.set('job_id', String(params.jobId));\n\t\t\t\t}\n\n\t\t\t\tconst response = await fetch(`${baseUrl}/applications/check-duplicate?${searchParams}`, {\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\theaders: { Accept: 'application/json', 'x-publishable-key': publishableKey },\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tlogger.error(`[TalentBankClient] checkDuplicate failed with status ${response.status}`);\n\t\t\t\t\treturn { isDuplicate: false };\n\t\t\t\t}\n\n\t\t\t\tconst json = await response.json();\n\t\t\t\tconst parsed = v.safeParse(DuplicateCheckResultSchema, json);\n\t\t\t\tif (parsed.success) {\n\t\t\t\t\treturn parsed.output;\n\t\t\t\t}\n\n\t\t\t\t// `isDuplicate` is the only field callers gate on; `existingApplication`\n\t\t\t\t// is supplementary. A schema drift in that nested payload must never\n\t\t\t\t// silently downgrade a real duplicate to a non-duplicate, so fall back\n\t\t\t\t// to the flag directly rather than failing closed.\n\t\t\t\tlogger.error('[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag');\n\t\t\t\tif (\n\t\t\t\t\ttypeof json === 'object' &&\n\t\t\t\t\tjson != null &&\n\t\t\t\t\ttypeof (json as { isDuplicate?: unknown }).isDuplicate === 'boolean'\n\t\t\t\t) {\n\t\t\t\t\treturn { isDuplicate: (json as { isDuplicate: boolean }).isDuplicate };\n\t\t\t\t}\n\n\t\t\t\treturn { isDuplicate: false };\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error('[TalentBankClient] checkDuplicate failed:', e);\n\t\t\t\treturn { isDuplicate: false };\n\t\t\t}\n\t\t},\n\n\t\tasync identify(params) {\n\t\t\ttry {\n\t\t\t\tif (!params.anonymousId) {\n\t\t\t\t\tlogger.error('[TalentBankClient] identify skipped because anonymousId is missing');\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst body: v.InferInput<typeof IdentifyInputSchema> = {\n\t\t\t\t\temail: params.email,\n\t\t\t\t\tfirstName: params.firstName,\n\t\t\t\t\tlastName: params.lastName,\n\t\t\t\t\tphone: params.phone,\n\t\t\t\t\tanonymousId: params.anonymousId,\n\t\t\t\t\tsource: params.source ?? 'sdk',\n\t\t\t\t};\n\t\t\t\tconst parsedBody = v.safeParse(IdentifyInputSchema, body);\n\t\t\t\tif (!parsedBody.success) {\n\t\t\t\t\tlogger.error('[TalentBankClient] identify received invalid input');\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst response = await fetch(`${baseUrl}/identify`, {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t\tAccept: 'application/json',\n\t\t\t\t\t\t'x-publishable-key': publishableKey,\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify(parsedBody.output),\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tlogger.error(`[TalentBankClient] identify failed with status ${response.status}`);\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst parsed = v.safeParse(IdentifyResultSchema, await response.json());\n\t\t\t\tif (!parsed.success) {\n\t\t\t\t\tlogger.error('[TalentBankClient] identify returned an invalid response');\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn parsed.output;\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error('[TalentBankClient] identify failed:', e);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t},\n\t};\n};\n","import { AnalyticsOnEventCallback, createAnalyticsService } from './sdk.analytics';\nimport { createApiClient } from './sdk.api';\nimport { ENV_TO_API_URL, InploiSdkEnvironment } from './sdk.constants';\nimport { Logger, inploiBrandedLogger, noLogging } from './sdk.logger';\nimport { InploiSdkPlugin } from './sdk.plugins';\nimport { InploiRpcClient } from './sdk.rpc';\nimport { createTalentBankClient } from './sdk.talent-bank';\n\nexport type InitialiseInploiSdkParams = {\n\t/** Your public API key for the inploi SDK. */\n\tpublishableKey: string;\n\t/** Which app environment to run. This ultimately affects which inploi endpoints to gather data are going to be used.\n\t * Anything other than `production` should be considered a development environment and the data periodicaly purged. */\n\tenv: InploiSdkEnvironment;\n\t/** Logger object that handles logging of different levels.\n\t * You can override this to use your own logger, or to disable logging altogether by passing`false`.\n\t * @default inploiBrandedLogger\n\t * */\n\tlogger?: Logger | false;\n\n\t/** When provided, this callback will be called with every event that is logged to the analytics service. */\n\tonEvent?: AnalyticsOnEventCallback;\n};\n\nexport function initialiseSdk({\n\tpublishableKey,\n\tenv,\n\tlogger = inploiBrandedLogger,\n\tonEvent,\n}: InitialiseInploiSdkParams) {\n\t/** @deprecated - use `rpcClient` instead */\n\tconst apiClient = createApiClient({ baseUrl: ENV_TO_API_URL[env], publishableKey });\n\tconst loggerService = logger === false ? noLogging : logger;\n\tconst rpcClient = new InploiRpcClient({\n\t\tenvironment: env,\n\t\tapiKey: { type: 'publishable', key: publishableKey },\n\t\tlogger: loggerService,\n\t});\n\tconst talentBank = createTalentBankClient({ environment: env, publishableKey, logger: loggerService });\n\tconst analytics = createAnalyticsService({\n\t\trpcClient,\n\t\tlogger: loggerService,\n\t\tonEvent,\n\t\ttalentBank,\n\t});\n\n\tconst register = <P extends InploiSdkPlugin>(plugin: P): ReturnType<P> => {\n\t\treturn plugin({ logger: loggerService, apiClient, analytics, rpcClient, publishableKey, env });\n\t};\n\n\treturn { register, analytics, apiClient };\n}\n\nexport type InploiSdk = ReturnType<typeof initialiseSdk>;\n","import { CONSENT_STORAGE_KEY_PREFIX } from './sdk.constants';\n\n/**\n * Tenant-published consent / approval config (PROD-5763).\n *\n * Mirror of `ConsentConfig` in inploi/agents — the agent worker sends\n * this in the `authenticated` WS event for the SDK to render before\n * the chat is usable.\n *\n * enabled — render the consent screen on first session if true.\n * message — body copy; markdown is rendered, so customers can\n * embed links inline (e.g. \"By continuing you agree\n * to our [Privacy Policy](https://...)\").\n * acceptLabel — text on the \"agree\" button. SDK defaults to\n * \"I agree\" if omitted.\n * declineLabel — text on the \"decline\" button. SDK defaults to\n * \"Decline\".\n */\nexport interface ConsentConfig {\n\tenabled: boolean;\n\tmessage: string;\n\tacceptLabel?: string;\n\tdeclineLabel?: string;\n}\n\n/**\n * Deterministic, fast, non-cryptographic hash of the consent config.\n * Used purely as a cache-busting suffix on the localStorage key — so\n * any material wording / label change produces a new key and the\n * candidate is re-prompted. Not a security primitive.\n *\n * djb2 + base36 = ~7 chars, plenty of entropy for a per-tenant key\n * suffix and easy to eyeball / grep in devtools storage.\n *\n * Exported for unit testing.\n */\nexport function hashConsentConfig(config: ConsentConfig): string {\n\tconst canonical = JSON.stringify({\n\t\tmessage: config.message,\n\t\tacceptLabel: config.acceptLabel ?? '',\n\t\tdeclineLabel: config.declineLabel ?? '',\n\t});\n\tlet hash = 5381;\n\tfor (let i = 0; i < canonical.length; i++) {\n\t\t// djb2: hash * 33 + char\n\t\thash = (hash * 33) ^ canonical.charCodeAt(i);\n\t}\n\t// Force unsigned 32-bit, then base36 for compactness.\n\treturn (hash >>> 0).toString(36);\n}\n\n/**\n * Build the localStorage key for a (tenant × consent config) pair.\n *\n * Exported for unit testing.\n */\nexport function consentStorageKey(publishableKey: string, configHash: string): string {\n\treturn `${CONSENT_STORAGE_KEY_PREFIX}:${publishableKey}:${configHash}`;\n}\n\n/**\n * Has the candidate already accepted this exact consent config?\n *\n * Returns `false` in non-browser environments and when localStorage\n * throws (Safari private mode, sandboxed iframes without storage\n * access). Same conservative posture as `getStoredCandidateId` — if\n * we cannot prove acceptance, re-prompt.\n */\nexport function getConsentAcceptance(publishableKey: string, config: ConsentConfig): boolean {\n\tif (typeof window === 'undefined') return false;\n\ttry {\n\t\tconst key = consentStorageKey(publishableKey, hashConsentConfig(config));\n\t\treturn window.localStorage.getItem(key) === 'accepted';\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Persist the candidate's acceptance of this exact consent config.\n *\n * Silently no-ops on storage failures — the consent flow still works\n * for the current page even if we cannot remember it across reloads.\n * That matches the existing identity / candidate-id pattern.\n */\nexport function setConsentAcceptance(publishableKey: string, config: ConsentConfig): void {\n\tif (typeof window === 'undefined') return;\n\ttry {\n\t\tconst key = consentStorageKey(publishableKey, hashConsentConfig(config));\n\t\twindow.localStorage.setItem(key, 'accepted');\n\t} catch {\n\t\t// localStorage unavailable — see comment above.\n\t}\n}\n","export function ready(callback: () => void): void {\n\tif (typeof document === 'undefined') return;\n\n\tif (document.readyState === 'loading') {\n\t\tdocument.addEventListener('DOMContentLoaded', callback, { once: true });\n\t\treturn;\n\t}\n\n\tPromise.resolve().then(callback);\n}\n"],"mappings":"AAAO,IAAMA,EAAiB,iBACjBC,EAAgB,qCAUhBC,EAA8B,CAC1C,KAAM,IAAIC,IAAS,QAAQ,KAAKH,EAAgBC,EAAe,GAAGE,CAAI,EACtE,MAAO,IAAIA,IAAS,QAAQ,MAAMH,EAAgBC,EAAe,GAAGE,CAAI,EACxE,KAAM,IAAIA,IAAS,QAAQ,KAAKH,EAAgBC,EAAe,GAAGE,CAAI,EACtE,IAAK,IAAIA,IAAS,QAAQ,IAAIH,EAAgBC,EAAe,GAAGE,CAAI,CACrE,EAEaC,GAAoB,CAAE,KAAM,IAAG,GAAW,MAAO,IAAG,GAAW,IAAK,IAAG,GAAW,KAAM,IAAG,EAAU,ECW3G,IAAMC,GAA2CC,GAAgBA,ECzBjE,SAASC,GAAUC,EAAgBC,EAAqC,CAC9E,GAAI,CAAAD,EAIJ,MAAM,IAAI,MAAMC,CAAO,CACxB,CA2BO,SAASC,EAA+BC,EAAcC,EAAqC,CACjG,OAAOA,KAAQD,CAChB,CE9BA,IAAME,GAAoB,IAAI,KAAK,mBAAmB,OAAW,CAAE,QAAS,MAAO,CAAC,ECN7E,IAAMC,GAAyB,kBACzBC,GAAsB,+BAEtBC,EAAN,cAA8B,KAAM,CAE1C,YAAYC,EAAkBC,EAAiB,CAC9C,MAAMD,CAAO,EACb,KAAK,OAASC,EACd,KAAK,KAAO,iBACb,CACD,EAEaC,EAAN,cAA4BH,CAAg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C,CAC5F,GAAI,OAAO,OAAW,IAAa,MAAO,GAC1C,GAAI,CACH,IAAMS,EAAML,GAAkBC,EAAgBN,GAAkBC,CAAM,CAAC,EACvE,OAAO,OAAO,aAAa,QAAQS,CAAG,IAAM,UAC7C,MAAQ,CACP,MAAO,EACR,CACD,CASO,SAASC,GAAqBL,EAAwBL,EAA6B,CACzF,GAAI,SAAO,OAAW,KACtB,GAAI,CACH,IAAMS,EAAML,GAAkBC,EAAgBN,GAAkBC,CAAM,CAAC,EACvE,OAAO,aAAa,QAAQS,EAAK,UAAU,CAC5C,MAAQ,CAER,CACD,CC7FO,SAASE,GAAMC,EAA4B,CACjD,GAAI,SAAO,SAAa,KAExB,IAAI,SAAS,aAAe,UAAW,CACtC,SAAS,iBAAiB,mBAAoBA,EAAU,CAAE,KAAM,EAAK,CAAC,EACtE,MACD,CAEA,QAAQ,QAAQ,EAAE,KAAKA,CAAQ,EAChC","names":["CONSOLE_PREFIX","CONSOLE_STYLE","inploiBrandedLogger","args","noLogging","createPlugin","pluginFn","invariant","condition","message","hasProp","data","prop","DEFAULT_FORMATTER","unauthenticatedMessage","unauthorisedMessage","ErrorWithStatus","message","status","NotFoundError","UnauthorisedError","SchemaValidationError","issues","source","sourceText","ApiError","data","isApiErrorWithData","error","JsonParsingError","response","parseJsonResponse","response","mediaType","JsonParsingError","ERROR_MESSAGE_KEYS","getErrorMessageFromJson","json","messages","key","hasProp","value","item","handleApiExceptions","status","message","NotFoundError","unauthenticatedMessage","UnauthorisedError","unauthorisedMessage","ApiError","createApiClient","params","defaultHeaders","pathname","options","init","SdkError","SchemaValidationError","isSdkError","error","ErrorClass","version","ENV_TO_API_URL","ENV_TO_TALENT_BANK_URL","ANALYTICS_VERSION","version","ANALYTICS_COOKIE_NAME","ANALYTICS_CANDIDATE_ID_STORAGE_KEY","CONSENT_STORAGE_KEY_PREFIX","generateUUID","c","formatCookie","value","now","ANALYTICS_COOKIE_NAME","getSessionId","searchParams","isServer","fromSearchParams","fromSessionStorage","getStoredCandidateId","stored","ANALYTICS_CANDIDATE_ID_STORAGE_KEY","setStoredCandidateId","candidateId","cookieRegex","getSessionInfo","request","href","anonymous_id","session_id","cookie","getOrCreateAnonymousId","existing","newId","generateUUID","getSessionInfoFromResponse","response","serverReferrer","referrer","analyticsLogEndpoint","typed","createAnalyticsService","rpcClient","logger","onEvent","talentBank","params","invariant","page","context","ANALYTICS_VERSION","sessionInfo","resolvedCandidateId","identifyProperties","result","payload","responseJson","newSession","e","headers","stringify","parse","schema","input","source","result","SchemaValidationError","safeParse","e","InploiRpcClient","params","ENV_TO_API_URL","endpoint","options","validateIn","searchParams","body","validateEndpointInputs","url","pathname","key","value","stringify","json","parseJsonResponse","handleApiExceptions","fetchParams","response","typed","validatedInputs","v","CANDIDATE_SOURCES","STAGE_GROUPS","SCORE_TYPES","INTERVIEW_STATUSES","DUPLICATE_CHECK_SCOPES","APPLICATION_SORT_FIELDS","SORT_ORDERS","APPLICATION_SOURCES","APPLICATION_ACTIONS","ACTOR_TYPES","CandidateSourceSchema","CANDIDATE_SOURCES","StageGroupSchema","STAGE_GROUPS","StageSchema","ScoreTypeSchema","InterviewStatusSchema","DuplicateCheckScopeSchema","ApplicationSortFieldSchema","SortOrderSchema","DisqualificationReasonSchema","ApplicationSourceSchema","ApplicationActionSchema","ActorTypeSchema","ActorInputSchema","v","PaginationSchema","paginatedResultSchema","itemSchema","v","CandidateSchema","CandidateSourceSchema","v","v","RequiredStringSchema","PositiveIntegerSchema","UnknownRecordSchema","v","InterviewSchema","InterviewStatusSchema","UnknownRecordSchema","ScoreCategorySchema","ApplicationSchema","StageSchema","StageGroupSchema","DisqualificationReasonSchema","ApplicationSourceSchema","UnknownRecordSchema","ApplicationScoreSchema","ScoreTypeSchema","ApplicationDetailSchema","CandidateSchema","InterviewSchema","CandidateDetailSchema","ApplicationLogSchema","ApplicationActionSchema","ActorTypeSchema","IdentifyInputSchema","RequiredStringSchema","CandidateSourceSchema","IdentifyResultSchema","v","APPLY_ACTION_KEYS","ApplyActionKeySchema","CommaSeparatedStringSchema","s","t","StagesQuerySchema","StageSchema","StageGroupsQuerySchema","StageGroupSchema","JobIdsQuerySchema","ListApplicationsQuerySchema","ApplicationSortFieldSchema","SortOrderSchema","SubmitApplicationInputSchema","RequiredStringSchema","PositiveIntegerSchema","UnknownRecordSchema","ApplicationSourceSchema","ActorInputSchema","input","DuplicateApplicationSchema","SubmitApplicationResultSchema","DuplicateCheckResultSchema","WriteScoreInputSchema","ScoreTypeSchema","ScoreCategorySchema","WriteScoreResponseSchema","ListApplicationsResponseSchema","paginatedResultSchema","ApplicationDetailSchema","TransitionSkipReasonSchema","ListApplicationLogsResponseSchema","ApplicationLogSchema","NoteMeta","StageSchema","HireMeta","ApplyActionInputSchema","ActorInputSchema","StageGroupSchema","DisqualificationReasonSchema","BulkApplyActionInputSchema","ApplyActionSkipReasonSchema","ApplyActionResultSchema","ApplyActionKeySchema","ApplicationDetailSchema","BulkApplyActionResultSchema","NonNegativeIntegerSchema","JobApplicationCountsSchema","ListJobApplicationCountsQuerySchema","JobIdsQuerySchema","ListJobApplicationCountsResponseSchema","ListCandidatesResponseSchema","paginatedResultSchema","CandidateSchema","v","JobMetricsResponseSchema","v","createTalentBankClient","environment","publishableKey","logger","baseUrl","ENV_TO_TALENT_BANK_URL","params","searchParams","response","json","parsed","DuplicateCheckResultSchema","e","body","parsedBody","IdentifyInputSchema","IdentifyResultSchema","initialiseSdk","publishableKey","env","logger","inploiBrandedLogger","onEvent","apiClient","createApiClient","ENV_TO_API_URL","loggerService","noLogging","rpcClient","InploiRpcClient","talentBank","createTalentBankClient","analytics","createAnalyticsService","plugin","hashConsentConfig","config","canonical","hash","i","consentStorageKey","publishableKey","configHash","CONSENT_STORAGE_KEY_PREFIX","getConsentAcceptance","key","setConsentAcceptance","ready","callback"]}
1
+ {"version":3,"sources":["../src/sdk.logger.ts","../src/sdk.plugins.ts","../../core/src/common/common.utils.ts","../../core/src/common/common.currency.ts","../../core/src/common/common.datetime.ts","../src/sdk.api.ts","../package.json","../src/sdk.constants.ts","../src/sdk.uuid.ts","../src/sdk.analytics.ts","../src/sdk.rpc.ts","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/enums.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/pagination.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/candidate.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/application.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/_shared.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/interview.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/http/identify.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/http/applications.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/http/candidates.js","../../../node_modules/.pnpm/@inploi+talent-bank@git+https+++github.com+inploi+talent-bank.git+e587d4a8a0f9ebf12e243_6505c42bf184afa1a4720595db56836f/node_modules/@inploi/talent-bank/dist/contract/http/metrics.js","../src/sdk.talent-bank.ts","../src/sdk.ts","../src/sdk.consent.ts","../src/ready.ts"],"sourcesContent":["export const CONSOLE_PREFIX = '%c[inploi SDK]';\nexport const CONSOLE_STYLE = 'color: #65BC67; font-weight: bold;';\n\ntype LogMessage = (...data: any[]) => void;\nexport type Logger = {\n\twarn: LogMessage;\n\terror: LogMessage;\n\tinfo: LogMessage;\n\tlog: LogMessage;\n};\n\nexport const inploiBrandedLogger: Logger = {\n\twarn: (...args) => console.warn(CONSOLE_PREFIX, CONSOLE_STYLE, ...args),\n\terror: (...args) => console.error(CONSOLE_PREFIX, CONSOLE_STYLE, ...args),\n\tinfo: (...args) => console.info(CONSOLE_PREFIX, CONSOLE_STYLE, ...args),\n\tlog: (...args) => console.log(CONSOLE_PREFIX, CONSOLE_STYLE, ...args),\n};\n\nexport const noLogging: Logger = { info: () => void 0, error: () => void 0, log: () => void 0, warn: () => void 0 };\n","import { AnalyticsService } from './sdk.analytics';\nimport { ApiClient } from './sdk.api';\nimport { InploiSdkEnvironment } from './sdk.constants';\nimport { Logger } from './sdk.logger';\nimport { InploiRpcClient } from './sdk.rpc';\n\nexport type PluginParams = {\n\tapiClient: ApiClient;\n\tlogger: Logger;\n};\n\nexport type Plugin<T extends string, P extends Record<string, unknown>> = {\n\tpluginName: T;\n\tpure_createActions: (params: PluginParams) => P;\n};\n\ntype PluginDependencies = {\n\tapiClient: ApiClient;\n\trpcClient: InploiRpcClient;\n\tlogger: Logger;\n\tanalytics: AnalyticsService;\n\t/** The publishable key used to initialise the SDK (available when registered via initialiseSdk) */\n\tpublishableKey?: string;\n\t/** The environment the SDK was initialised with — plugins can use this to select the correct service URL */\n\tenv?: InploiSdkEnvironment;\n};\n\nexport type InploiSdkPlugin = (dependencies: PluginDependencies) => any;\n\nexport const createPlugin = <T extends InploiSdkPlugin>(pluginFn: T) => pluginFn;\n","export const exhaustive = (value: never) => {\n\tthrow new Error(`Unhandled discriminated union member: ${JSON.stringify(value)}`);\n};\n\nexport function invariant(condition: any, message?: string): asserts condition {\n\tif (condition) {\n\t\treturn;\n\t}\n\n\tthrow new Error(message);\n}\n\nexport const uniqueOrThrow = <T>(array: T[]) => {\n\tconst uniqueValues = new Set(array);\n\n\tif (array.length !== uniqueValues.size) {\n\t\tthrow new Error('Duplicate values found');\n\t}\n\treturn true;\n};\n\nexport const uniqueByPropertyOrThrow =\n\t<T extends PropertyKey>(propertyKey: T) =>\n\t(array: { [K in T]: any }[]) => {\n\t\tconst values = array.map(item => item[propertyKey]);\n\t\tconst uniqueValues = new Set(values);\n\n\t\tif (values.length !== uniqueValues.size) {\n\t\t\tthrow new Error(`Duplicate values found for property: ${propertyKey.toString()}`);\n\t\t}\n\t\treturn true;\n\t};\n\n/**\n * A destructive way to ensure an object has a property.\n * This is useful when working with unknowns.\n */\nexport function hasProp<K extends PropertyKey>(data: object, prop: K): data is Record<K, unknown> {\n\treturn prop in data;\n}\n\n/**\n * A sort of type-safe way to check whether a key exists in an object.\n */\nexport function isKeyInObj<O extends Record<string, unknown>>(key: PropertyKey, obj: O): key is keyof O {\n\treturn key in obj;\n}\n","type TFunction = (key: 'competitive' | 'invalid_salary' | 'from' | 'up_to') => string;\n\ninterface SalaryParams {\n\tpay: string | null;\n\tpay_min: string | null;\n\tpay_mask: boolean;\n\tpay_max: string | null;\n\tpay_type: 'ANNUALLY' | 'HOURLY' | 'MONTHLY' | 'WEEKLY' | 'DAILY' | null;\n\tpay_currency: string;\n\tpay_display: boolean;\n}\n\nconst payPeriods: Record<NonNullable<SalaryParams['pay_type']>, string> = {\n\tANNUALLY: 'per year',\n\tDAILY: 'per day',\n\tHOURLY: 'per hour',\n\tMONTHLY: 'per month',\n\tWEEKLY: 'per week',\n};\n\nexport const getSalaryAsText = (params: {\n\tsalary: SalaryParams;\n\tconfig: { locales: string | string[] | undefined };\n\tt?: TFunction;\n}) => {\n\tconst { salary, config, t = s => s } = params;\n\tconst numberFormatter = new Intl.NumberFormat(config.locales, {\n\t\tstyle: 'currency',\n\t\tcurrency: salary.pay_currency,\n\t\ttrailingZeroDisplay: 'stripIfInteger',\n\t});\n\tif (salary.pay_display === false) return undefined;\n\tif (salary.pay === null && salary.pay_min === null && salary.pay_max === null) return undefined;\n\tif (salary.pay_mask) return t('competitive');\n\n\tif (salary.pay_max && Number.isNaN(+salary.pay_max)) return t('invalid_salary');\n\tif (salary.pay_min && Number.isNaN(+salary.pay_min)) return t('invalid_salary');\n\tif (salary.pay && Number.isNaN(+salary.pay)) return t('invalid_salary');\n\n\tconst period = salary.pay_type && salary.pay_type in payPeriods ? payPeriods[salary.pay_type] : undefined;\n\n\tif (salary.pay) return [numberFormatter.format(+salary.pay), period].filter(Boolean).join(' ');\n\n\tif (salary.pay_max && salary.pay_min)\n\t\treturn [numberFormatter.formatRange(+salary.pay_min, +salary.pay_max), period].filter(Boolean).join(' ') || '';\n\n\tif (salary.pay_max)\n\t\treturn `${t('up_to')} ${[numberFormatter.format(+salary.pay_max), period].filter(Boolean).join(' ')}`;\n\tif (salary.pay_min)\n\t\treturn `${t('from')} ${[numberFormatter.format(+salary.pay_min), period].filter(Boolean).join(' ')}`;\n\treturn t('invalid_salary');\n};\n","type TFunction = (key: 'today' | 'over_30_days_ago' | 'in_over_30_days') => string;\n\ntype Params = {\n\tfrom?: Date;\n\tto: string | number | Date;\n\tformatter?: Intl.RelativeTimeFormat;\n\tt?: TFunction;\n};\n\nconst DEFAULT_FORMATTER = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });\n/** From a date, calculates the relative time difference from now */\nexport const getRelativeTimeDifference = ({\n\tfrom = new Date(),\n\tto,\n\tformatter = DEFAULT_FORMATTER,\n\tt = s => s,\n}: Params) => {\n\tconst then = to instanceof Date ? to : new Date(to);\n\tconst diff = then.getTime() - from.getTime();\n\n\tconst diffIn = {\n\t\tdays: Math.round(diff / 1000 / 60 / 60 / 24),\n\t\tmonths: Math.round(diff / 1000 / 60 / 60 / 24 / 30),\n\t};\n\n\tif (diffIn.days === 0) return t('today');\n\tif (Math.abs(diffIn.days) < 30) return formatter.format(diffIn.days, 'days');\n\tif (Math.abs(diffIn.days) < 3) return formatter.format(diffIn.months, 'months');\n\treturn diffIn.months < 0 ? t('over_30_days_ago') : t('in_over_30_days');\n};\n","import { hasProp } from '@inploi/core/common';\nimport { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport const unauthenticatedMessage = 'Unauthenticated';\nexport const unauthorisedMessage = 'This action is unauthorized.';\n\nexport class ErrorWithStatus extends Error {\n\tpublic status?: number;\n\tconstructor(message?: string, status?: number) {\n\t\tsuper(message);\n\t\tthis.status = status;\n\t\tthis.name = 'ErrorWithStatus';\n\t}\n}\n\nexport class NotFoundError extends ErrorWithStatus {\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Not found');\n\t\tthis.name = 'NotFoundError';\n\t\tthis.status = 404;\n\t}\n}\n\nexport class UnauthorisedError extends ErrorWithStatus {\n\tconstructor(message?: string, status?: number) {\n\t\tsuper(message ?? 'You are not authorised to perform this action.');\n\t\tthis.name = 'UnauthorisedError';\n\t\tthis.status = status ?? 401;\n\t}\n}\n\nexport class SchemaValidationError extends ErrorWithStatus {\n\tconstructor(\n\t\tpublic issues: readonly StandardSchemaV1.Issue[],\n\t\tpublic source?: 'body' | 'searchParams' | 'response',\n\t) {\n\t\tconst sourceText = source ? ` in ${source}` : '';\n\t\tsuper(`Schema validation failed${sourceText}`);\n\t\tthis.name = 'SchemaValidationError';\n\t\tthis.status = 400;\n\t}\n}\n\nexport class ApiError extends ErrorWithStatus {\n\tconstructor(\n\t\tmessage: string,\n\t\tstatus?: number,\n\t\tpublic data?: unknown,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'ApiError';\n\t\tthis.status = status ?? 500;\n\t}\n}\n\nexport const isApiErrorWithData = (error: unknown): error is ApiError & { data: unknown } =>\n\terror instanceof ApiError && error.data !== undefined;\n\nexport class JsonParsingError extends ErrorWithStatus {\n\tpublic contentType?: string;\n\n\tconstructor(public response?: Response) {\n\t\tsuper('Error parsing response into JSON.');\n\t\tthis.name = 'ParsingError';\n\t\tthis.status = response && response.status >= 300 ? response.status : 500;\n\t\tthis.contentType = new Headers(response?.headers).get('content-type') ?? undefined;\n\t}\n}\n\n/** @deprecated - use `JsonParsingError` instead */\nexport class ParsingError extends JsonParsingError {}\n\nexport type ApiClient = {\n\tfetch: (pathname: string, options?: RequestInit) => Promise<unknown>;\n};\n\nexport async function parseJsonResponse(response: Response): Promise<unknown> {\n\tconst contentType = new Headers(response.headers).get('content-type');\n\tconst mediaType = contentType?.replace(/;.*/, '').trim().toLowerCase();\n\tif (mediaType && mediaType !== 'application/json' && !mediaType.endsWith('+json')) {\n\t\tthrow new JsonParsingError(response);\n\t}\n\n\treturn response.json().catch(() => {\n\t\tthrow new JsonParsingError(response);\n\t});\n}\n\nconst ERROR_MESSAGE_KEYS = ['message', 'error', 'errors', 'exception', 'exceptions'] as const;\nfunction getErrorMessageFromJson(json: unknown): string {\n\tconst messages: string[] = [];\n\tif (typeof json === 'object' && json !== null) {\n\t\tfor (const key of ERROR_MESSAGE_KEYS) {\n\t\t\tif (hasProp(json, key)) {\n\t\t\t\tconst value = json[key];\n\t\t\t\tif (typeof value === 'string') messages.push(value);\n\t\t\t\tif (Array.isArray(value) && value.every((item): item is string => typeof item === 'string'))\n\t\t\t\t\tmessages.push(...value);\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\thasProp(json, 'integration_response') &&\n\t\t\ttypeof json.integration_response === 'object' &&\n\t\t\tjson.integration_response !== null &&\n\t\t\thasProp(json.integration_response, 'error') &&\n\t\t\ttypeof json.integration_response.error === 'object' &&\n\t\t\tjson.integration_response.error !== null &&\n\t\t\thasProp(json.integration_response.error, 'message') &&\n\t\t\ttypeof json.integration_response.error.message === 'string'\n\t\t) {\n\t\t\tmessages.push(json.integration_response.error.message);\n\t\t}\n\t}\n\tif (messages.length === 0) messages.push('Unknown error');\n\treturn [...new Set(messages)].join(', ');\n}\n\n/** Throws branded errors when API returns a known error. */\nexport function handleApiExceptions(json: unknown, status: number) {\n\tif (status >= 300) {\n\t\tconst message = getErrorMessageFromJson(json);\n\t\tif (status === 404) {\n\t\t\tthrow new NotFoundError(message);\n\t\t}\n\t\tif (message === unauthenticatedMessage) {\n\t\t\tthrow new UnauthorisedError('You are not authenticated.', status);\n\t\t}\n\t\tif (message === unauthorisedMessage) {\n\t\t\tthrow new UnauthorisedError(message, status);\n\t\t}\n\t\tthrow new ApiError(message, status, json);\n\t}\n}\n\nexport const createApiClient = (params: { baseUrl: string; publishableKey: string }): ApiClient => {\n\tconst defaultHeaders: HeadersInit = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t\t'x-publishable-key': params.publishableKey,\n\t};\n\n\treturn {\n\t\t/** Fetches from a pathname with a pre-established base path.\n\t\t * Parses received output as JSON, and throw if one of the common error messages is received.\n\t\t */\n\t\tfetch: async (pathname, options = {}) => {\n\t\t\tconst init = { ...options, headers: { ...options.headers, ...defaultHeaders } };\n\t\t\tconst response = await fetch(`${params.baseUrl}${pathname}`, init);\n\t\t\tif (response.status === 404) throw new NotFoundError();\n\n\t\t\tconst json = await parseJsonResponse(response);\n\n\t\t\thandleApiExceptions(json, response.status);\n\n\t\t\t// We’re assuming no other exceptions have happened.\n\t\t\treturn json;\n\t\t},\n\t};\n};\n\nexport const SdkError = {\n\tNotFound: NotFoundError,\n\tUnauthorised: UnauthorisedError,\n\tSchemaValidation: SchemaValidationError,\n\tApi: ApiError,\n\tJsonParsing: JsonParsingError,\n};\n\nexport function isSdkError(error: unknown): error is (typeof SdkError)[keyof typeof SdkError] {\n\treturn Object.values(SdkError).some(ErrorClass => error instanceof ErrorClass);\n}\n","{\n\t\"name\": \"@inploi/sdk\",\n\t\"version\": \"2.3.3\",\n\t\"main\": \"dist/index.js\",\n\t\"types\": \"dist/index.d.ts\",\n\t\"license\": \"MIT\",\n\t\"files\": [\n\t\t\"/dist\",\n\t\t\"/cdn\"\n\t],\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"require\": \"./dist/index.js\",\n\t\t\t\"import\": \"./dist/index.mjs\",\n\t\t\t\"types\": \"./dist/index.d.ts\"\n\t\t}\n\t},\n\t\"scripts\": {\n\t\t\"build:npm\": \"tsup --dts --dts-resolve && node scripts/check-npm-bundle.mjs\",\n\t\t\"build:cdn\": \"tsup --config tsup.cdn.config.ts\",\n\t\t\"build\": \"concurrently 'pnpm run build:npm' 'pnpm run build:cdn'\",\n\t\t\"dev\": \"tsup --watch --config tsup.cdn.config.ts\",\n\t\t\"check\": \"eslint src --fix --max-warnings 0 && tsc\",\n\t\t\"test\": \"bun test\",\n\t\t\"test:coverage\": \"bun test --coverage --coverage-reporter=lcov\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@happy-dom/global-registrator\": \"^13.6.2\",\n\t\t\"@inploi/core\": \"workspace:*\",\n\t\t\"@inploi/talent-bank\": \"github:inploi/talent-bank#e587d4a8a0f9ebf12e24393b3d917bf095ddf908\",\n\t\t\"@total-typescript/ts-reset\": \"^0.5.1\",\n\t\t\"@types/bun\": \"^1.2.5\",\n\t\t\"@types/react\": \"^18.2.33\",\n\t\t\"@types/react-dom\": \"^18.2.14\",\n\t\t\"autoprefixer\": \"^10.4.16\",\n\t\t\"concurrently\": \"9.1.2\",\n\t\t\"eslint\": \"^7.32.0\",\n\t\t\"eslint-config-custom\": \"workspace:*\",\n\t\t\"happy-dom\": \"^12.6.0\",\n\t\t\"ts-toolbelt\": \"^9.6.0\",\n\t\t\"tsconfig\": \"workspace:*\",\n\t\t\"tsup\": \"^7.2.0\"\n\t},\n\t\"dependencies\": {\n\t\t\"@standard-schema/spec\": \"^1.0.0\",\n\t\t\"neoqs\": \"^6.13.0\",\n\t\t\"valibot\": \"^1.3.1\"\n\t}\n}\n","import { version } from '../package.json';\n\n/**\n * The environment the SDK should run in.\n * - `production`: data will be stored and displayed on dashboards\n * - `sandbox`: data will be stored temporarily and purged periodically\n */\nexport type InploiSdkEnvironment = 'production' | 'sandbox';\n\nexport const ENV_TO_API_URL: Record<InploiSdkEnvironment, string> = {\n\tsandbox: 'https://api.staging.inploi.com',\n\tproduction: 'https://api.inploi.com',\n\t// @ts-expect-error - local test environment\n\t_internal_local: 'http://api.test',\n};\n\nexport const ENV_TO_TALENT_BANK_URL: Record<InploiSdkEnvironment, string> = {\n\tsandbox: 'https://talent-bank.staging.inploi.com',\n\tproduction: 'https://talent-bank.inploi.com',\n\t// @ts-expect-error - local test environment\n\t_internal_local: 'http://localhost:8787',\n};\n\nexport const ANALYTICS_VERSION = version;\n\nexport const LOG_PATHNAME = '/log';\n\nexport const ANALYTICS_COOKIE_NAME = 'isdk_session';\n\n/**\n * Local-storage key used to persist the Talent Bank `candidateId` once the\n * user has identified via the SDK. The SDK forwards this id on every\n * subsequent analytics log request so Laravel can stamp it onto the session.\n */\nexport const ANALYTICS_CANDIDATE_ID_STORAGE_KEY = `${ANALYTICS_COOKIE_NAME}-candidate_id`;\n\n/**\n * Local-storage key prefix for the candidate's consent / approval state\n * (PROD-5763). The final key is composed of:\n *\n * `${CONSENT_STORAGE_KEY_PREFIX}:<publishableKey>:<configHash>`\n *\n * The `configHash` is a deterministic hash of the consent message +\n * labels. Any material wording change produces a new hash → new\n * storage key → candidate is automatically re-prompted, without the\n * customer having to manage a `version` field manually.\n *\n * Per-tenant scoping (the `publishableKey` segment) matters because\n * the consent UI runs inside the Kin iframe at `sdk.inploi.com`, so\n * one origin's localStorage is shared across every tenant a candidate\n * has visited from this browser.\n */\nexport const CONSENT_STORAGE_KEY_PREFIX = `${ANALYTICS_COOKIE_NAME}-consent`;\n","/**\n * Generates a RFC 4122 v4 UUID.\n *\n * `crypto.randomUUID()` is only available in secure contexts (HTTPS). This\n * utility falls back to `crypto.getRandomValues`, which is available in all\n * browsing contexts including HTTP, so the SDK works on non-HTTPS staging\n * environments.\n */\nexport const generateUUID = (): `${string}-${string}-${string}-${string}-${string}` => {\n\tif (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n\t\treturn crypto.randomUUID();\n\t}\n\n\treturn '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, c =>\n\t\t(+c ^ (crypto.getRandomValues(new Uint8Array(1))[0]! & (15 >> (+c / 4)))).toString(16),\n\t) as `${string}-${string}-${string}-${string}-${string}`;\n};\n","import type { ResponseObj } from '@inploi/core/common';\nimport { invariant } from '@inploi/core/common';\n\nimport { InploiRpcClient, Logger, endpoint, typed } from '.';\nimport {\n\tANALYTICS_CANDIDATE_ID_STORAGE_KEY,\n\tANALYTICS_COOKIE_NAME,\n\tANALYTICS_VERSION,\n} from './sdk.constants';\nimport type { TalentBankClient } from './sdk.talent-bank';\nimport { generateUUID } from './sdk.uuid';\n\nconst formatCookie = (value: string) => {\n\tconst now = new Date();\n\tnow.setTime(now.getTime() + 7 * 24 * 60 * 60 * 1000); // 7 days expiration\n\n\treturn `${ANALYTICS_COOKIE_NAME}=${value};expires=${now.toUTCString()};path=/`;\n};\n\ntype FlowProperties = { flow_id: string; flow_version: number; flow_session_id: string; flow_build: number };\n\nexport type FlowType = 'CHATBOT_DRAWER' | 'FORM_DRAWER' | 'FORM_EMBED';\n\ntype FunnelFlowProperties = FlowProperties & { flow_type?: FlowType };\n\ntype JobProperties = {\n\tid: string;\n\tid_type: 'internal' | 'external';\n};\n\nexport type AnalyticsLogParams =\n\t| {\n\t\t\tevent: 'VIEW_JOB';\n\t\t\tproperties: { job: JobProperties };\n\t }\n\t| {\n\t\t\tevent: 'FLOW_REDIRECT';\n\t\t\tproperties: { href: string; job: JobProperties | undefined } & FlowProperties;\n\t }\n\t| {\n\t\t\tevent: 'FLOW_START' | 'FLOW_INTERACT';\n\t\t\tproperties: { job: JobProperties | undefined } & FunnelFlowProperties;\n\t }\n\t| {\n\t\t\tevent: 'FLOW_END';\n\t\t\tproperties: { job: JobProperties | undefined } & FlowProperties;\n\t }\n\t| {\n\t\t\tevent: 'FLOW_SUBMIT';\n\t\t\tproperties: {\n\t\t\t\tservice: string;\n\t\t\t\t/** Confirmed first-apply capture, even when downstream delivery failed. */\n\t\t\t\tcaptured?: boolean;\n\t\t\t\tresponse: {\n\t\t\t\t\tstatus: number;\n\t\t\t\t\tpayload: unknown;\n\t\t\t\t};\n\t\t\t\tjob: JobProperties | undefined;\n\t\t\t\t/**\n\t\t\t\t * Set when the provider confirmed a duplicate (distinguishing one within an hour of the candidate's own\n\t\t\t\t * failed attempt on that application), or when the API accepted the application for later delivery (`pending`).\n\t\t\t\t */\n\t\t\t\toutcome?: 'duplicate' | 'duplicate_after_own_attempt' | 'pending';\n\t\t\t} & FunnelFlowProperties;\n\t }\n\t| {\n\t\t\tevent: 'SUBMIT_FORM' | 'VIEW_PAGE';\n\t\t\tproperties?: {\n\t\t\t\tjob: JobProperties | undefined;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'IDENTIFY';\n\t\t\tproperties: {\n\t\t\t\tidentifier: string;\n\t\t\t\tfirst_name?: string;\n\t\t\t\tlast_name?: string;\n\t\t\t\tphone_number?: string;\n\t\t\t\temail?: string;\n\t\t\t\tcustom_traits?: Record<string, unknown>;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'SEARCH_PAGINATE';\n\t\t\tproperties: {\n\t\t\t\tquery?: string;\n\t\t\t\tfilters?: Record<string, string[]>;\n\t\t\t\tdefault_filters?: Record<string, string[]>;\n\t\t\t\ttotal_count: number;\n\t\t\t\tpage_size: number;\n\t\t\t\tpage: number;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'SEARCH_SETTLE';\n\t\t\tproperties: {\n\t\t\t\tquery?: string;\n\t\t\t\tfilters?: Record<string, string[]>;\n\t\t\t\tdefault_filters?: Record<string, string[]>;\n\t\t\t\ttotal_count: number;\n\t\t\t\tpage_size: number;\n\t\t\t\tpage: number;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'SEARCH_JOB_CLICK';\n\t\t\tproperties: {\n\t\t\t\tjob_id: number;\n\t\t\t\tquery?: string;\n\t\t\t\tfilters?: Record<string, string[]>;\n\t\t\t\tdefault_filters?: Record<string, string[]>;\n\t\t\t\ttotal_count: number;\n\t\t\t\tpage_size: number;\n\t\t\t\tpage: number;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'VIEW_SEARCH';\n\t\t\tproperties: {\n\t\t\t\tquery?: string;\n\t\t\t\tfilters?: Record<string, string[]>;\n\t\t\t\tdefault_filters?: Record<string, string[]>;\n\t\t\t\ttotal_count: number;\n\t\t\t\tpage_size: number;\n\t\t\t\tpage: number;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'FEEDBACK';\n\t\t\tproperties: {\n\t\t\t\tkey: string;\n\t\t\t\tscore?: -1 | 0 | 1;\n\t\t\t\tcomment?: string;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'LINK_CLICK';\n\t\t\tproperties: {\n\t\t\t\ttarget_href: string;\n\t\t\t\tjob_id: string | undefined;\n\t\t\t};\n\t }\n\t| {\n\t\t\tevent: 'INTERACTION';\n\t\t\tproperties: {\n\t\t\t\ttag: string;\n\t\t\t};\n\t };\n\nexport type AnalyticsLogEvent = AnalyticsLogParams['event'];\n\ntype EventPropertyMap = {\n\t[Param in AnalyticsLogParams as Param['event']]: Omit<Param, 'event'>;\n};\n\ntype AnalyticsContext = {\n\tlibrary: {\n\t\tname: 'inploi-sdk';\n\t\tversion: string;\n\t};\n\tpage: {\n\t\thref: string;\n\t\treferrer: string;\n\t\ttitle: string;\n\t};\n};\n\ntype TrackPayload<P = EventPropertyMap[keyof EventPropertyMap]['properties']> = {\n\tanonymous_id: string | null;\n\tsession_id: string | null;\n\t/**\n\t * Talent Bank candidate id — set once the SDK has identified the user\n\t * (via `TalentBankClient.identify`). Laravel's session middleware reads\n\t * this and stamps it onto `session.context.candidate_id` for attribution.\n\t * `null` for anonymous / unidentified users.\n\t */\n\tcandidate_id: string | null;\n\tevent: AnalyticsLogEvent;\n\tsent_at: string;\n\tcontext: AnalyticsContext;\n\tproperties: P;\n\tcustom_properties?: Record<string, unknown>;\n};\n\ntype LogFnParams<T extends keyof EventPropertyMap> = {\n\tevent: T;\n\tcustomProperties?: Record<string, unknown>;\n\t/** Passing a request will make logging possible on a server environment. */\n\trequest?: Request;\n} & EventPropertyMap[T];\n\ntype LogFn = <TEvent extends keyof EventPropertyMap>(\n\tparams: LogFnParams<TEvent>,\n) => Promise<ResponseObj<TrackPayload<EventPropertyMap[TEvent]['properties']>>>;\n\nexport type AnalyticsService = {\n\tlog: LogFn;\n\t/** From a log payload data, generate headers to use in server environments to update the anonymous_id */\n\tgetHeaders: (payload?: TrackPayload) => Headers;\n\tgetSessionInfo: typeof getSessionInfo;\n};\n\nconst getSessionId = (searchParams: URLSearchParams, isServer: boolean) => {\n\tconst fromSearchParams = searchParams.get('session_id');\n\tif (isServer) return fromSearchParams;\n\tif (fromSearchParams) return fromSearchParams;\n\tconst fromSessionStorage = sessionStorage.getItem(`${ANALYTICS_COOKIE_NAME}-session_id`);\n\tif (typeof fromSessionStorage === 'string') return fromSessionStorage;\n\treturn null;\n};\n\n/**\n * Read the cached Talent Bank candidate id from localStorage.\n *\n * Returns `null` in non-browser / no-localStorage environments so server-side\n * logging and tests don't explode.\n */\nconst getStoredCandidateId = (): string | null => {\n\tif (typeof window === 'undefined') return null;\n\ttry {\n\t\tconst stored = window.localStorage.getItem(ANALYTICS_CANDIDATE_ID_STORAGE_KEY);\n\t\treturn typeof stored === 'string' && stored !== '' ? stored : null;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\nconst setStoredCandidateId = (candidateId: string | null): void => {\n\tif (typeof window === 'undefined') return;\n\ttry {\n\t\tif (candidateId) {\n\t\t\twindow.localStorage.setItem(ANALYTICS_CANDIDATE_ID_STORAGE_KEY, candidateId);\n\t\t} else {\n\t\t\twindow.localStorage.removeItem(ANALYTICS_CANDIDATE_ID_STORAGE_KEY);\n\t\t}\n\t} catch {\n\t\t// localStorage may be unavailable (Safari private mode, sandboxed\n\t\t// iframes, etc). Identification still works for the current page — we\n\t\t// just won't remember it across reloads.\n\t}\n};\n\nconst cookieRegex = new RegExp(`${ANALYTICS_COOKIE_NAME}=([^;]+)`);\nconst getSessionInfo = (request?: Request) => {\n\tconst href = request ? request.url : location.href;\n\tconst { searchParams } = new URL(href);\n\tconst anonymous_id = searchParams.get('anonymous_id');\n\tconst session_id = getSessionId(searchParams, typeof window === 'undefined');\n\n\t// If there's an anonymous_id in the search params, use it\n\tif (anonymous_id)\n\t\treturn {\n\t\t\tanonymous_id,\n\t\t\tsession_id,\n\t\t};\n\n\t// If there's a cookie, use it\n\tconst cookie = request ? request.headers.get('cookie') : document.cookie;\n\tif (cookie) {\n\t\tconst match = cookieRegex.exec(cookie);\n\t\tconst anonymous_id = match?.[1];\n\t\treturn {\n\t\t\tanonymous_id: anonymous_id ?? null,\n\t\t\tsession_id,\n\t\t};\n\t}\n\n\t// Otherwise, return what we have\n\treturn {\n\t\tanonymous_id,\n\t\tsession_id,\n\t};\n};\n\n/**\n * Get or create a persistent anonymous ID.\n *\n * This is the universal identifier that bridges:\n * - SDK analytics (Laravel tracking)\n * - Agent conversations (Durable Object routing)\n * - Identity resolution\n *\n * The ID is:\n * - Generated client-side if none exists\n * - Persisted in cookie for 7 days\n * - The same across all SDK plugins\n *\n * @returns The anonymous ID (existing or newly generated)\n */\nexport const getOrCreateAnonymousId = (): string => {\n\t// Server-side: cannot generate, return empty (should not happen in normal flow)\n\tif (typeof window === 'undefined') {\n\t\tthrow new Error('getOrCreateAnonymousId() can only be called in browser environment');\n\t}\n\n\t// Check existing sources first\n\tconst existing = getSessionInfo().anonymous_id;\n\tif (existing) return existing;\n\n\t// Generate new ID and immediately persist to cookie\n\tconst newId = generateUUID();\n\tdocument.cookie = formatCookie(newId);\n\treturn newId;\n};\n\nconst getSessionInfoFromResponse = (response: unknown) => {\n\tif (typeof response !== 'object' || response === null) return null;\n\treturn {\n\t\tanonymous_id:\n\t\t\t'anonymous_id' in response && typeof response.anonymous_id === 'string' ? response.anonymous_id : null,\n\t\tsession_id: 'session_id' in response && typeof response.session_id === 'string' ? response.session_id : null,\n\t};\n};\n\nconst serverReferrer = (referrer: typeof Request.prototype.referrer) => {\n\tif (referrer === 'about:client') return '';\n\treturn referrer;\n};\n\nconst analyticsLogEndpoint = endpoint({\n\tpathname: '/log',\n\tmethod: 'POST',\n\tschema: {\n\t\tresponse: typed<unknown>(),\n\t\tbody: typed<TrackPayload>(),\n\t},\n});\n\nexport type AnalyticsOnEventCallback = (event: AnalyticsLogParams) => void;\n\nexport const createAnalyticsService = ({\n\trpcClient,\n\tlogger,\n\tonEvent,\n\ttalentBank,\n}: {\n\tlogger: Logger;\n\trpcClient: InploiRpcClient;\n\tonEvent?: AnalyticsOnEventCallback;\n\t/**\n\t * Optional Talent Bank client. When provided, `IDENTIFY` events are sent\n\t * directly to Talent Bank's `POST /identify` (in addition to Laravel's\n\t * `/log`), and the returned `candidateId` is cached locally and forwarded\n\t * on every subsequent log call.\n\t */\n\ttalentBank?: TalentBankClient;\n}): AnalyticsService => {\n\tconst logFn: LogFn = async params => {\n\t\tinvariant(\n\t\t\tparams.request || typeof window !== 'undefined',\n\t\t\t'Cannot log on the server without a request. Please pass a request to `log`.',\n\t\t);\n\n\t\t// if there’s a request, use it instead of browser APIs\n\t\tconst page =\n\t\t\t'request' in params && params.request ?\n\t\t\t\t{\n\t\t\t\t\thref: params.request.url,\n\t\t\t\t\treferrer: serverReferrer(params.request.referrer),\n\t\t\t\t\ttitle: '',\n\t\t\t\t}\n\t\t\t:\t{\n\t\t\t\t\thref: location.href,\n\t\t\t\t\treferrer: document.referrer,\n\t\t\t\t\ttitle: document.title,\n\t\t\t\t};\n\n\t\ttry {\n\t\t\tconst context: AnalyticsContext = {\n\t\t\t\tlibrary: {\n\t\t\t\t\tname: 'inploi-sdk',\n\t\t\t\t\tversion: ANALYTICS_VERSION,\n\t\t\t\t},\n\t\t\t\tpage,\n\t\t\t};\n\n\t\t\tlet sessionInfo = getSessionInfo(params.request);\n\t\t\tif (params.event === 'IDENTIFY' && !sessionInfo.anonymous_id && !params.request && typeof window !== 'undefined') {\n\t\t\t\tsessionInfo = { ...sessionInfo, anonymous_id: getOrCreateAnonymousId() };\n\t\t\t}\n\n\t\t\t// For IDENTIFY events, resolve the Talent Bank candidate directly\n\t\t\t// from the SDK before firing the /log call. The returned candidateId\n\t\t\t// is cached so every subsequent log request includes it. Identify\n\t\t\t// is best-effort: a failure here must not prevent the analytics log.\n\t\t\tlet resolvedCandidateId = getStoredCandidateId();\n\t\t\tif (params.event === 'IDENTIFY' && talentBank && sessionInfo.anonymous_id) {\n\t\t\t\tconst identifyProperties = params.properties as EventPropertyMap['IDENTIFY']['properties'];\n\t\t\t\tconst result = await talentBank.identify({\n\t\t\t\t\temail: identifyProperties.email ?? identifyProperties.identifier,\n\t\t\t\t\tfirstName: identifyProperties.first_name,\n\t\t\t\t\tlastName: identifyProperties.last_name,\n\t\t\t\t\tphone: identifyProperties.phone_number,\n\t\t\t\t\tanonymousId: sessionInfo.anonymous_id,\n\t\t\t\t\tsource: 'sdk',\n\t\t\t\t});\n\t\t\t\tif (result?.candidateId) {\n\t\t\t\t\tresolvedCandidateId = result.candidateId;\n\t\t\t\t\tsetStoredCandidateId(result.candidateId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst payload: TrackPayload = {\n\t\t\t\tanonymous_id: sessionInfo.anonymous_id,\n\t\t\t\tsession_id: sessionInfo.session_id,\n\t\t\t\tcandidate_id: resolvedCandidateId,\n\t\t\t\tevent: params.event,\n\t\t\t\tsent_at: new Date().toISOString(),\n\t\t\t\tcontext,\n\t\t\t\tproperties: params.properties,\n\t\t\t\tcustom_properties: params.customProperties,\n\t\t\t};\n\n\t\t\tconst responseJson = await rpcClient.request(analyticsLogEndpoint, {\n\t\t\t\tbody: payload,\n\t\t\t});\n\n\t\t\tconst newSession = getSessionInfoFromResponse(responseJson);\n\t\t\tif (newSession?.anonymous_id) {\n\t\t\t\tpayload.anonymous_id = newSession.anonymous_id;\n\t\t\t}\n\t\t\tif (newSession?.session_id) {\n\t\t\t\tpayload.session_id = newSession.session_id;\n\t\t\t}\n\n\t\t\tif (typeof window !== 'undefined' && payload.anonymous_id) {\n\t\t\t\tif (payload.session_id) {\n\t\t\t\t\tsessionStorage.setItem(`${ANALYTICS_COOKIE_NAME}-session_id`, payload.session_id.toString());\n\t\t\t\t}\n\t\t\t\tdocument.cookie = formatCookie(payload.anonymous_id);\n\t\t\t}\n\n\t\t\tonEvent?.(payload as AnalyticsLogParams);\n\t\t\treturn { success: true, data: payload };\n\t\t} catch (e) {\n\t\t\t/** We dont’t log any PII on the console */\n\t\t\tlogger.error('Failed to send log to API. Inspect error response of `log` for more information.');\n\t\t\treturn { success: false, error: e };\n\t\t}\n\t};\n\n\treturn {\n\t\tlog: logFn,\n\t\tgetHeaders: payload => {\n\t\t\tconst headers = new Headers();\n\t\t\tif (!payload?.anonymous_id) return headers;\n\n\t\t\theaders.append('Set-Cookie', formatCookie(payload.anonymous_id));\n\t\t\treturn headers;\n\t\t},\n\t\tgetSessionInfo,\n\t};\n};\n","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { stringify } from 'neoqs';\n\nimport { SchemaValidationError, handleApiExceptions, parseJsonResponse } from './sdk.api';\nimport { ENV_TO_API_URL, InploiSdkEnvironment } from './sdk.constants';\nimport { Logger } from './sdk.logger';\n\ntype RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';\n\n/** Extract parameter names from a pathname string */\ntype ExtractParamNames<T extends string> =\n\tT extends `${infer _Before}:${infer Param}/${infer After}` ? Param | ExtractParamNames<`/${After}`>\n\t: T extends `${infer _Before}:${infer Param}` ? Param\n\t: never;\n\n/** Create params object from parameter names */\ntype ExtractPathParams<T extends string> =\n\tstring extends T ? Record<string, string | number>\n\t: ExtractParamNames<T> extends never ? Record<string, never>\n\t: { [K in ExtractParamNames<T>]: string | number };\n\n/** Parses a StandardSchemaV1 schema and input into an output. */\nexport function parse<T extends StandardSchemaV1>(\n\tschema: T,\n\tinput: StandardSchemaV1.InferInput<T>,\n\tsource?: 'body' | 'searchParams' | 'response',\n): StandardSchemaV1.InferOutput<T> {\n\tconst result = schema['~standard'].validate(input);\n\tif (result instanceof Promise) {\n\t\tthrow new TypeError('Async schema');\n\t}\n\n\tif (result.issues) {\n\t\tthrow new SchemaValidationError(result.issues, source);\n\t}\n\n\treturn result.value;\n}\n\n/** Parses a StandardSchemaV1 schema and input into an output, returning a success flag and issues if the parse fails. */\nexport function safeParse<T extends StandardSchemaV1>(\n\tschema: T,\n\tinput: StandardSchemaV1.InferInput<T>,\n\tsource?: 'body' | 'searchParams' | 'response',\n):\n\t| {\n\t\t\tsuccess: true;\n\t\t\toutput: StandardSchemaV1.InferOutput<T>;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\tissues: readonly StandardSchemaV1.Issue[];\n\t\t\tsource?: 'body' | 'searchParams' | 'response';\n\t } {\n\ttry {\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\toutput: parse(schema, input, source),\n\t\t};\n\t} catch (e) {\n\t\tif (e instanceof SchemaValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tissues: e.issues,\n\t\t\t\tsource: e.source,\n\t\t\t};\n\t\t}\n\t\tthrow e;\n\t}\n}\n\nexport interface InploiRpcClientParams {\n\tenvironment: InploiSdkEnvironment;\n\tlogger: Logger;\n\tapiKey:\n\t\t| {\n\t\t\t\t/** Makes the API call with an x-secret-key header\n\t\t\t\t * This will error if used in a browser environment.\n\t\t\t\t */\n\t\t\t\ttype: 'secret';\n\t\t\t\tkey: string;\n\t\t }\n\t\t| {\n\t\t\t\t/** Makes the API call with an x-publishable-key header\n\t\t\t\t * This can be called in a browser or server environment.\n\t\t\t\t */\n\t\t\t\ttype: 'publishable';\n\t\t\t\tkey: string;\n\t\t };\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype NonReducibleUnknown = {} | null | undefined;\ntype LooseAutocomplete<T extends BaseType, BaseType> = T | BaseType;\n\n/** RPC client for making API calls to the Inploi API. */\nexport class InploiRpcClient {\n\tprivate baseUrl: string;\n\tprivate headers: Headers;\n\tprivate logger: Logger;\n\tprivate _environment: InploiSdkEnvironment;\n\n\tconstructor(params: InploiRpcClientParams) {\n\t\tthis.baseUrl = ENV_TO_API_URL[params.environment];\n\t\tthis.headers = new Headers({\n\t\t\t'Content-Type': 'application/json',\n\t\t\tAccept: 'application/json',\n\t\t});\n\t\tif (params.apiKey.type === 'secret') {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\tthrow new Error('Secret key cannot be used in a browser environment');\n\t\t\t}\n\t\t\tthis.headers.set('x-secret-key', params.apiKey.key);\n\t\t} else {\n\t\t\tthis.headers.set('x-publishable-key', params.apiKey.key);\n\t\t}\n\t\tthis.logger = params.logger;\n\t\tthis._environment = params.environment;\n\t}\n\n\tget environment() {\n\t\treturn this._environment;\n\t}\n\n\t/** Gets params for a fetch request to the given endpoint */\n\tgetFetchParams<T extends RpcEndpoint>(\n\t\tendpoint: T,\n\t\toptions: T extends RpcEndpoint<infer _, infer _TPathname, infer TPathParams, infer TSearch, infer TBody> ?\n\t\t\tGetSchemaValues<{\n\t\t\t\tbody: TBody;\n\t\t\t\tsearchParams: TSearch;\n\t\t\t\tparams: TPathParams;\n\t\t\t}> & {\n\t\t\t\tsignal?: AbortSignal;\n\t\t\t\t/**\n\t\t\t\t * Whether to validate the inputs against the schema.\n\t\t\t\t * If you want to skip validation (e.g.: already validated yourself or with `validateEndpontInputs`), set this to false.\n\t\t\t\t */\n\t\t\t\tvalidateIn?: boolean;\n\t\t\t}\n\t\t:\tnever,\n\t): [url: string, options: RequestInit] {\n\t\tconst validateIn = options.validateIn ?? true;\n\t\tconst { searchParams, body } = validateIn ? validateEndpointInputs(endpoint, options) : options;\n\n\t\tconst url = new URL(this.baseUrl);\n\n\t\t// Replace path parameters in pathname\n\t\tlet pathname = endpoint.pathname;\n\t\tif ('params' in options && options.params) {\n\t\t\tfor (const [key, value] of Object.entries(options.params)) {\n\t\t\t\tpathname = pathname.replace(`:${key}`, String(value));\n\t\t\t}\n\t\t}\n\t\turl.pathname = pathname;\n\n\t\tif (endpoint.schema.searchParams) {\n\t\t\turl.search = stringify(searchParams);\n\t\t}\n\n\t\treturn [\n\t\t\turl.toString(),\n\t\t\t{\n\t\t\t\tmethod: endpoint.method,\n\t\t\t\tbody: body ? JSON.stringify(body) : undefined,\n\t\t\t\theaders: this.headers,\n\t\t\t\tsignal: options.signal,\n\t\t\t},\n\t\t];\n\t}\n\n\t/** Parses a response against an endpoint’s response schema, considering common errors thrown from the API.\n\t * @throws {JsonParsingError} - If the response is not valid JSON.\n\t * @throws {SchemaValidationError} - If the response does not match the schema.\n\t * @throws {ApiError} - If the API responded with an error message.\n\t */\n\tasync parseResponse<T extends RpcEndpoint>(\n\t\tendpoint: T,\n\t\toptions: {\n\t\t\tresponse: Response;\n\t\t\t/**\n\t\t\t * Whether to validate the response against the schema.\n\t\t\t * This is meant more as an escape hatch for when the response is not as expected and you want to handle it separately yourself.\n\t\t\t * ⚠️ This will lead to potential type/runtime mismatch as it does not verify the response against the schema.\n\t\t\t */\n\t\t\tvalidateOut?: boolean;\n\t\t},\n\t): Promise<StandardSchemaV1.InferOutput<T['schema']['response']>> {\n\t\tconst json = await parseJsonResponse(options.response);\n\n\t\tconst validateOut = options.validateOut ?? true;\n\t\tif (!validateOut) return json as StandardSchemaV1.InferOutput<T['schema']['response']>;\n\n\t\tconst result = safeParse(endpoint.schema.response, json, 'response');\n\t\tif (!result.success) {\n\t\t\thandleApiExceptions(json, options.response.status);\n\t\t\tthrow new SchemaValidationError(result.issues, result.source);\n\t\t}\n\n\t\treturn result.output as StandardSchemaV1.InferOutput<T['schema']['response']>;\n\t}\n\n\t/** Fetches, parses and validates an API endpoint.\n\t * Logs errors and throws them again so that the caller can handle them.\n\t *\n\t * @throws {JsonParsingError} - If the response is not valid JSON.\n\t * @throws {SchemaValidationError} - If the searchParams, body or response does not match the schema.\n\t * @throws {ApiError} - If the API responded with an error message.\n\t * @throws {UnauthorisedError} - If the request is unauthorised either by missing key or unmet permissions.\n\t * @throws {NotFoundError} - If the endpoint is not found.\n\t * @throws {Error} - Another unhandled error.\n\t */\n\tasync request<T extends RpcEndpoint>(\n\t\tendpoint: T,\n\t\toptions: T extends RpcEndpoint<infer _, infer _TPathname, infer TPathParams, infer TSearch, infer TBody> ?\n\t\t\tGetSchemaValues<{\n\t\t\t\tbody: TBody;\n\t\t\t\tsearchParams: TSearch;\n\t\t\t\tparams: TPathParams;\n\t\t\t}> & {\n\t\t\t\tsignal?: AbortSignal;\n\t\t\t\t/**\n\t\t\t\t * Whether to validate the inputs against the schema.\n\t\t\t\t * If you want to skip validation (e.g.: already validated yourself or with `validateEndpontInputs`), set this to false.\n\t\t\t\t */\n\t\t\t\tvalidateIn?: boolean;\n\t\t\t\t/**\n\t\t\t\t * Whether to validate the response against the schema.\n\t\t\t\t * This is meant more as an escape hatch for when the response is not as expected and you want to handle it separately yourself.\n\t\t\t\t * ⚠️ This will lead to potential type/runtime mismatch as it does not verify the response against the schema.\n\t\t\t\t */\n\t\t\t\tvalidateOut?: boolean;\n\t\t\t}\n\t\t:\tnever,\n\t): Promise<StandardSchemaV1.InferOutput<T['schema']['response']>> {\n\t\ttry {\n\t\t\tconst fetchParams = this.getFetchParams(endpoint, options);\n\t\t\tconst response = await fetch(...fetchParams);\n\t\t\treturn await this.parseResponse(endpoint, { response, validateOut: options.validateOut });\n\t\t} catch (e) {\n\t\t\tif (e instanceof SchemaValidationError) {\n\t\t\t\tthis.logger.error(e.message, e.issues);\n\t\t\t} else {\n\t\t\t\tthis.logger.error(e);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n}\n\ntype GetSchemaValues<T extends { searchParams: any; body: any; params?: any }> = {\n\t[K in keyof T as T[K] extends never ? never\n\t: T[K] extends Record<string, never> ? never\n\t: K]: T[K] extends never ? never : LooseAutocomplete<T[K], NonReducibleUnknown>;\n};\n\n/**\n * Typed but *not runtime validated* schema\n * useful for type-checking the schema without bundling validation schemas\n */\nexport function typed<T>(): StandardSchemaV1<T, T> {\n\treturn {\n\t\t'~standard': {\n\t\t\tvendor: 'inploi',\n\t\t\tversion: 1,\n\t\t\tvalidate: input => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: input as T,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport interface RpcEndpoint<\n\tTMethod extends RequestMethod = RequestMethod,\n\tTPathname extends string = string,\n\tTPathParams = any,\n\tTSearch = any,\n\tTBody = any,\n\tTResponse = any,\n> {\n\tpathname: TPathname;\n\tmethod: TMethod;\n\theaders?: Headers;\n\tschema: {\n\t\tsearchParams?: StandardSchemaV1<TSearch, TSearch>;\n\t\tbody?: StandardSchemaV1<TBody, TBody>;\n\t\tresponse: StandardSchemaV1<TResponse, TResponse>;\n\t};\n\t/** Type-only property to store path parameter types */\n\treadonly __pathParams?: TPathParams;\n}\n\nexport function endpoint<\n\tTMethod extends RequestMethod,\n\tTPathname extends string,\n\tTSearch extends StandardSchemaV1 | never = never,\n\tTBody extends StandardSchemaV1 | never = never,\n\tTResponse extends StandardSchemaV1 | never = never,\n>(endpoint: {\n\tpathname: TPathname;\n\tmethod: TMethod;\n\theaders?: Headers;\n\tschema: {\n\t\tsearchParams?: TSearch;\n\t\tbody?: TBody;\n\t\tresponse: TResponse;\n\t};\n}) {\n\ttype PathParams = ExtractPathParams<TPathname>;\n\treturn endpoint as RpcEndpoint<\n\t\tTMethod,\n\t\tTPathname,\n\t\tPathParams,\n\t\tStandardSchemaV1.InferInput<TSearch>,\n\t\tStandardSchemaV1.InferInput<TBody>,\n\t\tStandardSchemaV1.InferOutput<TResponse>\n\t>;\n}\n\n/** Validates the inputs for an endpoint ahead of time\n * Useful when you need to validate and throw earlier, or use the inputs for something other than the API call.\n */\nexport function validateEndpointInputs<T extends RpcEndpoint>(\n\tendpoint: T,\n\toptions: GetSchemaValues<{ body: unknown; searchParams: unknown }>,\n) {\n\tconst validatedInputs = {\n\t\tsearchParams: undefined,\n\t\tbody: undefined,\n\t\tvalidateIn: false,\n\t} as T extends RpcEndpoint<infer _, infer __, infer ___, infer TSearch, infer TBody> ?\n\t\tGetSchemaValues<{\n\t\t\tbody: TBody;\n\t\t\tsearchParams: TSearch;\n\t\t}> & {\n\t\t\tvalidateIn: false;\n\t\t}\n\t:\tnever;\n\n\tif (endpoint.schema.searchParams) {\n\t\tvalidatedInputs.searchParams = parse(\n\t\t\tendpoint.schema.searchParams,\n\t\t\t'searchParams' in options ? options.searchParams : {},\n\t\t);\n\t}\n\n\tif (endpoint.schema.body) {\n\t\tvalidatedInputs.body = parse(endpoint.schema.body, 'body' in options ? options.body : {});\n\t}\n\n\treturn validatedInputs;\n}\n","import * as v from \"valibot\";\nexport const CANDIDATE_SOURCES = [\n \"agent\",\n \"sdk\",\n \"form\",\n \"integration\",\n \"migration\",\n];\n/**\n * Canonical funnel-milestone groups. Stable enum baked into the contract —\n * lifecycle decisions key off this, never off `stage` (which is free-text).\n */\nexport const STAGE_GROUPS = [\n \"APPLIED\",\n \"SHORTLISTED\",\n \"INTERVIEWED\",\n \"OFFERED\",\n \"HIRED\",\n \"REJECTED\",\n \"WITHDRAWN\",\n];\n/**\n * Historical 1:1 stage slugs per group. Stages are now free-text at the\n * contract boundary — studio owns the per-company list — so this constant\n * exists only as the default-per-group fallback for callers (and tests)\n * that don't supply an explicit stage. See {@link DEFAULT_STAGE_FOR_GROUP}.\n */\nexport const STAGES = [\n \"applied\",\n \"shortlisted\",\n \"interviewed\",\n \"offered\",\n \"hired\",\n \"rejected\",\n \"withdrawn\",\n];\nexport const SCORE_TYPES = [\n \"screening\",\n \"cv_match\",\n \"interview\",\n \"overall\",\n];\nexport const INTERVIEW_STATUSES = [\n \"PENDING\",\n \"SCHEDULED\",\n \"IN_PROGRESS\",\n \"COMPLETED\",\n \"CANCELLED\",\n];\nexport const DUPLICATE_CHECK_SCOPES = [\"job\", \"company\"];\nexport const APPLICATION_SORT_FIELDS = [\"created_at\", \"updated_at\"];\nexport const SORT_ORDERS = [\"asc\", \"desc\"];\n/** Per-application source label. Set once on submit; never mutated thereafter. */\nexport const APPLICATION_SOURCES = [\n \"careers_site\",\n \"chatbot\",\n \"plugin_job_search\",\n \"ats_import\",\n \"referral\",\n \"agency\",\n \"other\",\n \"unknown\",\n];\n/**\n * The closed set of state-mutating actions that can be recorded in the\n * `application_logs` audit table.\n *\n * The named group transitions (`shortlist`, `move_to_interview`,\n * `make_offer`, `hire`, `withdraw`) exist *alongside* the generic\n * `move_to_stage` because the action key is what flows into audit +\n * analytics: a `shortlist` row and a `move_to_stage` row that happen to\n * both land in `SHORTLISTED` carry different intent and the dashboards\n * pivot on that. The legacy `stage_transition` is kept as an alias for\n * `move_to_stage` so existing consumers don't break.\n *\n * `submit` and `score_written` are server-emitted only — never accepted\n * via the generic apply-action surface.\n */\nexport const APPLICATION_ACTIONS = [\n \"submit\",\n \"stage_transition\",\n \"move_to_stage\",\n \"shortlist\",\n \"move_to_interview\",\n \"make_offer\",\n \"hire\",\n \"withdraw\",\n \"disqualify\",\n \"reinstate\",\n \"rate\",\n \"score_written\",\n];\n/** Who initiated the audited action. Verbatim from the request body. */\nexport const ACTOR_TYPES = [\n \"user\",\n \"system\",\n \"automation\",\n \"integration\",\n \"candidate\",\n];\nexport const CandidateSourceSchema = v.picklist(CANDIDATE_SOURCES);\nexport const StageGroupSchema = v.picklist(STAGE_GROUPS);\n/**\n * Stage slug — free-text from talent-bank's POV. Studio owns the per-company\n * stage configuration; talent-bank just stores and reflects whatever slug the\n * caller sends. The trimmed length cap mirrors the column intent (TEXT, but\n * we don't want kilobyte-sized slugs leaking through accidents).\n */\nexport const StageSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(100));\nexport const ScoreTypeSchema = v.picklist(SCORE_TYPES);\nexport const InterviewStatusSchema = v.picklist(INTERVIEW_STATUSES);\nexport const DuplicateCheckScopeSchema = v.picklist(DUPLICATE_CHECK_SCOPES);\nexport const ApplicationSortFieldSchema = v.picklist(APPLICATION_SORT_FIELDS);\nexport const SortOrderSchema = v.picklist(SORT_ORDERS);\n/**\n * Disqualification reason slug — free-text from talent-bank's POV. Studio owns\n * the per-company reason configuration (label, ordering, whether a note is\n * required); talent-bank just stores and reflects whatever slug the caller\n * sends, exactly like {@link StageSchema}. The length cap mirrors the column\n * intent (TEXT, but we don't want kilobyte-sized slugs leaking through).\n */\nexport const DisqualificationReasonSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(100));\nexport const ApplicationSourceSchema = v.picklist(APPLICATION_SOURCES);\nexport const ApplicationActionSchema = v.picklist(APPLICATION_ACTIONS);\nexport const ActorTypeSchema = v.picklist(ACTOR_TYPES);\n/**\n * The actor type that marks a shortlist as initiated by one of our own\n * automations (e.g. the Studio \"Sync shortlist to Talent Bank\" workflow node).\n *\n * This value is load-bearing across repos: the `/metrics` soft-cap query\n * (`buildShortlistCountQuery`) counts only `application.shortlisted` rows whose\n * `actorType` equals this constant, and the API workflow node must send exactly\n * this `actor.type` for its shortlists to be counted. Keeping it as a single\n * `satisfies ActorType` constant means a typo or a removal from {@link ACTOR_TYPES}\n * is a compile error rather than a silently-zero metric.\n */\nexport const AUTOMATION_ACTOR_TYPE = \"automation\";\n/**\n * Historical default-slug → group map. **Not a runtime validator** — stages\n * are now free-text and studio owns the per-company stage list. Only useful\n * for resolving the v1 default slugs in tests and back-compat paths.\n */\nexport const STAGE_TO_GROUP = {\n applied: \"APPLIED\",\n shortlisted: \"SHORTLISTED\",\n interviewed: \"INTERVIEWED\",\n offered: \"OFFERED\",\n hired: \"HIRED\",\n rejected: \"REJECTED\",\n withdrawn: \"WITHDRAWN\",\n};\n/**\n * Default stage slug per stage group. Used by named group-transition actions\n * when the caller does not supply an explicit `stage`, and by `submit` when\n * the request body omits both `stage` and `stageGroup`.\n */\nexport const DEFAULT_STAGE_FOR_GROUP = {\n APPLIED: \"applied\",\n SHORTLISTED: \"shortlisted\",\n INTERVIEWED: \"interviewed\",\n OFFERED: \"offered\",\n HIRED: \"hired\",\n REJECTED: \"rejected\",\n WITHDRAWN: \"withdrawn\",\n};\n/** Convention default applied on submit when the caller does not supply a stage. */\nexport const DEFAULT_STAGE = \"applied\";\nexport const DEFAULT_STAGE_GROUP = \"APPLIED\";\n/** Terminal stage groups — disqualified or self-withdrawn. */\nexport const TERMINAL_STAGE_GROUPS = new Set([\n \"REJECTED\",\n \"WITHDRAWN\",\n \"HIRED\",\n]);\n/**\n * Source stage groups that `reinstate` is permitted to move an application\n * *out of*. The set is engine-internal — it answers \"given a target row,\n * may the reinstate action proceed?\" — not a synonym for \"is this row\n * disqualified\" (the row's `disqualifiedAt` column answers that).\n *\n * HIRED is included so fat-finger hires can be corrected on the kanban\n * without resorting to a back-channel DB edit. `reinstate.apply` always\n * clears `disqualifiedAt` and `disqualificationReason`, which is a no-op\n * on HIRED rows (already null) — so adding HIRED has no semantic effect\n * on genuine disqualified reinstates.\n *\n * The complementary \"cannot reinstate INTO terminal\" guard\n * ({@link TERMINAL_STAGE_GROUPS}) is unchanged: this action moves\n * applications back into the active funnel, never sideways between\n * terminal states (use `disqualify` for HIRED → REJECTED).\n */\nexport const REINSTATABLE_STAGE_GROUPS = new Set([\n \"REJECTED\",\n \"WITHDRAWN\",\n \"HIRED\",\n]);\n/**\n * Discriminated actor block. Sent on every mutating route's body and\n * written verbatim into the matching `application_logs` row.\n */\nexport const ActorInputSchema = v.variant(\"type\", [\n v.object({\n type: v.literal(\"user\"),\n id: v.pipe(v.string(), v.minLength(1)),\n email: v.pipe(v.string(), v.minLength(1)),\n name: v.pipe(v.string(), v.minLength(1)),\n }),\n v.object({\n type: v.literal(\"system\"),\n id: v.pipe(v.string(), v.minLength(1)),\n name: v.optional(v.string()),\n }),\n v.object({\n type: v.literal(\"automation\"),\n id: v.pipe(v.string(), v.minLength(1)),\n name: v.optional(v.string()),\n }),\n v.object({\n type: v.literal(\"integration\"),\n id: v.pipe(v.string(), v.minLength(1)),\n name: v.optional(v.string()),\n }),\n v.object({\n type: v.literal(\"candidate\"),\n id: v.pipe(v.string(), v.minLength(1)),\n email: v.optional(v.string()),\n }),\n]);\n","import * as v from \"valibot\";\nexport const PaginationSchema = v.object({\n total: v.number(),\n page: v.number(),\n perPage: v.number(),\n lastPage: v.number(),\n});\nexport function paginatedResultSchema(itemSchema) {\n return v.object({\n data: v.array(itemSchema),\n pagination: PaginationSchema,\n });\n}\n","import * as v from \"valibot\";\nimport { CandidateSourceSchema } from \"./enums.js\";\nexport const CandidateSchema = v.object({\n id: v.string(),\n email: v.nullable(v.string()),\n firstName: v.nullable(v.string()),\n lastName: v.nullable(v.string()),\n phone: v.nullable(v.string()),\n source: v.nullable(CandidateSourceSchema),\n identifiedAt: v.nullable(v.string()),\n createdAt: v.string(),\n updatedAt: v.string(),\n});\n","import * as v from \"valibot\";\nimport { UnknownRecordSchema } from \"./_shared.js\";\nimport { CandidateSchema } from \"./candidate.js\";\nimport { ActorTypeSchema, ApplicationActionSchema, ApplicationSourceSchema, DisqualificationReasonSchema, ScoreTypeSchema, StageGroupSchema, StageSchema, } from \"./enums.js\";\nimport { InterviewSchema } from \"./interview.js\";\nexport const ScoreCategorySchema = v.object({\n score: v.number(),\n reason: v.string(),\n confidence: v.number(),\n});\nexport const ApplicationSchema = v.object({\n id: v.string(),\n candidateId: v.string(),\n jobId: v.number(),\n stage: StageSchema,\n stageGroup: StageGroupSchema,\n stageEnteredAt: v.string(),\n rating: v.nullable(v.number()),\n disqualifiedAt: v.nullable(v.string()),\n disqualificationReason: v.nullable(DisqualificationReasonSchema),\n disqualificationNote: v.nullable(v.string()),\n source: ApplicationSourceSchema,\n sourceDetail: v.nullable(v.string()),\n sessionId: v.nullable(v.number()),\n externalApplicationId: v.nullable(v.string()),\n meta: v.nullable(UnknownRecordSchema),\n context: v.nullable(UnknownRecordSchema),\n scoredAt: v.nullable(v.string()),\n createdAt: v.string(),\n updatedAt: v.string(),\n});\nexport const ApplicationScoreSchema = v.object({\n id: v.string(),\n applicationId: v.string(),\n scoreType: ScoreTypeSchema,\n score: v.nullable(v.number()),\n reason: v.nullable(v.string()),\n categories: v.nullable(v.record(v.string(), ScoreCategorySchema)),\n scoredBy: v.nullable(v.string()),\n createdAt: v.string(),\n});\nexport const ApplicationDetailSchema = v.object({\n ...ApplicationSchema.entries,\n candidate: v.nullable(CandidateSchema),\n score: v.nullable(ApplicationScoreSchema),\n interview: v.nullable(InterviewSchema),\n});\nexport const CandidateDetailSchema = v.object({\n ...CandidateSchema.entries,\n applications: v.array(ApplicationSchema),\n});\n/**\n * Audit-log row recording a single state-mutating action against an\n * application. Structured stage columns carry every transition-relevant\n * field in typed form; `meta` carries opaque action-specific extras.\n */\nexport const ApplicationLogSchema = v.object({\n id: v.string(),\n applicationId: v.string(),\n action: ApplicationActionSchema,\n fromStage: v.nullable(StageSchema),\n fromStageGroup: v.nullable(StageGroupSchema),\n toStage: v.nullable(StageSchema),\n toStageGroup: v.nullable(StageGroupSchema),\n disqualificationReason: v.nullable(DisqualificationReasonSchema),\n disqualificationNote: v.nullable(v.string()),\n actorId: v.nullable(v.string()),\n actorType: ActorTypeSchema,\n actorEmail: v.nullable(v.string()),\n actorName: v.nullable(v.string()),\n meta: v.nullable(UnknownRecordSchema),\n schemaVersion: v.number(),\n createdAt: v.string(),\n});\n","import * as v from \"valibot\";\n// Shared building blocks used by HTTP DTO schemas. Not re-exported from the\n// public barrel — these stay private to the contract folder so consumers don't\n// depend on incidental helpers.\nexport const RequiredStringSchema = v.pipe(v.string(), v.minLength(1));\nexport const PositiveIntegerSchema = v.pipe(v.number(), v.integer(), v.minValue(1));\nexport const UnknownRecordSchema = v.record(v.string(), v.unknown());\n","import * as v from \"valibot\";\nimport { UnknownRecordSchema } from \"./_shared.js\";\nimport { InterviewStatusSchema } from \"./enums.js\";\nexport const InterviewSchema = v.object({\n id: v.string(),\n applicationId: v.string(),\n status: InterviewStatusSchema,\n scheduledAt: v.nullable(v.string()),\n completedAt: v.nullable(v.string()),\n meta: v.nullable(UnknownRecordSchema),\n createdAt: v.string(),\n updatedAt: v.string(),\n});\n","import * as v from \"valibot\";\nimport { RequiredStringSchema } from \"../_shared.js\";\nimport { CandidateSourceSchema } from \"../enums.js\";\nexport const IdentifyInputSchema = v.object({\n anonymousId: RequiredStringSchema,\n email: RequiredStringSchema,\n firstName: v.nullish(v.string()),\n lastName: v.nullish(v.string()),\n phone: v.nullish(v.string()),\n source: v.nullish(CandidateSourceSchema),\n});\nexport const IdentifyResultSchema = v.object({\n candidateId: v.string(),\n isNew: v.boolean(),\n});\n","import * as v from \"valibot\";\nimport { PositiveIntegerSchema, RequiredStringSchema, UnknownRecordSchema, } from \"../_shared.js\";\nimport { ApplicationDetailSchema, ApplicationLogSchema, ScoreCategorySchema, } from \"../application.js\";\nimport { ActorInputSchema, ApplicationSortFieldSchema, ApplicationSourceSchema, DisqualificationReasonSchema, ScoreTypeSchema, SortOrderSchema, StageGroupSchema, StageSchema, } from \"../enums.js\";\nimport { paginatedResultSchema } from \"../pagination.js\";\n/**\n * Action keys exposed to consumers via the generic `applyAction` endpoint.\n * Excludes server-driven entries from {@link APPLICATION_ACTIONS} (`submit`,\n * `score_written`) because those are write-only audit-log labels emitted by\n * the store's dedicated paths, not user-dispatchable actions.\n */\nexport const APPLY_ACTION_KEYS = [\n \"stage_transition\",\n \"move_to_stage\",\n \"shortlist\",\n \"move_to_interview\",\n \"make_offer\",\n \"hire\",\n \"withdraw\",\n \"disqualify\",\n \"reinstate\",\n \"rate\",\n];\nexport const ApplyActionKeySchema = v.picklist(APPLY_ACTION_KEYS);\n/**\n * Comma-separated string in query parameters; transformed into a string[]\n * for downstream use. e.g. `?stages=applied,shortlisted`.\n */\nconst CommaSeparatedStringSchema = v.pipe(v.string(), v.transform((s) => s\n .split(\",\")\n .map((t) => t.trim())\n .filter((t) => t.length > 0)));\n// Stages are free-text post-v6 — the query filter accepts whatever the\n// caller passes. Stage groups remain picklist-validated below.\nconst StagesQuerySchema = v.pipe(CommaSeparatedStringSchema, v.array(StageSchema));\nconst StageGroupsQuerySchema = v.pipe(CommaSeparatedStringSchema, v.array(StageGroupSchema));\nconst JobIdsQuerySchema = v.pipe(v.string(), v.transform((s) => s\n .split(\",\")\n .map((t) => Number(t.trim()))\n .filter((n) => Number.isInteger(n) && n > 0)));\nexport const ListApplicationsQuerySchema = v.object({\n stages: v.optional(StagesQuerySchema),\n stage_groups: v.optional(StageGroupsQuerySchema),\n job_id: v.optional(v.string()),\n job_ids: v.optional(JobIdsQuerySchema),\n candidate_id: v.optional(v.string()),\n is_disqualified: v.optional(v.picklist([\"true\", \"false\"])),\n created_from: v.optional(v.string()),\n created_to: v.optional(v.string()),\n updated_from: v.optional(v.string()),\n updated_to: v.optional(v.string()),\n entered_stage_from: v.optional(v.string()),\n entered_stage_to: v.optional(v.string()),\n from: v.optional(v.string()),\n to: v.optional(v.string()),\n q: v.optional(v.string()),\n scored: v.optional(v.picklist([\"true\", \"false\"])),\n sort: v.optional(ApplicationSortFieldSchema),\n order: v.optional(SortOrderSchema),\n page: v.optional(v.string()),\n per_page: v.optional(v.string()),\n});\n/**\n * `stage` and `stageGroup` must be supplied together, or both omitted. Only\n * studio knows which stage slug belongs in which group (the slug is free-text\n * and the platform deliberately does not carry the per-tenant mapping), so a\n * `stage` arriving without an explicit `stageGroup` cannot be classified\n * without guessing. Omitting both still works and falls back to the\n * `applied` / `APPLIED` defaults inside the store.\n */\nexport const SubmitApplicationInputSchema = v.pipe(v.object({\n candidateId: RequiredStringSchema,\n jobId: PositiveIntegerSchema,\n meta: v.nullish(UnknownRecordSchema),\n sessionId: v.nullish(v.number()),\n externalApplicationId: v.nullish(v.string()),\n context: v.nullish(UnknownRecordSchema),\n source: v.nullish(ApplicationSourceSchema),\n sourceDetail: v.nullish(v.string()),\n stage: v.nullish(StageSchema),\n stageGroup: v.nullish(StageGroupSchema),\n actor: v.nullish(ActorInputSchema),\n}), v.check((input) => (input.stage == null) === (input.stageGroup == null), \"stage and stageGroup must be supplied together\"));\nconst DuplicateApplicationSchema = v.object({\n id: v.string(),\n stageGroup: v.string(),\n createdAt: v.string(),\n});\nexport const SubmitApplicationResultSchema = v.union([\n v.object({\n ok: v.literal(true),\n duplicate: v.literal(false),\n applicationId: v.string(),\n candidateId: v.string(),\n }),\n v.object({\n ok: v.literal(true),\n duplicate: v.literal(true),\n existingApplication: DuplicateApplicationSchema,\n }),\n]);\nexport const DuplicateCheckResultSchema = v.object({\n isDuplicate: v.boolean(),\n existingApplication: v.optional(DuplicateApplicationSchema),\n});\nexport const WriteScoreInputSchema = v.object({\n applicationId: RequiredStringSchema,\n scoreType: ScoreTypeSchema,\n score: v.number(),\n reason: v.nullish(v.string()),\n categories: v.nullish(v.record(v.string(), ScoreCategorySchema)),\n scoredBy: v.nullish(v.string()),\n actor: v.nullish(ActorInputSchema),\n});\nexport const WriteScoreResponseSchema = v.object({ scoreId: v.string() });\nexport const ListApplicationsResponseSchema = paginatedResultSchema(ApplicationDetailSchema);\nexport const GetApplicationResponseSchema = ApplicationDetailSchema;\n/**\n * Single-row stage transition. The server does **not** validate the\n * `(toStage, toStageGroup)` pair against any closed map — `toStage` is\n * free-text and studio is the only system that knows whether a given slug\n * belongs to its configured group.\n */\n/**\n * Skip reasons surfaced by the dispatcher when a stage-changing action is a\n * no-op. Kept as a top-level schema because it's a primitive reused both in\n * `ApplyActionSkipReasonSchema` (which adds `already_disqualified`) and by\n * internal store types via the inferred `TransitionSkipReason` type.\n */\nconst TransitionSkipReasonSchema = v.picklist([\n \"already_in_target_stage\",\n \"not_in_source_stage\",\n \"disqualified\",\n]);\nexport const ListApplicationLogsResponseSchema = v.array(ApplicationLogSchema);\n/* ─────────────────────────────────────────────────────────────\n * Generic applyAction surface\n * ──────────────────────────────────────────────────────────── */\n/**\n * Meta schemas per action key. The generic `applyAction` HTTP body wraps one\n * of these in a discriminated union so each action's payload is validated\n * before reaching the store.\n *\n * `note` fields are optional everywhere except where the rule itself\n * requires them (e.g. `disqualify` with `reason='other'`, enforced inside\n * the registry — not duplicated here).\n */\nconst NoteMeta = v.object({\n stage: v.nullish(StageSchema),\n note: v.nullish(v.string()),\n});\nconst HireMeta = v.object({\n stage: v.nullish(StageSchema),\n startDate: v.nullish(v.string()),\n note: v.nullish(v.string()),\n});\nexport const ApplyActionInputSchema = v.variant(\"action\", [\n v.object({\n action: v.literal(\"shortlist\"),\n actor: ActorInputSchema,\n meta: v.nullish(NoteMeta),\n }),\n v.object({\n action: v.literal(\"move_to_interview\"),\n actor: ActorInputSchema,\n meta: v.nullish(NoteMeta),\n }),\n v.object({\n action: v.literal(\"make_offer\"),\n actor: ActorInputSchema,\n meta: v.nullish(NoteMeta),\n }),\n v.object({\n action: v.literal(\"hire\"),\n actor: ActorInputSchema,\n meta: v.nullish(HireMeta),\n }),\n v.object({\n action: v.literal(\"withdraw\"),\n actor: ActorInputSchema,\n meta: v.nullish(NoteMeta),\n }),\n v.object({\n action: v.literal(\"move_to_stage\"),\n actor: ActorInputSchema,\n meta: v.object({\n stage: StageSchema,\n stageGroup: StageGroupSchema,\n note: v.nullish(v.string()),\n }),\n }),\n v.object({\n action: v.literal(\"stage_transition\"),\n actor: ActorInputSchema,\n meta: v.object({\n toStage: StageSchema,\n toStageGroup: StageGroupSchema,\n note: v.nullish(v.string()),\n }),\n }),\n v.object({\n action: v.literal(\"disqualify\"),\n actor: ActorInputSchema,\n meta: v.object({\n reason: DisqualificationReasonSchema,\n note: v.nullish(v.string()),\n }),\n }),\n v.object({\n action: v.literal(\"reinstate\"),\n actor: ActorInputSchema,\n meta: v.object({\n toStage: StageSchema,\n toStageGroup: StageGroupSchema,\n note: v.nullish(v.string()),\n }),\n }),\n v.object({\n action: v.literal(\"rate\"),\n actor: ActorInputSchema,\n meta: v.object({\n rating: v.nullable(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(5))),\n }),\n }),\n]);\nexport const BulkApplyActionInputSchema = v.object({\n applicationIds: v.pipe(v.array(v.string()), v.minLength(1)),\n body: ApplyActionInputSchema,\n});\nconst ApplyActionSkipReasonSchema = v.picklist([\n \"already_in_target_stage\",\n \"not_in_source_stage\",\n \"disqualified\",\n \"already_disqualified\",\n]);\n/**\n * Result envelope for the generic apply-action endpoint. `updated` returns\n * the new application detail; `skipped` returns the no-op reason; `failed`\n * is reserved for bulk responses (single-row failures surface as HTTP 4xx).\n */\nexport const ApplyActionResultSchema = v.variant(\"kind\", [\n v.object({\n kind: v.literal(\"updated\"),\n action: ApplyActionKeySchema,\n application: ApplicationDetailSchema,\n }),\n v.object({\n kind: v.literal(\"skipped\"),\n action: ApplyActionKeySchema,\n applicationId: v.string(),\n reason: ApplyActionSkipReasonSchema,\n }),\n]);\nexport const BulkApplyActionResultSchema = v.object({\n updated: v.array(v.object({\n kind: v.literal(\"updated\"),\n action: ApplyActionKeySchema,\n application: ApplicationDetailSchema,\n })),\n skipped: v.array(v.object({\n kind: v.literal(\"skipped\"),\n action: ApplyActionKeySchema,\n applicationId: v.string(),\n reason: ApplyActionSkipReasonSchema,\n })),\n failed: v.array(v.object({ applicationId: v.string(), error: v.string() })),\n});\n/* ─────────────────────────────────────────────────────────────\n * Per-job application counts (jobs list page badge / column)\n * ──────────────────────────────────────────────────────────── */\nconst NonNegativeIntegerSchema = v.pipe(v.number(), v.integer(), v.minValue(0));\n/**\n * Zero-filled count for every stage group. Talent-bank always returns the\n * full shape so studio (and other consumers) never need to defensive-merge\n * against missing keys when a job has no applications in a particular group.\n */\nexport const JobApplicationCountsSchema = v.object({\n APPLIED: NonNegativeIntegerSchema,\n SHORTLISTED: NonNegativeIntegerSchema,\n INTERVIEWED: NonNegativeIntegerSchema,\n OFFERED: NonNegativeIntegerSchema,\n HIRED: NonNegativeIntegerSchema,\n REJECTED: NonNegativeIntegerSchema,\n WITHDRAWN: NonNegativeIntegerSchema,\n});\nexport const ListJobApplicationCountsQuerySchema = v.object({\n job_ids: JobIdsQuerySchema,\n});\n/**\n * Response is keyed by job-ID string. Every requested job appears in the\n * map, even when it has zero applications, so callers can safely iterate\n * over their input job list without nullable-handling.\n */\nexport const ListJobApplicationCountsResponseSchema = v.object({\n counts: v.record(v.string(), JobApplicationCountsSchema),\n});\n","import { CandidateDetailSchema } from \"../application.js\";\nimport { CandidateSchema } from \"../candidate.js\";\nimport { paginatedResultSchema } from \"../pagination.js\";\nexport const ListCandidatesResponseSchema = paginatedResultSchema(CandidateSchema);\nexport const GetCandidateResponseSchema = CandidateDetailSchema;\n","import * as v from \"valibot\";\nexport const JobMetricsResponseSchema = v.object({\n avg_score: v.nullable(v.number()),\n p90_score: v.nullable(v.number()),\n p85_score: v.nullable(v.number()),\n p80_score: v.nullable(v.number()),\n total_scores: v.number(),\n /**\n * Cumulative count of distinct applications shortlisted by our own\n * automations for this job (\"ever shortlisted by us\"), sourced from\n * `application.shortlisted` analytics events whose actor type is\n * `automation`. Append-only; does not decrease when a candidate moves out\n * of a shortlisted column. Excludes recruiter-initiated shortlists made\n * directly in the ATS (which never reach the action engine) and human\n * shortlists made in studio (actor type `user`).\n */\n total_shortlists: v.number(),\n});\n","import { DuplicateCheckResultSchema, IdentifyInputSchema, IdentifyResultSchema } from '@inploi/talent-bank/contract';\nimport * as v from 'valibot';\n\nimport { ENV_TO_TALENT_BANK_URL, InploiSdkEnvironment } from './sdk.constants';\nimport { Logger } from './sdk.logger';\n\n// `@inploi/talent-bank` is a private package: tsup bundles its schemas into the\n// npm build, but cannot inline its types into `dist/index.d.ts`, so the shapes\n// this client exposes are declared here. The call sites below (`parsed.output`\n// return values and the schema-typed `identify` body) keep them assignable to\n// the bundled contract.\ntype DuplicateCheckScope = 'job' | 'company';\n\ntype CandidateSource = 'agent' | 'sdk' | 'form' | 'integration' | 'migration';\n\nexport type TalentBankCheckDuplicateResult = {\n\tisDuplicate: boolean;\n\texistingApplication?: { id: string; stageGroup: string; createdAt: string };\n};\n\nexport type TalentBankIdentifyParams = {\n\tanonymousId: string;\n\temail: string;\n\tfirstName?: string | null;\n\tlastName?: string | null;\n\tphone?: string | null;\n\t/** Caller tag — defaults to `'sdk'`. */\n\tsource?: CandidateSource;\n};\n\nexport type TalentBankIdentifyResult = { candidateId: string; isNew: boolean };\n\nexport interface TalentBankClient {\n\tcheckDuplicate(params: {\n\t\temail: string;\n\t\tjobId?: string | number;\n\t\tscope: DuplicateCheckScope;\n\t}): Promise<TalentBankCheckDuplicateResult>;\n\n\t/**\n\t * Resolve or create a Talent Bank candidate for the supplied identifier.\n\t *\n\t * This is the direct-to-Talent-Bank replacement for the old Laravel-proxied\n\t * `/log` IDENTIFY flow. The SDK calls this and then forwards the returned\n\t * `candidateId` on every subsequent analytics log so Laravel can stamp it\n\t * onto the session for attribution.\n\t *\n\t * Returns `null` if the call fails — identification is best-effort and must\n\t * never break the host page.\n\t */\n\tidentify(params: TalentBankIdentifyParams): Promise<TalentBankIdentifyResult | null>;\n}\n\nexport const createTalentBankClient = ({\n\tenvironment,\n\tpublishableKey,\n\tlogger,\n}: {\n\tenvironment: InploiSdkEnvironment;\n\tpublishableKey: string;\n\tlogger: Logger;\n}): TalentBankClient => {\n\tconst baseUrl = ENV_TO_TALENT_BANK_URL[environment];\n\n\treturn {\n\t\tasync checkDuplicate(params) {\n\t\t\ttry {\n\t\t\t\tconst searchParams = new URLSearchParams({ email: params.email, scope: params.scope });\n\t\t\t\tif (params.scope === 'job' && params.jobId != null) {\n\t\t\t\t\tsearchParams.set('job_id', String(params.jobId));\n\t\t\t\t}\n\n\t\t\t\tconst response = await fetch(`${baseUrl}/applications/check-duplicate?${searchParams}`, {\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\theaders: { Accept: 'application/json', 'x-publishable-key': publishableKey },\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tlogger.error(`[TalentBankClient] checkDuplicate failed with status ${response.status}`);\n\t\t\t\t\treturn { isDuplicate: false };\n\t\t\t\t}\n\n\t\t\t\tconst json = await response.json();\n\t\t\t\tconst parsed = v.safeParse(DuplicateCheckResultSchema, json);\n\t\t\t\tif (parsed.success) {\n\t\t\t\t\treturn parsed.output;\n\t\t\t\t}\n\n\t\t\t\t// `isDuplicate` is the only field callers gate on; `existingApplication`\n\t\t\t\t// is supplementary. A schema drift in that nested payload must never\n\t\t\t\t// silently downgrade a real duplicate to a non-duplicate, so fall back\n\t\t\t\t// to the flag directly rather than failing closed.\n\t\t\t\tlogger.error('[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag');\n\t\t\t\tif (\n\t\t\t\t\ttypeof json === 'object' &&\n\t\t\t\t\tjson != null &&\n\t\t\t\t\ttypeof (json as { isDuplicate?: unknown }).isDuplicate === 'boolean'\n\t\t\t\t) {\n\t\t\t\t\treturn { isDuplicate: (json as { isDuplicate: boolean }).isDuplicate };\n\t\t\t\t}\n\n\t\t\t\treturn { isDuplicate: false };\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error('[TalentBankClient] checkDuplicate failed:', e);\n\t\t\t\treturn { isDuplicate: false };\n\t\t\t}\n\t\t},\n\n\t\tasync identify(params) {\n\t\t\ttry {\n\t\t\t\tif (!params.anonymousId) {\n\t\t\t\t\tlogger.error('[TalentBankClient] identify skipped because anonymousId is missing');\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst body: v.InferInput<typeof IdentifyInputSchema> = {\n\t\t\t\t\temail: params.email,\n\t\t\t\t\tfirstName: params.firstName,\n\t\t\t\t\tlastName: params.lastName,\n\t\t\t\t\tphone: params.phone,\n\t\t\t\t\tanonymousId: params.anonymousId,\n\t\t\t\t\tsource: params.source ?? 'sdk',\n\t\t\t\t};\n\t\t\t\tconst parsedBody = v.safeParse(IdentifyInputSchema, body);\n\t\t\t\tif (!parsedBody.success) {\n\t\t\t\t\tlogger.error('[TalentBankClient] identify received invalid input');\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst response = await fetch(`${baseUrl}/identify`, {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t\tAccept: 'application/json',\n\t\t\t\t\t\t'x-publishable-key': publishableKey,\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify(parsedBody.output),\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tlogger.error(`[TalentBankClient] identify failed with status ${response.status}`);\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst parsed = v.safeParse(IdentifyResultSchema, await response.json());\n\t\t\t\tif (!parsed.success) {\n\t\t\t\t\tlogger.error('[TalentBankClient] identify returned an invalid response');\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn parsed.output;\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error('[TalentBankClient] identify failed:', e);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t},\n\t};\n};\n","import { AnalyticsOnEventCallback, createAnalyticsService } from './sdk.analytics';\nimport { createApiClient } from './sdk.api';\nimport { ENV_TO_API_URL, InploiSdkEnvironment } from './sdk.constants';\nimport { Logger, inploiBrandedLogger, noLogging } from './sdk.logger';\nimport { InploiSdkPlugin } from './sdk.plugins';\nimport { InploiRpcClient } from './sdk.rpc';\nimport { createTalentBankClient } from './sdk.talent-bank';\n\nexport type InitialiseInploiSdkParams = {\n\t/** Your public API key for the inploi SDK. */\n\tpublishableKey: string;\n\t/** Which app environment to run. This ultimately affects which inploi endpoints to gather data are going to be used.\n\t * Anything other than `production` should be considered a development environment and the data periodicaly purged. */\n\tenv: InploiSdkEnvironment;\n\t/** Logger object that handles logging of different levels.\n\t * You can override this to use your own logger, or to disable logging altogether by passing`false`.\n\t * @default inploiBrandedLogger\n\t * */\n\tlogger?: Logger | false;\n\n\t/** When provided, this callback will be called with every event that is logged to the analytics service. */\n\tonEvent?: AnalyticsOnEventCallback;\n};\n\nexport function initialiseSdk({\n\tpublishableKey,\n\tenv,\n\tlogger = inploiBrandedLogger,\n\tonEvent,\n}: InitialiseInploiSdkParams) {\n\t/** @deprecated - use `rpcClient` instead */\n\tconst apiClient = createApiClient({ baseUrl: ENV_TO_API_URL[env], publishableKey });\n\tconst loggerService = logger === false ? noLogging : logger;\n\tconst rpcClient = new InploiRpcClient({\n\t\tenvironment: env,\n\t\tapiKey: { type: 'publishable', key: publishableKey },\n\t\tlogger: loggerService,\n\t});\n\tconst talentBank = createTalentBankClient({ environment: env, publishableKey, logger: loggerService });\n\tconst analytics = createAnalyticsService({\n\t\trpcClient,\n\t\tlogger: loggerService,\n\t\tonEvent,\n\t\ttalentBank,\n\t});\n\n\tconst register = <P extends InploiSdkPlugin>(plugin: P): ReturnType<P> => {\n\t\treturn plugin({ logger: loggerService, apiClient, analytics, rpcClient, publishableKey, env });\n\t};\n\n\treturn { register, analytics, apiClient };\n}\n\nexport type InploiSdk = ReturnType<typeof initialiseSdk>;\n","import { CONSENT_STORAGE_KEY_PREFIX } from './sdk.constants';\n\n/**\n * Tenant-published consent / approval config (PROD-5763).\n *\n * Mirror of `ConsentConfig` in inploi/agents — the agent worker sends\n * this in the `authenticated` WS event for the SDK to render before\n * the chat is usable.\n *\n * enabled — render the consent screen on first session if true.\n * message — body copy; markdown is rendered, so customers can\n * embed links inline (e.g. \"By continuing you agree\n * to our [Privacy Policy](https://...)\").\n * acceptLabel — text on the \"agree\" button. SDK defaults to\n * \"I agree\" if omitted.\n * declineLabel — text on the \"decline\" button. SDK defaults to\n * \"Decline\".\n */\nexport interface ConsentConfig {\n\tenabled: boolean;\n\tmessage: string;\n\tacceptLabel?: string;\n\tdeclineLabel?: string;\n}\n\n/**\n * Deterministic, fast, non-cryptographic hash of the consent config.\n * Used purely as a cache-busting suffix on the localStorage key — so\n * any material wording / label change produces a new key and the\n * candidate is re-prompted. Not a security primitive.\n *\n * djb2 + base36 = ~7 chars, plenty of entropy for a per-tenant key\n * suffix and easy to eyeball / grep in devtools storage.\n *\n * Exported for unit testing.\n */\nexport function hashConsentConfig(config: ConsentConfig): string {\n\tconst canonical = JSON.stringify({\n\t\tmessage: config.message,\n\t\tacceptLabel: config.acceptLabel ?? '',\n\t\tdeclineLabel: config.declineLabel ?? '',\n\t});\n\tlet hash = 5381;\n\tfor (let i = 0; i < canonical.length; i++) {\n\t\t// djb2: hash * 33 + char\n\t\thash = (hash * 33) ^ canonical.charCodeAt(i);\n\t}\n\t// Force unsigned 32-bit, then base36 for compactness.\n\treturn (hash >>> 0).toString(36);\n}\n\n/**\n * Build the localStorage key for a (tenant × consent config) pair.\n *\n * Exported for unit testing.\n */\nexport function consentStorageKey(publishableKey: string, configHash: string): string {\n\treturn `${CONSENT_STORAGE_KEY_PREFIX}:${publishableKey}:${configHash}`;\n}\n\n/**\n * Has the candidate already accepted this exact consent config?\n *\n * Returns `false` in non-browser environments and when localStorage\n * throws (Safari private mode, sandboxed iframes without storage\n * access). Same conservative posture as `getStoredCandidateId` — if\n * we cannot prove acceptance, re-prompt.\n */\nexport function getConsentAcceptance(publishableKey: string, config: ConsentConfig): boolean {\n\tif (typeof window === 'undefined') return false;\n\ttry {\n\t\tconst key = consentStorageKey(publishableKey, hashConsentConfig(config));\n\t\treturn window.localStorage.getItem(key) === 'accepted';\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Persist the candidate's acceptance of this exact consent config.\n *\n * Silently no-ops on storage failures — the consent flow still works\n * for the current page even if we cannot remember it across reloads.\n * That matches the existing identity / candidate-id pattern.\n */\nexport function setConsentAcceptance(publishableKey: string, config: ConsentConfig): void {\n\tif (typeof window === 'undefined') return;\n\ttry {\n\t\tconst key = consentStorageKey(publishableKey, hashConsentConfig(config));\n\t\twindow.localStorage.setItem(key, 'accepted');\n\t} catch {\n\t\t// localStorage unavailable — see comment above.\n\t}\n}\n","export function ready(callback: () => void): void {\n\tif (typeof document === 'undefined') return;\n\n\tif (document.readyState === 'loading') {\n\t\tdocument.addEventListener('DOMContentLoaded', callback, { once: true });\n\t\treturn;\n\t}\n\n\tPromise.resolve().then(callback);\n}\n"],"mappings":"AAAO,IAAMA,EAAiB,iBACjBC,EAAgB,qCAUhBC,EAA8B,CAC1C,KAAM,IAAIC,IAAS,QAAQ,KAAKH,EAAgBC,EAAe,GAAGE,CAAI,EACtE,MAAO,IAAIA,IAAS,QAAQ,MAAMH,EAAgBC,EAAe,GAAGE,CAAI,EACxE,KAAM,IAAIA,IAAS,QAAQ,KAAKH,EAAgBC,EAAe,GAAGE,CAAI,EACtE,IAAK,IAAIA,IAAS,QAAQ,IAAIH,EAAgBC,EAAe,GAAGE,CAAI,CACrE,EAEaC,GAAoB,CAAE,KAAM,IAAG,GAAW,MAAO,IAAG,GAAW,IAAK,IAAG,GAAW,KAAM,IAAG,EAAU,ECW3G,IAAMC,GAA2CC,GAAgBA,ECzBjE,SAASC,GAAUC,EAAgBC,EAAqC,CAC9E,GAAI,CAAAD,EAIJ,MAAM,IAAI,MAAMC,CAAO,CACxB,CA2BO,SAASC,EAA+BC,EAAcC,EAAqC,CACjG,OAAOA,KAAQD,CAChB,CE9BA,IAAME,GAAoB,IAAI,KAAK,mBAAmB,OAAW,CAAE,QAAS,MAAO,CAAC,ECN7E,IAAMC,GAAyB,kBACzBC,GAAsB,+BAEtBC,EAAN,cAA8B,KAAM,CAE1C,YAAYC,EAAkBC,EAAiB,CAC9C,MAAMD,CAAO,EACb,KAAK,OAASC,EACd,KAAK,KAAO,iBACb,CACD,EAEaC,EAAN,cAA4BH,CAAgB,CAClD,YAAYC,EAAkB,CAC7B,MAAMA,GAAW,WAAW,EAC5B,KAAK,KAAO,gBACZ,KAAK,OAAS,GACf,CACD,EAEaG,EAAN,cAAgCJ,CAAgB,CACtD,YAAYC,EAAkBC,EAAiB,CAC9C,MAAMD,GAAW,gDAAgD,EACjE,KAAK,KAAO,oB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EAAwBL,EAA6B,CACzF,GAAI,SAAO,OAAW,KACtB,GAAI,CACH,IAAMS,EAAML,GAAkBC,EAAgBN,GAAkBC,CAAM,CAAC,EACvE,OAAO,aAAa,QAAQS,EAAK,UAAU,CAC5C,MAAQ,CAER,CACD,CC7FO,SAASE,GAAMC,EAA4B,CACjD,GAAI,SAAO,SAAa,KAExB,IAAI,SAAS,aAAe,UAAW,CACtC,SAAS,iBAAiB,mBAAoBA,EAAU,CAAE,KAAM,EAAK,CAAC,EACtE,MACD,CAEA,QAAQ,QAAQ,EAAE,KAAKA,CAAQ,EAChC","names":["CONSOLE_PREFIX","CONSOLE_STYLE","inploiBrandedLogger","args","noLogging","createPlugin","pluginFn","invariant","condition","message","hasProp","data","prop","DEFAULT_FORMATTER","unauthenticatedMessage","unauthorisedMessage","ErrorWithStatus","message","status","NotFoundError","UnauthorisedError","SchemaValidationError","issues","source","sourceText","ApiError","data","isApiErrorWithData","error","JsonParsingError","response","parseJsonResponse","response","mediaType","JsonParsingError","ERROR_MESSAGE_KEYS","getErrorMessageFromJson","json","messages","key","hasProp","value","item","handleApiExceptions","status","message","NotFoundError","unauthenticatedMessage","UnauthorisedError","unauthorisedMessage","ApiError","createApiClient","params","defaultHeaders","pathname","options","init","SdkError","SchemaValidationError","isSdkError","error","ErrorClass","version","ENV_TO_API_URL","ENV_TO_TALENT_BANK_URL","ANALYTICS_VERSION","version","ANALYTICS_COOKIE_NAME","ANALYTICS_CANDIDATE_ID_STORAGE_KEY","CONSENT_STORAGE_KEY_PREFIX","generateUUID","c","formatCookie","value","now","ANALYTICS_COOKIE_NAME","getSessionId","searchParams","isServer","fromSearchParams","fromSessionStorage","getStoredCandidateId","stored","ANALYTICS_CANDIDATE_ID_STORAGE_KEY","setStoredCandidateId","candidateId","cookieRegex","getSessionInfo","request","href","anonymous_id","session_id","cookie","getOrCreateAnonymousId","existing","newId","generateUUID","getSessionInfoFromResponse","response","serverReferrer","referrer","analyticsLogEndpoint","typed","createAnalyticsService","rpcClient","logger","onEvent","talentBank","params","invariant","page","context","ANALYTICS_VERSION","sessionInfo","resolvedCandidateId","identifyProperties","result","payload","responseJson","newSession","e","headers","stringify","parse","schema","input","source","result","SchemaValidationError","safeParse","e","InploiRpcClient","params","ENV_TO_API_URL","endpoint","options","validateIn","searchParams","body","validateEndpointInputs","url","pathname","key","value","stringify","json","parseJsonResponse","handleApiExceptions","fetchParams","response","typed","validatedInputs","v","CANDIDATE_SOURCES","STAGE_GROUPS","SCORE_TYPES","INTERVIEW_STATUSES","DUPLICATE_CHECK_SCOPES","APPLICATION_SORT_FIELDS","SORT_ORDERS","APPLICATION_SOURCES","APPLICATION_ACTIONS","ACTOR_TYPES","CandidateSourceSchema","CANDIDATE_SOURCES","StageGroupSchema","STAGE_GROUPS","StageSchema","ScoreTypeSchema","InterviewStatusSchema","DuplicateCheckScopeSchema","ApplicationSortFieldSchema","SortOrderSchema","DisqualificationReasonSchema","ApplicationSourceSchema","ApplicationActionSchema","ActorTypeSchema","ActorInputSchema","v","PaginationSchema","paginatedResultSchema","itemSchema","v","CandidateSchema","CandidateSourceSchema","v","v","RequiredStringSchema","PositiveIntegerSchema","UnknownRecordSchema","v","InterviewSchema","InterviewStatusSchema","UnknownRecordSchema","ScoreCategorySchema","ApplicationSchema","StageSchema","StageGroupSchema","DisqualificationReasonSchema","ApplicationSourceSchema","UnknownRecordSchema","ApplicationScoreSchema","ScoreTypeSchema","ApplicationDetailSchema","CandidateSchema","InterviewSchema","CandidateDetailSchema","ApplicationLogSchema","ApplicationActionSchema","ActorTypeSchema","IdentifyInputSchema","RequiredStringSchema","CandidateSourceSchema","IdentifyResultSchema","v","APPLY_ACTION_KEYS","ApplyActionKeySchema","CommaSeparatedStringSchema","s","t","StagesQuerySchema","StageSchema","StageGroupsQuerySchema","StageGroupSchema","JobIdsQuerySchema","ListApplicationsQuerySchema","ApplicationSortFieldSchema","SortOrderSchema","SubmitApplicationInputSchema","RequiredStringSchema","PositiveIntegerSchema","UnknownRecordSchema","ApplicationSourceSchema","ActorInputSchema","input","DuplicateApplicationSchema","SubmitApplicationResultSchema","DuplicateCheckResultSchema","WriteScoreInputSchema","ScoreTypeSchema","ScoreCategorySchema","WriteScoreResponseSchema","ListApplicationsResponseSchema","paginatedResultSchema","ApplicationDetailSchema","TransitionSkipReasonSchema","ListApplicationLogsResponseSchema","ApplicationLogSchema","NoteMeta","StageSchema","HireMeta","ApplyActionInputSchema","ActorInputSchema","StageGroupSchema","DisqualificationReasonSchema","BulkApplyActionInputSchema","ApplyActionSkipReasonSchema","ApplyActionResultSchema","ApplyActionKeySchema","ApplicationDetailSchema","BulkApplyActionResultSchema","NonNegativeIntegerSchema","JobApplicationCountsSchema","ListJobApplicationCountsQuerySchema","JobIdsQuerySchema","ListJobApplicationCountsResponseSchema","ListCandidatesResponseSchema","paginatedResultSchema","CandidateSchema","v","JobMetricsResponseSchema","v","createTalentBankClient","environment","publishableKey","logger","baseUrl","ENV_TO_TALENT_BANK_URL","params","searchParams","response","json","parsed","DuplicateCheckResultSchema","e","body","parsedBody","IdentifyInputSchema","IdentifyResultSchema","initialiseSdk","publishableKey","env","logger","inploiBrandedLogger","onEvent","apiClient","createApiClient","ENV_TO_API_URL","loggerService","noLogging","rpcClient","InploiRpcClient","talentBank","createTalentBankClient","analytics","createAnalyticsService","plugin","hashConsentConfig","config","canonical","hash","i","consentStorageKey","publishableKey","configHash","CONSENT_STORAGE_KEY_PREFIX","getConsentAcceptance","key","setConsentAcceptance","ready","callback"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/sdk",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "happy-dom": "^12.6.0",
29
29
  "ts-toolbelt": "^9.6.0",
30
30
  "tsup": "^7.2.0",
31
- "@inploi/core": "1.19.0",
31
+ "@inploi/core": "1.21.0",
32
32
  "eslint-config-custom": "0.1.0",
33
33
  "tsconfig": "0.1.0"
34
34
  },