@qaiddev/thumbs-embed 1.8.0 → 1.9.0

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
@@ -213,38 +213,69 @@ new QaidFeedback({
213
213
 
214
214
  ## Script Tag Data Attributes
215
215
 
216
- When using the script tag method, all config options are available as `data-*` attributes:
216
+ Every config option has a `data-*` attribute, so the script tag alone can set anything. If a JSON config block is also on the page, the block wins and the attributes are not read.
217
+
218
+ Boolean attributes turn on with `"true"`; any other value leaves the default. `data-annotate` is the exception: it is on by default, so only `"false"` changes it. Numbers are plain digits (`data-zindex="9001"`, `data-backdrop-opacity="0.5"`).
217
219
 
218
220
  | Attribute | Maps To |
219
221
  |-----------|---------|
220
- | `data-endpoint` | `endpoint` |
222
+ | `data-endpoint` | `endpoint` (required) |
221
223
  | `data-api-key` | `apiKey` |
222
- | `data-position` | `position` |
223
- | `data-zindex` | `zIndex` |
224
- | `data-button-size` | `buttonSize` |
224
+ | `data-container` | `container` |
225
225
  | `data-button-class` | `buttonClass` |
226
- | `data-modal-width` | `modalWidth` |
227
- | `data-backdrop-opacity` | `backdropOpacity` |
226
+ | `data-direction` | `direction` |
227
+ | `data-position` | `position` |
228
228
  | `data-offset-x` | `offset.x` |
229
229
  | `data-offset-y` | `offset.y` |
230
+ | `data-zindex` | `zIndex` |
231
+ | `data-skip-targeting` | `skipTargeting` |
232
+ | `data-single-button` | `singleButton` |
233
+ | `data-feedback-mode` | `feedbackMode` |
230
234
  | `data-positive-color` | `colors.positive` |
231
235
  | `data-negative-color` | `colors.negative` |
232
236
  | `data-marker-color` | `colors.marker` |
233
- | `data-container` | `container` |
234
- | `data-skip-targeting` | `skipTargeting` |
235
- | `data-incognito` | `incognito` |
236
- | `data-font-family` | `fontFamily` |
237
- | `data-font-size` | `fontSize` |
237
+ | `data-button-size` | `buttonSize` |
238
238
  | `data-tooltip` | `text.tooltip` |
239
239
  | `data-modal-title` | `text.modalTitle` |
240
240
  | `data-modal-subtitle` | `text.modalSubtitle` |
241
241
  | `data-placeholder` | `text.placeholder` |
242
242
  | `data-submit-button` | `text.submitButton` |
243
243
  | `data-skip-button` | `text.skipButton` |
244
+ | `data-positive-label` | `text.positiveLabel` |
245
+ | `data-negative-label` | `text.negativeLabel` |
246
+ | `data-record-label` | `text.recordLabel` |
247
+ | `data-dismiss-label` | `text.dismissLabel` |
248
+ | `data-feedback-label` | `text.feedbackLabel` |
249
+ | `data-confirmation-title` | `text.confirmationTitle` |
250
+ | `data-confirmation-message` | `text.confirmationMessage` |
251
+ | `data-confirmation-close` | `text.confirmationClose` |
244
252
  | `data-error-title` | `text.errorTitle` |
245
253
  | `data-error-message` | `text.errorMessage` |
254
+ | `data-hide-confirmation` | `hideConfirmation` |
255
+ | `data-modal-width` | `modalWidth` |
256
+ | `data-backdrop-opacity` | `backdropOpacity` |
257
+ | `data-font-family` | `fontFamily` |
258
+ | `data-font-size` | `fontSize` |
259
+ | `data-capture-screenshot` | `captureScreenshot` |
260
+ | `data-annotate` | `annotate` (`"false"` to turn off) |
261
+ | `data-annotation-color` | `annotationColor` |
262
+ | `data-annotation-palette` | `annotationPalette`: a JSON array (`'["#f00","#0f0"]'`) or a comma list (`"#f00, rgb(0, 128, 0), #00f"`) |
263
+ | `data-capture-video` | `captureVideo` |
264
+ | `data-video-max-duration` | `videoOptions.maxDuration` |
265
+ | `data-video-redaction` | `videoOptions.redaction` |
266
+ | `data-record-icon` | `recordIcon` |
267
+ | `data-incognito` | `incognito` |
268
+ | `data-hide-dismiss` | `hideDismiss` |
246
269
  | `data-positive-icon` | `positiveIcon` |
247
270
  | `data-negative-icon` | `negativeIcon` |
271
+ | `data-feedback-icon` | `feedbackIcon` |
272
+ | `data-hide-thumbs` | `hideThumbs` |
273
+ | `data-css` | `css` (wins over `data-css-selector`) |
274
+ | `data-css-selector` | `css`, taken from the `textContent` of the element this selector matches |
275
+ | `data-screenshot-method` | `screenshotMethod` |
276
+ | `data-screenshot-quality` | `screenshotOptions.quality` |
277
+ | `data-screenshot-max-width` | `screenshotOptions.maxWidth` |
278
+ | `data-screenshot-max-height` | `screenshotOptions.maxHeight` |
248
279
  | `data-quest-base` | `quests.base` |
249
280
  | `data-quest-up` | `quests.up` |
250
281
  | `data-quest-down` | `quests.down` |
@@ -252,6 +283,8 @@ When using the script tag method, all config options are available as `data-*` a
252
283
  | `data-quest-api-key` | `quests.apiKey` |
253
284
  | `data-quest-module-url` | `quests.moduleUrl` |
254
285
 
286
+ A value the embed can't use is ignored with one `console.warn` naming the attribute, and the default stays. That covers a malformed `data-annotation-palette` and an empty screen-reader label (`data-positive-label=""` would leave the button with no accessible name).
287
+
255
288
  ## Custom Button Container
256
289
 
257
290
  By default, the embed creates a fixed-position container in the viewport corner. To place the buttons inside your own element:
@@ -9,9 +9,11 @@
9
9
  */
10
10
  import type { FeedbackConfig } from "./types";
11
11
  /**
12
- * Parse config from data-* attributes (backward compatibility)
12
+ * Parse config from data-* attributes. Every option that can be written as
13
+ * text has one, so the JSON config block is a choice, not a requirement.
14
+ *
15
+ * Exported for tests: index.ts does not re-export it, so this is not public API.
13
16
  */
14
- /** Exported for tests: index.ts does not re-export it, so this is not public API. */
15
17
  export declare function parseDataAttributes(script: HTMLScriptElement): Partial<FeedbackConfig> | null;
16
18
  /**
17
19
  * Initialize a QaidFeedback instance from the current `<script>` tag's JSON