@omnizoek/react 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +74 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -2
- package/dist/index.d.ts +84 -2
- package/dist/index.js +67 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -34,14 +34,20 @@ __export(index_exports, {
|
|
|
34
34
|
useAddressEnrich: () => useAddressEnrich,
|
|
35
35
|
useEmissionZone: () => useEmissionZone,
|
|
36
36
|
useEnergyLabel: () => useEnergyLabel,
|
|
37
|
+
useExchangeRates: () => useExchangeRates,
|
|
38
|
+
useGeocode: () => useGeocode,
|
|
37
39
|
useGridTrigger: () => useGridTrigger,
|
|
38
40
|
useHolidaySurcharge: () => useHolidaySurcharge,
|
|
39
41
|
useIbanToBic: () => useIbanToBic,
|
|
42
|
+
useLeiLookup: () => useLeiLookup,
|
|
40
43
|
useMinimumWage: () => useMinimumWage,
|
|
41
44
|
useOmniClient: () => useOmniClient,
|
|
45
|
+
useReverseGeocode: () => useReverseGeocode,
|
|
42
46
|
useTransitDisruptions: () => useTransitDisruptions,
|
|
43
47
|
useValidateFinance: () => useValidateFinance,
|
|
44
|
-
|
|
48
|
+
useVatRates: () => useVatRates,
|
|
49
|
+
useVatVerify: () => useVatVerify,
|
|
50
|
+
useVehicleHistory: () => useVehicleHistory
|
|
45
51
|
});
|
|
46
52
|
module.exports = __toCommonJS(index_exports);
|
|
47
53
|
|
|
@@ -103,6 +109,26 @@ function useAddressEnrich(params, options) {
|
|
|
103
109
|
);
|
|
104
110
|
}
|
|
105
111
|
|
|
112
|
+
// src/hooks/useGeocode.ts
|
|
113
|
+
function useGeocode(params, options) {
|
|
114
|
+
return useOmniQuery(
|
|
115
|
+
"geo.geocode",
|
|
116
|
+
params,
|
|
117
|
+
(client, p) => client.geo.geocode(p),
|
|
118
|
+
options
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/hooks/useReverseGeocode.ts
|
|
123
|
+
function useReverseGeocode(params, options) {
|
|
124
|
+
return useOmniQuery(
|
|
125
|
+
"geo.reverseGeocode",
|
|
126
|
+
params,
|
|
127
|
+
(client, p) => client.geo.reverseGeocode(p),
|
|
128
|
+
options
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
106
132
|
// src/hooks/useIbanToBic.ts
|
|
107
133
|
function useIbanToBic(params, options) {
|
|
108
134
|
return useOmniQuery(
|
|
@@ -123,6 +149,26 @@ function useVatVerify(params, options) {
|
|
|
123
149
|
);
|
|
124
150
|
}
|
|
125
151
|
|
|
152
|
+
// src/hooks/useExchangeRates.ts
|
|
153
|
+
function useExchangeRates(enabled, options) {
|
|
154
|
+
return useOmniQuery(
|
|
155
|
+
"finance.exchangeRates",
|
|
156
|
+
enabled === false || enabled === null ? null : {},
|
|
157
|
+
(_client, _p) => _client.finance.exchangeRates(),
|
|
158
|
+
options
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/hooks/useVatRates.ts
|
|
163
|
+
function useVatRates(params, options) {
|
|
164
|
+
return useOmniQuery(
|
|
165
|
+
"finance.vatRates",
|
|
166
|
+
params,
|
|
167
|
+
(client, p) => client.finance.vatRates(p),
|
|
168
|
+
options
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
126
172
|
// src/hooks/useValidateFinance.ts
|
|
127
173
|
function useValidateFinance(params, options) {
|
|
128
174
|
return useOmniQuery(
|
|
@@ -183,6 +229,16 @@ function useTransitDisruptions(params, options) {
|
|
|
183
229
|
);
|
|
184
230
|
}
|
|
185
231
|
|
|
232
|
+
// src/hooks/useVehicleHistory.ts
|
|
233
|
+
function useVehicleHistory(params, options) {
|
|
234
|
+
return useOmniQuery(
|
|
235
|
+
"logistics.vehicleHistory",
|
|
236
|
+
params,
|
|
237
|
+
(client, p) => client.logistics.vehicleHistory(p),
|
|
238
|
+
options
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
186
242
|
// src/hooks/useGridTrigger.ts
|
|
187
243
|
function useGridTrigger(params, options) {
|
|
188
244
|
return useOmniQuery(
|
|
@@ -192,19 +248,35 @@ function useGridTrigger(params, options) {
|
|
|
192
248
|
options
|
|
193
249
|
);
|
|
194
250
|
}
|
|
251
|
+
|
|
252
|
+
// src/hooks/useLeiLookup.ts
|
|
253
|
+
function useLeiLookup(params, options) {
|
|
254
|
+
return useOmniQuery(
|
|
255
|
+
"business.leiLookup",
|
|
256
|
+
params,
|
|
257
|
+
(client, p) => client.business.leiLookup(p),
|
|
258
|
+
options
|
|
259
|
+
);
|
|
260
|
+
}
|
|
195
261
|
// Annotate the CommonJS export names for ESM import in node:
|
|
196
262
|
0 && (module.exports = {
|
|
197
263
|
OmniProvider,
|
|
198
264
|
useAddressEnrich,
|
|
199
265
|
useEmissionZone,
|
|
200
266
|
useEnergyLabel,
|
|
267
|
+
useExchangeRates,
|
|
268
|
+
useGeocode,
|
|
201
269
|
useGridTrigger,
|
|
202
270
|
useHolidaySurcharge,
|
|
203
271
|
useIbanToBic,
|
|
272
|
+
useLeiLookup,
|
|
204
273
|
useMinimumWage,
|
|
205
274
|
useOmniClient,
|
|
275
|
+
useReverseGeocode,
|
|
206
276
|
useTransitDisruptions,
|
|
207
277
|
useValidateFinance,
|
|
208
|
-
|
|
278
|
+
useVatRates,
|
|
279
|
+
useVatVerify,
|
|
280
|
+
useVehicleHistory
|
|
209
281
|
});
|
|
210
282
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/context.tsx","../src/hooks/useOmniQuery.ts","../src/hooks/useAddressEnrich.ts","../src/hooks/useIbanToBic.ts","../src/hooks/useVatVerify.ts","../src/hooks/useValidateFinance.ts","../src/hooks/useMinimumWage.ts","../src/hooks/useHolidaySurcharge.ts","../src/hooks/useEnergyLabel.ts","../src/hooks/useEmissionZone.ts","../src/hooks/useTransitDisruptions.ts","../src/hooks/useGridTrigger.ts"],"sourcesContent":["/**\n * @omnizoek/react — React hooks for the OmniZoek API\n *\n * @example\n * ```tsx\n * import { OmniProvider, useAddressEnrich } from \"@omnizoek/react\";\n *\n * // Wrap once at the root:\n * <OmniProvider apiKey={process.env.NEXT_PUBLIC_OMNI_API_KEY!}>\n * <App />\n * </OmniProvider>\n *\n * // Use hooks anywhere in the tree:\n * const { data, loading } = useAddressEnrich({ postcode: \"1012LG\", houseNumber: \"1\" });\n * ```\n */\n\n// Provider + context\nexport { OmniProvider, useOmniClient } from \"./context.js\";\nexport type { OmniProviderProps } from \"./context.js\";\n\n// Shared result type\nexport type { OmniHookResult, UseOmniQueryOptions } from \"./hooks/useOmniQuery.js\";\n\n// Hooks\nexport { useAddressEnrich } from \"./hooks/useAddressEnrich.js\";\nexport { useIbanToBic } from \"./hooks/useIbanToBic.js\";\nexport { useVatVerify } from \"./hooks/useVatVerify.js\";\nexport { useValidateFinance } from \"./hooks/useValidateFinance.js\";\nexport { useMinimumWage } from \"./hooks/useMinimumWage.js\";\nexport { useHolidaySurcharge } from \"./hooks/useHolidaySurcharge.js\";\nexport { useEnergyLabel } from \"./hooks/useEnergyLabel.js\";\nexport { useEmissionZone } from \"./hooks/useEmissionZone.js\";\nexport { useTransitDisruptions } from \"./hooks/useTransitDisruptions.js\";\nexport { useGridTrigger } from \"./hooks/useGridTrigger.js\";\n","/**\n * context.tsx — OmniProvider and useOmniClient.\n *\n * Wrap your app (or a subtree) once with <OmniProvider apiKey=\"...\">\n * to make all hooks available without prop-drilling the API key.\n *\n * @example\n * ```tsx\n * // app/layout.tsx (Next.js App Router)\n * \"use client\";\n *\n * import { OmniProvider } from \"@omnizoek/react\";\n *\n * export default function RootLayout({ children }) {\n * return (\n * <OmniProvider apiKey={process.env.NEXT_PUBLIC_OMNI_API_KEY!}>\n * {children}\n * </OmniProvider>\n * );\n * }\n * ```\n */\n\nimport {\n createContext,\n useContext,\n useMemo,\n type ReactNode,\n} from \"react\";\nimport { OmniClient, type OmniClientOptions } from \"@omnizoek/sdk\";\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst OmniContext = createContext<OmniClient | null>(null);\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport interface OmniProviderProps {\n /** Your OmniZoek API key (omni_live_… or omni_test_…) */\n apiKey: string;\n /** Override the API base URL — useful for testing against a local mock */\n baseUrl?: string;\n /** Additional client options forwarded to OmniClient */\n options?: Omit<OmniClientOptions, \"apiKey\" | \"baseUrl\">;\n children: ReactNode;\n}\n\n/**\n * Provides an OmniClient instance to all descendant hooks.\n * The client is created once and recreated only when `apiKey` or `baseUrl` changes.\n */\nexport function OmniProvider({\n apiKey,\n baseUrl,\n options,\n children,\n}: OmniProviderProps) {\n const client = useMemo(\n () => new OmniClient({ apiKey, baseUrl, ...options }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [apiKey, baseUrl],\n );\n\n return <OmniContext.Provider value={client}>{children}</OmniContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the OmniClient instance from the nearest OmniProvider.\n * Throws if called outside of an OmniProvider.\n */\nexport function useOmniClient(): OmniClient {\n const client = useContext(OmniContext);\n if (!client) {\n throw new Error(\n \"[OmniZoek] useOmniClient must be called inside an <OmniProvider>. \" +\n \"Wrap your app or component tree with <OmniProvider apiKey=\\\"...\\\">.\",\n );\n }\n return client;\n}\n","/**\n * useOmniQuery.ts — Internal generic hook powering all endpoint hooks.\n *\n * Not exported from the package — consumers use the named endpoint hooks.\n */\n\nimport useSWR from \"swr\";\nimport type { OmniClient } from \"@omnizoek/sdk\";\nimport { useOmniClient } from \"../context.js\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface OmniHookResult<T> {\n /** Response data, or `undefined` while loading or on error */\n data: T | undefined;\n /** `true` on the initial load (no cached data yet) */\n loading: boolean;\n /** `true` whenever a background revalidation is in flight */\n validating: boolean;\n /** Typed error from the SDK, or `null` */\n error: Error | null;\n /** Manually trigger a refetch / revalidation */\n refetch: () => Promise<T | undefined>;\n}\n\nexport interface UseOmniQueryOptions {\n /**\n * Set to `false` to skip the request entirely.\n * Useful when required inputs haven't been filled in yet.\n * @default true\n */\n enabled?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Generic hook\n// ---------------------------------------------------------------------------\n\n/**\n * Internal hook shared by all endpoint-specific hooks.\n *\n * @param endpointKey Stable string identifying this endpoint (used as SWR cache key prefix)\n * @param params Request params — pass `null` or `undefined` to skip the request\n * @param fetcher Function that calls the relevant OmniClient method\n * @param options Hook options (enabled, etc.)\n */\nexport function useOmniQuery<P, R>(\n endpointKey: string,\n params: P | null | undefined,\n fetcher: (client: OmniClient, params: P) => Promise<R>,\n options?: UseOmniQueryOptions,\n): OmniHookResult<R> {\n const client = useOmniClient();\n const isEnabled = options?.enabled !== false;\n\n // SWR key: null → skip request; array → fetch\n const swrKey: [string, P] | null =\n isEnabled && params != null ? [endpointKey, params] : null;\n\n const { data, error, isLoading, isValidating, mutate } = useSWR<R, Error>(\n swrKey,\n ([, p]: [string, P]) => fetcher(client, p),\n { shouldRetryOnError: false },\n );\n\n return {\n data,\n loading: isLoading,\n validating: isValidating,\n error: error ?? null,\n refetch: () => mutate(),\n };\n}\n","import type { AddressEnrichParams, AddressEnrichResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Enrich a Dutch address using postcode + house number.\n *\n * Calls `GET /v1/geo/enrich` via the BAG (Basisregistratie Adressen en Gebouwen).\n * Returns street, city, coordinates, BAG ID, surface area, and energy label.\n *\n * Pass `null` as `params` to skip the request (e.g. while the user is still typing).\n *\n * @example\n * ```tsx\n * const { data, loading, error } = useAddressEnrich(\n * postcode && houseNumber ? { postcode, houseNumber } : null\n * );\n * if (loading) return <Spinner />;\n * return <span>{data?.street} {data?.city}</span>;\n * ```\n */\nexport function useAddressEnrich(\n params: AddressEnrichParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<AddressEnrichResponse> {\n return useOmniQuery(\n \"geo.enrichAddress\",\n params,\n (client, p) => client.geo.enrichAddress(p),\n options,\n );\n}\n","import type { IbanToBicParams, IbanToBicResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Resolve a Dutch IBAN to its BIC code and bank name.\n *\n * Calls `GET /v1/finance/iban-to-bic`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useIbanToBic(iban ? { iban } : null);\n * return <span>{data?.bank_name} ({data?.bic})</span>;\n * ```\n */\nexport function useIbanToBic(\n params: IbanToBicParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<IbanToBicResponse> {\n return useOmniQuery(\n \"finance.ibanToBic\",\n params,\n (client, p) => client.finance.ibanToBic(p),\n options,\n );\n}\n","import type { VatVerifyParams, VatVerifyResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Verify a European VAT number via VIES.\n *\n * Calls `GET /v1/finance/vat-verify`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useVatVerify(\n * vatNumber ? { countryCode: \"NL\", vatNumber } : null\n * );\n * return <span>{data?.valid ? \"✅ Geldig\" : \"❌ Ongeldig\"}</span>;\n * ```\n */\nexport function useVatVerify(\n params: VatVerifyParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<VatVerifyResponse> {\n return useOmniQuery(\n \"finance.vatVerify\",\n params,\n (client, p) => client.finance.vatVerify(p),\n options,\n );\n}\n","import type { ValidateFinanceParams, FinanceValidationResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Validate a BSN or IBAN number using local checksum algorithms.\n *\n * Calls `GET /v1/compliance/validate-finance`.\n * No external service called — pure algorithm check.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * // BSN validation\n * const { data } = useValidateFinance(bsn ? { type: \"bsn\", number: bsn } : null);\n *\n * // IBAN validation\n * const { data } = useValidateFinance(iban ? { type: \"iban\", number: iban } : null);\n *\n * return <span>{data?.valid ? \"✅\" : \"❌\"} {data?.detail}</span>;\n * ```\n */\nexport function useValidateFinance(\n params: ValidateFinanceParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<FinanceValidationResponse> {\n return useOmniQuery(\n \"compliance.validateFinance\",\n params,\n (client, p) => client.compliance.validateFinance(p),\n options,\n );\n}\n","import type { MinimumWageParams, MinimumWageResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Retrieve the Dutch statutory minimum wage (WML) for a given age.\n *\n * Calls `GET /v1/hr/minimum-wage`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useMinimumWage(age ? { age } : null);\n * return <span>Minimumloon: €{data?.hourly_eur.toFixed(2)}/uur</span>;\n * ```\n */\nexport function useMinimumWage(\n params: MinimumWageParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<MinimumWageResponse> {\n return useOmniQuery(\n \"hr.minimumWage\",\n params,\n (client, p) => client.hr.minimumWage(p),\n options,\n );\n}\n","import type { HolidaySurchargeParams, HolidaySurchargeResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check whether a date is a Dutch public holiday and get the applicable\n * surcharge multiplier for a given industry (e.g. \"horeca\", \"retail\").\n *\n * Calls `GET /v1/hr/holiday-surcharge`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data } = useHolidaySurcharge(\n * date ? { date, industry: \"horeca\" } : null\n * );\n * if (data?.is_holiday) {\n * return <span>Toeslag: {data.surcharge_multiplier}× ({data.holiday_name})</span>;\n * }\n * ```\n */\nexport function useHolidaySurcharge(\n params: HolidaySurchargeParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<HolidaySurchargeResponse> {\n return useOmniQuery(\n \"hr.holidaySurcharge\",\n params,\n (client, p) => client.hr.holidaySurcharge(p),\n options,\n );\n}\n","import type { EnergyLabelParams, EnergyLabelResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Retrieve the EP-Online energy label for a Dutch property.\n *\n * Calls `GET /v1/real-estate/energy-label`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useEnergyLabel(\n * postcode && houseNumber ? { postcode, houseNumber } : null\n * );\n * return <span>Energielabel: {data?.energy_label ?? \"–\"}</span>;\n * ```\n */\nexport function useEnergyLabel(\n params: EnergyLabelParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<EnergyLabelResponse> {\n return useOmniQuery(\n \"realEstate.energyLabel\",\n params,\n (client, p) => client.realEstate.energyLabel(p),\n options,\n );\n}\n","import type { EmissionZoneParams, EmissionZoneResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check whether a Dutch vehicle (by licence plate) is zero-emission compliant\n * for urban emission zones.\n *\n * Calls `GET /v1/logistics/emission-zone`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data } = useEmissionZone(kenteken ? { kenteken } : null);\n * return <span>{data?.ze_compliant ? \"✅ ZE-compliant\" : \"❌ Niet toegestaan\"}</span>;\n * ```\n */\nexport function useEmissionZone(\n params: EmissionZoneParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<EmissionZoneResponse> {\n return useOmniQuery(\n \"logistics.emissionZone\",\n params,\n (client, p) => client.logistics.emissionZone(p),\n options,\n );\n}\n","import type { TransitDisruptionsParams, TransitDisruptionsResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Fetch current NS train disruptions for a given station.\n *\n * Calls `GET /v1/logistics/transit-disruptions`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useTransitDisruptions({ stationCode: \"ASD\" });\n *\n * if (loading) return <Spinner />;\n * return (\n * <ul>\n * {data?.disruptions.map(d => <li key={d.title}>{d.title}</li>)}\n * </ul>\n * );\n * ```\n */\nexport function useTransitDisruptions(\n params: TransitDisruptionsParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<TransitDisruptionsResponse> {\n return useOmniQuery(\n \"logistics.transitDisruptions\",\n params,\n (client, p) => client.logistics.transitDisruptions(p),\n options,\n );\n}\n","import type { GridTriggerParams, GridTriggerResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check the current ENTSO-E day-ahead electricity price and whether it is\n * negative (a signal to run high-consumption processes).\n *\n * Calls `GET /v1/energy/grid-trigger`.\n * Always fetches unless `options.enabled` is `false`.\n *\n * @example\n * ```tsx\n * const { data } = useGridTrigger();\n *\n * if (data?.trigger) {\n * return <Banner>⚡ Stroomprijs negatief — goedkoop laden!</Banner>;\n * }\n * ```\n */\nexport function useGridTrigger(\n params?: GridTriggerParams,\n options?: UseOmniQueryOptions,\n): OmniHookResult<GridTriggerResponse> {\n // Always pass a params object (even empty) so the request fires by default.\n return useOmniQuery(\n \"energy.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,OAAO,UAAU,mBAAmB,CAAC;AAAA,IACpD;AAAA,EACF;AACF;;;ACZO,SAAS,eACd,QACA,SACqC;AAErC,SAAO;AAAA,IACL;AAAA,IACA,UAAU,CAAC;AAAA,IACX,CAAC,QAAQ,MAAM,OAAO,OAAO,YAAY,CAAC;AAAA,IAC1C;AAAA,EACF;AACF;","names":["useSWR"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/context.tsx","../src/hooks/useOmniQuery.ts","../src/hooks/useAddressEnrich.ts","../src/hooks/useGeocode.ts","../src/hooks/useReverseGeocode.ts","../src/hooks/useIbanToBic.ts","../src/hooks/useVatVerify.ts","../src/hooks/useExchangeRates.ts","../src/hooks/useVatRates.ts","../src/hooks/useValidateFinance.ts","../src/hooks/useMinimumWage.ts","../src/hooks/useHolidaySurcharge.ts","../src/hooks/useEnergyLabel.ts","../src/hooks/useEmissionZone.ts","../src/hooks/useTransitDisruptions.ts","../src/hooks/useVehicleHistory.ts","../src/hooks/useGridTrigger.ts","../src/hooks/useLeiLookup.ts"],"sourcesContent":["/**\n * @omnizoek/react — React hooks for the OmniZoek API\n *\n * @example\n * ```tsx\n * import { OmniProvider, useAddressEnrich } from \"@omnizoek/react\";\n *\n * // Wrap once at the root:\n * <OmniProvider apiKey={process.env.NEXT_PUBLIC_OMNI_API_KEY!}>\n * <App />\n * </OmniProvider>\n *\n * // Use hooks anywhere in the tree:\n * const { data, loading } = useAddressEnrich({ postcode: \"1012LG\", houseNumber: \"1\" });\n * ```\n */\n\n// Provider + context\nexport { OmniProvider, useOmniClient } from \"./context.js\";\nexport type { OmniProviderProps } from \"./context.js\";\n\n// Shared result type\nexport type { OmniHookResult, UseOmniQueryOptions } from \"./hooks/useOmniQuery.js\";\n\n// Hooks\nexport { useAddressEnrich } from \"./hooks/useAddressEnrich.js\";\nexport { useGeocode } from \"./hooks/useGeocode.js\";\nexport { useReverseGeocode } from \"./hooks/useReverseGeocode.js\";\nexport { useIbanToBic } from \"./hooks/useIbanToBic.js\";\nexport { useVatVerify } from \"./hooks/useVatVerify.js\";\nexport { useExchangeRates } from \"./hooks/useExchangeRates.js\";\nexport { useVatRates } from \"./hooks/useVatRates.js\";\nexport { useValidateFinance } from \"./hooks/useValidateFinance.js\";\nexport { useMinimumWage } from \"./hooks/useMinimumWage.js\";\nexport { useHolidaySurcharge } from \"./hooks/useHolidaySurcharge.js\";\nexport { useEnergyLabel } from \"./hooks/useEnergyLabel.js\";\nexport { useEmissionZone } from \"./hooks/useEmissionZone.js\";\nexport { useTransitDisruptions } from \"./hooks/useTransitDisruptions.js\";\nexport { useVehicleHistory } from \"./hooks/useVehicleHistory.js\";\nexport { useGridTrigger } from \"./hooks/useGridTrigger.js\";\nexport { useLeiLookup } from \"./hooks/useLeiLookup.js\";\n","/**\n * context.tsx — OmniProvider and useOmniClient.\n *\n * Wrap your app (or a subtree) once with <OmniProvider apiKey=\"...\">\n * to make all hooks available without prop-drilling the API key.\n *\n * @example\n * ```tsx\n * // app/layout.tsx (Next.js App Router)\n * \"use client\";\n *\n * import { OmniProvider } from \"@omnizoek/react\";\n *\n * export default function RootLayout({ children }) {\n * return (\n * <OmniProvider apiKey={process.env.NEXT_PUBLIC_OMNI_API_KEY!}>\n * {children}\n * </OmniProvider>\n * );\n * }\n * ```\n */\n\nimport {\n createContext,\n useContext,\n useMemo,\n type ReactNode,\n} from \"react\";\nimport { OmniClient, type OmniClientOptions } from \"@omnizoek/sdk\";\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst OmniContext = createContext<OmniClient | null>(null);\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport interface OmniProviderProps {\n /** Your OmniZoek API key (omni_live_… or omni_test_…) */\n apiKey: string;\n /** Override the API base URL — useful for testing against a local mock */\n baseUrl?: string;\n /** Additional client options forwarded to OmniClient */\n options?: Omit<OmniClientOptions, \"apiKey\" | \"baseUrl\">;\n children: ReactNode;\n}\n\n/**\n * Provides an OmniClient instance to all descendant hooks.\n * The client is created once and recreated only when `apiKey` or `baseUrl` changes.\n */\nexport function OmniProvider({\n apiKey,\n baseUrl,\n options,\n children,\n}: OmniProviderProps) {\n const client = useMemo(\n () => new OmniClient({ apiKey, baseUrl, ...options }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [apiKey, baseUrl],\n );\n\n return <OmniContext.Provider value={client}>{children}</OmniContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the OmniClient instance from the nearest OmniProvider.\n * Throws if called outside of an OmniProvider.\n */\nexport function useOmniClient(): OmniClient {\n const client = useContext(OmniContext);\n if (!client) {\n throw new Error(\n \"[OmniZoek] useOmniClient must be called inside an <OmniProvider>. \" +\n \"Wrap your app or component tree with <OmniProvider apiKey=\\\"...\\\">.\",\n );\n }\n return client;\n}\n","/**\n * useOmniQuery.ts — Internal generic hook powering all endpoint hooks.\n *\n * Not exported from the package — consumers use the named endpoint hooks.\n */\n\nimport useSWR from \"swr\";\nimport type { OmniClient } from \"@omnizoek/sdk\";\nimport { useOmniClient } from \"../context.js\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface OmniHookResult<T> {\n /** Response data, or `undefined` while loading or on error */\n data: T | undefined;\n /** `true` on the initial load (no cached data yet) */\n loading: boolean;\n /** `true` whenever a background revalidation is in flight */\n validating: boolean;\n /** Typed error from the SDK, or `null` */\n error: Error | null;\n /** Manually trigger a refetch / revalidation */\n refetch: () => Promise<T | undefined>;\n}\n\nexport interface UseOmniQueryOptions {\n /**\n * Set to `false` to skip the request entirely.\n * Useful when required inputs haven't been filled in yet.\n * @default true\n */\n enabled?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Generic hook\n// ---------------------------------------------------------------------------\n\n/**\n * Internal hook shared by all endpoint-specific hooks.\n *\n * @param endpointKey Stable string identifying this endpoint (used as SWR cache key prefix)\n * @param params Request params — pass `null` or `undefined` to skip the request\n * @param fetcher Function that calls the relevant OmniClient method\n * @param options Hook options (enabled, etc.)\n */\nexport function useOmniQuery<P, R>(\n endpointKey: string,\n params: P | null | undefined,\n fetcher: (client: OmniClient, params: P) => Promise<R>,\n options?: UseOmniQueryOptions,\n): OmniHookResult<R> {\n const client = useOmniClient();\n const isEnabled = options?.enabled !== false;\n\n // SWR key: null → skip request; array → fetch\n const swrKey: [string, P] | null =\n isEnabled && params != null ? [endpointKey, params] : null;\n\n const { data, error, isLoading, isValidating, mutate } = useSWR<R, Error>(\n swrKey,\n ([, p]: [string, P]) => fetcher(client, p),\n { shouldRetryOnError: false },\n );\n\n return {\n data,\n loading: isLoading,\n validating: isValidating,\n error: error ?? null,\n refetch: () => mutate(),\n };\n}\n","import type { AddressEnrichParams, AddressEnrichResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Enrich a Dutch address using postcode + house number.\n *\n * Calls `GET /v1/geo/enrich` via the BAG (Basisregistratie Adressen en Gebouwen).\n * Returns street, city, coordinates, BAG ID, surface area, and energy label.\n *\n * Pass `null` as `params` to skip the request (e.g. while the user is still typing).\n *\n * @example\n * ```tsx\n * const { data, loading, error } = useAddressEnrich(\n * postcode && houseNumber ? { postcode, houseNumber } : null\n * );\n * if (loading) return <Spinner />;\n * return <span>{data?.street} {data?.city}</span>;\n * ```\n */\nexport function useAddressEnrich(\n params: AddressEnrichParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<AddressEnrichResponse> {\n return useOmniQuery(\n \"geo.enrichAddress\",\n params,\n (client, p) => client.geo.enrichAddress(p),\n options,\n );\n}\n","import type { GeocodeParams, GeocodeResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Free-text address search via PDOK Locatieserver.\n * Returns up to `rows` matching locations with coordinates and BAG IDs.\n * Pass `null` as `params` to skip the request (e.g. while the user is still typing).\n *\n * @example\n * ```tsx\n * const { data, loading } = useGeocode(\n * query.length >= 3 ? { q: query, rows: 5 } : null\n * );\n * ```\n */\nexport function useGeocode(\n params: GeocodeParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<GeocodeResponse> {\n return useOmniQuery(\n \"geo.geocode\",\n params,\n (client, p) => client.geo.geocode(p),\n options,\n );\n}\n","import type { ReverseGeocodeParams, ReverseGeocodeResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Convert WGS84 coordinates to the nearest Dutch address via PDOK Locatieserver.\n * Pass `null` as `params` to skip the request (e.g. while coordinates are not yet known).\n *\n * @example\n * ```tsx\n * const { data, loading } = useReverseGeocode(\n * coords ? { lat: coords.lat, lon: coords.lon } : null\n * );\n * return <span>{data?.display_name}</span>;\n * ```\n */\nexport function useReverseGeocode(\n params: ReverseGeocodeParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<ReverseGeocodeResponse> {\n return useOmniQuery(\n \"geo.reverseGeocode\",\n params,\n (client, p) => client.geo.reverseGeocode(p),\n options,\n );\n}\n","import type { IbanToBicParams, IbanToBicResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Resolve a Dutch IBAN to its BIC code and bank name.\n *\n * Calls `GET /v1/finance/iban-to-bic`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useIbanToBic(iban ? { iban } : null);\n * return <span>{data?.bank_name} ({data?.bic})</span>;\n * ```\n */\nexport function useIbanToBic(\n params: IbanToBicParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<IbanToBicResponse> {\n return useOmniQuery(\n \"finance.ibanToBic\",\n params,\n (client, p) => client.finance.ibanToBic(p),\n options,\n );\n}\n","import type { VatVerifyParams, VatVerifyResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Verify a European VAT number via VIES.\n *\n * Calls `GET /v1/finance/vat-verify`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useVatVerify(\n * vatNumber ? { countryCode: \"NL\", vatNumber } : null\n * );\n * return <span>{data?.valid ? \"✅ Geldig\" : \"❌ Ongeldig\"}</span>;\n * ```\n */\nexport function useVatVerify(\n params: VatVerifyParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<VatVerifyResponse> {\n return useOmniQuery(\n \"finance.vatVerify\",\n params,\n (client, p) => client.finance.vatVerify(p),\n options,\n );\n}\n","import type { ExchangeRatesResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Daily ECB euro foreign exchange reference rates (~30 currencies).\n * Cached for 4 hours — pass `null` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading, error } = useExchangeRates();\n * return <span>USD: {data?.rates.USD}</span>;\n * ```\n */\nexport function useExchangeRates(\n enabled?: boolean | null,\n options?: UseOmniQueryOptions,\n): OmniHookResult<ExchangeRatesResponse> {\n return useOmniQuery(\n \"finance.exchangeRates\",\n enabled === false || enabled === null ? null : {},\n (_client, _p) => _client.finance.exchangeRates(),\n options,\n );\n}\n","import type { VatRatesParams, VatRatesResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Official VAT rates for any EU/EEA country plus GB, NO, CH.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useVatRates({ country: \"NL\" });\n * return <span>Standard rate: {data?.standard_rate}%</span>;\n * ```\n */\nexport function useVatRates(\n params: VatRatesParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<VatRatesResponse> {\n return useOmniQuery(\n \"finance.vatRates\",\n params,\n (client, p) => client.finance.vatRates(p),\n options,\n );\n}\n","import type { ValidateFinanceParams, FinanceValidationResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Validate a BSN or IBAN number using local checksum algorithms.\n *\n * Calls `GET /v1/compliance/validate-finance`.\n * No external service called — pure algorithm check.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * // BSN validation\n * const { data } = useValidateFinance(bsn ? { type: \"bsn\", number: bsn } : null);\n *\n * // IBAN validation\n * const { data } = useValidateFinance(iban ? { type: \"iban\", number: iban } : null);\n *\n * return <span>{data?.valid ? \"✅\" : \"❌\"} {data?.detail}</span>;\n * ```\n */\nexport function useValidateFinance(\n params: ValidateFinanceParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<FinanceValidationResponse> {\n return useOmniQuery(\n \"compliance.validateFinance\",\n params,\n (client, p) => client.compliance.validateFinance(p),\n options,\n );\n}\n","import type { MinimumWageParams, MinimumWageResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Retrieve the Dutch statutory minimum wage (WML) for a given age.\n *\n * Calls `GET /v1/hr/minimum-wage`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useMinimumWage(age ? { age } : null);\n * return <span>Minimumloon: €{data?.hourly_eur.toFixed(2)}/uur</span>;\n * ```\n */\nexport function useMinimumWage(\n params: MinimumWageParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<MinimumWageResponse> {\n return useOmniQuery(\n \"hr.minimumWage\",\n params,\n (client, p) => client.hr.minimumWage(p),\n options,\n );\n}\n","import type { HolidaySurchargeParams, HolidaySurchargeResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check whether a date is a Dutch public holiday and get the applicable\n * surcharge multiplier for a given industry (e.g. \"horeca\", \"retail\").\n *\n * Calls `GET /v1/hr/holiday-surcharge`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data } = useHolidaySurcharge(\n * date ? { date, industry: \"horeca\" } : null\n * );\n * if (data?.is_holiday) {\n * return <span>Toeslag: {data.surcharge_multiplier}× ({data.holiday_name})</span>;\n * }\n * ```\n */\nexport function useHolidaySurcharge(\n params: HolidaySurchargeParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<HolidaySurchargeResponse> {\n return useOmniQuery(\n \"hr.holidaySurcharge\",\n params,\n (client, p) => client.hr.holidaySurcharge(p),\n options,\n );\n}\n","import type { EnergyLabelParams, EnergyLabelResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Retrieve the EP-Online energy label for a Dutch property.\n *\n * Calls `GET /v1/real-estate/energy-label`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useEnergyLabel(\n * postcode && houseNumber ? { postcode, houseNumber } : null\n * );\n * return <span>Energielabel: {data?.energy_label ?? \"–\"}</span>;\n * ```\n */\nexport function useEnergyLabel(\n params: EnergyLabelParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<EnergyLabelResponse> {\n return useOmniQuery(\n \"realEstate.energyLabel\",\n params,\n (client, p) => client.realEstate.energyLabel(p),\n options,\n );\n}\n","import type { EmissionZoneParams, EmissionZoneResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check whether a Dutch vehicle (by licence plate) is zero-emission compliant\n * for urban emission zones.\n *\n * Calls `GET /v1/logistics/emission-zone`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data } = useEmissionZone(kenteken ? { kenteken } : null);\n * return <span>{data?.ze_compliant ? \"✅ ZE-compliant\" : \"❌ Niet toegestaan\"}</span>;\n * ```\n */\nexport function useEmissionZone(\n params: EmissionZoneParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<EmissionZoneResponse> {\n return useOmniQuery(\n \"logistics.emissionZone\",\n params,\n (client, p) => client.logistics.emissionZone(p),\n options,\n );\n}\n","import type { TransitDisruptionsParams, TransitDisruptionsResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Fetch current NS train disruptions for a given station.\n *\n * Calls `GET /v1/logistics/transit-disruptions`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useTransitDisruptions({ stationCode: \"ASD\" });\n *\n * if (loading) return <Spinner />;\n * return (\n * <ul>\n * {data?.disruptions.map(d => <li key={d.title}>{d.title}</li>)}\n * </ul>\n * );\n * ```\n */\nexport function useTransitDisruptions(\n params: TransitDisruptionsParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<TransitDisruptionsResponse> {\n return useOmniQuery(\n \"logistics.transitDisruptions\",\n params,\n (client, p) => client.logistics.transitDisruptions(p),\n options,\n );\n}\n","import type { VehicleHistoryParams, VehicleHistoryResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Full RDW vehicle record for a Dutch licence plate (APK, fuel, emissions, recalls).\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading, error } = useVehicleHistory(\n * plate ? { kenteken: plate } : null\n * );\n * if (loading) return <Spinner />;\n * return <span>{data?.make} {data?.commercial_name}</span>;\n * ```\n */\nexport function useVehicleHistory(\n params: VehicleHistoryParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<VehicleHistoryResponse> {\n return useOmniQuery(\n \"logistics.vehicleHistory\",\n params,\n (client, p) => client.logistics.vehicleHistory(p),\n options,\n );\n}\n","import type { GridTriggerParams, GridTriggerResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check the current ENTSO-E day-ahead electricity price and whether it is\n * negative (a signal to run high-consumption processes).\n *\n * Calls `GET /v1/energy/grid-trigger`.\n * Always fetches unless `options.enabled` is `false`.\n *\n * @example\n * ```tsx\n * const { data } = useGridTrigger();\n *\n * if (data?.trigger) {\n * return <Banner>⚡ Stroomprijs negatief — goedkoop laden!</Banner>;\n * }\n * ```\n */\nexport function useGridTrigger(\n params?: GridTriggerParams,\n options?: UseOmniQueryOptions,\n): OmniHookResult<GridTriggerResponse> {\n // Always pass a params object (even empty) so the request fires by default.\n return useOmniQuery(\n \"energy.gridTrigger\",\n params ?? {},\n (client, p) => client.energy.gridTrigger(p),\n options,\n );\n}\n","import type { LeiLookupParams, LeiLookupResponse, LeiSearchResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Look up a company by LEI code (exact) or name (fuzzy) via GLEIF.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * // Exact lookup\n * const { data } = useLeiLookup({ lei: \"5493001KJTIIGC8Y1R12\" });\n *\n * // Name search\n * const { data } = useLeiLookup(name ? { name, country: \"NL\" } : null);\n * ```\n */\nexport function useLeiLookup(\n params: LeiLookupParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<LeiLookupResponse | LeiSearchResponse> {\n return useOmniQuery(\n \"business.leiLookup\",\n params,\n (client, p) => client.business.leiLookup(p),\n options,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAAA,IAC3C;AAAA,EACF;AACF;;;ACbO,SAAS,eACd,QACA,SACqC;AACrC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,WAAW,YAAY,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;;;ACXO,SAAS,gBACd,QACA,SACsC;AACtC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,UAAU,aAAa,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;;;ACLO,SAAS,sBACd,QACA,SAC4C;AAC5C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,UAAU,mBAAmB,CAAC;AAAA,IACpD;AAAA,EACF;AACF;;;ACfO,SAAS,kBACd,QACA,SACwC;AACxC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,UAAU,eAAe,CAAC;AAAA,IAChD;AAAA,EACF;AACF;;;ACPO,SAAS,eACd,QACA,SACqC;AAErC,SAAO;AAAA,IACL;AAAA,IACA,UAAU,CAAC;AAAA,IACX,CAAC,QAAQ,MAAM,OAAO,OAAO,YAAY,CAAC;AAAA,IAC1C;AAAA,EACF;AACF;;;ACdO,SAAS,aACd,QACA,SACuD;AACvD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,SAAS,UAAU,CAAC;AAAA,IAC1C;AAAA,EACF;AACF;","names":["useSWR"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { OmniClientOptions, OmniClient, AddressEnrichParams, AddressEnrichResponse, IbanToBicParams, IbanToBicResponse, VatVerifyParams, VatVerifyResponse, ValidateFinanceParams, FinanceValidationResponse, MinimumWageParams, MinimumWageResponse, HolidaySurchargeParams, HolidaySurchargeResponse, EnergyLabelParams, EnergyLabelResponse, EmissionZoneParams, EmissionZoneResponse, TransitDisruptionsParams, TransitDisruptionsResponse, GridTriggerParams, GridTriggerResponse } from '@omnizoek/sdk';
|
|
3
|
+
import { OmniClientOptions, OmniClient, AddressEnrichParams, AddressEnrichResponse, GeocodeParams, GeocodeResponse, ReverseGeocodeParams, ReverseGeocodeResponse, IbanToBicParams, IbanToBicResponse, VatVerifyParams, VatVerifyResponse, ExchangeRatesResponse, VatRatesParams, VatRatesResponse, ValidateFinanceParams, FinanceValidationResponse, MinimumWageParams, MinimumWageResponse, HolidaySurchargeParams, HolidaySurchargeResponse, EnergyLabelParams, EnergyLabelResponse, EmissionZoneParams, EmissionZoneResponse, TransitDisruptionsParams, TransitDisruptionsResponse, VehicleHistoryParams, VehicleHistoryResponse, GridTriggerParams, GridTriggerResponse, LeiLookupParams, LeiLookupResponse, LeiSearchResponse } from '@omnizoek/sdk';
|
|
4
4
|
|
|
5
5
|
interface OmniProviderProps {
|
|
6
6
|
/** Your OmniZoek API key (omni_live_… or omni_test_…) */
|
|
@@ -68,6 +68,34 @@ interface UseOmniQueryOptions {
|
|
|
68
68
|
*/
|
|
69
69
|
declare function useAddressEnrich(params: AddressEnrichParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<AddressEnrichResponse>;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Free-text address search via PDOK Locatieserver.
|
|
73
|
+
* Returns up to `rows` matching locations with coordinates and BAG IDs.
|
|
74
|
+
* Pass `null` as `params` to skip the request (e.g. while the user is still typing).
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* const { data, loading } = useGeocode(
|
|
79
|
+
* query.length >= 3 ? { q: query, rows: 5 } : null
|
|
80
|
+
* );
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
declare function useGeocode(params: GeocodeParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<GeocodeResponse>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Convert WGS84 coordinates to the nearest Dutch address via PDOK Locatieserver.
|
|
87
|
+
* Pass `null` as `params` to skip the request (e.g. while coordinates are not yet known).
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* const { data, loading } = useReverseGeocode(
|
|
92
|
+
* coords ? { lat: coords.lat, lon: coords.lon } : null
|
|
93
|
+
* );
|
|
94
|
+
* return <span>{data?.display_name}</span>;
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare function useReverseGeocode(params: ReverseGeocodeParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<ReverseGeocodeResponse>;
|
|
98
|
+
|
|
71
99
|
/**
|
|
72
100
|
* Resolve a Dutch IBAN to its BIC code and bank name.
|
|
73
101
|
*
|
|
@@ -98,6 +126,30 @@ declare function useIbanToBic(params: IbanToBicParams | null | undefined, option
|
|
|
98
126
|
*/
|
|
99
127
|
declare function useVatVerify(params: VatVerifyParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<VatVerifyResponse>;
|
|
100
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Daily ECB euro foreign exchange reference rates (~30 currencies).
|
|
131
|
+
* Cached for 4 hours — pass `null` to skip the request.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```tsx
|
|
135
|
+
* const { data, loading, error } = useExchangeRates();
|
|
136
|
+
* return <span>USD: {data?.rates.USD}</span>;
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
declare function useExchangeRates(enabled?: boolean | null, options?: UseOmniQueryOptions): OmniHookResult<ExchangeRatesResponse>;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Official VAT rates for any EU/EEA country plus GB, NO, CH.
|
|
143
|
+
* Pass `null` as `params` to skip the request.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```tsx
|
|
147
|
+
* const { data, loading } = useVatRates({ country: "NL" });
|
|
148
|
+
* return <span>Standard rate: {data?.standard_rate}%</span>;
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
declare function useVatRates(params: VatRatesParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<VatRatesResponse>;
|
|
152
|
+
|
|
101
153
|
/**
|
|
102
154
|
* Validate a BSN or IBAN number using local checksum algorithms.
|
|
103
155
|
*
|
|
@@ -202,6 +254,21 @@ declare function useEmissionZone(params: EmissionZoneParams | null | undefined,
|
|
|
202
254
|
*/
|
|
203
255
|
declare function useTransitDisruptions(params: TransitDisruptionsParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<TransitDisruptionsResponse>;
|
|
204
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Full RDW vehicle record for a Dutch licence plate (APK, fuel, emissions, recalls).
|
|
259
|
+
* Pass `null` as `params` to skip the request.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```tsx
|
|
263
|
+
* const { data, loading, error } = useVehicleHistory(
|
|
264
|
+
* plate ? { kenteken: plate } : null
|
|
265
|
+
* );
|
|
266
|
+
* if (loading) return <Spinner />;
|
|
267
|
+
* return <span>{data?.make} {data?.commercial_name}</span>;
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
declare function useVehicleHistory(params: VehicleHistoryParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<VehicleHistoryResponse>;
|
|
271
|
+
|
|
205
272
|
/**
|
|
206
273
|
* Check the current ENTSO-E day-ahead electricity price and whether it is
|
|
207
274
|
* negative (a signal to run high-consumption processes).
|
|
@@ -220,4 +287,19 @@ declare function useTransitDisruptions(params: TransitDisruptionsParams | null |
|
|
|
220
287
|
*/
|
|
221
288
|
declare function useGridTrigger(params?: GridTriggerParams, options?: UseOmniQueryOptions): OmniHookResult<GridTriggerResponse>;
|
|
222
289
|
|
|
223
|
-
|
|
290
|
+
/**
|
|
291
|
+
* Look up a company by LEI code (exact) or name (fuzzy) via GLEIF.
|
|
292
|
+
* Pass `null` as `params` to skip the request.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```tsx
|
|
296
|
+
* // Exact lookup
|
|
297
|
+
* const { data } = useLeiLookup({ lei: "5493001KJTIIGC8Y1R12" });
|
|
298
|
+
*
|
|
299
|
+
* // Name search
|
|
300
|
+
* const { data } = useLeiLookup(name ? { name, country: "NL" } : null);
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
declare function useLeiLookup(params: LeiLookupParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<LeiLookupResponse | LeiSearchResponse>;
|
|
304
|
+
|
|
305
|
+
export { type OmniHookResult, OmniProvider, type OmniProviderProps, type UseOmniQueryOptions, useAddressEnrich, useEmissionZone, useEnergyLabel, useExchangeRates, useGeocode, useGridTrigger, useHolidaySurcharge, useIbanToBic, useLeiLookup, useMinimumWage, useOmniClient, useReverseGeocode, useTransitDisruptions, useValidateFinance, useVatRates, useVatVerify, useVehicleHistory };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { OmniClientOptions, OmniClient, AddressEnrichParams, AddressEnrichResponse, IbanToBicParams, IbanToBicResponse, VatVerifyParams, VatVerifyResponse, ValidateFinanceParams, FinanceValidationResponse, MinimumWageParams, MinimumWageResponse, HolidaySurchargeParams, HolidaySurchargeResponse, EnergyLabelParams, EnergyLabelResponse, EmissionZoneParams, EmissionZoneResponse, TransitDisruptionsParams, TransitDisruptionsResponse, GridTriggerParams, GridTriggerResponse } from '@omnizoek/sdk';
|
|
3
|
+
import { OmniClientOptions, OmniClient, AddressEnrichParams, AddressEnrichResponse, GeocodeParams, GeocodeResponse, ReverseGeocodeParams, ReverseGeocodeResponse, IbanToBicParams, IbanToBicResponse, VatVerifyParams, VatVerifyResponse, ExchangeRatesResponse, VatRatesParams, VatRatesResponse, ValidateFinanceParams, FinanceValidationResponse, MinimumWageParams, MinimumWageResponse, HolidaySurchargeParams, HolidaySurchargeResponse, EnergyLabelParams, EnergyLabelResponse, EmissionZoneParams, EmissionZoneResponse, TransitDisruptionsParams, TransitDisruptionsResponse, VehicleHistoryParams, VehicleHistoryResponse, GridTriggerParams, GridTriggerResponse, LeiLookupParams, LeiLookupResponse, LeiSearchResponse } from '@omnizoek/sdk';
|
|
4
4
|
|
|
5
5
|
interface OmniProviderProps {
|
|
6
6
|
/** Your OmniZoek API key (omni_live_… or omni_test_…) */
|
|
@@ -68,6 +68,34 @@ interface UseOmniQueryOptions {
|
|
|
68
68
|
*/
|
|
69
69
|
declare function useAddressEnrich(params: AddressEnrichParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<AddressEnrichResponse>;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Free-text address search via PDOK Locatieserver.
|
|
73
|
+
* Returns up to `rows` matching locations with coordinates and BAG IDs.
|
|
74
|
+
* Pass `null` as `params` to skip the request (e.g. while the user is still typing).
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* const { data, loading } = useGeocode(
|
|
79
|
+
* query.length >= 3 ? { q: query, rows: 5 } : null
|
|
80
|
+
* );
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
declare function useGeocode(params: GeocodeParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<GeocodeResponse>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Convert WGS84 coordinates to the nearest Dutch address via PDOK Locatieserver.
|
|
87
|
+
* Pass `null` as `params` to skip the request (e.g. while coordinates are not yet known).
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* const { data, loading } = useReverseGeocode(
|
|
92
|
+
* coords ? { lat: coords.lat, lon: coords.lon } : null
|
|
93
|
+
* );
|
|
94
|
+
* return <span>{data?.display_name}</span>;
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare function useReverseGeocode(params: ReverseGeocodeParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<ReverseGeocodeResponse>;
|
|
98
|
+
|
|
71
99
|
/**
|
|
72
100
|
* Resolve a Dutch IBAN to its BIC code and bank name.
|
|
73
101
|
*
|
|
@@ -98,6 +126,30 @@ declare function useIbanToBic(params: IbanToBicParams | null | undefined, option
|
|
|
98
126
|
*/
|
|
99
127
|
declare function useVatVerify(params: VatVerifyParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<VatVerifyResponse>;
|
|
100
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Daily ECB euro foreign exchange reference rates (~30 currencies).
|
|
131
|
+
* Cached for 4 hours — pass `null` to skip the request.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```tsx
|
|
135
|
+
* const { data, loading, error } = useExchangeRates();
|
|
136
|
+
* return <span>USD: {data?.rates.USD}</span>;
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
declare function useExchangeRates(enabled?: boolean | null, options?: UseOmniQueryOptions): OmniHookResult<ExchangeRatesResponse>;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Official VAT rates for any EU/EEA country plus GB, NO, CH.
|
|
143
|
+
* Pass `null` as `params` to skip the request.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```tsx
|
|
147
|
+
* const { data, loading } = useVatRates({ country: "NL" });
|
|
148
|
+
* return <span>Standard rate: {data?.standard_rate}%</span>;
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
declare function useVatRates(params: VatRatesParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<VatRatesResponse>;
|
|
152
|
+
|
|
101
153
|
/**
|
|
102
154
|
* Validate a BSN or IBAN number using local checksum algorithms.
|
|
103
155
|
*
|
|
@@ -202,6 +254,21 @@ declare function useEmissionZone(params: EmissionZoneParams | null | undefined,
|
|
|
202
254
|
*/
|
|
203
255
|
declare function useTransitDisruptions(params: TransitDisruptionsParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<TransitDisruptionsResponse>;
|
|
204
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Full RDW vehicle record for a Dutch licence plate (APK, fuel, emissions, recalls).
|
|
259
|
+
* Pass `null` as `params` to skip the request.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```tsx
|
|
263
|
+
* const { data, loading, error } = useVehicleHistory(
|
|
264
|
+
* plate ? { kenteken: plate } : null
|
|
265
|
+
* );
|
|
266
|
+
* if (loading) return <Spinner />;
|
|
267
|
+
* return <span>{data?.make} {data?.commercial_name}</span>;
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
declare function useVehicleHistory(params: VehicleHistoryParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<VehicleHistoryResponse>;
|
|
271
|
+
|
|
205
272
|
/**
|
|
206
273
|
* Check the current ENTSO-E day-ahead electricity price and whether it is
|
|
207
274
|
* negative (a signal to run high-consumption processes).
|
|
@@ -220,4 +287,19 @@ declare function useTransitDisruptions(params: TransitDisruptionsParams | null |
|
|
|
220
287
|
*/
|
|
221
288
|
declare function useGridTrigger(params?: GridTriggerParams, options?: UseOmniQueryOptions): OmniHookResult<GridTriggerResponse>;
|
|
222
289
|
|
|
223
|
-
|
|
290
|
+
/**
|
|
291
|
+
* Look up a company by LEI code (exact) or name (fuzzy) via GLEIF.
|
|
292
|
+
* Pass `null` as `params` to skip the request.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```tsx
|
|
296
|
+
* // Exact lookup
|
|
297
|
+
* const { data } = useLeiLookup({ lei: "5493001KJTIIGC8Y1R12" });
|
|
298
|
+
*
|
|
299
|
+
* // Name search
|
|
300
|
+
* const { data } = useLeiLookup(name ? { name, country: "NL" } : null);
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
declare function useLeiLookup(params: LeiLookupParams | null | undefined, options?: UseOmniQueryOptions): OmniHookResult<LeiLookupResponse | LeiSearchResponse>;
|
|
304
|
+
|
|
305
|
+
export { type OmniHookResult, OmniProvider, type OmniProviderProps, type UseOmniQueryOptions, useAddressEnrich, useEmissionZone, useEnergyLabel, useExchangeRates, useGeocode, useGridTrigger, useHolidaySurcharge, useIbanToBic, useLeiLookup, useMinimumWage, useOmniClient, useReverseGeocode, useTransitDisruptions, useValidateFinance, useVatRates, useVatVerify, useVehicleHistory };
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,26 @@ function useAddressEnrich(params, options) {
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
// src/hooks/useGeocode.ts
|
|
64
|
+
function useGeocode(params, options) {
|
|
65
|
+
return useOmniQuery(
|
|
66
|
+
"geo.geocode",
|
|
67
|
+
params,
|
|
68
|
+
(client, p) => client.geo.geocode(p),
|
|
69
|
+
options
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/hooks/useReverseGeocode.ts
|
|
74
|
+
function useReverseGeocode(params, options) {
|
|
75
|
+
return useOmniQuery(
|
|
76
|
+
"geo.reverseGeocode",
|
|
77
|
+
params,
|
|
78
|
+
(client, p) => client.geo.reverseGeocode(p),
|
|
79
|
+
options
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
63
83
|
// src/hooks/useIbanToBic.ts
|
|
64
84
|
function useIbanToBic(params, options) {
|
|
65
85
|
return useOmniQuery(
|
|
@@ -80,6 +100,26 @@ function useVatVerify(params, options) {
|
|
|
80
100
|
);
|
|
81
101
|
}
|
|
82
102
|
|
|
103
|
+
// src/hooks/useExchangeRates.ts
|
|
104
|
+
function useExchangeRates(enabled, options) {
|
|
105
|
+
return useOmniQuery(
|
|
106
|
+
"finance.exchangeRates",
|
|
107
|
+
enabled === false || enabled === null ? null : {},
|
|
108
|
+
(_client, _p) => _client.finance.exchangeRates(),
|
|
109
|
+
options
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/hooks/useVatRates.ts
|
|
114
|
+
function useVatRates(params, options) {
|
|
115
|
+
return useOmniQuery(
|
|
116
|
+
"finance.vatRates",
|
|
117
|
+
params,
|
|
118
|
+
(client, p) => client.finance.vatRates(p),
|
|
119
|
+
options
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
83
123
|
// src/hooks/useValidateFinance.ts
|
|
84
124
|
function useValidateFinance(params, options) {
|
|
85
125
|
return useOmniQuery(
|
|
@@ -140,6 +180,16 @@ function useTransitDisruptions(params, options) {
|
|
|
140
180
|
);
|
|
141
181
|
}
|
|
142
182
|
|
|
183
|
+
// src/hooks/useVehicleHistory.ts
|
|
184
|
+
function useVehicleHistory(params, options) {
|
|
185
|
+
return useOmniQuery(
|
|
186
|
+
"logistics.vehicleHistory",
|
|
187
|
+
params,
|
|
188
|
+
(client, p) => client.logistics.vehicleHistory(p),
|
|
189
|
+
options
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
143
193
|
// src/hooks/useGridTrigger.ts
|
|
144
194
|
function useGridTrigger(params, options) {
|
|
145
195
|
return useOmniQuery(
|
|
@@ -149,18 +199,34 @@ function useGridTrigger(params, options) {
|
|
|
149
199
|
options
|
|
150
200
|
);
|
|
151
201
|
}
|
|
202
|
+
|
|
203
|
+
// src/hooks/useLeiLookup.ts
|
|
204
|
+
function useLeiLookup(params, options) {
|
|
205
|
+
return useOmniQuery(
|
|
206
|
+
"business.leiLookup",
|
|
207
|
+
params,
|
|
208
|
+
(client, p) => client.business.leiLookup(p),
|
|
209
|
+
options
|
|
210
|
+
);
|
|
211
|
+
}
|
|
152
212
|
export {
|
|
153
213
|
OmniProvider,
|
|
154
214
|
useAddressEnrich,
|
|
155
215
|
useEmissionZone,
|
|
156
216
|
useEnergyLabel,
|
|
217
|
+
useExchangeRates,
|
|
218
|
+
useGeocode,
|
|
157
219
|
useGridTrigger,
|
|
158
220
|
useHolidaySurcharge,
|
|
159
221
|
useIbanToBic,
|
|
222
|
+
useLeiLookup,
|
|
160
223
|
useMinimumWage,
|
|
161
224
|
useOmniClient,
|
|
225
|
+
useReverseGeocode,
|
|
162
226
|
useTransitDisruptions,
|
|
163
227
|
useValidateFinance,
|
|
164
|
-
|
|
228
|
+
useVatRates,
|
|
229
|
+
useVatVerify,
|
|
230
|
+
useVehicleHistory
|
|
165
231
|
};
|
|
166
232
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/context.tsx","../src/hooks/useOmniQuery.ts","../src/hooks/useAddressEnrich.ts","../src/hooks/useIbanToBic.ts","../src/hooks/useVatVerify.ts","../src/hooks/useValidateFinance.ts","../src/hooks/useMinimumWage.ts","../src/hooks/useHolidaySurcharge.ts","../src/hooks/useEnergyLabel.ts","../src/hooks/useEmissionZone.ts","../src/hooks/useTransitDisruptions.ts","../src/hooks/useGridTrigger.ts"],"sourcesContent":["/**\n * context.tsx — OmniProvider and useOmniClient.\n *\n * Wrap your app (or a subtree) once with <OmniProvider apiKey=\"...\">\n * to make all hooks available without prop-drilling the API key.\n *\n * @example\n * ```tsx\n * // app/layout.tsx (Next.js App Router)\n * \"use client\";\n *\n * import { OmniProvider } from \"@omnizoek/react\";\n *\n * export default function RootLayout({ children }) {\n * return (\n * <OmniProvider apiKey={process.env.NEXT_PUBLIC_OMNI_API_KEY!}>\n * {children}\n * </OmniProvider>\n * );\n * }\n * ```\n */\n\nimport {\n createContext,\n useContext,\n useMemo,\n type ReactNode,\n} from \"react\";\nimport { OmniClient, type OmniClientOptions } from \"@omnizoek/sdk\";\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst OmniContext = createContext<OmniClient | null>(null);\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport interface OmniProviderProps {\n /** Your OmniZoek API key (omni_live_… or omni_test_…) */\n apiKey: string;\n /** Override the API base URL — useful for testing against a local mock */\n baseUrl?: string;\n /** Additional client options forwarded to OmniClient */\n options?: Omit<OmniClientOptions, \"apiKey\" | \"baseUrl\">;\n children: ReactNode;\n}\n\n/**\n * Provides an OmniClient instance to all descendant hooks.\n * The client is created once and recreated only when `apiKey` or `baseUrl` changes.\n */\nexport function OmniProvider({\n apiKey,\n baseUrl,\n options,\n children,\n}: OmniProviderProps) {\n const client = useMemo(\n () => new OmniClient({ apiKey, baseUrl, ...options }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [apiKey, baseUrl],\n );\n\n return <OmniContext.Provider value={client}>{children}</OmniContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the OmniClient instance from the nearest OmniProvider.\n * Throws if called outside of an OmniProvider.\n */\nexport function useOmniClient(): OmniClient {\n const client = useContext(OmniContext);\n if (!client) {\n throw new Error(\n \"[OmniZoek] useOmniClient must be called inside an <OmniProvider>. \" +\n \"Wrap your app or component tree with <OmniProvider apiKey=\\\"...\\\">.\",\n );\n }\n return client;\n}\n","/**\n * useOmniQuery.ts — Internal generic hook powering all endpoint hooks.\n *\n * Not exported from the package — consumers use the named endpoint hooks.\n */\n\nimport useSWR from \"swr\";\nimport type { OmniClient } from \"@omnizoek/sdk\";\nimport { useOmniClient } from \"../context.js\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface OmniHookResult<T> {\n /** Response data, or `undefined` while loading or on error */\n data: T | undefined;\n /** `true` on the initial load (no cached data yet) */\n loading: boolean;\n /** `true` whenever a background revalidation is in flight */\n validating: boolean;\n /** Typed error from the SDK, or `null` */\n error: Error | null;\n /** Manually trigger a refetch / revalidation */\n refetch: () => Promise<T | undefined>;\n}\n\nexport interface UseOmniQueryOptions {\n /**\n * Set to `false` to skip the request entirely.\n * Useful when required inputs haven't been filled in yet.\n * @default true\n */\n enabled?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Generic hook\n// ---------------------------------------------------------------------------\n\n/**\n * Internal hook shared by all endpoint-specific hooks.\n *\n * @param endpointKey Stable string identifying this endpoint (used as SWR cache key prefix)\n * @param params Request params — pass `null` or `undefined` to skip the request\n * @param fetcher Function that calls the relevant OmniClient method\n * @param options Hook options (enabled, etc.)\n */\nexport function useOmniQuery<P, R>(\n endpointKey: string,\n params: P | null | undefined,\n fetcher: (client: OmniClient, params: P) => Promise<R>,\n options?: UseOmniQueryOptions,\n): OmniHookResult<R> {\n const client = useOmniClient();\n const isEnabled = options?.enabled !== false;\n\n // SWR key: null → skip request; array → fetch\n const swrKey: [string, P] | null =\n isEnabled && params != null ? [endpointKey, params] : null;\n\n const { data, error, isLoading, isValidating, mutate } = useSWR<R, Error>(\n swrKey,\n ([, p]: [string, P]) => fetcher(client, p),\n { shouldRetryOnError: false },\n );\n\n return {\n data,\n loading: isLoading,\n validating: isValidating,\n error: error ?? null,\n refetch: () => mutate(),\n };\n}\n","import type { AddressEnrichParams, AddressEnrichResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Enrich a Dutch address using postcode + house number.\n *\n * Calls `GET /v1/geo/enrich` via the BAG (Basisregistratie Adressen en Gebouwen).\n * Returns street, city, coordinates, BAG ID, surface area, and energy label.\n *\n * Pass `null` as `params` to skip the request (e.g. while the user is still typing).\n *\n * @example\n * ```tsx\n * const { data, loading, error } = useAddressEnrich(\n * postcode && houseNumber ? { postcode, houseNumber } : null\n * );\n * if (loading) return <Spinner />;\n * return <span>{data?.street} {data?.city}</span>;\n * ```\n */\nexport function useAddressEnrich(\n params: AddressEnrichParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<AddressEnrichResponse> {\n return useOmniQuery(\n \"geo.enrichAddress\",\n params,\n (client, p) => client.geo.enrichAddress(p),\n options,\n );\n}\n","import type { IbanToBicParams, IbanToBicResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Resolve a Dutch IBAN to its BIC code and bank name.\n *\n * Calls `GET /v1/finance/iban-to-bic`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useIbanToBic(iban ? { iban } : null);\n * return <span>{data?.bank_name} ({data?.bic})</span>;\n * ```\n */\nexport function useIbanToBic(\n params: IbanToBicParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<IbanToBicResponse> {\n return useOmniQuery(\n \"finance.ibanToBic\",\n params,\n (client, p) => client.finance.ibanToBic(p),\n options,\n );\n}\n","import type { VatVerifyParams, VatVerifyResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Verify a European VAT number via VIES.\n *\n * Calls `GET /v1/finance/vat-verify`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useVatVerify(\n * vatNumber ? { countryCode: \"NL\", vatNumber } : null\n * );\n * return <span>{data?.valid ? \"✅ Geldig\" : \"❌ Ongeldig\"}</span>;\n * ```\n */\nexport function useVatVerify(\n params: VatVerifyParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<VatVerifyResponse> {\n return useOmniQuery(\n \"finance.vatVerify\",\n params,\n (client, p) => client.finance.vatVerify(p),\n options,\n );\n}\n","import type { ValidateFinanceParams, FinanceValidationResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Validate a BSN or IBAN number using local checksum algorithms.\n *\n * Calls `GET /v1/compliance/validate-finance`.\n * No external service called — pure algorithm check.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * // BSN validation\n * const { data } = useValidateFinance(bsn ? { type: \"bsn\", number: bsn } : null);\n *\n * // IBAN validation\n * const { data } = useValidateFinance(iban ? { type: \"iban\", number: iban } : null);\n *\n * return <span>{data?.valid ? \"✅\" : \"❌\"} {data?.detail}</span>;\n * ```\n */\nexport function useValidateFinance(\n params: ValidateFinanceParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<FinanceValidationResponse> {\n return useOmniQuery(\n \"compliance.validateFinance\",\n params,\n (client, p) => client.compliance.validateFinance(p),\n options,\n );\n}\n","import type { MinimumWageParams, MinimumWageResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Retrieve the Dutch statutory minimum wage (WML) for a given age.\n *\n * Calls `GET /v1/hr/minimum-wage`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useMinimumWage(age ? { age } : null);\n * return <span>Minimumloon: €{data?.hourly_eur.toFixed(2)}/uur</span>;\n * ```\n */\nexport function useMinimumWage(\n params: MinimumWageParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<MinimumWageResponse> {\n return useOmniQuery(\n \"hr.minimumWage\",\n params,\n (client, p) => client.hr.minimumWage(p),\n options,\n );\n}\n","import type { HolidaySurchargeParams, HolidaySurchargeResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check whether a date is a Dutch public holiday and get the applicable\n * surcharge multiplier for a given industry (e.g. \"horeca\", \"retail\").\n *\n * Calls `GET /v1/hr/holiday-surcharge`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data } = useHolidaySurcharge(\n * date ? { date, industry: \"horeca\" } : null\n * );\n * if (data?.is_holiday) {\n * return <span>Toeslag: {data.surcharge_multiplier}× ({data.holiday_name})</span>;\n * }\n * ```\n */\nexport function useHolidaySurcharge(\n params: HolidaySurchargeParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<HolidaySurchargeResponse> {\n return useOmniQuery(\n \"hr.holidaySurcharge\",\n params,\n (client, p) => client.hr.holidaySurcharge(p),\n options,\n );\n}\n","import type { EnergyLabelParams, EnergyLabelResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Retrieve the EP-Online energy label for a Dutch property.\n *\n * Calls `GET /v1/real-estate/energy-label`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useEnergyLabel(\n * postcode && houseNumber ? { postcode, houseNumber } : null\n * );\n * return <span>Energielabel: {data?.energy_label ?? \"–\"}</span>;\n * ```\n */\nexport function useEnergyLabel(\n params: EnergyLabelParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<EnergyLabelResponse> {\n return useOmniQuery(\n \"realEstate.energyLabel\",\n params,\n (client, p) => client.realEstate.energyLabel(p),\n options,\n );\n}\n","import type { EmissionZoneParams, EmissionZoneResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check whether a Dutch vehicle (by licence plate) is zero-emission compliant\n * for urban emission zones.\n *\n * Calls `GET /v1/logistics/emission-zone`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data } = useEmissionZone(kenteken ? { kenteken } : null);\n * return <span>{data?.ze_compliant ? \"✅ ZE-compliant\" : \"❌ Niet toegestaan\"}</span>;\n * ```\n */\nexport function useEmissionZone(\n params: EmissionZoneParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<EmissionZoneResponse> {\n return useOmniQuery(\n \"logistics.emissionZone\",\n params,\n (client, p) => client.logistics.emissionZone(p),\n options,\n );\n}\n","import type { TransitDisruptionsParams, TransitDisruptionsResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Fetch current NS train disruptions for a given station.\n *\n * Calls `GET /v1/logistics/transit-disruptions`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useTransitDisruptions({ stationCode: \"ASD\" });\n *\n * if (loading) return <Spinner />;\n * return (\n * <ul>\n * {data?.disruptions.map(d => <li key={d.title}>{d.title}</li>)}\n * </ul>\n * );\n * ```\n */\nexport function useTransitDisruptions(\n params: TransitDisruptionsParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<TransitDisruptionsResponse> {\n return useOmniQuery(\n \"logistics.transitDisruptions\",\n params,\n (client, p) => client.logistics.transitDisruptions(p),\n options,\n );\n}\n","import type { GridTriggerParams, GridTriggerResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check the current ENTSO-E day-ahead electricity price and whether it is\n * negative (a signal to run high-consumption processes).\n *\n * Calls `GET /v1/energy/grid-trigger`.\n * Always fetches unless `options.enabled` is `false`.\n *\n * @example\n * ```tsx\n * const { data } = useGridTrigger();\n *\n * if (data?.trigger) {\n * return <Banner>⚡ Stroomprijs negatief — goedkoop laden!</Banner>;\n * }\n * ```\n */\nexport function useGridTrigger(\n params?: GridTriggerParams,\n options?: UseOmniQueryOptions,\n): OmniHookResult<GridTriggerResponse> {\n // Always pass a params object (even empty) so the request fires by default.\n return useOmniQuery(\n \"energy.gridTrigger\",\n params ?? {},\n (client, p) => client.energy.gridTrigger(p),\n options,\n );\n}\n"],"mappings":";AAuBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAA0C;AAsC1C;AAhCT,IAAM,cAAc,cAAiC,IAAI;A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AAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,QAAQ,UAAU,CAAC;AAAA,IACzC;AAAA,EACF;AACF;;;ACNO,SAAS,mBACd,QACA,SAC2C;AAC3C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,WAAW,gBAAgB,CAAC;AAAA,IAClD;AAAA,EACF;AACF;;;AChBO,SAAS,eACd,QACA,SACqC;AACrC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,GAAG,YAAY,CAAC;AAAA,IACtC;AAAA,EACF;AACF;;;ACLO,SAAS,oBACd,QACA,SAC0C;AAC1C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAAA,IAC3C;AAAA,EACF;AACF;;;ACbO,SAAS,eACd,QACA,SACqC;AACrC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,WAAW,YAAY,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;;;ACXO,SAAS,gBACd,QACA,SACsC;AACtC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,UAAU,aAAa,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;;;ACLO,SAAS,sBACd,QACA,SAC4C;AAC5C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,UAAU,mBAAmB,CAAC;AAAA,IACpD;AAAA,EACF;AACF;;;ACZO,SAAS,eACd,QACA,SACqC;AAErC,SAAO;AAAA,IACL;AAAA,IACA,UAAU,CAAC;AAAA,IACX,CAAC,QAAQ,MAAM,OAAO,OAAO,YAAY,CAAC;AAAA,IAC1C;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/context.tsx","../src/hooks/useOmniQuery.ts","../src/hooks/useAddressEnrich.ts","../src/hooks/useGeocode.ts","../src/hooks/useReverseGeocode.ts","../src/hooks/useIbanToBic.ts","../src/hooks/useVatVerify.ts","../src/hooks/useExchangeRates.ts","../src/hooks/useVatRates.ts","../src/hooks/useValidateFinance.ts","../src/hooks/useMinimumWage.ts","../src/hooks/useHolidaySurcharge.ts","../src/hooks/useEnergyLabel.ts","../src/hooks/useEmissionZone.ts","../src/hooks/useTransitDisruptions.ts","../src/hooks/useVehicleHistory.ts","../src/hooks/useGridTrigger.ts","../src/hooks/useLeiLookup.ts"],"sourcesContent":["/**\n * context.tsx — OmniProvider and useOmniClient.\n *\n * Wrap your app (or a subtree) once with <OmniProvider apiKey=\"...\">\n * to make all hooks available without prop-drilling the API key.\n *\n * @example\n * ```tsx\n * // app/layout.tsx (Next.js App Router)\n * \"use client\";\n *\n * import { OmniProvider } from \"@omnizoek/react\";\n *\n * export default function RootLayout({ children }) {\n * return (\n * <OmniProvider apiKey={process.env.NEXT_PUBLIC_OMNI_API_KEY!}>\n * {children}\n * </OmniProvider>\n * );\n * }\n * ```\n */\n\nimport {\n createContext,\n useContext,\n useMemo,\n type ReactNode,\n} from \"react\";\nimport { OmniClient, type OmniClientOptions } from \"@omnizoek/sdk\";\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst OmniContext = createContext<OmniClient | null>(null);\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport interface OmniProviderProps {\n /** Your OmniZoek API key (omni_live_… or omni_test_…) */\n apiKey: string;\n /** Override the API base URL — useful for testing against a local mock */\n baseUrl?: string;\n /** Additional client options forwarded to OmniClient */\n options?: Omit<OmniClientOptions, \"apiKey\" | \"baseUrl\">;\n children: ReactNode;\n}\n\n/**\n * Provides an OmniClient instance to all descendant hooks.\n * The client is created once and recreated only when `apiKey` or `baseUrl` changes.\n */\nexport function OmniProvider({\n apiKey,\n baseUrl,\n options,\n children,\n}: OmniProviderProps) {\n const client = useMemo(\n () => new OmniClient({ apiKey, baseUrl, ...options }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [apiKey, baseUrl],\n );\n\n return <OmniContext.Provider value={client}>{children}</OmniContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the OmniClient instance from the nearest OmniProvider.\n * Throws if called outside of an OmniProvider.\n */\nexport function useOmniClient(): OmniClient {\n const client = useContext(OmniContext);\n if (!client) {\n throw new Error(\n \"[OmniZoek] useOmniClient must be called inside an <OmniProvider>. \" +\n \"Wrap your app or component tree with <OmniProvider apiKey=\\\"...\\\">.\",\n );\n }\n return client;\n}\n","/**\n * useOmniQuery.ts — Internal generic hook powering all endpoint hooks.\n *\n * Not exported from the package — consumers use the named endpoint hooks.\n */\n\nimport useSWR from \"swr\";\nimport type { OmniClient } from \"@omnizoek/sdk\";\nimport { useOmniClient } from \"../context.js\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface OmniHookResult<T> {\n /** Response data, or `undefined` while loading or on error */\n data: T | undefined;\n /** `true` on the initial load (no cached data yet) */\n loading: boolean;\n /** `true` whenever a background revalidation is in flight */\n validating: boolean;\n /** Typed error from the SDK, or `null` */\n error: Error | null;\n /** Manually trigger a refetch / revalidation */\n refetch: () => Promise<T | undefined>;\n}\n\nexport interface UseOmniQueryOptions {\n /**\n * Set to `false` to skip the request entirely.\n * Useful when required inputs haven't been filled in yet.\n * @default true\n */\n enabled?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Generic hook\n// ---------------------------------------------------------------------------\n\n/**\n * Internal hook shared by all endpoint-specific hooks.\n *\n * @param endpointKey Stable string identifying this endpoint (used as SWR cache key prefix)\n * @param params Request params — pass `null` or `undefined` to skip the request\n * @param fetcher Function that calls the relevant OmniClient method\n * @param options Hook options (enabled, etc.)\n */\nexport function useOmniQuery<P, R>(\n endpointKey: string,\n params: P | null | undefined,\n fetcher: (client: OmniClient, params: P) => Promise<R>,\n options?: UseOmniQueryOptions,\n): OmniHookResult<R> {\n const client = useOmniClient();\n const isEnabled = options?.enabled !== false;\n\n // SWR key: null → skip request; array → fetch\n const swrKey: [string, P] | null =\n isEnabled && params != null ? [endpointKey, params] : null;\n\n const { data, error, isLoading, isValidating, mutate } = useSWR<R, Error>(\n swrKey,\n ([, p]: [string, P]) => fetcher(client, p),\n { shouldRetryOnError: false },\n );\n\n return {\n data,\n loading: isLoading,\n validating: isValidating,\n error: error ?? null,\n refetch: () => mutate(),\n };\n}\n","import type { AddressEnrichParams, AddressEnrichResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Enrich a Dutch address using postcode + house number.\n *\n * Calls `GET /v1/geo/enrich` via the BAG (Basisregistratie Adressen en Gebouwen).\n * Returns street, city, coordinates, BAG ID, surface area, and energy label.\n *\n * Pass `null` as `params` to skip the request (e.g. while the user is still typing).\n *\n * @example\n * ```tsx\n * const { data, loading, error } = useAddressEnrich(\n * postcode && houseNumber ? { postcode, houseNumber } : null\n * );\n * if (loading) return <Spinner />;\n * return <span>{data?.street} {data?.city}</span>;\n * ```\n */\nexport function useAddressEnrich(\n params: AddressEnrichParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<AddressEnrichResponse> {\n return useOmniQuery(\n \"geo.enrichAddress\",\n params,\n (client, p) => client.geo.enrichAddress(p),\n options,\n );\n}\n","import type { GeocodeParams, GeocodeResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Free-text address search via PDOK Locatieserver.\n * Returns up to `rows` matching locations with coordinates and BAG IDs.\n * Pass `null` as `params` to skip the request (e.g. while the user is still typing).\n *\n * @example\n * ```tsx\n * const { data, loading } = useGeocode(\n * query.length >= 3 ? { q: query, rows: 5 } : null\n * );\n * ```\n */\nexport function useGeocode(\n params: GeocodeParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<GeocodeResponse> {\n return useOmniQuery(\n \"geo.geocode\",\n params,\n (client, p) => client.geo.geocode(p),\n options,\n );\n}\n","import type { ReverseGeocodeParams, ReverseGeocodeResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Convert WGS84 coordinates to the nearest Dutch address via PDOK Locatieserver.\n * Pass `null` as `params` to skip the request (e.g. while coordinates are not yet known).\n *\n * @example\n * ```tsx\n * const { data, loading } = useReverseGeocode(\n * coords ? { lat: coords.lat, lon: coords.lon } : null\n * );\n * return <span>{data?.display_name}</span>;\n * ```\n */\nexport function useReverseGeocode(\n params: ReverseGeocodeParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<ReverseGeocodeResponse> {\n return useOmniQuery(\n \"geo.reverseGeocode\",\n params,\n (client, p) => client.geo.reverseGeocode(p),\n options,\n );\n}\n","import type { IbanToBicParams, IbanToBicResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Resolve a Dutch IBAN to its BIC code and bank name.\n *\n * Calls `GET /v1/finance/iban-to-bic`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useIbanToBic(iban ? { iban } : null);\n * return <span>{data?.bank_name} ({data?.bic})</span>;\n * ```\n */\nexport function useIbanToBic(\n params: IbanToBicParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<IbanToBicResponse> {\n return useOmniQuery(\n \"finance.ibanToBic\",\n params,\n (client, p) => client.finance.ibanToBic(p),\n options,\n );\n}\n","import type { VatVerifyParams, VatVerifyResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Verify a European VAT number via VIES.\n *\n * Calls `GET /v1/finance/vat-verify`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useVatVerify(\n * vatNumber ? { countryCode: \"NL\", vatNumber } : null\n * );\n * return <span>{data?.valid ? \"✅ Geldig\" : \"❌ Ongeldig\"}</span>;\n * ```\n */\nexport function useVatVerify(\n params: VatVerifyParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<VatVerifyResponse> {\n return useOmniQuery(\n \"finance.vatVerify\",\n params,\n (client, p) => client.finance.vatVerify(p),\n options,\n );\n}\n","import type { ExchangeRatesResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Daily ECB euro foreign exchange reference rates (~30 currencies).\n * Cached for 4 hours — pass `null` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading, error } = useExchangeRates();\n * return <span>USD: {data?.rates.USD}</span>;\n * ```\n */\nexport function useExchangeRates(\n enabled?: boolean | null,\n options?: UseOmniQueryOptions,\n): OmniHookResult<ExchangeRatesResponse> {\n return useOmniQuery(\n \"finance.exchangeRates\",\n enabled === false || enabled === null ? null : {},\n (_client, _p) => _client.finance.exchangeRates(),\n options,\n );\n}\n","import type { VatRatesParams, VatRatesResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Official VAT rates for any EU/EEA country plus GB, NO, CH.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useVatRates({ country: \"NL\" });\n * return <span>Standard rate: {data?.standard_rate}%</span>;\n * ```\n */\nexport function useVatRates(\n params: VatRatesParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<VatRatesResponse> {\n return useOmniQuery(\n \"finance.vatRates\",\n params,\n (client, p) => client.finance.vatRates(p),\n options,\n );\n}\n","import type { ValidateFinanceParams, FinanceValidationResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Validate a BSN or IBAN number using local checksum algorithms.\n *\n * Calls `GET /v1/compliance/validate-finance`.\n * No external service called — pure algorithm check.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * // BSN validation\n * const { data } = useValidateFinance(bsn ? { type: \"bsn\", number: bsn } : null);\n *\n * // IBAN validation\n * const { data } = useValidateFinance(iban ? { type: \"iban\", number: iban } : null);\n *\n * return <span>{data?.valid ? \"✅\" : \"❌\"} {data?.detail}</span>;\n * ```\n */\nexport function useValidateFinance(\n params: ValidateFinanceParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<FinanceValidationResponse> {\n return useOmniQuery(\n \"compliance.validateFinance\",\n params,\n (client, p) => client.compliance.validateFinance(p),\n options,\n );\n}\n","import type { MinimumWageParams, MinimumWageResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Retrieve the Dutch statutory minimum wage (WML) for a given age.\n *\n * Calls `GET /v1/hr/minimum-wage`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useMinimumWage(age ? { age } : null);\n * return <span>Minimumloon: €{data?.hourly_eur.toFixed(2)}/uur</span>;\n * ```\n */\nexport function useMinimumWage(\n params: MinimumWageParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<MinimumWageResponse> {\n return useOmniQuery(\n \"hr.minimumWage\",\n params,\n (client, p) => client.hr.minimumWage(p),\n options,\n );\n}\n","import type { HolidaySurchargeParams, HolidaySurchargeResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check whether a date is a Dutch public holiday and get the applicable\n * surcharge multiplier for a given industry (e.g. \"horeca\", \"retail\").\n *\n * Calls `GET /v1/hr/holiday-surcharge`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data } = useHolidaySurcharge(\n * date ? { date, industry: \"horeca\" } : null\n * );\n * if (data?.is_holiday) {\n * return <span>Toeslag: {data.surcharge_multiplier}× ({data.holiday_name})</span>;\n * }\n * ```\n */\nexport function useHolidaySurcharge(\n params: HolidaySurchargeParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<HolidaySurchargeResponse> {\n return useOmniQuery(\n \"hr.holidaySurcharge\",\n params,\n (client, p) => client.hr.holidaySurcharge(p),\n options,\n );\n}\n","import type { EnergyLabelParams, EnergyLabelResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Retrieve the EP-Online energy label for a Dutch property.\n *\n * Calls `GET /v1/real-estate/energy-label`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useEnergyLabel(\n * postcode && houseNumber ? { postcode, houseNumber } : null\n * );\n * return <span>Energielabel: {data?.energy_label ?? \"–\"}</span>;\n * ```\n */\nexport function useEnergyLabel(\n params: EnergyLabelParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<EnergyLabelResponse> {\n return useOmniQuery(\n \"realEstate.energyLabel\",\n params,\n (client, p) => client.realEstate.energyLabel(p),\n options,\n );\n}\n","import type { EmissionZoneParams, EmissionZoneResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check whether a Dutch vehicle (by licence plate) is zero-emission compliant\n * for urban emission zones.\n *\n * Calls `GET /v1/logistics/emission-zone`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data } = useEmissionZone(kenteken ? { kenteken } : null);\n * return <span>{data?.ze_compliant ? \"✅ ZE-compliant\" : \"❌ Niet toegestaan\"}</span>;\n * ```\n */\nexport function useEmissionZone(\n params: EmissionZoneParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<EmissionZoneResponse> {\n return useOmniQuery(\n \"logistics.emissionZone\",\n params,\n (client, p) => client.logistics.emissionZone(p),\n options,\n );\n}\n","import type { TransitDisruptionsParams, TransitDisruptionsResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Fetch current NS train disruptions for a given station.\n *\n * Calls `GET /v1/logistics/transit-disruptions`.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading } = useTransitDisruptions({ stationCode: \"ASD\" });\n *\n * if (loading) return <Spinner />;\n * return (\n * <ul>\n * {data?.disruptions.map(d => <li key={d.title}>{d.title}</li>)}\n * </ul>\n * );\n * ```\n */\nexport function useTransitDisruptions(\n params: TransitDisruptionsParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<TransitDisruptionsResponse> {\n return useOmniQuery(\n \"logistics.transitDisruptions\",\n params,\n (client, p) => client.logistics.transitDisruptions(p),\n options,\n );\n}\n","import type { VehicleHistoryParams, VehicleHistoryResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Full RDW vehicle record for a Dutch licence plate (APK, fuel, emissions, recalls).\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * const { data, loading, error } = useVehicleHistory(\n * plate ? { kenteken: plate } : null\n * );\n * if (loading) return <Spinner />;\n * return <span>{data?.make} {data?.commercial_name}</span>;\n * ```\n */\nexport function useVehicleHistory(\n params: VehicleHistoryParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<VehicleHistoryResponse> {\n return useOmniQuery(\n \"logistics.vehicleHistory\",\n params,\n (client, p) => client.logistics.vehicleHistory(p),\n options,\n );\n}\n","import type { GridTriggerParams, GridTriggerResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Check the current ENTSO-E day-ahead electricity price and whether it is\n * negative (a signal to run high-consumption processes).\n *\n * Calls `GET /v1/energy/grid-trigger`.\n * Always fetches unless `options.enabled` is `false`.\n *\n * @example\n * ```tsx\n * const { data } = useGridTrigger();\n *\n * if (data?.trigger) {\n * return <Banner>⚡ Stroomprijs negatief — goedkoop laden!</Banner>;\n * }\n * ```\n */\nexport function useGridTrigger(\n params?: GridTriggerParams,\n options?: UseOmniQueryOptions,\n): OmniHookResult<GridTriggerResponse> {\n // Always pass a params object (even empty) so the request fires by default.\n return useOmniQuery(\n \"energy.gridTrigger\",\n params ?? {},\n (client, p) => client.energy.gridTrigger(p),\n options,\n );\n}\n","import type { LeiLookupParams, LeiLookupResponse, LeiSearchResponse } from \"@omnizoek/sdk\";\nimport { useOmniQuery, type OmniHookResult, type UseOmniQueryOptions } from \"./useOmniQuery.js\";\n\n/**\n * Look up a company by LEI code (exact) or name (fuzzy) via GLEIF.\n * Pass `null` as `params` to skip the request.\n *\n * @example\n * ```tsx\n * // Exact lookup\n * const { data } = useLeiLookup({ lei: \"5493001KJTIIGC8Y1R12\" });\n *\n * // Name search\n * const { data } = useLeiLookup(name ? { name, country: \"NL\" } : null);\n * ```\n */\nexport function useLeiLookup(\n params: LeiLookupParams | null | undefined,\n options?: UseOmniQueryOptions,\n): OmniHookResult<LeiLookupResponse | LeiSearchResponse> {\n return useOmniQuery(\n \"business.leiLookup\",\n params,\n (client, p) => client.business.leiLookup(p),\n options,\n );\n}\n"],"mappings":";AAuBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAA0C;AAsC1C;AAhCT,IAAM,cAAc,cAAiC,IAAI;AAoBlD,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,QAAM,S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;AACF;;;ACXO,SAAS,gBACd,QACA,SACsC;AACtC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,UAAU,aAAa,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;;;ACLO,SAAS,sBACd,QACA,SAC4C;AAC5C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,UAAU,mBAAmB,CAAC;AAAA,IACpD;AAAA,EACF;AACF;;;ACfO,SAAS,kBACd,QACA,SACwC;AACxC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,UAAU,eAAe,CAAC;AAAA,IAChD;AAAA,EACF;AACF;;;ACPO,SAAS,eACd,QACA,SACqC;AAErC,SAAO;AAAA,IACL;AAAA,IACA,UAAU,CAAC;AAAA,IACX,CAAC,QAAQ,MAAM,OAAO,OAAO,YAAY,CAAC;AAAA,IAC1C;AAAA,EACF;AACF;;;ACdO,SAAS,aACd,QACA,SACuD;AACvD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,MAAM,OAAO,SAAS,UAAU,CAAC;AAAA,IAC1C;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnizoek/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "React hooks for the OmniZoek API — address enrichment, IBAN, vehicle, energy labels and more.",
|
|
5
5
|
"author": "OmniZoek <support@omnizoek.nl>",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
7
|
"homepage": "https://omnizoek.nl/docs",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"swr": ">=2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@omnizoek/sdk": "
|
|
50
|
+
"@omnizoek/sdk": "file:../omni-sdk-js",
|
|
51
51
|
"@types/react": "^18.0.0",
|
|
52
52
|
"react": "^18.0.0",
|
|
53
53
|
"swr": "^2.2.0",
|