@repzo/widget-react-native 1.0.4 → 1.0.6

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.
Files changed (108) hide show
  1. package/lib/commonjs/api/client.js +8 -0
  2. package/lib/commonjs/api/client.js.map +1 -1
  3. package/lib/commonjs/i18n.js +14 -0
  4. package/lib/commonjs/i18n.js.map +1 -1
  5. package/lib/commonjs/locales.js +13 -0
  6. package/lib/commonjs/locales.js.map +1 -1
  7. package/lib/commonjs/state/widget-store.js +44 -4
  8. package/lib/commonjs/state/widget-store.js.map +1 -1
  9. package/lib/commonjs/types.js +3 -0
  10. package/lib/commonjs/types.js.map +1 -1
  11. package/lib/commonjs/ui/WidgetProvider.js +93 -64
  12. package/lib/commonjs/ui/WidgetProvider.js.map +1 -1
  13. package/lib/commonjs/ui/components/Gradient.js +18 -2
  14. package/lib/commonjs/ui/components/Gradient.js.map +1 -1
  15. package/lib/commonjs/ui/components/RatingCard.js +347 -0
  16. package/lib/commonjs/ui/components/RatingCard.js.map +1 -0
  17. package/lib/commonjs/ui/hooks/use-top-inset.js +22 -0
  18. package/lib/commonjs/ui/hooks/use-top-inset.js.map +1 -0
  19. package/lib/commonjs/ui/screens/chat/ChatView.js +30 -2
  20. package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -1
  21. package/lib/commonjs/ui/screens/home/HomeView.js +42 -9
  22. package/lib/commonjs/ui/screens/home/HomeView.js.map +1 -1
  23. package/lib/commonjs/ui/screens/home/HomeView.styles.js +5 -3
  24. package/lib/commonjs/ui/screens/home/HomeView.styles.js.map +1 -1
  25. package/lib/module/api/client.js +8 -0
  26. package/lib/module/api/client.js.map +1 -1
  27. package/lib/module/i18n.js +14 -0
  28. package/lib/module/i18n.js.map +1 -1
  29. package/lib/module/locales.js +13 -0
  30. package/lib/module/locales.js.map +1 -1
  31. package/lib/module/state/widget-store.js +44 -4
  32. package/lib/module/state/widget-store.js.map +1 -1
  33. package/lib/module/types.js +3 -0
  34. package/lib/module/types.js.map +1 -1
  35. package/lib/module/ui/WidgetProvider.js +96 -67
  36. package/lib/module/ui/WidgetProvider.js.map +1 -1
  37. package/lib/module/ui/components/Gradient.js +18 -2
  38. package/lib/module/ui/components/Gradient.js.map +1 -1
  39. package/lib/module/ui/components/RatingCard.js +341 -0
  40. package/lib/module/ui/components/RatingCard.js.map +1 -0
  41. package/lib/module/ui/hooks/use-top-inset.js +17 -0
  42. package/lib/module/ui/hooks/use-top-inset.js.map +1 -0
  43. package/lib/module/ui/screens/chat/ChatView.js +31 -3
  44. package/lib/module/ui/screens/chat/ChatView.js.map +1 -1
  45. package/lib/module/ui/screens/home/HomeView.js +44 -12
  46. package/lib/module/ui/screens/home/HomeView.js.map +1 -1
  47. package/lib/module/ui/screens/home/HomeView.styles.js +4 -2
  48. package/lib/module/ui/screens/home/HomeView.styles.js.map +1 -1
  49. package/lib/typescript/commonjs/api/client.d.ts +7 -1
  50. package/lib/typescript/commonjs/api/client.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/i18n.d.ts +13 -0
  52. package/lib/typescript/commonjs/i18n.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/locales.d.ts.map +1 -1
  54. package/lib/typescript/commonjs/state/widget-store.d.ts +18 -1
  55. package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/types.d.ts +17 -0
  57. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/ui/components/Gradient.d.ts.map +1 -1
  60. package/lib/typescript/commonjs/ui/components/RatingCard.d.ts +57 -0
  61. package/lib/typescript/commonjs/ui/components/RatingCard.d.ts.map +1 -0
  62. package/lib/typescript/commonjs/ui/hooks/use-top-inset.d.ts +11 -0
  63. package/lib/typescript/commonjs/ui/hooks/use-top-inset.d.ts.map +1 -0
  64. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts +1 -1
  65. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +11 -1
  67. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -1
  68. package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts +7 -0
  69. package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts +3 -1
  71. package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts.map +1 -1
  72. package/lib/typescript/module/api/client.d.ts +7 -1
  73. package/lib/typescript/module/api/client.d.ts.map +1 -1
  74. package/lib/typescript/module/i18n.d.ts +13 -0
  75. package/lib/typescript/module/i18n.d.ts.map +1 -1
  76. package/lib/typescript/module/locales.d.ts.map +1 -1
  77. package/lib/typescript/module/state/widget-store.d.ts +18 -1
  78. package/lib/typescript/module/state/widget-store.d.ts.map +1 -1
  79. package/lib/typescript/module/types.d.ts +17 -0
  80. package/lib/typescript/module/types.d.ts.map +1 -1
  81. package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -1
  82. package/lib/typescript/module/ui/components/Gradient.d.ts.map +1 -1
  83. package/lib/typescript/module/ui/components/RatingCard.d.ts +57 -0
  84. package/lib/typescript/module/ui/components/RatingCard.d.ts.map +1 -0
  85. package/lib/typescript/module/ui/hooks/use-top-inset.d.ts +11 -0
  86. package/lib/typescript/module/ui/hooks/use-top-inset.d.ts.map +1 -0
  87. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts +1 -1
  88. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -1
  89. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +11 -1
  90. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -1
  91. package/lib/typescript/module/ui/screens/home/HomeView.d.ts +7 -0
  92. package/lib/typescript/module/ui/screens/home/HomeView.d.ts.map +1 -1
  93. package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts +3 -1
  94. package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts.map +1 -1
  95. package/package.json +1 -1
  96. package/src/api/client.ts +13 -0
  97. package/src/i18n.ts +14 -0
  98. package/src/locales.ts +13 -0
  99. package/src/state/widget-store.ts +53 -4
  100. package/src/types.ts +19 -0
  101. package/src/ui/WidgetProvider.tsx +54 -4
  102. package/src/ui/components/Gradient.tsx +19 -2
  103. package/src/ui/components/RatingCard.tsx +355 -0
  104. package/src/ui/hooks/use-top-inset.ts +16 -0
  105. package/src/ui/screens/chat/ChatView.tsx +35 -2
  106. package/src/ui/screens/chat/ChatView.types.ts +11 -0
  107. package/src/ui/screens/home/HomeView.styles.ts +4 -2
  108. package/src/ui/screens/home/HomeView.tsx +36 -8
