@syntrologie/adapt-faq 2.2.0-canary.8 → 2.2.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/dist/FAQWidget.js CHANGED
@@ -437,7 +437,7 @@ export function FAQWidget({ config, runtime, instanceId }) {
437
437
  const hasCategories = useMemo(() => filteredQuestions.some((q) => q.config.category), [filteredQuestions]);
438
438
  // Resolve theme (auto -> detect system preference)
439
439
  const resolvedTheme = useMemo(() => {
440
- if (config.theme !== 'auto')
440
+ if (config.theme && config.theme !== 'auto')
441
441
  return config.theme;
442
442
  // Check system preference (SSR-safe)
443
443
  if (typeof window !== 'undefined') {
package/dist/cdn.d.ts CHANGED
@@ -39,12 +39,7 @@ export declare const manifest: {
39
39
  icon: string;
40
40
  };
41
41
  }[];
42
- /**
43
- * Extract notify watcher entries from tile config props.
44
- * The runtime evaluates these continuously (even with drawer closed)
45
- * and publishes faq:question_revealed when showWhen transitions false → true.
46
- */
47
- notifyWatchers(props: Record<string, unknown>): {
42
+ notifyWatchers: (props: Record<string, unknown>) => {
48
43
  id: string;
49
44
  strategy: import("./types").DecisionStrategy<boolean>;
50
45
  eventName: string;
package/dist/cdn.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAIlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;2BAwDgqoB,CAAC;8BAA8B,CAAC;;;;;;;;;QAhDjtoB;;;;WAIG;8BACmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;+BAqBtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CAQjD,CAAC;AAaF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAGlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;2BAoC23pB,CAAC;8BAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAtBr5pB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CAQjD,CAAC;AAaF,eAAe,QAAQ,CAAC"}
package/dist/cdn.js CHANGED
@@ -15,31 +15,11 @@ export const manifest = {
15
15
  version: runtime.version,
16
16
  name: runtime.name,
17
17
  description: runtime.description,
18
+ // biome-ignore lint: manifest shape maps runtime fields to specific interface properties
18
19
  runtime: {
19
20
  actions: runtime.executors,
20
21
  widgets: runtime.widgets,
21
- /**
22
- * Extract notify watcher entries from tile config props.
23
- * The runtime evaluates these continuously (even with drawer closed)
24
- * and publishes faq:question_revealed when showWhen transitions false → true.
25
- */
26
- notifyWatchers(props) {
27
- const actions = (props.actions ?? []);
28
- return actions
29
- .filter((a) => a.notify && a.showWhen)
30
- .map((a) => ({
31
- id: `faq:${a.config.id}`,
32
- strategy: a.showWhen,
33
- eventName: 'faq:question_revealed',
34
- eventProps: {
35
- questionId: a.config.id,
36
- question: a.config.question,
37
- title: a.notify.title,
38
- body: a.notify.body,
39
- icon: a.notify.icon,
40
- },
41
- }));
42
- },
22
+ notifyWatchers: runtime.notifyWatchers,
43
23
  },
44
24
  editor: {
45
25
  component: FAQEditor,
package/dist/editor.d.ts CHANGED
@@ -5,7 +5,20 @@
5
5
  * Displays a scannable list of Q&A cards with trigger, rationale,
6
6
  * and inline editing. Includes detection badges and hover-to-highlight.
7
7
  */
8
- import { type EditorPanelProps } from './types';
8
+ import { type EditorPanelProps, type FAQConfig, type FAQQuestionAction } from './types';
9
+ export interface FlatItem {
10
+ key: string;
11
+ index: number;
12
+ summary: string;
13
+ trigger: string;
14
+ rationale?: {
15
+ why: string;
16
+ confidence?: number;
17
+ };
18
+ firstAnchor: string | null;
19
+ question: FAQQuestionAction;
20
+ }
21
+ export declare function flattenItems(config: FAQConfig): FlatItem[];
9
22
  export declare function FAQEditor({ config, onChange, editor }: EditorPanelProps): import("react/jsx-runtime").JSX.Element;
10
23
  /**
11
24
  * Editor panel configuration for the app registry.
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsBH,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,SAAS,CAAC;AAiLjB,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CAsWvE;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;CAGlB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsBH,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,SAAS,EACd,KAAK,iBAAiB,EAGvB,MAAM,SAAS,CAAC;AAoEjB,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,EAAE,CAW1D;AAwFD,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CAyVvE;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;CAGlB,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/dist/editor.js CHANGED
@@ -58,7 +58,7 @@ function getAnswerText(answer) {
58
58
  return answer.html;
59
59
  return answer.content;
60
60
  }
61
- function flattenItems(config) {
61
+ export function flattenItems(config) {
62
62
  const actions = (config.actions || []).filter(isOwnAction);
63
63
  return actions.map((q, i) => ({
64
64
  key: String(i),
@@ -220,16 +220,6 @@ export function FAQEditor({ config, onChange, editor }) {
220
220
  editor.setBackHandler?.(editingKey !== null ? handleBackToList : null);
221
221
  return () => editor.setBackHandler?.(null);
222
222
  }, [editingKey, handleBackToList, editor]);
223
- const _handleBeforeAfter = useCallback((mode) => {
224
- setPreviewMode(mode);
225
- if (mode === 'before') {
226
- const filtered = filterConfig(typedConfig, new Set([editingKey]));
227
- editor.previewConfig(filtered);
228
- }
229
- else {
230
- editor.previewConfig(config);
231
- }
232
- }, [typedConfig, editingKey, editor, config]);
233
223
  const handleFieldChange = useCallback((index, field, value) => {
234
224
  const ownActions = (typedConfig.actions || []).filter(isOwnAction).slice();
235
225
  const q = { ...ownActions[index], config: { ...ownActions[index].config } };
package/dist/runtime.d.ts CHANGED
@@ -46,6 +46,23 @@ export declare const runtime: {
46
46
  icon: string;
47
47
  };
48
48
  }[];
49
+ /**
50
+ * Extract notify watcher entries from tile config props.
51
+ * The runtime evaluates these continuously (even with drawer closed)
52
+ * and publishes faq:question_revealed when showWhen transitions false → true.
53
+ */
54
+ notifyWatchers(props: Record<string, unknown>): {
55
+ id: string;
56
+ strategy: import("./types").DecisionStrategy<boolean>;
57
+ eventName: string;
58
+ eventProps: {
59
+ questionId: string;
60
+ question: string;
61
+ title: string | undefined;
62
+ body: string | undefined;
63
+ icon: string | undefined;
64
+ };
65
+ }[];
49
66
  };
50
67
  export default runtime;
51
68
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;IAOlB;;OAEG;;;;;;;;;;;IAGH;;OAEG;;;;;uBAeg/pB,CAAC;0BAA8B,CAAC;;;;;;;;;CAHphqB,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;IAOlB;;OAEG;;;;;;;;;;;IAGH;;OAEG;;;;;uBAsCwtoB,CAAC;0BAA8B,CAAC;;;;;;;;;IAzB3voB;;;;OAIG;0BACmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;CAiB9C,CAAC;AAEF,eAAe,OAAO,CAAC"}
package/dist/runtime.js CHANGED
@@ -39,5 +39,27 @@ export const runtime = {
39
39
  },
40
40
  },
41
41
  ],
42
+ /**
43
+ * Extract notify watcher entries from tile config props.
44
+ * The runtime evaluates these continuously (even with drawer closed)
45
+ * and publishes faq:question_revealed when showWhen transitions false → true.
46
+ */
47
+ notifyWatchers(props) {
48
+ const actions = (props.actions ?? []);
49
+ return actions
50
+ .filter((a) => a.notify && a.showWhen)
51
+ .map((a) => ({
52
+ id: `faq:${a.config.id}`,
53
+ strategy: a.showWhen,
54
+ eventName: 'faq:question_revealed',
55
+ eventProps: {
56
+ questionId: a.config.id,
57
+ question: a.config.question,
58
+ title: a.notify.title,
59
+ body: a.notify.body,
60
+ icon: a.notify.icon,
61
+ },
62
+ }));
63
+ },
42
64
  };
43
65
  export default runtime;