@tetsuo-ai/marketplace-react 0.1.0 → 0.1.1

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.
@@ -121,6 +121,13 @@ var EN_COMPONENT_STRINGS = {
121
121
  "components.provider.provisional": "provisional",
122
122
  "components.provider.noData": "No track record yet.",
123
123
  "components.provider.unavailable": "Track record is unavailable on this read transport.",
124
+ // Domain trust (P7.3) — VERIFIED is an on-chain attestation; CLAIMED is the
125
+ // operator's self-reported metadata. The copy keeps them distinct so a buyer
126
+ // never reads an unverified claim as a proven one.
127
+ "components.provider.verifiedDomain": "Verified: {domain}",
128
+ "components.provider.verifiedDomainLabel": "Verified domain {domain}",
129
+ "components.provider.claimedDomain": "Claims: {domain}",
130
+ "components.provider.claimedDomainLabel": "Claimed domain {domain} (not verified on-chain)",
124
131
  // PoweredByAgenC.
125
132
  "components.poweredBy.label": "Powered by AgenC",
126
133
  "components.poweredBy.trustLink": "Learn how this works"
@@ -1174,9 +1181,90 @@ function DisputeBanner({
1174
1181
  ) : null
1175
1182
  ] });
1176
1183
  }
1184
+ var UNVERIFIED = Object.freeze({
1185
+ verified: false
1186
+ });
1187
+ function evaluateAgentVerification(account, nowSeconds) {
1188
+ if (!account) return UNVERIFIED;
1189
+ if (account.revoked) return UNVERIFIED;
1190
+ if (account.expiresAt !== 0n && nowSeconds >= account.expiresAt) {
1191
+ return UNVERIFIED;
1192
+ }
1193
+ return {
1194
+ verified: true,
1195
+ domain: account.verifiedDomain,
1196
+ method: account.method,
1197
+ verifiedBy: account.verifiedBy,
1198
+ verifiedAt: account.verifiedAt,
1199
+ expiresAt: account.expiresAt,
1200
+ revoked: false
1201
+ };
1202
+ }
1203
+ function defaultNow() {
1204
+ return BigInt(Math.floor(Date.now() / 1e3));
1205
+ }
1206
+ function agentVerificationReaderFromRpc(rpc, options) {
1207
+ const now = options?.now ?? defaultNow;
1208
+ return async (agentPda) => {
1209
+ const [pda] = await marketplaceSdk.findAgentVerificationPda({ agent: agentPda });
1210
+ const maybe = await marketplaceSdk.fetchMaybeAgentVerification(rpc, pda);
1211
+ return evaluateAgentVerification(maybe.exists ? maybe.data : null, now());
1212
+ };
1213
+ }
1214
+ function useAgentVerification(agentPda, options) {
1215
+ const reader = options?.reader;
1216
+ const enabled = (options?.enabled ?? true) && Boolean(agentPda) && Boolean(reader);
1217
+ const query = reactQuery.useQuery({
1218
+ queryKey: ["agenc", "agentVerification", agentPda ? String(agentPda) : ""],
1219
+ enabled,
1220
+ queryFn: async () => {
1221
+ return reader(agentPda);
1222
+ }
1223
+ });
1224
+ const verification = query.error ? UNVERIFIED : query.data ?? UNVERIFIED;
1225
+ return {
1226
+ verification,
1227
+ verified: verification.verified,
1228
+ isLoading: query.isLoading && enabled,
1229
+ error: query.error ?? null,
1230
+ refetch: () => void query.refetch()
1231
+ };
1232
+ }
1233
+ function VerifiedDomainBadge({
1234
+ domain,
1235
+ unstyled
1236
+ }) {
1237
+ return /* @__PURE__ */ jsxRuntime.jsx(
1238
+ Badge,
1239
+ {
1240
+ tone: "success",
1241
+ unstyled,
1242
+ className: unstyled ? void 0 : "agenc-provider__domain agenc-provider__domain--verified",
1243
+ label: tc("components.provider.verifiedDomainLabel", { domain }),
1244
+ children: tc("components.provider.verifiedDomain", { domain })
1245
+ }
1246
+ );
1247
+ }
1248
+ function ClaimedDomainBadge({
1249
+ domain,
1250
+ unstyled
1251
+ }) {
1252
+ return /* @__PURE__ */ jsxRuntime.jsx(
1253
+ Badge,
1254
+ {
1255
+ tone: "neutral",
1256
+ unstyled,
1257
+ className: unstyled ? void 0 : "agenc-provider__domain agenc-provider__domain--claimed",
1258
+ label: tc("components.provider.claimedDomainLabel", { domain }),
1259
+ children: tc("components.provider.claimedDomain", { domain })
1260
+ }
1261
+ );
1262
+ }
1177
1263
  function ProviderCard({
1178
1264
  agent,
1179
1265
  trackRecord,
1266
+ verification = UNVERIFIED,
1267
+ operatorDomain,
1180
1268
  verified = false,
1181
1269
  isLoading = false,
1182
1270
  error = null,
@@ -1185,12 +1273,19 @@ function ProviderCard({
1185
1273
  className
1186
1274
  }) {
1187
1275
  const cardClass = rootClass("agenc-provider", unstyled, className);
1276
+ const isVerified = verification.verified || verification === UNVERIFIED && verified;
1277
+ const verifiedDomain = verification.verified ? verification.domain : null;
1278
+ const claimed = typeof operatorDomain === "string" && operatorDomain.trim() !== "" ? operatorDomain.trim() : null;
1279
+ const domainBadge = verifiedDomain ? /* @__PURE__ */ jsxRuntime.jsx(VerifiedDomainBadge, { domain: verifiedDomain, unstyled }) : claimed ? /* @__PURE__ */ jsxRuntime.jsx(ClaimedDomainBadge, { domain: claimed, unstyled }) : null;
1188
1280
  const header = /* @__PURE__ */ jsxRuntime.jsxs("header", { className: unstyled ? void 0 : "agenc-provider__header", children: [
1189
1281
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__id", children: [
1190
1282
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-provider__label", children: tc("components.provider.title") }),
1191
1283
  agent ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-provider__pda", children: truncateAddress(agent) }) : null
1192
1284
  ] }),
1193
- /* @__PURE__ */ jsxRuntime.jsx(VerifiedBadge, { verified, unstyled })
1285
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__badges", children: [
1286
+ domainBadge,
1287
+ /* @__PURE__ */ jsxRuntime.jsx(VerifiedBadge, { verified: isVerified, unstyled })
1288
+ ] })
1194
1289
  ] });
