@firstflow/react 0.0.1 → 0.0.101
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 +107 -315
- package/dist/chunk-WTTDFCFD.mjs +2157 -0
- package/dist/events-DAiGBrYc.d.mts +325 -0
- package/dist/events-DAiGBrYc.d.ts +325 -0
- package/dist/index.d.mts +356 -395
- package/dist/index.d.ts +356 -395
- package/dist/index.js +4726 -666
- package/dist/index.mjs +3242 -1272
- package/dist/internal.d.mts +131 -0
- package/dist/internal.d.ts +131 -0
- package/dist/internal.js +915 -0
- package/dist/internal.mjs +228 -0
- package/package.json +27 -9
- package/dist/index.css +0 -360
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { N as NormalizedFeedbackConfig, p as NormalizedFeedbackFormConfig, q as FeedbackModulePublic, I as IssueFormValues, r as NormalizedConfig, s as NormalizedFieldConfig, t as IssueContextMetadata, O as OpenOptions, u as IssuePayload, v as RawIssueFieldConfig, R as RawIssuesConfig, V as ValidationResult, w as IssueReporterInstance, x as IssueReportData, y as CreateIssueReporterOptions } from './events-DAiGBrYc.mjs';
|
|
2
|
+
export { z as FEEDBACK_SUBMITTED, B as ISSUE_SUBMITTED, D as IssueModulePublic, M as MessageFeedbackSubmitPayload, a as RawFeedbackConfig } from './events-DAiGBrYc.mjs';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import React, { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
type UseFirstflowFeedbackMessageResult = {
|
|
7
|
+
rating: 'like' | 'dislike' | null;
|
|
8
|
+
selectedTags: string[];
|
|
9
|
+
comment: string;
|
|
10
|
+
submitting: boolean;
|
|
11
|
+
submitted: boolean;
|
|
12
|
+
error: string | null;
|
|
13
|
+
setRating: (r: 'like' | 'dislike') => void;
|
|
14
|
+
toggleTag: (tag: string) => void;
|
|
15
|
+
setComment: (c: string) => void;
|
|
16
|
+
submit: () => Promise<void>;
|
|
17
|
+
clearError: () => void;
|
|
18
|
+
isEnabled: boolean;
|
|
19
|
+
config: NormalizedFeedbackConfig | null;
|
|
20
|
+
sideConfig: NormalizedFeedbackFormConfig | null;
|
|
21
|
+
};
|
|
22
|
+
type UseFirstflowFeedbackMessageOptions = {
|
|
23
|
+
conversationId: string;
|
|
24
|
+
messageId: string;
|
|
25
|
+
messagePreview: string;
|
|
26
|
+
metadata?: Record<string, unknown>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* **Module mode** — `useFirstflowFeedback()`
|
|
30
|
+
* Returns `firstflow.feedback`: programmatic `submit(payload)`, `getConfig()`, `isEnabled()` (e.g. Thread slot, one-off submits).
|
|
31
|
+
*
|
|
32
|
+
* **Message mode** — `useFirstflowFeedback({ conversationId, messageId, messagePreview, metadata? })`
|
|
33
|
+
* Headless per-message state: rating, tags, comment, `submit()`, localStorage.
|
|
34
|
+
*/
|
|
35
|
+
declare function useFirstflowFeedback(): FeedbackModulePublic;
|
|
36
|
+
declare function useFirstflowFeedback(options: UseFirstflowFeedbackMessageOptions): UseFirstflowFeedbackMessageResult;
|
|
37
|
+
|
|
38
|
+
type UseFirstflowIssueFormResult = {
|
|
39
|
+
/** Current field values (ids from config). */
|
|
40
|
+
values: IssueFormValues;
|
|
41
|
+
setValue: (fieldId: string, value: string) => void;
|
|
42
|
+
setValues: (next: IssueFormValues) => void;
|
|
43
|
+
errors: Record<string, string>;
|
|
44
|
+
submitting: boolean;
|
|
45
|
+
submitted: boolean;
|
|
46
|
+
submitError: string | null;
|
|
47
|
+
/** Validate only; sets `errors`. Returns whether valid. */
|
|
48
|
+
validate: () => boolean;
|
|
49
|
+
/** Validate, then `reportIssue` with merged `open()` context (messageId, etc.). */
|
|
50
|
+
submit: () => Promise<void>;
|
|
51
|
+
/** Clear values to empty, errors, submit state. */
|
|
52
|
+
reset: () => void;
|
|
53
|
+
clearSubmitError: () => void;
|
|
54
|
+
isEnabled: boolean;
|
|
55
|
+
config: NormalizedConfig;
|
|
56
|
+
title: string;
|
|
57
|
+
triggerLabel: string;
|
|
58
|
+
submitLabel: string;
|
|
59
|
+
cancelLabel: string;
|
|
60
|
+
cancelEnabled: boolean;
|
|
61
|
+
uiText: {
|
|
62
|
+
title: string;
|
|
63
|
+
triggerLabel: string;
|
|
64
|
+
submitLabel: string;
|
|
65
|
+
cancelLabel: string;
|
|
66
|
+
cancelEnabled: boolean;
|
|
67
|
+
promptText: string;
|
|
68
|
+
};
|
|
69
|
+
fields: NormalizedFieldConfig[];
|
|
70
|
+
promptText: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Headless issue form: same validation + submit as {@link IssueReporter}.
|
|
74
|
+
* Build any UI; merge context from `open({ messageId, conversationId, … })` on submit.
|
|
75
|
+
*/
|
|
76
|
+
declare function useFirstflowIssueForm(): UseFirstflowIssueFormResult;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Issue module types. Use the Issue namespace so the root package stays platform-first.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
declare const issue_IssueContextMetadata: typeof IssueContextMetadata;
|
|
83
|
+
declare const issue_NormalizedConfig: typeof NormalizedConfig;
|
|
84
|
+
declare const issue_NormalizedFieldConfig: typeof NormalizedFieldConfig;
|
|
85
|
+
declare const issue_OpenOptions: typeof OpenOptions;
|
|
86
|
+
declare const issue_RawIssueFieldConfig: typeof RawIssueFieldConfig;
|
|
87
|
+
declare const issue_RawIssuesConfig: typeof RawIssuesConfig;
|
|
88
|
+
declare const issue_ValidationResult: typeof ValidationResult;
|
|
89
|
+
declare namespace issue {
|
|
90
|
+
export { IssueFormValues as FormValues, issue_IssueContextMetadata as IssueContextMetadata, issue_NormalizedConfig as NormalizedConfig, issue_NormalizedFieldConfig as NormalizedFieldConfig, issue_OpenOptions as OpenOptions, IssuePayload as Payload, issue_RawIssueFieldConfig as RawIssueFieldConfig, issue_RawIssuesConfig as RawIssuesConfig, issue_ValidationResult as ValidationResult };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare function useFirstflowIssueReporter(): {
|
|
94
|
+
reporter: IssueReporterInstance;
|
|
95
|
+
open: (options?: OpenOptions) => void;
|
|
96
|
+
reportIssue: (data: IssueReportData) => Promise<void>;
|
|
97
|
+
submit: (data: IssueReportData) => Promise<void>;
|
|
98
|
+
config: NormalizedConfig;
|
|
99
|
+
isModalOpen: boolean;
|
|
100
|
+
closeModal: () => void;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type IssueReporterProps = {
|
|
104
|
+
showTrigger?: boolean;
|
|
105
|
+
};
|
|
106
|
+
declare function IssueReporter({ showTrigger }: IssueReporterProps): react_jsx_runtime.JSX.Element | null;
|
|
107
|
+
|
|
108
|
+
type IssueReporterContextValue = {
|
|
109
|
+
reporter: IssueReporterInstance;
|
|
110
|
+
isModalOpen: boolean;
|
|
111
|
+
openModal: (options?: OpenOptions) => void;
|
|
112
|
+
closeModal: () => void;
|
|
113
|
+
openOptionsRef: React.MutableRefObject<OpenOptions | undefined>;
|
|
114
|
+
};
|
|
115
|
+
type IssueReporterProviderProps = {
|
|
116
|
+
reporter: IssueReporterInstance;
|
|
117
|
+
children: ReactNode;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Provides React bindings and modal state only. Config lifecycle and submission stay in the reporter instance.
|
|
121
|
+
*/
|
|
122
|
+
declare function IssueReporterProvider({ reporter, children, }: IssueReporterProviderProps): react_jsx_runtime.JSX.Element;
|
|
123
|
+
declare function useIssueReporterContext(): IssueReporterContextValue;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Factory: returns an instance. No global state; callback ref from Provider for open().
|
|
127
|
+
* Issue events are sent via the platform analytics layer only (no direct transport/backend calls from here).
|
|
128
|
+
*/
|
|
129
|
+
declare function createIssueReporter(options: CreateIssueReporterOptions): IssueReporterInstance;
|
|
130
|
+
|
|
131
|
+
export { CreateIssueReporterOptions, FeedbackModulePublic, issue as Issue, IssueContextMetadata, IssueFormValues, IssuePayload, IssueReporter, IssueReporterInstance, type IssueReporterProps, IssueReporterProvider, NormalizedConfig, NormalizedFeedbackConfig, NormalizedFieldConfig, OpenOptions, RawIssueFieldConfig, RawIssuesConfig, type UseFirstflowFeedbackMessageOptions, type UseFirstflowFeedbackMessageResult, type UseFirstflowIssueFormResult, ValidationResult, createIssueReporter, useFirstflowFeedback, useFirstflowIssueForm, useFirstflowIssueReporter, useIssueReporterContext };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { N as NormalizedFeedbackConfig, p as NormalizedFeedbackFormConfig, q as FeedbackModulePublic, I as IssueFormValues, r as NormalizedConfig, s as NormalizedFieldConfig, t as IssueContextMetadata, O as OpenOptions, u as IssuePayload, v as RawIssueFieldConfig, R as RawIssuesConfig, V as ValidationResult, w as IssueReporterInstance, x as IssueReportData, y as CreateIssueReporterOptions } from './events-DAiGBrYc.js';
|
|
2
|
+
export { z as FEEDBACK_SUBMITTED, B as ISSUE_SUBMITTED, D as IssueModulePublic, M as MessageFeedbackSubmitPayload, a as RawFeedbackConfig } from './events-DAiGBrYc.js';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import React, { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
type UseFirstflowFeedbackMessageResult = {
|
|
7
|
+
rating: 'like' | 'dislike' | null;
|
|
8
|
+
selectedTags: string[];
|
|
9
|
+
comment: string;
|
|
10
|
+
submitting: boolean;
|
|
11
|
+
submitted: boolean;
|
|
12
|
+
error: string | null;
|
|
13
|
+
setRating: (r: 'like' | 'dislike') => void;
|
|
14
|
+
toggleTag: (tag: string) => void;
|
|
15
|
+
setComment: (c: string) => void;
|
|
16
|
+
submit: () => Promise<void>;
|
|
17
|
+
clearError: () => void;
|
|
18
|
+
isEnabled: boolean;
|
|
19
|
+
config: NormalizedFeedbackConfig | null;
|
|
20
|
+
sideConfig: NormalizedFeedbackFormConfig | null;
|
|
21
|
+
};
|
|
22
|
+
type UseFirstflowFeedbackMessageOptions = {
|
|
23
|
+
conversationId: string;
|
|
24
|
+
messageId: string;
|
|
25
|
+
messagePreview: string;
|
|
26
|
+
metadata?: Record<string, unknown>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* **Module mode** — `useFirstflowFeedback()`
|
|
30
|
+
* Returns `firstflow.feedback`: programmatic `submit(payload)`, `getConfig()`, `isEnabled()` (e.g. Thread slot, one-off submits).
|
|
31
|
+
*
|
|
32
|
+
* **Message mode** — `useFirstflowFeedback({ conversationId, messageId, messagePreview, metadata? })`
|
|
33
|
+
* Headless per-message state: rating, tags, comment, `submit()`, localStorage.
|
|
34
|
+
*/
|
|
35
|
+
declare function useFirstflowFeedback(): FeedbackModulePublic;
|
|
36
|
+
declare function useFirstflowFeedback(options: UseFirstflowFeedbackMessageOptions): UseFirstflowFeedbackMessageResult;
|
|
37
|
+
|
|
38
|
+
type UseFirstflowIssueFormResult = {
|
|
39
|
+
/** Current field values (ids from config). */
|
|
40
|
+
values: IssueFormValues;
|
|
41
|
+
setValue: (fieldId: string, value: string) => void;
|
|
42
|
+
setValues: (next: IssueFormValues) => void;
|
|
43
|
+
errors: Record<string, string>;
|
|
44
|
+
submitting: boolean;
|
|
45
|
+
submitted: boolean;
|
|
46
|
+
submitError: string | null;
|
|
47
|
+
/** Validate only; sets `errors`. Returns whether valid. */
|
|
48
|
+
validate: () => boolean;
|
|
49
|
+
/** Validate, then `reportIssue` with merged `open()` context (messageId, etc.). */
|
|
50
|
+
submit: () => Promise<void>;
|
|
51
|
+
/** Clear values to empty, errors, submit state. */
|
|
52
|
+
reset: () => void;
|
|
53
|
+
clearSubmitError: () => void;
|
|
54
|
+
isEnabled: boolean;
|
|
55
|
+
config: NormalizedConfig;
|
|
56
|
+
title: string;
|
|
57
|
+
triggerLabel: string;
|
|
58
|
+
submitLabel: string;
|
|
59
|
+
cancelLabel: string;
|
|
60
|
+
cancelEnabled: boolean;
|
|
61
|
+
uiText: {
|
|
62
|
+
title: string;
|
|
63
|
+
triggerLabel: string;
|
|
64
|
+
submitLabel: string;
|
|
65
|
+
cancelLabel: string;
|
|
66
|
+
cancelEnabled: boolean;
|
|
67
|
+
promptText: string;
|
|
68
|
+
};
|
|
69
|
+
fields: NormalizedFieldConfig[];
|
|
70
|
+
promptText: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Headless issue form: same validation + submit as {@link IssueReporter}.
|
|
74
|
+
* Build any UI; merge context from `open({ messageId, conversationId, … })` on submit.
|
|
75
|
+
*/
|
|
76
|
+
declare function useFirstflowIssueForm(): UseFirstflowIssueFormResult;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Issue module types. Use the Issue namespace so the root package stays platform-first.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
declare const issue_IssueContextMetadata: typeof IssueContextMetadata;
|
|
83
|
+
declare const issue_NormalizedConfig: typeof NormalizedConfig;
|
|
84
|
+
declare const issue_NormalizedFieldConfig: typeof NormalizedFieldConfig;
|
|
85
|
+
declare const issue_OpenOptions: typeof OpenOptions;
|
|
86
|
+
declare const issue_RawIssueFieldConfig: typeof RawIssueFieldConfig;
|
|
87
|
+
declare const issue_RawIssuesConfig: typeof RawIssuesConfig;
|
|
88
|
+
declare const issue_ValidationResult: typeof ValidationResult;
|
|
89
|
+
declare namespace issue {
|
|
90
|
+
export { IssueFormValues as FormValues, issue_IssueContextMetadata as IssueContextMetadata, issue_NormalizedConfig as NormalizedConfig, issue_NormalizedFieldConfig as NormalizedFieldConfig, issue_OpenOptions as OpenOptions, IssuePayload as Payload, issue_RawIssueFieldConfig as RawIssueFieldConfig, issue_RawIssuesConfig as RawIssuesConfig, issue_ValidationResult as ValidationResult };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare function useFirstflowIssueReporter(): {
|
|
94
|
+
reporter: IssueReporterInstance;
|
|
95
|
+
open: (options?: OpenOptions) => void;
|
|
96
|
+
reportIssue: (data: IssueReportData) => Promise<void>;
|
|
97
|
+
submit: (data: IssueReportData) => Promise<void>;
|
|
98
|
+
config: NormalizedConfig;
|
|
99
|
+
isModalOpen: boolean;
|
|
100
|
+
closeModal: () => void;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type IssueReporterProps = {
|
|
104
|
+
showTrigger?: boolean;
|
|
105
|
+
};
|
|
106
|
+
declare function IssueReporter({ showTrigger }: IssueReporterProps): react_jsx_runtime.JSX.Element | null;
|
|
107
|
+
|
|
108
|
+
type IssueReporterContextValue = {
|
|
109
|
+
reporter: IssueReporterInstance;
|
|
110
|
+
isModalOpen: boolean;
|
|
111
|
+
openModal: (options?: OpenOptions) => void;
|
|
112
|
+
closeModal: () => void;
|
|
113
|
+
openOptionsRef: React.MutableRefObject<OpenOptions | undefined>;
|
|
114
|
+
};
|
|
115
|
+
type IssueReporterProviderProps = {
|
|
116
|
+
reporter: IssueReporterInstance;
|
|
117
|
+
children: ReactNode;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Provides React bindings and modal state only. Config lifecycle and submission stay in the reporter instance.
|
|
121
|
+
*/
|
|
122
|
+
declare function IssueReporterProvider({ reporter, children, }: IssueReporterProviderProps): react_jsx_runtime.JSX.Element;
|
|
123
|
+
declare function useIssueReporterContext(): IssueReporterContextValue;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Factory: returns an instance. No global state; callback ref from Provider for open().
|
|
127
|
+
* Issue events are sent via the platform analytics layer only (no direct transport/backend calls from here).
|
|
128
|
+
*/
|
|
129
|
+
declare function createIssueReporter(options: CreateIssueReporterOptions): IssueReporterInstance;
|
|
130
|
+
|
|
131
|
+
export { CreateIssueReporterOptions, FeedbackModulePublic, issue as Issue, IssueContextMetadata, IssueFormValues, IssuePayload, IssueReporter, IssueReporterInstance, type IssueReporterProps, IssueReporterProvider, NormalizedConfig, NormalizedFeedbackConfig, NormalizedFieldConfig, OpenOptions, RawIssueFieldConfig, RawIssuesConfig, type UseFirstflowFeedbackMessageOptions, type UseFirstflowFeedbackMessageResult, type UseFirstflowIssueFormResult, ValidationResult, createIssueReporter, useFirstflowFeedback, useFirstflowIssueForm, useFirstflowIssueReporter, useIssueReporterContext };
|