@linktr.ee/messaging-react 3.15.2 → 3.15.3
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/dist/{Card-D3a49RTT.cjs → Card-BGmgW1l2.cjs} +2 -2
- package/dist/{Card-D3a49RTT.cjs.map → Card-BGmgW1l2.cjs.map} +1 -1
- package/dist/{Card-CL8BkAA9.js → Card-CdouSSmP.js} +2 -2
- package/dist/{Card-CL8BkAA9.js.map → Card-CdouSSmP.js.map} +1 -1
- package/dist/{index-CGWNR062.js → index-B5xEngCd.js} +260 -260
- package/dist/index-B5xEngCd.js.map +1 -0
- package/dist/index-BfEoDUXO.cjs +2 -0
- package/dist/index-BfEoDUXO.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/CustomMessage/MessageTag.test.tsx +45 -0
- package/src/components/CustomMessage/MessageTag.tsx +12 -5
- package/dist/index-CGWNR062.js.map +0 -1
- package/dist/index-DBu8nDLG.cjs +0 -2
- package/dist/index-DBu8nDLG.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BfEoDUXO.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageBubble=e.MessageBubble;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;exports.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-
|
|
1
|
+
import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-B5xEngCd.js";
|
|
2
2
|
export {
|
|
3
3
|
e as ActionButton,
|
|
4
4
|
t as Avatar,
|
package/package.json
CHANGED
|
@@ -100,6 +100,51 @@ describe('MessageTag', () => {
|
|
|
100
100
|
expect(tipTag.closest('.message-tag--tip')).not.toBeNull()
|
|
101
101
|
})
|
|
102
102
|
|
|
103
|
+
it('renders tip standalone label for textless tip messages', () => {
|
|
104
|
+
renderWithProviders(
|
|
105
|
+
<MessageTag
|
|
106
|
+
message={createMockMessage({
|
|
107
|
+
text: '',
|
|
108
|
+
metadata: { custom_type: 'MESSAGE_TIP', amount_text: '$50.00' },
|
|
109
|
+
})}
|
|
110
|
+
standalone
|
|
111
|
+
/>
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
const tipTag = screen.getByText('$50.00 tip')
|
|
115
|
+
expect(tipTag.closest('.message-tip-standalone')).not.toBeNull()
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it('renders paid footer tag with message copy, not tip copy', () => {
|
|
119
|
+
renderWithProviders(
|
|
120
|
+
<MessageTag
|
|
121
|
+
message={createMockMessage({
|
|
122
|
+
metadata: { custom_type: 'MESSAGE_PAID', amount_text: '$10.00' },
|
|
123
|
+
})}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
const paidTag = screen.getByText('Delivered with $10.00 message')
|
|
128
|
+
expect(paidTag.closest('.message-tag--tip')).not.toBeNull()
|
|
129
|
+
expect(screen.queryByText(/tip/i)).toBeNull()
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('renders paid standalone label for textless paid messages', () => {
|
|
133
|
+
renderWithProviders(
|
|
134
|
+
<MessageTag
|
|
135
|
+
message={createMockMessage({
|
|
136
|
+
text: '',
|
|
137
|
+
metadata: { custom_type: 'MESSAGE_PAID', amount_text: '$25.00' },
|
|
138
|
+
})}
|
|
139
|
+
standalone
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
const paidTag = screen.getByText('$25.00 message')
|
|
144
|
+
expect(paidTag.closest('.message-tip-standalone')).not.toBeNull()
|
|
145
|
+
expect(screen.queryByText(/tip/i)).toBeNull()
|
|
146
|
+
})
|
|
147
|
+
|
|
103
148
|
it('returns null for non-custom messages', () => {
|
|
104
149
|
const { container } = renderWithProviders(
|
|
105
150
|
<MessageTag message={createMockMessage()} />
|
|
@@ -48,14 +48,20 @@ export const isAttachmentMessage = (message: LocalMessage): boolean => {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export const isTextAttachmentMessage = (message: LocalMessage): boolean => {
|
|
51
|
-
return
|
|
51
|
+
return (
|
|
52
|
+
isAttachmentMessage(message) &&
|
|
53
|
+
message.metadata?.attachment_content_type === 'text'
|
|
54
|
+
)
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
export const isMediaAttachmentMessage = (message: LocalMessage): boolean => {
|
|
55
|
-
return
|
|
58
|
+
return (
|
|
59
|
+
isAttachmentMessage(message) &&
|
|
60
|
+
message.metadata?.attachment_content_type !== 'text'
|
|
61
|
+
)
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
/** Check if a message has a tip
|
|
64
|
+
/** Check if a message has a tip or paid tag (shared layout, distinct copy) */
|
|
59
65
|
export const isTipOrPaidMessage = (message: LocalMessage): boolean => {
|
|
60
66
|
return isTipMessage(message) || isPaidMessage(message)
|
|
61
67
|
}
|
|
@@ -86,9 +92,10 @@ export const MessageTag = ({
|
|
|
86
92
|
? 'message-tip-standalone'
|
|
87
93
|
: 'message-tag message-tag--tip'
|
|
88
94
|
|
|
95
|
+
const amountLabel = isPaidMessage(message) ? 'message' : 'tip'
|
|
89
96
|
const label = standalone
|
|
90
|
-
? `${amountText}
|
|
91
|
-
: `Delivered with ${amountText}
|
|
97
|
+
? `${amountText} ${amountLabel}`
|
|
98
|
+
: `Delivered with ${amountText} ${amountLabel}`
|
|
92
99
|
|
|
93
100
|
return (
|
|
94
101
|
<div className={className}>
|