1195
1290
  if (error) {
1196
1291
  return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
@@ -1316,12 +1411,15 @@ exports.ReviewPanel = ReviewPanel;
1316
1411
  exports.Spinner = Spinner;
1317
1412
  exports.StateMessage = StateMessage;
1318
1413
  exports.TaskTimeline = TaskTimeline;
1414
+ exports.UNVERIFIED = UNVERIFIED;
1319
1415
  exports.VerifiedBadge = VerifiedBadge;
1416
+ exports.agentVerificationReaderFromRpc = agentVerificationReaderFromRpc;
1320
1417
  exports.cx = cx;
1321
1418
  exports.decodeListingCategory = decodeListingCategory;
1322
1419
  exports.decodeListingName = decodeListingName;
1323
1420
  exports.decodeListingTags = decodeListingTags;
1324
1421
  exports.elementClass = elementClass;
1422
+ exports.evaluateAgentVerification = evaluateAgentVerification;
1325
1423
  exports.formatPriceSol = formatPriceSol;
1326
1424
  exports.formatRate = formatRate;
1327
1425
  exports.formatSol = formatSol;
@@ -1330,6 +1428,7 @@ exports.rootClass = rootClass;
1330
1428
  exports.tc = tc;
1331
1429
  exports.toHex = toHex;
1332
1430
  exports.truncateAddress = truncateAddress;
1431
+ exports.useAgentVerification = useAgentVerification;
1333
1432
  exports.useFocusTrap = useFocusTrap;
1334
1433
  //# sourceMappingURL=index.cjs.map
1335
1434
  //# sourceMappingURL=index.cjs.map