@@ -0,0 +1,347 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RatingCard = RatingCard;
7
+ exports.getRatingRequest = getRatingRequest;
8
+ exports.isBadRating = void 0;
9
+ exports.reasonLabel = reasonLabel;
10
+ var _react = require("react");
11
+ var _reactNative = require("react-native");
12
+ var _theme = require("../styles/theme.js");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ /**
15
+ * Conversation rating card (CSAT), posted two minutes after a teammate closes
16
+ * the chat. Port of `client/src/widget/components/RatingCard.tsx`.
17
+ *
18
+ * Tapping a face saves it right away; after 😠/🙁 the visitor can also tap a
19
+ * reason, labelled in their language. A comment locks the rating. The server enforces the change window and answers
20
+ * 409 (locked) or 410 (expired), which the card shows instead of the faces'
21
+ * actions.
22
+ */
23
+
24
+ /** 1..5, worst to best — Intercom's five faces. */const RATING_SCALE = [{
25
+ value: 1,
26
+ emoji: '😠'
27
+ }, {
28
+ value: 2,
29
+ emoji: '🙁'
30
+ }, {
31
+ value: 3,
32
+ emoji: '😐'
33
+ }, {
34
+ value: 4,
35
+ emoji: '🙂'
36
+ }, {
37
+ value: 5,
38
+ emoji: '🤩'
39
+ }];
40
+ /** 1–2 asks for a reason; 3 is neutral, 4–5 good. */
41
+ const isBadRating = rating => rating != null && rating <= 2;
42
+ exports.isBadRating = isBadRating;
43
+ const isRatingReason = value => !!value && typeof value === 'object' && typeof value.id === 'string' && !!value.labels && typeof value.labels === 'object';
44
+
45
+ /** The rating card carried by a system message's metadata, or null. */
46
+ function getRatingRequest(metadata) {
47
+ if (!metadata || metadata.event !== 'rating_request' || typeof metadata.ratingId !== 'string') return null;
48
+ const rating = typeof metadata.rating === 'number' && metadata.rating >= 1 && metadata.rating <= 5 ? metadata.rating : null;
49
+ const comment = typeof metadata.ratingComment === 'string' && metadata.ratingComment ? metadata.ratingComment : null;
50
+ const reason = typeof metadata.ratingReason === 'string' && metadata.ratingReason ? metadata.ratingReason : null;
51
+ const reasons = Array.isArray(metadata.ratingReasons) ? metadata.ratingReasons.filter(isRatingReason) : [];
52
+ return {
53
+ ratingId: metadata.ratingId,
54
+ rating,
55
+ comment,
56
+ reason,
57
+ reasons
58
+ };
59
+ }
60
+
61
+ /**
62
+ * A reason's label in the first of `locales` it has (full code, then its base
63
+ * language: "ar-SA" → "ar"), else English, else whatever it has.
64
+ */
65
+ function reasonLabel(reason, locales) {
66
+ for (const locale of [...locales, 'en']) {
67
+ if (!locale) continue;
68
+ const label = reason.labels[locale] || reason.labels[locale.split('-')[0]];
69
+ if (label) return label;
70
+ }
71
+ return Object.values(reason.labels).find(Boolean) ?? reason.id;
72
+ }
73
+ function RatingCard({
74
+ ratingId,
75
+ initialRating,
76
+ initialComment,
77
+ initialReason,
78
+ reasons,
79
+ locales,
80
+ color,
81
+ labels,
82
+ onRate
83
+ }) {
84
+ const [rating, setRating] = (0, _react.useState)(initialRating);
85
+ const [reason, setReason] = (0, _react.useState)(initialReason);
86
+ const [comment, setComment] = (0, _react.useState)(initialComment);
87
+ const [draft, setDraft] = (0, _react.useState)('');
88
+ const [pending, setPending] = (0, _react.useState)(false);
89
+ const [closedReason, setClosedReason] = (0, _react.useState)(initialComment ? 'locked' : null);
90
+ const [failed, setFailed] = (0, _react.useState)(false);
91
+ const interactive = !!onRate && !closedReason && !pending;
92
+ const canSubmit = !pending && draft.trim().length > 0;
93
+ const submit = async next => {
94
+ if (!onRate || pending) return;
95
+ setPending(true);
96
+ setFailed(false);
97
+ try {
98
+ const result = await onRate(ratingId, next);
99
+ setRating(result.rating);
100
+ setReason(result.reason ?? null);
101
+ setComment(result.comment);
102
+ if (result.locked) setClosedReason('locked');
103
+ setDraft('');
104
+ } catch (error) {
105
+ const status = error.status;
106
+ if (status === 409) setClosedReason('locked');else if (status === 410) setClosedReason('expired');else setFailed(true);
107
+ } finally {
108
+ setPending(false);
109
+ }
110
+ };
111
+ const status = closedReason === 'expired' ? labels.expired : closedReason === 'locked' && !comment ? labels.locked : failed ? labels.failed : rating != null ? labels.thanks : null;
112
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
113
+ style: styles.row,
114
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
115
+ style: styles.card,
116
+ testID: "repzo-rating-card",
117
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
118
+ style: styles.question,
119
+ children: labels.question
120
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
121
+ style: styles.faces,
122
+ accessibilityRole: "radiogroup",
123
+ children: RATING_SCALE.map((entry, index) => {
124
+ const selected = rating === entry.value;
125
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
126
+ accessibilityRole: "radio",
127
+ accessibilityLabel: labels.scale[index],
128
+ accessibilityState: {
129
+ checked: selected,
130
+ disabled: !interactive
131
+ },
132
+ disabled: !interactive,
133
+ hitSlop: 4,
134
+ onPress: () => {
135
+ if (!selected) void submit({
136
+ rating: entry.value
137
+ });
138
+ },
139
+ style: ({
140
+ pressed
141
+ }) => [styles.face, selected && {
142
+ borderColor: color,
143
+ backgroundColor: (0, _theme.withAlpha)(color, 0.08)
144
+ }, rating != null && !selected && styles.faceDimmed, pressed && styles.facePressed],
145
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
146
+ style: styles.emoji,
147
+ children: entry.emoji
148
+ })
149
+ }, entry.value);
150
+ })
151
+ }), status ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
152
+ style: [styles.status, failed && styles.statusFailed],
153
+ children: status
154
+ }) : null, isBadRating(rating) && reasons.length > 0 && (interactive || reason) ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
155
+ style: styles.reasons,
156
+ children: [interactive ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
157
+ style: styles.reasonPrompt,
158
+ children: labels.reasonPrompt
159
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
160
+ style: styles.chips,
161
+ accessibilityRole: "radiogroup",
162
+ accessibilityLabel: labels.reasonPrompt,
163
+ children: reasons.filter(item => interactive || item.id === reason).map(item => {
164
+ const selected = item.id === reason;
165
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
166
+ accessibilityRole: "radio",
167
+ accessibilityState: {
168
+ checked: selected,
169
+ disabled: !interactive
170
+ },
171
+ disabled: !interactive,
172
+ onPress: () => {
173
+ if (!selected && rating != null) void submit({
174
+ rating,
175
+ reason: item.id
176
+ });
177
+ },
178
+ style: ({
179
+ pressed
180
+ }) => [styles.chip, selected && {
181
+ backgroundColor: color,
182
+ borderColor: color
183
+ }, pressed && styles.facePressed],
184
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
185
+ style: [styles.chipText, selected && {
186
+ color: (0, _theme.contrastingTextColor)(color)
187
+ }],
188
+ children: reasonLabel(item, locales)
189
+ })
190
+ }, item.id);
191
+ })
192
+ })]
193
+ }) : null, comment ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
194
+ style: styles.comment,
195
+ children: comment
196
+ }) : rating != null && !closedReason ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
197
+ style: styles.form,
198
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
199
+ value: draft,
200
+ onChangeText: setDraft,
201
+ editable: !pending,
202
+ multiline: true,
203
+ maxLength: 2000,
204
+ placeholder: labels.commentPlaceholder,
205
+ placeholderTextColor: _theme.palette.textSubtle,
206
+ style: styles.input
207
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
208
+ accessibilityRole: "button",
209
+ disabled: !canSubmit,
210
+ onPress: () => {
211
+ const text = draft.trim();
212
+ if (text && rating != null) void submit({
213
+ rating,
214
+ comment: text
215
+ });
216
+ },
217
+ style: ({
218
+ pressed
219
+ }) => [styles.submit, {
220
+ backgroundColor: color
221
+ }, !canSubmit && styles.submitDisabled, pressed && canSubmit && styles.facePressed],
222
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
223
+ style: [styles.submitText, {
224
+ color: (0, _theme.contrastingTextColor)(color)
225
+ }],
226
+ children: labels.submit
227
+ })
228
+ })]
229
+ }) : null]
230
+ })
231
+ });
232
+ }
233
+ const styles = _reactNative.StyleSheet.create({
234
+ row: {
235
+ alignItems: 'center',
236
+ paddingVertical: _theme.spacing.md
237
+ },
238
+ card: {
239
+ width: '100%',
240
+ maxWidth: 340,
241
+ gap: _theme.spacing.md,
242
+ padding: _theme.spacing.lg,
243
+ borderRadius: _theme.radius.xl,
244
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
245
+ borderColor: _theme.palette.border,
246
+ backgroundColor: _theme.palette.white
247
+ },
248
+ question: {
249
+ textAlign: 'center',
250
+ color: _theme.palette.ink,
251
+ fontSize: _theme.fontSize.body,
252
+ fontWeight: '600'
253
+ },
254
+ faces: {
255
+ flexDirection: 'row',
256
+ justifyContent: 'center',
257
+ gap: _theme.spacing.sm
258
+ },
259
+ face: {
260
+ width: 48,
261
+ height: 48,
262
+ borderRadius: 24,
263
+ borderWidth: 2,
264
+ borderColor: 'transparent',
265
+ alignItems: 'center',
266
+ justifyContent: 'center'
267
+ },
268
+ faceDimmed: {
269
+ opacity: 0.45
270
+ },
271
+ facePressed: {
272
+ opacity: 0.7
273
+ },
274
+ emoji: {
275
+ fontSize: 28
276
+ },
277
+ status: {
278
+ textAlign: 'center',
279
+ color: _theme.palette.textMuted,
280
+ fontSize: _theme.fontSize.meta
281
+ },
282
+ statusFailed: {
283
+ color: _theme.palette.danger
284
+ },
285
+ reasons: {
286
+ gap: _theme.spacing.sm
287
+ },
288
+ reasonPrompt: {
289
+ color: _theme.palette.ink,
290
+ fontSize: _theme.fontSize.meta,
291
+ fontWeight: '600'
292
+ },
293
+ chips: {
294
+ flexDirection: 'row',
295
+ flexWrap: 'wrap',
296
+ gap: _theme.spacing.sm
297
+ },
298
+ chip: {
299
+ paddingHorizontal: _theme.spacing.md,
300
+ paddingVertical: _theme.spacing.sm,
301
+ borderRadius: _theme.radius.pill,
302
+ borderWidth: 1,
303
+ borderColor: _theme.palette.border,
304
+ backgroundColor: _theme.palette.white
305
+ },
306
+ chipText: {
307
+ color: _theme.palette.ink,
308
+ fontSize: _theme.fontSize.meta
309
+ },
310
+ comment: {
311
+ paddingHorizontal: _theme.spacing.md,
312
+ paddingVertical: _theme.spacing.sm,
313
+ borderRadius: _theme.radius.md,
314
+ backgroundColor: _theme.palette.surfaceAlt,
315
+ color: _theme.palette.ink,
316
+ fontSize: _theme.fontSize.meta,
317
+ writingDirection: 'auto'
318
+ },
319
+ form: {
320
+ gap: _theme.spacing.sm
321
+ },
322
+ input: {
323
+ minHeight: 64,
324
+ paddingHorizontal: _theme.spacing.md,
325
+ paddingVertical: _theme.spacing.sm,
326
+ borderRadius: _theme.radius.md,
327
+ borderWidth: 1,
328
+ borderColor: _theme.palette.border,
329
+ color: _theme.palette.ink,
330
+ fontSize: _theme.fontSize.input,
331
+ textAlignVertical: 'top'
332
+ },
333
+ submit: {
334
+ alignSelf: 'flex-end',
335
+ paddingHorizontal: _theme.spacing.lg,
336
+ paddingVertical: _theme.spacing.sm,
337
+ borderRadius: _theme.radius.pill
338
+ },
339
+ submitDisabled: {
340
+ opacity: 0.5
341
+ },
342
+ submitText: {
343
+ fontSize: _theme.fontSize.meta,
344
+ fontWeight: '600'
345
+ }
346
+ });
347
+ //# sourceMappingURL=RatingCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_theme","_jsxRuntime","RATING_SCALE","value","emoji","isBadRating","rating","exports","isRatingReason","id","labels","getRatingRequest","metadata","event","ratingId","comment","ratingComment","reason","ratingReason","reasons","Array","isArray","ratingReasons","filter","reasonLabel","locales","locale","label","split","Object","values","find","Boolean","RatingCard","initialRating","initialComment","initialReason","color","onRate","setRating","useState","setReason","setComment","draft","setDraft","pending","setPending","closedReason","setClosedReason","failed","setFailed","interactive","canSubmit","trim","length","submit","next","result","locked","error","status","expired","thanks","jsx","View","style","styles","row","children","jsxs","card","testID","Text","question","faces","accessibilityRole","map","entry","index","selected","Pressable","accessibilityLabel","scale","accessibilityState","checked","disabled","hitSlop","onPress","pressed","face","borderColor","backgroundColor","withAlpha","faceDimmed","facePressed","statusFailed","reasonPrompt","chips","item","chip","chipText","contrastingTextColor","form","TextInput","onChangeText","editable","multiline","maxLength","placeholder","commentPlaceholder","placeholderTextColor","palette","textSubtle","input","text","submitDisabled","submitText","StyleSheet","create","alignItems","paddingVertical","spacing","md","width","maxWidth","gap","padding","lg","borderRadius","radius","xl","borderWidth","hairlineWidth","border","white","textAlign","ink","fontSize","body","fontWeight","flexDirection","justifyContent","sm","height","opacity","textMuted","meta","danger","flexWrap","paddingHorizontal","pill","surfaceAlt","writingDirection","minHeight","textAlignVertical","alignSelf"],"sourceRoot":"../../../../src","sources":["ui/components/RatingCard.tsx"],"mappings":";;;;;;;;;AAUA,IAAAA,MAAA,GAAAC,OAAA;AACA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;IAC7BP,eAAe,EAAEC,cAAO,CAACqB,EAAE;IAC3Bd,YAAY,EAAEC,aAAM,CAACqB;EACvB,CAAC;EACDnC,cAAc,EAAE;IACd6B,OAAO,EAAE;EACX,CAAC;EACD5B,UAAU,EAAE;IACVqB,QAAQ,EAAEA,eAAQ,CAACS,IAAI;IACvBP,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TopInsetContext = void 0;
7
+ exports.useTopInset = useTopInset;
8
+ var _react = require("react");
9
+ /**
10
+ * How far a screen's header must reach up to sit under the status bar.
11
+ *
12
+ * The messenger draws edge to edge. Screens with a brand header (home, chat)
13
+ * extend that header's background into the status-bar area instead of leaving
14
+ * a white strip above it; the provider gives them the inset through this
15
+ * context and pads every other screen itself, so this is 0 for them.
16
+ */
17
+
18
+ const TopInsetContext = exports.TopInsetContext = /*#__PURE__*/(0, _react.createContext)(0);
19
+ function useTopInset() {
20
+ return (0, _react.useContext)(TopInsetContext);
21
+ }
22
+ //# sourceMappingURL=use-top-inset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","TopInsetContext","exports","createContext","useTopInset","useContext"],"sourceRoot":"../../../../src","sources":["ui/hooks/use-top-inset.ts"],"mappings":";;;;;;;AASA,IAAAA,MAAA,GAAAC,OAAA;AATA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,oBAAa,EAAC,CAAC,CAAC;AAExC,SAASC,WAAWA,CAAA,EAAW;EACpC,OAAO,IAAAC,iBAAU,EAACJ,eAAe,CAAC;AACpC","ignoreList":[]}
@@ -13,12 +13,14 @@ var _AttachmentChips = require("../../components/AttachmentChips.js");
13
13
  var _AttachmentMenu = require("../../components/AttachmentMenu.js");
