node-red-contrib-vectorprime 0.1.18 → 0.1.20

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 (2) hide show
  1. package/package.json +1 -1
  2. package/vectorprime.html +22 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-vectorprime",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "VectorPrime Decision Kernel node for Node-RED",
5
5
  "main": "vectorprime.js",
6
6
  "license": "MIT",
package/vectorprime.html CHANGED
@@ -9,6 +9,14 @@
9
9
  <input type="text" id="node-config-input-baseUrl" placeholder="https://vectorprime-kernel-backend.onrender.com">
10
10
  </div>
11
11
 
12
+ <!-- ✅ REQUIRED: email for /v1/billing/signup -->
13
+ <div class="form-row">
14
+ <label for="node-config-input-email">
15
+ <i class="fa fa-envelope"></i> Email
16
+ </label>
17
+ <input type="text" id="node-config-input-email" placeholder="you@example.com">
18
+ </div>
19
+
12
20
  <div class="form-row">
13
21
  <label for="node-config-input-apiKey">
14
22
  <i class="fa fa-key"></i> API Key
@@ -42,7 +50,8 @@
42
50
  RED.nodes.registerType("vectorprime-config", {
43
51
  category: "config",
44
52
  defaults: {
45
- baseUrl: { value: "https://vectorprime-kernel-backend.onrender.com", required: true }
53
+ baseUrl: { value: "https://vectorprime-kernel-backend.onrender.com", required: true },
54
+ email: { value: "", required: true }
46
55
  },
47
56
  credentials: {
48
57
  apiKey: { type: "password" }
@@ -61,9 +70,11 @@
61
70
 
62
71
  try {
63
72
  const baseUrlInput = document.getElementById("node-config-input-baseUrl");
73
+ const emailInput = document.getElementById("node-config-input-email");
64
74
  const apiKeyInput = document.getElementById("node-config-input-apiKey");
65
75
 
66
76
  const baseUrl = normalizeBaseUrl(baseUrlInput.value);
77
+ const email = ((emailInput && emailInput.value) ? emailInput.value : "").trim();
67
78
 
68
79
  if (!baseUrl.startsWith("http")) {
69
80
  statusEl.textContent = "❌ Base URL missing/invalid";
@@ -71,12 +82,17 @@
71
82
  return;
72
83
  }
73
84
 
74
- // Call backend directly from the editor
75
- const resp = await fetch(`${baseUrl}/v1/keys/create`, {
85
+ if (!email || !email.includes("@")) {
86
+ statusEl.textContent = "❌ Enter a valid email";
87
+ statusEl.style.color = "red";
88
+ return;
89
+ }
76
90
 
91
+ // ✅ Call REAL backend endpoint that exists (per /openapi.json)
92
+ const resp = await fetch(`${baseUrl}/v1/billing/signup`, {
77
93
  method: "POST",
78
94
  headers: { "Content-Type": "application/json" },
79
- body: JSON.stringify({})
95
+ body: JSON.stringify({ email: email })
80
96
  });
81
97
 
82
98
  const text = await resp.text();
@@ -84,7 +100,7 @@
84
100
  try { data = JSON.parse(text); } catch { data = { raw: text }; }
85
101
 
86
102
  if (!resp.ok) {
87
- statusEl.textContent = `❌ Failed (${resp.status}): ${data.message || data.error || "unknown"}`;
103
+ statusEl.textContent = `❌ Failed (${resp.status}): ${data.message || data.error || data.detail || "unknown"}`;
88
104
  statusEl.style.color = "red";
89
105
  return;
90
106
  }
@@ -115,6 +131,7 @@
115
131
  <h3>Quick Setup</h3>
116
132
  <ol>
117
133
  <li>Set <b>Base URL</b> (default is already correct)</li>
134
+ <li>Enter your <b>Email</b></li>
118
135
  <li>Click <b>Get Free Key</b></li>
119
136
  <li>Click <b>Done</b></li>
120
137
  </ol>