@repzo/widget-react-native 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/README.md +72 -16
  3. package/lib/commonjs/api/client.js +113 -0
  4. package/lib/commonjs/api/client.js.map +1 -1
  5. package/lib/commonjs/attachments/file-size.js +52 -0
  6. package/lib/commonjs/attachments/file-size.js.map +1 -0
  7. package/lib/commonjs/attachments/local-previews.js +40 -0
  8. package/lib/commonjs/attachments/local-previews.js.map +1 -0
  9. package/lib/commonjs/attachments/pickers.js +76 -28
  10. package/lib/commonjs/attachments/pickers.js.map +1 -1
  11. package/lib/commonjs/i18n.js +24 -3
  12. package/lib/commonjs/i18n.js.map +1 -1
  13. package/lib/commonjs/locales.js +13 -3
  14. package/lib/commonjs/locales.js.map +1 -1
  15. package/lib/commonjs/state/widget-store.js +486 -63
  16. package/lib/commonjs/state/widget-store.js.map +1 -1
  17. package/lib/commonjs/storage.js +3 -1
  18. package/lib/commonjs/storage.js.map +1 -1
  19. package/lib/commonjs/types.js.map +1 -1
  20. package/lib/commonjs/ui/WidgetProvider.js +40 -16
  21. package/lib/commonjs/ui/WidgetProvider.js.map +1 -1
  22. package/lib/commonjs/ui/components/AttachmentChips.js +109 -40
  23. package/lib/commonjs/ui/components/AttachmentChips.js.map +1 -1
  24. package/lib/commonjs/ui/components/ConversationRow.js +65 -10
  25. package/lib/commonjs/ui/components/ConversationRow.js.map +1 -1
  26. package/lib/commonjs/ui/components/ImageViewer.js +231 -25
  27. package/lib/commonjs/ui/components/ImageViewer.js.map +1 -1
  28. package/lib/commonjs/ui/components/RatingCard.js +5 -2
  29. package/lib/commonjs/ui/components/RatingCard.js.map +1 -1
  30. package/lib/commonjs/ui/components/ZoomableImage.js +58 -10
  31. package/lib/commonjs/ui/components/ZoomableImage.js.map +1 -1
  32. package/lib/commonjs/ui/components/icons.js +22 -16
  33. package/lib/commonjs/ui/components/icons.js.map +1 -1
  34. package/lib/commonjs/ui/hooks/use-retained-state.js +39 -0
  35. package/lib/commonjs/ui/hooks/use-retained-state.js.map +1 -0
  36. package/lib/commonjs/ui/screens/chat/ChatView.js +666 -171
  37. package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -1
  38. package/lib/commonjs/ui/screens/chat/ChatView.styles.js +150 -3
  39. package/lib/commonjs/ui/screens/chat/ChatView.styles.js.map +1 -1
  40. package/lib/commonjs/ui/screens/conversations/ConversationsList.js +1 -0
  41. package/lib/commonjs/ui/screens/conversations/ConversationsList.js.map +1 -1
  42. package/lib/commonjs/ui/screens/home/HomeView.js +38 -55
  43. package/lib/commonjs/ui/screens/home/HomeView.js.map +1 -1
  44. package/lib/commonjs/ui/screens/home/HomeView.styles.js +36 -45
  45. package/lib/commonjs/ui/screens/home/HomeView.styles.js.map +1 -1
  46. package/lib/commonjs/ui/styles/theme.js +1 -0
  47. package/lib/commonjs/ui/styles/theme.js.map +1 -1
  48. package/lib/commonjs/ui/utils/conversations.js +17 -1
  49. package/lib/commonjs/ui/utils/conversations.js.map +1 -1
  50. package/lib/commonjs/ui/utils/html.js +13 -0
  51. package/lib/commonjs/ui/utils/html.js.map +1 -1
  52. package/lib/commonjs/ui/utils/image-load-queue.js +114 -0
  53. package/lib/commonjs/ui/utils/image-load-queue.js.map +1 -0
  54. package/lib/commonjs/ui/utils/inline-attachments.js +88 -0
  55. package/lib/commonjs/ui/utils/inline-attachments.js.map +1 -0
  56. package/lib/module/api/client.js +113 -0
  57. package/lib/module/api/client.js.map +1 -1
  58. package/lib/module/attachments/file-size.js +47 -0
  59. package/lib/module/attachments/file-size.js.map +1 -0
  60. package/lib/module/attachments/local-previews.js +33 -0
  61. package/lib/module/attachments/local-previews.js.map +1 -0
  62. package/lib/module/attachments/pickers.js +74 -27
  63. package/lib/module/attachments/pickers.js.map +1 -1
  64. package/lib/module/i18n.js +24 -3
  65. package/lib/module/i18n.js.map +1 -1
  66. package/lib/module/locales.js +13 -3
  67. package/lib/module/locales.js.map +1 -1
  68. package/lib/module/state/widget-store.js +488 -65
  69. package/lib/module/state/widget-store.js.map +1 -1
  70. package/lib/module/storage.js +2 -0
  71. package/lib/module/storage.js.map +1 -1
  72. package/lib/module/types.js.map +1 -1
  73. package/lib/module/ui/WidgetProvider.js +40 -16
  74. package/lib/module/ui/WidgetProvider.js.map +1 -1
  75. package/lib/module/ui/components/AttachmentChips.js +111 -42
  76. package/lib/module/ui/components/AttachmentChips.js.map +1 -1
  77. package/lib/module/ui/components/ConversationRow.js +65 -10
  78. package/lib/module/ui/components/ConversationRow.js.map +1 -1
  79. package/lib/module/ui/components/ImageViewer.js +233 -27
  80. package/lib/module/ui/components/ImageViewer.js.map +1 -1
  81. package/lib/module/ui/components/RatingCard.js +5 -2
  82. package/lib/module/ui/components/RatingCard.js.map +1 -1
  83. package/lib/module/ui/components/ZoomableImage.js +58 -10
  84. package/lib/module/ui/components/ZoomableImage.js.map +1 -1
  85. package/lib/module/ui/components/icons.js +21 -15
  86. package/lib/module/ui/components/icons.js.map +1 -1
  87. package/lib/module/ui/hooks/use-retained-state.js +34 -0
  88. package/lib/module/ui/hooks/use-retained-state.js.map +1 -0
  89. package/lib/module/ui/screens/chat/ChatView.js +672 -177
  90. package/lib/module/ui/screens/chat/ChatView.js.map +1 -1
  91. package/lib/module/ui/screens/chat/ChatView.styles.js +152 -4
  92. package/lib/module/ui/screens/chat/ChatView.styles.js.map +1 -1
  93. package/lib/module/ui/screens/conversations/ConversationsList.js +1 -0
  94. package/lib/module/ui/screens/conversations/ConversationsList.js.map +1 -1
  95. package/lib/module/ui/screens/home/HomeView.js +40 -57
  96. package/lib/module/ui/screens/home/HomeView.js.map +1 -1
  97. package/lib/module/ui/screens/home/HomeView.styles.js +36 -45
  98. package/lib/module/ui/screens/home/HomeView.styles.js.map +1 -1
  99. package/lib/module/ui/styles/theme.js +1 -0
  100. package/lib/module/ui/styles/theme.js.map +1 -1
  101. package/lib/module/ui/utils/conversations.js +15 -1
  102. package/lib/module/ui/utils/conversations.js.map +1 -1
  103. package/lib/module/ui/utils/html.js +12 -0
  104. package/lib/module/ui/utils/html.js.map +1 -1
  105. package/lib/module/ui/utils/image-load-queue.js +109 -0
  106. package/lib/module/ui/utils/image-load-queue.js.map +1 -0
  107. package/lib/module/ui/utils/inline-attachments.js +85 -0
  108. package/lib/module/ui/utils/inline-attachments.js.map +1 -0
  109. package/lib/typescript/commonjs/api/client.d.ts +35 -1
  110. package/lib/typescript/commonjs/api/client.d.ts.map +1 -1
  111. package/lib/typescript/commonjs/attachments/file-size.d.ts +15 -0
  112. package/lib/typescript/commonjs/attachments/file-size.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/attachments/local-previews.d.ts +14 -0
  114. package/lib/typescript/commonjs/attachments/local-previews.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/attachments/pickers.d.ts +35 -10
  116. package/lib/typescript/commonjs/attachments/pickers.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/i18n.d.ts +13 -3
  118. package/lib/typescript/commonjs/i18n.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/locales.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/state/widget-store.d.ts +67 -4
  121. package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/storage.d.ts +2 -0
  123. package/lib/typescript/commonjs/storage.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/types.d.ts +58 -0
  125. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  126. package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/ui/components/AttachmentChips.d.ts +13 -3
  128. package/lib/typescript/commonjs/ui/components/AttachmentChips.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/ui/components/ConversationRow.d.ts +15 -1
  130. package/lib/typescript/commonjs/ui/components/ConversationRow.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/ui/components/ImageViewer.d.ts +26 -6
  132. package/lib/typescript/commonjs/ui/components/ImageViewer.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/ui/components/RatingCard.d.ts.map +1 -1
  134. package/lib/typescript/commonjs/ui/components/ZoomableImage.d.ts +10 -1
  135. package/lib/typescript/commonjs/ui/components/ZoomableImage.d.ts.map +1 -1
  136. package/lib/typescript/commonjs/ui/components/icons.d.ts +2 -1
  137. package/lib/typescript/commonjs/ui/components/icons.d.ts.map +1 -1
  138. package/lib/typescript/commonjs/ui/hooks/use-retained-state.d.ts +11 -0
  139. package/lib/typescript/commonjs/ui/hooks/use-retained-state.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts +4 -4
  141. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts +154 -2
  143. package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +30 -1
  145. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.types.d.ts +2 -0
  148. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.types.d.ts.map +1 -1
  149. package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts +7 -5
  150. package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts +30 -35
  152. package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts.map +1 -1
  153. package/lib/typescript/commonjs/ui/screens/home/HomeView.types.d.ts +5 -6
  154. package/lib/typescript/commonjs/ui/screens/home/HomeView.types.d.ts.map +1 -1
  155. package/lib/typescript/commonjs/ui/styles/theme.d.ts +2 -0
  156. package/lib/typescript/commonjs/ui/styles/theme.d.ts.map +1 -1
  157. package/lib/typescript/commonjs/ui/utils/conversations.d.ts +10 -2
  158. package/lib/typescript/commonjs/ui/utils/conversations.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/ui/utils/html.d.ts +5 -0
  160. package/lib/typescript/commonjs/ui/utils/html.d.ts.map +1 -1
  161. package/lib/typescript/commonjs/ui/utils/image-load-queue.d.ts +44 -0
  162. package/lib/typescript/commonjs/ui/utils/image-load-queue.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/ui/utils/inline-attachments.d.ts +29 -0
  164. package/lib/typescript/commonjs/ui/utils/inline-attachments.d.ts.map +1 -0
  165. package/lib/typescript/module/api/client.d.ts +35 -1
  166. package/lib/typescript/module/api/client.d.ts.map +1 -1
  167. package/lib/typescript/module/attachments/file-size.d.ts +15 -0
  168. package/lib/typescript/module/attachments/file-size.d.ts.map +1 -0
  169. package/lib/typescript/module/attachments/local-previews.d.ts +14 -0
  170. package/lib/typescript/module/attachments/local-previews.d.ts.map +1 -0
  171. package/lib/typescript/module/attachments/pickers.d.ts +35 -10
  172. package/lib/typescript/module/attachments/pickers.d.ts.map +1 -1
  173. package/lib/typescript/module/i18n.d.ts +13 -3
  174. package/lib/typescript/module/i18n.d.ts.map +1 -1
  175. package/lib/typescript/module/locales.d.ts.map +1 -1
  176. package/lib/typescript/module/state/widget-store.d.ts +67 -4
  177. package/lib/typescript/module/state/widget-store.d.ts.map +1 -1
  178. package/lib/typescript/module/storage.d.ts +2 -0
  179. package/lib/typescript/module/storage.d.ts.map +1 -1
  180. package/lib/typescript/module/types.d.ts +58 -0
  181. package/lib/typescript/module/types.d.ts.map +1 -1
  182. package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -1
  183. package/lib/typescript/module/ui/components/AttachmentChips.d.ts +13 -3
  184. package/lib/typescript/module/ui/components/AttachmentChips.d.ts.map +1 -1
  185. package/lib/typescript/module/ui/components/ConversationRow.d.ts +15 -1
  186. package/lib/typescript/module/ui/components/ConversationRow.d.ts.map +1 -1
  187. package/lib/typescript/module/ui/components/ImageViewer.d.ts +26 -6
  188. package/lib/typescript/module/ui/components/ImageViewer.d.ts.map +1 -1
  189. package/lib/typescript/module/ui/components/RatingCard.d.ts.map +1 -1
  190. package/lib/typescript/module/ui/components/ZoomableImage.d.ts +10 -1
  191. package/lib/typescript/module/ui/components/ZoomableImage.d.ts.map +1 -1
  192. package/lib/typescript/module/ui/components/icons.d.ts +2 -1
  193. package/lib/typescript/module/ui/components/icons.d.ts.map +1 -1
  194. package/lib/typescript/module/ui/hooks/use-retained-state.d.ts +11 -0
  195. package/lib/typescript/module/ui/hooks/use-retained-state.d.ts.map +1 -0
  196. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts +4 -4
  197. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -1
  198. package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts +154 -2
  199. package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
  200. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +30 -1
  201. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -1
  202. package/lib/typescript/module/ui/screens/conversations/ConversationsList.d.ts.map +1 -1
  203. package/lib/typescript/module/ui/screens/conversations/ConversationsList.types.d.ts +2 -0
  204. package/lib/typescript/module/ui/screens/conversations/ConversationsList.types.d.ts.map +1 -1
  205. package/lib/typescript/module/ui/screens/home/HomeView.d.ts +7 -5
  206. package/lib/typescript/module/ui/screens/home/HomeView.d.ts.map +1 -1
  207. package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts +30 -35
  208. package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts.map +1 -1
  209. package/lib/typescript/module/ui/screens/home/HomeView.types.d.ts +5 -6
  210. package/lib/typescript/module/ui/screens/home/HomeView.types.d.ts.map +1 -1
  211. package/lib/typescript/module/ui/styles/theme.d.ts +2 -0
  212. package/lib/typescript/module/ui/styles/theme.d.ts.map +1 -1
  213. package/lib/typescript/module/ui/utils/conversations.d.ts +10 -2
  214. package/lib/typescript/module/ui/utils/conversations.d.ts.map +1 -1
  215. package/lib/typescript/module/ui/utils/html.d.ts +5 -0
  216. package/lib/typescript/module/ui/utils/html.d.ts.map +1 -1
  217. package/lib/typescript/module/ui/utils/image-load-queue.d.ts +44 -0
  218. package/lib/typescript/module/ui/utils/image-load-queue.d.ts.map +1 -0
  219. package/lib/typescript/module/ui/utils/inline-attachments.d.ts +29 -0
  220. package/lib/typescript/module/ui/utils/inline-attachments.d.ts.map +1 -0
  221. package/package.json +1 -1
  222. package/src/api/client.ts +148 -2
  223. package/src/attachments/file-size.ts +42 -0
  224. package/src/attachments/local-previews.ts +32 -0
  225. package/src/attachments/pickers.ts +90 -30
  226. package/src/i18n.ts +24 -3
  227. package/src/locales.ts +13 -3
  228. package/src/state/widget-store.ts +519 -70
  229. package/src/storage.ts +2 -0
  230. package/src/types.ts +58 -0
  231. package/src/ui/WidgetProvider.tsx +50 -12
  232. package/src/ui/components/AttachmentChips.tsx +100 -29
  233. package/src/ui/components/ConversationRow.tsx +90 -9
  234. package/src/ui/components/ImageViewer.tsx +250 -28
  235. package/src/ui/components/RatingCard.tsx +5 -2
  236. package/src/ui/components/ZoomableImage.tsx +58 -5
  237. package/src/ui/components/icons.tsx +10 -12
  238. package/src/ui/hooks/use-retained-state.ts +35 -0
  239. package/src/ui/screens/chat/ChatView.styles.ts +151 -3
  240. package/src/ui/screens/chat/ChatView.tsx +760 -213
  241. package/src/ui/screens/chat/ChatView.types.ts +30 -1
  242. package/src/ui/screens/conversations/ConversationsList.tsx +1 -0
  243. package/src/ui/screens/conversations/ConversationsList.types.ts +2 -0
  244. package/src/ui/screens/home/HomeView.styles.ts +36 -45
  245. package/src/ui/screens/home/HomeView.tsx +54 -70
  246. package/src/ui/screens/home/HomeView.types.ts +5 -6
  247. package/src/ui/styles/theme.ts +6 -0
  248. package/src/ui/utils/conversations.ts +16 -2
  249. package/src/ui/utils/html.ts +26 -0
  250. package/src/ui/utils/image-load-queue.ts +108 -0
  251. package/src/ui/utils/inline-attachments.ts +71 -0
