@siteping/widget 0.9.8 → 0.9.10

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/types.d.ts CHANGED
@@ -82,6 +82,55 @@ export interface SitepingConfig {
82
82
  } | undefined;
83
83
  /** Called when the widget is skipped (production mode, mobile viewport) */
84
84
  onSkip?: (reason: "production" | "mobile") => void;
85
+ /**
86
+ * Auto-focus a specific annotation when its ID appears in the URL query
87
+ * string. Lets hosts deeplink directly into a feedback from external
88
+ * systems (Zammad tickets, Slack notifications, dashboard rows).
89
+ *
90
+ * When enabled, the widget reads the configured query parameter from
91
+ * `window.location.search` right after the initial markers load. If the
92
+ * value matches a visible feedback ID, the widget scrolls the annotation
93
+ * into view, pins its highlight, and pulses the marker — the same visual
94
+ * affordance a marker click produces.
95
+ *
96
+ * - `false` / `undefined` (default): no URL parsing. Existing behavior
97
+ * unchanged, no host URL inspection.
98
+ * - `true`: enabled with default query parameter name `siteping`.
99
+ * - object: enabled with a custom parameter name. Use this to avoid
100
+ * clashes with host-app query keys.
101
+ *
102
+ * Only the initial load triggers focus. Subsequent URL changes (SPA
103
+ * navigation, `history.pushState`, hash updates) are ignored —
104
+ * deliberate, to avoid surprising re-scrolls during normal browsing.
105
+ * Hosts that need re-focus on route change can call
106
+ * `instance.focusFeedback(id)` explicitly.
107
+ */
108
+ deepLink?: boolean | {
109
+ param?: string;
110
+ } | undefined;
111
+ /**
112
+ * Pre-fill author identity from the host application — typically the
113
+ * currently signed-in user. When set, the widget uses these values
114
+ * directly and never shows the identity modal, even on first feedback.
115
+ *
116
+ * Use case: SSO-integrated apps where the end user is already
117
+ * authenticated by the host. Avoids the awkward "enter your name and
118
+ * email" prompt for users the host already knows.
119
+ *
120
+ * When unset (default), the widget falls back to localStorage and shows
121
+ * the modal on first feedback as before — existing behavior unchanged.
122
+ *
123
+ * Note: `config.identity` is **not** persisted to localStorage. It is
124
+ * read at widget init time, not on every render. Hosts that need live
125
+ * identity updates after sign-in/sign-out should currently remount the
126
+ * widget (e.g. via a React `key` on the wrapping component). See
127
+ * https://github.com/NeosiaNexus/SitePing/issues/85 for tracking a
128
+ * future enhancement that propagates identity updates without a remount.
129
+ */
130
+ identity?: {
131
+ name: string;
132
+ email: string;
133
+ } | undefined;
85
134
  /** Called when the feedback panel is opened. */
86
135
  onOpen?: () => void;
87
136
  /** Called when the feedback panel is closed. */
@@ -114,6 +163,17 @@ export interface SitepingInstance {
114
163
  close: () => void;
115
164
  /** Reload feedbacks from server */
116
165
  refresh: () => void;
166
+ /**
167
+ * Scroll the matching annotation into view, pin its highlight, and
168
+ * pulse its marker. Returns `true` when a visible feedback matched the
169
+ * given ID, `false` otherwise (unknown ID, feedback on another URL when
170
+ * `scopeAnnotationsByUrl` filtered it out, or markers not yet loaded).
171
+ *
172
+ * Counterpart to the `deepLink` config option for hosts that prefer to
173
+ * drive focus from JS (e.g., a notification click handler) instead of a
174
+ * URL query parameter.
175
+ */
176
+ focusFeedback: (feedbackId: string) => boolean;
117
177
  /** Subscribe to a public widget event */
118
178
  on: <K extends keyof SitepingPublicEvents>(event: K, listener: (...args: SitepingPublicEvents[K]) => void) => () => void;
119
179
  /** Unsubscribe from a public widget event */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteping/widget",
3
- "version": "0.9.8",
3
+ "version": "0.9.10",
4
4
  "description": "Feedback widget for client review during development — annotations, bugs, questions directly on the site",
5
5
  "type": "module",
6
6
  "sideEffects": false,