@originallyus/feedback-rn-sdk 4.0.0-beta.6 → 4.0.0-beta.8

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.

Potentially problematic release.


This version of @originallyus/feedback-rn-sdk might be problematic. Click here for more details.

Files changed (56) hide show
  1. package/lib/module/AIAContentUsefulness.js +1 -1
  2. package/lib/module/AIAContentUsefulness.js.map +1 -1
  3. package/lib/module/AIAFeedback.js +8 -8
  4. package/lib/module/AIAFeedback.js.map +1 -1
  5. package/lib/module/AIAFeedbackForm.js.map +1 -1
  6. package/lib/module/AIAFeedbackSplash.js.map +1 -1
  7. package/lib/module/AIAFeedbackStyles.js.map +1 -1
  8. package/lib/module/AIAFeedbackSuccess.js.map +1 -1
  9. package/lib/module/component/ButtonSubmit.js +2 -2
  10. package/lib/module/component/ButtonSubmit.js.map +1 -1
  11. package/lib/module/component/Input.js +3 -3
  12. package/lib/module/component/Input.js.map +1 -1
  13. package/lib/module/component/MultiSelectButtons.js +5 -5
  14. package/lib/module/component/MultiSelectButtons.js.map +1 -1
  15. package/lib/module/component/Rating.js +4 -4
  16. package/lib/module/component/Rating.js.map +1 -1
  17. package/lib/module/component/RatingNumber.js +3 -3
  18. package/lib/module/component/RatingNumber.js.map +1 -1
  19. package/lib/module/component/Textarea.js +3 -3
  20. package/lib/module/component/Textarea.js.map +1 -1
  21. package/lib/module/component/YesNoButtons.js +2 -2
  22. package/lib/module/component/YesNoButtons.js.map +1 -1
  23. package/lib/module/index.js +8 -8
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/service/feedbackService.js +1 -1
  26. package/lib/module/service/feedbackService.js.map +1 -1
  27. package/lib/module/utils/networking.js +3 -3
  28. package/lib/module/utils/networking.js.map +1 -1
  29. package/package.json +4 -4
  30. package/src/AIAContentUsefulness.tsx +0 -296
  31. package/src/AIAFeedback.tsx +0 -354
  32. package/src/AIAFeedbackForm.tsx +0 -267
  33. package/src/AIAFeedbackSplash.tsx +0 -49
  34. package/src/AIAFeedbackStyles.ts +0 -311
  35. package/src/AIAFeedbackSuccess.tsx +0 -67
  36. package/src/assets/CheckIcon.tsx +0 -18
  37. package/src/assets/CloseIcon.tsx +0 -18
  38. package/src/assets/ErrorIcon.tsx +0 -18
  39. package/src/assets/PlusIcon.tsx +0 -18
  40. package/src/assets/StarIcon.tsx +0 -18
  41. package/src/component/Button.tsx +0 -68
  42. package/src/component/ButtonSubmit.tsx +0 -335
  43. package/src/component/Input.tsx +0 -288
  44. package/src/component/MultiSelectButtons.tsx +0 -272
  45. package/src/component/README.md +0 -215
  46. package/src/component/READMEVI.md +0 -192
  47. package/src/component/Rating.tsx +0 -248
  48. package/src/component/RatingNumber.tsx +0 -421
  49. package/src/component/Textarea.tsx +0 -282
  50. package/src/component/YesNoButtons.tsx +0 -236
  51. package/src/index.tsx +0 -33
  52. package/src/service/feedbackService.ts +0 -108
  53. package/src/utils/common.ts +0 -241
  54. package/src/utils/constants.ts +0 -60
  55. package/src/utils/index.ts +0 -167
  56. package/src/utils/networking.ts +0 -134
