neoagent 3.1.1-beta.1 → 3.1.1-beta.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/package.json
CHANGED
package/server/admin/admin.js
CHANGED
|
@@ -1108,6 +1108,7 @@ async function saveBillingSetupConfig(event) {
|
|
|
1108
1108
|
} else {
|
|
1109
1109
|
showToast('Billing configuration saved — restart the server to apply changes', 'success');
|
|
1110
1110
|
setTimeout(loadBillingSetupConfig, 600);
|
|
1111
|
+
if (typeof refreshBillingNav === 'function') refreshBillingNav();
|
|
1111
1112
|
}
|
|
1112
1113
|
} catch (err) {
|
|
1113
1114
|
if (err.message !== 'unauthorized') showToast('Network error', 'error');
|
package/server/admin/billing.js
CHANGED
|
@@ -4,34 +4,54 @@ let _billingPlans = [];
|
|
|
4
4
|
let _billingSubsOffset = 0;
|
|
5
5
|
const BILLING_SUBS_LIMIT = 50;
|
|
6
6
|
|
|
7
|
+
async function billingIsEnabled() {
|
|
8
|
+
try {
|
|
9
|
+
const r = await fetch('/admin/api/config/billing-setup');
|
|
10
|
+
if (!r.ok) return false;
|
|
11
|
+
const data = await r.json();
|
|
12
|
+
return data.settings?.billingEnabled === true;
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function renderBillingDisabled() {
|
|
19
|
+
document.getElementById('billing-plans-content').innerHTML =
|
|
20
|
+
'<div class="empty">Billing is not enabled on this server.</div>';
|
|
21
|
+
document.getElementById('billing-subs-content').innerHTML = '';
|
|
22
|
+
const pagination = document.getElementById('billing-subs-pagination');
|
|
23
|
+
if (pagination) pagination.innerHTML = '';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function refreshBillingNav() {
|
|
27
|
+
const nav = document.getElementById('nav-billing');
|
|
28
|
+
if (!nav) return false;
|
|
29
|
+
const enabled = await billingIsEnabled();
|
|
30
|
+
nav.style.display = enabled ? '' : 'none';
|
|
31
|
+
return enabled;
|
|
32
|
+
}
|
|
33
|
+
|
|
7
34
|
async function loadBilling() {
|
|
8
|
-
|
|
35
|
+
if (!(await refreshBillingNav())) {
|
|
36
|
+
renderBillingDisabled();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
9
40
|
try {
|
|
10
41
|
const r = await fetch('/admin/api/billing/plans');
|
|
11
|
-
if (!r.ok)
|
|
12
|
-
document.getElementById('billing-plans-content').innerHTML =
|
|
13
|
-
'<div class="empty">Billing is not enabled on this server. Set <code>NEOAGENT_BILLING_ENABLED=1</code> to enable it.</div>';
|
|
14
|
-
document.getElementById('billing-subs-content').innerHTML = '';
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
42
|
+
if (!r.ok) throw new Error('plans unavailable');
|
|
17
43
|
const data = await r.json();
|
|
18
44
|
_billingPlans = data.plans || [];
|
|
19
45
|
renderPlansTable(_billingPlans);
|
|
20
46
|
} catch {
|
|
21
47
|
document.getElementById('billing-plans-content').innerHTML = '<div class="empty">Failed to load billing data.</div>';
|
|
48
|
+
return;
|
|
22
49
|
}
|
|
23
|
-
document.getElementById('nav-billing').style.display = '';
|
|
24
50
|
_billingSubsOffset = 0;
|
|
25
51
|
await loadBillingSubscriptions();
|
|
26
52
|
}
|
|
27
53
|
|
|
28
|
-
|
|
29
|
-
(async function checkBillingEnabled() {
|
|
30
|
-
try {
|
|
31
|
-
const r = await fetch('/admin/api/billing/plans');
|
|
32
|
-
if (r.ok) document.getElementById('nav-billing').style.display = '';
|
|
33
|
-
} catch {}
|
|
34
|
-
})();
|
|
54
|
+
refreshBillingNav();
|
|
35
55
|
|
|
36
56
|
function planRowHtml(plan) {
|
|
37
57
|
const id = escAttr(plan.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f7df01608b06990693a484c0623d8650
|
|
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"a10d8ac38de835021c8d2f920dbf50a920ccc0
|
|
|
37
37
|
|
|
38
38
|
_flutter.loader.load({
|
|
39
39
|
serviceWorkerSettings: {
|
|
40
|
-
serviceWorkerVersion: "
|
|
40
|
+
serviceWorkerVersion: "62998229" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -139076,7 +139076,7 @@ r===$&&A.b()
|
|
|
139076
139076
|
p.push(A.iT(q,A.ju(!1,new A.a_(B.vy,A.cN(new A.cA(B.jW,new A.a99(r,q),q),q,q),q),!1,B.I,!0),q,q,0,0,0,q))}r=!1
|
|
139077
139077
|
if(!s.ay)if(!s.ch){r=s.e
|
|
139078
139078
|
r===$&&A.b()
|
|
139079
|
-
r=B.b.p("
|
|
139079
|
+
r=B.b.p("mr21qa22-02cd7cc").length!==0&&r.b}if(r){r=s.d
|
|
139080
139080
|
r===$&&A.b()
|
|
139081
139081
|
r=r.aD&&!r.av?84:0
|
|
139082
139082
|
s=s.e
|
|
@@ -145436,7 +145436,7 @@ $S:0}
|
|
|
145436
145436
|
A.a0k.prototype={}
|
|
145437
145437
|
A.U2.prototype={
|
|
145438
145438
|
nm(a){var s=this
|
|
145439
|
-
if(B.b.p("
|
|
145439
|
+
if(B.b.p("mr21qa22-02cd7cc").length===0||s.a!=null)return
|
|
145440
145440
|
s.Bl()
|
|
145441
145441
|
s.a=A.m9(B.T5,new A.bgr(s))},
|
|
145442
145442
|
Bl(){var s=0,r=A.l(t.H),q,p=2,o=[],n=this,m,l,k,j,i,h,g,f
|
|
@@ -145454,7 +145454,7 @@ if(!t.f.b(k)){s=1
|
|
|
145454
145454
|
break}i=J.a1(k,"buildId")
|
|
145455
145455
|
h=i==null?null:B.b.p(J.p(i))
|
|
145456
145456
|
j=h==null?"":h
|
|
145457
|
-
if(J.be(j)===0||J.f(j,"
|
|
145457
|
+
if(J.be(j)===0||J.f(j,"mr21qa22-02cd7cc")){s=1
|
|
145458
145458
|
break}n.b=!0
|
|
145459
145459
|
n.E()
|
|
145460
145460
|
p=2
|
|
@@ -145471,7 +145471,7 @@ case 2:return A.i(o.at(-1),r)}})
|
|
|
145471
145471
|
return A.k($async$Bl,r)},
|
|
145472
145472
|
vW(){var s=0,r=A.l(t.H),q,p=2,o=[],n=this,m,l,k,j,i,h,g,f,e,d,c,b,a,a0,a1
|
|
145473
145473
|
var $async$vW=A.h(function(a2,a3){if(a2===1){o.push(a3)
|
|
145474
|
-
s=p}for(;;)switch(s){case 0:if(B.b.p("
|
|
145474
|
+
s=p}for(;;)switch(s){case 0:if(B.b.p("mr21qa22-02cd7cc").length===0||n.c){s=1
|
|
145475
145475
|
break}n.c=!0
|
|
145476
145476
|
n.E()
|
|
145477
145477
|
p=4
|
|
@@ -298,11 +298,10 @@ class WhatsAppPlatform extends BasePlatform {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
async markRead(chatId, messageId) {
|
|
301
|
-
if (!this.sock) return;
|
|
301
|
+
if (!this.sock || typeof this.sock.readMessages !== 'function' || !messageId) return;
|
|
302
302
|
const jid = toWhatsAppJid(chatId);
|
|
303
303
|
if (!jid) return;
|
|
304
|
-
|
|
305
|
-
await this.sock.sendReadReceipt(jid, null, [messageId]).catch(() => { });
|
|
304
|
+
await this.sock.readMessages([{ remoteJid: jid, id: messageId, fromMe: false }]).catch(() => { });
|
|
306
305
|
}
|
|
307
306
|
|
|
308
307
|
async sendTyping(chatId, isTyping) {
|