@@ -16,6 +16,12 @@ export declare class RepzoWidgetError extends Error {
16
16
  /** Builds the error for a non-2xx `{ message, code }` body. */
17
17
  static fromResponse(status: number, body: unknown): RepzoWidgetError;
18
18
  }
19
+ /** A file in storage, waiting for the message that names it. */
20
+ export interface UploadedFile {
21
+ uploadToken: string;
22
+ /** When Workstation stops taking `uploadToken`, on this phone's clock (ms). */
23
+ expiresAt: number;
24
+ }
19
25
  export declare class WidgetApiClient {
20
26
  private baseUrl;
21
27
  private channelAccountId;
@@ -94,21 +100,49 @@ export declare class WidgetApiClient {
94
100
  conversationId?: string;
95
101
  forceNewConversation?: boolean;
96
102
  body: string;
97
- /** `url` is a base64 data URL; max 5, each <= 1.5 MB decoded. */
103
+ /**
104
+ * Max 5. Either inline (`url`, a base64 data URL, each <= 1.5 MB decoded)
105
+ * or uploaded first (`uploadToken`, from uploadAttachment).
106
+ */
98
107
  attachments?: Array<{
99
108
  name: string;
100
109
  url: string;
101
110
  contentType: string;
102
111
  size: number;
112
+ } | {
113
+ name: string;
114
+ uploadToken: string;
115
+ contentType: string;
116
+ size: number;
103
117
  }>;
104
118
  visitorName?: string;
105
119
  visitorEmail?: string;
106
120
  agentUiAction?: AgentUiAction;
121
+ /**
122
+ * Same on every retry of a message. Newer Workstation deployments store it
123
+ * once and echo it on the stored row; older ones don't read it.
124
+ */
125
+ clientMessageId?: string;
107
126
  }): Promise<{
108
127
  messageId: string;
109
128
  conversationId: string;
110
129
  isNewConversation: boolean;
111
130
  }>;
131
+ /**
132
+ * Puts a local file in storage ahead of the message, which then names it by
133
+ * the returned upload token. The target is presigned storage, or a path on
134
+ * the server where its storage can't presign. The upload URL is signed for
135
+ * exactly the size asked for: a `file://` file whose size `expo-file-system`
136
+ * can read streams from disk, anything else is read as a native blob and
137
+ * measured. `signal` cancels the transfer (the visitor removed the file, or
138
+ * left the conversation). Resolves the token and when it expires.
139
+ */
140
+ uploadAttachment(file: {
141
+ uri: string;
142
+ name: string;
143
+ contentType: string;
144
+ size: number;
145
+ }, signal?: AbortSignal): Promise<UploadedFile>;
112
146
  listConversations(): Promise<{
113
147
  data: Conversation[];
114
148
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,YAAY,EACZ,OAAO,EACP,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,UAAU,EACX,MAAM,UAAU,CAAC;AASlB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE5E;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,oBAA6B;IAOhF,+DAA+D;IAC/D,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,gBAAgB;CAYrE;AAwBD,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAM;IAErB,OAAO,CAAC,gBAAgB,CAAM;IAE9B,OAAO,CAAC,KAAK,CAAuB;IAEpC,OAAO,CAAC,WAAW,CAAS;IAE5B;;;OAGG;IACH,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAQ;IAEpF,kFAAkF;IAClF,eAAe,EAAE,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,I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AAC;IAOjB,iBAAiB,CAAC,IAAI,EAAE;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjB,gGAAgG;IAChG,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,qEAAqE;IACrE,eAAe,CACb,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAO,GAC7D,OAAO,CAAC,IAAI,CAAC;CAOjB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Local file sizes from the host's `expo-file-system` (optional, like the
3
+ * pickers): read from the file's metadata, never from its contents. Shared by
4
+ * the pickers and the upload client, so the client doesn't pull in pickers.
5
+ *
6
+ * No `react-native` import on purpose: it stays testable in plain Node.
7
+ */
8
+ /** A positive, finite byte count, or null. */
9
+ export declare function validSize(size: unknown): number | null;
10
+ /**
11
+ * A local file's exact size in bytes, from its metadata without reading it.
12
+ * Null without `expo-file-system`, or when it can't tell.
13
+ */
14
+ export declare function measureFileSize(uri: string): Promise<number | null>;
15
+ //# sourceMappingURL=file-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-size.d.ts","sourceRoot":"","sources":["../../../../src/attachments/file-size.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,8CAA8C;AAC9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAEtD;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBzE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The phone's copy of each file the visitor sent, by the URL of the stored
3
+ * copy that replaced it in the thread. Right after a send the stored copy
4
+ * may not load yet (Workstation can still be storing it), so a photo keeps
5
+ * showing from the phone instead of turning into a file row. Kept in memory
6
+ * only: a later session shows the stored copy.
7
+ */
8
+ export declare function rememberLocalPreview(storedUrl: string, localUrl: string): void;
9
+ export declare function localPreviewFor(storedUrl: string): string | null;
10
+ /** One that failed to load (the OS cleared the picker's cache): every view moves to the stored copy. */
11
+ export declare function forgetLocalPreview(storedUrl: string): void;
12
+ /** Signing out forgets them: the next visitor on the phone doesn't inherit the paths. */
13
+ export declare function clearLocalPreviews(): void;
14
+ //# sourceMappingURL=local-previews.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-previews.d.ts","sourceRoot":"","sources":["../../../../src/attachments/local-previews.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAM9E;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEhE;AAED,wGAAwG;AACxG,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE1D;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -1,6 +1,10 @@
1
1
  /**
2
- * Visitor attachments: picking photos/files and turning them into the base64
3
- * data URLs `POST /api/widget/messages` accepts.
2
+ * Visitor attachments: picking photos/files for `POST /api/widget/messages`.
3
+ *
4
+ * A server that takes uploads names its cap (`maxAttachmentBytes`): a picked
5
+ * file then stays a local URI, which the composer uploads right away. An
6
+ * older server only takes files inline, as base64 data URLs within the
7
+ * 1.5 MB / 6 MB caps below.
4
8
  *
5
9
  * The SDK ships no native code, so every picker is borrowed from the host —
6
10
  * the same approach as `storage.ts` and `native-gradient.ts`:
@@ -8,7 +12,7 @@
8
12
  * - `expo-document-picker` → any file
9
13
  * - `expo-file-system` → reads a picked file as base64 (optional; without it
10
14
  * the file is read through `fetch` + `FileReader`)
11
- * - `expo-image-manipulator` → shrinks photos to fit the 1.5 MB cap (optional;
15
+ * - `expo-image-manipulator` → shrinks photos, to fit the 1.5 MB inline cap (optional;
12
16
  * without it a full-resolution camera photo is usually refused as too large)
13
17
  *
14
18
  * A host without those (or with `react-native-image-picker` etc.) plugs its own
@@ -21,25 +25,36 @@
21
25
  import type { AttachmentSource, RepzoWidgetAttachmentOptions } from '../types';
22
26
  /** The server keeps the first five and silently drops the rest. */
23
27
  export declare const MAX_ATTACHMENTS = 5;
24
- /** Per file, decoded. The server silently drops anything larger. */
28
+ /** Per inline file, decoded. The server silently drops anything larger. */
25
29
  export declare const MAX_ATTACHMENT_BYTES = 1500000;
26
30
  /**
27
- * All files in one message, decoded. Base64 inside JSON inflates bytes by
31
+ * All inline files in one message, decoded. Base64 inside JSON inflates bytes by
28
32
  * ~1.37x and the server caps a request body at 10 MB, so five files at the
29
33
  * per-file maximum would come back as a 413.
30
34
  */
31
35
  export declare const MAX_TOTAL_ATTACHMENT_BYTES = 6000000;
32
- /** A picked file, encoded and ready to send; what the composer shows as a chip. */
36
+ /** A picked file, ready to send; what the composer shows as a chip. */
33
37
  export interface DraftAttachment {
34
38
  id: string;
35
39
  name: string;
36
40
  contentType: string;
37
41
  /** Decoded bytes — what the server measures against its cap. */
38
42
  size: number;
39
- /** `data:<mime>;base64,<…>` — the wire format. */
43
+ /** `data:<mime>;base64,<…>` for an inline file; empty when `fileUri` is uploaded instead. */
40
44
  dataUrl: string;
45
+ /** The local file uploaded ahead of the message. */
46
+ fileUri?: string;
41
47
  /** What `<Image>` renders locally: the picked file's URI, else the data URL. */
42
48
  previewUri: string;
49
+ /**
50
+ * Where `fileUri`'s upload stands. The composer starts it as soon as the
51
+ * file is picked and holds Send until every file is up. Absent for inline files.
52
+ */
53
+ uploadStatus?: 'uploading' | 'uploaded' | 'failed';
54
+ /** What the message names the uploaded file by, once `uploadStatus` is `uploaded`. */
55
+ uploadToken?: string;
56
+ /** When `uploadToken` stops working, on this phone's clock (ms). */
57
+ uploadExpiresAt?: number;
43
58
  }
44
59
  /** Why some (or all) of a pick didn't make it into the composer. */
45
60
  export type AttachmentProblem = 'tooMany' | 'tooLarge' | 'tooLargeTogether' | 'cameraDenied' | 'failed';
@@ -50,6 +65,8 @@ export interface PickResult {
50
65
  }
51
66
  /** Set from `boot({ attachments })`; `null` restores auto-detection. */
52
67
  export declare function setAttachmentOptions(options: RepzoWidgetAttachmentOptions | null): void;
68
+ /** Whether a picked file starts uploading before Send (`attachments.uploadOnPick`). */
69
+ export declare function uploadsOnPick(): boolean;
53
70
  /**
54
71
  * The options the attach menu offers, in menu order. Empty means no button:
55
72
  * attachments were switched off by the host, or nothing can pick a file.
@@ -57,13 +74,19 @@ export declare function setAttachmentOptions(options: RepzoWidgetAttachmentOptio
57
74
  export declare function getAttachmentSources(): AttachmentSource[];
58
75
  /**
59
76
  * Opens the picker for `source` and returns what fits alongside `current`.
77
+ * `uploadLimit` is the server's upload cap; without it files go inline.
60
78
  * Never throws: a cancelled pick is `{ added: [], problem: null }`.
61
79
  */
62
- export declare function pickAttachments(source: AttachmentSource, current: DraftAttachment[]): Promise<PickResult>;
63
- /** Null when a file of `size` bytes still fits beside `current`; otherwise the limit it breaks. */
80
+ export declare function pickAttachments(source: AttachmentSource, current: DraftAttachment[], uploadLimit?: number | null): Promise<PickResult>;
81
+ /**
82
+ * Null when a file of `size` bytes still fits beside `current`; otherwise the
83
+ * limit it breaks. With `uploadLimit` the file is uploaded on its own, so
84
+ * only its own size counts; inline files also share one request body.
85
+ */
64
86
  export declare function checkAttachmentFits(current: ReadonlyArray<{
65
87
  size: number;
66
- }>, size: number): AttachmentProblem | null;
88
+ fileUri?: string;
89
+ }>, size: number, uploadLimit?: number | null): AttachmentProblem | null;
67
90
  export declare function buildDataUrl(contentType: string, base64: string): string;
68
91
  /**
69
92
  * A picker's MIME type as a bare lowercase `type/subtype`, or null when it
@@ -78,4 +101,6 @@ export declare function base64ByteLength(base64: string): number;
78
101
  /** `1.2 MB`, `340 KB` — for chips; the limits themselves use decimal units too. */
79
102
  export declare function formatBytes(bytes: number): string;
80
103
  export declare function isImageAttachment(contentType: string | null | undefined): boolean;
104
+ /** The type a file name's extension implies, or null for one this table doesn't know. */
105
+ export declare function guessContentType(nameOrUri: string | null | undefined): string | null;
81
106
  //# sourceMappingURL=pickers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pickers.d.ts","sourceRoot":"","sources":["../../../../src/attachments/pickers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAmB,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAEhG,mEAAmE;AACnE,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,UAAY,CAAC;AAC9C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,UAAY,CAAC;AAKpD,mFAAmF;AACnF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,cAAc,GACd,QAAQ,CAAC;AAEb,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,uEAAuE;IACvE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACnC;AAgDD,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,4BAA4B,GAAG,IAAI,GAAG,IAAI,CAEvF;AAID;;;GAGG;AACH,wBAAgB,oBA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1D,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,MAAM,GAAG,IAAW,GAChC,iBAAiB,GAAG,IAAI,CAO1B;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAExE;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAIpF;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEjF;AAqCD,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGpF"}