14
14
  var _Avatar = require("../../components/Avatar.js");
15
15
  var _ImageViewer = require("../../components/ImageViewer.js");
16
+ var _RatingCard = require("../../components/RatingCard.js");
16
17
  var _ErrorBoundary = require("../../components/ErrorBoundary.js");
17
18
  var _Gradient = require("../../components/Gradient.js");
18
19
  var _icons = require("../../components/icons.js");
19
20
  var _TeamAvatars = require("../../components/TeamAvatars.js");
20
21
  var _Markdown = require("../../components/Markdown.js");
21
22
  var _useReduceMotion = require("../../hooks/use-reduce-motion.js");
23
+ var _useTopInset = require("../../hooks/use-top-inset.js");
22
24
  var _global = require("../../styles/global.js");
23
25
  var _theme = require("../../styles/theme.js");
24
26
  var _conversations = require("../../utils/conversations.js");
@@ -58,6 +60,8 @@ function ChatView({
58
60
  onPickAttachments,
59
61
  onSendMessage,
60
62
  onIdentifyVisitor,
63
+ onRateConversation,
64
+ defaultLocale,
61
65
  onLoadMore,
62
66
  onTyping,
63
67
  onBack,
@@ -266,6 +270,7 @@ function ChatView({
266
270
  const lastVisitorMessageId = [...messages].reverse().find(message => message.direction === 'inbound' && (message.messageType ?? 'message') === 'message')?.id;
267
271
  // Two stops off the brand color: flat fill looked like an unstyled block.
268
272
  // A non-hex brand color falls through mixHex unchanged and renders solid.
273
+ const topInset = (0, _useTopInset.useTopInset)();
269
274
  const headerGradient = [color, (0, _theme.mixHex)(color, '#000000', 0.16)];
270
275
  const headerControl = {
271
276
  backgroundColor: (0, _theme.withAlpha)(headerTextColor, 0.16)
@@ -276,7 +281,12 @@ function ChatView({
276
281
  colors: headerGradient,
277
282
  style: [_ChatViewStyles.styles.header, {
278
283
  borderBottomColor: (0, _theme.mixHex)(color, '#000000', 0.26)
279
- }],
284
+ },
285
+ // Reaches under the status bar so the brand colour runs to the top.
286
+ topInset > 0 ? {
287
+ paddingTop: _theme.spacing.md + topInset,
288
+ minHeight: 72 + topInset
289
+ } : null],
280
290
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
281
291
  onPress: onBack,
282
292
  accessibilityRole: "button",
@@ -432,6 +442,8 @@ function ChatView({
432
442
  color: color,
433
443
  labels: labels,
434
444
  onOpenImage: setViewerImage,
445
+ onRateConversation: onRateConversation,
446
+ locales: [locale, defaultLocale],
435
447
  senderLabel: isAgentMessage && (startsRun || startsDay) ? message.senderName || agentName || labels.team : null,
436
448
  timeLabel: (0, _conversations.formatClockTime)(message.createdAt, locale),
437
449
  receiptLabel: message.id === lastVisitorMessageId ? receiptLabel(message, labels) : undefined,
@@ -567,7 +579,9 @@ function MessageBubble({
567
579
  receiptLabel,
568
580
  onSubmitProcedureForm,
569
581
  onAgentUiAction,
570
- onOpenImage
582
+ onOpenImage,
583
+ onRateConversation,
584
+ locales
571
585
  }) {
572
586
  const joinedName = message.metadata?.event === 'agent_joined' ? message.metadata?.agentName : null;
573
587
  if (message.messageType === 'system' && typeof joinedName === 'string' && joinedName) {
@@ -587,6 +601,20 @@ function MessageBubble({
587
601
  })]
588
602
  });
589
603
  }
604
+ const ratingRequest = message.messageType === 'system' ? (0, _RatingCard.getRatingRequest)(message.metadata) : null;
605
+ if (ratingRequest) {
606
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RatingCard.RatingCard, {
607
+ ratingId: ratingRequest.ratingId,
608
+ initialRating: ratingRequest.rating,
609
+ initialComment: ratingRequest.comment,
610
+ initialReason: ratingRequest.reason,
611
+ reasons: ratingRequest.reasons,
612
+ locales: locales,
613
+ color: color,
614
+ labels: labels.rating,
615
+ onRate: onRateConversation ? (ratingId, data) => onRateConversation(message.id, ratingId, data) : undefined
616
+ });
617
+ }
590
618
  if (message.messageType === 'system') {
591
619
  const text = message.bodyPlain || (0, _html.stripHtml)(message.body || '') || labels.conversationUpdated;
592
620
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {