@poolse/react-native 3.10.0 → 3.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/README.md +23 -3
- package/dist/index.cjs +360 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1852 -1736
- package/dist/index.d.ts +1852 -1736
- package/dist/index.js +362 -153
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -851,6 +851,7 @@ function Avatar({
|
|
|
851
851
|
const theme = useTheme();
|
|
852
852
|
const dim = SIZES[size];
|
|
853
853
|
const initials = computeInitials(name);
|
|
854
|
+
const [failedSrc, setFailedSrc] = react.useState(null);
|
|
854
855
|
const tint = seed ? userColor(seed) : theme.colors.accent;
|
|
855
856
|
const fontSize = size === "xs" ? 9 : size === "sm" ? 11 : size === "lg" ? 22 : 15;
|
|
856
857
|
const badgeSize = Math.max(8, Math.round(dim * 0.32));
|
|
@@ -872,10 +873,11 @@ function Avatar({
|
|
|
872
873
|
accessibilityRole: "image",
|
|
873
874
|
accessibilityLabel: agent ? `${name ?? "Agent"} (agent)` : name ?? "avatar",
|
|
874
875
|
children: [
|
|
875
|
-
src ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
876
|
+
src && failedSrc !== src ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
876
877
|
reactNative.Image,
|
|
877
878
|
{
|
|
878
879
|
source: { uri: src },
|
|
880
|
+
onError: () => setFailedSrc(src),
|
|
879
881
|
style: { width: dim, height: dim, borderRadius: radius },
|
|
880
882
|
accessible: false
|
|
881
883
|
}
|
|
@@ -905,7 +907,7 @@ function Avatar({
|
|
|
905
907
|
]
|
|
906
908
|
}
|
|
907
909
|
) : null,
|
|
908
|
-
lookupId ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
910
|
+
lookupId ? /* @__PURE__ */ jsxRuntime.jsx(OptionalLivePresenceBadge, { id: lookupId, size: badgeSize, style: badgeStyle }) : presence && presence !== true ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
909
911
|
PresenceBadge,
|
|
910
912
|
{
|
|
911
913
|
state: presence,
|
|
@@ -932,6 +934,9 @@ function Avatar({
|
|
|
932
934
|
}
|
|
933
935
|
);
|
|
934
936
|
}
|
|
937
|
+
function OptionalLivePresenceBadge(props) {
|
|
938
|
+
return react$1.useOptionalPoolse() ? /* @__PURE__ */ jsxRuntime.jsx(LivePresenceBadge, { ...props }) : null;
|
|
939
|
+
}
|
|
935
940
|
function LivePresenceBadge({
|
|
936
941
|
id,
|
|
937
942
|
size,
|
|
@@ -3295,6 +3300,17 @@ var MessageComposer = react.forwardRef(
|
|
|
3295
3300
|
if (!controlled) setInnerValue("");
|
|
3296
3301
|
onChangeTextRef.current?.("");
|
|
3297
3302
|
},
|
|
3303
|
+
getText: () => valueRef.current,
|
|
3304
|
+
setText: (text) => setValueRef.current(text),
|
|
3305
|
+
insertText: (text) => {
|
|
3306
|
+
const now = valueRef.current;
|
|
3307
|
+
const sel = selectionRef.current ?? { start: now.length, end: now.length };
|
|
3308
|
+
const caret = sel.start + text.length;
|
|
3309
|
+
applyTextRef.current(now.slice(0, sel.start) + text + now.slice(sel.end), {
|
|
3310
|
+
start: caret,
|
|
3311
|
+
end: caret
|
|
3312
|
+
});
|
|
3313
|
+
},
|
|
3298
3314
|
setSelection: (start, end) => {
|
|
3299
3315
|
selectionRef.current = { start, end };
|
|
3300
3316
|
inputRef.current?.setSelection?.(start, end);
|
|
@@ -3329,14 +3345,19 @@ var MessageComposer = react.forwardRef(
|
|
|
3329
3345
|
const replyId = replyingTo?.id;
|
|
3330
3346
|
const attachmentIds = readyAttachmentIds;
|
|
3331
3347
|
setDraft("");
|
|
3332
|
-
upload.reset();
|
|
3333
3348
|
const opts = {
|
|
3334
3349
|
...replyId ? { quoted_message_id: replyId } : {},
|
|
3335
3350
|
...attachmentIds.length > 0 ? { attachment_ids: attachmentIds } : {}
|
|
3336
3351
|
};
|
|
3337
3352
|
try {
|
|
3338
|
-
await onSend(body, opts)
|
|
3353
|
+
if (await onSend(body, opts) === false) {
|
|
3354
|
+
if (!controlled) setInnerValue((now) => now ? now : body);
|
|
3355
|
+
else onChangeTextRef.current?.(body);
|
|
3356
|
+
return;
|
|
3357
|
+
}
|
|
3358
|
+
upload.reset();
|
|
3339
3359
|
} catch (err) {
|
|
3360
|
+
upload.reset();
|
|
3340
3361
|
const outcome = react$1.readDlpError(err);
|
|
3341
3362
|
if (outcome) setDlp({ outcome, body, opts });
|
|
3342
3363
|
if (!controlled) setInnerValue((now) => now ? now : body);
|
|
@@ -3357,6 +3378,12 @@ var MessageComposer = react.forwardRef(
|
|
|
3357
3378
|
setCursor(sel.end);
|
|
3358
3379
|
setTimeout(() => inputRef.current?.setSelection?.(sel.start, sel.end), 0);
|
|
3359
3380
|
};
|
|
3381
|
+
const valueRef = react.useRef(value);
|
|
3382
|
+
valueRef.current = value;
|
|
3383
|
+
const setValueRef = react.useRef(setValue);
|
|
3384
|
+
setValueRef.current = setValue;
|
|
3385
|
+
const applyTextRef = react.useRef(applyText);
|
|
3386
|
+
applyTextRef.current = applyText;
|
|
3360
3387
|
const format2 = (kind) => {
|
|
3361
3388
|
const sel = selectionRef.current ?? { start: value.length, end: value.length };
|
|
3362
3389
|
const r = react$1.applyFormat(value, sel, kind);
|
|
@@ -3645,129 +3672,146 @@ var styles15 = reactNative.StyleSheet.create({
|
|
|
3645
3672
|
padding: 6
|
|
3646
3673
|
}
|
|
3647
3674
|
});
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
const
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
onPress: () => pick(c)
|
|
3732
|
-
},
|
|
3733
|
-
c.member.user_id
|
|
3734
|
-
)),
|
|
3735
|
-
groupMatches.map((g) => /* @__PURE__ */ jsxRuntime.jsx(GroupRow, { group: g, onPress: () => pickGroup(g) }, `group:${g.handle}`))
|
|
3736
|
-
] }),
|
|
3737
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3738
|
-
reactNative.Pressable,
|
|
3675
|
+
var MentionInput = react.forwardRef(
|
|
3676
|
+
function MentionInput2({
|
|
3677
|
+
conversationId,
|
|
3678
|
+
onSend,
|
|
3679
|
+
maxSuggestions = 6,
|
|
3680
|
+
labelFor,
|
|
3681
|
+
value: valueProp,
|
|
3682
|
+
onChangeText,
|
|
3683
|
+
onSelectionChange,
|
|
3684
|
+
groups,
|
|
3685
|
+
...composerProps
|
|
3686
|
+
}, ref) {
|
|
3687
|
+
const theme = useTheme();
|
|
3688
|
+
const chat = react$1.usePoolse();
|
|
3689
|
+
const { me } = react$1.useMe();
|
|
3690
|
+
const { members } = react$1.useMembers(conversationId);
|
|
3691
|
+
const composerRef = react.useRef(null);
|
|
3692
|
+
react.useImperativeHandle(
|
|
3693
|
+
ref,
|
|
3694
|
+
() => ({
|
|
3695
|
+
addFiles: (inputs) => composerRef.current?.addFiles(inputs),
|
|
3696
|
+
focus: () => composerRef.current?.focus(),
|
|
3697
|
+
clear: () => composerRef.current?.clear(),
|
|
3698
|
+
getText: () => composerRef.current?.getText() ?? "",
|
|
3699
|
+
setText: (t) => composerRef.current?.setText(t),
|
|
3700
|
+
insertText: (t) => composerRef.current?.insertText(t),
|
|
3701
|
+
setSelection: (start, end) => composerRef.current?.setSelection(start, end)
|
|
3702
|
+
}),
|
|
3703
|
+
[]
|
|
3704
|
+
);
|
|
3705
|
+
const [innerText, setInnerText] = react.useState("");
|
|
3706
|
+
const text = valueProp ?? innerText;
|
|
3707
|
+
const [cursor, setCursor] = react.useState(0);
|
|
3708
|
+
const [dismissedAt, setDismissedAt] = react.useState(null);
|
|
3709
|
+
const pickedRef = react.useRef([]);
|
|
3710
|
+
const setText = (next) => {
|
|
3711
|
+
if (valueProp === void 0) setInnerText(next);
|
|
3712
|
+
onChangeText?.(next);
|
|
3713
|
+
};
|
|
3714
|
+
const query = react.useMemo(() => {
|
|
3715
|
+
const q = activeMentionQuery(text, cursor);
|
|
3716
|
+
return q && q.start !== dismissedAt ? q : null;
|
|
3717
|
+
}, [text, cursor, dismissedAt]);
|
|
3718
|
+
const candidates = react.useMemo(() => {
|
|
3719
|
+
if (!query) return [];
|
|
3720
|
+
const all = members.filter((m) => m.user_id !== me?.id).map((m) => ({
|
|
3721
|
+
member: m,
|
|
3722
|
+
externalId: m.external_id,
|
|
3723
|
+
label: labelFor?.(m.external_id) ?? chat.users.peek(m.external_id)?.displayName ?? m.external_id
|
|
3724
|
+
}));
|
|
3725
|
+
return filterMentionCandidates(all, query.query, maxSuggestions);
|
|
3726
|
+
}, [query, members, me?.id, labelFor, chat, maxSuggestions]);
|
|
3727
|
+
const groupMatches = react.useMemo(
|
|
3728
|
+
() => query && groups ? react$1.rankMentionGroups(groups, query.query, Math.max(0, maxSuggestions - candidates.length)) : [],
|
|
3729
|
+
[query, groups, maxSuggestions, candidates.length]
|
|
3730
|
+
);
|
|
3731
|
+
const pickGroup = (g) => {
|
|
3732
|
+
if (!query) return;
|
|
3733
|
+
const next = insertMention(text, query.start, cursor, g.handle);
|
|
3734
|
+
setText(next.text);
|
|
3735
|
+
setCursor(next.cursor);
|
|
3736
|
+
setTimeout(() => composerRef.current?.setSelection(next.cursor, next.cursor), 0);
|
|
3737
|
+
};
|
|
3738
|
+
const pick = (c) => {
|
|
3739
|
+
if (!query) return;
|
|
3740
|
+
const next = insertMention(text, query.start, cursor, c.label);
|
|
3741
|
+
pickedRef.current = [...pickedRef.current, { userId: c.member.user_id, label: c.label }];
|
|
3742
|
+
setText(next.text);
|
|
3743
|
+
setCursor(next.cursor);
|
|
3744
|
+
setTimeout(() => composerRef.current?.setSelection(next.cursor, next.cursor), 0);
|
|
3745
|
+
};
|
|
3746
|
+
const handleSend = async (body, opts) => {
|
|
3747
|
+
const mentions = mentionedUserIds(body, pickedRef.current);
|
|
3748
|
+
const result = await onSend(body, { ...opts, ...mentions.length > 0 ? { mentions } : {} });
|
|
3749
|
+
if (result === false) return false;
|
|
3750
|
+
pickedRef.current = [];
|
|
3751
|
+
return void 0;
|
|
3752
|
+
};
|
|
3753
|
+
const suggestions = query && candidates.length + groupMatches.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3754
|
+
reactNative.View,
|
|
3755
|
+
{
|
|
3756
|
+
style: [
|
|
3757
|
+
styles16.suggestions,
|
|
3739
3758
|
{
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
}
|
|
3759
|
+
backgroundColor: theme.colors.surface,
|
|
3760
|
+
borderColor: theme.colors.border,
|
|
3761
|
+
borderRadius: theme.radii.md
|
|
3762
|
+
},
|
|
3763
|
+
theme.shadows.md
|
|
3764
|
+
],
|
|
3765
|
+
accessibilityRole: "menu",
|
|
3766
|
+
accessibilityLabel: "Mention suggestions",
|
|
3767
|
+
children: [
|
|
3768
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.ScrollView, { keyboardShouldPersistTaps: "always", style: styles16.suggestionScroll, children: [
|
|
3769
|
+
candidates.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3770
|
+
MentionRow,
|
|
3771
|
+
{
|
|
3772
|
+
externalId: c.externalId,
|
|
3773
|
+
label: c.label,
|
|
3774
|
+
onPress: () => pick(c)
|
|
3775
|
+
},
|
|
3776
|
+
c.member.user_id
|
|
3777
|
+
)),
|
|
3778
|
+
groupMatches.map((g) => /* @__PURE__ */ jsxRuntime.jsx(GroupRow, { group: g, onPress: () => pickGroup(g) }, `group:${g.handle}`))
|
|
3779
|
+
] }),
|
|
3780
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3781
|
+
reactNative.Pressable,
|
|
3782
|
+
{
|
|
3783
|
+
onPress: () => setDismissedAt(query.start),
|
|
3784
|
+
style: styles16.dismiss,
|
|
3785
|
+
accessibilityRole: "button",
|
|
3786
|
+
accessibilityLabel: "Dismiss suggestions",
|
|
3787
|
+
hitSlop: 6,
|
|
3788
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "close", size: 14, color: theme.colors.textSubtle, label: null })
|
|
3789
|
+
}
|
|
3790
|
+
)
|
|
3791
|
+
]
|
|
3792
|
+
}
|
|
3793
|
+
) : null;
|
|
3794
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3795
|
+
MessageComposer,
|
|
3796
|
+
{
|
|
3797
|
+
ref: composerRef,
|
|
3798
|
+
...composerProps,
|
|
3799
|
+
...labelFor ? { labelFor } : {},
|
|
3800
|
+
value: text,
|
|
3801
|
+
onChangeText: (next) => {
|
|
3802
|
+
setText(next);
|
|
3803
|
+
if (dismissedAt !== null && !next.includes("@", dismissedAt)) setDismissedAt(null);
|
|
3804
|
+
},
|
|
3805
|
+
onSelectionChange: (sel) => {
|
|
3806
|
+
setCursor(sel.end);
|
|
3807
|
+
onSelectionChange?.(sel);
|
|
3808
|
+
},
|
|
3809
|
+
onSend: handleSend,
|
|
3810
|
+
accessory: suggestions
|
|
3811
|
+
}
|
|
3812
|
+
);
|
|
3813
|
+
}
|
|
3814
|
+
);
|
|
3771
3815
|
function MentionRow({
|
|
3772
3816
|
externalId,
|
|
3773
3817
|
label,
|
|
@@ -3884,6 +3928,23 @@ var styles16 = reactNative.StyleSheet.create({
|
|
|
3884
3928
|
right: 8
|
|
3885
3929
|
}
|
|
3886
3930
|
});
|
|
3931
|
+
var alertConfirmDelete = () => new Promise((resolve) => {
|
|
3932
|
+
reactNative.Alert.alert(
|
|
3933
|
+
"Delete message?",
|
|
3934
|
+
"It will be deleted for everyone.",
|
|
3935
|
+
[
|
|
3936
|
+
{ text: "Cancel", style: "cancel", onPress: () => resolve(false) },
|
|
3937
|
+
{ text: "Delete", style: "destructive", onPress: () => resolve(true) }
|
|
3938
|
+
],
|
|
3939
|
+
{ cancelable: true, onDismiss: () => resolve(false) }
|
|
3940
|
+
);
|
|
3941
|
+
});
|
|
3942
|
+
|
|
3943
|
+
// src/internal/confirmDelete.ts
|
|
3944
|
+
async function confirmThenDelete(msg, confirm, remove) {
|
|
3945
|
+
if (!await confirm(msg)) return;
|
|
3946
|
+
await remove(msg.id).catch(() => void 0);
|
|
3947
|
+
}
|
|
3887
3948
|
|
|
3888
3949
|
// src/internal/messageFocus.ts
|
|
3889
3950
|
function latestMarkableId(messages) {
|
|
@@ -7312,6 +7373,7 @@ function FlatMessageRow({
|
|
|
7312
7373
|
isEditing = false,
|
|
7313
7374
|
onStartEdit,
|
|
7314
7375
|
onDelete,
|
|
7376
|
+
extraActions,
|
|
7315
7377
|
onOpenThread,
|
|
7316
7378
|
onQuote,
|
|
7317
7379
|
labelFor,
|
|
@@ -7573,7 +7635,8 @@ function FlatMessageRow({
|
|
|
7573
7635
|
onQuote,
|
|
7574
7636
|
onMarkUnread,
|
|
7575
7637
|
onRemoveLinkPreview,
|
|
7576
|
-
linkPreviews
|
|
7638
|
+
linkPreviews,
|
|
7639
|
+
extraActions
|
|
7577
7640
|
}
|
|
7578
7641
|
) : null;
|
|
7579
7642
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -7750,7 +7813,8 @@ function MessageActions({
|
|
|
7750
7813
|
pinned = false,
|
|
7751
7814
|
onForward,
|
|
7752
7815
|
onTranslate,
|
|
7753
|
-
translated = false
|
|
7816
|
+
translated = false,
|
|
7817
|
+
extraActions = []
|
|
7754
7818
|
}) {
|
|
7755
7819
|
const theme = useTheme();
|
|
7756
7820
|
const insets = useSafeInsets();
|
|
@@ -7780,6 +7844,14 @@ function MessageActions({
|
|
|
7780
7844
|
});
|
|
7781
7845
|
}
|
|
7782
7846
|
}
|
|
7847
|
+
for (const a of extraActions) {
|
|
7848
|
+
items.push({
|
|
7849
|
+
label: a.label,
|
|
7850
|
+
icon: a.icon ?? "more-h",
|
|
7851
|
+
onPress: a.onPress,
|
|
7852
|
+
...a.danger ? { danger: true } : {}
|
|
7853
|
+
});
|
|
7854
|
+
}
|
|
7783
7855
|
if (isSelf && onEdit) items.push({ label: "Edit", icon: "edit", onPress: onEdit });
|
|
7784
7856
|
if (isSelf && onDelete)
|
|
7785
7857
|
items.push({ label: "Delete", icon: "trash", onPress: onDelete, danger: true });
|
|
@@ -7939,7 +8011,8 @@ function RowActionsSheet({
|
|
|
7939
8011
|
onQuote,
|
|
7940
8012
|
onMarkUnread,
|
|
7941
8013
|
onRemoveLinkPreview,
|
|
7942
|
-
linkPreviews
|
|
8014
|
+
linkPreviews,
|
|
8015
|
+
extraActions
|
|
7943
8016
|
}) {
|
|
7944
8017
|
const then = (fn) => () => {
|
|
7945
8018
|
close();
|
|
@@ -7959,6 +8032,7 @@ function RowActionsSheet({
|
|
|
7959
8032
|
...threads && onOpenThread ? { onReplyInThread: then(onOpenThread) } : {},
|
|
7960
8033
|
...quotations && onQuote ? { onQuote: then(onQuote) } : {},
|
|
7961
8034
|
...onMarkUnread ? { onMarkUnread: then(onMarkUnread) } : {},
|
|
8035
|
+
...extraActions && extraActions.length > 0 ? { extraActions: extraActions.map((a) => ({ ...a, onPress: then(a.onPress) })) } : {},
|
|
7962
8036
|
...onRemoveLinkPreview && previewUrls.length > 0 ? {
|
|
7963
8037
|
previewUrls,
|
|
7964
8038
|
onRemovePreview: (url) => {
|
|
@@ -8060,7 +8134,8 @@ function BubbleMessageRow({
|
|
|
8060
8134
|
onMarkUnread,
|
|
8061
8135
|
editHistory = true,
|
|
8062
8136
|
onRetrySend,
|
|
8063
|
-
onDiscardSend
|
|
8137
|
+
onDiscardSend,
|
|
8138
|
+
extraActions
|
|
8064
8139
|
}) {
|
|
8065
8140
|
const theme = useTheme();
|
|
8066
8141
|
const isSelf = meId !== null && msg.sender_id === meId;
|
|
@@ -8317,7 +8392,8 @@ function BubbleMessageRow({
|
|
|
8317
8392
|
onQuote,
|
|
8318
8393
|
onMarkUnread,
|
|
8319
8394
|
onRemoveLinkPreview,
|
|
8320
|
-
linkPreviews
|
|
8395
|
+
linkPreviews,
|
|
8396
|
+
extraActions
|
|
8321
8397
|
}
|
|
8322
8398
|
) : null
|
|
8323
8399
|
),
|
|
@@ -8443,7 +8519,8 @@ function ThreadView({
|
|
|
8443
8519
|
showPresence = false,
|
|
8444
8520
|
linkPreviews = true,
|
|
8445
8521
|
follow = true,
|
|
8446
|
-
alsoSendToChannel = true
|
|
8522
|
+
alsoSendToChannel = true,
|
|
8523
|
+
...hooks
|
|
8447
8524
|
}) {
|
|
8448
8525
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8449
8526
|
reactNative.Modal,
|
|
@@ -8467,7 +8544,8 @@ function ThreadView({
|
|
|
8467
8544
|
showPresence,
|
|
8468
8545
|
linkPreviews,
|
|
8469
8546
|
follow,
|
|
8470
|
-
alsoSendToChannel
|
|
8547
|
+
alsoSendToChannel,
|
|
8548
|
+
hooks
|
|
8471
8549
|
}
|
|
8472
8550
|
) })
|
|
8473
8551
|
}
|
|
@@ -8485,7 +8563,8 @@ function ThreadSheet({
|
|
|
8485
8563
|
showPresence,
|
|
8486
8564
|
linkPreviews,
|
|
8487
8565
|
follow,
|
|
8488
|
-
alsoSendToChannel
|
|
8566
|
+
alsoSendToChannel,
|
|
8567
|
+
hooks
|
|
8489
8568
|
}) {
|
|
8490
8569
|
const theme = useTheme();
|
|
8491
8570
|
const followState = react$1.useThreadFollow(follow ? rootMessage.id : null);
|
|
@@ -8529,9 +8608,8 @@ function ThreadSheet({
|
|
|
8529
8608
|
quotations: false,
|
|
8530
8609
|
isEditing: editingId === msg.id,
|
|
8531
8610
|
...canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {},
|
|
8532
|
-
onDelete: () =>
|
|
8533
|
-
|
|
8534
|
-
},
|
|
8611
|
+
onDelete: () => void confirmThenDelete(msg, hooks.confirmDelete ?? alertConfirmDelete, deleteReply),
|
|
8612
|
+
...hooks.extraActions ? { extraActions: hooks.extraActions(msg) } : {},
|
|
8535
8613
|
...labelFor ? { labelFor } : {},
|
|
8536
8614
|
...avatarFor ? { avatarFor } : {},
|
|
8537
8615
|
...layout ? { layout } : {},
|
|
@@ -8549,6 +8627,7 @@ function ThreadSheet({
|
|
|
8549
8627
|
meId,
|
|
8550
8628
|
editingId,
|
|
8551
8629
|
deleteReply,
|
|
8630
|
+
hooks,
|
|
8552
8631
|
labelFor,
|
|
8553
8632
|
avatarFor,
|
|
8554
8633
|
layout,
|
|
@@ -8694,20 +8773,30 @@ function ThreadSheet({
|
|
|
8694
8773
|
}
|
|
8695
8774
|
)
|
|
8696
8775
|
] }) : null,
|
|
8776
|
+
hooks.composerAccessory,
|
|
8697
8777
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8698
8778
|
MessageComposer,
|
|
8699
8779
|
{
|
|
8780
|
+
ref: hooks.composerHandle ?? null,
|
|
8700
8781
|
onSend: async (body, opts) => {
|
|
8701
|
-
|
|
8782
|
+
let draft = {
|
|
8702
8783
|
body,
|
|
8703
8784
|
...opts,
|
|
8704
8785
|
...alsoSendToChannel && alsoToChannel ? { also_send_to_channel: true } : {}
|
|
8705
|
-
}
|
|
8786
|
+
};
|
|
8787
|
+
if (hooks.beforeSend) {
|
|
8788
|
+
const changed = await hooks.beforeSend(draft);
|
|
8789
|
+
if (changed === false) return false;
|
|
8790
|
+
draft = changed;
|
|
8791
|
+
}
|
|
8792
|
+
await sendReply(draft);
|
|
8706
8793
|
setAlsoToChannel(false);
|
|
8794
|
+
return void 0;
|
|
8707
8795
|
},
|
|
8708
8796
|
placeholder: "Reply to thread\u2026",
|
|
8709
8797
|
attachments: true,
|
|
8710
8798
|
onAttachPress: () => setPickerOpen(true),
|
|
8799
|
+
...hooks.composerProps,
|
|
8711
8800
|
editingMessage,
|
|
8712
8801
|
onCancelEdit: () => setEditingId(null),
|
|
8713
8802
|
onSaveEdit: async (body) => {
|
|
@@ -9128,7 +9217,13 @@ function ConversationView({
|
|
|
9128
9217
|
maxFileSize,
|
|
9129
9218
|
acceptedFileTypes,
|
|
9130
9219
|
markUnread = true,
|
|
9131
|
-
onMarkedUnread
|
|
9220
|
+
onMarkedUnread,
|
|
9221
|
+
composerProps: appComposerProps,
|
|
9222
|
+
composerAccessory,
|
|
9223
|
+
composerHandle,
|
|
9224
|
+
beforeSend,
|
|
9225
|
+
extraActions,
|
|
9226
|
+
confirmDelete = alertConfirmDelete
|
|
9132
9227
|
}) {
|
|
9133
9228
|
const theme = useTheme();
|
|
9134
9229
|
const chat = react$1.usePoolse();
|
|
@@ -9204,6 +9299,20 @@ function ConversationView({
|
|
|
9204
9299
|
);
|
|
9205
9300
|
const [draftFor, setDraftFor] = react.useState(conversationId);
|
|
9206
9301
|
const [draftText, setDraftText] = react.useState(() => drafts.peek(conversationId)?.text ?? "");
|
|
9302
|
+
const composerRef = react.useRef(null);
|
|
9303
|
+
react.useImperativeHandle(
|
|
9304
|
+
composerHandle,
|
|
9305
|
+
() => ({
|
|
9306
|
+
addFiles: (inputs) => composerRef.current?.addFiles(inputs),
|
|
9307
|
+
focus: () => composerRef.current?.focus(),
|
|
9308
|
+
clear: () => composerRef.current?.clear(),
|
|
9309
|
+
getText: () => composerRef.current?.getText() ?? "",
|
|
9310
|
+
setText: (t) => composerRef.current?.setText(t),
|
|
9311
|
+
insertText: (t) => composerRef.current?.insertText(t),
|
|
9312
|
+
setSelection: (start, end) => composerRef.current?.setSelection(start, end)
|
|
9313
|
+
}),
|
|
9314
|
+
[]
|
|
9315
|
+
);
|
|
9207
9316
|
const [replyingTo, setReplyingTo] = react.useState(
|
|
9208
9317
|
() => drafts.peek(conversationId)?.quote ?? null
|
|
9209
9318
|
);
|
|
@@ -9466,7 +9575,8 @@ function ConversationView({
|
|
|
9466
9575
|
...readState ? { readState } : {},
|
|
9467
9576
|
isEditing: editingId === msg.id,
|
|
9468
9577
|
...canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {},
|
|
9469
|
-
onDelete: () =>
|
|
9578
|
+
onDelete: () => void confirmThenDelete(msg, confirmDelete, deleteMsg),
|
|
9579
|
+
...extraActions ? { extraActions: extraActions(msg) } : {},
|
|
9470
9580
|
...threads ? { onOpenThread: () => setThreadRoot(msg) } : {},
|
|
9471
9581
|
...canQuote && !tombstone ? { onQuote: () => setReplyingTo(msg) } : {},
|
|
9472
9582
|
onQuotedClick,
|
|
@@ -9508,6 +9618,8 @@ function ConversationView({
|
|
|
9508
9618
|
threads,
|
|
9509
9619
|
editingId,
|
|
9510
9620
|
deleteMsg,
|
|
9621
|
+
confirmDelete,
|
|
9622
|
+
extraActions,
|
|
9511
9623
|
labelFor,
|
|
9512
9624
|
avatarFor,
|
|
9513
9625
|
showSenderLabels,
|
|
@@ -9567,9 +9679,15 @@ function ConversationView({
|
|
|
9567
9679
|
const composerProps = react.useMemo(
|
|
9568
9680
|
() => ({
|
|
9569
9681
|
onSend: async (body, opts) => {
|
|
9570
|
-
|
|
9682
|
+
let draft = { body, ...opts };
|
|
9683
|
+
if (beforeSend) {
|
|
9684
|
+
const changed = await beforeSend(draft);
|
|
9685
|
+
if (changed === false) return false;
|
|
9686
|
+
draft = changed;
|
|
9687
|
+
}
|
|
9688
|
+
const id = draft.id ?? sdk.safeUuid();
|
|
9571
9689
|
try {
|
|
9572
|
-
await send({
|
|
9690
|
+
await send({ ...draft, id });
|
|
9573
9691
|
} catch (err) {
|
|
9574
9692
|
const kept = err instanceof sdk.MessageQueuedError || chat.outboxEnabled && !isQuoteGone(err);
|
|
9575
9693
|
if (kept) {
|
|
@@ -9586,6 +9704,7 @@ function ConversationView({
|
|
|
9586
9704
|
setReplyingTo(null);
|
|
9587
9705
|
setAutoReadPaused(false);
|
|
9588
9706
|
onSent?.(conversationId);
|
|
9707
|
+
return void 0;
|
|
9589
9708
|
},
|
|
9590
9709
|
value: draftText,
|
|
9591
9710
|
onChangeText: (text) => {
|
|
@@ -9593,7 +9712,11 @@ function ConversationView({
|
|
|
9593
9712
|
setDraftText(text);
|
|
9594
9713
|
},
|
|
9595
9714
|
emojiPicker,
|
|
9596
|
-
|
|
9715
|
+
...appComposerProps,
|
|
9716
|
+
onTyping: () => {
|
|
9717
|
+
signalTyping();
|
|
9718
|
+
appComposerProps?.onTyping?.();
|
|
9719
|
+
},
|
|
9597
9720
|
...attachments ? { onAttachPress: () => setPickerOpen(true) } : {},
|
|
9598
9721
|
...replyingTo ? { replyingTo } : {},
|
|
9599
9722
|
onCancelReply: () => setReplyingTo(null),
|
|
@@ -9623,7 +9746,9 @@ function ConversationView({
|
|
|
9623
9746
|
editingId,
|
|
9624
9747
|
edit,
|
|
9625
9748
|
draftText,
|
|
9626
|
-
emojiPicker
|
|
9749
|
+
emojiPicker,
|
|
9750
|
+
beforeSend,
|
|
9751
|
+
appComposerProps
|
|
9627
9752
|
]
|
|
9628
9753
|
);
|
|
9629
9754
|
const headerNode = header === false ? null : header === true ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -9763,7 +9888,8 @@ function ConversationView({
|
|
|
9763
9888
|
}
|
|
9764
9889
|
) : null
|
|
9765
9890
|
] }),
|
|
9766
|
-
|
|
9891
|
+
showComposer ? composerAccessory : null,
|
|
9892
|
+
!showComposer ? null : mentions ? /* @__PURE__ */ jsxRuntime.jsx(MentionInput, { ref: composerRef, conversationId, ...composerProps }) : /* @__PURE__ */ jsxRuntime.jsx(MessageComposer, { ref: composerRef, ...composerProps }),
|
|
9767
9893
|
canAttach ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
9768
9894
|
AttachmentPicker,
|
|
9769
9895
|
{
|
|
@@ -9787,7 +9913,11 @@ function ConversationView({
|
|
|
9787
9913
|
...timeFormat ? { timeFormat } : {},
|
|
9788
9914
|
density,
|
|
9789
9915
|
showPresence,
|
|
9790
|
-
linkPreviews
|
|
9916
|
+
linkPreviews,
|
|
9917
|
+
confirmDelete,
|
|
9918
|
+
...appComposerProps ? { composerProps: appComposerProps } : {},
|
|
9919
|
+
...beforeSend ? { beforeSend } : {},
|
|
9920
|
+
...extraActions ? { extraActions } : {}
|
|
9791
9921
|
}
|
|
9792
9922
|
) : null
|
|
9793
9923
|
]
|
|
@@ -11995,11 +12125,13 @@ function QuestionsPanel({
|
|
|
11995
12125
|
}
|
|
11996
12126
|
function BreakoutBanner({
|
|
11997
12127
|
breakouts,
|
|
11998
|
-
inBreakout
|
|
12128
|
+
inBreakout: inBreakoutProp,
|
|
11999
12129
|
onJoined,
|
|
12000
12130
|
onReturned,
|
|
12001
12131
|
style
|
|
12002
12132
|
}) {
|
|
12133
|
+
const native = "joinRoom" in breakouts ? breakouts : null;
|
|
12134
|
+
const inBreakout = inBreakoutProp ?? native?.inBreakout ?? false;
|
|
12003
12135
|
const { theme, text, muted, card } = useText2();
|
|
12004
12136
|
const s2 = breakouts.session;
|
|
12005
12137
|
const room = breakouts.myRoom;
|
|
@@ -12031,6 +12163,7 @@ function BreakoutBanner({
|
|
|
12031
12163
|
primary: true,
|
|
12032
12164
|
disabled: breakouts.pending,
|
|
12033
12165
|
onPress: async () => {
|
|
12166
|
+
if (native) return void await native.joinRoom(room.id);
|
|
12034
12167
|
const session = await breakouts.join(room.id);
|
|
12035
12168
|
if (session) onJoined?.(session);
|
|
12036
12169
|
}
|
|
@@ -12042,6 +12175,7 @@ function BreakoutBanner({
|
|
|
12042
12175
|
label: "Return to main",
|
|
12043
12176
|
disabled: breakouts.pending,
|
|
12044
12177
|
onPress: async () => {
|
|
12178
|
+
if (native) return void await native.returnToMainRoom();
|
|
12045
12179
|
const session = await breakouts.returnToMain();
|
|
12046
12180
|
if (session) onReturned?.(session);
|
|
12047
12181
|
}
|
|
@@ -12051,6 +12185,39 @@ function BreakoutBanner({
|
|
|
12051
12185
|
}
|
|
12052
12186
|
);
|
|
12053
12187
|
}
|
|
12188
|
+
function useNativeBreakouts(conversationId, callId, opts) {
|
|
12189
|
+
const optsRef = react.useRef(opts);
|
|
12190
|
+
optsRef.current = opts;
|
|
12191
|
+
const [inBreakout, setInBreakout] = react.useState(false);
|
|
12192
|
+
const move = react.useCallback(async (session, into) => {
|
|
12193
|
+
if (!session) return false;
|
|
12194
|
+
const ok = await optsRef.current.moveToRoom(session).catch(() => false);
|
|
12195
|
+
if (ok) setInBreakout(into);
|
|
12196
|
+
return ok;
|
|
12197
|
+
}, []);
|
|
12198
|
+
const breakouts = react$1.useBreakouts(conversationId, callId, {
|
|
12199
|
+
auto: opts.auto ?? true,
|
|
12200
|
+
onJoinRoom: (session, room) => {
|
|
12201
|
+
void move(session, true);
|
|
12202
|
+
optsRef.current.onJoinRoom?.(session, room);
|
|
12203
|
+
},
|
|
12204
|
+
onReturn: (session) => {
|
|
12205
|
+
void move(session, false);
|
|
12206
|
+
optsRef.current.onReturn?.(session);
|
|
12207
|
+
}
|
|
12208
|
+
});
|
|
12209
|
+
react.useEffect(() => setInBreakout(false), [callId]);
|
|
12210
|
+
const { join, returnToMain } = breakouts;
|
|
12211
|
+
const joinRoom = react.useCallback(
|
|
12212
|
+
async (roomId) => move(await join(roomId), true),
|
|
12213
|
+
[join, move]
|
|
12214
|
+
);
|
|
12215
|
+
const returnToMainRoom = react.useCallback(
|
|
12216
|
+
async () => move(await returnToMain(), false),
|
|
12217
|
+
[returnToMain, move]
|
|
12218
|
+
);
|
|
12219
|
+
return { ...breakouts, inBreakout, joinRoom, returnToMainRoom };
|
|
12220
|
+
}
|
|
12054
12221
|
function LobbyWaiting({ name, status, title, onLeave, style }) {
|
|
12055
12222
|
const { theme, text, muted } = useText2();
|
|
12056
12223
|
const headline = status === "denied" ? "The host didn\u2019t let you in" : status === "ended" ? "This meeting has ended" : status === "admitted" ? "You\u2019re in \u2014 joining\u2026" : "Waiting for the host to let you in";
|
|
@@ -12745,14 +12912,56 @@ function WhiteboardView({
|
|
|
12745
12912
|
}
|
|
12746
12913
|
);
|
|
12747
12914
|
}
|
|
12748
|
-
function AnnotationOverlay({
|
|
12915
|
+
function AnnotationOverlay({
|
|
12916
|
+
state,
|
|
12917
|
+
annotations,
|
|
12918
|
+
drawing = false,
|
|
12919
|
+
color = "#e5484d",
|
|
12920
|
+
style
|
|
12921
|
+
}) {
|
|
12749
12922
|
const [box, setBox] = react.useState({ w: 0, h: 0 });
|
|
12923
|
+
const stroke = react.useRef(null);
|
|
12924
|
+
const canDraw = drawing && !!annotations && box.w > 0 && box.h > 0;
|
|
12925
|
+
const pan = react.useMemo(
|
|
12926
|
+
() => reactNative.PanResponder.create({
|
|
12927
|
+
onStartShouldSetPanResponder: () => canDraw,
|
|
12928
|
+
onMoveShouldSetPanResponder: () => canDraw,
|
|
12929
|
+
onPanResponderGrant: (e) => {
|
|
12930
|
+
if (!annotations) return;
|
|
12931
|
+
const id = annotations.begin({ color });
|
|
12932
|
+
stroke.current = id;
|
|
12933
|
+
annotations.extend(id, e.nativeEvent.locationX / box.w, e.nativeEvent.locationY / box.h);
|
|
12934
|
+
},
|
|
12935
|
+
onPanResponderMove: (e) => {
|
|
12936
|
+
if (!annotations || !stroke.current) return;
|
|
12937
|
+
annotations.extend(
|
|
12938
|
+
stroke.current,
|
|
12939
|
+
e.nativeEvent.locationX / box.w,
|
|
12940
|
+
e.nativeEvent.locationY / box.h
|
|
12941
|
+
);
|
|
12942
|
+
},
|
|
12943
|
+
onPanResponderRelease: () => {
|
|
12944
|
+
if (annotations && stroke.current) annotations.end(stroke.current);
|
|
12945
|
+
stroke.current = null;
|
|
12946
|
+
},
|
|
12947
|
+
onPanResponderTerminate: () => {
|
|
12948
|
+
if (annotations && stroke.current) annotations.end(stroke.current);
|
|
12949
|
+
stroke.current = null;
|
|
12950
|
+
}
|
|
12951
|
+
}),
|
|
12952
|
+
[canDraw, annotations, color, box.w, box.h]
|
|
12953
|
+
);
|
|
12750
12954
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12751
12955
|
reactNative.View,
|
|
12752
12956
|
{
|
|
12753
12957
|
style: [reactNative.StyleSheet.absoluteFill, style],
|
|
12754
|
-
pointerEvents: "none",
|
|
12958
|
+
pointerEvents: canDraw ? "auto" : "none",
|
|
12755
12959
|
onLayout: (e) => setBox({ w: e.nativeEvent.layout.width, h: e.nativeEvent.layout.height }),
|
|
12960
|
+
...canDraw ? {
|
|
12961
|
+
...pan.panHandlers,
|
|
12962
|
+
accessible: true,
|
|
12963
|
+
accessibilityLabel: "Shared screen. Draw with one finger"
|
|
12964
|
+
} : {},
|
|
12756
12965
|
children: state && box.w > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(reactNativeSvg.Svg, { width: box.w, height: box.h, children: [
|
|
12757
12966
|
state.strokes.map((s2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12758
12967
|
reactNativeSvg.Path,
|
|
@@ -14218,6 +14427,7 @@ exports.useBackgroundClients = useBackgroundClients;
|
|
|
14218
14427
|
exports.useCallDuration = useCallDuration;
|
|
14219
14428
|
exports.useDisplayName = useDisplayName;
|
|
14220
14429
|
exports.useMessageExtras = useMessageExtras;
|
|
14430
|
+
exports.useNativeBreakouts = useNativeBreakouts;
|
|
14221
14431
|
exports.usePoolseTheme = usePoolseTheme;
|
|
14222
14432
|
exports.useTheme = useTheme;
|
|
14223
14433
|
//# sourceMappingURL=index.cjs.map
|