@@ -1,335 +0,0 @@
1
- import * as f from '@utils/common'
2
- import type {ReactNode} from 'react'
3
- import {useMemo} from 'react'
4
- import {ActivityIndicator, Pressable, StyleSheet, Text, View, type TextStyle, type ViewStyle} from 'react-native'
5
-
6
- import {
7
- BG_BUTTON_SECONDARY,
8
- BG_DISABLED,
9
- BG_DISABLED_SECONDARY,
10
- ERROR_COLOR,
11
- PRESSED_COLOR,
12
- PRIMARY_COLOR,
13
- TEXT_DISABLED,
14
- TEXT_WHITE,
15
- } from '@utils/constants'
16
-
17
- /**
18
- * Visual style variant for `ButtonSubmit`.
19
- *
20
- * - `'primary'` – solid primary background with white text.
21
- * - `'secondary'` – light background with colored border and text.
22
- */
23
- export type ButtonSubmitVariant = 'primary' | 'secondary'
24
-
25
- /**
26
- * Props for the form submit button.
27
- *
28
- * This is a higher-level button component that supports loading state,
29
- * primary/secondary variants, full-width layout and basic theming.
30
- */
31
- export interface ButtonSubmitProps {
32
- /**
33
- * Called when the button is pressed.
34
- */
35
- onPress: () => void
36
- /**
37
- * Button label.
38
- */
39
- title: string
40
- /**
41
- * Optional icon or character shown to the left of the title.
42
- * Accepts a string (e.g. `"+"`, `"✓"`) or a ReactNode (e.g. SVG icon component).
43
- */
44
- leftIcon?: string | ReactNode
45
- /**
46
- * Visual variant of the button.
47
- *
48
- * @default 'primary'
49
- */
50
- variant?: ButtonSubmitVariant
51
- /**
52
- * When true, the button stretches to full container width.
53
- *
54
- * @default true
55
- */
56
- fullWidth?: boolean
57
- /**
58
- * When true, disables the button.
59
- *
60
- * @default false
61
- */
62
- disabled?: boolean
63
- /**
64
- * When true, shows an `ActivityIndicator` and prevents presses.
65
- *
66
- * @default false
67
- */
68
- loading?: boolean
69
- /**
70
- * Screen width, used internally to compute top margin.
71
- */
72
- appWidth: number
73
- /**
74
- * On tablets, constrain width to 200 instead of full width.
75
- */
76
- isTabletInstrusive?: boolean
77
- /**
78
- * Custom font family for the label (and left icon text).
79
- */
80
- fontFamily?: string
81
- /**
82
- * Font size for the label.
83
- *
84
- * @default 16
85
- */
86
- fontSize?: number
87
- /**
88
- * Text color override for normal (non-disabled, non-pressed) state.
89
- */
90
- textColor?: string
91
- /**
92
- * Background color override for normal (non-disabled, non-pressed) state.
93
- */
94
- backgroundColor?: string
95
- /**
96
- * Background color when pressed.
97
- */
98
- pressedColor?: string
99
- /**
100
- * Background color when disabled.
101
- */
102
- disabledBackgroundColor?: string
103
- /**
104
- * Text color when disabled.
105
- */
106
- disabledTextColor?: string
107
- /**
108
- * Border color for secondary variant.
109
- */
110
- borderColor?: string
111
- /**
112
- * Style for the outer container wrapping the `Pressable`.
113
- */
114
- containerStyle?: ViewStyle
115
- /**
116
- * Style for the `Pressable` itself.
117
- */
118
- style?: ViewStyle
119
- /**
120
- * Style for the text label.
121
- */
122
- textStyle?: TextStyle
123
- /**
124
- * Maximum number of lines for the label.
125
- */
126
- numberOfLines?: number
127
- }
128
-
129
- function ButtonSubmit({
130
- onPress,
131
- title,
132
- leftIcon,
133
- variant = 'primary',
134
- fullWidth = true,
135
- disabled = false,
136
- loading = false,
137
- appWidth,
138
- isTabletInstrusive,
139
- fontFamily,
140
- fontSize = 16,
141
- textColor: textColorProp,
142
- backgroundColor: backgroundColorProp,
143
- pressedColor: pressedColorProp,
144
- disabledBackgroundColor: disabledBgProp,
145
- disabledTextColor: disabledTextProp,
146
- borderColor: borderColorProp,
147
- containerStyle,
148
- style,
149
- textStyle,
150
- numberOfLines = 1,
151
- }: ButtonSubmitProps) {
152
- // const [pressed, setPressed] = useState(false)
153
- const isPrimary = variant === 'primary'
154
-
155
- const currentStyles = useMemo(() => {
156
- const base = (() => {
157
- if (isPrimary) {
158
- return {
159
- bg: PRIMARY_COLOR,
160
- disabledBg: BG_DISABLED,
161
- textColor: TEXT_WHITE,
162
- border: undefined,
163
- borderW: 0,
164
- pressedBg: pressedColorProp ?? PRESSED_COLOR,
165
- pressedText: TEXT_WHITE,
166
- pressedBorder: undefined,
167
- }
168
- }
169
- return {
170
- bg: BG_BUTTON_SECONDARY,
171
- disabledBg: BG_DISABLED_SECONDARY,
172
- textColor: ERROR_COLOR,
173
- border: borderColorProp ?? ERROR_COLOR,
174
- borderW: 1.2,
175
- pressedBg: BG_BUTTON_SECONDARY,
176
- pressedText: pressedColorProp ?? PRESSED_COLOR,
177
- pressedBorder: pressedColorProp ?? PRESSED_COLOR,
178
- }
179
- })()
180
-
181
- if (disabled || loading) {
182
- return {
183
- bg: disabledBgProp ?? base.disabledBg,
184
- text: disabledTextProp ?? TEXT_DISABLED,
185
- border: isPrimary ? undefined : disabledTextProp ?? TEXT_DISABLED,
186
- borderW: base.borderW,
187
- }
188
- }
189
-
190
- // if (pressed) {
191
- // return {
192
- // bg: base.pressedBg,
193
- // text: base.pressedText,
194
- // border: base.pressedBorder,
195
- // borderW: base.borderW,
196
- // }
197
- // }
198
-
199
- return {
200
- bg: backgroundColorProp ?? base.bg,
201
- text: textColorProp ?? base.textColor,
202
- border: base.border,
203
- borderW: base.borderW,
204
- }
205
- }, [
206
- isPrimary,
207
- disabled,
208
- loading,
209
- pressedColorProp,
210
- borderColorProp,
211
- disabledBgProp,
212
- disabledTextProp,
213
- backgroundColorProp,
214
- textColorProp,
215
- ])
216
-
217
- const layout = useMemo(() => {
218
- const widthStyle = (() => {
219
- if (isTabletInstrusive) return {width: 200}
220
- if (fullWidth) return {width: '100%' as const}
221
- return {alignSelf: 'flex-start' as const}
222
- })()
223
-
224
- const loaderColor = (() => {
225
- if (disabled) return TEXT_DISABLED
226
- if (isPrimary) return TEXT_WHITE
227
- return ERROR_COLOR
228
- })()
229
-
230
- return {
231
- width: widthStyle,
232
- loaderColor,
233
- opacity: loading ? 0 : 1,
234
- marginTop: f.w_p(appWidth, 10),
235
- }
236
- }, [isTabletInstrusive, fullWidth, disabled, isPrimary, loading, appWidth])
237
-
238
- return (
239
- <View
240
- style={[
241
- styles.container,
242
- {
243
- marginTop: layout.marginTop,
244
- },
245
- containerStyle,
246
- ]}
247
- >
248
- <Pressable
249
- onPress={disabled || loading ? undefined : onPress}
250
- // onPressIn={() => setPressed(true)}
251
- // onPressOut={() => setPressed(false)}
252
- disabled={disabled}
253
- style={[
254
- styles.button,
255
- layout.width,
256
- {
257
- backgroundColor: currentStyles.bg,
258
- borderWidth: currentStyles.borderW,
259
- borderColor: currentStyles.border,
260
- },
261
- style,
262
- ]}
263
- >
264
- {loading && <ActivityIndicator style={styles.loader} color={layout.loaderColor} />}
265
- <View style={styles.contentRow}>
266
- {leftIcon != null && leftIcon !== '' && (
267
- <Text
268
- style={[
269
- styles.text,
270
- styles.leftIcon,
271
- {
272
- fontSize,
273
- fontFamily,
274
- color: currentStyles.text,
275
- opacity: layout.opacity,
276
- },
277
- textStyle,
278
- ]}
279
- >
280
- {leftIcon}
281
- </Text>
282
- )}
283
- <Text
284
- style={[
285
- styles.text,
286
- {
287
- fontSize,
288
- fontFamily,
289
- color: currentStyles.text,
290
- opacity: layout.opacity,
291
- },
292
- textStyle,
293
- ]}
294
- numberOfLines={numberOfLines}
295
- ellipsizeMode="tail"
296
- >
297
- {title}
298
- </Text>
299
- </View>
300
- </Pressable>
301
- </View>
302
- )
303
- }
304
-
305
- export default ButtonSubmit
306
-
307
- const styles = StyleSheet.create({
308
- container: {
309
- width: '100%',
310
- },
311
- button: {
312
- borderRadius: 8,
313
- paddingVertical: 14,
314
- paddingHorizontal: 20,
315
- justifyContent: 'center',
316
- alignItems: 'center',
317
- minHeight: 44,
318
- maxWidth: '100%',
319
- },
320
- loader: {
321
- position: 'absolute',
322
- },
323
- contentRow: {
324
- flexDirection: 'row',
325
- alignItems: 'center',
326
- gap: 6,
327
- },
328
- leftIcon: {
329
- marginRight: 0,
330
- },
331
- text: {
332
- fontWeight: '500',
333
- flexShrink: 1,
334
- },
335
- })
@@ -1,288 +0,0 @@
1
- import {useMemo, useState} from 'react'
2
- import {View, Text, StyleSheet, TextInput, type ViewStyle, type TextStyle} from 'react-native'
3
- import * as f from '@utils/common'
4
- import {
5
- BG_DEFAULT,
6
- BORDER_FOCUS,
7
- BORDER_SECONDARY,
8
- ERROR_COLOR,
9
- TEXT_DARK,
10
- TEXT_NOTE,
11
- TEXT_PLACEHOLDER,
12
- } from '@utils/constants'
13
- import ErrorIcon from '@/assets/ErrorIcon'
14
-
15
- /**
16
- * Props for the single-line `Input` component.
17
- *
18
- * Renders a label, single-line text input, optional note, error,
19
- * and an optional character counter.
20
- */
21
- export interface InputProps {
22
- /**
23
- * Current text value.
24
- */
25
- value: string
26
- /**
27
- * Called when the text changes.
28
- */
29
- onChangeText: (text: string) => void
30
- /**
31
- * Placeholder text.
32
- *
33
- * @default 'Placeholder'
34
- */
35
- placeholder?: string
36
- /**
37
- * Label text rendered above the field.
38
- */
39
- label?: string
40
- /**
41
- * Helper text rendered below the field.
42
- */
43
- note?: string
44
- /**
45
- * Error message; when present, border and text are styled as error.
46
- */
47
- error?: string
48
- /**
49
- * Maximum number of characters allowed.
50
- */
51
- maxLength?: number
52
- /**
53
- * Whether to show the 0/maxLength counter when `maxLength` is set.
54
- *
55
- * @default true
56
- */
57
- showCounter?: boolean
58
- /**
59
- * App width, used to compute internal padding.
60
- */
61
- appWidth: number
62
- // Style
63
- /**
64
- * Background color when not focused.
65
- */
66
- backgroundColor?: string
67
- /**
68
- * Border color when not focused and not errored.
69
- */
70
- borderColor?: string
71
- /**
72
- * Background color when focused.
73
- */
74
- focusBackgroundColor?: string
75
- /**
76
- * Border color when focused.
77
- */
78
- focusBorderColor?: string
79
- /**
80
- * Border color when `error` is present.
81
- *
82
- * @default '#D32F2F'
83
- */
84
- errorBorderColor?: string
85
- /**
86
- * Font family for the text input.
87
- */
88
- fontFamily?: string
89
- /**
90
- * Font size for the text input.
91
- *
92
- * @default 16
93
- */
94
- fontSize?: number
95
- /**
96
- * Color used for the placeholder text.
97
- */
98
- placeholderTextColor?: string
99
- /**
100
- * Color used for the input text.
101
- */
102
- textColor?: string
103
- /**
104
- * Style for the label text.
105
- */
106
- labelStyle?: TextStyle
107
- /**
108
- * Style for the note text.
109
- */
110
- noteStyle?: TextStyle
111
- /**
112
- * Style for the error text.
113
- */
114
- errorStyle?: TextStyle
115
- /**
116
- * Style for the character counter text.
117
- */
118
- counterStyle?: TextStyle
119
- /**
120
- * Style for the outer wrapper view.
121
- */
122
- style?: ViewStyle
123
- }
124
-
125
- const DEFAULT_BG = BG_DEFAULT
126
- const DEFAULT_BORDER = BORDER_SECONDARY
127
- const DEFAULT_FOCUS_BORDER = BORDER_FOCUS
128
- const DEFAULT_TEXT = TEXT_DARK
129
- const DEFAULT_PLACEHOLDER = TEXT_PLACEHOLDER
130
- const DEFAULT_COUNTER = TEXT_PLACEHOLDER
131
- const DEFAULT_NOTE = TEXT_NOTE
132
- const DEFAULT_ERROR = ERROR_COLOR
133
-
134
- function Input({
135
- value,
136
- onChangeText,
137
- placeholder = 'Placeholder',
138
- label,
139
- note,
140
- error,
141
- maxLength,
142
- showCounter = true,
143
- appWidth,
144
- backgroundColor = DEFAULT_BG,
145
- borderColor = DEFAULT_BORDER,
146
- focusBackgroundColor = DEFAULT_BG,
147
- focusBorderColor = DEFAULT_FOCUS_BORDER,
148
- errorBorderColor = DEFAULT_ERROR,
149
- fontFamily,
150
- fontSize = 16,
151
- placeholderTextColor = DEFAULT_PLACEHOLDER,
152
- textColor = DEFAULT_TEXT,
153
- labelStyle,
154
- noteStyle,
155
- errorStyle,
156
- counterStyle,
157
- style,
158
- }: InputProps) {
159
- const [focused, setFocused] = useState(false)
160
- const length = value.length
161
- const hasError = useMemo(() => error != null && error !== '', [error])
162
- const showCounterEl = useMemo(() => maxLength != null && showCounter, [maxLength, showCounter])
163
-
164
- const effectiveBorderColor = useMemo(() => {
165
- if (hasError) return errorBorderColor
166
- if (focused) return focusBorderColor
167
- return borderColor
168
- }, [hasError, focused, errorBorderColor, focusBorderColor, borderColor])
169
-
170
- const inputContainerStyle = useMemo(
171
- () => [
172
- styles.inputWrapper,
173
- {
174
- paddingHorizontal: f.w_p(appWidth, 8),
175
- paddingVertical: 10,
176
- borderRadius: f.isTablet ? 6 : 4,
177
- backgroundColor: focused ? focusBackgroundColor : backgroundColor,
178
- borderColor: effectiveBorderColor,
179
- borderWidth: 1,
180
- },
181
- ],
182
- [appWidth, focused, focusBackgroundColor, backgroundColor, effectiveBorderColor],
183
- )
184
-
185
- const textInputStyle = useMemo(
186
- () => [
187
- styles.input,
188
- {
189
- fontFamily,
190
- fontSize,
191
- color: textColor,
192
- paddingRight: showCounterEl ? 48 : 0,
193
- },
194
- ],
195
- [fontFamily, fontSize, textColor, showCounterEl],
196
- )
197
-
198
- return (
199
- <View style={[styles.wrapper, style]}>
200
- {label != null && label !== '' && <Text style={[styles.label, labelStyle]}>{label}</Text>}
201
- <View style={inputContainerStyle}>
202
- <TextInput
203
- placeholder={placeholder}
204
- placeholderTextColor={placeholderTextColor}
205
- style={textInputStyle}
206
- value={value}
207
- onChangeText={text => {
208
- if (maxLength == null || text.length <= maxLength) {
209
- onChangeText(text)
210
- } else {
211
- onChangeText(text.slice(0, maxLength))
212
- }
213
- }}
214
- onFocus={() => setFocused(true)}
215
- onBlur={() => setFocused(false)}
216
- autoCorrect={false}
217
- />
218
- {showCounterEl && (
219
- <View style={styles.counterWrapper} pointerEvents="none">
220
- <Text style={[styles.counter, {color: DEFAULT_COUNTER}, counterStyle]}>
221
- {length}/{maxLength}
222
- </Text>
223
- </View>
224
- )}
225
- </View>
226
- {note != null && note !== '' && <Text style={[styles.note, {color: DEFAULT_NOTE}, noteStyle]}>{note}</Text>}
227
-
228
- {hasError && (
229
- <View style={styles.errorWrap}>
230
- <ErrorIcon size={20} color={ERROR_COLOR} />
231
- <Text style={[styles.error, {color: DEFAULT_ERROR}, errorStyle]}>{error}</Text>
232
- </View>
233
- )}
234
- </View>
235
- )
236
- }
237
-
238
- export default Input
239
-
240
- const styles = StyleSheet.create({
241
- wrapper: {
242
- width: '100%',
243
- },
244
- label: {
245
- fontSize: 16,
246
- fontWeight: '600',
247
- color: '#000000',
248
- marginBottom: 8,
249
- },
250
- inputWrapper: {
251
- width: '100%',
252
- position: 'relative',
253
- flexDirection: 'row',
254
- alignItems: 'center',
255
- },
256
- input: {
257
- flex: 1,
258
- padding: 0,
259
- minHeight: 20,
260
- },
261
- counterWrapper: {
262
- position: 'absolute',
263
- right: 12,
264
- top: 0,
265
- bottom: 0,
266
- justifyContent: 'center',
267
- },
268
- counter: {
269
- fontSize: 12,
270
- },
271
- note: {
272
- fontSize: 12,
273
- marginTop: 8,
274
- },
275
- errorWrap: {
276
- flexDirection: 'row',
277
- alignItems: 'center',
278
- marginTop: 8,
279
- gap: 6,
280
- },
281
-
282
- error: {
283
- fontSize: 14,
284
- lineHeight: 20,
285
- flex: 1,
286
- fontWeight: '400',
287
- },
288
- })