satyamark-react 0.0.8 → 0.0.9
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/index.js +15 -19
- package/dist/index.mjs +15 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -212,7 +212,7 @@ var import_ai = __toESM(require("./ai-J46U5IDK.png"));
|
|
|
212
212
|
var import_nonai = __toESM(require("./nonai-LPEFMQBT.png"));
|
|
213
213
|
var jobMap = {};
|
|
214
214
|
var DEFAULT_ICON_SIZE = 20;
|
|
215
|
-
var satyamark_url = "https://satyamark.vercel.app/";
|
|
215
|
+
var satyamark_url = "https://satyamark.vercel.app/chat";
|
|
216
216
|
var iconMap = {
|
|
217
217
|
verifyable: import_verifyable.default,
|
|
218
218
|
unverifyable: import_unverifyable.default,
|
|
@@ -231,26 +231,25 @@ function registerStatus(jobId, rootElement, options = {}) {
|
|
|
231
231
|
};
|
|
232
232
|
updateIcon(jobId, "pending", null);
|
|
233
233
|
}
|
|
234
|
-
function updateIcon(jobId,
|
|
234
|
+
function updateIcon(jobId, rawMark, data) {
|
|
235
235
|
const entry = jobMap[jobId];
|
|
236
236
|
if (!entry)
|
|
237
237
|
return;
|
|
238
238
|
const { root, iconSize } = entry;
|
|
239
|
+
const mark = rawMark != null ? rawMark : "pending";
|
|
239
240
|
const container = root.querySelector("[data-satyamark-status-container]");
|
|
240
241
|
if (!container)
|
|
241
242
|
return;
|
|
243
|
+
container.innerHTML = "";
|
|
242
244
|
container.style.position = "relative";
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
icon.style.objectFit = "contain";
|
|
248
|
-
icon.style.display = "block";
|
|
249
|
-
container.appendChild(icon);
|
|
250
|
-
}
|
|
245
|
+
const icon = document.createElement("img");
|
|
246
|
+
icon.alt = "status";
|
|
247
|
+
icon.style.objectFit = "contain";
|
|
248
|
+
icon.style.display = "block";
|
|
251
249
|
icon.style.width = iconSize + "px";
|
|
252
250
|
icon.style.height = iconSize + "px";
|
|
253
251
|
icon.src = iconMap[mark] || iconMap["pending"];
|
|
252
|
+
container.appendChild(icon);
|
|
254
253
|
const type = data == null ? void 0 : data.type;
|
|
255
254
|
const isValidType = type === "text" || type === "image";
|
|
256
255
|
const isClickable = !!(data == null ? void 0 : data.dataId) && isValidType && mark !== "pending";
|
|
@@ -273,14 +272,14 @@ function updateIcon(jobId, mark, data) {
|
|
|
273
272
|
container.appendChild(tooltip);
|
|
274
273
|
}
|
|
275
274
|
tooltip.textContent = mark.toUpperCase();
|
|
275
|
+
icon.onmouseenter = () => {
|
|
276
|
+
tooltip.style.opacity = "1";
|
|
277
|
+
};
|
|
278
|
+
icon.onmouseleave = () => {
|
|
279
|
+
tooltip.style.opacity = "0";
|
|
280
|
+
};
|
|
276
281
|
if (isClickable) {
|
|
277
282
|
icon.style.cursor = "pointer";
|
|
278
|
-
icon.onmouseenter = () => {
|
|
279
|
-
tooltip.style.opacity = "1";
|
|
280
|
-
};
|
|
281
|
-
icon.onmouseleave = () => {
|
|
282
|
-
tooltip.style.opacity = "0";
|
|
283
|
-
};
|
|
284
283
|
icon.onclick = () => {
|
|
285
284
|
window.open(
|
|
286
285
|
`${satyamark_url}/${type}/${data.dataId}`,
|
|
@@ -290,9 +289,6 @@ function updateIcon(jobId, mark, data) {
|
|
|
290
289
|
} else {
|
|
291
290
|
icon.style.cursor = "default";
|
|
292
291
|
icon.onclick = null;
|
|
293
|
-
icon.onmouseenter = null;
|
|
294
|
-
icon.onmouseleave = null;
|
|
295
|
-
tooltip.style.opacity = "0";
|
|
296
292
|
}
|
|
297
293
|
}
|
|
298
294
|
onReceive((data) => {
|
package/dist/index.mjs
CHANGED
|
@@ -170,7 +170,7 @@ import aiIcon from "./ai-J46U5IDK.png";
|
|
|
170
170
|
import nonaiIcon from "./nonai-LPEFMQBT.png";
|
|
171
171
|
var jobMap = {};
|
|
172
172
|
var DEFAULT_ICON_SIZE = 20;
|
|
173
|
-
var satyamark_url = "https://satyamark.vercel.app/";
|
|
173
|
+
var satyamark_url = "https://satyamark.vercel.app/chat";
|
|
174
174
|
var iconMap = {
|
|
175
175
|
verifyable: verifyableIcon,
|
|
176
176
|
unverifyable: unverifyableIcon,
|
|
@@ -189,26 +189,25 @@ function registerStatus(jobId, rootElement, options = {}) {
|
|
|
189
189
|
};
|
|
190
190
|
updateIcon(jobId, "pending", null);
|
|
191
191
|
}
|
|
192
|
-
function updateIcon(jobId,
|
|
192
|
+
function updateIcon(jobId, rawMark, data) {
|
|
193
193
|
const entry = jobMap[jobId];
|
|
194
194
|
if (!entry)
|
|
195
195
|
return;
|
|
196
196
|
const { root, iconSize } = entry;
|
|
197
|
+
const mark = rawMark != null ? rawMark : "pending";
|
|
197
198
|
const container = root.querySelector("[data-satyamark-status-container]");
|
|
198
199
|
if (!container)
|
|
199
200
|
return;
|
|
201
|
+
container.innerHTML = "";
|
|
200
202
|
container.style.position = "relative";
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
icon.style.objectFit = "contain";
|
|
206
|
-
icon.style.display = "block";
|
|
207
|
-
container.appendChild(icon);
|
|
208
|
-
}
|
|
203
|
+
const icon = document.createElement("img");
|
|
204
|
+
icon.alt = "status";
|
|
205
|
+
icon.style.objectFit = "contain";
|
|
206
|
+
icon.style.display = "block";
|
|
209
207
|
icon.style.width = iconSize + "px";
|
|
210
208
|
icon.style.height = iconSize + "px";
|
|
211
209
|
icon.src = iconMap[mark] || iconMap["pending"];
|
|
210
|
+
container.appendChild(icon);
|
|
212
211
|
const type = data == null ? void 0 : data.type;
|
|
213
212
|
const isValidType = type === "text" || type === "image";
|
|
214
213
|
const isClickable = !!(data == null ? void 0 : data.dataId) && isValidType && mark !== "pending";
|
|
@@ -231,14 +230,14 @@ function updateIcon(jobId, mark, data) {
|
|
|
231
230
|
container.appendChild(tooltip);
|
|
232
231
|
}
|
|
233
232
|
tooltip.textContent = mark.toUpperCase();
|
|
233
|
+
icon.onmouseenter = () => {
|
|
234
|
+
tooltip.style.opacity = "1";
|
|
235
|
+
};
|
|
236
|
+
icon.onmouseleave = () => {
|
|
237
|
+
tooltip.style.opacity = "0";
|
|
238
|
+
};
|
|
234
239
|
if (isClickable) {
|
|
235
240
|
icon.style.cursor = "pointer";
|
|
236
|
-
icon.onmouseenter = () => {
|
|
237
|
-
tooltip.style.opacity = "1";
|
|
238
|
-
};
|
|
239
|
-
icon.onmouseleave = () => {
|
|
240
|
-
tooltip.style.opacity = "0";
|
|
241
|
-
};
|
|
242
241
|
icon.onclick = () => {
|
|
243
242
|
window.open(
|
|
244
243
|
`${satyamark_url}/${type}/${data.dataId}`,
|
|
@@ -248,9 +247,6 @@ function updateIcon(jobId, mark, data) {
|
|
|
248
247
|
} else {
|
|
249
248
|
icon.style.cursor = "default";
|
|
250
249
|
icon.onclick = null;
|
|
251
|
-
icon.onmouseenter = null;
|
|
252
|
-
icon.onmouseleave = null;
|
|
253
|
-
tooltip.style.opacity = "0";
|
|
254
250
|
}
|
|
255
251
|
}
|
|
256
252
|
onReceive((data) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "satyamark-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Official React SDK for SatyaMark — a lightweight UI library to embed transparent content verification marks, confidence indicators, and trust signals into React applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "DK",
|