@@ -20,6 +20,10 @@ export declare const DEFAULT_LABELS: {
20
20
  readonly loadEarlier: "Load earlier messages";
21
21
  readonly emptyConversation: "Send a message to start the conversation";
22
22
  readonly messagePlaceholder: "Type a message...";
23
+ readonly sendMessage: "Send message";
24
+ readonly jumpToLatest: "Jump to latest messages";
25
+ readonly jumpToLatestNew: "New messages: {count}. Jump to latest";
26
+ readonly morePhotos: "{count} more photos";
23
27
  readonly attachFile: "Attach file";
24
28
  readonly attachPhotoLibrary: "Photo library";
25
29
  readonly attachTakePhoto: "Take photo";
@@ -29,15 +33,20 @@ export declare const DEFAULT_LABELS: {
29
33
  readonly attachmentTooMany: "You can attach up to {count} files";
30
34
  readonly attachmentsTooLargeTogether: "Attachments are too large to send together — send some in another message";
31
35
  readonly attachmentFailed: "Couldn't attach that file";
36
+ readonly attachmentUploading: "Uploading {name}";
37
+ readonly attachmentUploadFailed: "Couldn't upload {name}. Tap to try again";
38
+ readonly attachmentsUploadFailed: "Couldn't upload a file. Tap it to try again";
32
39
  readonly openAttachment: "Open {name}";
33
40
  readonly voicePlay: "Play voice message";
34
41
  readonly voicePause: "Pause voice message";
35
42
  readonly voiceSpeed: "Playback speed";
36
43
  readonly imageLoadFailed: "Couldn't load this image";
37
44
  readonly openImageExternally: "Open image";
45
+ readonly imagePosition: "{current} of {total}";
38
46
  readonly cameraPermissionDenied: "Allow camera access in Settings to take a photo";
39
47
  readonly cancel: "Cancel";
40
48
  readonly failedToSend: "Failed to send";
49
+ readonly tapToRetry: "Tap to retry";
41
50
  readonly thinking: "Typing";
42
51
  readonly messages: "Messages";
43
52
  readonly noMessages: "No messages yet";
@@ -47,13 +56,14 @@ export declare const DEFAULT_LABELS: {
47
56
  readonly preChatSubtitle: "Let us know a bit about you so we can help you better.";
48
57
  readonly preChatSkip: "Skip";
49
58
  readonly preChatSubmit: "Start chat";
50
- readonly viewPreviousConversations: "View previous conversations";
51
- readonly homeRecentTitle: "Recent";
52
- readonly homeViewAllCount: "View all ({count})";
59
+ readonly homeRecentMessageTitle: "Recent message";
53
60
  readonly homeNoConversations: "Your conversations will show up here";
54
61
  readonly homeStatusOnline: "We're online";
55
62
  readonly homeStatusAway: "We're away";
56
63
  readonly unreadBadge: "{count} unread";
64
+ readonly lastMessagePhoto: "Photo";
65
+ readonly lastMessageFile: "File";
66
+ readonly lastMessageYou: "You: {message}";
57
67
  readonly team: "Team";
58
68
  readonly home: "Home";
59
69
  readonly close: "Close";
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,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AG,YAAY,GAAG,IAAI,CAQpG;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqKjB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,cAAc,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAI7F;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAM3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/locales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,KAAK,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAoIrE,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAU,CAAC;AAErE,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE3D"}
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/locales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,KAAK,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AA8IrE,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAU,CAAC;AAErE,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE3D"}
@@ -7,7 +7,7 @@
7
7
  * and the unread count must stay alive while the UI is closed — the modal is
8
8
  * only a subscriber.
9
9
  */
10
- import { WidgetApiClient } from '../api/client';
10
+ import { WidgetApiClient, type UploadedFile } from '../api/client';
11
11
  import { EventEmitter } from '../events';
12
12
  import { PushManager } from '../push/push-notifications';
13
13
  import type { AgentUiAction, BootOptions, ConversationRatingResult, OutgoingAttachment, PostInteractionKind, PostReply, WidgetCustomAttributes, WidgetSpaceType, WidgetState, WidgetUser, WidgetView } from '../types';
@@ -27,6 +27,10 @@ export declare class WidgetStore {
27
27
  private inAppNotificationsEnabled;
28
28
  /** `boot({ posts })` — Send posts over the app. */
29
29
  private postsEnabled;
30
+ /** `boot({ photoAlbums })` — a message's photos share one album in the thread. */
31
+ private photoAlbumsEnabled;
32
+ /** `boot({ youPrefix })` — "You:" before the visitor's own newest message in the lists. */
33
+ private youPrefixEnabled;
30
34
  /** Posts whose view was reported this session (the server also dedupes per day). */
31
35
  private viewedPostIds;
32
36
  /** Bumped per post load, so an older answer never lands over a newer one. */
@@ -67,8 +71,17 @@ export declare class WidgetStore {
67
71
  private lastTypingPingAt;
68
72
  private visitorTypingActive;
69
73
  private seenMessageIds;
74
+ /** Who sent each thread's newest message and what it carried; see `withLastMessage`. */
75
+ private lastMessages;
76
+ private lastMessagesLoaded;
70
77
  /** Statuses (e.g. "read") that arrived for an id before a send response revealed it. */
71
78
  private earlyStatuses;
79
+ /** The agent UI action behind a failed bubble, so Retry runs it again too. */
80
+ private failedActions;
81
+ /** The next re-read for a sent file's stored copy (see `syncServerCopies`). */
82
+ private serverCopyTimer;
83
+ private serverCopyRetries;
84
+ private serverCopySyncing;
72
85
  /**
73
86
  * Identity generation. Bumped whenever boot/login/logout is requested; every
74
87
  * async path that writes session state captures it first and bails once it
@@ -116,6 +129,8 @@ export declare class WidgetStore {
116
129
  getState: () => WidgetState;
117
130
  /** Composer identity: explicit opens reset it; a draft receiving its server ID does not. */
118
131
  getThreadGeneration: () => number;
132
+ showsPhotoAlbums: () => boolean;
133
+ showsYouPrefix: () => boolean;
119
134
  private setState;
120
135
  private serialize;
121
136
  /** Queue a requested identity op; anything older becomes stale right away. */
@@ -240,6 +255,25 @@ export declare class WidgetStore {
240
255
  private rememberConversationAgent;
241
256
  private applyConversationAgent;
242
257
  private hydrateConversation;
258
+ /**
259
+ * Workstation's list doesn't say who sent the newest message, and calls one
260
+ * without words "2 attachments". While a row still describes the message
261
+ * this device saw last, both are filled in from it. `snippet` keeps the
262
+ * list's words: apps read it, and the lists draw "Photo" or "File" from
263
+ * `lastMessageAttachment` instead.
264
+ */
265
+ private withLastMessage;
266
+ /**
267
+ * A send or a streamed message is the newest by arrival, whatever the two
268
+ * clocks say; a history page only replaces something older. A sent message
269
+ * is timed by the phone, which may run ahead of Workstation, so instead a
270
+ * page that has it replaces it: whatever is newest there came after it, and
271
+ * Workstation's own time then stands in for the phone's.
272
+ */
273
+ private rememberLastMessage;
274
+ private loadLastMessages;
275
+ /** A thread's newest page shows who sent its newest message, so its row can say too. */
276
+ private learnLastMessage;
243
277
  /**
244
278
  * Normalizes attachments from history pages and live payloads alike. Live
245
279
  * payloads may omit `id`/`size`, so the list still gets a stable key.
@@ -281,6 +315,14 @@ export declare class WidgetStore {
281
315
  * server read cursor, which must not happen for a thread nobody is reading.
282
316
  */
283
317
  private refreshOpenThread;
318
+ /**
319
+ * Until its stored copy replaces it, a sent bubble points at the visitor's
320
+ * local files: a photo still opens in the viewer, but a PDF has nothing to
321
+ * open. When the stream's echo hasn't brought that copy, re-read the
322
+ * thread, and try again a few times while Workstation is still storing it.
323
+ */
324
+ private syncServerCopies;
325
+ private cancelServerCopySync;
284
326
  /** A history page (newest-first) as the oldest-first list the UI renders. */
285
327
  private hydrateMessages;
286
328
  /**
@@ -293,11 +335,32 @@ export declare class WidgetStore {
293
335
  private hydrateBlockMedia;
294
336
  /**
295
337
  * Rejects when the message wasn't sent, so the composer can keep
296
- * attachments for a retry. A text-only bubble is marked failed; one with
297
- * attachments is removed instead — the composer's chips are the retry, and
298
- * keeping both would leave a duplicate after a successful resend.
338
+ * attachments for a retry. A text-only bubble is marked failed and can be
339
+ * re-sent with `retryMessage`; one with attachments is removed instead — the
340
+ * composer's chips are the retry, and keeping both would leave a duplicate
341
+ * after a successful resend. Likewise an agent UI action replaces the
342
+ * failed bubble of the same action, since its card stays tappable.
299
343
  */
300
344
  sendMessage(body: string, attachments?: OutgoingAttachment[], agentUiAction?: AgentUiAction): Promise<void>;
345
+ /**
346
+ * Puts a picked file in storage while the visitor is still writing, so
347
+ * Send goes out at once. Resolves the token `sendMessage` names it by, and
348
+ * when that token expires.
349
+ */
350
+ uploadAttachment(file: {
351
+ uri: string;
352
+ name: string;
353
+ contentType: string;
354
+ size: number;
355
+ }, signal?: AbortSignal): Promise<UploadedFile>;
356
+ /**
357
+ * Re-sends a text bubble that failed. It moves to the end of the thread,
358
+ * since it now goes out after anything sent meanwhile. Rejects like
359
+ * `sendMessage` when it fails again; the bubble is then failed once more.
360
+ */
361
+ retryMessage(messageId: string): Promise<void>;
362
+ /** Sends the optimistic bubble `tempId`, already on screen as pending. */
363
+ private deliverMessage;
301
364
  identifyVisitor(data: {
302
365
  email?: string;
303
366
  name?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"widget-store.d.ts","sourceRoot":"","sources":["../../../../src/state/widget-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAyC,eAAe,EAAE,MAAM,eAAe,CAAC;AAGvF,OAAO,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EAEX,wBAAwB,E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= "repzo_widget_user_key";
19
19
  export declare const DEVICE_ID_KEY = "repzo_widget_device_id";
20
20
  export declare const UNREAD_KEY = "repzo_widget_unread";
21
+ /** Who sent each conversation's newest message; Workstation's list doesn't say. */
22
+ export declare const LAST_MESSAGE_KEY = "repzo_widget_last_message";
21
23
  /** Last config received — repaints the real theme instantly on relaunch. */
22
24
  /**
23
25
  * v2 wraps the config with the channel/baseUrl/platform it came from. v1 held a
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD,eAAO,MAAM,SAAS,uBAAuB,CAAC;AAC9C,sFAAsF;AACtF,eAAO,MAAM,QAAQ,0BAA0B,CAAC;AAChD,eAAO,MAAM,aAAa,2BAA2B,CAAC;AACtD,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAChD,4EAA4E;AAC5E;;;;GAIG;AACH,eAAO,MAAM,UAAU,2BAA2B,CAAC;AACnD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAwCvD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAEjF;AAED,eAAO,MAAM,OAAO;iBACC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;iBAS/B,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;oBAQlC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAO7C,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAEvF;AAiBD,eAAO,MAAM,aAAa;iBACL,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;iBAkB/B,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBxD,0EAA0E;oBACpD,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAU7C,CAAC"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD,eAAO,MAAM,SAAS,uBAAuB,CAAC;AAC9C,sFAAsF;AACtF,eAAO,MAAM,QAAQ,0BAA0B,CAAC;AAChD,eAAO,MAAM,aAAa,2BAA2B,CAAC;AACtD,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAChD,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAC5D,4EAA4E;AAC5E;;;;GAIG;AACH,eAAO,MAAM,UAAU,2BAA2B,CAAC;AACnD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAwCvD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAEjF;AAED,eAAO,MAAM,OAAO;iBACC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;iBAS/B,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;oBAQlC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAO7C,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAEvF;AAiBD,eAAO,MAAM,aAAa;iBACL,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;iBAkB/B,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBxD,0EAA0E;oBACpD,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAU7C,CAAC"}
@@ -59,6 +59,12 @@ export interface WidgetConfig {
59
59
  proactiveFrequency: 'session' | 'visitor';
60
60
  proactiveOpenMode: 'home' | 'new_message';
61
61
  attachmentsEnabled: boolean;
62
+ /**
63
+ * Largest file a visitor may attach. Set by servers that take uploads
64
+ * (`/api/widget/uploads`); absent on older ones, which only take files
65
+ * inline in the message.
66
+ */
67
+ maxAttachmentBytes?: number;
62
68
  analyticsEnabled: boolean;
63
69
  toursEnabled: boolean;
64
70
  defaultLocale: string;
@@ -87,7 +93,12 @@ export interface WidgetAttachment {
87
93
  */
88
94
  export interface OutgoingAttachment {
89
95
  name: string;
96
+ /** A base64 data URL; empty when `fileUri` is set. */
90
97
  url: string;
98
+ /** A local file uploaded before the message is sent (servers with `maxAttachmentBytes`). */
99
+ fileUri?: string;
100
+ /** `fileUri` is already uploaded under this token, so the send skips uploading it. */
101
+ uploadToken?: string;
91
102
  contentType: string;
92
103
  /** Decoded bytes. */
93
104
  size: number;
@@ -99,6 +110,21 @@ export interface Conversation {
99
110
  subject: string | null;
100
111
  status: string;
101
112
  snippet: string | null;
113
+ /**
114
+ * Set when the newest message had no words, only photos (`'photo'`) or
115
+ * other files (`'file'`); the lists then say "Photo" or "File", while
116
+ * `snippet` keeps Workstation's wording ("2 attachments"). `null` when it
117
+ * had words. Filled in from what this device sent, received or loaded.
118
+ * @since 1.4.0
119
+ */
120
+ lastMessageAttachment?: 'photo' | 'file' | null;
121
+ /**
122
+ * The newest message is the visitor's own; the lists put "You:" before it.
123
+ * A Workstation list that includes it is used as is; otherwise the SDK fills
124
+ * it in from what this device sent, received or loaded.
125
+ * @since 1.4.0
126
+ */
127
+ lastMessageFromVisitor?: boolean | null;
102
128
  messageCount: number;
103
129
  lastMessageAt: string | null;
104
130
  createdAt: string;
@@ -127,6 +153,14 @@ export interface Message {
127
153
  createdAt: string;
128
154
  /** Set when a teammate deleted the message; the content fields are then empty. */
129
155
  deletedAt?: string | null;
156
+ /**
157
+ * On the visitor's own messages: the id this device sent it under, which
158
+ * stays the same when a failed message is retried. Lets a stored message
159
+ * replace its pending or failed bubble. Only newer Workstation deployments
160
+ * send it.
161
+ * @since 1.3.1
162
+ */
163
+ clientMessageId?: string | null;
130
164
  }
131
165
  export interface OutboundMessage {
132
166
  id?: string;
@@ -237,6 +271,22 @@ export interface BootOptions {
237
271
  * @since 1.2.0
238
272
  */
239
273
  posts?: boolean;
274
+ /**
275
+ * Show two or more photos in one message together as an album: one square
276
+ * holding them all, with "+N" on the last tile past four (default true).
277
+ * False shows each photo on its own, full width, as before 1.4.0. Either
278
+ * way, tapping a photo opens the message's photos in the viewer.
279
+ * @since 1.4.0
280
+ */
281
+ photoAlbums?: boolean;
282
+ /**
283
+ * Put "You: " before a conversation's newest message on Home and in
284
+ * Messages when the visitor sent it (default true; Arabic "أنت: ", the
285
+ * `lastMessageYou` translation key). False shows the message alone, as
286
+ * before 1.4.0. `Conversation.lastMessageFromVisitor` is filled in either way.
287
+ * @since 1.4.0
288
+ */
289
+ youPrefix?: boolean;
240
290
  }
241
291
  /** An option in the composer's attach menu. */
242
292
  export type AttachmentSource = 'photo' | 'camera' | 'file';
@@ -270,6 +320,14 @@ export interface RepzoWidgetAttachmentOptions {
270
320
  pick?: (source: AttachmentSource) => Promise<RepzoPickedFile[] | null>;
271
321
  /** Menu options offered with `pick`. Default all three. Ignored without `pick`. */
272
322
  sources?: AttachmentSource[];
323
+ /**
324
+ * Default true: with a Workstation that takes uploads, a picked file starts
325
+ * uploading right away, while the visitor writes, so the message goes out
326
+ * the moment they tap Send. False uploads the files only when they tap
327
+ * Send, so nothing leaves the phone for a file they remove first.
328
+ * @since 1.4.0
329
+ */
330
+ uploadOnPick?: boolean;
273
331
  }
274
332
  export type AgentUiModule = 'products' | 'product_variants' | 'carts' | 'orders' | 'contacts' | 'leads' | 'appointments' | 'price_offers' | 'send';
275
333
  export interface AgentUiAction {