@kelet-ai/feedback-ui 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -319,23 +319,6 @@ const [data, setData] = useFeedbackState(initial, 'tracker', {
319
319
 
320
320
  ---
321
321
 
322
- ## 🔗 OpenTelemetry Integration
323
-
324
- Prefer W3C traceparent to correlate feedback with distributed traces:
325
-
326
- ```tsx
327
- import { VoteFeedback, getTraceParent } from '@kelet-ai/feedback-ui';
328
-
329
- <VoteFeedback.Root tx_id={getTraceParent} onFeedback={handleFeedback}>
330
- <VoteFeedback.UpvoteButton>👍</VoteFeedback.UpvoteButton>
331
- <VoteFeedback.DownvoteButton>👎</VoteFeedback.DownvoteButton>
332
- </VoteFeedback.Root>;
333
- ```
334
-
335
- Requires `@opentelemetry/api` for active context. If missing at runtime, an error is thrown.
336
-
337
- ---
338
-
339
322
  ## 🔧 Core Components
340
323
 
341
324
  ### **VoteFeedback.Root**
@@ -2160,42 +2160,10 @@ function useFeedbackState(initialState, tx_id, options) {
2160
2160
  );
2161
2161
  return [state, setState];
2162
2162
  }
2163
- const _loadOtelApi = () => {
2164
- const g = globalThis;
2165
- const store = g[Symbol.for("opentelemetry.js.api.1")];
2166
- const api = store?.api ?? store;
2167
- if (!api?.context || !api?.propagation) {
2168
- throw new Error(
2169
- "@opentelemetry/api not found. Install it and configure a tracer provider."
2170
- );
2171
- }
2172
- return api;
2173
- };
2174
- function getTraceParent(_ = null) {
2175
- try {
2176
- const { context, propagation } = _loadOtelApi();
2177
- const carrier = {};
2178
- propagation.inject(context.active(), carrier, {
2179
- set: (c, k, v) => {
2180
- c[k] = v;
2181
- }
2182
- });
2183
- const traceparent = carrier["traceparent"];
2184
- if (!traceparent) {
2185
- throw new Error("traceparent header not available from active context");
2186
- }
2187
- return traceparent;
2188
- } catch (error) {
2189
- throw new Error(
2190
- `Failed to extract traceparent: ${error instanceof Error ? error.message : "Unknown error"}`
2191
- );
2192
- }
2193
- }
2194
2163
  export {
2195
2164
  KeletContext,
2196
2165
  KeletProvider,
2197
2166
  VoteFeedback,
2198
- getTraceParent,
2199
2167
  useDefaultFeedbackHandler,
2200
2168
  useFeedbackState,
2201
2169
  useKelet