c2pa-react-cawg-component 0.1.11 → 0.1.13
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/README.md +41 -0
- package/dist/c2pa-react-cawg-component.css +1 -1
- package/dist/c2pa-react-cawg-component.js +309 -184
- package/dist/c2pa-react-cawg-component.umd.cjs +1 -1
- package/dist/components/Cawg/helper/TrustBadge.d.ts +9 -0
- package/dist/components/Cawg/helper/getBestUserName.d.ts +10 -0
- package/dist/components/Cawg/helper/getSignerPayload.d.ts +18 -0
- package/dist/components/Cawg/helper/trqp.d.ts +29 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,6 +89,45 @@ import { CAWGManifest } from "c2pa-react-cawg-component";
|
|
|
89
89
|
|
|
90
90
|
Clicking "More Info" advances from level 1 → 2 → 3. Clicking "Small View" at level 3 returns to level 1.
|
|
91
91
|
|
|
92
|
+
## Trust registry (TRQP)
|
|
93
|
+
|
|
94
|
+
Level 2 and level 3 render a `TrustBadge` next to verified identities, showing whether the manifest's issuer is recognized by a [TRQP](https://creator-assertions.github.io/) trust registry.
|
|
95
|
+
|
|
96
|
+
This package does **not** ship a mock or default trust registry. Out of the box, the badge will always report "Unable to reach trust registry" — you must configure a real query function that calls your TRQP endpoint (or any equivalent authorization check).
|
|
97
|
+
|
|
98
|
+
### `setTrustRegistryQueryFn`
|
|
99
|
+
|
|
100
|
+
Call once at app startup to configure the query function used by every `TrustBadge` in your app:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { setTrustRegistryQueryFn } from "c2pa-react-cawg-component";
|
|
104
|
+
import type { TrqpAuthorizationResponse } from "c2pa-react-cawg-component";
|
|
105
|
+
|
|
106
|
+
setTrustRegistryQueryFn(async ({ entityId, action, resource }): Promise<TrqpAuthorizationResponse> => {
|
|
107
|
+
const res = await fetch(
|
|
108
|
+
`https://your-trqp-endpoint.example.com/registries/main/entities/${entityId}/authorization/${action}/${resource}`,
|
|
109
|
+
);
|
|
110
|
+
if (!res.ok) throw new Error(`TRQP query failed: ${res.status}`);
|
|
111
|
+
return res.json();
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
If no query function is configured, every `TrustBadge` throws and renders an error state instead of silently reporting a false result.
|
|
116
|
+
|
|
117
|
+
### Per-badge override
|
|
118
|
+
|
|
119
|
+
`TrustBadge` (used internally by `CAWGManifest` at levels 2–3) also accepts a `queryFn` prop directly, which takes precedence over the app-wide default set via `setTrustRegistryQueryFn`.
|
|
120
|
+
|
|
121
|
+
### `TrustRegistryQueryFn`
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
type TrustRegistryQueryFn = (params: {
|
|
125
|
+
entityId: string;
|
|
126
|
+
action?: string;
|
|
127
|
+
resource?: string;
|
|
128
|
+
}) => Promise<TrqpAuthorizationResponse>;
|
|
129
|
+
```
|
|
130
|
+
|
|
92
131
|
## Types
|
|
93
132
|
|
|
94
133
|
Types are provided by the shared `c2pa-react-component-types` package, which is installed automatically as a dependency.
|
|
@@ -102,6 +141,8 @@ import type {
|
|
|
102
141
|
} from "c2pa-react-component-types";
|
|
103
142
|
```
|
|
104
143
|
|
|
144
|
+
This package also exports its own TRQP-related types — see [Trust registry (TRQP)](#trust-registry-trqp) above.
|
|
145
|
+
|
|
105
146
|
## Local development
|
|
106
147
|
|
|
107
148
|
Use [yalc](https://github.com/wclr/yalc) to consume the library in another local project without publishing to npm.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.cawg-card{background:#fff;border-radius:12px;width:95%;padding:16px;display:inline-block;box-shadow:0 4px 20px #00000014}.cawg-container{align-items:center;gap:16px;display:flex}.cawg-square{background-color:gold;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:48px;height:48px;display:flex}.cawg-logo-text{color:#000;letter-spacing:-.5px;font-size:18px;font-weight:700}.cawg-media-title{color:#333;letter-spacing:-.3px;font-size:20px;font-weight:600}.cawg-claim-generator{color:#666;font-size:14px}.cawg-thumbnail{object-fit:cover;border-radius:4px;width:48px;height:48px}.cawg-button{color:#666;cursor:pointer;background:#fff;border:2px solid #666;border-radius:999px;width:100%;height:42px;font-size:16px;font-weight:700;transition:background-color .16s,border-color .16s,color .16s,box-shadow .16s}.cawg-button:hover{color:#fff;background:#111;border-color:#111;box-shadow:0 4px 12px #00000024}.cawg-button:focus-visible{outline-offset:3px;outline:3px solid #11111140}.cawg-section-title{color:#333;margin-bottom:6px;font-size:16px;font-weight:600}.cawg-key-value{margin-top:16px}.cawg-key-value-label{color:#64748b;text-transform:uppercase;letter-spacing:.025em;margin-bottom:4px;font-size:14px;font-weight:600}.cawg-key-value-value{color:#1e293b;word-break:break-word;overflow-wrap:break-word;font-size:16px;line-height:1.5}.cawg-divider{background:#e2e8f0;height:1px;margin:16px 0}.cawg-roles{flex-wrap:wrap;gap:6px;margin-top:12px;display:flex}.cawg-role-badge{color:#475569;letter-spacing:.02em;background:#f0f4f8;border:1px solid #cbd5e1;border-radius:999px;align-items:center;padding:2px 10px;font-size:12px;font-weight:600;display:inline-flex}.cawg-identity-list{flex-direction:column;gap:8px;margin-top:10px;display:flex}.cawg-identity-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;align-items:flex-start;padding:10px 12px;display:flex}.cawg-identity-type-label{color:#64748b;text-transform:uppercase;letter-spacing:.06em;margin-bottom:2px;font-size:11px;font-weight:700}.cawg-identity-name{color:#1e293b;font-size:14px;font-weight:600}.cawg-identity-provider{color:#64748b;margin-top:1px;font-size:13px}.cawg-identity-link{color:#3b82f6;word-break:break-all;margin-top:2px;font-size:12px;text-decoration:none;display:block}.cawg-identity-link:hover{text-decoration:underline}.cawg-identity-meta{color:#94a3b8;margin-top:3px;font-size:11px}.cawg-training-list{flex-direction:column;gap:6px;margin-top:10px;display:flex}.cawg-training-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;justify-content:space-between;align-items:flex-start;gap:8px;padding:8px 12px;display:flex}.cawg-training-label{color:#374151;font-size:13px;font-weight:500}.cawg-constraint-info{color:#92400e;margin-top:3px;font-size:12px;font-style:italic}.cawg-use-badge{letter-spacing:.04em;text-transform:uppercase;border-radius:999px;flex-shrink:0;padding:2px 8px;font-size:11px;font-weight:700}.cawg-use-allowed{color:#166534;background:#dcfce7}.cawg-use-not-allowed{color:#991b1b;background:#fee2e2}.cawg-use-constrained{color:#854d0e;background:#fef9c3}
|
|
1
|
+
.cawg-card{background:#fff;border-radius:12px;width:95%;padding:16px;display:inline-block;box-shadow:0 4px 20px #00000014}.cawg-container{align-items:center;gap:16px;display:flex}.cawg-square{background-color:gold;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:48px;height:48px;display:flex}.cawg-logo-text{color:#000;letter-spacing:-.5px;font-size:18px;font-weight:700}.cawg-media-title{color:#333;letter-spacing:-.3px;font-size:20px;font-weight:600}.cawg-claim-generator,.cawg-creators-name{color:#666;font-size:14px}.cawg-thumbnail{object-fit:cover;border-radius:4px;width:48px;height:48px}.cawg-button{color:#666;cursor:pointer;background:#fff;border:2px solid #666;border-radius:999px;width:100%;height:42px;font-size:16px;font-weight:700;transition:background-color .16s,border-color .16s,color .16s,box-shadow .16s}.cawg-button:hover{color:#fff;background:#111;border-color:#111;box-shadow:0 4px 12px #00000024}.cawg-button:focus-visible{outline-offset:3px;outline:3px solid #11111140}.cawg-section-title{color:#333;margin-bottom:6px;font-size:16px;font-weight:600}.cawg-key-value{margin-top:16px}.cawg-key-value-label{color:#64748b;text-transform:uppercase;letter-spacing:.025em;margin-bottom:4px;font-size:14px;font-weight:600}.cawg-key-value-value{color:#1e293b;word-break:break-word;overflow-wrap:break-word;font-size:16px;line-height:1.5}.cawg-divider{background:#e2e8f0;height:1px;margin:16px 0}.cawg-roles{flex-wrap:wrap;gap:6px;margin-top:12px;display:flex}.cawg-role-badge{color:#475569;letter-spacing:.02em;background:#f0f4f8;border:1px solid #cbd5e1;border-radius:999px;align-items:center;padding:2px 10px;font-size:12px;font-weight:600;display:inline-flex}.cawg-identity-list{flex-direction:column;gap:8px;margin-top:10px;display:flex}.cawg-identity-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;align-items:flex-start;padding:10px 12px;display:flex}.cawg-identity-type-label{color:#64748b;text-transform:uppercase;letter-spacing:.06em;margin-bottom:2px;font-size:11px;font-weight:700}.cawg-identity-name{color:#1e293b;font-size:14px;font-weight:600}.cawg-identity-provider{color:#64748b;margin-top:1px;font-size:13px}.cawg-identity-link{color:#3b82f6;word-break:break-all;margin-top:2px;font-size:12px;text-decoration:none;display:block}.cawg-identity-link:hover{text-decoration:underline}.cawg-identity-meta{color:#94a3b8;margin-top:3px;font-size:11px}.cawg-training-list{flex-direction:column;gap:6px;margin-top:10px;display:flex}.cawg-training-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;justify-content:space-between;align-items:flex-start;gap:8px;padding:8px 12px;display:flex}.cawg-training-label{color:#374151;font-size:13px;font-weight:500}.cawg-constraint-info{color:#92400e;margin-top:3px;font-size:12px;font-style:italic}.cawg-use-badge{letter-spacing:.04em;text-transform:uppercase;border-radius:999px;flex-shrink:0;padding:2px 8px;font-size:11px;font-weight:700}.cawg-use-allowed{color:#166534;background:#dcfce7}.cawg-use-not-allowed{color:#991b1b;background:#fee2e2}.cawg-use-constrained{color:#854d0e;background:#fef9c3}.cawg-trust-status{margin-top:4px}.cawg-trust-badge{letter-spacing:.04em;text-transform:uppercase;white-space:nowrap;border-radius:999px;align-items:center;padding:2px 10px;font-size:11px;font-weight:700;display:inline-flex}.cawg-trust-pending{color:#64748b;background:#f1f5f9}.cawg-trust-verified{color:#166534;background:#dcfce7}.cawg-trust-unverified{color:#991b1b;background:#fee2e2}.cawg-trust-meta{color:#94a3b8;margin-top:4px;font-size:12px}.cawg-trust-message{color:#991b1b;margin-top:4px;font-size:12px}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import { Fragment as
|
|
1
|
+
import e, { useEffect as t, useState as n } from "react";
|
|
2
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/Cawg/CAWG_Header.tsx
|
|
4
|
-
var
|
|
4
|
+
var o = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_17170_59571)\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.8875 2.20138C12.9985 0.955258 14.0434 0 15.2937 0H18.7065C19.9567 0 21.0017 0.955258 21.1127 2.20138L21.3059 4.36814C21.85 4.55372 22.3784 4.77304 22.8882 5.02387L24.555 3.62851C25.5149 2.8265 26.9306 2.88955 27.8143 3.77319L30.227 6.18588L30.2287 6.18758C31.1092 7.07235 31.1751 8.48356 30.3723 9.44443L28.9769 11.1112C29.2286 11.6219 29.4473 12.1506 29.6323 12.6944L31.7987 12.8875C33.0448 12.9984 34.0002 14.0434 34.0002 15.2937V18.7065C34.0002 19.9568 33.0448 21.0018 31.7987 21.1127L29.632 21.3059C29.4464 21.85 29.2271 22.3784 28.9763 22.8882L30.3717 24.555C31.1737 25.5149 31.1106 26.9307 30.227 27.8143L27.8143 30.227L27.8126 30.2287C26.9278 31.1092 25.5166 31.1751 24.5557 30.3723L22.889 28.9769C22.3782 29.2286 21.8496 29.4473 21.3058 29.6323L21.1127 31.7987C21.0017 33.0448 19.9567 34.0002 18.7065 34.0002H15.2937C14.0434 34.0002 12.9985 33.0449 12.8875 31.7988L12.6943 29.632C12.1502 29.4465 11.6218 29.2271 11.1119 28.9763L9.44515 30.3717C8.48529 31.1737 7.06951 31.1106 6.18588 30.227L3.77319 27.8143L3.77149 27.8126C2.89097 26.9278 2.82504 25.5166 3.6279 24.5557L5.02323 22.889C4.77158 22.3783 4.55287 21.8496 4.36784 21.3058L2.20148 21.1127C0.95531 21.0018 0 19.9568 0 18.7065V15.2937C0 14.0434 0.95531 12.9984 2.20148 12.8875L4.36814 12.6943C4.55372 12.1502 4.77304 11.6218 5.02387 11.112L3.62851 9.44515C2.8265 8.48529 2.88955 7.06952 3.77319 6.18588L6.18588 3.77319L6.18758 3.77149C7.07235 2.89097 8.48356 2.82504 9.44443 3.6279L11.1112 5.02323C11.6219 4.77158 12.1506 4.55288 12.6943 4.36784L12.8875 2.20138ZM15.2937 2.00016C15.0789 2.00016 14.8988 2.16494 14.8797 2.37888L14.6272 5.2117L14.5661 5.89685L13.9044 6.08489C13.0453 6.32903 12.2307 6.66675 11.4733 7.09234L10.8711 7.43075L10.3414 6.98733L8.16195 5.16279C7.99794 5.02598 7.75432 5.03471 7.59907 5.18865L5.18751 7.6002C5.03615 7.75156 5.02474 7.99645 5.16256 8.16168L6.98732 10.3414L7.42966 10.8698L7.09346 11.4713C6.66869 12.2313 6.32859 13.0469 6.08489 13.9045L5.89685 14.5661L5.2117 14.6272L2.37898 14.8797C2.16503 14.8988 2.00016 15.0789 2.00016 15.2937V18.7065C2.00016 18.9213 2.16493 19.1014 2.37888 19.1205L5.2117 19.373L5.89685 19.4341L6.08489 20.0957C6.32903 20.9548 6.66674 21.7695 7.09234 22.5269L7.43074 23.1291L6.98732 23.6588L5.16279 25.8382C5.02613 26.0022 5.03474 26.2457 5.18849 26.401L5.18921 26.4017L7.6002 28.8127C7.75162 28.9641 7.99664 28.9754 8.16187 28.8375L10.3414 27.0129L10.8698 26.5705L11.4713 26.9067C12.2313 27.3315 13.0469 27.6716 13.9044 27.9153L14.5661 28.1033L14.6272 28.7885L14.8797 31.6212C14.8988 31.8351 15.0789 32 15.2937 32H18.7065C18.9213 32 19.1014 31.8352 19.1204 31.6213L19.373 28.7885L19.434 28.1033L20.0957 27.9153C20.9548 27.6711 21.7695 27.3334 22.5269 26.9078L23.1291 26.5694L23.6588 27.0129L25.8382 28.8374C26.0022 28.9744 26.2458 28.9656 26.4011 28.8115L28.8126 26.4C28.964 26.2486 28.9754 26.0037 28.8376 25.8385L27.0128 23.6588L26.5705 23.1304L26.9067 22.5289C27.3315 21.7689 27.6716 20.9533 27.9153 20.0957L28.1033 19.4341L28.7885 19.373L31.6212 19.1205C31.8351 19.1014 32 18.9213 32 18.7065V15.2937C32 15.0789 31.8352 14.8988 31.6213 14.8797L28.7885 14.6272L28.1033 14.5661L27.9153 13.9045C27.6711 13.0454 27.3334 12.2307 26.9078 11.4733L26.5694 10.8711L27.0128 10.3414L28.8374 8.16195C28.9745 7.99789 28.9655 7.75428 28.8114 7.59895L26.4 5.18751C26.2485 5.03607 26.0034 5.02473 25.8382 5.16279L23.6588 6.98733L23.1304 7.42966L22.5289 7.09347C21.7689 6.66869 20.9533 6.3286 20.0957 6.08489L19.434 5.89685L19.373 5.2117L19.1204 2.37898C19.1014 2.16504 18.9213 2.00016 18.7065 2.00016H15.2937ZM12.1524 16.874C11.9997 17.8144 12.6384 18.7006 13.5788 18.8532C14.5193 19.0059 15.4054 18.3672 15.5581 17.4268C15.7108 16.4863 15.0721 15.6002 14.1317 15.4475C13.1912 15.2949 12.3051 15.9335 12.1524 16.874ZM13.2584 20.8275C11.2275 20.4979 9.84843 18.5843 10.1781 16.5535C10.5077 14.5226 12.4213 13.1436 14.4521 13.4732C16.483 13.8029 17.8621 15.7164 17.5324 17.7473C17.2028 19.7781 15.2892 21.1572 13.2584 20.8275ZM23.61 17.1489C23.61 18.104 22.8349 18.8791 21.8799 18.8791C20.9248 18.8791 20.1497 18.104 20.1497 17.1489C20.1497 16.1939 20.9248 15.4188 21.8799 15.4188C22.8349 15.4188 23.61 16.1939 23.61 17.1489Z\" fill=\"black\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_17170_59571\">\n<rect width=\"34\" height=\"34\" fill=\"black\"/>\n</clipPath>\n</defs>\n</svg>", s = () => /* @__PURE__ */ a("div", {
|
|
5
5
|
style: {
|
|
6
6
|
display: "flex",
|
|
7
7
|
alignItems: "center",
|
|
8
8
|
gap: "8px",
|
|
9
9
|
marginBottom: "16px"
|
|
10
10
|
},
|
|
11
|
-
children: [/* @__PURE__ */
|
|
12
|
-
dangerouslySetInnerHTML: { __html:
|
|
11
|
+
children: [/* @__PURE__ */ i("div", {
|
|
12
|
+
dangerouslySetInnerHTML: { __html: o },
|
|
13
13
|
style: {
|
|
14
14
|
width: "24px",
|
|
15
15
|
height: "24px",
|
|
16
16
|
display: "flex",
|
|
17
17
|
alignItems: "center"
|
|
18
18
|
}
|
|
19
|
-
}), /* @__PURE__ */
|
|
19
|
+
}), /* @__PURE__ */ i("span", {
|
|
20
20
|
style: {
|
|
21
21
|
fontSize: "14px",
|
|
22
22
|
fontWeight: 600,
|
|
@@ -26,7 +26,21 @@ var i = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
26
26
|
},
|
|
27
27
|
children: "Creator Assertions Working Group"
|
|
28
28
|
})]
|
|
29
|
-
}),
|
|
29
|
+
}), c = (e) => {
|
|
30
|
+
switch (e) {
|
|
31
|
+
case "cawg.document_verification": return 0;
|
|
32
|
+
case "cawg.social_media": return 10;
|
|
33
|
+
case "cawg.web_site": return 20;
|
|
34
|
+
case "cawg.affiliation": return 1e6;
|
|
35
|
+
default: return 1e5;
|
|
36
|
+
}
|
|
37
|
+
}, l = ["cawg.affiliation"], u = (e) => {
|
|
38
|
+
if (typeof e == "object" && !Array.isArray(e) && (e = [e]), !e || e.length === 0) return "Unknown";
|
|
39
|
+
let t = e.sort((e, t) => c(e.type) - c(t.type))[0];
|
|
40
|
+
return !t || l.includes(t.type) ? "Unknown" : t.name;
|
|
41
|
+
}, d = (e) => {
|
|
42
|
+
if (e) return e.signer_payload ?? e.c2paAsset;
|
|
43
|
+
}, f = {
|
|
30
44
|
"cawg.creator": "Creator",
|
|
31
45
|
"cawg.contributor": "Contributor",
|
|
32
46
|
"cawg.editor": "Editor",
|
|
@@ -35,49 +49,49 @@ var i = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
35
49
|
"cawg.sponsor": "Sponsor",
|
|
36
50
|
"cawg.translator": "Translator"
|
|
37
51
|
};
|
|
38
|
-
function
|
|
39
|
-
let
|
|
40
|
-
return /* @__PURE__ */
|
|
52
|
+
function p({ className: e, manifest: t, moreInfo: n }) {
|
|
53
|
+
let r = t.title, o = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", c = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), l = o.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", p = t.assertions?.["cawg.identity"], m = d(p)?.role ?? [];
|
|
54
|
+
return /* @__PURE__ */ a("div", {
|
|
41
55
|
className: `cawg-card ${e ?? ""}`,
|
|
42
56
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ i(s, {}),
|
|
58
|
+
/* @__PURE__ */ a("div", {
|
|
45
59
|
className: "cawg-container",
|
|
46
|
-
children: [t.thumbnail ? /* @__PURE__ */
|
|
60
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
47
61
|
src: t.thumbnail,
|
|
48
62
|
alt: "Thumbnail",
|
|
49
63
|
className: "cawg-thumbnail"
|
|
50
|
-
}) : /* @__PURE__ */
|
|
64
|
+
}) : /* @__PURE__ */ i("div", {
|
|
51
65
|
className: "cawg-square",
|
|
52
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ i("span", {
|
|
53
67
|
className: "cawg-logo-text",
|
|
54
68
|
children: l
|
|
55
69
|
})
|
|
56
|
-
}), /* @__PURE__ */
|
|
70
|
+
}), /* @__PURE__ */ a("div", {
|
|
57
71
|
style: {
|
|
58
72
|
display: "flex",
|
|
59
73
|
flexDirection: "column"
|
|
60
74
|
},
|
|
61
|
-
children: [/* @__PURE__ */
|
|
75
|
+
children: [/* @__PURE__ */ i("span", {
|
|
62
76
|
className: "cawg-media-title",
|
|
63
|
-
children:
|
|
64
|
-
}), /* @__PURE__ */
|
|
65
|
-
className: "cawg-
|
|
77
|
+
children: r
|
|
78
|
+
}), /* @__PURE__ */ i("span", {
|
|
79
|
+
className: "cawg-creators-name",
|
|
66
80
|
children: c
|
|
67
81
|
})]
|
|
68
82
|
})]
|
|
69
83
|
}),
|
|
70
|
-
|
|
84
|
+
m.length > 0 && /* @__PURE__ */ i("div", {
|
|
71
85
|
className: "cawg-roles",
|
|
72
|
-
children:
|
|
86
|
+
children: m.map((e) => /* @__PURE__ */ i("span", {
|
|
73
87
|
className: "cawg-role-badge",
|
|
74
|
-
children:
|
|
88
|
+
children: f[e] ?? e
|
|
75
89
|
}, e))
|
|
76
90
|
}),
|
|
77
|
-
|
|
91
|
+
n && /* @__PURE__ */ i("div", {
|
|
78
92
|
style: { marginTop: 16 },
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
onClick:
|
|
93
|
+
children: /* @__PURE__ */ i("button", {
|
|
94
|
+
onClick: n,
|
|
81
95
|
className: "cawg-button",
|
|
82
96
|
children: "More Info"
|
|
83
97
|
})
|
|
@@ -86,8 +100,96 @@ function s({ className: e, manifest: t, moreInfo: i }) {
|
|
|
86
100
|
});
|
|
87
101
|
}
|
|
88
102
|
//#endregion
|
|
103
|
+
//#region src/components/Cawg/helper/trqp.ts
|
|
104
|
+
async function m() {
|
|
105
|
+
throw Error("No trust registry query function configured. Call `setTrustRegistryQueryFn` (or pass a `queryFn` prop to TrustBadge) with a function that queries a real TRQP endpoint.");
|
|
106
|
+
}
|
|
107
|
+
var h = m;
|
|
108
|
+
function g(e) {
|
|
109
|
+
h = e;
|
|
110
|
+
}
|
|
111
|
+
function _() {
|
|
112
|
+
return h;
|
|
113
|
+
}
|
|
114
|
+
function v(e, r, i, a = _()) {
|
|
115
|
+
let [o, s] = n("idle"), [c, l] = n(null), [u, d] = n(null);
|
|
116
|
+
return t(() => {
|
|
117
|
+
if (!e) {
|
|
118
|
+
s("idle"), l(null), d(null);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
let t = !1;
|
|
122
|
+
return s("loading"), d(null), a({
|
|
123
|
+
entityId: e,
|
|
124
|
+
action: r,
|
|
125
|
+
resource: i
|
|
126
|
+
}).then((e) => {
|
|
127
|
+
t || (l(e), s("done"));
|
|
128
|
+
}, (e) => {
|
|
129
|
+
t || (l(null), d(e instanceof Error ? e : Error(String(e))), s("error"));
|
|
130
|
+
}), () => {
|
|
131
|
+
t = !0;
|
|
132
|
+
};
|
|
133
|
+
}, [
|
|
134
|
+
e,
|
|
135
|
+
r,
|
|
136
|
+
i,
|
|
137
|
+
a
|
|
138
|
+
]), {
|
|
139
|
+
status: o,
|
|
140
|
+
result: c,
|
|
141
|
+
error: u
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/components/Cawg/helper/TrustBadge.tsx
|
|
146
|
+
function y(e) {
|
|
147
|
+
try {
|
|
148
|
+
return new Date(e).toLocaleDateString(void 0, {
|
|
149
|
+
year: "numeric",
|
|
150
|
+
month: "long",
|
|
151
|
+
day: "numeric"
|
|
152
|
+
});
|
|
153
|
+
} catch {
|
|
154
|
+
return e;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
var b = "Identity Verified by Trust Registry", x = "Identity Unable to be Verified by Trust Registry";
|
|
158
|
+
function S({ entityId: e, action: t, resource: n, variant: r = "full", queryFn: o }) {
|
|
159
|
+
let { status: s, result: c, error: l } = v(e, t, n, o);
|
|
160
|
+
if (!e) return null;
|
|
161
|
+
if (s === "error") return /* @__PURE__ */ i("span", {
|
|
162
|
+
className: "cawg-trust-badge cawg-trust-unverified",
|
|
163
|
+
title: l?.message,
|
|
164
|
+
children: "Unable to reach trust registry"
|
|
165
|
+
});
|
|
166
|
+
if (s !== "done" || !c) return /* @__PURE__ */ i("span", {
|
|
167
|
+
className: "cawg-trust-badge cawg-trust-pending",
|
|
168
|
+
children: "Checking trust registry…"
|
|
169
|
+
});
|
|
170
|
+
let u = /* @__PURE__ */ i("span", {
|
|
171
|
+
className: c.authorized ? "cawg-trust-badge cawg-trust-verified" : "cawg-trust-badge cawg-trust-unverified",
|
|
172
|
+
title: c.authorized ? `Recognized by ${c.authority_id} · checked ${y(c.time_evaluated)}` : c.message,
|
|
173
|
+
children: c.authorized ? b : x
|
|
174
|
+
});
|
|
175
|
+
return r === "compact" ? u : /* @__PURE__ */ a("div", {
|
|
176
|
+
className: "cawg-trust-status",
|
|
177
|
+
children: [u, c.authorized ? /* @__PURE__ */ a("div", {
|
|
178
|
+
className: "cawg-trust-meta",
|
|
179
|
+
children: [
|
|
180
|
+
c.authority_id,
|
|
181
|
+
" · checked ",
|
|
182
|
+
y(c.time_evaluated)
|
|
183
|
+
]
|
|
184
|
+
}) : c.message && /* @__PURE__ */ i("div", {
|
|
185
|
+
className: "cawg-trust-message",
|
|
186
|
+
children: c.message
|
|
187
|
+
})]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
89
191
|
//#region src/components/Cawg/levels/L2/CAWGL2.tsx
|
|
90
|
-
var
|
|
192
|
+
var C = {
|
|
91
193
|
"cawg.creator": "Creator",
|
|
92
194
|
"cawg.contributor": "Contributor",
|
|
93
195
|
"cawg.editor": "Editor",
|
|
@@ -95,27 +197,27 @@ var c = {
|
|
|
95
197
|
"cawg.publisher": "Publisher",
|
|
96
198
|
"cawg.sponsor": "Sponsor",
|
|
97
199
|
"cawg.translator": "Translator"
|
|
98
|
-
},
|
|
200
|
+
}, w = {
|
|
99
201
|
"cawg.document_verification": "ID Verified",
|
|
100
202
|
"cawg.web_site": "Website",
|
|
101
203
|
"cawg.affiliation": "Affiliation",
|
|
102
204
|
"cawg.social_media": "Social Media",
|
|
103
205
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
104
|
-
},
|
|
206
|
+
}, T = {
|
|
105
207
|
"cawg.data_mining": "Data Mining",
|
|
106
208
|
"cawg.ai_inference": "AI Inference",
|
|
107
209
|
"cawg.ai_training": "AI Training",
|
|
108
210
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
109
|
-
},
|
|
211
|
+
}, E = {
|
|
110
212
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
111
213
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
112
214
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
113
|
-
},
|
|
215
|
+
}, D = {
|
|
114
216
|
allowed: "Allowed",
|
|
115
217
|
notAllowed: "Not Allowed",
|
|
116
218
|
constrained: "Constrained"
|
|
117
219
|
};
|
|
118
|
-
function
|
|
220
|
+
function O(e) {
|
|
119
221
|
try {
|
|
120
222
|
return new Date(e).toLocaleDateString(void 0, {
|
|
121
223
|
year: "numeric",
|
|
@@ -126,72 +228,83 @@ function p(e) {
|
|
|
126
228
|
return e;
|
|
127
229
|
}
|
|
128
230
|
}
|
|
129
|
-
function
|
|
231
|
+
function k(e) {
|
|
130
232
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string").join(", ") : typeof e == "string" ? e : "";
|
|
131
233
|
}
|
|
132
|
-
function
|
|
133
|
-
let
|
|
134
|
-
return /* @__PURE__ */
|
|
234
|
+
function A({ className: e, manifest: t, moreInfo: n }) {
|
|
235
|
+
let o = t.title, c = (t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown").split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), f = t.assertions?.["cawg.identity"], p = d(f)?.role ?? [], m = f?.verifiedIdentities ?? [], h = f?.issuer, g = t.assertions?.["cawg.training-mining"]?.entries ?? {}, _ = t.assertions?.["cawg.metadata"], v = k(_?.["dc:creator"]), y = _?.["xmp:CreateDate"];
|
|
236
|
+
return /* @__PURE__ */ a("div", {
|
|
135
237
|
className: `cawg-card ${e ?? ""}`,
|
|
136
238
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ i(s, {}),
|
|
240
|
+
/* @__PURE__ */ a("div", {
|
|
139
241
|
className: "cawg-container",
|
|
140
|
-
children: [
|
|
141
|
-
src:
|
|
242
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
243
|
+
src: t.thumbnail,
|
|
142
244
|
alt: "Thumbnail",
|
|
143
245
|
className: "cawg-thumbnail"
|
|
144
|
-
}) : /* @__PURE__ */
|
|
246
|
+
}) : /* @__PURE__ */ i("div", {
|
|
145
247
|
className: "cawg-square",
|
|
146
|
-
children: /* @__PURE__ */
|
|
248
|
+
children: /* @__PURE__ */ i("span", {
|
|
147
249
|
className: "cawg-logo-text",
|
|
148
|
-
children:
|
|
250
|
+
children: c
|
|
149
251
|
})
|
|
150
|
-
}), /* @__PURE__ */
|
|
252
|
+
}), /* @__PURE__ */ a("div", {
|
|
151
253
|
style: {
|
|
152
254
|
display: "flex",
|
|
153
255
|
flexDirection: "column"
|
|
154
256
|
},
|
|
155
|
-
children: [/* @__PURE__ */
|
|
257
|
+
children: [/* @__PURE__ */ i("span", {
|
|
156
258
|
className: "cawg-media-title",
|
|
157
|
-
children:
|
|
158
|
-
}), /* @__PURE__ */
|
|
159
|
-
className: "cawg-
|
|
160
|
-
children:
|
|
259
|
+
children: o
|
|
260
|
+
}), /* @__PURE__ */ i("span", {
|
|
261
|
+
className: "cawg-creators-name",
|
|
262
|
+
children: l
|
|
161
263
|
})]
|
|
162
264
|
})]
|
|
163
265
|
}),
|
|
164
|
-
|
|
266
|
+
p.length > 0 && /* @__PURE__ */ i("div", {
|
|
165
267
|
className: "cawg-roles",
|
|
166
|
-
children:
|
|
268
|
+
children: p.map((e) => /* @__PURE__ */ i("span", {
|
|
167
269
|
className: "cawg-role-badge",
|
|
168
|
-
children:
|
|
270
|
+
children: C[e] ?? e
|
|
169
271
|
}, e))
|
|
170
272
|
}),
|
|
171
|
-
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
273
|
+
m.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
274
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
275
|
+
/* @__PURE__ */ a("div", {
|
|
174
276
|
className: "cawg-section-title",
|
|
175
|
-
|
|
277
|
+
style: {
|
|
278
|
+
display: "flex",
|
|
279
|
+
alignItems: "center",
|
|
280
|
+
justifyContent: "space-between",
|
|
281
|
+
gap: 8
|
|
282
|
+
},
|
|
283
|
+
children: [/* @__PURE__ */ i("span", { children: "Identity" }), /* @__PURE__ */ i(S, {
|
|
284
|
+
entityId: h,
|
|
285
|
+
action: "issue",
|
|
286
|
+
resource: "cawg.identity",
|
|
287
|
+
variant: "compact"
|
|
288
|
+
})]
|
|
176
289
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ i("div", {
|
|
178
291
|
className: "cawg-identity-list",
|
|
179
|
-
children:
|
|
180
|
-
let
|
|
181
|
-
return /* @__PURE__ */
|
|
292
|
+
children: m.map((e, t) => {
|
|
293
|
+
let n = e.type, r = e.name ?? e.username, o = e.provider;
|
|
294
|
+
return /* @__PURE__ */ i("div", {
|
|
182
295
|
className: "cawg-identity-item",
|
|
183
|
-
children: /* @__PURE__ */
|
|
296
|
+
children: /* @__PURE__ */ a("div", {
|
|
184
297
|
style: { flex: 1 },
|
|
185
298
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ i("div", {
|
|
187
300
|
className: "cawg-identity-type-label",
|
|
188
|
-
children:
|
|
301
|
+
children: w[n] ?? n
|
|
189
302
|
}),
|
|
190
|
-
|
|
303
|
+
r && /* @__PURE__ */ i("div", {
|
|
191
304
|
className: "cawg-identity-name",
|
|
192
|
-
children:
|
|
305
|
+
children: r
|
|
193
306
|
}),
|
|
194
|
-
o?.name && /* @__PURE__ */
|
|
307
|
+
o?.name && /* @__PURE__ */ i("div", {
|
|
195
308
|
className: "cawg-identity-provider",
|
|
196
309
|
children: o.name
|
|
197
310
|
})
|
|
@@ -201,57 +314,57 @@ function h({ className: e, manifest: i, moreInfo: o }) {
|
|
|
201
314
|
})
|
|
202
315
|
})
|
|
203
316
|
] }),
|
|
204
|
-
Object.keys(
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
317
|
+
Object.keys(g).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
318
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
319
|
+
/* @__PURE__ */ i("div", {
|
|
207
320
|
className: "cawg-section-title",
|
|
208
321
|
children: "Training & Data Mining"
|
|
209
322
|
}),
|
|
210
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ i("div", {
|
|
211
324
|
className: "cawg-training-list",
|
|
212
|
-
children: Object.entries(
|
|
325
|
+
children: Object.entries(g).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
213
326
|
className: "cawg-training-item",
|
|
214
|
-
children: [/* @__PURE__ */
|
|
327
|
+
children: [/* @__PURE__ */ i("span", {
|
|
215
328
|
className: "cawg-training-label",
|
|
216
|
-
children:
|
|
217
|
-
}), /* @__PURE__ */
|
|
218
|
-
className:
|
|
219
|
-
children:
|
|
329
|
+
children: T[e] ?? e
|
|
330
|
+
}), /* @__PURE__ */ i("span", {
|
|
331
|
+
className: E[t.use] ?? "cawg-use-badge",
|
|
332
|
+
children: D[t.use] ?? t.use
|
|
220
333
|
})]
|
|
221
334
|
}, e))
|
|
222
335
|
})
|
|
223
336
|
] }),
|
|
224
|
-
(
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
337
|
+
(v || y) && /* @__PURE__ */ a(r, { children: [
|
|
338
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
339
|
+
/* @__PURE__ */ i("div", {
|
|
227
340
|
className: "cawg-section-title",
|
|
228
341
|
children: "Creator"
|
|
229
342
|
}),
|
|
230
|
-
|
|
343
|
+
v && /* @__PURE__ */ a("div", {
|
|
231
344
|
className: "cawg-key-value",
|
|
232
|
-
children: [/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ i("div", {
|
|
233
346
|
className: "cawg-key-value-label",
|
|
234
347
|
children: "Name"
|
|
235
|
-
}), /* @__PURE__ */
|
|
348
|
+
}), /* @__PURE__ */ i("div", {
|
|
236
349
|
className: "cawg-key-value-value",
|
|
237
|
-
children:
|
|
350
|
+
children: v
|
|
238
351
|
})]
|
|
239
352
|
}),
|
|
240
|
-
|
|
353
|
+
y && /* @__PURE__ */ a("div", {
|
|
241
354
|
className: "cawg-key-value",
|
|
242
|
-
children: [/* @__PURE__ */
|
|
355
|
+
children: [/* @__PURE__ */ i("div", {
|
|
243
356
|
className: "cawg-key-value-label",
|
|
244
357
|
children: "Date Created"
|
|
245
|
-
}), /* @__PURE__ */
|
|
358
|
+
}), /* @__PURE__ */ i("div", {
|
|
246
359
|
className: "cawg-key-value-value",
|
|
247
|
-
children:
|
|
360
|
+
children: O(y)
|
|
248
361
|
})]
|
|
249
362
|
})
|
|
250
363
|
] }),
|
|
251
|
-
|
|
364
|
+
n && /* @__PURE__ */ i("div", {
|
|
252
365
|
style: { marginTop: 16 },
|
|
253
|
-
children: /* @__PURE__ */
|
|
254
|
-
onClick:
|
|
366
|
+
children: /* @__PURE__ */ i("button", {
|
|
367
|
+
onClick: n,
|
|
255
368
|
className: "cawg-button",
|
|
256
369
|
children: "More Info"
|
|
257
370
|
})
|
|
@@ -261,7 +374,7 @@ function h({ className: e, manifest: i, moreInfo: o }) {
|
|
|
261
374
|
}
|
|
262
375
|
//#endregion
|
|
263
376
|
//#region src/components/Cawg/levels/L3/CAWGL3.tsx
|
|
264
|
-
var
|
|
377
|
+
var j = {
|
|
265
378
|
"cawg.creator": "Creator",
|
|
266
379
|
"cawg.contributor": "Contributor",
|
|
267
380
|
"cawg.editor": "Editor",
|
|
@@ -269,31 +382,31 @@ var g = {
|
|
|
269
382
|
"cawg.publisher": "Publisher",
|
|
270
383
|
"cawg.sponsor": "Sponsor",
|
|
271
384
|
"cawg.translator": "Translator"
|
|
272
|
-
},
|
|
385
|
+
}, M = {
|
|
273
386
|
"cawg.document_verification": "ID Verified",
|
|
274
387
|
"cawg.web_site": "Website",
|
|
275
388
|
"cawg.affiliation": "Affiliation",
|
|
276
389
|
"cawg.social_media": "Social Media",
|
|
277
390
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
278
|
-
},
|
|
391
|
+
}, N = {
|
|
279
392
|
"cawg.data_mining": "Data Mining",
|
|
280
393
|
"cawg.ai_inference": "AI Inference",
|
|
281
394
|
"cawg.ai_training": "AI Training",
|
|
282
395
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
283
|
-
},
|
|
396
|
+
}, P = {
|
|
284
397
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
285
398
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
286
399
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
287
|
-
},
|
|
400
|
+
}, F = {
|
|
288
401
|
allowed: "Allowed",
|
|
289
402
|
notAllowed: "Not Allowed",
|
|
290
403
|
constrained: "Constrained"
|
|
291
|
-
},
|
|
404
|
+
}, I = {
|
|
292
405
|
"cawg.identity_claims_aggregation": "Identity Claims Aggregation",
|
|
293
406
|
"cawg.x509.cose": "X.509 Certificate",
|
|
294
407
|
"cawg.verifiable_credential_binding": "Verifiable Credential"
|
|
295
408
|
};
|
|
296
|
-
function
|
|
409
|
+
function L(e) {
|
|
297
410
|
try {
|
|
298
411
|
return new Date(e).toLocaleDateString(void 0, {
|
|
299
412
|
year: "numeric",
|
|
@@ -304,106 +417,118 @@ function S(e) {
|
|
|
304
417
|
return e;
|
|
305
418
|
}
|
|
306
419
|
}
|
|
307
|
-
function
|
|
308
|
-
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) =>
|
|
420
|
+
function R(e) {
|
|
421
|
+
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => R(e)).filter(Boolean).join(", ") : typeof e == "object" ? Object.entries(e).filter(([e]) => !e.startsWith("@")).map(([e, t]) => `${e}: ${R(t)}`).join("; ") : String(e);
|
|
309
422
|
}
|
|
310
|
-
function
|
|
311
|
-
let
|
|
312
|
-
return /* @__PURE__ */
|
|
423
|
+
function z({ className: e, manifest: t, moreInfo: n }) {
|
|
424
|
+
let o = t.title, c = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), f = c.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", p = t.assertions?.["cawg.identity"], m = d(p), h = m?.role ?? [], g = p?.verifiedIdentities ?? [], _ = m?.sig_type, v = p?.issuer, y = t.assertions?.["cawg.training-mining"]?.entries ?? {}, b = t.assertions?.["cawg.metadata"], x = b ? Object.entries(b).filter(([e]) => !e.startsWith("@")) : [];
|
|
425
|
+
return /* @__PURE__ */ a("div", {
|
|
313
426
|
className: `cawg-card ${e ?? ""}`,
|
|
314
427
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ i(s, {}),
|
|
429
|
+
/* @__PURE__ */ a("div", {
|
|
317
430
|
className: "cawg-container",
|
|
318
|
-
children: [
|
|
319
|
-
src:
|
|
431
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
432
|
+
src: t.thumbnail,
|
|
320
433
|
alt: "Thumbnail",
|
|
321
434
|
className: "cawg-thumbnail"
|
|
322
|
-
}) : /* @__PURE__ */
|
|
435
|
+
}) : /* @__PURE__ */ i("div", {
|
|
323
436
|
className: "cawg-square",
|
|
324
|
-
children: /* @__PURE__ */
|
|
437
|
+
children: /* @__PURE__ */ i("span", {
|
|
325
438
|
className: "cawg-logo-text",
|
|
326
|
-
children:
|
|
439
|
+
children: f
|
|
327
440
|
})
|
|
328
|
-
}), /* @__PURE__ */
|
|
441
|
+
}), /* @__PURE__ */ a("div", {
|
|
329
442
|
style: {
|
|
330
443
|
display: "flex",
|
|
331
444
|
flexDirection: "column"
|
|
332
445
|
},
|
|
333
|
-
children: [/* @__PURE__ */
|
|
446
|
+
children: [/* @__PURE__ */ i("span", {
|
|
334
447
|
className: "cawg-media-title",
|
|
335
|
-
children:
|
|
336
|
-
}), /* @__PURE__ */
|
|
337
|
-
className: "cawg-
|
|
338
|
-
children:
|
|
448
|
+
children: o
|
|
449
|
+
}), /* @__PURE__ */ i("span", {
|
|
450
|
+
className: "cawg-creators-name",
|
|
451
|
+
children: l
|
|
339
452
|
})]
|
|
340
453
|
})]
|
|
341
454
|
}),
|
|
342
|
-
|
|
455
|
+
h.length > 0 && /* @__PURE__ */ i("div", {
|
|
343
456
|
className: "cawg-roles",
|
|
344
|
-
children:
|
|
457
|
+
children: h.map((e) => /* @__PURE__ */ i("span", {
|
|
345
458
|
className: "cawg-role-badge",
|
|
346
|
-
children:
|
|
459
|
+
children: j[e] ?? e
|
|
347
460
|
}, e))
|
|
348
461
|
}),
|
|
349
|
-
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
462
|
+
p && /* @__PURE__ */ a(r, { children: [
|
|
463
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
464
|
+
/* @__PURE__ */ i("div", {
|
|
352
465
|
className: "cawg-section-title",
|
|
353
466
|
children: "Identity Assertion"
|
|
354
467
|
}),
|
|
355
|
-
|
|
468
|
+
_ && /* @__PURE__ */ a("div", {
|
|
356
469
|
className: "cawg-key-value",
|
|
357
|
-
children: [/* @__PURE__ */
|
|
470
|
+
children: [/* @__PURE__ */ i("div", {
|
|
358
471
|
className: "cawg-key-value-label",
|
|
359
472
|
children: "Credential Type"
|
|
360
|
-
}), /* @__PURE__ */
|
|
473
|
+
}), /* @__PURE__ */ i("div", {
|
|
361
474
|
className: "cawg-key-value-value",
|
|
362
|
-
children:
|
|
475
|
+
children: I[_] ?? _
|
|
363
476
|
})]
|
|
364
477
|
}),
|
|
365
|
-
|
|
478
|
+
v && /* @__PURE__ */ a("div", {
|
|
366
479
|
className: "cawg-key-value",
|
|
367
|
-
children: [/* @__PURE__ */
|
|
480
|
+
children: [/* @__PURE__ */ i("div", {
|
|
368
481
|
className: "cawg-key-value-label",
|
|
369
482
|
children: "Issuer"
|
|
370
|
-
}), /* @__PURE__ */
|
|
483
|
+
}), /* @__PURE__ */ i("div", {
|
|
371
484
|
className: "cawg-key-value-value",
|
|
372
|
-
children:
|
|
485
|
+
children: v
|
|
486
|
+
})]
|
|
487
|
+
}),
|
|
488
|
+
/* @__PURE__ */ a("div", {
|
|
489
|
+
className: "cawg-key-value",
|
|
490
|
+
children: [/* @__PURE__ */ i("div", {
|
|
491
|
+
className: "cawg-key-value-label",
|
|
492
|
+
children: "Trust Registry"
|
|
493
|
+
}), /* @__PURE__ */ i(S, {
|
|
494
|
+
entityId: v,
|
|
495
|
+
action: "issue",
|
|
496
|
+
resource: "cawg.identity",
|
|
497
|
+
variant: "full"
|
|
373
498
|
})]
|
|
374
499
|
}),
|
|
375
|
-
|
|
500
|
+
g.length > 0 && /* @__PURE__ */ i("div", {
|
|
376
501
|
className: "cawg-identity-list",
|
|
377
502
|
style: { marginTop: 12 },
|
|
378
|
-
children:
|
|
379
|
-
let
|
|
380
|
-
return /* @__PURE__ */
|
|
503
|
+
children: g.map((e, t) => {
|
|
504
|
+
let n = e.type, r = e.name ?? e.username ?? e.address, o = e.provider, s = e.uri, c = e.verifiedAt;
|
|
505
|
+
return /* @__PURE__ */ i("div", {
|
|
381
506
|
className: "cawg-identity-item",
|
|
382
|
-
children: /* @__PURE__ */
|
|
507
|
+
children: /* @__PURE__ */ a("div", {
|
|
383
508
|
style: { flex: 1 },
|
|
384
509
|
children: [
|
|
385
|
-
/* @__PURE__ */
|
|
510
|
+
/* @__PURE__ */ i("div", {
|
|
386
511
|
className: "cawg-identity-type-label",
|
|
387
|
-
children:
|
|
512
|
+
children: M[n] ?? n
|
|
388
513
|
}),
|
|
389
|
-
|
|
514
|
+
r && /* @__PURE__ */ i("div", {
|
|
390
515
|
className: "cawg-identity-name",
|
|
391
|
-
children:
|
|
516
|
+
children: r
|
|
392
517
|
}),
|
|
393
|
-
o?.name && /* @__PURE__ */
|
|
518
|
+
o?.name && /* @__PURE__ */ a("div", {
|
|
394
519
|
className: "cawg-identity-provider",
|
|
395
520
|
children: ["via ", o.name]
|
|
396
521
|
}),
|
|
397
|
-
s && /* @__PURE__ */
|
|
522
|
+
s && /* @__PURE__ */ i("a", {
|
|
398
523
|
href: s,
|
|
399
524
|
target: "_blank",
|
|
400
525
|
rel: "noopener noreferrer",
|
|
401
526
|
className: "cawg-identity-link",
|
|
402
527
|
children: s
|
|
403
528
|
}),
|
|
404
|
-
c && /* @__PURE__ */
|
|
529
|
+
c && /* @__PURE__ */ a("div", {
|
|
405
530
|
className: "cawg-identity-meta",
|
|
406
|
-
children: ["Verified ",
|
|
531
|
+
children: ["Verified ", L(c)]
|
|
407
532
|
})
|
|
408
533
|
]
|
|
409
534
|
})
|
|
@@ -411,64 +536,64 @@ function w({ className: e, manifest: i, moreInfo: o }) {
|
|
|
411
536
|
})
|
|
412
537
|
})
|
|
413
538
|
] }),
|
|
414
|
-
Object.keys(
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
539
|
+
Object.keys(y).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
540
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
541
|
+
/* @__PURE__ */ i("div", {
|
|
417
542
|
className: "cawg-section-title",
|
|
418
543
|
children: "Training & Data Mining"
|
|
419
544
|
}),
|
|
420
|
-
/* @__PURE__ */
|
|
545
|
+
/* @__PURE__ */ i("div", {
|
|
421
546
|
className: "cawg-training-list",
|
|
422
|
-
children: Object.entries(
|
|
547
|
+
children: Object.entries(y).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
423
548
|
className: "cawg-training-item",
|
|
424
549
|
style: {
|
|
425
550
|
flexDirection: "column",
|
|
426
551
|
alignItems: "flex-start"
|
|
427
552
|
},
|
|
428
|
-
children: [/* @__PURE__ */
|
|
553
|
+
children: [/* @__PURE__ */ a("div", {
|
|
429
554
|
style: {
|
|
430
555
|
display: "flex",
|
|
431
556
|
justifyContent: "space-between",
|
|
432
557
|
width: "100%"
|
|
433
558
|
},
|
|
434
|
-
children: [/* @__PURE__ */
|
|
559
|
+
children: [/* @__PURE__ */ i("span", {
|
|
435
560
|
className: "cawg-training-label",
|
|
436
|
-
children:
|
|
437
|
-
}), /* @__PURE__ */
|
|
438
|
-
className:
|
|
439
|
-
children:
|
|
561
|
+
children: N[e] ?? e
|
|
562
|
+
}), /* @__PURE__ */ i("span", {
|
|
563
|
+
className: P[t.use] ?? "cawg-use-badge",
|
|
564
|
+
children: F[t.use] ?? t.use
|
|
440
565
|
})]
|
|
441
|
-
}), t.constraint_info && /* @__PURE__ */
|
|
566
|
+
}), t.constraint_info && /* @__PURE__ */ i("div", {
|
|
442
567
|
className: "cawg-constraint-info",
|
|
443
568
|
children: t.constraint_info
|
|
444
569
|
})]
|
|
445
570
|
}, e))
|
|
446
571
|
})
|
|
447
572
|
] }),
|
|
448
|
-
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
/* @__PURE__ */
|
|
573
|
+
x.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
574
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
575
|
+
/* @__PURE__ */ i("div", {
|
|
451
576
|
className: "cawg-section-title",
|
|
452
577
|
children: "Metadata"
|
|
453
578
|
}),
|
|
454
|
-
|
|
455
|
-
let
|
|
456
|
-
return
|
|
579
|
+
x.map(([e, t]) => {
|
|
580
|
+
let n = R(t);
|
|
581
|
+
return n ? /* @__PURE__ */ a("div", {
|
|
457
582
|
className: "cawg-key-value",
|
|
458
|
-
children: [/* @__PURE__ */
|
|
583
|
+
children: [/* @__PURE__ */ i("div", {
|
|
459
584
|
className: "cawg-key-value-label",
|
|
460
585
|
children: e
|
|
461
|
-
}), /* @__PURE__ */
|
|
586
|
+
}), /* @__PURE__ */ i("div", {
|
|
462
587
|
className: "cawg-key-value-value",
|
|
463
|
-
children:
|
|
588
|
+
children: n
|
|
464
589
|
})]
|
|
465
590
|
}, e) : null;
|
|
466
591
|
})
|
|
467
592
|
] }),
|
|
468
|
-
|
|
593
|
+
n && /* @__PURE__ */ i("div", {
|
|
469
594
|
style: { marginTop: 16 },
|
|
470
|
-
children: /* @__PURE__ */
|
|
471
|
-
onClick:
|
|
595
|
+
children: /* @__PURE__ */ i("button", {
|
|
596
|
+
onClick: n,
|
|
472
597
|
className: "cawg-button",
|
|
473
598
|
children: "Small View"
|
|
474
599
|
})
|
|
@@ -478,7 +603,7 @@ function w({ className: e, manifest: i, moreInfo: o }) {
|
|
|
478
603
|
}
|
|
479
604
|
//#endregion
|
|
480
605
|
//#region src/components/Cawg/Cawg.tsx
|
|
481
|
-
function
|
|
606
|
+
function B(e) {
|
|
482
607
|
return {
|
|
483
608
|
id: e.id ?? "",
|
|
484
609
|
title: e.title ?? "",
|
|
@@ -500,36 +625,36 @@ function T(e) {
|
|
|
500
625
|
ingredients: e.ingredients ?? []
|
|
501
626
|
};
|
|
502
627
|
}
|
|
503
|
-
var
|
|
504
|
-
let o = t.manifestStore?.activeManifest,
|
|
505
|
-
if (!
|
|
506
|
-
let [
|
|
507
|
-
switch (
|
|
508
|
-
case 1: return /* @__PURE__ */
|
|
628
|
+
var V = ({ manifest: t, entry: n, level: r, className: a }) => {
|
|
629
|
+
let o = t.manifestStore?.activeManifest, s = n == null ? t.manifests.find((e) => e.id === o || e.instanceId === o) ?? (o ? t.manifestStore.manifests[o] : void 0) ?? t.manifests[0] : B(n);
|
|
630
|
+
if (!s || !(s.assertions?.["cawg.identity"] != null || s.assertions?.["cawg.training-mining"] != null || s.assertions?.["cawg.metadata"] != null)) return null;
|
|
631
|
+
let [c, l] = e.useState(r || 1);
|
|
632
|
+
switch (c) {
|
|
633
|
+
case 1: return /* @__PURE__ */ i(p, {
|
|
509
634
|
className: a,
|
|
510
|
-
manifest:
|
|
635
|
+
manifest: s,
|
|
511
636
|
moreInfo: () => {
|
|
512
|
-
|
|
637
|
+
l(2);
|
|
513
638
|
}
|
|
514
639
|
});
|
|
515
|
-
case 2: return /* @__PURE__ */
|
|
640
|
+
case 2: return /* @__PURE__ */ i(A, {
|
|
516
641
|
className: a,
|
|
517
|
-
manifest:
|
|
642
|
+
manifest: s,
|
|
518
643
|
moreInfo: () => {
|
|
519
|
-
|
|
644
|
+
l(3);
|
|
520
645
|
}
|
|
521
646
|
});
|
|
522
|
-
case 3: return /* @__PURE__ */
|
|
647
|
+
case 3: return /* @__PURE__ */ i(z, {
|
|
523
648
|
className: a,
|
|
524
|
-
manifest:
|
|
649
|
+
manifest: s,
|
|
525
650
|
moreInfo: () => {
|
|
526
|
-
|
|
651
|
+
l(1);
|
|
527
652
|
}
|
|
528
653
|
});
|
|
529
654
|
}
|
|
530
|
-
return /* @__PURE__ */
|
|
655
|
+
return /* @__PURE__ */ i("div", { children: "Level Of Detail Not Selected" });
|
|
531
656
|
};
|
|
532
|
-
|
|
657
|
+
V.knownAssertions = [
|
|
533
658
|
"cawg.identity",
|
|
534
659
|
"cawg.training-mining",
|
|
535
660
|
"cawg.metadata",
|
|
@@ -547,4 +672,4 @@ E.knownAssertions = [
|
|
|
547
672
|
"cawg.crypto_wallet"
|
|
548
673
|
];
|
|
549
674
|
//#endregion
|
|
550
|
-
export {
|
|
675
|
+
export { V as CAWGManifest, S as TrustBadge, _ as getTrustRegistryQueryFn, m as queryTrustRegistry, g as setTrustRegistryQueryFn, v as useTrustRegistryQuery };
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
<rect width="34" height="34" fill="black"/>
|
|
8
8
|
</clipPath>
|
|
9
9
|
</defs>
|
|
10
|
-
</svg>`,d=()=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`16px`},children:[(0,n.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u},style:{width:`24px`,height:`24px`,display:`flex`,alignItems:`center`}}),(0,n.jsx)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:`#333`,display:`flex`,alignItems:`center`},children:`Creator Assertions Working Group`})]}),f={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function p({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=(t.assertions?.[`cawg.identity`])?.signer_payload?.role??[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:o})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:a})]})]}),s.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:s.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:f[e]??e},e))}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var m={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},h={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},g={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},_={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},v={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function y(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function b(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):typeof e==`string`?e:``}function x({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=t.assertions?.[`cawg.identity`],c=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=t.assertions?.[`cawg.training-mining`]?.entries??{},f=t.assertions?.[`cawg.metadata`],p=b(f?.[`dc:creator`]),x=f?.[`xmp:CreateDate`];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:o})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:a})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:m[e]??e},e))}),l.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity`}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:l.map((e,t)=>{let r=e.type,i=e.name??e.username,a=e.provider;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:h[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsx)(`div`,{className:`cawg-identity-provider`,children:a.name})]})},t)})})]}),Object.keys(u).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(u).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:g[e]??e}),(0,n.jsx)(`span`,{className:_[t.use]??`cawg-use-badge`,children:v[t.use]??t.use})]},e))})]}),(p||x)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Creator`}),p&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Name`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:p})]}),x&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Date Created`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:y(x)})]})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var S={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},C={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},w={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},T={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},E={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},D={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function O(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function k(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>k(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${k(t)}`).join(`; `):String(e)}function A({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=t.assertions?.[`cawg.identity`],c=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=s?.signer_payload?.sig_type,f=s?.issuer,p=t.assertions?.[`cawg.training-mining`]?.entries??{},m=t.assertions?.[`cawg.metadata`],h=m?Object.entries(m).filter(([e])=>!e.startsWith(`@`)):[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:o})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:a})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:S[e]??e},e))}),s&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),u&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Credential Type`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:D[u]??u})]}),f&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Issuer`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:f})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:l.map((e,t)=>{let r=e.type,i=e.name??e.username??e.address,a=e.provider,o=e.uri,s=e.verifiedAt;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:C[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsxs)(`div`,{className:`cawg-identity-provider`,children:[`via `,a.name]}),o&&(0,n.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`cawg-identity-link`,children:o}),s&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Verified `,O(s)]})]})},t)})})]}),Object.keys(p).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(p).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,width:`100%`},children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:w[e]??e}),(0,n.jsx)(`span`,{className:T[t.use]??`cawg-use-badge`,children:E[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),h.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Metadata`}),h.map(([e,t])=>{let r=k(t);return r?(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:e}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:r})]},e):null})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`Small View`})})]})}function j(e){return{id:e.id??``,title:e.title??``,claimGenerator:e.claimGenerator??null,claimGeneratorInfo:(e.claimGeneratorInfo??[]).map(e=>({name:e.name,"org.contentauth.c2pa_rs":e[`org.contentauth.c2pa_rs`]??``})),instanceId:e.instanceId??``,signatureInfo:{alg:e.signatureInfo?.alg??``,issuer:e.signatureInfo?.issuer??``,common_name:e.signatureInfo?.common_name??``,cert_serial_number:e.signatureInfo?.cert_serial_number??``},assertions:e.assertions??{},credentials:e.credentials??[],thumbnail:typeof e.thumbnail==`string`?e.thumbnail:null,ingredients:e.ingredients??[]}}var M=({manifest:e,entry:r,level:i,className:a})=>{let o=e.manifestStore?.activeManifest,s=r==null?e.manifests.find(e=>e.id===o||e.instanceId===o)??(o?e.manifestStore.manifests[o]:void 0)??e.manifests[0]:j(r);if(!s||!(s.assertions?.[`cawg.identity`]!=null||s.assertions?.[`cawg.training-mining`]!=null||s.assertions?.[`cawg.metadata`]!=null))return null;let[c,l]=t.default.useState(i||1);switch(c){case 1:return(0,n.jsx)(p,{className:a,manifest:s,moreInfo:()=>{l(2)}});case 2:return(0,n.jsx)(x,{className:a,manifest:s,moreInfo:()=>{l(3)}});case 3:return(0,n.jsx)(A,{className:a,manifest:s,moreInfo:()=>{l(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};M.knownAssertions=[`cawg.identity`,`cawg.training-mining`,`cawg.metadata`,`cawg.creator`,`cawg.contributor`,`cawg.editor`,`cawg.producer`,`cawg.publisher`,`cawg.sponsor`,`cawg.translator`,`cawg.document_verification`,`cawg.web_site`,`cawg.affiliation`,`cawg.social_media`,`cawg.crypto_wallet`],e.CAWGManifest=M});
|
|
10
|
+
</svg>`,d=()=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`16px`},children:[(0,n.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u},style:{width:`24px`,height:`24px`,display:`flex`,alignItems:`center`}}),(0,n.jsx)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:`#333`,display:`flex`,alignItems:`center`},children:`Creator Assertions Working Group`})]}),f=e=>{switch(e){case`cawg.document_verification`:return 0;case`cawg.social_media`:return 10;case`cawg.web_site`:return 20;case`cawg.affiliation`:return 1e6;default:return 1e5}},p=[`cawg.affiliation`],m=e=>{if(typeof e==`object`&&!Array.isArray(e)&&(e=[e]),!e||e.length===0)return`Unknown`;let t=e.sort((e,t)=>f(e.type)-f(t.type))[0];return!t||p.includes(t.type)?`Unknown`:t.name},h=e=>{if(e)return e.signer_payload??e.c2paAsset},g={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function _({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,c=t.assertions?.[`cawg.identity`],l=h(c)?.role??[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:s})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:l.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:g[e]??e},e))}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}async function v(){throw Error("No trust registry query function configured. Call `setTrustRegistryQueryFn` (or pass a `queryFn` prop to TrustBadge) with a function that queries a real TRQP endpoint.")}var y=v;function b(e){y=e}function x(){return y}function S(e,n,r,i=x()){let[a,o]=(0,t.useState)(`idle`),[s,c]=(0,t.useState)(null),[l,u]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(!e){o(`idle`),c(null),u(null);return}let t=!1;return o(`loading`),u(null),i({entityId:e,action:n,resource:r}).then(e=>{t||(c(e),o(`done`))},e=>{t||(c(null),u(e instanceof Error?e:Error(String(e))),o(`error`))}),()=>{t=!0}},[e,n,r,i]),{status:a,result:s,error:l}}function C(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}var w=`Identity Verified by Trust Registry`,T=`Identity Unable to be Verified by Trust Registry`;function E({entityId:e,action:t,resource:r,variant:i=`full`,queryFn:a}){let{status:o,result:s,error:c}=S(e,t,r,a);if(!e)return null;if(o===`error`)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-unverified`,title:c?.message,children:`Unable to reach trust registry`});if(o!==`done`||!s)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-pending`,children:`Checking trust registry…`});let l=(0,n.jsx)(`span`,{className:s.authorized?`cawg-trust-badge cawg-trust-verified`:`cawg-trust-badge cawg-trust-unverified`,title:s.authorized?`Recognized by ${s.authority_id} · checked ${C(s.time_evaluated)}`:s.message,children:s.authorized?w:T});return i===`compact`?l:(0,n.jsxs)(`div`,{className:`cawg-trust-status`,children:[l,s.authorized?(0,n.jsxs)(`div`,{className:`cawg-trust-meta`,children:[s.authority_id,` · checked `,C(s.time_evaluated)]}):s.message&&(0,n.jsx)(`div`,{className:`cawg-trust-message`,children:s.message})]})}var D={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},O={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},k={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},A={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},j={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function M(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function N(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):typeof e==`string`?e:``}function P({className:e,manifest:t,moreInfo:r}){let i=t.title,a=(t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`).split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=t.assertions?.[`cawg.identity`],c=h(s)?.role??[],l=s?.verifiedIdentities??[],u=s?.issuer,f=t.assertions?.[`cawg.training-mining`]?.entries??{},p=t.assertions?.[`cawg.metadata`],g=N(p?.[`dc:creator`]),_=p?.[`xmp:CreateDate`];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:a})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:D[e]??e},e))}),l.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsxs)(`div`,{className:`cawg-section-title`,style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,n.jsx)(`span`,{children:`Identity`}),(0,n.jsx)(E,{entityId:u,action:`issue`,resource:`cawg.identity`,variant:`compact`})]}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:l.map((e,t)=>{let r=e.type,i=e.name??e.username,a=e.provider;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:O[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsx)(`div`,{className:`cawg-identity-provider`,children:a.name})]})},t)})})]}),Object.keys(f).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(f).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:k[e]??e}),(0,n.jsx)(`span`,{className:A[t.use]??`cawg-use-badge`,children:j[t.use]??t.use})]},e))})]}),(g||_)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Creator`}),g&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Name`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:g})]}),_&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Date Created`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:M(_)})]})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var F={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},I={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},L={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},R={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},z={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},B={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function V(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function H(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>H(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${H(t)}`).join(`; `):String(e)}function U({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,c=t.assertions?.[`cawg.identity`],l=h(c),u=l?.role??[],f=c?.verifiedIdentities??[],p=l?.sig_type,g=c?.issuer,_=t.assertions?.[`cawg.training-mining`]?.entries??{},v=t.assertions?.[`cawg.metadata`],y=v?Object.entries(v).filter(([e])=>!e.startsWith(`@`)):[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:s})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),u.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:u.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:F[e]??e},e))}),c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),p&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Credential Type`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:B[p]??p})]}),g&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Issuer`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:g})]}),(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Trust Registry`}),(0,n.jsx)(E,{entityId:g,action:`issue`,resource:`cawg.identity`,variant:`full`})]}),f.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:f.map((e,t)=>{let r=e.type,i=e.name??e.username??e.address,a=e.provider,o=e.uri,s=e.verifiedAt;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:I[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsxs)(`div`,{className:`cawg-identity-provider`,children:[`via `,a.name]}),o&&(0,n.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`cawg-identity-link`,children:o}),s&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Verified `,V(s)]})]})},t)})})]}),Object.keys(_).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(_).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,width:`100%`},children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:L[e]??e}),(0,n.jsx)(`span`,{className:R[t.use]??`cawg-use-badge`,children:z[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),y.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Metadata`}),y.map(([e,t])=>{let r=H(t);return r?(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:e}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:r})]},e):null})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`Small View`})})]})}function W(e){return{id:e.id??``,title:e.title??``,claimGenerator:e.claimGenerator??null,claimGeneratorInfo:(e.claimGeneratorInfo??[]).map(e=>({name:e.name,"org.contentauth.c2pa_rs":e[`org.contentauth.c2pa_rs`]??``})),instanceId:e.instanceId??``,signatureInfo:{alg:e.signatureInfo?.alg??``,issuer:e.signatureInfo?.issuer??``,common_name:e.signatureInfo?.common_name??``,cert_serial_number:e.signatureInfo?.cert_serial_number??``},assertions:e.assertions??{},credentials:e.credentials??[],thumbnail:typeof e.thumbnail==`string`?e.thumbnail:null,ingredients:e.ingredients??[]}}var G=({manifest:e,entry:r,level:i,className:a})=>{let o=e.manifestStore?.activeManifest,s=r==null?e.manifests.find(e=>e.id===o||e.instanceId===o)??(o?e.manifestStore.manifests[o]:void 0)??e.manifests[0]:W(r);if(!s||!(s.assertions?.[`cawg.identity`]!=null||s.assertions?.[`cawg.training-mining`]!=null||s.assertions?.[`cawg.metadata`]!=null))return null;let[c,l]=t.default.useState(i||1);switch(c){case 1:return(0,n.jsx)(_,{className:a,manifest:s,moreInfo:()=>{l(2)}});case 2:return(0,n.jsx)(P,{className:a,manifest:s,moreInfo:()=>{l(3)}});case 3:return(0,n.jsx)(U,{className:a,manifest:s,moreInfo:()=>{l(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};G.knownAssertions=[`cawg.identity`,`cawg.training-mining`,`cawg.metadata`,`cawg.creator`,`cawg.contributor`,`cawg.editor`,`cawg.producer`,`cawg.publisher`,`cawg.sponsor`,`cawg.translator`,`cawg.document_verification`,`cawg.web_site`,`cawg.affiliation`,`cawg.social_media`,`cawg.crypto_wallet`],e.CAWGManifest=G,e.TrustBadge=E,e.getTrustRegistryQueryFn=x,e.queryTrustRegistry=v,e.setTrustRegistryQueryFn=b,e.useTrustRegistryQuery=S});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TrustRegistryQueryFn } from './trqp';
|
|
2
|
+
export interface TrustBadgeProps {
|
|
3
|
+
entityId?: string;
|
|
4
|
+
action?: string;
|
|
5
|
+
resource?: string;
|
|
6
|
+
variant?: 'compact' | 'full';
|
|
7
|
+
queryFn?: TrustRegistryQueryFn;
|
|
8
|
+
}
|
|
9
|
+
export declare function TrustBadge({ entityId, action, resource, variant, queryFn }: TrustBadgeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type VerifiedIdentitiesObject = {
|
|
2
|
+
"type": string;
|
|
3
|
+
"name": string;
|
|
4
|
+
"provider": {
|
|
5
|
+
"id": string;
|
|
6
|
+
"name": string;
|
|
7
|
+
};
|
|
8
|
+
"verifiedAt": string;
|
|
9
|
+
};
|
|
10
|
+
export declare const getBestUserName: (identityObjectArray: VerifiedIdentitiesObject[] | VerifiedIdentitiesObject) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type SignerPayload = {
|
|
2
|
+
sig_type?: string;
|
|
3
|
+
role?: string[];
|
|
4
|
+
referenced_assertions?: unknown[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The cawg.identity assertion's role/sig_type/referenced_assertions data
|
|
8
|
+
* lives under different keys depending on which identity path signed it:
|
|
9
|
+
* the X.509/COSE path puts it at `signer_payload` (there's no VC wrapper,
|
|
10
|
+
* so the assertion data *is* the signer_payload); the ICA (Identity Claims
|
|
11
|
+
* Aggregation) path puts the same data at `c2paAsset` instead — that's the
|
|
12
|
+
* actual field name the CAWG spec uses for it under `credentialSubject`
|
|
13
|
+
* (see credentialSubject.c2paAsset in the Identity Claims Aggregation
|
|
14
|
+
* spec). Consumers that only checked `signer_payload` would see roles for
|
|
15
|
+
* X.509-signed assertions but never for ICA-signed ones, even though the
|
|
16
|
+
* data is there under `c2paAsset`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getSignerPayload: (identityAssertion: Record<string, unknown> | undefined) => SignerPayload | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface TrqpAuthorizationResponse {
|
|
2
|
+
entity_id: string;
|
|
3
|
+
authority_id: string;
|
|
4
|
+
action: string;
|
|
5
|
+
resource: string;
|
|
6
|
+
authorized: boolean;
|
|
7
|
+
time_requested: string;
|
|
8
|
+
time_evaluated: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
}
|
|
11
|
+
export type TrustRegistryQueryFn = (params: {
|
|
12
|
+
entityId: string;
|
|
13
|
+
action?: string;
|
|
14
|
+
resource?: string;
|
|
15
|
+
}) => Promise<TrqpAuthorizationResponse>;
|
|
16
|
+
export declare function queryTrustRegistry(): Promise<TrqpAuthorizationResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Overrides the default TRQP query function used by every TrustBadge / useTrustRegistryQuery
|
|
19
|
+
* call that doesn't receive an explicit `queryFn`. Call once at app startup.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setTrustRegistryQueryFn(fn: TrustRegistryQueryFn): void;
|
|
22
|
+
export declare function getTrustRegistryQueryFn(): TrustRegistryQueryFn;
|
|
23
|
+
type QueryStatus = 'idle' | 'loading' | 'done' | 'error';
|
|
24
|
+
export declare function useTrustRegistryQuery(entityId: string | undefined, action?: string, resource?: string, queryFn?: TrustRegistryQueryFn): {
|
|
25
|
+
status: QueryStatus;
|
|
26
|
+
result: TrqpAuthorizationResponse | null;
|
|
27
|
+
error: Error | null;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2pa-react-cawg-component",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "A React plugin for c2pa-react-component that renders Creator Assertions Working Group (CAWG) data — identity credentials, metadata, and training permissions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/c2pa-react-cawg-component.umd.cjs",
|