c2pa-react-cawg-component 0.1.11 → 0.1.12
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 +307 -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/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,19 @@ 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 = {
|
|
30
42
|
"cawg.creator": "Creator",
|
|
31
43
|
"cawg.contributor": "Contributor",
|
|
32
44
|
"cawg.editor": "Editor",
|
|
@@ -35,49 +47,49 @@ var i = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
35
47
|
"cawg.sponsor": "Sponsor",
|
|
36
48
|
"cawg.translator": "Translator"
|
|
37
49
|
};
|
|
38
|
-
function
|
|
39
|
-
let
|
|
40
|
-
return /* @__PURE__ */
|
|
50
|
+
function f({ className: e, manifest: t, moreInfo: n }) {
|
|
51
|
+
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("") || "?", f = (t.assertions?.["cawg.identity"])?.signer_payload?.role ?? [];
|
|
52
|
+
return /* @__PURE__ */ a("div", {
|
|
41
53
|
className: `cawg-card ${e ?? ""}`,
|
|
42
54
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ i(s, {}),
|
|
56
|
+
/* @__PURE__ */ a("div", {
|
|
45
57
|
className: "cawg-container",
|
|
46
|
-
children: [t.thumbnail ? /* @__PURE__ */
|
|
58
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
47
59
|
src: t.thumbnail,
|
|
48
60
|
alt: "Thumbnail",
|
|
49
61
|
className: "cawg-thumbnail"
|
|
50
|
-
}) : /* @__PURE__ */
|
|
62
|
+
}) : /* @__PURE__ */ i("div", {
|
|
51
63
|
className: "cawg-square",
|
|
52
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ i("span", {
|
|
53
65
|
className: "cawg-logo-text",
|
|
54
66
|
children: l
|
|
55
67
|
})
|
|
56
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ a("div", {
|
|
57
69
|
style: {
|
|
58
70
|
display: "flex",
|
|
59
71
|
flexDirection: "column"
|
|
60
72
|
},
|
|
61
|
-
children: [/* @__PURE__ */
|
|
73
|
+
children: [/* @__PURE__ */ i("span", {
|
|
62
74
|
className: "cawg-media-title",
|
|
63
|
-
children:
|
|
64
|
-
}), /* @__PURE__ */
|
|
65
|
-
className: "cawg-
|
|
75
|
+
children: r
|
|
76
|
+
}), /* @__PURE__ */ i("span", {
|
|
77
|
+
className: "cawg-creators-name",
|
|
66
78
|
children: c
|
|
67
79
|
})]
|
|
68
80
|
})]
|
|
69
81
|
}),
|
|
70
|
-
|
|
82
|
+
f.length > 0 && /* @__PURE__ */ i("div", {
|
|
71
83
|
className: "cawg-roles",
|
|
72
|
-
children:
|
|
84
|
+
children: f.map((e) => /* @__PURE__ */ i("span", {
|
|
73
85
|
className: "cawg-role-badge",
|
|
74
|
-
children:
|
|
86
|
+
children: d[e] ?? e
|
|
75
87
|
}, e))
|
|
76
88
|
}),
|
|
77
|
-
|
|
89
|
+
n && /* @__PURE__ */ i("div", {
|
|
78
90
|
style: { marginTop: 16 },
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
onClick:
|
|
91
|
+
children: /* @__PURE__ */ i("button", {
|
|
92
|
+
onClick: n,
|
|
81
93
|
className: "cawg-button",
|
|
82
94
|
children: "More Info"
|
|
83
95
|
})
|
|
@@ -86,8 +98,96 @@ function s({ className: e, manifest: t, moreInfo: i }) {
|
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
100
|
//#endregion
|
|
101
|
+
//#region src/components/Cawg/helper/trqp.ts
|
|
102
|
+
async function p() {
|
|
103
|
+
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.");
|
|
104
|
+
}
|
|
105
|
+
var m = p;
|
|
106
|
+
function h(e) {
|
|
107
|
+
m = e;
|
|
108
|
+
}
|
|
109
|
+
function g() {
|
|
110
|
+
return m;
|
|
111
|
+
}
|
|
112
|
+
function _(e, r, i, a = g()) {
|
|
113
|
+
let [o, s] = n("idle"), [c, l] = n(null), [u, d] = n(null);
|
|
114
|
+
return t(() => {
|
|
115
|
+
if (!e) {
|
|
116
|
+
s("idle"), l(null), d(null);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let t = !1;
|
|
120
|
+
return s("loading"), d(null), a({
|
|
121
|
+
entityId: e,
|
|
122
|
+
action: r,
|
|
123
|
+
resource: i
|
|
124
|
+
}).then((e) => {
|
|
125
|
+
t || (l(e), s("done"));
|
|
126
|
+
}, (e) => {
|
|
127
|
+
t || (l(null), d(e instanceof Error ? e : Error(String(e))), s("error"));
|
|
128
|
+
}), () => {
|
|
129
|
+
t = !0;
|
|
130
|
+
};
|
|
131
|
+
}, [
|
|
132
|
+
e,
|
|
133
|
+
r,
|
|
134
|
+
i,
|
|
135
|
+
a
|
|
136
|
+
]), {
|
|
137
|
+
status: o,
|
|
138
|
+
result: c,
|
|
139
|
+
error: u
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/components/Cawg/helper/TrustBadge.tsx
|
|
144
|
+
function v(e) {
|
|
145
|
+
try {
|
|
146
|
+
return new Date(e).toLocaleDateString(void 0, {
|
|
147
|
+
year: "numeric",
|
|
148
|
+
month: "long",
|
|
149
|
+
day: "numeric"
|
|
150
|
+
});
|
|
151
|
+
} catch {
|
|
152
|
+
return e;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
var y = "Identity Verified by Trust Registry", b = "Identity Unable to be Verified by Trust Registry";
|
|
156
|
+
function x({ entityId: e, action: t, resource: n, variant: r = "full", queryFn: o }) {
|
|
157
|
+
let { status: s, result: c, error: l } = _(e, t, n, o);
|
|
158
|
+
if (!e) return null;
|
|
159
|
+
if (s === "error") return /* @__PURE__ */ i("span", {
|
|
160
|
+
className: "cawg-trust-badge cawg-trust-unverified",
|
|
161
|
+
title: l?.message,
|
|
162
|
+
children: "Unable to reach trust registry"
|
|
163
|
+
});
|
|
164
|
+
if (s !== "done" || !c) return /* @__PURE__ */ i("span", {
|
|
165
|
+
className: "cawg-trust-badge cawg-trust-pending",
|
|
166
|
+
children: "Checking trust registry…"
|
|
167
|
+
});
|
|
168
|
+
let u = /* @__PURE__ */ i("span", {
|
|
169
|
+
className: c.authorized ? "cawg-trust-badge cawg-trust-verified" : "cawg-trust-badge cawg-trust-unverified",
|
|
170
|
+
title: c.authorized ? `Recognized by ${c.authority_id} · checked ${v(c.time_evaluated)}` : c.message,
|
|
171
|
+
children: c.authorized ? y : b
|
|
172
|
+
});
|
|
173
|
+
return r === "compact" ? u : /* @__PURE__ */ a("div", {
|
|
174
|
+
className: "cawg-trust-status",
|
|
175
|
+
children: [u, c.authorized ? /* @__PURE__ */ a("div", {
|
|
176
|
+
className: "cawg-trust-meta",
|
|
177
|
+
children: [
|
|
178
|
+
c.authority_id,
|
|
179
|
+
" · checked ",
|
|
180
|
+
v(c.time_evaluated)
|
|
181
|
+
]
|
|
182
|
+
}) : c.message && /* @__PURE__ */ i("div", {
|
|
183
|
+
className: "cawg-trust-message",
|
|
184
|
+
children: c.message
|
|
185
|
+
})]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
89
189
|
//#region src/components/Cawg/levels/L2/CAWGL2.tsx
|
|
90
|
-
var
|
|
190
|
+
var S = {
|
|
91
191
|
"cawg.creator": "Creator",
|
|
92
192
|
"cawg.contributor": "Contributor",
|
|
93
193
|
"cawg.editor": "Editor",
|
|
@@ -95,27 +195,27 @@ var c = {
|
|
|
95
195
|
"cawg.publisher": "Publisher",
|
|
96
196
|
"cawg.sponsor": "Sponsor",
|
|
97
197
|
"cawg.translator": "Translator"
|
|
98
|
-
},
|
|
198
|
+
}, C = {
|
|
99
199
|
"cawg.document_verification": "ID Verified",
|
|
100
200
|
"cawg.web_site": "Website",
|
|
101
201
|
"cawg.affiliation": "Affiliation",
|
|
102
202
|
"cawg.social_media": "Social Media",
|
|
103
203
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
104
|
-
},
|
|
204
|
+
}, w = {
|
|
105
205
|
"cawg.data_mining": "Data Mining",
|
|
106
206
|
"cawg.ai_inference": "AI Inference",
|
|
107
207
|
"cawg.ai_training": "AI Training",
|
|
108
208
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
109
|
-
},
|
|
209
|
+
}, T = {
|
|
110
210
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
111
211
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
112
212
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
113
|
-
},
|
|
213
|
+
}, E = {
|
|
114
214
|
allowed: "Allowed",
|
|
115
215
|
notAllowed: "Not Allowed",
|
|
116
216
|
constrained: "Constrained"
|
|
117
217
|
};
|
|
118
|
-
function
|
|
218
|
+
function D(e) {
|
|
119
219
|
try {
|
|
120
220
|
return new Date(e).toLocaleDateString(void 0, {
|
|
121
221
|
year: "numeric",
|
|
@@ -126,72 +226,83 @@ function p(e) {
|
|
|
126
226
|
return e;
|
|
127
227
|
}
|
|
128
228
|
}
|
|
129
|
-
function
|
|
229
|
+
function O(e) {
|
|
130
230
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string").join(", ") : typeof e == "string" ? e : "";
|
|
131
231
|
}
|
|
132
|
-
function
|
|
133
|
-
let
|
|
134
|
-
return /* @__PURE__ */
|
|
232
|
+
function k({ className: e, manifest: t, moreInfo: n }) {
|
|
233
|
+
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), d = t.assertions?.["cawg.identity"], f = d?.signer_payload?.role ?? [], p = d?.verifiedIdentities ?? [], m = d?.issuer, h = t.assertions?.["cawg.training-mining"]?.entries ?? {}, g = t.assertions?.["cawg.metadata"], _ = O(g?.["dc:creator"]), v = g?.["xmp:CreateDate"];
|
|
234
|
+
return /* @__PURE__ */ a("div", {
|
|
135
235
|
className: `cawg-card ${e ?? ""}`,
|
|
136
236
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ i(s, {}),
|
|
238
|
+
/* @__PURE__ */ a("div", {
|
|
139
239
|
className: "cawg-container",
|
|
140
|
-
children: [
|
|
141
|
-
src:
|
|
240
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
241
|
+
src: t.thumbnail,
|
|
142
242
|
alt: "Thumbnail",
|
|
143
243
|
className: "cawg-thumbnail"
|
|
144
|
-
}) : /* @__PURE__ */
|
|
244
|
+
}) : /* @__PURE__ */ i("div", {
|
|
145
245
|
className: "cawg-square",
|
|
146
|
-
children: /* @__PURE__ */
|
|
246
|
+
children: /* @__PURE__ */ i("span", {
|
|
147
247
|
className: "cawg-logo-text",
|
|
148
|
-
children:
|
|
248
|
+
children: c
|
|
149
249
|
})
|
|
150
|
-
}), /* @__PURE__ */
|
|
250
|
+
}), /* @__PURE__ */ a("div", {
|
|
151
251
|
style: {
|
|
152
252
|
display: "flex",
|
|
153
253
|
flexDirection: "column"
|
|
154
254
|
},
|
|
155
|
-
children: [/* @__PURE__ */
|
|
255
|
+
children: [/* @__PURE__ */ i("span", {
|
|
156
256
|
className: "cawg-media-title",
|
|
157
|
-
children:
|
|
158
|
-
}), /* @__PURE__ */
|
|
159
|
-
className: "cawg-
|
|
160
|
-
children:
|
|
257
|
+
children: o
|
|
258
|
+
}), /* @__PURE__ */ i("span", {
|
|
259
|
+
className: "cawg-creators-name",
|
|
260
|
+
children: l
|
|
161
261
|
})]
|
|
162
262
|
})]
|
|
163
263
|
}),
|
|
164
|
-
|
|
264
|
+
f.length > 0 && /* @__PURE__ */ i("div", {
|
|
165
265
|
className: "cawg-roles",
|
|
166
|
-
children:
|
|
266
|
+
children: f.map((e) => /* @__PURE__ */ i("span", {
|
|
167
267
|
className: "cawg-role-badge",
|
|
168
|
-
children:
|
|
268
|
+
children: S[e] ?? e
|
|
169
269
|
}, e))
|
|
170
270
|
}),
|
|
171
|
-
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
271
|
+
p.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
272
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
273
|
+
/* @__PURE__ */ a("div", {
|
|
174
274
|
className: "cawg-section-title",
|
|
175
|
-
|
|
275
|
+
style: {
|
|
276
|
+
display: "flex",
|
|
277
|
+
alignItems: "center",
|
|
278
|
+
justifyContent: "space-between",
|
|
279
|
+
gap: 8
|
|
280
|
+
},
|
|
281
|
+
children: [/* @__PURE__ */ i("span", { children: "Identity" }), /* @__PURE__ */ i(x, {
|
|
282
|
+
entityId: m,
|
|
283
|
+
action: "issue",
|
|
284
|
+
resource: "cawg.identity",
|
|
285
|
+
variant: "compact"
|
|
286
|
+
})]
|
|
176
287
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ i("div", {
|
|
178
289
|
className: "cawg-identity-list",
|
|
179
|
-
children:
|
|
180
|
-
let
|
|
181
|
-
return /* @__PURE__ */
|
|
290
|
+
children: p.map((e, t) => {
|
|
291
|
+
let n = e.type, r = e.name ?? e.username, o = e.provider;
|
|
292
|
+
return /* @__PURE__ */ i("div", {
|
|
182
293
|
className: "cawg-identity-item",
|
|
183
|
-
children: /* @__PURE__ */
|
|
294
|
+
children: /* @__PURE__ */ a("div", {
|
|
184
295
|
style: { flex: 1 },
|
|
185
296
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ i("div", {
|
|
187
298
|
className: "cawg-identity-type-label",
|
|
188
|
-
children:
|
|
299
|
+
children: C[n] ?? n
|
|
189
300
|
}),
|
|
190
|
-
|
|
301
|
+
r && /* @__PURE__ */ i("div", {
|
|
191
302
|
className: "cawg-identity-name",
|
|
192
|
-
children:
|
|
303
|
+
children: r
|
|
193
304
|
}),
|
|
194
|
-
o?.name && /* @__PURE__ */
|
|
305
|
+
o?.name && /* @__PURE__ */ i("div", {
|
|
195
306
|
className: "cawg-identity-provider",
|
|
196
307
|
children: o.name
|
|
197
308
|
})
|
|
@@ -201,57 +312,57 @@ function h({ className: e, manifest: i, moreInfo: o }) {
|
|
|
201
312
|
})
|
|
202
313
|
})
|
|
203
314
|
] }),
|
|
204
|
-
Object.keys(
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
315
|
+
Object.keys(h).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
316
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
317
|
+
/* @__PURE__ */ i("div", {
|
|
207
318
|
className: "cawg-section-title",
|
|
208
319
|
children: "Training & Data Mining"
|
|
209
320
|
}),
|
|
210
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ i("div", {
|
|
211
322
|
className: "cawg-training-list",
|
|
212
|
-
children: Object.entries(
|
|
323
|
+
children: Object.entries(h).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
213
324
|
className: "cawg-training-item",
|
|
214
|
-
children: [/* @__PURE__ */
|
|
325
|
+
children: [/* @__PURE__ */ i("span", {
|
|
215
326
|
className: "cawg-training-label",
|
|
216
|
-
children:
|
|
217
|
-
}), /* @__PURE__ */
|
|
218
|
-
className:
|
|
219
|
-
children:
|
|
327
|
+
children: w[e] ?? e
|
|
328
|
+
}), /* @__PURE__ */ i("span", {
|
|
329
|
+
className: T[t.use] ?? "cawg-use-badge",
|
|
330
|
+
children: E[t.use] ?? t.use
|
|
220
331
|
})]
|
|
221
332
|
}, e))
|
|
222
333
|
})
|
|
223
334
|
] }),
|
|
224
|
-
(
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
335
|
+
(_ || v) && /* @__PURE__ */ a(r, { children: [
|
|
336
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
337
|
+
/* @__PURE__ */ i("div", {
|
|
227
338
|
className: "cawg-section-title",
|
|
228
339
|
children: "Creator"
|
|
229
340
|
}),
|
|
230
|
-
|
|
341
|
+
_ && /* @__PURE__ */ a("div", {
|
|
231
342
|
className: "cawg-key-value",
|
|
232
|
-
children: [/* @__PURE__ */
|
|
343
|
+
children: [/* @__PURE__ */ i("div", {
|
|
233
344
|
className: "cawg-key-value-label",
|
|
234
345
|
children: "Name"
|
|
235
|
-
}), /* @__PURE__ */
|
|
346
|
+
}), /* @__PURE__ */ i("div", {
|
|
236
347
|
className: "cawg-key-value-value",
|
|
237
|
-
children:
|
|
348
|
+
children: _
|
|
238
349
|
})]
|
|
239
350
|
}),
|
|
240
|
-
|
|
351
|
+
v && /* @__PURE__ */ a("div", {
|
|
241
352
|
className: "cawg-key-value",
|
|
242
|
-
children: [/* @__PURE__ */
|
|
353
|
+
children: [/* @__PURE__ */ i("div", {
|
|
243
354
|
className: "cawg-key-value-label",
|
|
244
355
|
children: "Date Created"
|
|
245
|
-
}), /* @__PURE__ */
|
|
356
|
+
}), /* @__PURE__ */ i("div", {
|
|
246
357
|
className: "cawg-key-value-value",
|
|
247
|
-
children:
|
|
358
|
+
children: D(v)
|
|
248
359
|
})]
|
|
249
360
|
})
|
|
250
361
|
] }),
|
|
251
|
-
|
|
362
|
+
n && /* @__PURE__ */ i("div", {
|
|
252
363
|
style: { marginTop: 16 },
|
|
253
|
-
children: /* @__PURE__ */
|
|
254
|
-
onClick:
|
|
364
|
+
children: /* @__PURE__ */ i("button", {
|
|
365
|
+
onClick: n,
|
|
255
366
|
className: "cawg-button",
|
|
256
367
|
children: "More Info"
|
|
257
368
|
})
|
|
@@ -261,7 +372,7 @@ function h({ className: e, manifest: i, moreInfo: o }) {
|
|
|
261
372
|
}
|
|
262
373
|
//#endregion
|
|
263
374
|
//#region src/components/Cawg/levels/L3/CAWGL3.tsx
|
|
264
|
-
var
|
|
375
|
+
var A = {
|
|
265
376
|
"cawg.creator": "Creator",
|
|
266
377
|
"cawg.contributor": "Contributor",
|
|
267
378
|
"cawg.editor": "Editor",
|
|
@@ -269,31 +380,31 @@ var g = {
|
|
|
269
380
|
"cawg.publisher": "Publisher",
|
|
270
381
|
"cawg.sponsor": "Sponsor",
|
|
271
382
|
"cawg.translator": "Translator"
|
|
272
|
-
},
|
|
383
|
+
}, j = {
|
|
273
384
|
"cawg.document_verification": "ID Verified",
|
|
274
385
|
"cawg.web_site": "Website",
|
|
275
386
|
"cawg.affiliation": "Affiliation",
|
|
276
387
|
"cawg.social_media": "Social Media",
|
|
277
388
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
278
|
-
},
|
|
389
|
+
}, M = {
|
|
279
390
|
"cawg.data_mining": "Data Mining",
|
|
280
391
|
"cawg.ai_inference": "AI Inference",
|
|
281
392
|
"cawg.ai_training": "AI Training",
|
|
282
393
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
283
|
-
},
|
|
394
|
+
}, N = {
|
|
284
395
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
285
396
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
286
397
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
287
|
-
},
|
|
398
|
+
}, P = {
|
|
288
399
|
allowed: "Allowed",
|
|
289
400
|
notAllowed: "Not Allowed",
|
|
290
401
|
constrained: "Constrained"
|
|
291
|
-
},
|
|
402
|
+
}, F = {
|
|
292
403
|
"cawg.identity_claims_aggregation": "Identity Claims Aggregation",
|
|
293
404
|
"cawg.x509.cose": "X.509 Certificate",
|
|
294
405
|
"cawg.verifiable_credential_binding": "Verifiable Credential"
|
|
295
406
|
};
|
|
296
|
-
function
|
|
407
|
+
function I(e) {
|
|
297
408
|
try {
|
|
298
409
|
return new Date(e).toLocaleDateString(void 0, {
|
|
299
410
|
year: "numeric",
|
|
@@ -304,106 +415,118 @@ function S(e) {
|
|
|
304
415
|
return e;
|
|
305
416
|
}
|
|
306
417
|
}
|
|
307
|
-
function
|
|
308
|
-
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) =>
|
|
418
|
+
function L(e) {
|
|
419
|
+
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => L(e)).filter(Boolean).join(", ") : typeof e == "object" ? Object.entries(e).filter(([e]) => !e.startsWith("@")).map(([e, t]) => `${e}: ${L(t)}`).join("; ") : String(e);
|
|
309
420
|
}
|
|
310
|
-
function
|
|
311
|
-
let
|
|
312
|
-
return /* @__PURE__ */
|
|
421
|
+
function R({ className: e, manifest: t, moreInfo: n }) {
|
|
422
|
+
let o = t.title, c = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), d = c.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", f = t.assertions?.["cawg.identity"], p = f?.signer_payload?.role ?? [], m = f?.verifiedIdentities ?? [], h = f?.signer_payload?.sig_type, g = f?.issuer, _ = t.assertions?.["cawg.training-mining"]?.entries ?? {}, v = t.assertions?.["cawg.metadata"], y = v ? Object.entries(v).filter(([e]) => !e.startsWith("@")) : [];
|
|
423
|
+
return /* @__PURE__ */ a("div", {
|
|
313
424
|
className: `cawg-card ${e ?? ""}`,
|
|
314
425
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ i(s, {}),
|
|
427
|
+
/* @__PURE__ */ a("div", {
|
|
317
428
|
className: "cawg-container",
|
|
318
|
-
children: [
|
|
319
|
-
src:
|
|
429
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
430
|
+
src: t.thumbnail,
|
|
320
431
|
alt: "Thumbnail",
|
|
321
432
|
className: "cawg-thumbnail"
|
|
322
|
-
}) : /* @__PURE__ */
|
|
433
|
+
}) : /* @__PURE__ */ i("div", {
|
|
323
434
|
className: "cawg-square",
|
|
324
|
-
children: /* @__PURE__ */
|
|
435
|
+
children: /* @__PURE__ */ i("span", {
|
|
325
436
|
className: "cawg-logo-text",
|
|
326
|
-
children:
|
|
437
|
+
children: d
|
|
327
438
|
})
|
|
328
|
-
}), /* @__PURE__ */
|
|
439
|
+
}), /* @__PURE__ */ a("div", {
|
|
329
440
|
style: {
|
|
330
441
|
display: "flex",
|
|
331
442
|
flexDirection: "column"
|
|
332
443
|
},
|
|
333
|
-
children: [/* @__PURE__ */
|
|
444
|
+
children: [/* @__PURE__ */ i("span", {
|
|
334
445
|
className: "cawg-media-title",
|
|
335
|
-
children:
|
|
336
|
-
}), /* @__PURE__ */
|
|
337
|
-
className: "cawg-
|
|
338
|
-
children:
|
|
446
|
+
children: o
|
|
447
|
+
}), /* @__PURE__ */ i("span", {
|
|
448
|
+
className: "cawg-creators-name",
|
|
449
|
+
children: l
|
|
339
450
|
})]
|
|
340
451
|
})]
|
|
341
452
|
}),
|
|
342
|
-
|
|
453
|
+
p.length > 0 && /* @__PURE__ */ i("div", {
|
|
343
454
|
className: "cawg-roles",
|
|
344
|
-
children:
|
|
455
|
+
children: p.map((e) => /* @__PURE__ */ i("span", {
|
|
345
456
|
className: "cawg-role-badge",
|
|
346
|
-
children:
|
|
457
|
+
children: A[e] ?? e
|
|
347
458
|
}, e))
|
|
348
459
|
}),
|
|
349
|
-
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
460
|
+
f && /* @__PURE__ */ a(r, { children: [
|
|
461
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
462
|
+
/* @__PURE__ */ i("div", {
|
|
352
463
|
className: "cawg-section-title",
|
|
353
464
|
children: "Identity Assertion"
|
|
354
465
|
}),
|
|
355
|
-
|
|
466
|
+
h && /* @__PURE__ */ a("div", {
|
|
356
467
|
className: "cawg-key-value",
|
|
357
|
-
children: [/* @__PURE__ */
|
|
468
|
+
children: [/* @__PURE__ */ i("div", {
|
|
358
469
|
className: "cawg-key-value-label",
|
|
359
470
|
children: "Credential Type"
|
|
360
|
-
}), /* @__PURE__ */
|
|
471
|
+
}), /* @__PURE__ */ i("div", {
|
|
361
472
|
className: "cawg-key-value-value",
|
|
362
|
-
children:
|
|
473
|
+
children: F[h] ?? h
|
|
363
474
|
})]
|
|
364
475
|
}),
|
|
365
|
-
|
|
476
|
+
g && /* @__PURE__ */ a("div", {
|
|
366
477
|
className: "cawg-key-value",
|
|
367
|
-
children: [/* @__PURE__ */
|
|
478
|
+
children: [/* @__PURE__ */ i("div", {
|
|
368
479
|
className: "cawg-key-value-label",
|
|
369
480
|
children: "Issuer"
|
|
370
|
-
}), /* @__PURE__ */
|
|
481
|
+
}), /* @__PURE__ */ i("div", {
|
|
371
482
|
className: "cawg-key-value-value",
|
|
372
|
-
children:
|
|
483
|
+
children: g
|
|
484
|
+
})]
|
|
485
|
+
}),
|
|
486
|
+
/* @__PURE__ */ a("div", {
|
|
487
|
+
className: "cawg-key-value",
|
|
488
|
+
children: [/* @__PURE__ */ i("div", {
|
|
489
|
+
className: "cawg-key-value-label",
|
|
490
|
+
children: "Trust Registry"
|
|
491
|
+
}), /* @__PURE__ */ i(x, {
|
|
492
|
+
entityId: g,
|
|
493
|
+
action: "issue",
|
|
494
|
+
resource: "cawg.identity",
|
|
495
|
+
variant: "full"
|
|
373
496
|
})]
|
|
374
497
|
}),
|
|
375
|
-
|
|
498
|
+
m.length > 0 && /* @__PURE__ */ i("div", {
|
|
376
499
|
className: "cawg-identity-list",
|
|
377
500
|
style: { marginTop: 12 },
|
|
378
|
-
children:
|
|
379
|
-
let
|
|
380
|
-
return /* @__PURE__ */
|
|
501
|
+
children: m.map((e, t) => {
|
|
502
|
+
let n = e.type, r = e.name ?? e.username ?? e.address, o = e.provider, s = e.uri, c = e.verifiedAt;
|
|
503
|
+
return /* @__PURE__ */ i("div", {
|
|
381
504
|
className: "cawg-identity-item",
|
|
382
|
-
children: /* @__PURE__ */
|
|
505
|
+
children: /* @__PURE__ */ a("div", {
|
|
383
506
|
style: { flex: 1 },
|
|
384
507
|
children: [
|
|
385
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ i("div", {
|
|
386
509
|
className: "cawg-identity-type-label",
|
|
387
|
-
children:
|
|
510
|
+
children: j[n] ?? n
|
|
388
511
|
}),
|
|
389
|
-
|
|
512
|
+
r && /* @__PURE__ */ i("div", {
|
|
390
513
|
className: "cawg-identity-name",
|
|
391
|
-
children:
|
|
514
|
+
children: r
|
|
392
515
|
}),
|
|
393
|
-
o?.name && /* @__PURE__ */
|
|
516
|
+
o?.name && /* @__PURE__ */ a("div", {
|
|
394
517
|
className: "cawg-identity-provider",
|
|
395
518
|
children: ["via ", o.name]
|
|
396
519
|
}),
|
|
397
|
-
s && /* @__PURE__ */
|
|
520
|
+
s && /* @__PURE__ */ i("a", {
|
|
398
521
|
href: s,
|
|
399
522
|
target: "_blank",
|
|
400
523
|
rel: "noopener noreferrer",
|
|
401
524
|
className: "cawg-identity-link",
|
|
402
525
|
children: s
|
|
403
526
|
}),
|
|
404
|
-
c && /* @__PURE__ */
|
|
527
|
+
c && /* @__PURE__ */ a("div", {
|
|
405
528
|
className: "cawg-identity-meta",
|
|
406
|
-
children: ["Verified ",
|
|
529
|
+
children: ["Verified ", I(c)]
|
|
407
530
|
})
|
|
408
531
|
]
|
|
409
532
|
})
|
|
@@ -411,64 +534,64 @@ function w({ className: e, manifest: i, moreInfo: o }) {
|
|
|
411
534
|
})
|
|
412
535
|
})
|
|
413
536
|
] }),
|
|
414
|
-
Object.keys(
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
537
|
+
Object.keys(_).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
538
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
539
|
+
/* @__PURE__ */ i("div", {
|
|
417
540
|
className: "cawg-section-title",
|
|
418
541
|
children: "Training & Data Mining"
|
|
419
542
|
}),
|
|
420
|
-
/* @__PURE__ */
|
|
543
|
+
/* @__PURE__ */ i("div", {
|
|
421
544
|
className: "cawg-training-list",
|
|
422
|
-
children: Object.entries(
|
|
545
|
+
children: Object.entries(_).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
423
546
|
className: "cawg-training-item",
|
|
424
547
|
style: {
|
|
425
548
|
flexDirection: "column",
|
|
426
549
|
alignItems: "flex-start"
|
|
427
550
|
},
|
|
428
|
-
children: [/* @__PURE__ */
|
|
551
|
+
children: [/* @__PURE__ */ a("div", {
|
|
429
552
|
style: {
|
|
430
553
|
display: "flex",
|
|
431
554
|
justifyContent: "space-between",
|
|
432
555
|
width: "100%"
|
|
433
556
|
},
|
|
434
|
-
children: [/* @__PURE__ */
|
|
557
|
+
children: [/* @__PURE__ */ i("span", {
|
|
435
558
|
className: "cawg-training-label",
|
|
436
|
-
children:
|
|
437
|
-
}), /* @__PURE__ */
|
|
438
|
-
className:
|
|
439
|
-
children:
|
|
559
|
+
children: M[e] ?? e
|
|
560
|
+
}), /* @__PURE__ */ i("span", {
|
|
561
|
+
className: N[t.use] ?? "cawg-use-badge",
|
|
562
|
+
children: P[t.use] ?? t.use
|
|
440
563
|
})]
|
|
441
|
-
}), t.constraint_info && /* @__PURE__ */
|
|
564
|
+
}), t.constraint_info && /* @__PURE__ */ i("div", {
|
|
442
565
|
className: "cawg-constraint-info",
|
|
443
566
|
children: t.constraint_info
|
|
444
567
|
})]
|
|
445
568
|
}, e))
|
|
446
569
|
})
|
|
447
570
|
] }),
|
|
448
|
-
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
/* @__PURE__ */
|
|
571
|
+
y.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
572
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
573
|
+
/* @__PURE__ */ i("div", {
|
|
451
574
|
className: "cawg-section-title",
|
|
452
575
|
children: "Metadata"
|
|
453
576
|
}),
|
|
454
|
-
|
|
455
|
-
let
|
|
456
|
-
return
|
|
577
|
+
y.map(([e, t]) => {
|
|
578
|
+
let n = L(t);
|
|
579
|
+
return n ? /* @__PURE__ */ a("div", {
|
|
457
580
|
className: "cawg-key-value",
|
|
458
|
-
children: [/* @__PURE__ */
|
|
581
|
+
children: [/* @__PURE__ */ i("div", {
|
|
459
582
|
className: "cawg-key-value-label",
|
|
460
583
|
children: e
|
|
461
|
-
}), /* @__PURE__ */
|
|
584
|
+
}), /* @__PURE__ */ i("div", {
|
|
462
585
|
className: "cawg-key-value-value",
|
|
463
|
-
children:
|
|
586
|
+
children: n
|
|
464
587
|
})]
|
|
465
588
|
}, e) : null;
|
|
466
589
|
})
|
|
467
590
|
] }),
|
|
468
|
-
|
|
591
|
+
n && /* @__PURE__ */ i("div", {
|
|
469
592
|
style: { marginTop: 16 },
|
|
470
|
-
children: /* @__PURE__ */
|
|
471
|
-
onClick:
|
|
593
|
+
children: /* @__PURE__ */ i("button", {
|
|
594
|
+
onClick: n,
|
|
472
595
|
className: "cawg-button",
|
|
473
596
|
children: "Small View"
|
|
474
597
|
})
|
|
@@ -478,7 +601,7 @@ function w({ className: e, manifest: i, moreInfo: o }) {
|
|
|
478
601
|
}
|
|
479
602
|
//#endregion
|
|
480
603
|
//#region src/components/Cawg/Cawg.tsx
|
|
481
|
-
function
|
|
604
|
+
function z(e) {
|
|
482
605
|
return {
|
|
483
606
|
id: e.id ?? "",
|
|
484
607
|
title: e.title ?? "",
|
|
@@ -500,36 +623,36 @@ function T(e) {
|
|
|
500
623
|
ingredients: e.ingredients ?? []
|
|
501
624
|
};
|
|
502
625
|
}
|
|
503
|
-
var
|
|
504
|
-
let o = t.manifestStore?.activeManifest,
|
|
505
|
-
if (!
|
|
506
|
-
let [
|
|
507
|
-
switch (
|
|
508
|
-
case 1: return /* @__PURE__ */
|
|
626
|
+
var B = ({ manifest: t, entry: n, level: r, className: a }) => {
|
|
627
|
+
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] : z(n);
|
|
628
|
+
if (!s || !(s.assertions?.["cawg.identity"] != null || s.assertions?.["cawg.training-mining"] != null || s.assertions?.["cawg.metadata"] != null)) return null;
|
|
629
|
+
let [c, l] = e.useState(r || 1);
|
|
630
|
+
switch (c) {
|
|
631
|
+
case 1: return /* @__PURE__ */ i(f, {
|
|
509
632
|
className: a,
|
|
510
|
-
manifest:
|
|
633
|
+
manifest: s,
|
|
511
634
|
moreInfo: () => {
|
|
512
|
-
|
|
635
|
+
l(2);
|
|
513
636
|
}
|
|
514
637
|
});
|
|
515
|
-
case 2: return /* @__PURE__ */
|
|
638
|
+
case 2: return /* @__PURE__ */ i(k, {
|
|
516
639
|
className: a,
|
|
517
|
-
manifest:
|
|
640
|
+
manifest: s,
|
|
518
641
|
moreInfo: () => {
|
|
519
|
-
|
|
642
|
+
l(3);
|
|
520
643
|
}
|
|
521
644
|
});
|
|
522
|
-
case 3: return /* @__PURE__ */
|
|
645
|
+
case 3: return /* @__PURE__ */ i(R, {
|
|
523
646
|
className: a,
|
|
524
|
-
manifest:
|
|
647
|
+
manifest: s,
|
|
525
648
|
moreInfo: () => {
|
|
526
|
-
|
|
649
|
+
l(1);
|
|
527
650
|
}
|
|
528
651
|
});
|
|
529
652
|
}
|
|
530
|
-
return /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ i("div", { children: "Level Of Detail Not Selected" });
|
|
531
654
|
};
|
|
532
|
-
|
|
655
|
+
B.knownAssertions = [
|
|
533
656
|
"cawg.identity",
|
|
534
657
|
"cawg.training-mining",
|
|
535
658
|
"cawg.metadata",
|
|
@@ -547,4 +670,4 @@ E.knownAssertions = [
|
|
|
547
670
|
"cawg.crypto_wallet"
|
|
548
671
|
];
|
|
549
672
|
//#endregion
|
|
550
|
-
export {
|
|
673
|
+
export { B as CAWGManifest, x as TrustBadge, g as getTrustRegistryQueryFn, p as queryTrustRegistry, h as setTrustRegistryQueryFn, _ 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={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function g({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`])?.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: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})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:h[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 _(){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 v=_;function y(e){v=e}function b(){return v}function x(e,n,r,i=b()){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 S(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}var C=`Identity Verified by Trust Registry`,w=`Identity Unable to be Verified by Trust Registry`;function T({entityId:e,action:t,resource:r,variant:i=`full`,queryFn:a}){let{status:o,result:s,error:c}=x(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 ${S(s.time_evaluated)}`:s.message,children:s.authorized?C:w});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 `,S(s.time_evaluated)]}):s.message&&(0,n.jsx)(`div`,{className:`cawg-trust-message`,children:s.message})]})}var E={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},D={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},O={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},k={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},A={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function j(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function M(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):typeof e==`string`?e:``}function N({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=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=s?.issuer,f=t.assertions?.[`cawg.training-mining`]?.entries??{},p=t.assertions?.[`cawg.metadata`],h=M(p?.[`dc:creator`]),g=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:E[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)(T,{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:D[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:O[e]??e}),(0,n.jsx)(`span`,{className:k[t.use]??`cawg-use-badge`,children:A[t.use]??t.use})]},e))})]}),(h||g)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Creator`}),h&&(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:h})]}),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:j(g)})]})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var P={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},F={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},I={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},L={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},R={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},z={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function B(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function V(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>V(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${V(t)}`).join(`; `):String(e)}function H({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=c?.signer_payload?.role??[],u=c?.verifiedIdentities??[],f=c?.signer_payload?.sig_type,p=c?.issuer,h=t.assertions?.[`cawg.training-mining`]?.entries??{},g=t.assertions?.[`cawg.metadata`],_=g?Object.entries(g).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})]})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:l.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:P[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`}),f&&(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:z[f]??f})]}),p&&(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:p})]}),(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Trust Registry`}),(0,n.jsx)(T,{entityId:p,action:`issue`,resource:`cawg.identity`,variant:`full`})]}),u.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:u.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:F[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 `,B(s)]})]})},t)})})]}),Object.keys(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:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(h).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:I[e]??e}),(0,n.jsx)(`span`,{className:L[t.use]??`cawg-use-badge`,children:R[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),_.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`}),_.map(([e,t])=>{let r=V(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 U(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 W=({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]:U(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)(g,{className:a,manifest:s,moreInfo:()=>{l(2)}});case 2:return(0,n.jsx)(N,{className:a,manifest:s,moreInfo:()=>{l(3)}});case 3:return(0,n.jsx)(H,{className:a,manifest:s,moreInfo:()=>{l(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};W.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=W,e.TrustBadge=T,e.getTrustRegistryQueryFn=b,e.queryTrustRegistry=_,e.setTrustRegistryQueryFn=y,e.useTrustRegistryQuery=x});
|
|
@@ -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,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.12",
|
|
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",
|