@subiz/widget-v4 4.1.82 → 4.1.84
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/compiled_src/bot.js +1 -1
- package/compiled_src/call/call.js +2 -2
- package/compiled_src/chatbox/AgentsAvatar.js +1 -1
- package/compiled_src/chatbox/AudioAttachments.js +1 -1
- package/compiled_src/chatbox/ButtonAttachments.js +1 -1
- package/compiled_src/chatbox/Buttons.js +1 -1
- package/compiled_src/chatbox/ChatButton.js +8 -30
- package/compiled_src/chatbox/DropdownSelect.js +2 -2
- package/compiled_src/chatbox/Emoji.js +1 -1
- package/compiled_src/chatbox/Event.js +1 -1
- package/compiled_src/chatbox/Events.js +1 -1
- package/compiled_src/chatbox/FileAttachments.js +1 -1
- package/compiled_src/chatbox/FormAttachment.js +1 -1
- package/compiled_src/chatbox/FormAttachments.js +1 -1
- package/compiled_src/chatbox/FormSubmitAttachments.js +1 -1
- package/compiled_src/chatbox/GenericTemplateAttachments.js +1 -1
- package/compiled_src/chatbox/Header.js +1 -1
- package/compiled_src/chatbox/ImageAttachments.js +2 -2
- package/compiled_src/chatbox/InfoMessage.js +1 -1
- package/compiled_src/chatbox/ListField.js +1 -1
- package/compiled_src/chatbox/MessageInput.js +2 -2
- package/compiled_src/chatbox/Order.js +2 -2
- package/compiled_src/chatbox/OrderAttachments.js +1 -1
- package/compiled_src/chatbox/ProductAttachments.js +1 -1
- package/compiled_src/chatbox/QuickReplies.js +1 -1
- package/compiled_src/chatbox/Rating.js +2 -2
- package/compiled_src/chatbox/TextMessage.js +18 -97
- package/compiled_src/chatbox/Typing.js +1 -1
- package/compiled_src/chatbox/VideoAttachments.js +1 -1
- package/compiled_src/chatbox/Widget.js +2 -2
- package/compiled_src/chatbox/block.js +152 -0
- package/compiled_src/chatbox/main.js +1 -1
- package/compiled_src/chatbox/releaseAnimation.js +1 -1
- package/compiled_src/chatbox/time.js +1 -1
- package/compiled_src/common.js +1 -1
- package/compiled_src/contact/contact.js +2 -2
- package/compiled_src/lib.js +2 -2
- package/compiled_src/notif/notif.js +37 -37
- package/compiled_src/order/address_picker.js +2 -2
- package/compiled_src/order/icon.js +1 -1
- package/compiled_src/order/index.js +1 -1
- package/compiled_src/order/order.js +2 -2
- package/compiled_src/plugin.js +1 -1
- package/compiled_src/popup/countdown.js +2 -2
- package/compiled_src/popup/popup.js +2 -2
- package/compiled_src/popup/tick.core.commonjs.js +1 -1
- package/compiled_src/store/api.js +2 -2
- package/compiled_src/store/api_fake.js +2 -2
- package/compiled_src/store/store.js +2 -2
- package/compiled_src/util/common.js +174 -1
- package/compiled_src/util/index.js +0 -2
- package/dist/127.js +273 -0
- package/dist/132.js +2569 -6434
- package/dist/185.js +1885 -0
- package/dist/19077b40b00.127.js +1 -0
- package/dist/19077b40b00.132.js +1 -0
- package/dist/19077b40b00.185.js +1 -0
- package/dist/19077b40b00.27.js +1 -0
- package/dist/19077b40b00.278.js +1 -0
- package/dist/19077b40b00.459.js +1 -0
- package/dist/19077b40b00.490.js +1 -0
- package/dist/19077b40b00.74.js +1 -0
- package/dist/19077b40b00.997.js +1 -0
- package/dist/19077b40b00.app.js +1 -0
- package/dist/{18a02a9c54e.index.html → 19077b40b00.index.html} +4 -4
- package/dist/{18a02a9c54e.library.html → 19077b40b00.library.html} +4 -4
- package/dist/19077b40b00.library.js +1 -0
- package/dist/{18a02a9c54e.preview.html → 19077b40b00.preview.html} +1 -1
- package/dist/19077b40b00.preview.js +1 -0
- package/dist/19077b40b00.screenshoot.js +1 -0
- package/dist/19077b40b00.webview.js +1 -0
- package/dist/{782.js → 27.js} +7 -7
- package/dist/278.js +406 -0
- package/dist/{362.js → 459.js} +7 -7
- package/dist/{605.js → 490.js} +60 -61
- package/dist/{335.js → 74.js} +35 -35
- package/dist/{678.js → 997.js} +6 -6
- package/dist/HASH +1 -1
- package/dist/malicious-app.js +6 -4
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +5690 -1605
- package/package.json +1 -1
- package/src/chatbox/ChatButton.js +5 -36
- package/src/chatbox/Emoji.js +1 -1
- package/src/chatbox/TextMessage.js +18 -96
- package/src/chatbox/block.js +161 -0
- package/src/common.js +2 -10
- package/src/notif/notif.js +30 -43
- package/src/util/common.js +224 -0
- package/src/util/index.js +0 -3
- package/compiled_src/util/extractor.js +0 -136
- package/dist/178.js +0 -406
- package/dist/18a02a9c54e.132.js +0 -1
- package/dist/18a02a9c54e.178.js +0 -1
- package/dist/18a02a9c54e.213.js +0 -1
- package/dist/18a02a9c54e.335.js +0 -1
- package/dist/18a02a9c54e.362.js +0 -1
- package/dist/18a02a9c54e.441.js +0 -1
- package/dist/18a02a9c54e.605.js +0 -1
- package/dist/18a02a9c54e.678.js +0 -1
- package/dist/18a02a9c54e.782.js +0 -1
- package/dist/18a02a9c54e.app.js +0 -1
- package/dist/18a02a9c54e.library.js +0 -1
- package/dist/18a02a9c54e.preview.js +0 -1
- package/dist/18a02a9c54e.screenshoot.js +0 -1
- package/dist/18a02a9c54e.webview.js +0 -1
- package/dist/213.js +0 -2780
- package/dist/441.js +0 -2855
- package/src/util/extractor.js +0 -166
package/src/util/extractor.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
var common = require('./common.js')
|
|
2
|
-
|
|
3
|
-
let emojis = [
|
|
4
|
-
'like',
|
|
5
|
-
'unlike',
|
|
6
|
-
'wink',
|
|
7
|
-
'tongue-out',
|
|
8
|
-
'tired',
|
|
9
|
-
'surprised',
|
|
10
|
-
'smiling',
|
|
11
|
-
'sleepy',
|
|
12
|
-
'sad',
|
|
13
|
-
'neutral',
|
|
14
|
-
'heart-eyes',
|
|
15
|
-
'grinning',
|
|
16
|
-
'crying',
|
|
17
|
-
'confused',
|
|
18
|
-
'angry',
|
|
19
|
-
|
|
20
|
-
'cry',
|
|
21
|
-
'heart_eyes',
|
|
22
|
-
'neutral_face',
|
|
23
|
-
'emoji--disappointed',
|
|
24
|
-
'smile',
|
|
25
|
-
'open_mouth',
|
|
26
|
-
'tired_face',
|
|
27
|
-
'stuck_out_tongue',
|
|
28
|
-
'moyai',
|
|
29
|
-
'thumbsdown',
|
|
30
|
-
'dislike',
|
|
31
|
-
'thumbsup',
|
|
32
|
-
'ok_hand',
|
|
33
|
-
'octopus',
|
|
34
|
-
'pig2',
|
|
35
|
-
'wave',
|
|
36
|
-
'mouse',
|
|
37
|
-
'mouse2',
|
|
38
|
-
'rat',
|
|
39
|
-
]
|
|
40
|
-
emojis = common.map(emojis, e => ':' + e + ':')
|
|
41
|
-
|
|
42
|
-
export function extractEmojis (text) {
|
|
43
|
-
var out = []
|
|
44
|
-
for (var i = 0; i < text.length; i++) {
|
|
45
|
-
for (var e = 0; e < emojis.length; e++) {
|
|
46
|
-
if (text.indexOf(emojis[e], i) !== i) continue
|
|
47
|
-
out.push({ index: i, length: emojis[e].length })
|
|
48
|
-
i += emojis[e].length - 1
|
|
49
|
-
break
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return out
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function extractLinks (text) {
|
|
57
|
-
text = text || ''
|
|
58
|
-
var reg = /(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.,~#?&//=]*)/gim
|
|
59
|
-
var out = []
|
|
60
|
-
var match
|
|
61
|
-
while ((match = reg.exec(text))) {
|
|
62
|
-
out.push({ index: match.index, length: reg.lastIndex - match.index })
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return out
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function extractEmails (text) {
|
|
69
|
-
text = text || ''
|
|
70
|
-
var reg = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/gim
|
|
71
|
-
|
|
72
|
-
var out = []
|
|
73
|
-
var match
|
|
74
|
-
while ((match = reg.exec(text))) {
|
|
75
|
-
out.push({ index: match.index, length: reg.lastIndex - match.index })
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return out
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function extractPhones (msg) {
|
|
82
|
-
msg = msg || ''
|
|
83
|
-
var fgmsg = ''
|
|
84
|
-
// fine-grained msg
|
|
85
|
-
// remove '-' in number-number
|
|
86
|
-
// remove ' ' in number number
|
|
87
|
-
// remove '.' in number.number
|
|
88
|
-
|
|
89
|
-
var realchmap = {}
|
|
90
|
-
for (var i = 0; i < msg.length; i++) {
|
|
91
|
-
var ch = msg.charAt(i)
|
|
92
|
-
|
|
93
|
-
if (ch !== '.' && ch !== '-' && ch !== ' ') {
|
|
94
|
-
fgmsg += ch
|
|
95
|
-
realchmap[fgmsg.length - 1] = i
|
|
96
|
-
continue
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
var prevCh = i > 0 ? msg.charAt(i - 1) : '-'
|
|
100
|
-
var nextCh = i < msg.length - 1 ? msg.charAt(i + 1) : '-'
|
|
101
|
-
|
|
102
|
-
if ('0123456789'.indexOf(prevCh) !== -1 && '0123456789'.indexOf(nextCh) !== -1) continue
|
|
103
|
-
fgmsg += ch
|
|
104
|
-
realchmap[fgmsg.length - 1] = i
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
var reg = /([0-9]{8,13})/gim
|
|
108
|
-
|
|
109
|
-
var out = []
|
|
110
|
-
var match
|
|
111
|
-
while ((match = reg.exec(fgmsg))) {
|
|
112
|
-
out.push({ index: realchmap[match.index], length: realchmap[reg.lastIndex - 1] - realchmap[match.index] + 1 })
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return out
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function extract (text, extractor, type) {
|
|
119
|
-
if (!text) return []
|
|
120
|
-
var out = []
|
|
121
|
-
var lastindex = 0
|
|
122
|
-
var tags = extractor(text)
|
|
123
|
-
if (common.size(tags) === 0) return [{ type: 'text', text }]
|
|
124
|
-
common.each(tags, tag => {
|
|
125
|
-
out.push({ type: 'text', text: text.substr(lastindex, tag.index - lastindex) })
|
|
126
|
-
out.push({ type, text: text.substr(tag.index, tag.length) })
|
|
127
|
-
lastindex = tag.index + tag.length
|
|
128
|
-
})
|
|
129
|
-
var lastTag = common.last(tags)
|
|
130
|
-
out.push({
|
|
131
|
-
type: 'text',
|
|
132
|
-
text: text.substr(lastTag.index + lastTag.length, text.length - lastTag.index + lastTag.length),
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
return common.filter(out, o => o.text !== '')
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function pipeExtracts (text, extractors) {
|
|
139
|
-
var out = []
|
|
140
|
-
if (common.size(extractors) === 0) return [{ type: 'text', text }]
|
|
141
|
-
var ext = extractors.shift()
|
|
142
|
-
|
|
143
|
-
var tags = extract(text, ext, ext.type)
|
|
144
|
-
common.each(tags, t => {
|
|
145
|
-
if (t.type !== 'text') return out.push(t)
|
|
146
|
-
out = out.concat(pipeExtracts(t.text, extractors.slice()))
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
return out
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export function extractText (text) {
|
|
153
|
-
var link = extractLinks
|
|
154
|
-
link.type = 'link'
|
|
155
|
-
|
|
156
|
-
var email = extractEmails
|
|
157
|
-
email.type = 'email'
|
|
158
|
-
|
|
159
|
-
var phone = extractPhones
|
|
160
|
-
phone.type = 'phone'
|
|
161
|
-
|
|
162
|
-
var emoji = extractEmojis
|
|
163
|
-
emoji.type = 'emoji'
|
|
164
|
-
|
|
165
|
-
return pipeExtracts(text, [email, link, phone, emoji])
|
|
166
|
-
}
|