@repzo/widget-react-native 1.0.0 → 1.0.4

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 (153) hide show
  1. package/README.md +167 -74
  2. package/lib/commonjs/api/client.js +3 -1
  3. package/lib/commonjs/api/client.js.map +1 -1
  4. package/lib/commonjs/api/realtime.js +2 -0
  5. package/lib/commonjs/api/realtime.js.map +1 -1
  6. package/lib/commonjs/attachments/pickers.js +493 -0
  7. package/lib/commonjs/attachments/pickers.js.map +1 -0
  8. package/lib/commonjs/i18n.js +45 -0
  9. package/lib/commonjs/i18n.js.map +1 -1
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/locales.js +21 -0
  12. package/lib/commonjs/locales.js.map +1 -1
  13. package/lib/commonjs/state/widget-store.js +256 -18
  14. package/lib/commonjs/state/widget-store.js.map +1 -1
  15. package/lib/commonjs/types.js +16 -0
  16. package/lib/commonjs/types.js.map +1 -1
  17. package/lib/commonjs/ui/WidgetProvider.js +70 -10
  18. package/lib/commonjs/ui/WidgetProvider.js.map +1 -1
  19. package/lib/commonjs/ui/components/AttachmentChips.js +135 -0
  20. package/lib/commonjs/ui/components/AttachmentChips.js.map +1 -0
  21. package/lib/commonjs/ui/components/AttachmentMenu.js +125 -0
  22. package/lib/commonjs/ui/components/AttachmentMenu.js.map +1 -0
  23. package/lib/commonjs/ui/components/ImageViewer.js +181 -0
  24. package/lib/commonjs/ui/components/ImageViewer.js.map +1 -0
  25. package/lib/commonjs/ui/components/InAppNotification.js +210 -0
  26. package/lib/commonjs/ui/components/InAppNotification.js.map +1 -0
  27. package/lib/commonjs/ui/components/TeamAvatars.js +63 -0
  28. package/lib/commonjs/ui/components/TeamAvatars.js.map +1 -0
  29. package/lib/commonjs/ui/components/icons.js +50 -0
  30. package/lib/commonjs/ui/components/icons.js.map +1 -1
  31. package/lib/commonjs/ui/screens/chat/ChatView.js +303 -24
  32. package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -1
  33. package/lib/commonjs/ui/screens/chat/ChatView.styles.js +70 -0
  34. package/lib/commonjs/ui/screens/chat/ChatView.styles.js.map +1 -1
  35. package/lib/module/api/client.js +3 -1
  36. package/lib/module/api/client.js.map +1 -1
  37. package/lib/module/api/realtime.js +2 -0
  38. package/lib/module/api/realtime.js.map +1 -1
  39. package/lib/module/attachments/pickers.js +479 -0
  40. package/lib/module/attachments/pickers.js.map +1 -0
  41. package/lib/module/i18n.js +44 -0
  42. package/lib/module/i18n.js.map +1 -1
  43. package/lib/module/index.js.map +1 -1
  44. package/lib/module/locales.js +21 -0
  45. package/lib/module/locales.js.map +1 -1
  46. package/lib/module/state/widget-store.js +256 -18
  47. package/lib/module/state/widget-store.js.map +1 -1
  48. package/lib/module/types.js +16 -0
  49. package/lib/module/types.js.map +1 -1
  50. package/lib/module/ui/WidgetProvider.js +71 -11
  51. package/lib/module/ui/WidgetProvider.js.map +1 -1
  52. package/lib/module/ui/components/AttachmentChips.js +131 -0
  53. package/lib/module/ui/components/AttachmentChips.js.map +1 -0
  54. package/lib/module/ui/components/AttachmentMenu.js +120 -0
  55. package/lib/module/ui/components/AttachmentMenu.js.map +1 -0
  56. package/lib/module/ui/components/ImageViewer.js +177 -0
  57. package/lib/module/ui/components/ImageViewer.js.map +1 -0
  58. package/lib/module/ui/components/InAppNotification.js +208 -0
  59. package/lib/module/ui/components/InAppNotification.js.map +1 -0
  60. package/lib/module/ui/components/TeamAvatars.js +59 -0
  61. package/lib/module/ui/components/TeamAvatars.js.map +1 -0
  62. package/lib/module/ui/components/icons.js +49 -0
  63. package/lib/module/ui/components/icons.js.map +1 -1
  64. package/lib/module/ui/screens/chat/ChatView.js +306 -27
  65. package/lib/module/ui/screens/chat/ChatView.js.map +1 -1
  66. package/lib/module/ui/screens/chat/ChatView.styles.js +70 -0
  67. package/lib/module/ui/screens/chat/ChatView.styles.js.map +1 -1
  68. package/lib/typescript/commonjs/api/client.d.ts +8 -2
  69. package/lib/typescript/commonjs/api/client.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/api/realtime.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/attachments/pickers.d.ts +81 -0
  72. package/lib/typescript/commonjs/attachments/pickers.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/i18n.d.ts +23 -0
  74. package/lib/typescript/commonjs/i18n.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/index.d.ts +1 -1
  76. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/locales.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/state/widget-store.d.ts +40 -2
  79. package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/types.d.ts +88 -1
  81. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/ui/components/AttachmentChips.d.ts +16 -0
  84. package/lib/typescript/commonjs/ui/components/AttachmentChips.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/ui/components/AttachmentMenu.d.ts +28 -0
  86. package/lib/typescript/commonjs/ui/components/AttachmentMenu.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/ui/components/ImageViewer.d.ts +23 -0
  88. package/lib/typescript/commonjs/ui/components/ImageViewer.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/ui/components/InAppNotification.d.ts +28 -0
  90. package/lib/typescript/commonjs/ui/components/InAppNotification.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/ui/components/TeamAvatars.d.ts +17 -0
  92. package/lib/typescript/commonjs/ui/components/TeamAvatars.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/ui/components/icons.d.ts +2 -0
  94. package/lib/typescript/commonjs/ui/components/icons.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts +3 -2
  96. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -1
  97. package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts +69 -0
  98. package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +41 -2
  100. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -1
  101. package/lib/typescript/module/api/client.d.ts +8 -2
  102. package/lib/typescript/module/api/client.d.ts.map +1 -1
  103. package/lib/typescript/module/api/realtime.d.ts.map +1 -1
  104. package/lib/typescript/module/attachments/pickers.d.ts +81 -0
  105. package/lib/typescript/module/attachments/pickers.d.ts.map +1 -0
  106. package/lib/typescript/module/i18n.d.ts +23 -0
  107. package/lib/typescript/module/i18n.d.ts.map +1 -1
  108. package/lib/typescript/module/index.d.ts +1 -1
  109. package/lib/typescript/module/index.d.ts.map +1 -1
  110. package/lib/typescript/module/locales.d.ts.map +1 -1
  111. package/lib/typescript/module/state/widget-store.d.ts +40 -2
  112. package/lib/typescript/module/state/widget-store.d.ts.map +1 -1
  113. package/lib/typescript/module/types.d.ts +88 -1
  114. package/lib/typescript/module/types.d.ts.map +1 -1
  115. package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -1
  116. package/lib/typescript/module/ui/components/AttachmentChips.d.ts +16 -0
  117. package/lib/typescript/module/ui/components/AttachmentChips.d.ts.map +1 -0
  118. package/lib/typescript/module/ui/components/AttachmentMenu.d.ts +28 -0
  119. package/lib/typescript/module/ui/components/AttachmentMenu.d.ts.map +1 -0
  120. package/lib/typescript/module/ui/components/ImageViewer.d.ts +23 -0
  121. package/lib/typescript/module/ui/components/ImageViewer.d.ts.map +1 -0
  122. package/lib/typescript/module/ui/components/InAppNotification.d.ts +28 -0
  123. package/lib/typescript/module/ui/components/InAppNotification.d.ts.map +1 -0
  124. package/lib/typescript/module/ui/components/TeamAvatars.d.ts +17 -0
  125. package/lib/typescript/module/ui/components/TeamAvatars.d.ts.map +1 -0
  126. package/lib/typescript/module/ui/components/icons.d.ts +2 -0
  127. package/lib/typescript/module/ui/components/icons.d.ts.map +1 -1
  128. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts +3 -2
  129. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -1
  130. package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts +69 -0
  131. package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
  132. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +41 -2
  133. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -1
  134. package/metro.js +17 -32
  135. package/package.json +18 -1
  136. package/src/api/client.ts +5 -3
  137. package/src/api/realtime.ts +2 -0
  138. package/src/attachments/pickers.ts +515 -0
  139. package/src/i18n.ts +48 -0
  140. package/src/index.tsx +4 -0
  141. package/src/locales.ts +21 -0
  142. package/src/state/widget-store.ts +256 -19
  143. package/src/types.ts +95 -0
  144. package/src/ui/WidgetProvider.tsx +90 -9
  145. package/src/ui/components/AttachmentChips.tsx +135 -0
  146. package/src/ui/components/AttachmentMenu.tsx +132 -0
  147. package/src/ui/components/ImageViewer.tsx +178 -0
  148. package/src/ui/components/InAppNotification.tsx +225 -0
  149. package/src/ui/components/TeamAvatars.tsx +58 -0
  150. package/src/ui/components/icons.tsx +37 -0
  151. package/src/ui/screens/chat/ChatView.styles.ts +70 -0
  152. package/src/ui/screens/chat/ChatView.tsx +345 -35
  153. package/src/ui/screens/chat/ChatView.types.ts +51 -2
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Picked-but-unsent attachments above the composer: a thumbnail for images, a
3
+ * name + size card for everything else, each with its own remove button.
4
+ */
5
+ import { type DraftAttachment } from '../../attachments/pickers';
6
+ interface AttachmentChipsProps {
7
+ attachments: DraftAttachment[];
8
+ /** While a send is in flight the chips are dimmed and can't be removed. */
9
+ disabled?: boolean;
10
+ /** Keeps its `{name}` placeholder; filled per chip. */
11
+ removeLabel: string;
12
+ onRemove: (id: string) => void;
13
+ }
14
+ export declare function AttachmentChips({ attachments, disabled, removeLabel, onRemove, }: AttachmentChipsProps): import("react").JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=AttachmentChips.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttachmentChips.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/AttachmentChips.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AAMnC,UAAU,oBAAoB;IAC5B,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,QAAQ,EACR,WAAW,EACX,QAAQ,GACT,EAAE,oBAAoB,+BA0CtB"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The attach button's choice of source.
3
+ *
4
+ * iOS gets the native action sheet. Android has no equivalent (`Alert` caps at
5
+ * three buttons, and three sources plus Cancel is four), so it gets a small
6
+ * bottom sheet in its own transparent modal — which also lets the hardware
7
+ * back button close the sheet rather than the whole widget.
8
+ */
9
+ export interface AttachmentMenuOption<K extends string> {
10
+ key: K;
11
+ label: string;
12
+ }
13
+ /**
14
+ * iOS only: shows the native sheet and calls `onSelect` with the chosen key
15
+ * (nothing on cancel). Returns false elsewhere, so the caller shows
16
+ * `AttachmentMenu` instead.
17
+ */
18
+ export declare function showNativeAttachmentMenu<K extends string>(options: AttachmentMenuOption<K>[], cancelLabel: string, onSelect: (key: K) => void): boolean;
19
+ interface AttachmentMenuProps<K extends string> {
20
+ visible: boolean;
21
+ options: AttachmentMenuOption<K>[];
22
+ cancelLabel: string;
23
+ onSelect: (key: K) => void;
24
+ onClose: () => void;
25
+ }
26
+ export declare function AttachmentMenu<K extends string>({ visible, options, cancelLabel, onSelect, onClose, }: AttachmentMenuProps<K>): import("react").JSX.Element;
27
+ export {};
28
+ //# sourceMappingURL=AttachmentMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttachmentMenu.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/AttachmentMenu.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM;IACpD,GAAG,EAAE,CAAC,CAAC;IACP,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,EACvD,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAClC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,GACzB,OAAO,CAUT;AAED,UAAU,mBAAmB,CAAC,CAAC,SAAS,MAAM;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,EAC/C,OAAO,EACP,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,GACR,EAAE,mBAAmB,CAAC,CAAC,CAAC,+BAsCxB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Full-screen viewer for image attachments, so a tap on a photo the agent sent
3
+ * stays inside the messenger instead of bouncing to the browser. Pinch-to-zoom
4
+ * uses the native ScrollView zoom (iOS); Android shows the image fitted.
5
+ */
6
+ export interface ImageViewerLabels {
7
+ close: string;
8
+ loadFailed: string;
9
+ openExternally: string;
10
+ }
11
+ interface ImageViewerProps {
12
+ image: {
13
+ url: string;
14
+ name: string;
15
+ } | null;
16
+ labels: ImageViewerLabels;
17
+ onClose: () => void;
18
+ /** Escape hatch when the image can't render here (e.g. unsupported format). */
19
+ onOpenExternally: (url: string) => void;
20
+ }
21
+ export declare function ImageViewer({ image, labels, onClose, onOpenExternally }: ImageViewerProps): import("react").JSX.Element;
22
+ export {};
23
+ //# sourceMappingURL=ImageViewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageViewer.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ImageViewer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,gBAAgB;IACxB,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5C,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,+EAA+E;IAC/E,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,gBAAgB,+BAsEzF"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The card that floats over the host app when a team reply arrives while the
3
+ * messenger is closed — Intercom's in-app notification. It never times out:
4
+ * tapping it opens the conversation, swiping it left or right dismisses it
5
+ * (the thread stays unread). The store takes it down on its own once the
6
+ * messenger opens or the thread is read.
7
+ *
8
+ * Pure JS gestures (PanResponder), so hosts need no gesture library.
9
+ */
10
+ import type { InAppNotification as InAppNotificationData } from '../../types';
11
+ interface InAppNotificationProps {
12
+ notification: InAppNotificationData;
13
+ /** Brand color — the avatar's background when the agent has no photo. */
14
+ color: string;
15
+ bottomInset: number;
16
+ labels: {
17
+ replyFrom: string;
18
+ newReply: string;
19
+ attachment: string;
20
+ openHint: string;
21
+ dismiss: string;
22
+ };
23
+ onOpen: (conversationId: string) => void;
24
+ onDismiss: () => void;
25
+ }
26
+ export declare function InAppNotification({ notification, color, bottomInset, labels, onOpen, onDismiss, }: InAppNotificationProps): import("react").JSX.Element;
27
+ export {};
28
+ //# sourceMappingURL=InAppNotification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InAppNotification.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/InAppNotification.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAW9E,UAAU,sBAAsB;IAC9B,YAAY,EAAE,qBAAqB,CAAC;IACpC,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QACN,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,MAAM,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EACZ,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,SAAS,GACV,EAAE,sBAAsB,+BAiHxB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Up to three overlapping teammate avatars — the Messenger header when no
3
+ * teammate has joined yet, and the "Waiting for a teammate" row (Intercom-style).
4
+ * Falls back to a single placeholder avatar when the workspace sent none.
5
+ */
6
+ import type { TeamAvatar } from '../../types';
7
+ interface TeamAvatarsProps {
8
+ avatars: TeamAvatar[];
9
+ size?: number;
10
+ color?: string;
11
+ /** Ring between overlapping avatars; matches the surface behind them. */
12
+ ringColor?: string;
13
+ translucent?: boolean;
14
+ }
15
+ export declare function TeamAvatars({ avatars, size, color, ringColor, translucent, }: TeamAvatarsProps): import("react").JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=TeamAvatars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TeamAvatars.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/TeamAvatars.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,UAAU,gBAAgB;IACxB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,IAAS,EACT,KAAmB,EACnB,SAAyB,EACzB,WAAmB,GACpB,EAAE,gBAAgB,+BAyBlB"}
@@ -34,5 +34,7 @@ export declare function PersonIcon({ size, color, style }: IconProps): import("r
34
34
  /** Circle-with-bang used on the offline notice. */
35
35
  export declare function AlertIcon({ size, color, style }: IconProps): import("react").JSX.Element;
36
36
  export declare function PaperclipIcon({ size, color, style }: IconProps): import("react").JSX.Element;
37
+ /** A ring with two hands — the reply-time hint beside the team name. */
38
+ export declare function ClockIcon({ size, color, style }: IconProps): import("react").JSX.Element;
37
39
  export {};
38
40
  //# sourceMappingURL=icons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/icons.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;A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AK,EAAE,EAAE,SAAS,+BA6BnF;AAED,6DAA6D;AAC7D,wBAAgB,UAAU,CAAC,EAAE,IAAS,EAAE,KAAqB,EAAE,KAAK,EAAE,EAAE,SAAS,+BA8BhF;AAED,mDAAmD;AACnD,wBAAgB,SAAS,CAAC,EAAE,IAAS,EAAE,KAA2B,EAAE,KAAK,EAAE,EAAE,SAAS,+BA+BrF;AAED,wBAAgB,aAAa,CAAC,EAAE,IAAS,EAAE,KAAyB,EAAE,KAAK,EAAE,EAAE,SAAS,+BAgBvF;AASD,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,EAAE,IAAS,EAAE,KAAyB,EAAE,KAAK,EAAE,EAAE,SAAS,+BAkCnF"}
@@ -4,8 +4,9 @@
4
4
  *
5
5
  * Mobile differences: older messages load through an explicit "Load earlier
6
6
  * messages" control (a scroll-anchored infinite list fights the keyboard), and
7
- * the composer hides the attach button because v1 has no picker.
7
+ * the attach button only shows when the host app has a picker to open (see
8
+ * `attachments/pickers.ts`).
8
9
  */
9
10
  import type { ChatViewProps } from './ChatView.types';
10
- export declare function ChatView({ messages, loading, hasMoreMessages, agentTyping, color, agentName, agentAvatar, isOnline, locale, prefillText, offlineMessage, labels, onSendMessage, onIdentifyVisitor, onLoadMore, onTyping, onBack, onClose, }: ChatViewProps): import("react").JSX.Element;
11
+ export declare function ChatView({ messages, loading, hasMoreMessages, agentTyping, color, agentName, agentAvatar, agentOnline, isOnline, teamName, teamAvatars, replyTimeLabel, locale, prefillText, offlineMessage, labels, attachmentSources, onPickAttachments, onSendMessage, onIdentifyVisitor, onLoadMore, onTyping, onBack, onClose, }: ChatViewProps): import("react").JSX.Element;
11
12
  //# sourceMappingURL=ChatView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatView.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/chat/ChatView.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAmCH,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAElE,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,WAAW,EACX,cAAc,EACd,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,GACR,EAAE,aAAa,+BAmTf"}
1
+ {"version":3,"file":"ChatView.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/chat/ChatView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoDH,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAElE,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,WAAgB,EAChB,cAAc,EACd,MAAM,EACN,WAAW,EACX,cAAc,EACd,MAAM,EACN,iBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,GACR,EAAE,aAAa,+BAwhBf"}
@@ -44,6 +44,36 @@ export declare const styles: {
44
44
  fontSize: 12;
45
45
  marginTop: number;
46
46
  };
47
+ headerReplyTime: {
48
+ flexDirection: "row";
49
+ alignItems: "center";
50
+ gap: number;
51
+ marginTop: number;
52
+ };
53
+ headerReplyTimeText: {
54
+ flexShrink: number;
55
+ marginTop: number;
56
+ };
57
+ waitingRow: {
58
+ flexDirection: "row";
59
+ alignItems: "center";
60
+ justifyContent: "center";
61
+ gap: 8;
62
+ paddingVertical: 8;
63
+ };
64
+ waitingText: {
65
+ color: "#6b7280";
66
+ fontSize: 12;
67
+ };
68
+ joinedRow: {
69
+ flexDirection: "row";
70
+ justifyContent: "center";
71
+ gap: 4;
72
+ };
73
+ joinedName: {
74
+ fontWeight: "700";
75
+ color: "#1a1a1a";
76
+ };
47
77
  messagesContentEmpty: {
48
78
  flexGrow: number;
49
79
  justifyContent: "center";
@@ -102,6 +132,13 @@ export declare const styles: {
102
132
  marginBottom: number;
103
133
  marginStart: 4;
104
134
  };
135
+ receiptText: {
136
+ alignSelf: "flex-end";
137
+ marginTop: number;
138
+ marginEnd: 4;
139
+ fontSize: number;
140
+ color: "#9ca3af";
141
+ };
105
142
  messageTime: {
106
143
  fontSize: number;
107
144
  alignSelf: "flex-end";
@@ -183,6 +220,20 @@ export declare const styles: {
183
220
  fontSize: 12;
184
221
  marginTop: 4;
185
222
  };
223
+ deletedBubble: {
224
+ maxWidth: "80%";
225
+ paddingHorizontal: 12;
226
+ paddingVertical: 8;
227
+ borderRadius: number;
228
+ borderWidth: number;
229
+ borderStyle: "dashed";
230
+ borderColor: "#e5e7eb";
231
+ };
232
+ deletedText: {
233
+ color: "#6b7280";
234
+ fontSize: 12;
235
+ fontStyle: "italic";
236
+ };
186
237
  systemRow: {
187
238
  alignItems: "center";
188
239
  paddingVertical: 8;
@@ -252,9 +303,27 @@ export declare const styles: {
252
303
  paddingRight: number;
253
304
  paddingVertical: number;
254
305
  };
306
+ composerWithAttach: {
307
+ paddingLeft: number;
308
+ };
255
309
  composerFocused: {
256
310
  backgroundColor: "#ffffff";
257
311
  };
312
+ attachButton: {
313
+ width: number;
314
+ height: number;
315
+ borderRadius: number;
316
+ alignItems: "center";
317
+ justifyContent: "center";
318
+ };
319
+ composerNotice: {
320
+ textAlign: "left" | "right";
321
+ fontSize: 12;
322
+ lineHeight: number;
323
+ color: "#ef4444";
324
+ marginBottom: 8;
325
+ paddingHorizontal: 4;
326
+ };
258
327
  input: {
259
328
  textAlign: "left" | "right";
260
329
  flex: number;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatView.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/chat/ChatView.styles.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAOlF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6VjB,CAAC"}
1
+ {"version":3,"file":"ChatView.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/chat/ChatView.styles.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAOlF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmajB,CAAC"}
@@ -1,6 +1,9 @@
1
+ import type { TeamAvatar } from '../../../types';
1
2
  /** Props and label bundle for the chat thread. */
2
- import type { AgentUiAction, Message, WidgetAttachment } from '../../../types';
3
+ import type { DraftAttachment, PickResult } from '../../../attachments/pickers';
4
+ import type { AgentUiAction, AttachmentSource, Message, OutgoingAttachment } from '../../../types';
3
5
  import type { AgentUiBlockLabels } from '../../components/AgentUiBlocks';
6
+ import type { ImageViewerLabels } from '../../components/ImageViewer';
4
7
  export interface ChatLabels {
5
8
  back: string;
6
9
  loading: string;
@@ -16,9 +19,30 @@ export interface ChatLabels {
16
19
  today: string;
17
20
  yesterday: string;
18
21
  conversationUpdated: string;
22
+ messageDeleted: string;
23
+ messageSent: string;
24
+ messageSeen: string;
25
+ waitingForTeammate: string;
26
+ joinedConversation: string;
19
27
  procedureSend: string;
20
28
  procedureSent: string;
21
29
  blocks: AgentUiBlockLabels;
30
+ attach: AttachLabels;
31
+ viewer: ImageViewerLabels;
32
+ }
33
+ /** Composer attachment copy. Limits are already filled in; `remove` keeps `{name}`. */
34
+ export interface AttachLabels {
35
+ button: string;
36
+ photoLibrary: string;
37
+ takePhoto: string;
38
+ file: string;
39
+ cancel: string;
40
+ remove: string;
41
+ tooLarge: string;
42
+ tooMany: string;
43
+ tooLargeTogether: string;
44
+ failed: string;
45
+ cameraDenied: string;
22
46
  }
23
47
  export interface ChatViewProps {
24
48
  messages: Message[];
@@ -29,12 +53,27 @@ export interface ChatViewProps {
29
53
  /** Whoever is handling this thread, once the backend assigns someone. */
30
54
  agentName?: string | null;
31
55
  agentAvatar?: string | null;
56
+ /** The assigned teammate's own presence; falls back to `isOnline` when absent. */
57
+ agentOnline?: boolean | null;
32
58
  isOnline: boolean;
59
+ /** Header title with no teammate yet (or after close); falls back to the Team label. */
60
+ teamName?: string | null;
61
+ teamAvatars?: TeamAvatar[];
62
+ /** e.g. "We usually reply within a few minutes", under the team name. */
63
+ replyTimeLabel?: string;
33
64
  prefillText?: string;
34
65
  offlineMessage?: string;
35
66
  locale: string;
36
67
  labels: ChatLabels;
37
- onSendMessage: (body: string, attachments?: WidgetAttachment[], action?: AgentUiAction) => void;
68
+ /**
69
+ * Menu options for the attach button, in order. Empty (or absent) hides the
70
+ * button — attachments are off, or no picker is installed.
71
+ */
72
+ attachmentSources?: AttachmentSource[];
73
+ /** Opens a picker and returns what fits beside `current`. Never rejects. */
74
+ onPickAttachments?: (source: AttachmentSource, current: DraftAttachment[]) => Promise<PickResult>;
75
+ /** Rejects when the send fails, so the composer can keep its attachments. */
76
+ onSendMessage: (body: string, attachments?: OutgoingAttachment[], action?: AgentUiAction) => Promise<void>;
38
77
  onIdentifyVisitor?: (data: {
39
78
  email?: string;
40
79
  name?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatView.types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/chat/ChatView.types.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,C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CAAC;IACvB,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB"}
package/metro.js CHANGED
@@ -1,38 +1,23 @@
1
- const path = require('node:path');
2
-
3
- const optionalModules = new Set([
4
- '@react-native-async-storage/async-storage',
5
- '@react-native-firebase/messaging',
6
- 'react-native-linear-gradient',
7
- 'react-native-safe-area-context',
8
- ]);
9
-
10
- /** Keep installed integrations; map missing widget-only imports to Metro's empty module. */
1
+ /**
2
+ * Every optional integration (async-storage, Firebase messaging, gradients,
3
+ * safe-area insets, the Expo attachment pickers) is loaded with a `require()`
4
+ * inside a `try` block. With Metro's `allowOptionalDependencies` on, a missing
5
+ * one bundles as a require that throws at runtime, which that `try` catches.
6
+ *
7
+ * The React Native and Expo default configs already turn it on, so most apps
8
+ * need no Metro change at all. This helper only guarantees it for configs
9
+ * built from bare `metro-config` defaults.
10
+ *
11
+ * It deliberately does not install a custom `resolveRequest`: substituting
12
+ * Metro's empty module for missing imports broke Expo development bundles at
13
+ * startup ("Property 'MessageQueue' doesn't exist").
14
+ */
11
15
  function withRepzoWidget(config) {
12
- const previousResolver = config.resolver?.resolveRequest;
13
16
  return {
14
17
  ...config,
15
- resolver: {
16
- ...config.resolver,
17
- resolveRequest(context, moduleName, platform) {
18
- const resolve = previousResolver ?? context.resolveRequest;
19
- try {
20
- return resolve(context, moduleName, platform);
21
- } catch (error) {
22
- const relative = path.relative(__dirname, context.originModulePath);
23
- const fromWidget = /^(src|lib)[/\\]/.test(relative);
24
- // Do not mask invalid package entry points, missing transitive
25
- // dependencies, or imports owned by the host app.
26
- if (
27
- fromWidget &&
28
- optionalModules.has(moduleName) &&
29
- error?.constructor?.name === 'FailedToResolveNameError'
30
- ) {
31
- return { type: 'empty' };
32
- }
33
- throw error;
34
- }
35
- },
18
+ transformer: {
19
+ ...config.transformer,
20
+ allowOptionalDependencies: true,
36
21
  },
37
22
  };
38
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repzo/widget-react-native",
3
- "version": "1.0.0",
3
+ "version": "1.0.4",
4
4
  "description": "Repzo chat widget for React Native \u2014 pure JavaScript, no native modules",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -51,6 +51,10 @@
51
51
  "peerDependencies": {
52
52
  "@react-native-async-storage/async-storage": "*",
53
53
  "@react-native-firebase/messaging": "*",
54
+ "expo-document-picker": "*",
55
+ "expo-file-system": "*",
56
+ "expo-image-manipulator": "*",
57
+ "expo-image-picker": "*",
54
58
  "react": "*",
55
59
  "react-native": "*",
56
60
  "react-native-linear-gradient": "*",
@@ -63,6 +67,18 @@
63
67
  "@react-native-firebase/messaging": {
64
68
  "optional": true
65
69
  },
70
+ "expo-document-picker": {
71
+ "optional": true
72
+ },
73
+ "expo-file-system": {
74
+ "optional": true
75
+ },
76
+ "expo-image-manipulator": {
77
+ "optional": true
78
+ },
79
+ "expo-image-picker": {
80
+ "optional": true
81
+ },
66
82
  "react-native-linear-gradient": {
67
83
  "optional": true
68
84
  },
@@ -78,6 +94,7 @@
78
94
  "react": "19.2.0",
79
95
  "react-native": "0.83.6",
80
96
  "react-native-builder-bob": "^0.40.13",
97
+ "react-test-renderer": "19.2.0",
81
98
  "typescript": "^5.9.2",
82
99
  "metro": "^0.83.8",
83
100
  "metro-config": "^0.83.8"
package/src/api/client.ts CHANGED
@@ -16,7 +16,6 @@ import type {
16
16
  Message,
17
17
  OutboundMessage,
18
18
  RepzoWidgetErrorCode,
19
- WidgetAttachment,
20
19
  WidgetConfig,
21
20
  WidgetUser,
22
21
  } from '../types';
@@ -249,7 +248,8 @@ export class WidgetApiClient {
249
248
  conversationId?: string;
250
249
  forceNewConversation?: boolean;
251
250
  body: string;
252
- attachments?: WidgetAttachment[];
251
+ /** `url` is a base64 data URL; max 5, each <= 1.5 MB decoded. */
252
+ attachments?: Array<{ name: string; url: string; contentType: string; size: number }>;
253
253
  visitorName?: string;
254
254
  visitorEmail?: string;
255
255
  agentUiAction?: AgentUiAction;
@@ -265,7 +265,9 @@ export class WidgetApiClient {
265
265
  conversationId: string,
266
266
  cursor?: string | null
267
267
  ): Promise<{ data: Message[]; meta: { hasMore: boolean; nextCursor: string | null } }> {
268
- const query = cursor ? `?cursor=${encodeURIComponent(cursor)}` : '';
268
+ // includeDeleted: get a content-free placeholder where a teammate deleted a
269
+ // message, so the thread can show "This message was deleted".
270
+ const query = `?includeDeleted=1${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ''}`;
269
271
  return this.request(
270
272
  `/api/widget/conversations/${encodeURIComponent(conversationId)}/messages${query}`
271
273
  );
@@ -17,6 +17,8 @@ import { SseParser } from './sse-parser';
17
17
  const SERVER_EVENTS = {
18
18
  connected: 'connected',
19
19
  'widget.message.new': 'message.new',
20
+ 'widget.message.deleted': 'message.deleted',
21
+ 'widget.message.status': 'message.status',
20
22
  'widget.typing.start': 'typing.start',
21
23
  'widget.typing.stop': 'typing.stop',
22
24
  'widget.conversation.updated': 'conversation.updated',